Executables Started in Suspicious Folder

Detects process starts of binaries from a suspicious folder

Rule Content

- title: Executables Started in Suspicious Folder
  id: 7a38aa19-86a9-4af7-ac51-6bfe4e59f254
  status: experimental
  description: Detects process starts of binaries from a suspicious folder
  author: Florian Roth
  date: 2017/10/14
  modified: 2019/02/21
  references:
  - https://github.com/mbevilacqua/appcompatprocessor/blob/master/AppCompatSearch.txt
  - https://www.secureworks.com/research/bronze-butler-targets-japanese-businesses
  - https://www.crowdstrike.com/resources/reports/2019-crowdstrike-global-threat-report/
  - https://github.com/ThreatHuntingProject/ThreatHunting/blob/master/hunts/suspicious_process_creation_via_windows_event_logs.md
  tags:
  - attack.defense_evasion
  - attack.t1036
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      Image:
      - C:\PerfLogs\\*
      - C:\$Recycle.bin\\*
      - C:\Intel\Logs\\*
      - C:\Users\Default\\*
      - C:\Users\Public\\*
      - C:\Users\NetworkService\\*
      - C:\Windows\Fonts\\*
      - C:\Windows\Debug\\*
      - C:\Windows\Media\\*
      - C:\Windows\Help\\*
      - C:\Windows\addins\\*
      - C:\Windows\repair\\*
      - C:\Windows\security\\*
      - '*\RSA\MachineKeys\\*'
      - C:\Windows\system32\config\systemprofile\\*
      - C:\Windows\Tasks\\*
      - C:\Windows\System32\Tasks\\*
    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:(C\:\\PerfLogs\\* OR C\:\\$Recycle.bin\\* OR C\:\\Intel\\Logs\\* OR C\:\\Users\\Default\\* OR C\:\\Users\\Public\\* OR C\:\\Users\\NetworkService\\* OR C\:\\Windows\\Fonts\\* OR C\:\\Windows\\Debug\\* OR C\:\\Windows\\Media\\* OR C\:\\Windows\\Help\\* OR C\:\\Windows\\addins\\* OR C\:\\Windows\\repair\\* OR C\:\\Windows\\security\\* OR *\\RSA\\MachineKeys\\* OR C\:\\Windows\\system32\\config\\systemprofile\\* OR C\:\\Windows\\Tasks\\* OR C\:\\Windows\\System32\\Tasks\\*)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()