Malicious payload download via Office binaries

Downloads payload from remote server

Rule Content

- title: Malicious payload download via Office binaries
  id: 0c79148b-118e-472b-bdb7-9b57b444cc19
  status: experimental
  description: Downloads payload from remote server
  references:
  - https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OtherMSBinaries/Powerpnt.yml
  - https://medium.com/@reegun/unsanitized-file-validation-leads-to-malicious-payload-download-via-office-binaries-202d02db7191
  - Reegun J (OCBC Bank)
  author: Beyu Denis, oscd.community
  date: 2019/10/26
  modified: 2019/11/04
  tags:
  - attack.command_and_control
  - attack.t1105
  level: high
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      Image|endswith:
      - \powerpnt.exe
      - \winword.exe
      - \excel.exe
      CommandLine|contains: http
    condition: selection
  falsepositives:
  - Unknown

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_path.keyword:(*\\powerpnt.exe OR *\\winword.exe OR *\\excel.exe) AND process_command_line.keyword:*http*)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()