Suspicious Parent of Csc.exe

Detects a suspicious parent of csc.exe, which could by a sign of payload delivery

Rule Content

- title: Suspicious Parent of Csc.exe
  id: b730a276-6b63-41b8-bcf8-55930c8fc6ee
  description: Detects a suspicious parent of csc.exe, which could by a sign of payload
    delivery
  status: experimental
  references:
  - https://twitter.com/SBousseaden/status/1094924091256176641
  author: Florian Roth
  date: 2019/02/11
  tags:
  - attack.defense_evasion
  - attack.t1036
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      Image: '*\csc.exe*'
      ParentImage:
      - '*\wscript.exe'
      - '*\cscript.exe'
      - '*\mshta.exe'
    condition: selection
  falsepositives:
  - Unkown
  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.keyword:*\\csc.exe* AND process_parent_path.keyword:(*\\wscript.exe OR *\\cscript.exe OR *\\mshta.exe))')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()