Detection rules › Sublime MQL

Encrypted Microsoft Office files from untrusted sender

Severity
medium
Type
rule
Source
github.com/sublime-security/sublime-rules

Detects encrypted Microsoft Office document attachments (Word, Excel, PowerPoint, Access) from untrusted senders or high-trust senders failing DMARC authentication, which may indicate an effort to bypass security scanning.

Threat classification

Sublime's own taxonomy (not MITRE ATT&CK).

CategoryValues
Attack typesBEC/Fraud, Callback Phishing, Credential Phishing, Extortion, Malware/Ransomware, Spam
Tactics and techniquesEncryption, Evasion

Event coverage

Rule body MQL

type.inbound
and any(attachments,
        (
          // Word documents
          strings.iends_with(.file_name, ".doc")
          or strings.iends_with(.file_name, ".docx")
          or strings.iends_with(.file_name, ".docm")
          or .content_type == "application/msword"
          or .content_type == "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
          or .file_type in ("doc", "docx")
          or 

          // Excel documents
          strings.iends_with(.file_name, ".xls")
          or strings.iends_with(.file_name, ".xlsx")
          or strings.iends_with(.file_name, ".xlsm")
          or .content_type == "application/vnd.ms-excel"
          or .content_type == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
          or .file_type in ("xls", "xlsx")
          or 

          // PowerPoint documents
          strings.iends_with(.file_name, ".ppt")
          or strings.iends_with(.file_name, ".pptx")
          or strings.iends_with(.file_name, ".pptm")
          or .content_type == "application/vnd.ms-powerpoint"
          or .content_type == "application/vnd.openxmlformats-officedocument.presentationml.presentation"
          or .file_type in ("ppt", "pptx")
          or 

          // Access documents
          strings.iends_with(.file_name, ".accdb")
          or strings.iends_with(.file_name, ".mdb")
          or .content_type == "application/msaccess"
          or .content_type == "application/x-msaccess"
          or .content_type == "application/vnd.ms-access"
        )
        and any(file.explode(.),
                any(.scan.yara.matches, .name == 'aes_encryption_keywords')
        )
)
// Negating high-trust sender domains unless they fail DMARC authentication
and (
  (
    sender.email.domain.root_domain in $high_trust_sender_root_domains
    and (
      any(distinct(headers.hops, .authentication_results.dmarc is not null),
          strings.ilike(.authentication_results.dmarc, "*fail")
      )
    )
  )
  or sender.email.domain.root_domain not in $high_trust_sender_root_domains
)

Detection logic

Scope: inbound message.

Detects encrypted Microsoft Office document attachments (Word, Excel, PowerPoint, Access) from untrusted senders or high-trust senders failing DMARC authentication, which may indicate an effort to bypass security scanning.

  1. inbound message
  2. any of attachments where all hold:
    • any of:
      • .file_name ends with '.doc'
      • .file_name ends with '.docx'
      • .file_name ends with '.docm'
      • .content_type is 'application/msword'
      • .content_type is 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
      • .file_type in ('doc', 'docx')
      • .file_name ends with '.xls'
      • .file_name ends with '.xlsx'
      • .file_name ends with '.xlsm'
      • .content_type is 'application/vnd.ms-excel'
      • .content_type is 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
      • .file_type in ('xls', 'xlsx')
      • .file_name ends with '.ppt'
      • .file_name ends with '.pptx'
      • .file_name ends with '.pptm'
      • .content_type is 'application/vnd.ms-powerpoint'
      • .content_type is 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
      • .file_type in ('ppt', 'pptx')
      • .file_name ends with '.accdb'
      • .file_name ends with '.mdb'
      • .content_type is 'application/msaccess'
      • .content_type is 'application/x-msaccess'
      • .content_type is 'application/vnd.ms-access'
    • any of file.explode(.) where:
      • any of .scan.yara.matches where:
        • .name is 'aes_encryption_keywords'
  3. any of:
    • all of:
      • sender.email.domain.root_domain in $high_trust_sender_root_domains
      • any of distinct(headers.hops) where:
        • .authentication_results.dmarc matches '*fail'
    • sender.email.domain.root_domain not in $high_trust_sender_root_domains

Inspects: attachments[].content_type, attachments[].file_name, attachments[].file_type, headers.hops, headers.hops[].authentication_results.dmarc, sender.email.domain.root_domain, type.inbound. Sensors: file.explode, strings.iends_with, strings.ilike. Reference lists: $high_trust_sender_root_domains.

Indicators matched (28)

FieldMatchValue
strings.iends_withsuffix.doc
strings.iends_withsuffix.docx
strings.iends_withsuffix.docm
attachments[].content_typeequalsapplication/msword
attachments[].content_typeequalsapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
attachments[].file_typememberdoc
attachments[].file_typememberdocx
strings.iends_withsuffix.xls
strings.iends_withsuffix.xlsx
strings.iends_withsuffix.xlsm
attachments[].content_typeequalsapplication/vnd.ms-excel
attachments[].content_typeequalsapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet
16 more
attachments[].file_typememberxls
attachments[].file_typememberxlsx
strings.iends_withsuffix.ppt
strings.iends_withsuffix.pptx
strings.iends_withsuffix.pptm
attachments[].content_typeequalsapplication/vnd.ms-powerpoint
attachments[].content_typeequalsapplication/vnd.openxmlformats-officedocument.presentationml.presentation
attachments[].file_typememberppt
attachments[].file_typememberpptx
strings.iends_withsuffix.accdb
strings.iends_withsuffix.mdb
attachments[].content_typeequalsapplication/msaccess
attachments[].content_typeequalsapplication/x-msaccess
attachments[].content_typeequalsapplication/vnd.ms-access
file.explode(attachments[])[].scan.yara.matches[].nameequalsaes_encryption_keywords
strings.ilikesubstring*fail