StoneDrill Service Install

This method detects a service install of the malicious Microsoft Network Realtime Inspection Service service described in StoneDrill report by Kaspersky

Rule Content

- title: StoneDrill Service Install
  id: 9e987c6c-4c1e-40d8-bd85-dd26fba8fdd6
  description: This method detects a service install of the malicious Microsoft Network
    Realtime Inspection Service service described in StoneDrill report by Kaspersky
  author: Florian Roth
  references:
  - https://securelist.com/blog/research/77725/from-shamoon-to-stonedrill/
  tags:
  - attack.persistence
  - attack.g0064
  - attack.t1050
  logsource:
    product: windows
    service: system
    category: null
  detection:
    selection:
      EventID: 7045
      ServiceName: NtsSrv
      ServiceFileName: '* LocalService'
    condition: selection
  falsepositives:
  - Unlikely
  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-endpoint-winevent-system-*', doc_type='doc')

Run Elasticsearch Query


In [ ]:
s = searchContext.query('query_string', query='(event_id:"7045" AND service_name:"NtsSrv" AND service_image_path.keyword:*\ LocalService)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()