WMI Persistence - Command Line Event Consumer

Detects WMI command line event consumers

Rule Content

- title: WMI Persistence - Command Line Event Consumer
  id: 05936ce2-ee05-4dae-9d03-9a391cf2d2c6
  status: experimental
  description: Detects WMI command line event consumers
  references:
  - https://www.eideon.com/2018-03-02-THL03-WMIBackdoors/
  author: Thomas Patzke
  date: 2018/03/07
  tags:
  - attack.t1084
  - attack.persistence
  logsource:
    product: windows
    service: sysmon
    category: null
  detection:
    selection:
      EventID: 7
      Image: C:\Windows\System32\wbem\WmiPrvSE.exe
      ImageLoaded: wbemcons.dll
    condition: selection
  falsepositives:
  - Unknown (data set is too small; further testing needed)
  level: high

Querying Elasticsearch

Import Libraries


In [ ]:
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search
import pandas as pd

Initialize Elasticsearch client


In [ ]:
es = Elasticsearch(['http://helk-elasticsearch:9200'])
searchContext = Search(using=es, index='logs-endpoint-winevent-sysmon-*', doc_type='doc')

Run Elasticsearch Query


In [ ]:
s = searchContext.query('query_string', query='(event_id:"7" AND process_path:"C\:\\Windows\\System32\\wbem\\WmiPrvSE.exe" AND module_loaded:"wbemcons.dll")')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()