1. 簡介

網路安全威脅的領域不斷演變,攻擊者開發出日益複雜的技術來繞過防禦機制。端點偵測及回應 (Endpoint Detection and Response, EDR) 解決方案是現代安全架構的關鍵組成部分,旨在監控並回應端點上的惡意活動。然而,新穎的攻擊方法,例如 EDR-Freeze 技術,展示了這些防禦如何被暫時癱瘓。EDR-Freeze 是一種概念驗證技術,它利用合法的 Windows 作業系統元件來暫停 EDR/防毒軟體 (Anti-Virus, AV) 程序,使其變得無效而不會觸發立即警報 [1]。本報告提供了對 EDR-Freeze 攻擊的全面技術分析,詳細說明了其操作機制、鑑識 Artifact 以及潛在的偵測策略。

Windows WER 系統遭濫用:EDR-Freeze 漏洞讓資安「形同虛設」的技術研究 | 資訊安全新聞

2. EDR-Freeze 技術概述

EDR-Freeze 的運行原理是透過利用 Windows 錯誤回報 (Windows Error Reporting, WER) 子系統,特別是濫用 WerFaultSecure.exe 的功能並結合來自 dbghelp.dll MiniDumpWriteDump API [1]。與傳統可能涉及 Kernel 模式漏洞或自帶有漏洞的 Driver (Bring-Your-Own-Vulnerable-Driver, BYOVD) 方法的 EDR 規避方法不同,EDR-Freeze 完全在使用者模式下執行,使其成為一種更隱蔽的威脅 [2]。

2.1 操作機制

EDR-Freeze 技術的核心涉及一個時間點和 Race Condition 來實現其目標。當呼叫 MiniDumpWriteDump 時,它會固有地暫停目標程序的全部執行緒,以確保 dump 操作的記憶體快照一致。EDR-Freeze 利用了這一副作用。攻擊序列可以總結如下:

  1. EDR-Freeze 工具啟動攻擊,鎖定特定的 EDR/AV 程序。
  2. 它產生 WerFaultSecure.exe ,一個合法的 Windows 元件,傳遞特定的命令列參數,其中包括目標 EDR 程序的Process ID (Process ID, PID) 和執行緒 ID (Thread ID, TID) [1]。
  3. WerFaultSecure.exe 在 EDR-Freeze 的影響下,然後嘗試使用 MiniDumpWriteDump 對目標 EDR 程序執行記憶體 dump
  4. MiniDumpWriteDump 執行期間,目標 EDR 程序內部的所有執行緒都會被暫停。
  5. 關鍵是,EDR-Freeze 隨後會暫停 WerFaultSecure.exe 本身,阻止 EDR 永遠恢復其操作。這使得 EDR 處於一種「frozen」或「coma」狀態,它看起來正在運行,但實際上是無效的,無法生成遙測資料或強制執行安全政策 [2]。

2.2 程序流程圖

下圖表說明了 EDR-Freeze 技術的操作流程:

        graph TD
            A[Attacker Initiates EDR-Freeze Tool] --> B{"Target EDR/AV Process (e.g., MsMpEng.exe)"};
            A --> C[EDR-Freeze Spawns WerFaultSecure.exe];
            C -- Passes PID/TID as arguments --> D[WerFaultSecure.exe Invokes MiniDumpWriteDump];
            D -- Suspends all threads --> B;
            C -- EDR-Freeze suspends WerFaultSecure.exe --> D;
            B -- Remains Suspended --> E[EDR/AV in Coma State];
            E -- No Telemetry/Enforcement --> F[System Vulnerable];
    

3. 鑑識分析和 Artifact

了解 EDR-Freeze 留下的鑑識 Artifact 對於偵測和調查至關重要。像 Volatility 3 和 MemProcFS 這樣的記憶體鑑識工具可以揭示這種攻擊的底層機制 [1]。

3.1 程序和執行緒狀態

在 EDR-Freeze 攻擊期間,程序監控工具將顯示目標 EDR 程序(例如 MsMpEng.exe )和輔助程序( WerFaultSecure.exe )都處於暫停狀態。記憶體分析證實了目標 EDR 程序記憶體 在被暫停的執行緒。這些被暫停的執行緒通常具有相同的 StartAddress / Win32StartAddress 值,表明它們是被刻意保持暫停狀態的工作執行緒,而不是隨意的 Crash 堆疊 [1]。這些被暫停執行緒的時間戳直接與 WerFaultSecure.exe 的活動相關聯,建立了輔助程序和 EDR 凍結事件之間的時間關聯。

3.2 Handle 分析

對程序 Handle 的調查提供了攻擊的關鍵證據。 WerFaultSecure.exe 獲取了目標 EDR 的程序 Handle ,其 Access mask 包含 PROCESS_SUSPEND_RESUME PROCESS_CREATE_THREAD PROCESS_VM_OPERATION PROCESS_DUP_HANDLE PROCESS_QUERY_INFORMATION 。此外, WerFaultSecure.exe 擁有目標 EDR 執行緒的多個執行緒 Handle ,通常具有 THREAD_ALL_ACCESS 。這些 Handle 權限是 EDR-Freeze 工具能夠暫停和恢復目標 EDR 執行緒的直接機制,證實了觀察到的暫停執行緒 Artifact [1]。

python3 vol.py -q -r pretty -f /mnt/c/MemoryDumps/win11defender.raw windows.handles --pid 10892 | grep 3428
# This command uses Volatility 3 to list handles opened by WerFaultSecure.exe (PID 10892)
# and filters for handles related to the target EDR process (PID 3428).
# The output would reveal the specific access rights obtained by WerFaultSecure.exe.

3.3 檔案系統 Artifact

儘管設計為暫時性的,EDR-Freeze 仍會創建臨時檔案,可用作鑑識指標。一個名為 t.txt 的檔案在攻擊期間被創建並隨後被刪除。雖然它在磁碟上的存在時間很短,但它的創建和刪除事件可能會被作業系統或 檔案系統 監控工具記錄。原始碼也表明創建了一個 dump File dump_<PID>.txt ,這也是暫時性的。這些暫時性的檔案 操作,即使檔案 被刪除,也會留下可以通過鑑識分析恢復的痕跡 [1]。

3.4 命令列參數

分析命令列參數可直接洞察 EDR-Freeze 工具及其生成的程序的執行參數。主要的 EDR-Freeze 執行檔通常以目標 EDR 的Process ID (PID) 和指定的暫停持續時間運行。更重要的是, WerFaultSecure.exe 是以一組獨特的參數啟動的,包括 /pid /tid /encfile /cancel /type 。這些特定參數的存在是 EDR-Freeze 技術正在運行的有力指標,將啟動器、輔助程序和被暫停的執行緒聯繫起來 [1]。

windows.cmdline --pid 10892 5648
# This command uses the Volatility 3 windows.cmdline plugin to inspect the command-line arguments
# for WerFaultSecure.exe (PID 10892) and the EDR-Freeze launcher (PID 5648).
# It helps to identify the parameters used during the attack execution.

3.5 匯入位址表 (Import Address Table, IAT) 分析

WerFaultSecure.exe 的匯入位址表 (IAT) 揭示了其相依性和功能。一個關鍵發現是從 dbghelp.dll 匯入了 MiniDumpWriteDump 。此匯入是 WerFaultSecure.exe 擁有生成 minidumps 所需 API Native API 的靜態證據。由於 MiniDumpWriteDump 在其操作期間固有地暫停目標執行緒,因此它存在於 WerFaultSecure.exe 的 IAT 中解釋了輔助程序如何能夠暫時暫停另一個程序,這是 EDR-Freeze 技術的關鍵組成部分 [1]。

python3 vol.py -q -r pretty -f /mnt/c/MemoryDumps/win11defender.raw windows.iat.IAT --pid 10892
# This Volatility 3 command examines the Import Address Table (IAT) of WerFaultSecure.exe (PID 10892).
# It helps to identify imported functions like MiniDumpWriteDump, which are central to the EDR-Freeze mechanism.

4. 原始碼關聯和 YARA 規則

原始研究提供了與觀察到的鑑識 Artifact 直接相關的 C++ code 片段,從而提供了對攻擊實施的更深入理解。這些片段演示了為 WerFaultSecure.exe 構造命令列參數、使用 CreateFileW() 創建臨時 dump File ,以及使用 CreateEventW() 設定取消事件。隨後使用 DeleteFileW() 刪除臨時檔案 t.txt 也解釋了暫時性 檔案系統 Artifact [1]。

  1. // Command-line argument construction for WerFaultSecure.exe
  2. cmd &lt;&lt; werPath &lt;&lt; L" /h"
  3.     &lt;&lt; L" /pid " &lt;&lt; targetPID
  4.     &lt;&lt; L" /tid " &lt;&lt; targetTID
  5.     &lt;&lt; L" /encfile " &lt;&lt; HandleToDecimal(hEncDump)
  6.     &lt;&lt; L" /cancel " &lt;&lt; HandleToDecimal(hCancel)
  7.     &lt;&lt; L" /type 268310";
  8. // This C++ snippet shows how the command-line arguments for WerFaultSecure.exe are dynamically built,
  9. // including the target PID, TID, and handles for dump and cancellation events.
  10. </code></pre>
  11. <pre><code class="language-cpp">
  12. // File and event handle creation
  13. std::wstring dumpFileName = L"dump_" + std::to_wstring(targetPID) + L".txt";
  14. HANDLE hEncDump = CreateFileW(dumpFileName.c_str(), GENERIC_WRITE, 0, &amp;sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
  15. if (hEncDump == INVALID_HANDLE_VALUE)
  16. {
  17.     std::wcerr &lt;&lt; L"Failed to create dump files: " &lt;&lt; GetLastError() &lt;&lt; std::endl;
  18.     return 0;
  19. }
  20. HANDLE hCancel = CreateEventW(&amp;sa, TRUE, FALSE, nullptr);
  21. if (!hCancel)
  22. {
  23.     // Error handling
  24. }
  25. // ... later in the code ...
  26. if (DeleteFileW(L"t.txt"))
  27. {
  28.     std::wcout &lt;&lt; L"File deleted successfully." &lt;&lt; std::endl;
  29. }
  30. // These C++ code blocks illustrate the creation of the temporary dump file (dump_&lt;PID&gt;.txt)
  31. // and a cancellation event, which are then passed to WerFaultSecure.exe. The deletion of 't.txt'
  32. // explains the transient file system artifact observed during forensic analysis.
  1. // File and event handle creation
  2. std::wstring dumpFileName = L"dump_" + std::to_wstring(targetPID) + L".txt";
  3. HANDLE hEncDump = CreateFileW(dumpFileName.c_str(), GENERIC_WRITE, 0, &amp;sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
  4. if (hEncDump == INVALID_HANDLE_VALUE)
  5. {
  6.     std::wcerr &lt;&lt; L"Failed to create dump files: " &lt;&lt; GetLastError() &lt;&lt; std::endl;
  7.     return 0;
  8. }
  9. HANDLE hCancel = CreateEventW(&amp;sa, TRUE, FALSE, nullptr);
  10. if (!hCancel)
  11. {
  12.     // Error handling
  13. }
  14. // ... later in the code ...
  15. if (DeleteFileW(L"t.txt"))
  16. {
  17.     std::wcout &lt;&lt; L"File deleted successfully." &lt;&lt; std::endl;
  18. }
  19. // These C++ code blocks illustrate the creation of the temporary dump file (dump_&lt;PID&gt;.txt)
  20. // and a cancellation event, which are then passed to WerFaultSecure.exe. The deletion of 't.txt'
  21. // explains the transient file system artifact observed during forensic analysis.

4.1 用於偵測的 YARA 規則

為了幫助偵測 EDR-Freeze 技術,提出了兩條 YARA 規則。第一條規則 CAP_WerFaultSecure_Freeze_Technique 透過識別特定字串(例如命令列旗標、像 dump_ t.txt 的檔案名稱)和匯入函式(例如 CreateFileW CreateEventW MiniDumpWriteDump 和各種執行緒/程序暫停 API)來針對二進位檔本身。此規則旨在捕捉 EDR-Freeze 的特定實作 [1]。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
rule CAP_WerFaultSecure_Freeze_Technique
{
  meta:
    description = "Detects binaries implementing the WER freeze technique via WerFaultSecure + MiniDumpWriteDump + privilege escalation + handle manipulation"
    author = "Itamar Hallstrom"
    date = "2025-09-26"
    confidence = "high"
    mitre_technique = "T1562.001"

  strings:
    $wer        = "WerFaultSecure.exe" ascii wide nocase
    $flag_pid   = "/pid " ascii wide
    $flag_tid   = "/tid " ascii wide
    $flag_enc   = "/encfile " ascii wide
    $flag_can   = "/cancel " ascii wide
    $flag_h     = " /h" ascii wide
    $flag_type  = "/type " ascii wide
    $dumpfile   = "dump_" ascii wide
    $tfile      = "t.txt" ascii wide
    $mini       = "MiniDumpWriteDump" ascii wide nocase
    $ntsp       = "NtSuspendProcess" ascii wide nocase
    $zwsp       = "ZwSuspendProcess" ascii wide nocase
    $ntst       = "NtSuspendThread" ascii wide nocase
    $zwst       = "ZwSuspendThread" ascii wide nocase

  condition:
    ( $wer or $mini )
    and 2 of ($flag_enc, $flag_can, $flag_pid, $flag_tid, $flag_h, $flag_type)
    and pe.imports("KERNEL32.dll", "CreateFileW")
    and pe.imports("KERNEL32.dll", "CreateEventW")
    and (
         ( pe.imports("ADVAPI32.dll", "AdjustTokenPrivileges")
           and pe.imports("ADVAPI32.dll", "LookupPrivilegeValueW")
           and pe.imports("ADVAPI32.dll", "OpenProcessToken") )
         or any of ($ntsp, $zwsp, $ntst, $zwst)
        )
    and any of ($dumpfile, $tfile)
}
# This YARA rule identifies the EDR-Freeze technique by looking for specific strings and imported API calls
# that are characteristic of its operation, including the use of WerFaultSecure.exe, MiniDumpWriteDump,
# and various process/thread manipulation functions.

第二條 YARA 規則 BEHAVIOR_ProcessFreeze_Technique_v2 更為通用,專注於行為分群以偵測更廣泛的程序凍結/暫停技術,包括那些可能濫用 WER 或 MiniDumpWriteDump ,或自訂工具的技術。它尋找常見的命令列旗標、權限提升原語(例如 AdjustTokenPrivileges SeDebugPrivilege )、核心程序/執行緒操作 API(例如 NtSuspendProcess CreateRemoteThread )以及 Handle /同步原語(例如 CreateEventW CreateFileW )[1]。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
rule BEHAVIOR_ProcessFreeze_Technique_v2
{
  meta:
    description = "Detects memory-resident indicators of process freezing/suspension techniques (WER, MiniDump abuse, or custom tooling)"
    author = "Itamar Hallstrom"
    date = "2025-09-26"
    confidence = "medium"
    mitre_technique = "T1562.001 - Impair Defenses"

  strings:
    $pid      = "/pid " ascii wide
    $tid      = "/tid " ascii wide
    $encfile  = "/encfile " ascii wide
    $cancel   = "/cancel " ascii wide
    $type     = "/type " ascii wide
    $adjust   = "AdjustTokenPrivileges" ascii wide nocase
    $lookup   = "LookupPrivilegeValue" ascii wide nocase
    $openproc = "OpenProcessToken" ascii wide nocase
    $sedebug  = "SeDebugPrivilege" ascii wide nocase
    $ntsp     = "NtSuspendProcess" ascii wide nocase
    $zwsp     = "ZwSuspendProcess" ascii wide nocase
    $ntst     = "NtSuspendThread" ascii wide nocase
    $zwst     = "ZwSuspendThread" ascii wide nocase
    $term     = "TerminateProcess" ascii wide nocase
    $crt      = "CreateRemoteThread" ascii wide nocase
    $ct       = "CreateThread" ascii wide nocase
    $evt      = "CreateEventW" ascii wide nocase
    $cfile    = "CreateFileW" ascii wide nocase
    $dump     = "MiniDumpWriteDump" ascii wide nocase
    $tfile    = "t.txt" ascii wide

  condition:
    // --- Privilege Escalation ---
    ( ( $adjust and $lookup and $openproc ) or $sedebug )
    or
    // --- Core Process/Thread Manipulation ---
    any of ($ntsp, $zwsp, $ntst, $zwst, $term, $crt, $ct)
    or
    // --- Handle Plumbing and Synchronization ---
    ( $evt and $cfile and $dump )
    or
    // --- CLI Flags and Artifacts ---
    ( 2 of ($pid, $tid, $encfile, $cancel, $type) or $tfile )
}
# This behavioral YARA rule detects a broader range of process freezing techniques by identifying
# common indicators such as command-line flags, privilege escalation attempts, process/thread manipulation APIs,
# and file/event creation related to such activities.

5. EDR 規避演進與應對措施

EDR-Freeze 技術凸顯了網路攻擊的一個重要趨勢:EDR 規避從簡單的終止或解除安裝,演變成利用合法作業系統元件的更複雜方法 [2]。這種轉變意味著 EDR 不僅被繞過,而且還被積極地鎖定並癱瘓,而不會觸發立即警報。結果是安全團隊失去了可見度和控制權,使系統容易受到進一步的危害 [2]。

為了應對此類高階規避技術,安全策略必須超越傳統的基於偵測的方法。預防優先的模型,例如自動移動目標防禦 (Automated Moving Target Defense, AMTD),提供了一條有前景的途徑。AMTD 技術通過在執行時不斷變形記憶體來運作,打亂攻擊者所依賴的靜態假設。這種不可預測性會導致像 EDR-Freeze 這樣的漏洞和規避工具在造成損害之前就發生 Crash 或靜默失敗,而無需識別特定威脅或將其與特徵碼匹配 [2]。

6. 結論

EDR-Freeze 攻擊代表了一種複雜的方法,通過濫用 Windows 錯誤回報和 MiniDumpWriteDump API 來暫時停止 EDR/AV 解決方案。它的使用者模式操作和對合法 OS 元件的依賴使其特別難以通過傳統的基於特徵碼的方法進行偵測。然而,通過對程序狀態、 Handle 權限、檔案系統 Artifact、命令列參數和 IAT 進入點的詳細鑑識分析,以及特定 YARA 規則的開發,防禦者可以識別和調查此類活動。EDR-Freeze 等技術的出現,凸顯了對先進的、專注於預防的安全解決方案的迫切需求,這些解決方案能夠適應不斷演變的規避策略,並防禦針對以防禦端點的機制本身為目標的威脅。