APT29

This method detects a suspicious powershell command line combination as used by APT29 in a campaign against US think tanks

Rule Content

- title: APT29
  id: 033fe7d6-66d1-4240-ac6b-28908009c71f
  description: This method detects a suspicious powershell command line combination
    as used by APT29 in a campaign against US think tanks
  references:
  - https://cloudblogs.microsoft.com/microsoftsecure/2018/12/03/analysis-of-cyberattack-on-u-s-think-tanks-non-profits-public-sector-by-unidentified-attackers/
  tags:
  - attack.execution
  - attack.g0016
  - attack.t1086
  author: Florian Roth
  date: 2018/12/04
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      CommandLine: '*-noni -ep bypass $*'
    condition: selection
  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:*\-noni\ \-ep\ bypass\ $*')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()