Service Execution

Detects manual service execution (start) via system utilities

Rule Content

- title: Service Execution
  id: 2a072a96-a086-49fa-bcb5-15cc5a619093
  status: experimental
  description: Detects manual service execution (start) via system utilities
  author: Timur Zinniatullin, Daniil Yugoslavskiy, oscd.community
  date: 2019/10/21
  modified: 2019/11/04
  references:
  - https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1035/T1035.yaml
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      Image|endswith:
      - \net.exe
      - \net1.exe
      CommandLine|contains: ' start '
    condition: selection
  falsepositives:
  - Legitimate administrator or user executes a service for legitimate reason
  level: low
  tags:
  - attack.execution
  - attack.t1035

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:(*\\net.exe OR *\\net1.exe) AND process_command_line.keyword:*\ start\ *)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()