Sofacy Trojan Loader Activity

Detects Trojan loader acitivty as used by APT28

Rule Content

- title: Sofacy Trojan Loader Activity
  id: ba778144-5e3d-40cf-8af9-e28fb1df1e20
  author: Florian Roth
  status: experimental
  description: Detects Trojan loader acitivty as used by APT28
  references:
  - https://researchcenter.paloaltonetworks.com/2018/02/unit42-sofacy-attacks-multiple-government-entities/
  - https://www.reverse.it/sample/e3399d4802f9e6d6d539e3ae57e7ea9a54610a7c4155a6541df8e94d67af086e?environmentId=100
  - https://twitter.com/ClearskySec/status/960924755355369472
  tags:
  - attack.g0007
  - attack.execution
  - attack.t1059
  - attack.defense_evasion
  - attack.t1085
  - car.2013-10-002
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      CommandLine:
      - rundll32.exe %APPDATA%\\*.dat",*
      - rundll32.exe %APPDATA%\\*.dll",#1
    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:(rundll32.exe\ %APPDATA%\\*.dat\",* OR rundll32.exe\ %APPDATA%\\*.dll\",#1)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()