Suspicious Program Location Process Starts

Detects programs running in suspicious files system locations

Rule Content

- title: Suspicious Program Location Process Starts
  id: f50bfd8b-e2a3-4c15-9373-7900b5a4c6d5
  status: experimental
  description: Detects programs running in suspicious files system locations
  references:
  - https://docs.google.com/spreadsheets/d/17pSTDNpa0sf6pHeRhusvWG6rThciE8CsXTSlDUAZDyo
  tags:
  - attack.defense_evasion
  - attack.t1036
  author: Florian Roth
  date: 2019/01/15
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      Image:
      - '*\$Recycle.bin'
      - '*\Users\Public\\*'
      - C:\Perflogs\\*
      - '*\Windows\Fonts\\*'
      - '*\Windows\IME\\*'
      - '*\Windows\addins\\*'
      - '*\Windows\debug\\*'
    condition: selection
  falsepositives:
  - unknown
  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:(*\\$Recycle.bin OR *\\Users\\Public\\* OR C\:\\Perflogs\\* OR *\\Windows\\Fonts\\* OR *\\Windows\\IME\\* OR *\\Windows\\addins\\* OR *\\Windows\\debug\\*)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()