CrackMapExecWin

Detects CrackMapExecWin Activity as Described by NCSC

Rule Content

- title: CrackMapExecWin
  id: 04d9079e-3905-4b70-ad37-6bdf11304965
  description: Detects CrackMapExecWin Activity as Described by NCSC
  status: experimental
  references:
  - https://www.ncsc.gov.uk/alerts/hostile-state-actors-compromising-uk-organisations-focus-engineering-and-industrial-control
  tags:
  - attack.g0035
  author: Markus Neis
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      Image:
      - '*\crackmapexec.exe'
    condition: selection
  falsepositives:
  - None
  level: critical

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

Show Results


In [ ]:
df.head()