WMI Persistence - Script Event Consumer File Write

Detects file writes of WMI script event consumer

Rule Content

- title: WMI Persistence - Script Event Consumer File Write
  id: 33f41cdd-35ac-4ba8-814b-c6a4244a1ad4
  status: experimental
  description: Detects file writes of WMI script event consumer
  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: 11
      Image: C:\WINDOWS\system32\wbem\scrcons.exe
    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:"11" AND process_path:"C\:\\WINDOWS\\system32\\wbem\\scrcons.exe")')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()