# ESXiArgs 勒索軟體攻擊應對資訊 ###### tags: `vmware` `vmsa` `security` `esxiarg` 最近,發現大量**鎖定 VMware ESXi 虛擬化平台進行攻擊**的事件,利用 **CVE-2021-21974 漏洞**發動勒索軟體攻擊。這個漏洞允許**攻擊者遠端存取企業的虛擬環境加密數據**,已傳出有伺服器受害。 [toc] # 資訊 ## 資安新聞 法國電腦緊急應變小組(CERT-FR)於 2月3日 提出警告,有人積極針對虛擬化平臺 VMware ESXi 下手,利用 **CVE-2021-21974**(CVSS風險評分為8.8分)入侵,目的是部署勒索軟體,該組織表示,駭客**主要的攻擊目標是 6.7 版以前的ESXi伺服器**,但 7.0 版也有可能曝險。 當地雲端服務業者 OVHcloud 也觀察到相關攻擊行動,並指出**目標是包含 7.0 U3i 版之前的 ESXi 伺服器**,利用 **OpenSLP 連接埠(427埠)** 入侵,攻擊者疑似與勒索軟體 Nevada 有關。 但資安新聞網站 Bleeping Computer 有不同的看法 - 根據攻擊行動的勒索訊息進行分析,很有可能是**新的勒索軟體 ESXiArgs**,至少有120 臺 ESXi 伺服器受害。 ## ESXiArgs 勒索軟體 ESXiArgs 勒索軟體主要對 ESXi 主機上的某些**組態檔案**進行加密,進而使得虛擬機器(VM)無法正常運作。 :::danger **勒索軟體會加密與虛擬機器關聯的組態檔案,但不會加密 flat 檔案(-flat.vmdk)**。 ::: 在某些情況下,受害者有可能會透過未加密的 flat 檔案重建加密的組態檔案。惡意軟體加密檔案的副檔名完整列表是: <font color=red>**vmdk, vmx, vmxf, vmsd, vmsn, vswp, vmss, nvram, vmem**</font> # VMware 原廠回應 ## vSRC(VMware Security Responese Center) VMware Security Response Center (vSRC) 已於 2月6日 對於 ESXiArgs 惡意攻擊進行相關回應,並就客戶應採取的保護行動給予指導。 VMware 尚未取得明確證據顯示該次攻擊的勒索軟體所使用的漏洞,但就目前報告顯示,主要已知**特定目標為一般支援終止(End of General Support, EOGS)或過時已久的 ESXi 產品**。 [[**原文連結**]](https://blogs.vmware.com/security/2023/02/83330.html) ## VMSA(VMware Security Advisories) :::success 為了取得有關 VMware 產品最新的安全公告 [[**連結**]](https://www.vmware.com/security/advisories.html),記得關注 [[**VMSA RSS(xml)**]](https://www.vmware.com/security/advisories.xml) 或是訂閱 VMSA 通知。 ::: 其中所提到所使用的已知漏洞為 **CVE-2021-21974**,該漏洞先前已在 **VMware 安全公告(VMware Security Advisories, VMSA)** 提出披露和解決方案 **VMSA-2021-0002** [[**連結**]](https://www.vmware.com/security/advisories/VMSA-2021-0002.html) ![](https://i.imgur.com/nrTnYEu.png) :::warning **ESXi OpenSLP heap-overflow vulnerability (CVE-2021-21974)** **Description** OpenSLP as used in ESXi has a heap-overflow vulnerability. VMware has evaluated the severity of this issue to be in the Important severity range with a maximum **CVSSv3 base score of 8.8**. **Known Attack Vectors** A malicious actor residing within the same network segment as ESXi who has access to port 427 may be able to trigger the heap-overflow issue in OpenSLP service resulting in remote code execution. **Resolution** To remediate CVE-2021-21974 apply the updates listed in the 'Fixed Version' column of the 'Response Matrix' below to affected deployments. Workarounds **Workarounds** for CVE-2021-21974 have been listed in the 'Workarounds' column of the 'Response Matrix' below. **Additional Documentation** None. **Response Matrix** | Product | Version | Running On | Severity | Fixed Version | Workarounds | | --- | --- | --- | --- | --- | --- | | ESXi | 7.0 | Any | <font color=orange>**Important**</font> | ESXi70U1c-17325551 | [KB76372](#在-ESXi-停用-OpenSLP-服務) | | ESXi | 6.7 | Any | <font color=orange>**Important**</font> | ESXi670-202102401-SG | [KB76372](#在-ESXi-停用-OpenSLP-服務) | | ESXi | 6.5 | Any | <font color=orange>**Important**</font> | ESXi650-202102101-SG | [KB76372](#在-ESXi-停用-OpenSLP-服務) | ::: 另一個提到的 **CVE-2020-3992**,VMSA 也在 **VMSA-2020-0023.3** 提供披露及解決方案。 ![](https://i.imgur.com/3AF0UUg.png) 請各位自行點擊 [[**連結**]](https://www.vmware.com/security/advisories/VMSA-2020-0023.html) 查閱相關資訊。其中對應到的也是 **OpenSLP** 問題,應對方案請參考[[**下節說明**]](#應對方針)。 ## ESXiArgs: Q&A 相關詳細資訊,請參考[[**問答集**]](https://core.vmware.com/esxiargs-questions-answers)。 # 應對方針 ## VMware ### 版本升級 建議客戶根據 [VMware ESXi 版本資訊](https://kb.vmware.com/s/article/2143832) 升級至最新可用版本,以解決目前已知漏洞。 ### 在 ESXi 停用 OpenSLP 服務 請根據 **知識庫#76372: How to Disable/Enable the SLP Service on VMware ESXi** [[連結]](https://kb.vmware.com/s/article/76372) 提供資訊,停用指定服務。 :::info - **ESXi 7.0 U2c** 和 **ESXi 8.0 GA** 發行版本,已經**預設停用該服務**。 - VMware vSphere 配置指南 [[**部落格**]](https://blogs.vmware.com/vsphere/2021/02/evolving-the-vmware-vsphere-security-configuration-guides.html), [[**下載**]](https://core.vmware.com/security-configuration-guide) ::: :::info **使用 GOVC** 可以透過 **`GOVC`** 輕鬆檢測 ESXi 主機的 **`slpd` 服務**。 ```bash $ govc host.service.ls -host $host Key Policy Status Label DCUI on Running Direct Console UI TSM on Running ESXi Shell TSM-SSH on Running SSH attestd off Stopped attestd dpd off Stopped dpd kmxd off Stopped kmxd lbtd on Running Load-Based Teaming Daemon lwsmd off Stopped Active Directory Service ntpd on Running NTP Daemon pcscd off Stopped PC/SC Smart Card Daemon ptpd off Stopped PTP Daemon sfcbd-watchdog on Stopped CIM Server slpd off Stopped slpd snmpd on Stopped SNMP Server vltd off Stopped vltd vmsyslogd on Running Syslog Server vmware-fdm off Stopped vSphere High Availability Agent vpxa on Running VMware vCenter Agent xorg on Stopped X.Org Server ``` 若要檢視整個叢集的 ESXi 主機,可將主機資訊列入陣列中使用。 ```bash $SHELL='zsh' $ for ((i=1;i<${#host[@]};i++)); do echo "[${host[$i]}]" govc host.service.ls -host ${host[$i]} | grep slpd done [esxi01.meta.lab] slpd off Stopped slpd [esxi02.meta.lab] slpd on Running slpd ``` 發現其中一台 ESXi 主機有啟用 **slpd** 服務,同樣使用 **govc** 可以快速關閉相關服務。 ```bash $ govc host.service -host ${host2} stop slpd $ govc host.service -host ${host2} disable slp $ govc host.service.ls -host ${host2} | grep slpd slpd off Stopped slpd ``` ::: ### 其他資源 #### 勒索軟體資源中心 VMware 提供一般勒索軟體相關資訊 [[**連結**]](https://core.vmware.com/ransomware) #### 特定惡意軟體防禦攻略 近年來針對 vSphere 惡意軟體威脅日益增加,VMware 對於 vSphere 避免惡意軟體侵害,提供進一步有關問題的技術及配置資訊,請參考 [[**Protecting vSphere From Specialized Malware**]](https://core.vmware.com/vsphere-esxi-mandiant-malware-persistence)。 ## CISA(Cybersecurity & Infrastructure Security Agency) 美國網路安全暨基礎設施安全局(CISA)和 FBI ,針對受 ESXiArgs 勒索軟體攻擊的組織,發布解決指南 [[**連結**]](https://www.cisa.gov/uscert/ncas/alerts/aa23-039a), [[**PDF下載**]](https://www.cisa.gov/uscert/sites/default/files/documents/aa23-039a-esxiargs-ransomware-virtual-machine-recovery-guidance.pdf)。 復原腳本會藉由重新建立 VMware ESXi 伺服器上遭到加密的組態檔案,以恢復虛擬機器存取,目前受攻擊組織已可在 GitHub 頁面下載該腳本 [[**GitHub:cisagov /ESXiArgs-Recover**]](https://github.com/cisagov/ESXiArgs-Recover)。 腳本執行教程 (By Enes Sonmez and Ahmet Aykac) [[**連結**]](https://enes.dev/)。 :::warning - 使用該腳本請務必詳細閱讀執行步驟及相關限制。 - 在部署之前仔細檢查腳本是否適用於組織環境。 - 復原腳本不會刪除加密的組態檔案,而是建立新的組態檔案,使管理者能夠重新存取虛擬機器。 ::: 以下列出大致步驟並做些許變動,實際步驟請參閱上述連結說明。 ### 執行流程 1. 先將受影響的 ESXi 主機移至**隔離修復區**,確保不會擴散感染。 2. 使用工作筆電下載 CISA 的復原腳本檔,儲存至工作目錄 **`lab`** 下的 **`recover.sh`**。 3. 編輯腳本檔權限。 4. 使用隔離區的網路,上傳復原腳本 **`recvoer.sh`** 至受影響的 ESXi 主機。 上述流程寫個簡單的腳本檔完成。 ```bash= #!/bin/bash recoverFile='recover.sh' workingPath='lab' cisaUrl='https://raw.githubusercontent.com/cisagov/ESXiArgs-Recover/main/recover.sh' if [ ! -d ${workingPath} ]; then mkdir -p ${workingPath} fi if [ ! -f ${workingPath}/${recoverFile} ]; then wget -O ${workingPath}/${recoverFile} ${cisaUrl} chmod +x ${workingPath}/${recoverFile} fi host=$1 scp ${workingPath}/${recoverFile} root@${host}:/tmp ``` **程式執行結果**: ```bash $ ./downloadRecover.sh ${host2} --2023-02-14 11:23:47-- https://raw.githubusercontent.com/cisagov/ESXiArgs-Recover/main/recover.sh 正在查找主機 raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.109.133, 185.199.110.133, 185.199.108.133, ... 正在連接 raw.githubusercontent.com (raw.githubusercontent.com)|185.199.109.133|:443... 連上了。 已送出 HTTP 要求,正在等候回應... 200 OK 長度: 1719 (1.7K) [text/plain] 儲存到:「lab/recover.sh」 lab/recover.sh 100%[==================================>] 1.68K --.-KB/s 於 0s 2023-02-14 11:23:48 (14.9 MB/s) - 已儲存 「lab/recover.sh」 [1719/1719] (root@esxi02.meta.lab) Password: recover.sh 100% 1719 1.5MB/s 00:00 ``` 使用 SSH 方式查詢檔案是否已完成上傳。 ```bash $ ssh root@${host2} 'ls /tmp' (root@esxi02.meta.lab) Password: recover.sh ``` 5. 切換至虛擬機器存放的目錄,並檢視其目錄中的檔案。 :::info - 以下使用 **govc** 命令完成,若不熟悉按照文件步驟達成。 - 選擇我在 LAB 區的其中一台虛擬機器作為操作範例。 ::: ```bash $ govc find / -type m -name "Richard-*" /Datacenter/vm/Richard/Secure/Richard-pulsesecure-ISA-V /Datacenter/vm/Richard/Storage/Richard-dellemc-UnityVSA01 /Datacenter/vm/Richard/Backup/Richard-dellemc-PPDM01 /Datacenter/vm/Richard/Storage/Richard-dellemc-DDVE01 /Datacenter/vm/Richard/WorkVM/Richard-WORKVM-photon01 $vm='Richard-WORKVM-photon01' $ govc vm.info -json ${vm} | grep -i vmpathname | uniq "VmPathName": "[SC2080_Lab01] Richard-WORKVM-photon01/Richard-WORKVM-photon01.vmx" ``` 從上面結果顯示這個虛擬機器資料放置於資料存放區 **`SC2080_Lab01`**,使用以下命令可檢視該目錄 **`Richard-WORKVM-photon01`(一般都是虛擬機器名稱)** 下檔案。根據說明關注其中 **[虛擬機器名稱].vmdk** 的檔案。 ```bash $ govc datastore.ls -ds SC2080_Lab01 ${vm} Richard-WORKVM-photon01.vmdk Richard-WORKVM-photon01-000002.vmdk Richard-WORKVM-photon01-000002-sesparse.vmdk Richard-WORKVM-photon01-Snapshot1.vmsn Richard-WORKVM-photon01.vmx Richard-WORKVM-photon01.nvram Richard-WORKVM-photon01-flat.vmdk Richard-WORKVM-photon01.vmsd Richard-WORKVM-photon01-63a9ca8f.hlog Richard-WORKVM-photon01.vmxf vmware-2.log vmware-1.log vmware.log ``` 另外若是該虛擬機器使用 **Thin** 格式,則在執行復原腳本時,須加上 **`thin`** 參數。可透過以下 **`govc datastore.disk.info`** 命令確認 VMDK 是否屬於 **thin** 格式。 ```bash $ govc datastore.disk.info -ds SC2080_Lab01 ${vm}/${vm}.vmdk Name: Richard-WORKVM-photon01/Richard-WORKVM-photon01.vmdk Type: thin Parent: $ govc datastore.disk.info -ds SC2080_Lab01 ${vm}/${vm}-000002.vmdk Name: Richard-WORKVM-photon01/Richard-WORKVM-photon01.vmdk Type: thin Parent: Name: Richard-WORKVM-photon01/Richard-WORKVM-photon01-000002.vmdk Type: seSparse Parent: Richard-WORKVM-photon01/Richard-WORKVM-photon01.vmdk ``` 6. 執行復原腳本,以恢復虛擬機器組態檔。 ```bash /tmp/recover.sh [虛擬機器名稱] 或 /tmp/recover.sh [虛擬機器名稱] thin ``` 7. 若復原腳本執行成功,請將該虛擬機器完成**重新登錄(Re-register)** 動作。 - **取消登錄虛擬機器(Unregister)** - 選取**虛擬機器**,按**滑鼠右鍵**選擇**從詳細目錄中移除**。 - **登錄虛擬機器(Register)** - 選取**資料存放區(Datastore)**,按**滑鼠右鍵**選擇**登錄虛擬機器**,選擇欲登錄的虛擬機器 **.vmx 組態檔**。 當然可以透過 **govc** 命令輕鬆完成。 ```bash ## 取消登錄 $ govc vm.unregister ${vm} ## 進行登錄 $ govc vm.register -ds SC2080_Lab01 ${vm}/${vm}.vmx ``` 以上就是初步的執行流程,詳細操作及說明請以官方公告為主。 # 參考 ## VMware KB - How to Disable/Enable the SLP Service on VMware ESXi (76372) [[**連結**]](https://kb.vmware.com/s/article/76372) - Recreating a missing VMware virtual machine disk descriptor file (.vmdk) (1002511) [[**連結**]](https://kb.vmware.com/s/article/1002511) ## CISA - Alert (AA23-039A) ESXiArgs Ransomware Virtual Machine Recovery Guidance [[**連結**]](https://www.cisa.gov/uscert/ncas/alerts/aa23-039a) ## iThome 資安日報 - VMware虛擬化平臺遭到鎖定,利用2年前的漏洞進行勒索軟體攻擊(2/4) [[**連結**]](https://www.ithome.com.tw/news/155389), [[**來源連結**]](https://www.bleepingcomputer.com/news/security/massive-esxiargs-ransomware-attack-targets-vmware-esxi-servers-worldwide/) - 利用2年前VMware ESXi漏洞的勒索軟體攻擊行動出現災情,數十家義大利組織受害、數百萬用戶無法上網(2/7) [[**連結**]](https://www.ithome.com.tw/news/155423), [[**來源連結**]](https://eandt.theiet.org/content/articles/2023/02/italy-warns-of-large-scale-global-ransomware-attack/) - CISA提供勒索軟體ESXiArgs的自動化復原指令碼(2/9) [[**連結**]](https://www.ithome.com.tw/news/155446) :::success **來自 ChatGPT 提醒** 攻擊者最近積極針對 VMware ESXi 虛擬化平臺進行攻擊,利用 CVE-2021-21974 漏洞發動勒索軟體攻擊。該漏洞允許攻擊者遠端存取企業的虛擬環境,並進行數據加密,然後要求企業付贖金以恢復數據。 企業需要注意以下防範措施: - **立即安裝最新的 VMware ESXi 修補程式以修復此漏洞** - **加強網路安全,包括防火牆和入侵偵測系統的設置** - **定期備份數據,以防止數據遺失** 如果企業已經遭受了此攻擊,則應立即尋求專業的 IT 安全服務,以恢復系統和數據。此外,企業需要考慮報警相關部門,以協助調查和防止這種攻擊。 :::