ZxShell Malware

Detects a ZxShell start by the called and well-known function name

Rule Content

- title: ZxShell Malware
  id: f0b70adb-0075-43b0-9745-e82a1c608fcc
  description: Detects a ZxShell start by the called and well-known function name
  author: Florian Roth
  references:
  - https://www.hybrid-analysis.com/sample/5d2a4cde9fa7c2fdbf39b2e2ffd23378d0c50701a3095d1e91e3cf922d7b0b16?environmentId=100
  tags:
  - attack.g0001
  - attack.execution
  - attack.t1059
  - attack.defense_evasion
  - attack.t1085
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      Command:
      - rundll32.exe *,zxFunction*
      - rundll32.exe *,RemoteDiskXXXXX
    condition: selection
  fields:
  - CommandLine
  - ParentCommandLine
  falsepositives:
  - Unlikely
  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='Command.keyword:(rundll32.exe\ *,zxFunction* OR rundll32.exe\ *,RemoteDiskXXXXX)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()