網絡安全公司,Metastealer 接棒 Racoon stealer 進行竊密
MetaStealer 是一個新出現的竊密惡意軟件,該惡意軟件旨在填補 2022 年 3 月份 Racoon stealer 停止運營帶來的市場空白。
以色列暗網情報公司 Kela 的分析人員首先在地下市場確認了 MetaStealer 的出現,緊接著 SANS 確認該惡意軟件參與了垃圾郵件攻擊。
攻擊鏈
技術分析
檢測繞過
最開始 Metastealer 使用 PowerShell 執行命令?powershell -inputformat none -outputformat none –NonInteractive -Command Add-MpPreference -ExclusionExtension "exe"
。
該命令為 Microsoft Defender 添加了例外規則,將?.exe
擴展名排除在掃描外。這樣降低了惡意軟件與攻擊者投遞的其他 Payload 被檢測的概率。
Microsoft Defender
在處理 Microsoft Defender 后,Metastealer 使用另一個 PowerShell 命令將文件重命名為固定名稱:powershell rename-item -path .xyz -newname hyper-v.exe
。
持久化
Metastealer 使用組件對象模型(COM)在?\Microsoft\Windows’
下創建名為?sys
的計劃任務。該計劃任務會在用戶登錄時觸發,確保惡意軟件在計算機重啟后仍能持久化存在。
計劃任務
字符串混淆
Metastealer 的大部分字符串都是加密的,在運行時根據需要進行解密。加密字符串都被放置在棧上,使用按位異或進行解密。
字符串混淆邏輯
Python 等效代碼如下所示:
def swap32(x):
return int.from_bytes(x.to_bytes(8, byteorder='little'), byteorder='big', signed=False)
def split_hex(input):
text = hex(input)
text = text[2:]
text = text.zfill(len(text) + len(text) % 2)
output = " ".join(text[i: i+2] for i in range(0, len(text), 2))
return(output.split(' '))
hexIntXOR = []
hexIntKey = []
hexIntXOR.append(0x4BFB9390)
hexIntXOR.append(0x25C2F251)
hexIntXOR.append(0x11C52ED4)
hexIntXOR.append(0x5CEDBB0D)
hexIntKey.append(0x2489FBF3)
hexIntKey.append(0x25C2973C)
hexIntKey.append(0x11C52ED4)
hexIntKey.append(0x5CEDBB0D)
hexbytesxor = []
hexbyteskey = []
for HexInt in hexIntXOR:
hexBytes = split_hex(HexInt)
hexBytes.reverse()
hexbytesxor = hexbytesxor + hexBytes
for HexInt in hexIntKey:
hexBytes = split_hex(HexInt)
hexBytes.reverse()
hexbyteskey = hexbyteskey + hexBytes
count = 0
for hexByte in hexbytesxor:
print(chr(int(hexByte, base=16) ^ int(hexbyteskey[count], base=16)), end='')
count+=1
C&C
分析時 C&C 上線雖然能夠成功,但后續的請求會返回 HTTP 400 錯誤。這可能表示該攻擊是短期的,對新感染者不再下發指令。也有可能是為了限制分析人員對 C&C 通信的分析。
樣本總硬編碼的 C&C 服務器為?193.106.191.162:1775
,該地址也是被加密存儲的。
使用?cpp-httplib
通過 User Agent 為?cpp-httplib/0.10.1
的 HTTP 請求連接 C&C 服務器。
初始請求路徑為?/api/client/new
,僅用于注冊上線:
注冊上線
響應中返回的 UUID 作為?BotId
,每個上線請求都會返回一個新的 UUID。
使用 Nlohmann JSON 解析 JSON 字符串提取?BotId
,并以明文形式寫入文件?%localappdata%\hyper-v.ver
。
隨后的 C&C 通信以 UUID 為請求內容:
UUID
POST 請求發送給?/tasks/get_worker
,分析時 C&C 服務器只響應 HTTP 400 錯誤代碼。
C&C 通信
執行命令后,執行結果會發送到?/tasks/collect
,其中包含竊密數據或者命令執行輸出。
C&C 命令
命令ID | 功能 | 描述 |
---|---|---|
1001 | 收集系統信息 | 通過 cmd.exe 獲取系統信息 |
1002 | 竊取 Cookie | 竊取 Chrome、Firefox 與 Edge 瀏覽器的 Cookie |
1003 | 竊取密碼 | 竊取 Chrome、Firefox 與 Edge 瀏覽器的密碼 |
1004 | 啟動鍵盤記錄 | 針對 Chrome、Firefox 與 Notepad 啟動鍵盤記錄 |
1005 | 停止鍵盤記錄 | |
1006 | 啟動 HVNC | 利用 Kissnet 創建 HVNC 連接 |
1007 | 停止 HVNC | |
1008 | 執行命令 | 通過 cmd.exe 執行命令 |
IOC
193.106.191[.]162:1775
cpp-httplib/0.10.1
hyper-v.exe
Yara
rule metaStealer_memory {
meta:
description = "MetaStealer Memory"
author = "Peter Gurney"
date = "2022-04-29"
strings:
$str_c2_parse = {B8 56 55 55 55 F7 6D C4 8B C2 C1 E8 1F 03 C2 8B 55 C0 8D 04 40 2B 45 C4}
$str_filename = ".xyz -newname hyper-v.exe" fullword wide
$str_stackstring = {FF FF FF C7 85 ?? ?? ?? ?? ?? ?? ?? ?? C7 85 ?? ?? ?? ?? ?? ?? ?? ?? C7 85 ?? ?? ?? ?? ?? ?? ?? ?? C7 85 ?? ?? ?? ?? ?? ?? ?? ?? 66 0F EF}
condition:
uint16(0) == 0x5a4d and
2 of ($str_*)
}