Microsoft Office Product Spawning Windows Shell

Detects a Windows command line executable started from Microsoft Word, Excel, Powerpoint, Publisher and Visio.

Rule Content

- title: Microsoft Office Product Spawning Windows Shell
  id: 438025f9-5856-4663-83f7-52f878a70a50
  status: experimental
  description: Detects a Windows command line executable started from Microsoft Word,
    Excel, Powerpoint, Publisher and Visio.
  references:
  - https://www.hybrid-analysis.com/sample/465aabe132ccb949e75b8ab9c5bda36d80cf2fd503d52b8bad54e295f28bbc21?environmentId=100
  - https://mgreen27.github.io/posts/2018/04/02/DownloadCradle.html
  tags:
  - attack.execution
  - attack.defense_evasion
  - attack.t1059
  - attack.t1202
  - car.2013-02-003
  - car.2014-04-003
  author: Michael Haag, Florian Roth, Markus Neis
  date: 2018/04/06
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      ParentImage:
      - '*\WINWORD.EXE'
      - '*\EXCEL.EXE'
      - '*\POWERPNT.exe'
      - '*\MSPUB.exe'
      - '*\VISIO.exe'
      - '*\OUTLOOK.EXE'
      Image:
      - '*\cmd.exe'
      - '*\powershell.exe'
      - '*\wscript.exe'
      - '*\cscript.exe'
      - '*\sh.exe'
      - '*\bash.exe'
      - '*\scrcons.exe'
      - '*\schtasks.exe'
      - '*\regsvr32.exe'
      - '*\hh.exe'
      - '*\wmic.exe'
      - '*\mshta.exe'
      - '*\rundll32.exe'
      - '*\msiexec.exe'
      - '*\forfiles.exe'
      - '*\scriptrunner.exe'
      - '*\mftrace.exe'
      - '*\AppVLP.exe'
      - '*\svchost.exe'
    condition: selection
  fields:
  - CommandLine
  - ParentCommandLine
  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='(process_parent_path.keyword:(*\\WINWORD.EXE OR *\\EXCEL.EXE OR *\\POWERPNT.exe OR *\\MSPUB.exe OR *\\VISIO.exe OR *\\OUTLOOK.EXE) AND process_path.keyword:(*\\cmd.exe OR *\\powershell.exe OR *\\wscript.exe OR *\\cscript.exe OR *\\sh.exe OR *\\bash.exe OR *\\scrcons.exe OR *\\schtasks.exe OR *\\regsvr32.exe OR *\\hh.exe OR *\\wmic.exe OR *\\mshta.exe OR *\\rundll32.exe OR *\\msiexec.exe OR *\\forfiles.exe OR *\\scriptrunner.exe OR *\\mftrace.exe OR *\\AppVLP.exe OR *\\svchost.exe))')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()