IIS Native-Code Module Command Line Installation

Detects suspicious IIS native-code module installations via command line

Rule Content

- title: IIS Native-Code Module Command Line Installation
  id: 9465ddf4-f9e4-4ebd-8d98-702df3a93239
  description: Detects suspicious IIS native-code module installations via command
    line
  status: experimental
  references:
  - https://researchcenter.paloaltonetworks.com/2018/01/unit42-oilrig-uses-rgdoor-iis-backdoor-targets-middle-east/
  author: Florian Roth
  modified: 2012/12/11
  tags:
  - attack.persistence
  - attack.t1100
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      CommandLine:
      - '*\APPCMD.EXE install module /name:*'
    condition: selection
  falsepositives:
  - Unknown as it may vary from organisation to arganisation how admins use to install
    IIS modules
  level: medium

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:(*\\APPCMD.EXE\ install\ module\ \/name\:*)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()