Suspicious Double Extension

Detects suspicious use of an .exe extension after a non-executable file extension like .pdf.exe, a set of spaces or underlines to cloak the executable file in spear phishing campaigns

Rule Content

- title: Suspicious Double Extension
  id: 1cdd9a09-06c9-4769-99ff-626e2b3991b8
  description: Detects suspicious use of an .exe extension after a non-executable
    file extension like .pdf.exe, a set of spaces or underlines to cloak the executable
    file in spear phishing campaigns
  references:
  - https://blu3-team.blogspot.com/2019/06/misleading-extensions-xlsexe-docexe.html
  - https://twitter.com/blackorbird/status/1140519090961825792
  author: Florian Roth (rule), @blu3_team (idea)
  date: 2019/06/26
  tags:
  - attack.initial_access
  - attack.t1193
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      Image:
      - '*.doc.exe'
      - '*.docx.exe'
      - '*.xls.exe'
      - '*.xlsx.exe'
      - '*.ppt.exe'
      - '*.pptx.exe'
      - '*.rtf.exe'
      - '*.pdf.exe'
      - '*.txt.exe'
      - '*      .exe'
      - '*______.exe'
    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_path.keyword:(*.doc.exe OR *.docx.exe OR *.xls.exe OR *.xlsx.exe OR *.ppt.exe OR *.pptx.exe OR *.rtf.exe OR *.pdf.exe OR *.txt.exe OR *\ \ \ \ \ \ .exe OR *______.exe)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()