PsExec Service Start

Detects a PsExec service start

Rule Content

- title: PsExec Service Start
  id: 3ede524d-21cc-472d-a3ce-d21b568d8db7
  description: Detects a PsExec service start
  author: Florian Roth
  date: 2018/03/13
  modified: 2012/12/11
  tags:
  - attack.execution
  - attack.t1035
  - attack.s0029
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      ProcessCommandLine: C:\Windows\PSEXESVC.exe
    condition: selection
  falsepositives:
  - Administrative activity
  level: low

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_command_line:"C\:\\Windows\\PSEXESVC.exe"')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()