@port139 Blog

基本的にはデジタル・フォレンジックの技術について取り扱っていますが、記載内容には高確率で誤りが含まれる可能性があります。

WMIとsysmon v6.10

Sysmon v6.10 が 9/11 にリリースされ、WMI Filterとconsumersがモニタリング出来るようになったようです。 3つのイベントIDが追加されています、登録を検出するようですね。

Sysmon - Windows Sysinternals | Microsoft Docs より引用

Event ID 19: WmiEvent (WmiEventFilter activity detected)
When a WMI event filter is registered, which is a method used by malware to execute, this event logs the WMI namespace, filter name and filter expression.
Event ID 20: WmiEvent (WmiEventConsumer activity detected)
This event logs the registration of WMI consumers, recording the consumer name, log, and destination.
Event ID 21: WmiEvent (WmiEventConsumerToFilter activity detected)
When a consumer binds to a filter, this event logs the consumer name and filter path.

 Windows 10環境にsysmon 6.10をインストールし、WMI モニタリングを確認してみます。Sysmon にはテスト用として下記設定を行います。

<Sysmon schemaversion="3.40">
<!-- Capture all hashes -->
<HashAlgorithms>md5</HashAlgorithms>
<EventFiltering>
<WmiEvent onmatch="exclude" />
</EventFiltering>
</Sysmon>

f:id:hideakii:20170917081147p:plain

WMIの登録には、下記ページで紹介されているWMIGhost のスクリプト wmi_raw_formated.js を利用します。

secrary.com

スクリプトファイル wmi_raw_formated.js を実行後、Autorus ツールで WMI に自動起動が登録されている事を確認します。

f:id:hideakii:20170917081608p:plain

イベントログにWmiEventConsumerの登録が記録されています。

f:id:hideakii:20170917081916p:plain

 

f:id:hideakii:20170917090843p:plain

その他

EventID 19

f:id:hideakii:20170917085138p:plain

 Get-WMIObject -Namespace root\Subscription -Class __EventFilter

f:id:hideakii:20170917111746p:plain

Get-WMIObject -Namespace root\Subscription -Class __EventConsumer

f:id:hideakii:20170917111908p:plain

Get-WMIObject -Namespace root\Subscription -Class __FilterToConsumerBinding

f:id:hideakii:20170917112129p:plain

 PyWMIPersistenceFinder.py

f:id:hideakii:20170917185742p:plain

CCM_RUA_Finder.py

f:id:hideakii:20170917185938p:plain

参考URL: 

Visual Basic Script implementing WMI Persistence method (as implemented in SEADADDY malware and further documented by Matt Graeber) to make the Macro code schedule malware startup after roughly 3 minutes since system gets up. · GitHub

 

learn-powershell.net

  

www.exploit-monday.com

 

www.bleepingcomputer.com

 

www.hybrid-analysis.com

 

blog.zemana.com

WMI Event Subscription Persistence

https://www.rapid7.com/db/modules/exploit/windows/local/wmi_persistence

 

github.com

 

f:id:hideakii:20170917085708j:plain