マルウェア永続化手法
マルウェアの永続化手法についてのまとめ
参考
- Learning Malware Analysis: Explore the concepts, tools, and techniques to analyze and investigate Windows malware
- Malware Persistence Methodsを参考にまとめた
手法の一覧(Windows)
- 実行レジストリキーの追加(Running the Registry Key)
- タスクスケジューラ(Scheduled Tasks)
- スタートアップ(Startup Folder)
- Winlogonレジストリエントリ(Winlogon Registry Entries)
- イメージファイル実行オプション(Image File Execution Options)
- アクセシビリティプログラム(Accessibility Programs)
- AppInit_DLLs
- DLLハイジャック(DLL Search Order Hijacking)
- COMハイジャック(COM hijacking)
- サービス
実行レジストリキーの追加(Running the Registry Key)
- 場所
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce
HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run
- 検知
- Sysinternals(https://docs.microsoft.com/ja-jp/sysinternals/downloads/autoruns)のAutoRunsユーティリティを使用
タスクスケジューラ(Scheduled Tasks)
- 作成
- schtasks
- powershell
- WMI
- 検知
- Sysinternals(https://docs.microsoft.com/ja-jp/sysinternals/downloads/autoruns)のAutoRunsユーティリティを使用
- タスクスケジューラで確認
スタートアップ(Startup Folder)
- 場所
C:\%AppData%\Microsoft\Windows\Start Menu\Programs\Startup
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
- 検知
- スタートアップフォルダへの書き込みを監視する
Winlogonレジストリエントリ(Winlogon Registry Entries)
- 場所
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
- 検知
- Sysinternals(https://docs.microsoft.com/ja-jp/sysinternals/downloads/autoruns)のAutoRunsユーティリティを使用
- レジストリの変更を監視
イメージファイル実行オプション(Image File Execution Options)
- 場所
Key: "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\<executable name>"
Value: Debugger : REG_SZ : <full-path to the debugger>
- 検知
- Debuggerの値を検査する
アクセシビリティプログラム(Accessibility Programs)
- 場所
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\sethc.exe" /t REG_SZ /v Debugger /d "C:\windows\system32\cmd.exe" /f
"cmd /c netsh firewall add portopening tcp 3389 all & reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server /v fDenyTSConnections /t REG_DWORD /d 00000000 /f & REG ADD HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\sethc.exe /v Debugger /t REG_SZ /d %windir%\system32\taskmgr.exe /f"
- 検知
- イメージファイル実行オプションに変更がないかチェックする
- sethc.exeがcmd.exe/taskmgr.exeに変更されてないか
AppInit_DLLs
- 場所
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Windows
AppInit_DLLs
LoadAppInit_DLLs
- 検知
- レジストリの値をチェックする
DLLハイジャック(DLL Search Order Hijacking)
DLLを探す順番
- アプリ起動ディレクトリ
- システムディレクトリ
- 16ビットシステムディレクトリ
- Windowsディレクトリ
- カレントディレクトリ
- PATH変数で定義されたディレクトリ
- 検知
- DLLの作成、リネーム、置換、削除を監視
COMハイジャック(COM hijacking)
- 場所
HKCU\Software\Classes\CLSID\以下のエントリを書き換える
- 検知
- HKLM\Software\Classes\CLSID\以下のバイナリを検査する
サービス
- 作成
- scコマンド(sc create)
- API(CreateService()とStartService())
- powershell
- WMI
- 変更
- scコマンド(sc change)
- 場所
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services
- 検知
- pathの変更を検知する