JexBoss Command Sequence

Detects suspicious command sequence that JexBoss

Rule Content

- title: JexBoss Command Sequence
  id: 8ec2c8b4-557a-4121-b87c-5dfb3a602fae
  description: Detects suspicious command sequence that JexBoss
  references:
  - https://www.us-cert.gov/ncas/analysis-reports/AR18-312A
  author: Florian Roth
  date: 2017/08/24
  logsource:
    product: linux
    service: null
    category: null
  detection:
    selection1:
    - bash -c /bin/bash
    selection2:
    - '&/dev/tcp/'
    condition: selection1 and selection2
  falsepositives:
  - Unknown
  level: high

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='\*.keyword:(*bash\ \-c\ \/bin\/bash* AND *&\/dev\/tcp\/*)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()