Cobalt Strike DNS Beaconing

Detects suspicious DNS queries known from Cobalt Strike beacons

Rule Content

- title: Cobalt Strike DNS Beaconing
  id: 2975af79-28c4-4d2f-a951-9095f229df29
  status: experimental
  description: Detects suspicious DNS queries known from Cobalt Strike beacons
  references:
  - https://www.icebrg.io/blog/footprints-of-fin7-tracking-actor-patterns
  author: Florian Roth
  date: 2018/05/10
  logsource:
    category: dns
    product: null
    service: null
  detection:
    selection:
      query:
      - aaa.stage.*
      - post.1*
    condition: selection
  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='query.keyword:(aaa.stage.* OR post.1*)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()