WMI Persistence - Script Event Consumer

Detects WMI script event consumers

Rule Content

- title: WMI Persistence - Script Event Consumer
  id: ec1d5e28-8f3b-4188-a6f8-6e8df81dc28e
  status: experimental
  description: Detects WMI script event consumers
  references:
  - https://www.eideon.com/2018-03-02-THL03-WMIBackdoors/
  author: Thomas Patzke
  date: 2018/03/07
  tags:
  - attack.execution
  - attack.persistence
  - attack.t1047
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      Image: C:\WINDOWS\system32\wbem\scrcons.exe
      ParentImage: C:\Windows\System32\svchost.exe
    condition: selection
  falsepositives:
  - Legitimate event consumers
  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-*', doc_type='doc')

Run Elasticsearch Query


In [ ]:
s = searchContext.query('query_string', query='(process_path:"C\:\\WINDOWS\\system32\\wbem\\scrcons.exe" AND process_parent_path:"C\:\\Windows\\System32\\svchost.exe")')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()