Encoded IEX

Detects a base64 encoded IEX command string in a process command line

Rule Content

- title: Encoded IEX
  id: 88f680b8-070e-402c-ae11-d2914f2257f1
  status: experimental
  description: Detects a base64 encoded IEX command string in a process command line
  author: Florian Roth
  date: 2019/08/23
  tags:
  - attack.t1086
  - attack.t1140
  - attack.execution
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      CommandLine|base64offset|contains:
      - IEX ([
      - iex ([
      - iex (New
      - IEX (New
    condition: selection
  fields:
  - CommandLine
  - ParentCommandLine
  falsepositives:
  - unknown
  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_command_line.keyword:(*SUVYIChb* OR *lFWCAoW* OR *JRVggKF* OR *aWV4IChb* OR *lleCAoW* OR *pZXggKF* OR *aWV4IChOZX* OR *lleCAoTmV3* OR *pZXggKE5ld* OR *SUVYIChOZX* OR *lFWCAoTmV3* OR *JRVggKE5ld*)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()